patent-editor 0.2.4 → 0.2.6
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.d.ts +7 -7
- package/dist/lib.js +845 -833
- 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 It, useState as $, useEffect as M, useCallback as ae, useImperativeHandle as Nt, useRef as W, useMemo as At } from "react";
|
|
6
|
+
import { Extension as Oe, ReactRenderer as kn, Node as Z, mergeAttributes as ie, NodeViewWrapper as _n, ReactNodeViewRenderer as Lt, 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 Pt } 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 Dt, Italic as Rt, Underline as Mt, Strikethrough as Ft, Code as $t, Superscript as zt, Subscript as Ot, 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 Bt, Link2 as Ht, FileText as qt, Box as Mr, Workflow as Fr, FunctionSquare as $r, Sigma as zr, GitGraph as Or, Square as mt, ChevronDown as Ut, Trash2 as Br, Highlighter as Hr, Sparkles as qr, CaseSensitive as Ur, ChevronUp as Wr, Replace as gt, 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 it, 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
|
+
})), Wt = It(
|
|
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 Nt(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
|
+
Wt.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(Wt, {
|
|
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();
|
|
@@ -353,23 +353,23 @@ function Ee(e, t, n) {
|
|
|
353
353
|
const s = o.indexOf(i, c);
|
|
354
354
|
if (s === -1) break;
|
|
355
355
|
let l = 0, d = -1, g = -1;
|
|
356
|
-
e.descendants((u,
|
|
356
|
+
e.descendants((u, f) => {
|
|
357
357
|
if (d !== -1 && g !== -1) return !1;
|
|
358
358
|
if (u.isText) {
|
|
359
|
-
const
|
|
360
|
-
for (let b = 0; b <
|
|
361
|
-
if (l === s && (d =
|
|
362
|
-
return g =
|
|
359
|
+
const p = u.text || "";
|
|
360
|
+
for (let b = 0; b < p.length; b++) {
|
|
361
|
+
if (l === s && (d = f + b), l === s + i.length)
|
|
362
|
+
return g = f + b, !1;
|
|
363
363
|
l++;
|
|
364
364
|
}
|
|
365
|
-
l === s + i.length && g === -1 && (g =
|
|
366
|
-
} else u.isBlock && l > 0 && (l === s && (d =
|
|
365
|
+
l === s + i.length && g === -1 && (g = f + p.length);
|
|
366
|
+
} else u.isBlock && l > 0 && (l === s && (d = f), l++);
|
|
367
367
|
return !0;
|
|
368
368
|
}), d !== -1 && g !== -1 && r.push({ from: d, to: g }), c = s + 1;
|
|
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), ft(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), ft(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 ft(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, pt = 0;
|
|
462
|
+
let Ge = null;
|
|
463
|
+
function ca() {
|
|
464
|
+
return Ge || (Ge = new Pt()), Ge;
|
|
465
465
|
}
|
|
466
|
-
const
|
|
467
|
-
function
|
|
466
|
+
const jt = 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 Gt(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,33 @@ 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
|
+
for (const n of e)
|
|
486
|
+
if (n.textIdx > t)
|
|
487
|
+
return n.docPos;
|
|
488
|
+
if (e.length > 0) {
|
|
489
|
+
const n = e[e.length - 1];
|
|
490
|
+
return n.docPos + n.len;
|
|
491
|
+
}
|
|
485
492
|
return -1;
|
|
486
493
|
}
|
|
487
|
-
function
|
|
488
|
-
const { text: i, segments: o } =
|
|
494
|
+
function ht(e, t, n, r, a) {
|
|
495
|
+
const { text: i, segments: o } = Gt(e, n, r);
|
|
489
496
|
let c = 0;
|
|
490
497
|
for (; c <= i.length - t.length; ) {
|
|
491
498
|
const s = i.indexOf(t, c);
|
|
492
499
|
if (s === -1) return null;
|
|
493
|
-
const l =
|
|
500
|
+
const l = ye(o, s), d = ye(o, s + t.length);
|
|
494
501
|
if (l >= 0 && d >= 0 && !(a && a.has(l)))
|
|
495
502
|
return { from: l, to: d };
|
|
496
503
|
c = s + 1;
|
|
497
504
|
}
|
|
498
505
|
return null;
|
|
499
506
|
}
|
|
500
|
-
function
|
|
507
|
+
function Rs(e, t, n, r, a) {
|
|
501
508
|
const i = t.target;
|
|
502
509
|
let o = null;
|
|
503
510
|
const c = /* @__PURE__ */ new Set();
|
|
@@ -507,15 +514,15 @@ function Ps(e, t, n, r, a) {
|
|
|
507
514
|
if (!i)
|
|
508
515
|
t.from != null && t.to != null && (o = { from: t.from, to: t.to });
|
|
509
516
|
else if (i.type === "section" && i.sectionType)
|
|
510
|
-
o =
|
|
517
|
+
o = la(e, i.sectionType);
|
|
511
518
|
else if (i.type === "ref" && i.refIndex != null) {
|
|
512
519
|
const d = n[i.refIndex];
|
|
513
520
|
(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 =
|
|
521
|
+
} else i.type === "search" && i.searchText && (o = ht(e, i.searchText, 0, e.state.doc.content.size, c));
|
|
515
522
|
if (!o) return null;
|
|
516
523
|
let s = o;
|
|
517
524
|
if (t.search) {
|
|
518
|
-
const d =
|
|
525
|
+
const d = ht(e, t.search, o.from, o.to, c);
|
|
519
526
|
d && (s = d);
|
|
520
527
|
}
|
|
521
528
|
const l = s.from < s.to ? e.state.doc.textBetween(s.from, s.to, " ", "\0") : "";
|
|
@@ -530,72 +537,73 @@ function Ps(e, t, n, r, a) {
|
|
|
530
537
|
status: "pending"
|
|
531
538
|
};
|
|
532
539
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
540
|
+
const j = /* @__PURE__ */ new Map();
|
|
541
|
+
let De = [];
|
|
542
|
+
function Ms(e) {
|
|
543
|
+
return De.push(e), () => {
|
|
544
|
+
De = De.filter((t) => t !== e);
|
|
537
545
|
};
|
|
538
546
|
}
|
|
539
|
-
function
|
|
540
|
-
|
|
547
|
+
function ue() {
|
|
548
|
+
De.forEach((e) => e());
|
|
541
549
|
}
|
|
542
|
-
function
|
|
543
|
-
return [...
|
|
550
|
+
function Fs(e = "default") {
|
|
551
|
+
return [...j.get(e) || []];
|
|
544
552
|
}
|
|
545
|
-
function
|
|
546
|
-
|
|
553
|
+
function $s(e, t = "default") {
|
|
554
|
+
j.set(t, e), ue();
|
|
547
555
|
}
|
|
548
|
-
function
|
|
549
|
-
|
|
556
|
+
function zs(e = "default") {
|
|
557
|
+
j.delete(e), ue();
|
|
550
558
|
}
|
|
551
|
-
function
|
|
552
|
-
const n =
|
|
553
|
-
if (!
|
|
554
|
-
|
|
555
|
-
const { tr:
|
|
556
|
-
if (
|
|
557
|
-
|
|
558
|
-
else if (
|
|
559
|
-
|
|
560
|
-
else if (
|
|
561
|
-
const
|
|
562
|
-
|
|
559
|
+
function Os(e, t, n = "default") {
|
|
560
|
+
const r = j.get(n) || [], a = r.find((c) => c.id === t);
|
|
561
|
+
if (!a || a.status !== "pending") return !1;
|
|
562
|
+
a.status = "accepted";
|
|
563
|
+
const { tr: i } = e.state;
|
|
564
|
+
if (a.type === "delete")
|
|
565
|
+
i.delete(a.from, a.to);
|
|
566
|
+
else if (a.type === "insert")
|
|
567
|
+
i.insertText(a.content, a.from);
|
|
568
|
+
else if (Vt(e, a.from, a.to)) {
|
|
569
|
+
const s = Jt(e, a.content);
|
|
570
|
+
i.replaceWith(a.from, a.to, s);
|
|
563
571
|
} else
|
|
564
|
-
|
|
565
|
-
e.view.dispatch(
|
|
566
|
-
const
|
|
567
|
-
for (const
|
|
568
|
-
if (
|
|
569
|
-
const
|
|
570
|
-
|
|
572
|
+
i.insertText(a.content, a.from, a.to);
|
|
573
|
+
e.view.dispatch(i);
|
|
574
|
+
const o = i.mapping;
|
|
575
|
+
for (const c of r) {
|
|
576
|
+
if (c.id === t || c.status !== "pending") continue;
|
|
577
|
+
const s = o.map(c.from, 1), l = o.map(c.to, -1);
|
|
578
|
+
s >= l && c.type !== "insert" ? c.status = "rejected" : (c.from = s, c.to = c.type === "insert" ? s : l);
|
|
571
579
|
}
|
|
572
|
-
return
|
|
580
|
+
return j.set(n, r.filter((c) => c.id !== t && c.status === "pending")), Ue(e), ue(), !0;
|
|
573
581
|
}
|
|
574
|
-
function
|
|
575
|
-
const n =
|
|
576
|
-
return !
|
|
582
|
+
function Bs(e, t, n = "default") {
|
|
583
|
+
const r = j.get(n) || [], a = r.find((i) => i.id === t);
|
|
584
|
+
return !a || a.status !== "pending" ? !1 : (a.status = "rejected", j.set(n, r.filter((i) => i.id !== t)), Ue(e), ue(), !0);
|
|
577
585
|
}
|
|
578
|
-
function
|
|
579
|
-
const
|
|
580
|
-
for (const
|
|
581
|
-
if (
|
|
582
|
-
|
|
583
|
-
else if (
|
|
584
|
-
|
|
585
|
-
else if (
|
|
586
|
-
const
|
|
587
|
-
|
|
586
|
+
function Hs(e, t = "default") {
|
|
587
|
+
const a = [...(j.get(t) || []).filter((o) => o.status === "pending")].sort((o, c) => c.from - o.from), { tr: i } = e.state;
|
|
588
|
+
for (const o of a)
|
|
589
|
+
if (o.type === "delete")
|
|
590
|
+
i.delete(o.from, o.to);
|
|
591
|
+
else if (o.type === "insert")
|
|
592
|
+
i.insertText(o.content, o.from);
|
|
593
|
+
else if (Vt(e, o.from, o.to)) {
|
|
594
|
+
const s = Jt(e, o.content);
|
|
595
|
+
i.replaceWith(o.from, o.to, s);
|
|
588
596
|
} else
|
|
589
|
-
|
|
590
|
-
e.view.dispatch(
|
|
597
|
+
i.insertText(o.content, o.from, o.to);
|
|
598
|
+
e.view.dispatch(i), j.delete(t), Ue(e), ue();
|
|
591
599
|
}
|
|
592
|
-
function
|
|
593
|
-
|
|
600
|
+
function qs(e, t = "default") {
|
|
601
|
+
j.delete(t), Ue(e), ue();
|
|
594
602
|
}
|
|
595
|
-
function
|
|
596
|
-
e.view.dispatch(e.state.tr.setMeta(
|
|
603
|
+
function Ue(e) {
|
|
604
|
+
e.view.dispatch(e.state.tr.setMeta(jt, !0));
|
|
597
605
|
}
|
|
598
|
-
function
|
|
606
|
+
function da(e, t, n) {
|
|
599
607
|
const r = [];
|
|
600
608
|
return e.nodesBetween(t, n, (a, i) => {
|
|
601
609
|
if (a.isTextblock) {
|
|
@@ -605,7 +613,7 @@ function ca(e, t, n) {
|
|
|
605
613
|
return !0;
|
|
606
614
|
}), r;
|
|
607
615
|
}
|
|
608
|
-
function
|
|
616
|
+
function ua(e, t) {
|
|
609
617
|
if (!t.originalText || !t.content) return null;
|
|
610
618
|
try {
|
|
611
619
|
const c = e.resolve(t.from), s = e.resolve(t.to);
|
|
@@ -613,16 +621,16 @@ function la(e, t) {
|
|
|
613
621
|
} catch {
|
|
614
622
|
return null;
|
|
615
623
|
}
|
|
616
|
-
const n =
|
|
624
|
+
const n = ca(), r = n.diff_main(t.originalText, t.content);
|
|
617
625
|
n.diff_cleanupSemantic(r);
|
|
618
|
-
const a = r.filter(([c]) => c ===
|
|
626
|
+
const a = r.filter(([c]) => c === pt).reduce((c, [, s]) => c + s.length, 0);
|
|
619
627
|
if (t.originalText.length > 0 && a / t.originalText.length < 0.3) return null;
|
|
620
628
|
const i = [];
|
|
621
629
|
let o = t.from;
|
|
622
630
|
for (const [c, s] of r)
|
|
623
|
-
if (c ===
|
|
631
|
+
if (c === pt)
|
|
624
632
|
o += s.length;
|
|
625
|
-
else if (c ===
|
|
633
|
+
else if (c === sa) {
|
|
626
634
|
const l = o + s.length;
|
|
627
635
|
i.push(
|
|
628
636
|
re.inline(o, l, {
|
|
@@ -630,7 +638,7 @@ function la(e, t) {
|
|
|
630
638
|
"data-patch-id": t.id
|
|
631
639
|
})
|
|
632
640
|
), o = l;
|
|
633
|
-
} else c ===
|
|
641
|
+
} else c === oa && i.push(
|
|
634
642
|
re.widget(o, () => {
|
|
635
643
|
const l = document.createElement("span");
|
|
636
644
|
return l.className = "patch-diff-insert-inline", l.textContent = s, l.setAttribute("data-patch-id", t.id), l;
|
|
@@ -638,60 +646,60 @@ function la(e, t) {
|
|
|
638
646
|
);
|
|
639
647
|
return i;
|
|
640
648
|
}
|
|
641
|
-
function
|
|
642
|
-
return new
|
|
643
|
-
key:
|
|
649
|
+
function ma(e = "default") {
|
|
650
|
+
return new Be({
|
|
651
|
+
key: jt,
|
|
644
652
|
props: {
|
|
645
|
-
decorations(
|
|
646
|
-
const
|
|
647
|
-
if (
|
|
648
|
-
const
|
|
649
|
-
for (const
|
|
650
|
-
if (
|
|
651
|
-
const
|
|
652
|
-
if (
|
|
653
|
-
|
|
653
|
+
decorations(t) {
|
|
654
|
+
const n = (j.get(e) || []).filter((a) => a.status === "pending");
|
|
655
|
+
if (n.length === 0) return be.empty;
|
|
656
|
+
const r = [];
|
|
657
|
+
for (const a of n) {
|
|
658
|
+
if (a.type === "replace") {
|
|
659
|
+
const i = ua(t.doc, a);
|
|
660
|
+
if (i) {
|
|
661
|
+
r.push(...i);
|
|
654
662
|
continue;
|
|
655
663
|
}
|
|
656
664
|
}
|
|
657
|
-
if (
|
|
658
|
-
const
|
|
659
|
-
for (const
|
|
660
|
-
|
|
661
|
-
re.inline(
|
|
665
|
+
if (a.type === "delete" || a.type === "replace") {
|
|
666
|
+
const i = da(t.doc, a.from, a.to);
|
|
667
|
+
for (const o of i)
|
|
668
|
+
r.push(
|
|
669
|
+
re.inline(o.from, o.to, {
|
|
662
670
|
class: "patch-diff-delete",
|
|
663
|
-
"data-patch-id":
|
|
671
|
+
"data-patch-id": a.id
|
|
664
672
|
})
|
|
665
673
|
);
|
|
666
|
-
if (
|
|
667
|
-
const
|
|
674
|
+
if (a.type === "replace") {
|
|
675
|
+
const o = i.length > 0 ? i[i.length - 1].to : a.to, c = a.content.length > 120 || a.content.includes(`
|
|
668
676
|
`);
|
|
669
|
-
|
|
670
|
-
re.widget(
|
|
671
|
-
const
|
|
672
|
-
return
|
|
677
|
+
r.push(
|
|
678
|
+
re.widget(o, () => {
|
|
679
|
+
const s = document.createElement(c ? "div" : "span");
|
|
680
|
+
return s.className = c ? "patch-diff-insert-inline patch-diff-insert-block" : "patch-diff-insert-inline", s.textContent = a.content, s.setAttribute("data-patch-id", a.id), s;
|
|
673
681
|
}, { side: 1 })
|
|
674
682
|
);
|
|
675
683
|
}
|
|
676
684
|
} else
|
|
677
|
-
|
|
678
|
-
re.widget(
|
|
679
|
-
const
|
|
680
|
-
return
|
|
685
|
+
r.push(
|
|
686
|
+
re.widget(a.from, () => {
|
|
687
|
+
const i = document.createElement("span");
|
|
688
|
+
return i.className = "patch-diff-insert-inline", i.textContent = a.content, i.setAttribute("data-patch-id", a.id), i;
|
|
681
689
|
})
|
|
682
690
|
);
|
|
683
691
|
}
|
|
684
|
-
return
|
|
692
|
+
return be.create(t.doc, r);
|
|
685
693
|
}
|
|
686
694
|
}
|
|
687
695
|
});
|
|
688
696
|
}
|
|
689
|
-
function
|
|
697
|
+
function Vt(e, t, n) {
|
|
690
698
|
var i;
|
|
691
699
|
const r = e.state.doc.resolve(t);
|
|
692
700
|
return !!((i = r.parent.type.spec.content) != null && i.includes("block") && t === r.start() && n === r.end());
|
|
693
701
|
}
|
|
694
|
-
function
|
|
702
|
+
function Jt(e, t) {
|
|
695
703
|
const n = e.state.schema;
|
|
696
704
|
return t.split(/\n\n+/).filter((a) => a.trim().length > 0).map((a) => {
|
|
697
705
|
const i = a.replace(/\n/g, " ").trim();
|
|
@@ -701,7 +709,7 @@ function jt(e, t) {
|
|
|
701
709
|
);
|
|
702
710
|
});
|
|
703
711
|
}
|
|
704
|
-
const
|
|
712
|
+
const ga = Z.create({
|
|
705
713
|
name: "hardBreak",
|
|
706
714
|
inline: !0,
|
|
707
715
|
group: "inline",
|
|
@@ -722,40 +730,40 @@ const ua = Z.create({
|
|
|
722
730
|
}
|
|
723
731
|
};
|
|
724
732
|
}
|
|
725
|
-
}),
|
|
733
|
+
}), fa = Oe.create({
|
|
726
734
|
name: "dragDropUX",
|
|
727
735
|
addProseMirrorPlugins() {
|
|
728
736
|
return [
|
|
729
|
-
|
|
737
|
+
Kn({
|
|
730
738
|
width: 3,
|
|
731
739
|
color: "#2563eb"
|
|
732
740
|
}),
|
|
733
|
-
|
|
741
|
+
Xn()
|
|
734
742
|
];
|
|
735
743
|
}
|
|
736
|
-
}),
|
|
744
|
+
}), pa = Oe.create({
|
|
737
745
|
name: "patchDiff",
|
|
738
746
|
addProseMirrorPlugins() {
|
|
739
|
-
return [
|
|
747
|
+
return [ma()];
|
|
740
748
|
}
|
|
741
|
-
}),
|
|
742
|
-
In,
|
|
743
|
-
Nn,
|
|
749
|
+
}), ha = [
|
|
744
750
|
An,
|
|
745
|
-
|
|
746
|
-
|
|
751
|
+
Ln,
|
|
752
|
+
Pn,
|
|
753
|
+
fa,
|
|
754
|
+
Dn.configure({
|
|
747
755
|
levels: [1, 2, 3, 4, 5, 6]
|
|
748
756
|
}),
|
|
749
|
-
Pn,
|
|
750
|
-
Dn,
|
|
751
757
|
Rn,
|
|
752
758
|
Mn,
|
|
753
759
|
Fn,
|
|
754
|
-
ua,
|
|
755
760
|
$n,
|
|
756
761
|
zn,
|
|
757
|
-
|
|
758
|
-
|
|
762
|
+
ga,
|
|
763
|
+
On,
|
|
764
|
+
Bn,
|
|
765
|
+
Hn.configure({ nested: !0 }),
|
|
766
|
+
qn.extend({
|
|
759
767
|
addAttributes() {
|
|
760
768
|
var e;
|
|
761
769
|
return {
|
|
@@ -771,46 +779,46 @@ const ua = Z.create({
|
|
|
771
779
|
inline: !0,
|
|
772
780
|
allowBase64: !0
|
|
773
781
|
}),
|
|
774
|
-
|
|
782
|
+
Un.configure({
|
|
775
783
|
resizable: !0
|
|
776
784
|
}),
|
|
777
|
-
qn,
|
|
778
|
-
Un,
|
|
779
785
|
Wn,
|
|
780
|
-
jn
|
|
786
|
+
jn,
|
|
787
|
+
Gn,
|
|
788
|
+
Vn.configure({
|
|
781
789
|
placeholder: ({ node: e }) => e.type.name === "heading" ? "Heading" : "Type / for commands..."
|
|
782
790
|
}),
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
suggestion:
|
|
791
|
+
Jn,
|
|
792
|
+
ea.configure({
|
|
793
|
+
suggestion: ra()
|
|
786
794
|
}),
|
|
787
|
-
|
|
788
|
-
|
|
795
|
+
ia,
|
|
796
|
+
Yn.configure({
|
|
789
797
|
types: ["heading", "paragraph"],
|
|
790
798
|
defaultAlignment: "left"
|
|
791
799
|
}),
|
|
792
|
-
|
|
793
|
-
],
|
|
794
|
-
er,
|
|
795
|
-
tr,
|
|
800
|
+
pa
|
|
801
|
+
], ya = [
|
|
796
802
|
nr,
|
|
797
803
|
rr,
|
|
798
804
|
ar,
|
|
799
805
|
ir,
|
|
800
806
|
sr,
|
|
801
|
-
or
|
|
807
|
+
or,
|
|
808
|
+
cr,
|
|
809
|
+
lr.configure({
|
|
802
810
|
openOnClick: !1
|
|
803
811
|
}),
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
],
|
|
808
|
-
...
|
|
809
|
-
...
|
|
812
|
+
dr,
|
|
813
|
+
ur,
|
|
814
|
+
mr.configure({ multicolor: !0 })
|
|
815
|
+
], ba = [
|
|
816
|
+
...ha,
|
|
817
|
+
...ya
|
|
810
818
|
];
|
|
811
|
-
class
|
|
819
|
+
class va {
|
|
812
820
|
constructor() {
|
|
813
|
-
|
|
821
|
+
Se(this, "commands", /* @__PURE__ */ new Map());
|
|
814
822
|
}
|
|
815
823
|
normalizeCommand(t) {
|
|
816
824
|
return typeof t == "function" ? {
|
|
@@ -833,7 +841,7 @@ class ya {
|
|
|
833
841
|
return !r || !r.isActive ? !1 : r.isActive(n);
|
|
834
842
|
}
|
|
835
843
|
async execute(t, n, r, a = {}) {
|
|
836
|
-
var d, g, u,
|
|
844
|
+
var d, g, u, f;
|
|
837
845
|
const i = Date.now(), o = a.transaction ?? !0, c = a.rollbackOnFail ?? !0, s = o ? n.editor.getJSON() : null, l = this.commands.get(t);
|
|
838
846
|
if (!l)
|
|
839
847
|
return console.warn(`Command "${t}" not found.`), (d = a.onComplete) == null || d.call(a, {
|
|
@@ -856,15 +864,15 @@ class ya {
|
|
|
856
864
|
durationMs: Date.now() - i
|
|
857
865
|
};
|
|
858
866
|
return (u = a.onComplete) == null || u.call(a, h), b;
|
|
859
|
-
} catch (
|
|
867
|
+
} catch (p) {
|
|
860
868
|
s && c && n.editor.commands.setContent(s);
|
|
861
869
|
const b = {
|
|
862
870
|
name: t,
|
|
863
871
|
success: !1,
|
|
864
872
|
durationMs: Date.now() - i,
|
|
865
|
-
error:
|
|
873
|
+
error: p
|
|
866
874
|
};
|
|
867
|
-
return (
|
|
875
|
+
return (f = a.onComplete) == null || f.call(a, b), !1;
|
|
868
876
|
}
|
|
869
877
|
}
|
|
870
878
|
getCommand(t) {
|
|
@@ -874,11 +882,11 @@ class ya {
|
|
|
874
882
|
return Array.from(this.commands.keys()).sort();
|
|
875
883
|
}
|
|
876
884
|
}
|
|
877
|
-
const le = new
|
|
878
|
-
class
|
|
885
|
+
const le = new va();
|
|
886
|
+
class wa {
|
|
879
887
|
constructor() {
|
|
880
|
-
|
|
881
|
-
|
|
888
|
+
Se(this, "plugins", /* @__PURE__ */ new Map());
|
|
889
|
+
Se(this, "lifecycleOrder", ["register", "init", "stateSync", "destroy"]);
|
|
882
890
|
}
|
|
883
891
|
logLifecycle(t, n) {
|
|
884
892
|
t !== "stateSync" && console.info(`[PluginManager:${t}] ${n}`);
|
|
@@ -960,7 +968,7 @@ class ba {
|
|
|
960
968
|
});
|
|
961
969
|
}
|
|
962
970
|
}
|
|
963
|
-
const B = new
|
|
971
|
+
const B = new wa(), yt = {
|
|
964
972
|
zh: {
|
|
965
973
|
language: "语言",
|
|
966
974
|
bold: "加粗",
|
|
@@ -1207,13 +1215,13 @@ const B = new ba(), ft = {
|
|
|
1207
1215
|
insertMathBlock: "Insert math block",
|
|
1208
1216
|
insertDrawioDiagram: "Insert Draw.io diagram"
|
|
1209
1217
|
}
|
|
1210
|
-
},
|
|
1211
|
-
let
|
|
1212
|
-
const
|
|
1218
|
+
}, H = (e) => e === "en" ? yt.en : yt.zh;
|
|
1219
|
+
let _e = 0;
|
|
1220
|
+
const Ie = () => {
|
|
1213
1221
|
document.querySelectorAll('body > svg[id^="standalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
|
|
1214
1222
|
(e.id.startsWith("dmermaid") || e.id.startsWith("dstandalone")) && e.remove();
|
|
1215
1223
|
}), 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
|
-
},
|
|
1224
|
+
}, xa = Z.create({
|
|
1217
1225
|
name: "mermaid",
|
|
1218
1226
|
group: "block",
|
|
1219
1227
|
atom: !0,
|
|
@@ -1247,10 +1255,10 @@ const _e = () => {
|
|
|
1247
1255
|
g.className = "mermaid-edit-toolbar";
|
|
1248
1256
|
const u = document.createElement("span");
|
|
1249
1257
|
u.className = "mermaid-error-msg";
|
|
1250
|
-
const p = document.createElement("button");
|
|
1251
|
-
p.className = "mermaid-cancel-btn", p.type = "button";
|
|
1252
1258
|
const f = document.createElement("button");
|
|
1253
|
-
f.className = "mermaid-
|
|
1259
|
+
f.className = "mermaid-cancel-btn", f.type = "button";
|
|
1260
|
+
const p = document.createElement("button");
|
|
1261
|
+
p.className = "mermaid-save-btn", p.type = "button", g.append(u, f, p), l.append(d, g), i.append(o, l);
|
|
1254
1262
|
const b = (C) => {
|
|
1255
1263
|
const N = typeof n == "function" ? n() : null;
|
|
1256
1264
|
typeof N == "number" && e.commands.command(({ tr: A, dispatch: D }) => (A.setNodeMarkup(N, void 0, { ...r.attrs, ...C }), D && D(A), !0));
|
|
@@ -1265,13 +1273,13 @@ const _e = () => {
|
|
|
1265
1273
|
}
|
|
1266
1274
|
try {
|
|
1267
1275
|
const A = await import("mermaid");
|
|
1268
|
-
A.default.initialize({ startOnLoad: !1, theme: "default" }),
|
|
1269
|
-
const D = `standalone-mermaid-${
|
|
1276
|
+
A.default.initialize({ startOnLoad: !1, theme: "default" }), _e += 1;
|
|
1277
|
+
const D = `standalone-mermaid-${_e}`, { svg: z } = await A.default.render(D, N);
|
|
1270
1278
|
c.innerHTML = z, h = N;
|
|
1271
1279
|
} catch {
|
|
1272
1280
|
c.innerHTML = "", h = "";
|
|
1273
1281
|
} finally {
|
|
1274
|
-
|
|
1282
|
+
Ie();
|
|
1275
1283
|
}
|
|
1276
1284
|
}
|
|
1277
1285
|
}, E = () => {
|
|
@@ -1285,11 +1293,11 @@ const _e = () => {
|
|
|
1285
1293
|
if (N)
|
|
1286
1294
|
try {
|
|
1287
1295
|
const A = await import("mermaid");
|
|
1288
|
-
A.default.initialize({ startOnLoad: !1, theme: "default" }),
|
|
1289
|
-
const D = `standalone-mermaid-${
|
|
1290
|
-
c.innerHTML = z, h = N,
|
|
1296
|
+
A.default.initialize({ startOnLoad: !1, theme: "default" }), _e += 1;
|
|
1297
|
+
const D = `standalone-mermaid-${_e}`, { svg: z } = await A.default.render(D, N);
|
|
1298
|
+
c.innerHTML = z, h = N, Ie();
|
|
1291
1299
|
} catch {
|
|
1292
|
-
|
|
1300
|
+
Ie();
|
|
1293
1301
|
const A = I.getState().editorLanguage;
|
|
1294
1302
|
u.textContent = A === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", u.style.display = "inline";
|
|
1295
1303
|
return;
|
|
@@ -1298,14 +1306,14 @@ const _e = () => {
|
|
|
1298
1306
|
};
|
|
1299
1307
|
o.addEventListener("dblclick", (C) => {
|
|
1300
1308
|
C.preventDefault(), C.stopPropagation(), E();
|
|
1301
|
-
}), f.addEventListener("click", (C) => {
|
|
1302
|
-
C.stopPropagation(), w();
|
|
1303
1309
|
}), p.addEventListener("click", (C) => {
|
|
1310
|
+
C.stopPropagation(), w();
|
|
1311
|
+
}), f.addEventListener("click", (C) => {
|
|
1304
1312
|
C.stopPropagation(), x();
|
|
1305
1313
|
}), d.addEventListener("mousedown", (C) => C.stopPropagation()), d.addEventListener("keydown", (C) => C.stopPropagation()), d.addEventListener("keypress", (C) => C.stopPropagation());
|
|
1306
1314
|
const T = () => {
|
|
1307
|
-
const C = I.getState().editorLanguage, N =
|
|
1308
|
-
o.style.display = a ? "none" : "block", l.style.display = a ? "block" : "none",
|
|
1315
|
+
const C = I.getState().editorLanguage, N = H(C), A = typeof r.attrs.code == "string" ? r.attrs.code : "";
|
|
1316
|
+
o.style.display = a ? "none" : "block", l.style.display = a ? "block" : "none", p.textContent = N.mermaidSaveAndRender || "保存并渲染", f.textContent = N.mermaidCancel || "取消";
|
|
1309
1317
|
const D = A.trim().length > 0, z = c.querySelector("svg") !== null;
|
|
1310
1318
|
a || (D && z ? (s.textContent = N.mermaidDoubleClickToEdit || "双击编辑", s.className = "mermaid-view-hint mermaid-view-hint--subtle") : (s.textContent = N.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", s.className = "mermaid-view-hint mermaid-view-hint--empty")), !a && A.trim() !== h && y(A);
|
|
1311
1319
|
};
|
|
@@ -1322,15 +1330,15 @@ const _e = () => {
|
|
|
1322
1330
|
ignoreMutation: () => !0,
|
|
1323
1331
|
update: (C) => C.type.name !== "mermaid" ? !1 : (r = C, T(), !0),
|
|
1324
1332
|
destroy: () => {
|
|
1325
|
-
_(),
|
|
1333
|
+
_(), Ie();
|
|
1326
1334
|
}
|
|
1327
1335
|
};
|
|
1328
1336
|
};
|
|
1329
1337
|
}
|
|
1330
|
-
}),
|
|
1338
|
+
}), Ca = {
|
|
1331
1339
|
name: "mermaid",
|
|
1332
1340
|
version: "1.0.0",
|
|
1333
|
-
extensions: [
|
|
1341
|
+
extensions: [xa],
|
|
1334
1342
|
toolbarItems: [
|
|
1335
1343
|
{
|
|
1336
1344
|
id: "mermaid-insert",
|
|
@@ -1355,7 +1363,7 @@ const _e = () => {
|
|
|
1355
1363
|
}
|
|
1356
1364
|
}
|
|
1357
1365
|
}
|
|
1358
|
-
},
|
|
1366
|
+
}, Ve = "https://draw.goatpatent.com", Ta = Z.create({
|
|
1359
1367
|
name: "drawio",
|
|
1360
1368
|
group: "block",
|
|
1361
1369
|
atom: !0,
|
|
@@ -1387,7 +1395,7 @@ const _e = () => {
|
|
|
1387
1395
|
typeof x == "number" && e.commands.command(({ tr: w, dispatch: T }) => (w.setNodeMarkup(x, void 0, { ...r.attrs, ...E }), T && T(w), !0));
|
|
1388
1396
|
};
|
|
1389
1397
|
let d = null, g = null, u = null;
|
|
1390
|
-
const
|
|
1398
|
+
const f = () => {
|
|
1391
1399
|
if (a) return;
|
|
1392
1400
|
a = !0, g = document.createElement("div"), g.className = "drawio-modal-overlay";
|
|
1393
1401
|
const E = document.createElement("div");
|
|
@@ -1397,9 +1405,9 @@ const _e = () => {
|
|
|
1397
1405
|
const w = I.getState().editorLanguage, T = document.createElement("span");
|
|
1398
1406
|
T.textContent = w === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", T.className = "drawio-modal-title";
|
|
1399
1407
|
const v = document.createElement("button");
|
|
1400
|
-
v.className = "drawio-modal-close-btn", v.textContent = "✕", v.type = "button", v.addEventListener("click", () =>
|
|
1408
|
+
v.className = "drawio-modal-close-btn", v.textContent = "✕", v.type = "button", v.addEventListener("click", () => p()), 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
1409
|
const _ = w === "en" ? "en" : "zh";
|
|
1402
|
-
u.src =
|
|
1410
|
+
u.src = `${Ve}/?embed=1&proto=json&spin=1&lang=${_}`;
|
|
1403
1411
|
const C = u;
|
|
1404
1412
|
d = (N) => {
|
|
1405
1413
|
var D, z;
|
|
@@ -1414,27 +1422,27 @@ const _e = () => {
|
|
|
1414
1422
|
const Q = typeof r.attrs.xml == "string" ? r.attrs.xml : "";
|
|
1415
1423
|
(D = C.contentWindow) == null || D.postMessage(
|
|
1416
1424
|
JSON.stringify({ action: "load", autosave: 0, xml: Q || "" }),
|
|
1417
|
-
|
|
1425
|
+
Ve
|
|
1418
1426
|
);
|
|
1419
1427
|
} else if (A.event === "save") {
|
|
1420
1428
|
const Q = A.xml || "";
|
|
1421
1429
|
(z = C.contentWindow) == null || z.postMessage(
|
|
1422
1430
|
JSON.stringify({ action: "export", format: "svg" }),
|
|
1423
|
-
|
|
1431
|
+
Ve
|
|
1424
1432
|
), l({ xml: Q });
|
|
1425
1433
|
} else if (A.event === "export") {
|
|
1426
1434
|
const Q = A.data || "";
|
|
1427
|
-
l({ svg: Q }),
|
|
1428
|
-
} else A.event === "exit" &&
|
|
1435
|
+
l({ svg: Q }), p();
|
|
1436
|
+
} else A.event === "exit" && p();
|
|
1429
1437
|
}, window.addEventListener("message", d);
|
|
1430
|
-
},
|
|
1438
|
+
}, p = () => {
|
|
1431
1439
|
a = !1, d && (window.removeEventListener("message", d), d = null), u && (u.src = "about:blank", u = null), g && (g.remove(), g = null), b();
|
|
1432
1440
|
};
|
|
1433
1441
|
o.addEventListener("dblclick", (E) => {
|
|
1434
|
-
E.preventDefault(), E.stopPropagation(),
|
|
1442
|
+
E.preventDefault(), E.stopPropagation(), f();
|
|
1435
1443
|
});
|
|
1436
1444
|
const b = () => {
|
|
1437
|
-
const E = I.getState().editorLanguage, x =
|
|
1445
|
+
const E = I.getState().editorLanguage, x = H(E), w = typeof r.attrs.svg == "string" ? r.attrs.svg : "";
|
|
1438
1446
|
w ? (c.src = w, c.style.display = "block") : (c.src = "", c.style.display = "none"), w ? (s.textContent = x.mermaidDoubleClickToEdit || "双击编辑", s.className = "drawio-view-hint drawio-view-hint--subtle") : (s.textContent = x.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", s.className = "drawio-view-hint drawio-view-hint--empty");
|
|
1439
1447
|
};
|
|
1440
1448
|
let h = I.getState().editorLanguage;
|
|
@@ -1451,10 +1459,10 @@ const _e = () => {
|
|
|
1451
1459
|
};
|
|
1452
1460
|
};
|
|
1453
1461
|
}
|
|
1454
|
-
}),
|
|
1462
|
+
}), Sa = {
|
|
1455
1463
|
name: "drawio",
|
|
1456
1464
|
version: "1.0.0",
|
|
1457
|
-
extensions: [
|
|
1465
|
+
extensions: [Ta],
|
|
1458
1466
|
toolbarItems: [
|
|
1459
1467
|
{
|
|
1460
1468
|
id: "drawio-insert",
|
|
@@ -1479,13 +1487,13 @@ const _e = () => {
|
|
|
1479
1487
|
}
|
|
1480
1488
|
}
|
|
1481
1489
|
}
|
|
1482
|
-
},
|
|
1490
|
+
}, Kt = ({
|
|
1483
1491
|
node: e,
|
|
1484
1492
|
updateAttributes: t,
|
|
1485
1493
|
selected: n,
|
|
1486
1494
|
editor: r
|
|
1487
1495
|
}) => {
|
|
1488
|
-
const a =
|
|
1496
|
+
const a = W(null), [i, o] = $(!1), c = e.type.name === "math_block", s = W(!1), l = W(t), d = W(e.attrs.latex ?? "");
|
|
1489
1497
|
M(() => {
|
|
1490
1498
|
l.current = t;
|
|
1491
1499
|
}, [t]), M(() => {
|
|
@@ -1497,23 +1505,23 @@ const _e = () => {
|
|
|
1497
1505
|
var b, h;
|
|
1498
1506
|
if (!s.current) return;
|
|
1499
1507
|
s.current = !1;
|
|
1500
|
-
const
|
|
1501
|
-
l.current({ latex:
|
|
1508
|
+
const p = ((b = a.current) == null ? void 0 : b.value) ?? d.current;
|
|
1509
|
+
l.current({ latex: p }), o(!1), (h = globalThis.mathVirtualKeyboard) == null || h.hide({ animate: !0 });
|
|
1502
1510
|
}, []);
|
|
1503
1511
|
M(() => {
|
|
1504
1512
|
var b, h, y;
|
|
1505
|
-
const
|
|
1506
|
-
n &&
|
|
1513
|
+
const p = !!((y = (h = (b = r == null ? void 0 : r.view) == null ? void 0 : b.state) == null ? void 0 : h.selection) != null && y.empty);
|
|
1514
|
+
n && p && g();
|
|
1507
1515
|
}, [n, g]), M(() => {
|
|
1508
1516
|
i && requestAnimationFrame(() => {
|
|
1509
1517
|
var b;
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1518
|
+
const p = a.current;
|
|
1519
|
+
p && (p.virtualKeyboardMode = "onfocus", (b = p.focus) == null || b.call(p));
|
|
1512
1520
|
});
|
|
1513
1521
|
}, [i]), M(() => {
|
|
1514
1522
|
if (!i) return;
|
|
1515
|
-
const
|
|
1516
|
-
if (!
|
|
1523
|
+
const p = a.current;
|
|
1524
|
+
if (!p) return;
|
|
1517
1525
|
const b = () => {
|
|
1518
1526
|
setTimeout(() => {
|
|
1519
1527
|
var E, x, w;
|
|
@@ -1524,23 +1532,23 @@ const _e = () => {
|
|
|
1524
1532
|
}, h = (y) => {
|
|
1525
1533
|
y.key === "Escape" && u();
|
|
1526
1534
|
};
|
|
1527
|
-
return
|
|
1528
|
-
|
|
1535
|
+
return p.addEventListener("focusout", b), p.addEventListener("keydown", h), () => {
|
|
1536
|
+
p.removeEventListener("focusout", b), p.removeEventListener("keydown", h);
|
|
1529
1537
|
};
|
|
1530
1538
|
}, [i, u]), M(() => {
|
|
1531
1539
|
!i && a.current && a.current.value !== e.attrs.latex && (a.current.value = e.attrs.latex ?? "");
|
|
1532
1540
|
}, [e.attrs.latex, i]);
|
|
1533
|
-
let
|
|
1541
|
+
let f = "";
|
|
1534
1542
|
try {
|
|
1535
|
-
|
|
1543
|
+
f = gr.renderToString(e.attrs.latex || "", {
|
|
1536
1544
|
throwOnError: !1,
|
|
1537
1545
|
displayMode: c
|
|
1538
1546
|
});
|
|
1539
1547
|
} catch {
|
|
1540
|
-
|
|
1548
|
+
f = e.attrs.latex || "";
|
|
1541
1549
|
}
|
|
1542
1550
|
return /* @__PURE__ */ m(
|
|
1543
|
-
|
|
1551
|
+
_n,
|
|
1544
1552
|
{
|
|
1545
1553
|
as: c ? "div" : "span",
|
|
1546
1554
|
className: c ? "math-block" : "math-inline",
|
|
@@ -1552,12 +1560,12 @@ const _e = () => {
|
|
|
1552
1560
|
children: e.attrs.latex
|
|
1553
1561
|
}
|
|
1554
1562
|
) : /* @__PURE__ */ L("span", { className: "math-preview", onClick: g, children: [
|
|
1555
|
-
/* @__PURE__ */ m("span", { dangerouslySetInnerHTML: { __html:
|
|
1563
|
+
/* @__PURE__ */ m("span", { dangerouslySetInnerHTML: { __html: f } }),
|
|
1556
1564
|
/* @__PURE__ */ m("span", { className: "math-tooltip", children: "点击编辑" })
|
|
1557
1565
|
] })
|
|
1558
1566
|
}
|
|
1559
1567
|
);
|
|
1560
|
-
},
|
|
1568
|
+
}, Ea = Z.create({
|
|
1561
1569
|
name: "math_inline",
|
|
1562
1570
|
group: "inline",
|
|
1563
1571
|
inline: !0,
|
|
@@ -1583,14 +1591,14 @@ const _e = () => {
|
|
|
1583
1591
|
return ["span", ie(e, { "data-type": "math_inline" })];
|
|
1584
1592
|
},
|
|
1585
1593
|
addNodeView() {
|
|
1586
|
-
return
|
|
1594
|
+
return Lt(Kt, {
|
|
1587
1595
|
stopEvent: ({ event: e }) => {
|
|
1588
1596
|
const t = e.target;
|
|
1589
1597
|
return t.tagName.toLowerCase() === "math-field" || t.closest("math-field") !== null;
|
|
1590
1598
|
}
|
|
1591
1599
|
});
|
|
1592
1600
|
}
|
|
1593
|
-
}),
|
|
1601
|
+
}), ka = Z.create({
|
|
1594
1602
|
name: "math_block",
|
|
1595
1603
|
group: "block",
|
|
1596
1604
|
atom: !0,
|
|
@@ -1606,17 +1614,17 @@ const _e = () => {
|
|
|
1606
1614
|
return ["div", ie(e, { "data-type": "math_block" })];
|
|
1607
1615
|
},
|
|
1608
1616
|
addNodeView() {
|
|
1609
|
-
return
|
|
1617
|
+
return Lt(Kt, {
|
|
1610
1618
|
stopEvent: ({ event: e }) => {
|
|
1611
1619
|
const t = e.target;
|
|
1612
1620
|
return t.tagName.toLowerCase() === "math-field" || t.closest("math-field") !== null;
|
|
1613
1621
|
}
|
|
1614
1622
|
});
|
|
1615
1623
|
}
|
|
1616
|
-
}),
|
|
1624
|
+
}), _a = {
|
|
1617
1625
|
name: "math",
|
|
1618
1626
|
version: "1.0.0",
|
|
1619
|
-
extensions: [
|
|
1627
|
+
extensions: [Ea, ka],
|
|
1620
1628
|
toolbarItems: [
|
|
1621
1629
|
{
|
|
1622
1630
|
id: "math-inline-insert",
|
|
@@ -1661,14 +1669,14 @@ const _e = () => {
|
|
|
1661
1669
|
}
|
|
1662
1670
|
}
|
|
1663
1671
|
}
|
|
1664
|
-
},
|
|
1672
|
+
}, st = (e, t, n = {}) => {
|
|
1665
1673
|
const r = n.from ?? 0, a = n.to ?? e.state.doc.content.size;
|
|
1666
1674
|
let i = null;
|
|
1667
1675
|
return e.state.doc.nodesBetween(r, a, (o, c) => i ? !1 : o.type.name === t ? (i = { node: o, pos: c }, !1) : !0), i;
|
|
1668
|
-
},
|
|
1676
|
+
}, Xt = (e, t, n = {}) => {
|
|
1669
1677
|
const r = n.from ?? 0, a = n.to ?? e.state.doc.content.size, i = [];
|
|
1670
1678
|
return e.state.doc.nodesBetween(r, a, (o, c) => (t(o, c) && i.push({ node: o, pos: c }), !0)), i;
|
|
1671
|
-
},
|
|
1679
|
+
}, Re = (e, t) => {
|
|
1672
1680
|
const { $from: n } = e.state.selection;
|
|
1673
1681
|
for (let r = n.depth; r >= 0; r -= 1) {
|
|
1674
1682
|
const a = n.node(r);
|
|
@@ -1679,7 +1687,7 @@ const _e = () => {
|
|
|
1679
1687
|
};
|
|
1680
1688
|
}
|
|
1681
1689
|
return null;
|
|
1682
|
-
},
|
|
1690
|
+
}, Ia = (e) => {
|
|
1683
1691
|
const { $from: t } = e.state.selection;
|
|
1684
1692
|
for (let n = t.depth; n >= 0; n -= 1) {
|
|
1685
1693
|
const r = t.node(n);
|
|
@@ -1690,19 +1698,19 @@ const _e = () => {
|
|
|
1690
1698
|
};
|
|
1691
1699
|
}
|
|
1692
1700
|
return null;
|
|
1693
|
-
},
|
|
1701
|
+
}, Na = (e, t) => e.state.schema.nodes[t] || null, Aa = (e) => {
|
|
1694
1702
|
const t = Array.isArray(e.content) ? e.content : e.content ? [e.content] : void 0;
|
|
1695
1703
|
return {
|
|
1696
1704
|
type: e.type,
|
|
1697
1705
|
attrs: e.attrs,
|
|
1698
1706
|
content: t
|
|
1699
1707
|
};
|
|
1700
|
-
},
|
|
1701
|
-
const n =
|
|
1708
|
+
}, Yt = (e, t) => {
|
|
1709
|
+
const n = Aa(t);
|
|
1702
1710
|
return typeof t.position == "number" ? e.chain().focus().insertContentAt(t.position, n).run() : e.chain().focus().insertContent(n).run();
|
|
1703
|
-
},
|
|
1711
|
+
}, ze = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
|
|
1704
1712
|
var s;
|
|
1705
|
-
const i = typeof t.position == "number" ? t.position : (s =
|
|
1713
|
+
const i = typeof t.position == "number" ? t.position : (s = st(e, t.type || "")) == null ? void 0 : s.pos;
|
|
1706
1714
|
if (typeof i != "number")
|
|
1707
1715
|
return !1;
|
|
1708
1716
|
const o = r.doc.nodeAt(i);
|
|
@@ -1710,65 +1718,65 @@ const _e = () => {
|
|
|
1710
1718
|
return !1;
|
|
1711
1719
|
const c = { ...o.attrs, ...t.attrs };
|
|
1712
1720
|
return n.setNodeMarkup(i, void 0, c), a && a(n), !0;
|
|
1713
|
-
}),
|
|
1721
|
+
}), Zt = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
|
|
1714
1722
|
var c;
|
|
1715
|
-
const i = typeof t.position == "number" ? t.position : (c =
|
|
1723
|
+
const i = typeof t.position == "number" ? t.position : (c = st(e, t.type || "")) == null ? void 0 : c.pos;
|
|
1716
1724
|
if (typeof i != "number")
|
|
1717
1725
|
return !1;
|
|
1718
1726
|
const o = r.doc.nodeAt(i);
|
|
1719
1727
|
return !o || t.type && o.type.name !== t.type ? !1 : (n.delete(i, i + o.nodeSize), a && a(n), !0);
|
|
1720
|
-
}),
|
|
1721
|
-
const n =
|
|
1728
|
+
}), Qt = (e, t) => {
|
|
1729
|
+
const n = Na(e, t.type);
|
|
1722
1730
|
return n ? e.commands.command(({ tr: r, state: a, dispatch: i }) => {
|
|
1723
1731
|
const { from: o, to: c } = a.selection, s = a.selection.$from.blockRange(a.selection.$to);
|
|
1724
1732
|
if (!s)
|
|
1725
1733
|
return !1;
|
|
1726
|
-
const l =
|
|
1734
|
+
const l = fr(s, n, t.attrs);
|
|
1727
1735
|
return l ? (r.wrap(s, l), i && i(r.scrollIntoView()), o <= c) : !1;
|
|
1728
1736
|
}) : !1;
|
|
1729
|
-
},
|
|
1737
|
+
}, La = (e, t) => {
|
|
1730
1738
|
if (t.length === 0)
|
|
1731
1739
|
return !1;
|
|
1732
1740
|
const n = e.getJSON();
|
|
1733
1741
|
for (const r of t)
|
|
1734
|
-
if (!(r.type === "insertNode" ?
|
|
1742
|
+
if (!(r.type === "insertNode" ? Yt(e, r.payload) : r.type === "updateNodeAttrs" ? ze(e, r.payload) : r.type === "removeNode" ? Zt(e, r.payload) : Qt(e, r.payload)))
|
|
1735
1743
|
return e.commands.setContent(n), !1;
|
|
1736
1744
|
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),
|
|
1745
|
+
}, de = "https://draw.goatpatent.com";
|
|
1746
|
+
let Ne = 0;
|
|
1747
|
+
const Qe = [];
|
|
1748
|
+
let Ae = !1;
|
|
1749
|
+
const Pa = 2e4, bt = 6e4;
|
|
1750
|
+
let F = null, Me = !1, ne = null, pe = null;
|
|
1751
|
+
const et = /* @__PURE__ */ new Map();
|
|
1752
|
+
function vt() {
|
|
1753
|
+
ne && (window.removeEventListener("message", ne), ne = null), F && (F.src = "about:blank", F.remove(), F = null), Me = !1;
|
|
1746
1754
|
}
|
|
1747
|
-
function
|
|
1748
|
-
const n =
|
|
1755
|
+
function Da(e, t) {
|
|
1756
|
+
const n = et.get(e);
|
|
1749
1757
|
if (n) {
|
|
1750
1758
|
t(n);
|
|
1751
1759
|
return;
|
|
1752
1760
|
}
|
|
1753
|
-
|
|
1761
|
+
Qe.push({ xml: e, callback: t }), tt();
|
|
1754
1762
|
}
|
|
1755
|
-
function
|
|
1756
|
-
if (
|
|
1757
|
-
|
|
1758
|
-
const { xml: e, callback: t } =
|
|
1763
|
+
function tt() {
|
|
1764
|
+
if (Ae || Qe.length === 0) return;
|
|
1765
|
+
Ae = !0, pe && (clearTimeout(pe), pe = null);
|
|
1766
|
+
const { xml: e, callback: t } = Qe.shift(), n = et.get(e);
|
|
1759
1767
|
if (n) {
|
|
1760
|
-
t(n),
|
|
1768
|
+
t(n), Ae = !1, pe = setTimeout(vt, bt), tt();
|
|
1761
1769
|
return;
|
|
1762
1770
|
}
|
|
1763
1771
|
ne && (window.removeEventListener("message", ne), ne = null);
|
|
1764
1772
|
let r = null;
|
|
1765
1773
|
const a = (o) => {
|
|
1766
|
-
r && (clearTimeout(r), r = null), o &&
|
|
1774
|
+
r && (clearTimeout(r), r = null), o && et.set(e, o), t(o), Ae = !1, pe = setTimeout(vt, bt), tt();
|
|
1767
1775
|
}, i = () => {
|
|
1768
1776
|
var o;
|
|
1769
1777
|
(o = F.contentWindow) == null || o.postMessage(
|
|
1770
1778
|
JSON.stringify({ action: "load", autosave: 0, xml: e || "" }),
|
|
1771
|
-
|
|
1779
|
+
de
|
|
1772
1780
|
);
|
|
1773
1781
|
};
|
|
1774
1782
|
ne = (o) => {
|
|
@@ -1779,20 +1787,20 @@ function Qe() {
|
|
|
1779
1787
|
} catch {
|
|
1780
1788
|
return;
|
|
1781
1789
|
}
|
|
1782
|
-
c.event === "init" ? (
|
|
1790
|
+
c.event === "init" ? (Me = !0, i()) : c.event === "load" ? setTimeout(() => {
|
|
1783
1791
|
var s;
|
|
1784
1792
|
(s = F == null ? void 0 : F.contentWindow) == null || s.postMessage(
|
|
1785
1793
|
JSON.stringify({ action: "export", format: "svg" }),
|
|
1786
|
-
|
|
1794
|
+
de
|
|
1787
1795
|
);
|
|
1788
1796
|
}, 1500) : c.event === "export" && a(c.data || "");
|
|
1789
|
-
}, window.addEventListener("message", ne), r = setTimeout(() => a(""),
|
|
1797
|
+
}, 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
1798
|
}
|
|
1791
|
-
const
|
|
1799
|
+
const Le = () => {
|
|
1792
1800
|
document.querySelectorAll('body > svg[id^="fig-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
|
|
1793
1801
|
(e.id.startsWith("dmermaid") || e.id.startsWith("dfi")) && e.remove();
|
|
1794
1802
|
}), document.querySelectorAll("body > #dmermaid-svg").forEach((e) => e.remove()), document.querySelectorAll("body > style[data-mermaid-style]").forEach((e) => e.remove());
|
|
1795
|
-
},
|
|
1803
|
+
}, Ra = Z.create({
|
|
1796
1804
|
name: "figure",
|
|
1797
1805
|
group: "block",
|
|
1798
1806
|
content: "inline*",
|
|
@@ -1835,12 +1843,12 @@ const Ae = () => {
|
|
|
1835
1843
|
g.type = "file", g.accept = "image/*", g.style.display = "none";
|
|
1836
1844
|
const u = document.createElement("button");
|
|
1837
1845
|
u.className = "figure-replace-btn", l.append(d, g);
|
|
1838
|
-
const p = document.createElement("div");
|
|
1839
|
-
p.className = "figure-mermaid-view", p.contentEditable = "false", p.setAttribute("spellcheck", "false");
|
|
1840
1846
|
const f = document.createElement("div");
|
|
1841
|
-
f.className = "figure-mermaid-
|
|
1847
|
+
f.className = "figure-mermaid-view", f.contentEditable = "false", f.setAttribute("spellcheck", "false");
|
|
1848
|
+
const p = document.createElement("div");
|
|
1849
|
+
p.className = "figure-mermaid-preview", p.contentEditable = "false";
|
|
1842
1850
|
const b = document.createElement("div");
|
|
1843
|
-
b.className = "figure-mermaid-view-hint",
|
|
1851
|
+
b.className = "figure-mermaid-view-hint", f.append(p, b);
|
|
1844
1852
|
const h = document.createElement("div");
|
|
1845
1853
|
h.className = "figure-mermaid-edit";
|
|
1846
1854
|
const y = document.createElement("textarea");
|
|
@@ -1858,7 +1866,7 @@ const Ae = () => {
|
|
|
1858
1866
|
const _ = document.createElement("img");
|
|
1859
1867
|
_.className = "figure-drawio-preview-img", _.style.display = "none";
|
|
1860
1868
|
const C = document.createElement("div");
|
|
1861
|
-
C.className = "figure-drawio-view-hint", v.append(_, C), c.append(s, l, u), c.append(
|
|
1869
|
+
C.className = "figure-drawio-view-hint", v.append(_, C), c.append(s, l, u), c.append(f, h), c.append(v);
|
|
1862
1870
|
const N = document.createElement("figcaption");
|
|
1863
1871
|
N.className = "figure-caption";
|
|
1864
1872
|
const A = document.createElement("span");
|
|
@@ -1887,39 +1895,39 @@ const Ae = () => {
|
|
|
1887
1895
|
var k;
|
|
1888
1896
|
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
1897
|
});
|
|
1890
|
-
const
|
|
1898
|
+
const gn = () => {
|
|
1891
1899
|
a || (a = !0, y.value = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "", T.textContent = "", T.style.display = "none", J(), requestAnimationFrame(() => y.focus()));
|
|
1892
|
-
},
|
|
1900
|
+
}, fn = () => {
|
|
1893
1901
|
a = !1, J();
|
|
1894
|
-
},
|
|
1902
|
+
}, pn = async () => {
|
|
1895
1903
|
const S = y.value;
|
|
1896
1904
|
T.textContent = "", T.style.display = "none";
|
|
1897
1905
|
const k = S.trim();
|
|
1898
1906
|
if (k)
|
|
1899
1907
|
try {
|
|
1900
1908
|
const P = await import("mermaid");
|
|
1901
|
-
P.default.initialize({ startOnLoad: !1, theme: "default" }),
|
|
1902
|
-
const O = `fig-mermaid-${
|
|
1903
|
-
|
|
1909
|
+
P.default.initialize({ startOnLoad: !1, theme: "default" }), Ne += 1;
|
|
1910
|
+
const O = `fig-mermaid-${Ne}`, { svg: R } = await P.default.render(O, k);
|
|
1911
|
+
p.innerHTML = R, Le();
|
|
1904
1912
|
} catch {
|
|
1905
|
-
|
|
1913
|
+
Le();
|
|
1906
1914
|
const P = I.getState().editorLanguage;
|
|
1907
1915
|
T.textContent = P === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", T.style.display = "inline";
|
|
1908
1916
|
return;
|
|
1909
1917
|
}
|
|
1910
1918
|
z({ mermaidCode: S }), a = !1, J();
|
|
1911
1919
|
};
|
|
1912
|
-
|
|
1913
|
-
S.preventDefault(), S.stopPropagation(),
|
|
1920
|
+
f.addEventListener("dblclick", (S) => {
|
|
1921
|
+
S.preventDefault(), S.stopPropagation(), gn();
|
|
1914
1922
|
}), x.addEventListener("click", (S) => {
|
|
1915
|
-
S.stopPropagation(),
|
|
1923
|
+
S.stopPropagation(), pn();
|
|
1916
1924
|
}), w.addEventListener("click", (S) => {
|
|
1917
|
-
S.stopPropagation(),
|
|
1925
|
+
S.stopPropagation(), fn();
|
|
1918
1926
|
}), y.addEventListener("mousedown", (S) => S.stopPropagation()), y.addEventListener("keydown", (S) => S.stopPropagation()), y.addEventListener("keypress", (S) => S.stopPropagation());
|
|
1919
|
-
let ee = null,
|
|
1920
|
-
const
|
|
1927
|
+
let ee = null, G = null, q = null;
|
|
1928
|
+
const hn = () => {
|
|
1921
1929
|
if (i) return;
|
|
1922
|
-
i = !0, J(),
|
|
1930
|
+
i = !0, J(), G = document.createElement("div"), G.className = "drawio-modal-overlay";
|
|
1923
1931
|
const S = document.createElement("div");
|
|
1924
1932
|
S.className = "drawio-modal-content";
|
|
1925
1933
|
const k = document.createElement("div");
|
|
@@ -1927,93 +1935,93 @@ const Ae = () => {
|
|
|
1927
1935
|
const P = document.createElement("span"), O = I.getState().editorLanguage;
|
|
1928
1936
|
P.textContent = O === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", P.className = "drawio-modal-title";
|
|
1929
1937
|
const R = document.createElement("button");
|
|
1930
|
-
R.className = "drawio-modal-close-btn", R.textContent = "✕", R.type = "button", R.addEventListener("click", () =>
|
|
1931
|
-
const
|
|
1932
|
-
|
|
1933
|
-
const K =
|
|
1938
|
+
R.className = "drawio-modal-close-btn", R.textContent = "✕", R.type = "button", R.addEventListener("click", () => We()), k.append(P, R), q = document.createElement("iframe"), q.className = "drawio-modal-iframe", q.setAttribute("frameborder", "0"), S.append(k, q), G.appendChild(S), document.body.appendChild(G);
|
|
1939
|
+
const fe = O === "en" ? "en" : "zh";
|
|
1940
|
+
q.src = `${de}/?embed=1&proto=json&spin=1&lang=${fe}`;
|
|
1941
|
+
const K = q;
|
|
1934
1942
|
ee = (X) => {
|
|
1935
|
-
var oe,
|
|
1943
|
+
var oe, Te;
|
|
1936
1944
|
if (!K || X.source !== K.contentWindow) return;
|
|
1937
|
-
let
|
|
1945
|
+
let U;
|
|
1938
1946
|
try {
|
|
1939
|
-
|
|
1947
|
+
U = typeof X.data == "string" ? JSON.parse(X.data) : X.data;
|
|
1940
1948
|
} catch {
|
|
1941
1949
|
return;
|
|
1942
1950
|
}
|
|
1943
|
-
if (
|
|
1951
|
+
if (U.event === "init") {
|
|
1944
1952
|
const ce = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
|
|
1945
1953
|
(oe = K.contentWindow) == null || oe.postMessage(
|
|
1946
1954
|
JSON.stringify({ action: "load", autosave: 0, xml: ce || "" }),
|
|
1947
|
-
|
|
1955
|
+
de
|
|
1948
1956
|
);
|
|
1949
|
-
} else if (
|
|
1950
|
-
const ce =
|
|
1951
|
-
(
|
|
1957
|
+
} else if (U.event === "save") {
|
|
1958
|
+
const ce = U.xml || "";
|
|
1959
|
+
(Te = K.contentWindow) == null || Te.postMessage(
|
|
1952
1960
|
JSON.stringify({ action: "export", format: "svg" }),
|
|
1953
|
-
|
|
1961
|
+
de
|
|
1954
1962
|
), z({ drawioXml: ce });
|
|
1955
|
-
} else if (
|
|
1956
|
-
const ce =
|
|
1957
|
-
z({ drawioSvg: ce }),
|
|
1958
|
-
} else
|
|
1963
|
+
} else if (U.event === "export") {
|
|
1964
|
+
const ce = U.data || "";
|
|
1965
|
+
z({ drawioSvg: ce }), We();
|
|
1966
|
+
} else U.event === "exit" && We();
|
|
1959
1967
|
}, window.addEventListener("message", ee);
|
|
1960
|
-
},
|
|
1961
|
-
i = !1, ee && (window.removeEventListener("message", ee), ee = null),
|
|
1968
|
+
}, We = () => {
|
|
1969
|
+
i = !1, ee && (window.removeEventListener("message", ee), ee = null), q && (q.src = "about:blank", q = null), G && (G.remove(), G = null), J();
|
|
1962
1970
|
};
|
|
1963
1971
|
v.addEventListener("dblclick", (S) => {
|
|
1964
|
-
S.preventDefault(), S.stopPropagation(),
|
|
1972
|
+
S.preventDefault(), S.stopPropagation(), hn();
|
|
1965
1973
|
}), o.addEventListener("mousedown", (S) => {
|
|
1966
1974
|
const k = S.target;
|
|
1967
|
-
if (!(k instanceof HTMLElement) || k === D || D.contains(k) || k === y || h.contains(k) || k === l || l.contains(k) || k === u || k === g ||
|
|
1975
|
+
if (!(k instanceof HTMLElement) || k === D || D.contains(k) || k === y || h.contains(k) || k === l || l.contains(k) || k === u || k === g || f.contains(k) || v.contains(k)) return;
|
|
1968
1976
|
const P = typeof n == "function" ? n() : null;
|
|
1969
1977
|
if (typeof P != "number") return;
|
|
1970
|
-
const O = P + r.nodeSize - 1, R =
|
|
1978
|
+
const O = P + r.nodeSize - 1, R = Zn.create(e.state.doc, O);
|
|
1971
1979
|
e.view.dispatch(e.state.tr.setSelection(R));
|
|
1972
1980
|
});
|
|
1973
|
-
let
|
|
1974
|
-
const
|
|
1975
|
-
let
|
|
1976
|
-
const
|
|
1981
|
+
let xe = !1, se = null, me = null, Ce = 0;
|
|
1982
|
+
const yn = 2, bn = 1500, vn = 3e3;
|
|
1983
|
+
let ge = "";
|
|
1984
|
+
const wn = async (S) => {
|
|
1977
1985
|
const k = S.trim();
|
|
1978
|
-
if (k !==
|
|
1986
|
+
if (k !== ge) {
|
|
1979
1987
|
if (!k) {
|
|
1980
|
-
|
|
1988
|
+
p.innerHTML = "", ge = "";
|
|
1981
1989
|
return;
|
|
1982
1990
|
}
|
|
1983
1991
|
try {
|
|
1984
1992
|
const P = await import("mermaid");
|
|
1985
|
-
P.default.initialize({ startOnLoad: !1, theme: "default" }),
|
|
1986
|
-
const O = `fig-mermaid-${
|
|
1987
|
-
|
|
1993
|
+
P.default.initialize({ startOnLoad: !1, theme: "default" }), Ne += 1;
|
|
1994
|
+
const O = `fig-mermaid-${Ne}`, { svg: R } = await P.default.render(O, k);
|
|
1995
|
+
p.innerHTML = R, ge = k;
|
|
1988
1996
|
} catch {
|
|
1989
|
-
|
|
1997
|
+
p.innerHTML = "", ge = "";
|
|
1990
1998
|
} finally {
|
|
1991
|
-
|
|
1999
|
+
Le();
|
|
1992
2000
|
}
|
|
1993
2001
|
}
|
|
1994
2002
|
}, J = () => {
|
|
1995
|
-
const S = I.getState().editorLanguage, k =
|
|
2003
|
+
const S = I.getState().editorLanguage, k = H(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
2004
|
O ? (A.textContent = `[${O}] `, A.style.display = "inline") : (A.textContent = "", A.style.display = "none");
|
|
1997
|
-
const K = P === "image", X = P === "mermaid",
|
|
1998
|
-
s.style.display = K && R ? "block" : "none", l.style.display = K && !R ? "flex" : "none", u.style.display = K && R ? "block" : "none",
|
|
2005
|
+
const K = P === "image", X = P === "mermaid", U = P === "drawio";
|
|
2006
|
+
s.style.display = K && R ? "block" : "none", l.style.display = K && !R ? "flex" : "none", u.style.display = K && R ? "block" : "none", f.style.display = X && !a ? "block" : "none", h.style.display = X && a ? "block" : "none", v.style.display = U ? "flex" : "none", K && R && (s.src = R);
|
|
1999
2007
|
const oe = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
|
|
2000
|
-
|
|
2001
|
-
const
|
|
2002
|
-
X && !a && (
|
|
2003
|
-
const
|
|
2004
|
-
|
|
2008
|
+
U && (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 || "取消";
|
|
2009
|
+
const Te = fe.trim().length > 0, ce = p.querySelector("svg") !== null;
|
|
2010
|
+
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")), U && !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);
|
|
2011
|
+
const Cn = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
|
|
2012
|
+
U && Cn && !oe && !xe && !i && (se && clearTimeout(se), se = setTimeout(() => {
|
|
2005
2013
|
se = null;
|
|
2006
|
-
const
|
|
2007
|
-
!
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
},
|
|
2014
|
+
const dt = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "", Tn = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
|
|
2015
|
+
!dt || Tn || xe || (xe = !0, Da(dt, (ut) => {
|
|
2016
|
+
xe = !1, ut ? (Ce = 0, z({ drawioSvg: ut })) : Ce < yn && (Ce++, me = setTimeout(() => {
|
|
2017
|
+
me = null, J();
|
|
2018
|
+
}, vn * Ce));
|
|
2011
2019
|
}));
|
|
2012
|
-
},
|
|
2020
|
+
}, bn));
|
|
2013
2021
|
};
|
|
2014
|
-
let
|
|
2015
|
-
const
|
|
2016
|
-
S.editorLanguage !==
|
|
2022
|
+
let lt = I.getState().editorLanguage;
|
|
2023
|
+
const xn = I.subscribe((S) => {
|
|
2024
|
+
S.editorLanguage !== lt && (lt = S.editorLanguage, J());
|
|
2017
2025
|
});
|
|
2018
2026
|
return J(), {
|
|
2019
2027
|
dom: o,
|
|
@@ -2028,12 +2036,12 @@ const Ae = () => {
|
|
|
2028
2036
|
},
|
|
2029
2037
|
update: (S) => S.type.name !== "figure" ? !1 : (r = S, J(), !0),
|
|
2030
2038
|
destroy: () => {
|
|
2031
|
-
se && (clearTimeout(se), se = null),
|
|
2039
|
+
se && (clearTimeout(se), se = null), me && (clearTimeout(me), me = null), xn(), Le(), ee && (window.removeEventListener("message", ee), ee = null), q && (q.src = "about:blank", q = null), G && (G.remove(), G = null);
|
|
2032
2040
|
}
|
|
2033
2041
|
};
|
|
2034
2042
|
};
|
|
2035
2043
|
}
|
|
2036
|
-
}),
|
|
2044
|
+
}), Ma = Z.create({
|
|
2037
2045
|
name: "reference",
|
|
2038
2046
|
group: "inline",
|
|
2039
2047
|
inline: !0,
|
|
@@ -2094,7 +2102,7 @@ const Ae = () => {
|
|
|
2094
2102
|
return ({ node: e, editor: t }) => {
|
|
2095
2103
|
let n = e;
|
|
2096
2104
|
const r = document.createElement("span"), a = () => {
|
|
2097
|
-
const i = n.attrs.lang === "en" ? "en" : "zh", o =
|
|
2105
|
+
const i = n.attrs.lang === "en" ? "en" : "zh", o = H(i), c = n.attrs.targetType === "figure" ? "figure" : "claim", s = Number(n.attrs.resolvedNumber), l = typeof n.attrs.resolvedFigureId == "string" && n.attrs.resolvedFigureId ? n.attrs.resolvedFigureId : null, d = c === "figure" ? l || (i === "en" ? "Figure ?" : "附图?") : Number.isFinite(s) ? o.claimLabel(s) : i === "en" ? "Claim ?" : "权利要求?", g = n.attrs.displayText || d;
|
|
2098
2106
|
r.textContent = g, r.className = `reference-link${n.attrs.invalid ? " reference-link-invalid" : ""}`, r.setAttribute("data-type", "reference"), r.setAttribute("data-highlight", n.attrs.highlight ? "true" : "false"), r.title = n.attrs.invalid ? o.referenceNavigateDisabledTitle : c === "figure" ? o.figureReferenceNavigateTitle : o.referenceNavigateTitle;
|
|
2099
2107
|
};
|
|
2100
2108
|
return a(), r.addEventListener("click", () => {
|
|
@@ -2119,7 +2127,7 @@ const Ae = () => {
|
|
|
2119
2127
|
};
|
|
2120
2128
|
};
|
|
2121
2129
|
}
|
|
2122
|
-
}),
|
|
2130
|
+
}), wt = {
|
|
2123
2131
|
technical_field: "sectionTitle_technical_field",
|
|
2124
2132
|
background_art: "sectionTitle_background_art",
|
|
2125
2133
|
summary: "sectionTitle_summary",
|
|
@@ -2134,7 +2142,7 @@ const Ae = () => {
|
|
|
2134
2142
|
design_description: "sectionTitle_design_description",
|
|
2135
2143
|
design_views: "sectionTitle_design_views",
|
|
2136
2144
|
design_brief: "sectionTitle_design_brief"
|
|
2137
|
-
},
|
|
2145
|
+
}, Fa = /* @__PURE__ */ new Set([
|
|
2138
2146
|
"abstract",
|
|
2139
2147
|
"abstract_drawing",
|
|
2140
2148
|
"claims",
|
|
@@ -2145,22 +2153,22 @@ const Ae = () => {
|
|
|
2145
2153
|
"design_description",
|
|
2146
2154
|
"design_views",
|
|
2147
2155
|
"design_brief"
|
|
2148
|
-
]),
|
|
2156
|
+
]), $a = /* @__PURE__ */ new Set([
|
|
2149
2157
|
"technical_field",
|
|
2150
2158
|
"background_art",
|
|
2151
2159
|
"summary",
|
|
2152
2160
|
"drawing_description",
|
|
2153
2161
|
"detailed_description"
|
|
2154
|
-
]),
|
|
2162
|
+
]), ot = (e) => {
|
|
2155
2163
|
if (e.isText)
|
|
2156
2164
|
return (e.text ?? "").trim().length > 0;
|
|
2157
2165
|
if (e.isAtom || e.isLeaf || !["patent_section", "patent_title", "paragraph"].includes(e.type.name))
|
|
2158
2166
|
return !0;
|
|
2159
2167
|
let t = !1;
|
|
2160
2168
|
return e.forEach((n) => {
|
|
2161
|
-
!t &&
|
|
2169
|
+
!t && ot(n) && (t = !0);
|
|
2162
2170
|
}), t;
|
|
2163
|
-
},
|
|
2171
|
+
}, za = Z.create({
|
|
2164
2172
|
name: "patent_title",
|
|
2165
2173
|
group: "block",
|
|
2166
2174
|
content: "inline*",
|
|
@@ -2203,27 +2211,27 @@ const Ae = () => {
|
|
|
2203
2211
|
};
|
|
2204
2212
|
o.addEventListener("click", d), c.addEventListener("focusin", l), c.addEventListener("click", l);
|
|
2205
2213
|
const g = () => {
|
|
2206
|
-
const b = I.getState(), h =
|
|
2214
|
+
const b = I.getState(), h = H(b.editorLanguage), y = typeof h.bookTitle_description == "string" ? h.bookTitle_description : "说明书", E = typeof h.patentTitlePlaceholder == "string" ? h.patentTitlePlaceholder : "专利名称";
|
|
2207
2215
|
i.textContent = y;
|
|
2208
|
-
const x =
|
|
2216
|
+
const x = ot(r), w = b.rightPanel.activeSectionPos === s();
|
|
2209
2217
|
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
2218
|
};
|
|
2211
|
-
let u = I.getState().editorLanguage,
|
|
2212
|
-
const
|
|
2213
|
-
const h = b.editorLanguage !== u, y = b.rightPanel.activeSectionPos !==
|
|
2214
|
-
u = b.editorLanguage,
|
|
2219
|
+
let u = I.getState().editorLanguage, f = I.getState().rightPanel.activeSectionPos;
|
|
2220
|
+
const p = I.subscribe((b) => {
|
|
2221
|
+
const h = b.editorLanguage !== u, y = b.rightPanel.activeSectionPos !== f;
|
|
2222
|
+
u = b.editorLanguage, f = b.rightPanel.activeSectionPos, (h || y) && g();
|
|
2215
2223
|
});
|
|
2216
2224
|
return g(), {
|
|
2217
2225
|
dom: a,
|
|
2218
2226
|
contentDOM: c,
|
|
2219
2227
|
update: (b) => b.type.name !== "patent_title" ? !1 : (r = b, g(), !0),
|
|
2220
2228
|
destroy: () => {
|
|
2221
|
-
|
|
2229
|
+
p(), o.removeEventListener("click", d), c.removeEventListener("focusin", l), c.removeEventListener("click", l);
|
|
2222
2230
|
}
|
|
2223
2231
|
};
|
|
2224
2232
|
};
|
|
2225
2233
|
}
|
|
2226
|
-
}),
|
|
2234
|
+
}), Oa = Z.create({
|
|
2227
2235
|
name: "patent_section",
|
|
2228
2236
|
group: "block",
|
|
2229
2237
|
content: "block+",
|
|
@@ -2255,15 +2263,15 @@ const Ae = () => {
|
|
|
2255
2263
|
const n = [];
|
|
2256
2264
|
return t.forEach((r) => {
|
|
2257
2265
|
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
|
-
}),
|
|
2266
|
+
}), hr.from(n);
|
|
2259
2267
|
};
|
|
2260
2268
|
return [
|
|
2261
|
-
new
|
|
2262
|
-
key: new
|
|
2269
|
+
new Be({
|
|
2270
|
+
key: new we("patentSectionLock"),
|
|
2263
2271
|
props: {
|
|
2264
2272
|
transformPasted: (t) => {
|
|
2265
2273
|
const n = e(t.content);
|
|
2266
|
-
return new
|
|
2274
|
+
return new pr(n, t.openStart, t.openEnd);
|
|
2267
2275
|
}
|
|
2268
2276
|
},
|
|
2269
2277
|
filterTransaction: (t, n) => {
|
|
@@ -2308,13 +2316,13 @@ const Ae = () => {
|
|
|
2308
2316
|
};
|
|
2309
2317
|
c.addEventListener("click", g), s.addEventListener("focusin", d), s.addEventListener("click", d);
|
|
2310
2318
|
const u = () => {
|
|
2311
|
-
const h = I.getState(), y =
|
|
2319
|
+
const h = I.getState(), y = H(h.editorLanguage), E = Object.keys(wt).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", x = Fa.has(E), w = $a.has(E), T = wt[E], v = typeof y[T] == "string" ? y[T] : E, _ = ot(r), C = h.rightPanel.activeSectionPos === l();
|
|
2312
2320
|
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
2321
|
};
|
|
2314
|
-
let
|
|
2322
|
+
let f = I.getState().editorLanguage, p = I.getState().rightPanel.activeSectionPos;
|
|
2315
2323
|
const b = I.subscribe((h) => {
|
|
2316
|
-
const y = h.editorLanguage !==
|
|
2317
|
-
|
|
2324
|
+
const y = h.editorLanguage !== f, E = h.rightPanel.activeSectionPos !== p;
|
|
2325
|
+
f = h.editorLanguage, p = h.rightPanel.activeSectionPos, (y || E) && u();
|
|
2318
2326
|
});
|
|
2319
2327
|
return u(), {
|
|
2320
2328
|
dom: a,
|
|
@@ -2326,27 +2334,27 @@ const Ae = () => {
|
|
|
2326
2334
|
};
|
|
2327
2335
|
};
|
|
2328
2336
|
}
|
|
2329
|
-
}),
|
|
2337
|
+
}), Ba = [
|
|
2330
2338
|
"abstract",
|
|
2331
2339
|
// 说明书摘要
|
|
2332
2340
|
"abstract_drawing"
|
|
2333
2341
|
// 摘要附图
|
|
2334
|
-
],
|
|
2342
|
+
], Ha = [
|
|
2335
2343
|
"technical_field",
|
|
2336
2344
|
"background_art",
|
|
2337
2345
|
"summary",
|
|
2338
2346
|
"drawing_description",
|
|
2339
2347
|
"detailed_description"
|
|
2340
|
-
],
|
|
2348
|
+
], qa = [
|
|
2341
2349
|
"drawing_figures"
|
|
2342
2350
|
// 说明书附图
|
|
2343
|
-
],
|
|
2351
|
+
], Ua = [
|
|
2344
2352
|
"design_product_name",
|
|
2345
2353
|
"design_usage",
|
|
2346
2354
|
"design_description",
|
|
2347
2355
|
"design_views",
|
|
2348
2356
|
"design_brief"
|
|
2349
|
-
],
|
|
2357
|
+
], Fe = (e) => ({
|
|
2350
2358
|
type: "patent_section",
|
|
2351
2359
|
attrs: {
|
|
2352
2360
|
sectionType: e,
|
|
@@ -2357,35 +2365,35 @@ const Ae = () => {
|
|
|
2357
2365
|
type: "paragraph"
|
|
2358
2366
|
}
|
|
2359
2367
|
]
|
|
2360
|
-
}),
|
|
2368
|
+
}), en = () => ({
|
|
2361
2369
|
type: "patent_title",
|
|
2362
2370
|
content: []
|
|
2363
|
-
}),
|
|
2364
|
-
...
|
|
2365
|
-
|
|
2366
|
-
...
|
|
2367
|
-
...
|
|
2368
|
-
],
|
|
2369
|
-
|
|
2370
|
-
...
|
|
2371
|
-
],
|
|
2371
|
+
}), Wa = () => [
|
|
2372
|
+
...Ba.map(Fe),
|
|
2373
|
+
en(),
|
|
2374
|
+
...Ha.map(Fe),
|
|
2375
|
+
...qa.map(Fe)
|
|
2376
|
+
], ja = () => [
|
|
2377
|
+
en(),
|
|
2378
|
+
...Ua.map(Fe)
|
|
2379
|
+
], tn = (e = "invention") => ({ type: "doc", content: e === "design" ? ja() : Wa() }), ve = (e) => Xt(e, (t) => t.type.name === "figure"), V = (e) => typeof e != "string" ? "" : e.trim(), xt = (e) => {
|
|
2372
2380
|
const n = I.getState().editorLanguage === "en" ? "Fig." : "图", r = /* @__PURE__ */ new Set();
|
|
2373
|
-
|
|
2374
|
-
const o =
|
|
2381
|
+
ve(e).forEach((i) => {
|
|
2382
|
+
const o = V(i.node.attrs.id);
|
|
2375
2383
|
o && r.add(o);
|
|
2376
2384
|
});
|
|
2377
2385
|
let a = 1;
|
|
2378
2386
|
for (; r.has(`${n}${a}`); )
|
|
2379
2387
|
a += 1;
|
|
2380
2388
|
return `${n}${a}`;
|
|
2381
|
-
},
|
|
2382
|
-
const n = I.getState().editorLanguage === "en" ? "Fig." : "图", r =
|
|
2389
|
+
}, Ga = /^(Fig\.|图)(\d+)$/, Va = (e) => {
|
|
2390
|
+
const n = I.getState().editorLanguage === "en" ? "Fig." : "图", r = ve(e);
|
|
2383
2391
|
if (r.length === 0) return;
|
|
2384
2392
|
const a = [];
|
|
2385
2393
|
let i = 1;
|
|
2386
2394
|
for (const c of r) {
|
|
2387
|
-
const s =
|
|
2388
|
-
if (!
|
|
2395
|
+
const s = V(c.node.attrs.id);
|
|
2396
|
+
if (!Ga.exec(s)) continue;
|
|
2389
2397
|
const d = `${n}${i}`;
|
|
2390
2398
|
s !== d && a.push({ pos: c.pos, expectedId: d, currentId: s }), i++;
|
|
2391
2399
|
}
|
|
@@ -2396,44 +2404,44 @@ const Ae = () => {
|
|
|
2396
2404
|
!s || s.type.name !== "figure" || o.setNodeMarkup(c.pos, void 0, { ...s.attrs, id: c.expectedId });
|
|
2397
2405
|
}
|
|
2398
2406
|
o.steps.length > 0 && (o.setMeta("addToHistory", !1), e.view.dispatch(o));
|
|
2399
|
-
},
|
|
2407
|
+
}, nn = (e) => {
|
|
2400
2408
|
const t = /* @__PURE__ */ new Map();
|
|
2401
|
-
return
|
|
2402
|
-
const r =
|
|
2409
|
+
return ve(e).forEach((n) => {
|
|
2410
|
+
const r = V(n.node.attrs.id);
|
|
2403
2411
|
r && t.set(r, {
|
|
2404
2412
|
id: r,
|
|
2405
2413
|
pos: n.pos
|
|
2406
2414
|
});
|
|
2407
2415
|
}), t;
|
|
2408
|
-
},
|
|
2409
|
-
const r =
|
|
2416
|
+
}, rn = () => I.getState().editorLanguage === "en" ? "en" : "zh", an = (e, t, n) => {
|
|
2417
|
+
const r = H(e);
|
|
2410
2418
|
return n ? r.invalidFigureReference : t || (e === "en" ? "Figure ?" : "附图?");
|
|
2411
|
-
},
|
|
2412
|
-
const t =
|
|
2419
|
+
}, Je = (e) => {
|
|
2420
|
+
const t = nn(e), n = rn();
|
|
2413
2421
|
e.commands.command(({ tr: r, state: a, dispatch: i }) => {
|
|
2414
2422
|
let o = !1;
|
|
2415
2423
|
return a.doc.descendants((c, s) => {
|
|
2416
2424
|
if (c.type.name !== "reference" || c.attrs.targetType !== "figure")
|
|
2417
2425
|
return !0;
|
|
2418
|
-
const l = typeof c.attrs.targetFigureId == "string" && c.attrs.targetFigureId ?
|
|
2426
|
+
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, f = an(n, g, u), p = {
|
|
2419
2427
|
...c.attrs,
|
|
2420
2428
|
targetType: "figure",
|
|
2421
2429
|
targetFigureId: l,
|
|
2422
2430
|
resolvedFigureId: g,
|
|
2423
2431
|
invalid: u,
|
|
2424
2432
|
lang: n,
|
|
2425
|
-
displayText:
|
|
2433
|
+
displayText: f,
|
|
2426
2434
|
target: g || c.attrs.target || l || null
|
|
2427
2435
|
};
|
|
2428
|
-
return Object.keys(
|
|
2429
|
-
(h) =>
|
|
2430
|
-
) && (r.setNodeMarkup(s, void 0,
|
|
2436
|
+
return Object.keys(p).some(
|
|
2437
|
+
(h) => p[h] !== c.attrs[h]
|
|
2438
|
+
) && (r.setNodeMarkup(s, void 0, p), o = !0), !0;
|
|
2431
2439
|
}), o && i && i(r), !0;
|
|
2432
2440
|
});
|
|
2433
|
-
},
|
|
2441
|
+
}, Ja = {
|
|
2434
2442
|
name: "patent",
|
|
2435
2443
|
version: "1.0.0",
|
|
2436
|
-
extensions: [
|
|
2444
|
+
extensions: [Ra, Ma, za, Oa],
|
|
2437
2445
|
toolbarItems: [
|
|
2438
2446
|
{
|
|
2439
2447
|
id: "patent-figure-insert",
|
|
@@ -2456,14 +2464,14 @@ const Ae = () => {
|
|
|
2456
2464
|
return !1;
|
|
2457
2465
|
const r = n.lang === "en" ? "en" : "zh";
|
|
2458
2466
|
I.getState().setEditorLanguage(r);
|
|
2459
|
-
const i = (n.scope || "all") === "current" ?
|
|
2467
|
+
const i = (n.scope || "all") === "current" ? Re(e, "reference") : null;
|
|
2460
2468
|
return e.commands.command(({ tr: c, state: s, dispatch: l }) => {
|
|
2461
2469
|
let d = !1;
|
|
2462
2470
|
return s.doc.descendants((g, u) => (g.type.name !== "reference" || i && u !== i.pos || g.attrs.lang !== r && (c.setNodeMarkup(u, void 0, {
|
|
2463
2471
|
...g.attrs,
|
|
2464
2472
|
lang: r
|
|
2465
2473
|
}), d = !0), !0)), d && l && l(c), !0;
|
|
2466
|
-
}) ? (
|
|
2474
|
+
}) ? (Je(e), !0) : !1;
|
|
2467
2475
|
}
|
|
2468
2476
|
},
|
|
2469
2477
|
insertFigure: {
|
|
@@ -2472,7 +2480,7 @@ const Ae = () => {
|
|
|
2472
2480
|
shortcut: "Ctrl+Shift+F",
|
|
2473
2481
|
isActive: ({ editor: e }) => e.isActive("figure"),
|
|
2474
2482
|
execute: ({ editor: e }, t) => {
|
|
2475
|
-
const n = typeof t == "object" && t ? t : {}, r =
|
|
2483
|
+
const n = typeof t == "object" && t ? t : {}, r = V(n.id) || xt(e), a = n.contentType && ["image", "mermaid", "drawio"].includes(n.contentType) ? n.contentType : "image";
|
|
2476
2484
|
return e.chain().focus().insertContent({
|
|
2477
2485
|
type: "figure",
|
|
2478
2486
|
attrs: { id: r, contentType: a, imageSrc: "", mermaidCode: "", drawioXml: "" },
|
|
@@ -2484,17 +2492,17 @@ const Ae = () => {
|
|
|
2484
2492
|
description: "Update figure attributes",
|
|
2485
2493
|
category: "patent",
|
|
2486
2494
|
execute: ({ editor: e }, t) => {
|
|
2487
|
-
const n = typeof t == "object" && t ? t : {}, r =
|
|
2495
|
+
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
2496
|
if (typeof a != "number")
|
|
2489
2497
|
return !1;
|
|
2490
2498
|
const i = e.state.doc.nodeAt(a);
|
|
2491
2499
|
if (!i || i.type.name !== "figure")
|
|
2492
2500
|
return !1;
|
|
2493
|
-
const c = (typeof n.id == "string" ?
|
|
2494
|
-
if (
|
|
2501
|
+
const c = (typeof n.id == "string" ? V(n.id) : V(i.attrs.id)) || xt(e);
|
|
2502
|
+
if (ve(e).some((d) => d.pos === a ? !1 : V(d.node.attrs.id) === c))
|
|
2495
2503
|
return !1;
|
|
2496
2504
|
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),
|
|
2505
|
+
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
2506
|
type: "figure",
|
|
2499
2507
|
position: a,
|
|
2500
2508
|
attrs: l
|
|
@@ -2507,8 +2515,8 @@ const Ae = () => {
|
|
|
2507
2515
|
execute: ({ editor: e }) => {
|
|
2508
2516
|
const t = /* @__PURE__ */ new Set();
|
|
2509
2517
|
let n = !1;
|
|
2510
|
-
return
|
|
2511
|
-
const a =
|
|
2518
|
+
return ve(e).forEach((r) => {
|
|
2519
|
+
const a = V(r.node.attrs.id);
|
|
2512
2520
|
if (a) {
|
|
2513
2521
|
if (t.has(a)) {
|
|
2514
2522
|
n = !0;
|
|
@@ -2531,13 +2539,13 @@ const Ae = () => {
|
|
|
2531
2539
|
return typeof n.targetFigureId == "string" && n.targetFigureId.trim().length > 0;
|
|
2532
2540
|
},
|
|
2533
2541
|
execute: ({ editor: e }, t) => {
|
|
2534
|
-
const n = typeof t == "object" && t ? t : {}, r =
|
|
2542
|
+
const n = typeof t == "object" && t ? t : {}, r = nn(e), a = typeof n.targetFigureId == "string" ? V(n.targetFigureId) : "";
|
|
2535
2543
|
if (!a)
|
|
2536
2544
|
return !1;
|
|
2537
2545
|
const i = r.get(a);
|
|
2538
2546
|
if (!i)
|
|
2539
2547
|
return !1;
|
|
2540
|
-
const o = n.lang ||
|
|
2548
|
+
const o = n.lang || rn(), c = n.displayText || an(o, i.id, !1);
|
|
2541
2549
|
return e.chain().focus().insertContent({
|
|
2542
2550
|
type: "reference",
|
|
2543
2551
|
attrs: {
|
|
@@ -2552,14 +2560,14 @@ const Ae = () => {
|
|
|
2552
2560
|
target: n.target || i.id,
|
|
2553
2561
|
highlight: !1
|
|
2554
2562
|
}
|
|
2555
|
-
}).run() ? (
|
|
2563
|
+
}).run() ? (Je(e), !0) : !1;
|
|
2556
2564
|
}
|
|
2557
2565
|
},
|
|
2558
2566
|
insertPatentDocument: {
|
|
2559
2567
|
description: "Insert patent document skeleton with all sections",
|
|
2560
2568
|
category: "patent",
|
|
2561
2569
|
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 =
|
|
2570
|
+
const n = typeof t == "object" && t ? t : {}, r = n.patentType === "utility_model" ? "utility_model" : n.patentType === "design" ? "design" : "invention", a = tn(r);
|
|
2563
2571
|
return e.commands.setContent(a);
|
|
2564
2572
|
}
|
|
2565
2573
|
},
|
|
@@ -2567,10 +2575,10 @@ const Ae = () => {
|
|
|
2567
2575
|
description: "Toggle patent section collapse state",
|
|
2568
2576
|
category: "patent",
|
|
2569
2577
|
execute: ({ editor: e }, t) => {
|
|
2570
|
-
const n = typeof t == "object" && t ? t : {}, r =
|
|
2578
|
+
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
2579
|
if (typeof a != "number") return !1;
|
|
2572
2580
|
const i = e.state.doc.nodeAt(a);
|
|
2573
|
-
return !i || i.type.name !== "patent_section" ? !1 :
|
|
2581
|
+
return !i || i.type.name !== "patent_section" ? !1 : ze(e, {
|
|
2574
2582
|
type: "patent_section",
|
|
2575
2583
|
position: a,
|
|
2576
2584
|
attrs: { collapsed: !i.attrs.collapsed }
|
|
@@ -2579,13 +2587,13 @@ const Ae = () => {
|
|
|
2579
2587
|
}
|
|
2580
2588
|
},
|
|
2581
2589
|
onStateChange: (e) => {
|
|
2582
|
-
|
|
2590
|
+
Va(e), Je(e);
|
|
2583
2591
|
}
|
|
2584
|
-
},
|
|
2585
|
-
|
|
2586
|
-
const
|
|
2592
|
+
}, Ka = [Ca, Sa, _a, Ja];
|
|
2593
|
+
Ka.forEach((e) => B.register(e));
|
|
2594
|
+
const Xa = (e = {}) => {
|
|
2587
2595
|
const t = [
|
|
2588
|
-
...
|
|
2596
|
+
...ba,
|
|
2589
2597
|
...B.getExtensions(),
|
|
2590
2598
|
...e.extensions || []
|
|
2591
2599
|
];
|
|
@@ -2593,42 +2601,42 @@ const Ja = (e = {}) => {
|
|
|
2593
2601
|
...e,
|
|
2594
2602
|
extensions: t
|
|
2595
2603
|
};
|
|
2596
|
-
},
|
|
2604
|
+
}, Ke = (e) => {
|
|
2597
2605
|
const { from: t, to: n } = e.state.selection;
|
|
2598
2606
|
return {
|
|
2599
2607
|
editor: e,
|
|
2600
2608
|
selection: { from: t, to: n },
|
|
2601
2609
|
store: I.getState()
|
|
2602
2610
|
};
|
|
2603
|
-
},
|
|
2604
|
-
execCommand: (t, n, r) => B.executeCommand(t,
|
|
2605
|
-
canExecCommand: (t, n) => B.canExecuteCommand(t,
|
|
2606
|
-
isCommandActive: (t) => B.isCommandActive(t,
|
|
2611
|
+
}, ct = (e) => ({
|
|
2612
|
+
execCommand: (t, n, r) => B.executeCommand(t, Ke(e), n, r),
|
|
2613
|
+
canExecCommand: (t, n) => B.canExecuteCommand(t, Ke(e), n),
|
|
2614
|
+
isCommandActive: (t) => B.isCommandActive(t, Ke(e)),
|
|
2607
2615
|
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
|
-
}),
|
|
2616
|
+
insertNode: (t) => Yt(e, t),
|
|
2617
|
+
updateNodeAttrs: (t) => ze(e, t),
|
|
2618
|
+
removeNode: (t) => Zt(e, t),
|
|
2619
|
+
wrapSelection: (t) => Qt(e, t),
|
|
2620
|
+
applyTransactionBatch: (t) => La(e, t),
|
|
2621
|
+
findNodeByType: (t, n) => st(e, t, n),
|
|
2622
|
+
findAncestorNode: (t) => Re(e, t),
|
|
2623
|
+
findCurrentBlock: () => Ia(e),
|
|
2624
|
+
findNodesByPredicate: (t, n) => Xt(e, t, n)
|
|
2625
|
+
}), Ya = ["history", "text", "structure", "format", "technical", "patent"], Za = {
|
|
2618
2626
|
history: "groupHistory",
|
|
2619
2627
|
text: "groupText",
|
|
2620
2628
|
structure: "groupStructure",
|
|
2621
2629
|
format: "groupFormat",
|
|
2622
2630
|
technical: "groupTechnical",
|
|
2623
2631
|
patent: "groupPatent"
|
|
2624
|
-
},
|
|
2632
|
+
}, Xe = (e, t) => {
|
|
2625
2633
|
if (t) {
|
|
2626
|
-
const n =
|
|
2634
|
+
const n = Za[e];
|
|
2627
2635
|
if (n && typeof t[n] == "string") return t[n];
|
|
2628
2636
|
}
|
|
2629
2637
|
return e.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ");
|
|
2630
|
-
},
|
|
2631
|
-
const [n, r] = $(!1), a =
|
|
2638
|
+
}, Ct = ({ btn: e, items: t }) => {
|
|
2639
|
+
const [n, r] = $(!1), a = W(null), i = W(null), [o, c] = $({ top: 0, left: 0 }), s = ae(() => {
|
|
2632
2640
|
if (!a.current) return;
|
|
2633
2641
|
const l = a.current.getBoundingClientRect();
|
|
2634
2642
|
c({ top: l.bottom + 4, left: l.left });
|
|
@@ -2637,9 +2645,9 @@ const Ja = (e = {}) => {
|
|
|
2637
2645
|
if (!n) return;
|
|
2638
2646
|
s();
|
|
2639
2647
|
const l = (g) => {
|
|
2640
|
-
var
|
|
2648
|
+
var f, p;
|
|
2641
2649
|
const u = g.target;
|
|
2642
|
-
(
|
|
2650
|
+
(f = a.current) != null && f.contains(u) || (p = i.current) != null && p.contains(u) || r(!1);
|
|
2643
2651
|
}, d = () => s();
|
|
2644
2652
|
return document.addEventListener("mousedown", l), window.addEventListener("scroll", d, !0), () => {
|
|
2645
2653
|
document.removeEventListener("mousedown", l), window.removeEventListener("scroll", d, !0);
|
|
@@ -2669,10 +2677,10 @@ const Ja = (e = {}) => {
|
|
|
2669
2677
|
e.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200 text-gray-500"
|
|
2670
2678
|
),
|
|
2671
2679
|
disabled: e.disabled,
|
|
2672
|
-
children: /* @__PURE__ */ m(
|
|
2680
|
+
children: /* @__PURE__ */ m(Ut, { size: 12 })
|
|
2673
2681
|
}
|
|
2674
2682
|
),
|
|
2675
|
-
n &&
|
|
2683
|
+
n && yr(
|
|
2676
2684
|
/* @__PURE__ */ m(
|
|
2677
2685
|
"div",
|
|
2678
2686
|
{
|
|
@@ -2695,21 +2703,21 @@ const Ja = (e = {}) => {
|
|
|
2695
2703
|
document.body
|
|
2696
2704
|
)
|
|
2697
2705
|
] });
|
|
2698
|
-
},
|
|
2706
|
+
}, Qa = ({
|
|
2699
2707
|
editor: e,
|
|
2700
|
-
groupOrder: t =
|
|
2708
|
+
groupOrder: t = Ya,
|
|
2701
2709
|
collapsibleGroups: n = !0,
|
|
2702
2710
|
defaultCollapsedGroups: r = []
|
|
2703
2711
|
}) => {
|
|
2704
|
-
const [a, i] = $(() => new Set(r)), { editorLanguage: o, setEditorLanguage: c } = I(), s =
|
|
2712
|
+
const [a, i] = $(() => new Set(r)), { editorLanguage: o, setEditorLanguage: c } = I(), s = H(o);
|
|
2705
2713
|
if (!e)
|
|
2706
2714
|
return null;
|
|
2707
|
-
const l =
|
|
2715
|
+
const l = ct(e), d = o === "zh", g = [
|
|
2708
2716
|
{
|
|
2709
2717
|
id: "core-undo",
|
|
2710
2718
|
label: s.undo,
|
|
2711
2719
|
group: "history",
|
|
2712
|
-
icon:
|
|
2720
|
+
icon: br,
|
|
2713
2721
|
tooltip: `${s.undo} (Ctrl+Z)`,
|
|
2714
2722
|
isActive: !1,
|
|
2715
2723
|
disabled: !e.can().chain().focus().undo().run(),
|
|
@@ -2721,7 +2729,7 @@ const Ja = (e = {}) => {
|
|
|
2721
2729
|
id: "core-redo",
|
|
2722
2730
|
label: s.redo,
|
|
2723
2731
|
group: "history",
|
|
2724
|
-
icon:
|
|
2732
|
+
icon: vr,
|
|
2725
2733
|
tooltip: `${s.redo} (Ctrl+Y)`,
|
|
2726
2734
|
isActive: !1,
|
|
2727
2735
|
disabled: !e.can().chain().focus().redo().run(),
|
|
@@ -2733,7 +2741,7 @@ const Ja = (e = {}) => {
|
|
|
2733
2741
|
id: "core-bold",
|
|
2734
2742
|
label: s.bold,
|
|
2735
2743
|
group: "text",
|
|
2736
|
-
icon:
|
|
2744
|
+
icon: Dt,
|
|
2737
2745
|
tooltip: s.bold,
|
|
2738
2746
|
isActive: e.isActive("bold"),
|
|
2739
2747
|
disabled: !1,
|
|
@@ -2745,7 +2753,7 @@ const Ja = (e = {}) => {
|
|
|
2745
2753
|
id: "core-italic",
|
|
2746
2754
|
label: s.italic,
|
|
2747
2755
|
group: "text",
|
|
2748
|
-
icon:
|
|
2756
|
+
icon: Rt,
|
|
2749
2757
|
tooltip: s.italic,
|
|
2750
2758
|
isActive: e.isActive("italic"),
|
|
2751
2759
|
disabled: !1,
|
|
@@ -2757,7 +2765,7 @@ const Ja = (e = {}) => {
|
|
|
2757
2765
|
id: "core-underline",
|
|
2758
2766
|
label: s.underline,
|
|
2759
2767
|
group: "text",
|
|
2760
|
-
icon:
|
|
2768
|
+
icon: Mt,
|
|
2761
2769
|
tooltip: s.underline,
|
|
2762
2770
|
isActive: e.isActive("underline"),
|
|
2763
2771
|
disabled: !1,
|
|
@@ -2769,7 +2777,7 @@ const Ja = (e = {}) => {
|
|
|
2769
2777
|
id: "core-strike",
|
|
2770
2778
|
label: s.strike,
|
|
2771
2779
|
group: "text",
|
|
2772
|
-
icon:
|
|
2780
|
+
icon: Ft,
|
|
2773
2781
|
tooltip: s.strike,
|
|
2774
2782
|
isActive: e.isActive("strike"),
|
|
2775
2783
|
disabled: !1,
|
|
@@ -2781,7 +2789,7 @@ const Ja = (e = {}) => {
|
|
|
2781
2789
|
id: "core-code",
|
|
2782
2790
|
label: s.code,
|
|
2783
2791
|
group: "text",
|
|
2784
|
-
icon:
|
|
2792
|
+
icon: $t,
|
|
2785
2793
|
tooltip: s.code,
|
|
2786
2794
|
isActive: e.isActive("code"),
|
|
2787
2795
|
disabled: !1,
|
|
@@ -2793,7 +2801,7 @@ const Ja = (e = {}) => {
|
|
|
2793
2801
|
id: "core-superscript",
|
|
2794
2802
|
label: s.superscript,
|
|
2795
2803
|
group: "text",
|
|
2796
|
-
icon:
|
|
2804
|
+
icon: zt,
|
|
2797
2805
|
tooltip: `${s.superscript} (Ctrl+.)`,
|
|
2798
2806
|
isActive: e.isActive("superscript"),
|
|
2799
2807
|
disabled: !1,
|
|
@@ -2805,7 +2813,7 @@ const Ja = (e = {}) => {
|
|
|
2805
2813
|
id: "core-subscript",
|
|
2806
2814
|
label: s.subscript,
|
|
2807
2815
|
group: "text",
|
|
2808
|
-
icon:
|
|
2816
|
+
icon: Ot,
|
|
2809
2817
|
tooltip: `${s.subscript} (Ctrl+,)`,
|
|
2810
2818
|
isActive: e.isActive("subscript"),
|
|
2811
2819
|
disabled: !1,
|
|
@@ -2817,7 +2825,7 @@ const Ja = (e = {}) => {
|
|
|
2817
2825
|
id: "core-paragraph",
|
|
2818
2826
|
label: s.paragraph,
|
|
2819
2827
|
group: "structure",
|
|
2820
|
-
icon:
|
|
2828
|
+
icon: wr,
|
|
2821
2829
|
tooltip: s.paragraph,
|
|
2822
2830
|
isActive: e.isActive("paragraph"),
|
|
2823
2831
|
disabled: !1,
|
|
@@ -2829,7 +2837,7 @@ const Ja = (e = {}) => {
|
|
|
2829
2837
|
id: "core-heading1",
|
|
2830
2838
|
label: "H1",
|
|
2831
2839
|
group: "structure",
|
|
2832
|
-
icon:
|
|
2840
|
+
icon: xr,
|
|
2833
2841
|
tooltip: s.heading1,
|
|
2834
2842
|
isActive: e.isActive("heading", { level: 1 }),
|
|
2835
2843
|
disabled: !1,
|
|
@@ -2841,7 +2849,7 @@ const Ja = (e = {}) => {
|
|
|
2841
2849
|
id: "core-heading2",
|
|
2842
2850
|
label: "H2",
|
|
2843
2851
|
group: "structure",
|
|
2844
|
-
icon:
|
|
2852
|
+
icon: Cr,
|
|
2845
2853
|
tooltip: s.heading2,
|
|
2846
2854
|
isActive: e.isActive("heading", { level: 2 }),
|
|
2847
2855
|
disabled: !1,
|
|
@@ -2853,7 +2861,7 @@ const Ja = (e = {}) => {
|
|
|
2853
2861
|
id: "core-heading3",
|
|
2854
2862
|
label: "H3",
|
|
2855
2863
|
group: "structure",
|
|
2856
|
-
icon:
|
|
2864
|
+
icon: Tr,
|
|
2857
2865
|
tooltip: s.heading3,
|
|
2858
2866
|
isActive: e.isActive("heading", { level: 3 }),
|
|
2859
2867
|
disabled: !1,
|
|
@@ -2865,7 +2873,7 @@ const Ja = (e = {}) => {
|
|
|
2865
2873
|
id: "core-align-left",
|
|
2866
2874
|
label: s.alignLeft,
|
|
2867
2875
|
group: "format",
|
|
2868
|
-
icon:
|
|
2876
|
+
icon: Sr,
|
|
2869
2877
|
tooltip: s.alignLeft,
|
|
2870
2878
|
isActive: e.isActive({ textAlign: "left" }),
|
|
2871
2879
|
disabled: !1,
|
|
@@ -2877,7 +2885,7 @@ const Ja = (e = {}) => {
|
|
|
2877
2885
|
id: "core-align-center",
|
|
2878
2886
|
label: s.alignCenter,
|
|
2879
2887
|
group: "format",
|
|
2880
|
-
icon:
|
|
2888
|
+
icon: Er,
|
|
2881
2889
|
tooltip: s.alignCenter,
|
|
2882
2890
|
isActive: e.isActive({ textAlign: "center" }),
|
|
2883
2891
|
disabled: !1,
|
|
@@ -2889,7 +2897,7 @@ const Ja = (e = {}) => {
|
|
|
2889
2897
|
id: "core-align-right",
|
|
2890
2898
|
label: s.alignRight,
|
|
2891
2899
|
group: "format",
|
|
2892
|
-
icon:
|
|
2900
|
+
icon: kr,
|
|
2893
2901
|
tooltip: s.alignRight,
|
|
2894
2902
|
isActive: e.isActive({ textAlign: "right" }),
|
|
2895
2903
|
disabled: !1,
|
|
@@ -2901,7 +2909,7 @@ const Ja = (e = {}) => {
|
|
|
2901
2909
|
id: "core-align-justify",
|
|
2902
2910
|
label: s.alignJustify,
|
|
2903
2911
|
group: "format",
|
|
2904
|
-
icon:
|
|
2912
|
+
icon: _r,
|
|
2905
2913
|
tooltip: s.alignJustify,
|
|
2906
2914
|
isActive: e.isActive({ textAlign: "justify" }),
|
|
2907
2915
|
disabled: !1,
|
|
@@ -2913,7 +2921,7 @@ const Ja = (e = {}) => {
|
|
|
2913
2921
|
id: "core-bullet-list",
|
|
2914
2922
|
label: s.bulletList,
|
|
2915
2923
|
group: "structure",
|
|
2916
|
-
icon:
|
|
2924
|
+
icon: Ir,
|
|
2917
2925
|
tooltip: s.bulletList,
|
|
2918
2926
|
isActive: e.isActive("bulletList"),
|
|
2919
2927
|
disabled: !1,
|
|
@@ -2925,7 +2933,7 @@ const Ja = (e = {}) => {
|
|
|
2925
2933
|
id: "core-ordered-list",
|
|
2926
2934
|
label: s.orderedList,
|
|
2927
2935
|
group: "structure",
|
|
2928
|
-
icon:
|
|
2936
|
+
icon: Nr,
|
|
2929
2937
|
tooltip: s.orderedList,
|
|
2930
2938
|
isActive: e.isActive("orderedList"),
|
|
2931
2939
|
disabled: !1,
|
|
@@ -2937,7 +2945,7 @@ const Ja = (e = {}) => {
|
|
|
2937
2945
|
id: "core-blockquote",
|
|
2938
2946
|
label: s.blockquote,
|
|
2939
2947
|
group: "structure",
|
|
2940
|
-
icon:
|
|
2948
|
+
icon: Ar,
|
|
2941
2949
|
tooltip: s.blockquote,
|
|
2942
2950
|
isActive: e.isActive("blockquote"),
|
|
2943
2951
|
disabled: !1,
|
|
@@ -2949,7 +2957,7 @@ const Ja = (e = {}) => {
|
|
|
2949
2957
|
id: "core-code-block",
|
|
2950
2958
|
label: s.codeBlock,
|
|
2951
2959
|
group: "structure",
|
|
2952
|
-
icon:
|
|
2960
|
+
icon: Lr,
|
|
2953
2961
|
tooltip: s.codeBlock,
|
|
2954
2962
|
isActive: e.isActive("codeBlock"),
|
|
2955
2963
|
disabled: !1,
|
|
@@ -2961,7 +2969,7 @@ const Ja = (e = {}) => {
|
|
|
2961
2969
|
id: "core-table",
|
|
2962
2970
|
label: s.insertTable,
|
|
2963
2971
|
group: "structure",
|
|
2964
|
-
icon:
|
|
2972
|
+
icon: Pr,
|
|
2965
2973
|
tooltip: s.insertTable,
|
|
2966
2974
|
isActive: !1,
|
|
2967
2975
|
disabled: !1,
|
|
@@ -2973,7 +2981,7 @@ const Ja = (e = {}) => {
|
|
|
2973
2981
|
id: "core-horizontal-rule",
|
|
2974
2982
|
label: s.horizontalRule,
|
|
2975
2983
|
group: "structure",
|
|
2976
|
-
icon:
|
|
2984
|
+
icon: Dr,
|
|
2977
2985
|
tooltip: s.horizontalRule,
|
|
2978
2986
|
isActive: !1,
|
|
2979
2987
|
disabled: !1,
|
|
@@ -2985,7 +2993,7 @@ const Ja = (e = {}) => {
|
|
|
2985
2993
|
id: "core-task-list",
|
|
2986
2994
|
label: s.taskList,
|
|
2987
2995
|
group: "structure",
|
|
2988
|
-
icon:
|
|
2996
|
+
icon: Rr,
|
|
2989
2997
|
tooltip: s.taskList,
|
|
2990
2998
|
isActive: e.isActive("taskList"),
|
|
2991
2999
|
disabled: !1,
|
|
@@ -2994,21 +3002,21 @@ const Ja = (e = {}) => {
|
|
|
2994
3002
|
}
|
|
2995
3003
|
}
|
|
2996
3004
|
], u = {
|
|
2997
|
-
GitGraph:
|
|
2998
|
-
Sigma:
|
|
2999
|
-
FunctionSquare:
|
|
3000
|
-
Workflow:
|
|
3001
|
-
Box:
|
|
3002
|
-
FileText:
|
|
3003
|
-
Link2:
|
|
3004
|
-
Image:
|
|
3005
|
-
},
|
|
3005
|
+
GitGraph: Or,
|
|
3006
|
+
Sigma: zr,
|
|
3007
|
+
FunctionSquare: $r,
|
|
3008
|
+
Workflow: Fr,
|
|
3009
|
+
Box: Mr,
|
|
3010
|
+
FileText: qt,
|
|
3011
|
+
Link2: Ht,
|
|
3012
|
+
Image: Bt
|
|
3013
|
+
}, f = B.getToolbarItems().map((v) => {
|
|
3006
3014
|
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
3015
|
return {
|
|
3008
3016
|
id: v.id,
|
|
3009
3017
|
label: v.label,
|
|
3010
3018
|
group: v.group || "technical",
|
|
3011
|
-
icon: v.icon ? u[v.icon] ||
|
|
3019
|
+
icon: v.icon ? u[v.icon] || mt : mt,
|
|
3012
3020
|
isActive: l.isCommandActive(v.command),
|
|
3013
3021
|
disabled: !l.canExecCommand(v.command),
|
|
3014
3022
|
tooltip: A,
|
|
@@ -3016,9 +3024,9 @@ const Ja = (e = {}) => {
|
|
|
3016
3024
|
l.execCommand(v.command);
|
|
3017
3025
|
}
|
|
3018
3026
|
};
|
|
3019
|
-
}),
|
|
3027
|
+
}), p = [...g, ...f], b = p.map((v) => v.group).filter((v, _, C) => C.indexOf(v) === _ && !t.includes(v)), y = [...t, ...b].map((v) => ({
|
|
3020
3028
|
group: v,
|
|
3021
|
-
items:
|
|
3029
|
+
items: p.filter((_) => _.group === v)
|
|
3022
3030
|
})).filter((v) => v.items.length > 0), E = (v) => {
|
|
3023
3031
|
i((_) => {
|
|
3024
3032
|
const C = new Set(_);
|
|
@@ -3040,7 +3048,7 @@ const Ja = (e = {}) => {
|
|
|
3040
3048
|
{ label: s.insertImageFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "image" }) },
|
|
3041
3049
|
{ label: s.insertMermaidFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "mermaid" }) },
|
|
3042
3050
|
{ label: s.insertDrawioFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "drawio" }) }
|
|
3043
|
-
], T = (v) => v.id === "core-table" ? /* @__PURE__ */ m(
|
|
3051
|
+
], T = (v) => v.id === "core-table" ? /* @__PURE__ */ m(Ct, { btn: v, items: x }, v.id) : v.id === "patent-figure-insert" ? /* @__PURE__ */ m(Ct, { btn: v, items: w }, v.id) : /* @__PURE__ */ m(
|
|
3044
3052
|
"button",
|
|
3045
3053
|
{
|
|
3046
3054
|
onClick: v.run,
|
|
@@ -3083,16 +3091,16 @@ const Ja = (e = {}) => {
|
|
|
3083
3091
|
E(v.group);
|
|
3084
3092
|
},
|
|
3085
3093
|
className: "px-2 py-1 text-xs rounded bg-gray-200 text-gray-700 hover:bg-gray-300",
|
|
3086
|
-
title: _ ? `${s.expand} ${
|
|
3087
|
-
children:
|
|
3094
|
+
title: _ ? `${s.expand} ${Xe(v.group, s)}` : `${s.collapse} ${Xe(v.group, s)}`,
|
|
3095
|
+
children: Xe(v.group, s)
|
|
3088
3096
|
}
|
|
3089
3097
|
),
|
|
3090
3098
|
(!n || !_) && v.items.map(T)
|
|
3091
3099
|
] }, v.group);
|
|
3092
3100
|
})
|
|
3093
3101
|
] }) });
|
|
3094
|
-
},
|
|
3095
|
-
const [t, n] = $(0), [r, a] = $(""), i = I((w) => w.editorLanguage), o =
|
|
3102
|
+
}, ei = ({ editor: e }) => {
|
|
3103
|
+
const [t, n] = $(0), [r, a] = $(""), i = I((w) => w.editorLanguage), o = H(i);
|
|
3096
3104
|
if (M(() => {
|
|
3097
3105
|
if (!e) return;
|
|
3098
3106
|
const w = () => n((T) => T + 1);
|
|
@@ -3100,14 +3108,14 @@ const Ja = (e = {}) => {
|
|
|
3100
3108
|
e.off("selectionUpdate", w), e.off("update", w);
|
|
3101
3109
|
};
|
|
3102
3110
|
}, [e]), !e) return null;
|
|
3103
|
-
const c =
|
|
3111
|
+
const c = ct(e), s = [];
|
|
3104
3112
|
e.state.doc.descendants((w) => {
|
|
3105
3113
|
if (w.type.name !== "figure") return !0;
|
|
3106
3114
|
const T = typeof w.attrs.id == "string" ? w.attrs.id.trim() : "";
|
|
3107
3115
|
return T && s.push({ id: T, label: T }), !0;
|
|
3108
3116
|
});
|
|
3109
|
-
const l = c.findAncestorNode("figure"), d = !!l, g = l && typeof l.node.attrs.id == "string" ? l.node.attrs.id.trim() : "", u = l && typeof l.node.attrs.contentType == "string" ? l.node.attrs.contentType : "image", [
|
|
3110
|
-
y !== h.current && (h.current = y, d && g !==
|
|
3117
|
+
const l = c.findAncestorNode("figure"), d = !!l, g = l && typeof l.node.attrs.id == "string" ? l.node.attrs.id.trim() : "", u = l && typeof l.node.attrs.contentType == "string" ? l.node.attrs.contentType : "image", [f, p] = $(""), b = W(null), h = W(null), y = (l == null ? void 0 : l.pos) ?? null;
|
|
3118
|
+
y !== h.current && (h.current = y, d && g !== f && p(g));
|
|
3111
3119
|
const E = (w) => {
|
|
3112
3120
|
l && c.execCommand("patent.updateFigure", {
|
|
3113
3121
|
position: l.pos,
|
|
@@ -3115,14 +3123,14 @@ const Ja = (e = {}) => {
|
|
|
3115
3123
|
});
|
|
3116
3124
|
}, x = () => {
|
|
3117
3125
|
if (!l) return;
|
|
3118
|
-
const w =
|
|
3126
|
+
const w = f.trim();
|
|
3119
3127
|
w !== g && c.execCommand("patent.updateFigure", {
|
|
3120
3128
|
position: l.pos,
|
|
3121
3129
|
id: w
|
|
3122
3130
|
});
|
|
3123
3131
|
};
|
|
3124
3132
|
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(
|
|
3133
|
+
s.length > 0 && /* @__PURE__ */ L(je, { children: [
|
|
3126
3134
|
/* @__PURE__ */ m("span", { className: "text-xs text-gray-500", children: o.figureReferenceTarget }),
|
|
3127
3135
|
/* @__PURE__ */ L(
|
|
3128
3136
|
"select",
|
|
@@ -3147,12 +3155,12 @@ const Ja = (e = {}) => {
|
|
|
3147
3155
|
},
|
|
3148
3156
|
className: "p-2 hover:bg-blue-50 text-blue-600 rounded",
|
|
3149
3157
|
title: o.insertFigureReference,
|
|
3150
|
-
children: /* @__PURE__ */ m(
|
|
3158
|
+
children: /* @__PURE__ */ m(Bt, { size: 16 })
|
|
3151
3159
|
}
|
|
3152
3160
|
)
|
|
3153
3161
|
] }),
|
|
3154
3162
|
/* @__PURE__ */ m("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
|
|
3155
|
-
d && /* @__PURE__ */ L(
|
|
3163
|
+
d && /* @__PURE__ */ L(je, { children: [
|
|
3156
3164
|
/* @__PURE__ */ m("span", { className: "text-xs font-medium text-gray-700", children: o.currentFigure }),
|
|
3157
3165
|
/* @__PURE__ */ m("span", { className: "text-xs text-gray-500", children: o.figureId }),
|
|
3158
3166
|
/* @__PURE__ */ m(
|
|
@@ -3160,8 +3168,8 @@ const Ja = (e = {}) => {
|
|
|
3160
3168
|
{
|
|
3161
3169
|
ref: b,
|
|
3162
3170
|
type: "text",
|
|
3163
|
-
value:
|
|
3164
|
-
onChange: (w) =>
|
|
3171
|
+
value: f,
|
|
3172
|
+
onChange: (w) => p(w.target.value),
|
|
3165
3173
|
onBlur: x,
|
|
3166
3174
|
onKeyDown: (w) => {
|
|
3167
3175
|
w.key === "Enter" && (x(), w.target.blur());
|
|
@@ -3188,7 +3196,7 @@ const Ja = (e = {}) => {
|
|
|
3188
3196
|
] }),
|
|
3189
3197
|
e.isActive("image") && (() => {
|
|
3190
3198
|
const T = e.getAttributes("image").width || "";
|
|
3191
|
-
return /* @__PURE__ */ L(
|
|
3199
|
+
return /* @__PURE__ */ L(je, { children: [
|
|
3192
3200
|
/* @__PURE__ */ m("span", { className: "text-xs font-medium text-gray-700", children: i === "zh" ? "图片" : "Image" }),
|
|
3193
3201
|
["25%", "50%", "75%", "100%"].map((_) => /* @__PURE__ */ m(
|
|
3194
3202
|
"button",
|
|
@@ -3212,11 +3220,11 @@ const Ja = (e = {}) => {
|
|
|
3212
3220
|
},
|
|
3213
3221
|
className: "p-2 hover:bg-red-50 text-red-600 rounded",
|
|
3214
3222
|
title: o.deleteSelection,
|
|
3215
|
-
children: /* @__PURE__ */ m(
|
|
3223
|
+
children: /* @__PURE__ */ m(Br, { size: 16 })
|
|
3216
3224
|
}
|
|
3217
3225
|
)
|
|
3218
3226
|
] }) });
|
|
3219
|
-
},
|
|
3227
|
+
}, sn = {
|
|
3220
3228
|
// Invention & Utility Model
|
|
3221
3229
|
technical_field: [],
|
|
3222
3230
|
background_art: ["technical_field"],
|
|
@@ -3234,10 +3242,10 @@ const Ja = (e = {}) => {
|
|
|
3234
3242
|
design_views: ["design_description"],
|
|
3235
3243
|
design_brief: ["design_description", "design_views"]
|
|
3236
3244
|
};
|
|
3237
|
-
function
|
|
3238
|
-
return (
|
|
3245
|
+
function Us(e, t) {
|
|
3246
|
+
return (sn[e] || []).filter((r) => !t.has(r));
|
|
3239
3247
|
}
|
|
3240
|
-
function
|
|
3248
|
+
function ti(e) {
|
|
3241
3249
|
const t = [];
|
|
3242
3250
|
return e.state.doc.descendants((n, r) => n.type.name === "patent_title" ? (t.push({
|
|
3243
3251
|
sectionType: "patent_title",
|
|
@@ -3249,7 +3257,7 @@ function Qa(e) {
|
|
|
3249
3257
|
content: n.textContent || ""
|
|
3250
3258
|
}), !1) : !0), t;
|
|
3251
3259
|
}
|
|
3252
|
-
function
|
|
3260
|
+
function on(e) {
|
|
3253
3261
|
const { from: t } = e.state.selection, n = e.state.doc.resolve(t);
|
|
3254
3262
|
for (let r = n.depth; r >= 0; r--) {
|
|
3255
3263
|
const a = n.node(r);
|
|
@@ -3268,10 +3276,10 @@ function rn(e) {
|
|
|
3268
3276
|
}
|
|
3269
3277
|
return null;
|
|
3270
3278
|
}
|
|
3271
|
-
function
|
|
3272
|
-
const n =
|
|
3279
|
+
function ni(e, t) {
|
|
3280
|
+
const n = sn[t];
|
|
3273
3281
|
if (!n || n.length === 0) return [];
|
|
3274
|
-
const r =
|
|
3282
|
+
const r = ti(e), a = new Map(r.map((i) => [i.sectionType, i]));
|
|
3275
3283
|
return n.map((i) => {
|
|
3276
3284
|
const o = a.get(i);
|
|
3277
3285
|
return !o || o.content.trim().length === 0 ? null : {
|
|
@@ -3280,18 +3288,18 @@ function ei(e, t) {
|
|
|
3280
3288
|
};
|
|
3281
3289
|
}).filter((i) => i !== null && i.content.length > 0);
|
|
3282
3290
|
}
|
|
3283
|
-
function
|
|
3291
|
+
function Ws(e, t = {}) {
|
|
3284
3292
|
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
3293
|
let o = t.sectionType, c = t.targetSectionPos;
|
|
3286
3294
|
if (!o) {
|
|
3287
|
-
const g =
|
|
3295
|
+
const g = on(e);
|
|
3288
3296
|
g && (o = g.sectionType, c = g.pos);
|
|
3289
3297
|
}
|
|
3290
|
-
const s = t.scope || (o ? "section" : i ? "selection" : "document"), l = o ?
|
|
3298
|
+
const s = t.scope || (o ? "section" : i ? "selection" : "document"), l = o ? ni(e, o) : void 0;
|
|
3291
3299
|
let d;
|
|
3292
3300
|
if (s === "selection" && r !== a) {
|
|
3293
|
-
const u = Math.max(0, r - 200),
|
|
3294
|
-
d = `...${
|
|
3301
|
+
const u = Math.max(0, r - 200), f = Math.min(e.state.doc.content.size, a + 200), p = e.state.doc.textBetween(u, r, " ", "\0"), b = e.state.doc.textBetween(a, f, " ", "\0");
|
|
3302
|
+
d = `...${p}[SELECTED]${b}...`;
|
|
3295
3303
|
}
|
|
3296
3304
|
return {
|
|
3297
3305
|
scope: s,
|
|
@@ -3304,14 +3312,14 @@ function qs(e, t = {}) {
|
|
|
3304
3312
|
language: n
|
|
3305
3313
|
};
|
|
3306
3314
|
}
|
|
3307
|
-
const
|
|
3315
|
+
const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
3308
3316
|
const { addChatReference: n, openChatPanel: r, editorLanguage: a } = I(), i = a === "zh", o = (l) => Y(
|
|
3309
3317
|
"p-1.5 rounded transition-colors",
|
|
3310
3318
|
l ? "bg-blue-100 text-blue-600" : "text-gray-600 hover:bg-gray-100"
|
|
3311
3319
|
), c = () => {
|
|
3312
3320
|
const { from: l, to: d } = e.state.selection;
|
|
3313
3321
|
if (l === d) return;
|
|
3314
|
-
const g = e.state.doc.textBetween(l, d, " "), u =
|
|
3322
|
+
const g = e.state.doc.textBetween(l, d, " "), u = on(e);
|
|
3315
3323
|
if (t) {
|
|
3316
3324
|
t({ text: g, from: l, to: d, sectionType: u == null ? void 0 : u.sectionType });
|
|
3317
3325
|
return;
|
|
@@ -3322,7 +3330,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3322
3330
|
d !== null && (d === "" ? e.chain().focus().extendMarkRange("link").unsetLink().run() : e.chain().focus().extendMarkRange("link").setLink({ href: d }).run());
|
|
3323
3331
|
};
|
|
3324
3332
|
return /* @__PURE__ */ m(
|
|
3325
|
-
|
|
3333
|
+
Kr,
|
|
3326
3334
|
{
|
|
3327
3335
|
editor: e,
|
|
3328
3336
|
shouldShow: ({ editor: l, state: d }) => {
|
|
@@ -3336,7 +3344,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3336
3344
|
onClick: () => e.chain().focus().toggleBold().run(),
|
|
3337
3345
|
className: o(e.isActive("bold")),
|
|
3338
3346
|
title: "Bold",
|
|
3339
|
-
children: /* @__PURE__ */ m(
|
|
3347
|
+
children: /* @__PURE__ */ m(Dt, { size: 15 })
|
|
3340
3348
|
}
|
|
3341
3349
|
),
|
|
3342
3350
|
/* @__PURE__ */ m(
|
|
@@ -3345,7 +3353,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3345
3353
|
onClick: () => e.chain().focus().toggleItalic().run(),
|
|
3346
3354
|
className: o(e.isActive("italic")),
|
|
3347
3355
|
title: "Italic",
|
|
3348
|
-
children: /* @__PURE__ */ m(
|
|
3356
|
+
children: /* @__PURE__ */ m(Rt, { size: 15 })
|
|
3349
3357
|
}
|
|
3350
3358
|
),
|
|
3351
3359
|
/* @__PURE__ */ m(
|
|
@@ -3354,7 +3362,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3354
3362
|
onClick: () => e.chain().focus().toggleUnderline().run(),
|
|
3355
3363
|
className: o(e.isActive("underline")),
|
|
3356
3364
|
title: "Underline",
|
|
3357
|
-
children: /* @__PURE__ */ m(
|
|
3365
|
+
children: /* @__PURE__ */ m(Mt, { size: 15 })
|
|
3358
3366
|
}
|
|
3359
3367
|
),
|
|
3360
3368
|
/* @__PURE__ */ m(
|
|
@@ -3363,7 +3371,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3363
3371
|
onClick: () => e.chain().focus().toggleStrike().run(),
|
|
3364
3372
|
className: o(e.isActive("strike")),
|
|
3365
3373
|
title: "Strikethrough",
|
|
3366
|
-
children: /* @__PURE__ */ m(
|
|
3374
|
+
children: /* @__PURE__ */ m(Ft, { size: 15 })
|
|
3367
3375
|
}
|
|
3368
3376
|
),
|
|
3369
3377
|
/* @__PURE__ */ m(
|
|
@@ -3372,7 +3380,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3372
3380
|
onClick: () => e.chain().focus().toggleCode().run(),
|
|
3373
3381
|
className: o(e.isActive("code")),
|
|
3374
3382
|
title: "Code",
|
|
3375
|
-
children: /* @__PURE__ */ m(
|
|
3383
|
+
children: /* @__PURE__ */ m($t, { size: 15 })
|
|
3376
3384
|
}
|
|
3377
3385
|
),
|
|
3378
3386
|
/* @__PURE__ */ m(
|
|
@@ -3381,7 +3389,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3381
3389
|
onClick: () => e.chain().focus().toggleSuperscript().run(),
|
|
3382
3390
|
className: o(e.isActive("superscript")),
|
|
3383
3391
|
title: "Superscript",
|
|
3384
|
-
children: /* @__PURE__ */ m(
|
|
3392
|
+
children: /* @__PURE__ */ m(zt, { size: 15 })
|
|
3385
3393
|
}
|
|
3386
3394
|
),
|
|
3387
3395
|
/* @__PURE__ */ m(
|
|
@@ -3390,7 +3398,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3390
3398
|
onClick: () => e.chain().focus().toggleSubscript().run(),
|
|
3391
3399
|
className: o(e.isActive("subscript")),
|
|
3392
3400
|
title: "Subscript",
|
|
3393
|
-
children: /* @__PURE__ */ m(
|
|
3401
|
+
children: /* @__PURE__ */ m(Ot, { size: 15 })
|
|
3394
3402
|
}
|
|
3395
3403
|
),
|
|
3396
3404
|
/* @__PURE__ */ m("div", { className: "bubble-menu-divider" }),
|
|
@@ -3400,7 +3408,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3400
3408
|
onClick: () => e.chain().focus().toggleHighlight().run(),
|
|
3401
3409
|
className: o(e.isActive("highlight")),
|
|
3402
3410
|
title: "Highlight",
|
|
3403
|
-
children: /* @__PURE__ */ m(
|
|
3411
|
+
children: /* @__PURE__ */ m(Hr, { size: 15 })
|
|
3404
3412
|
}
|
|
3405
3413
|
),
|
|
3406
3414
|
/* @__PURE__ */ m(
|
|
@@ -3409,7 +3417,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3409
3417
|
onClick: s,
|
|
3410
3418
|
className: o(e.isActive("link")),
|
|
3411
3419
|
title: "Link",
|
|
3412
|
-
children: /* @__PURE__ */ m(
|
|
3420
|
+
children: /* @__PURE__ */ m(Ht, { size: 15 })
|
|
3413
3421
|
}
|
|
3414
3422
|
),
|
|
3415
3423
|
/* @__PURE__ */ m("div", { className: "bubble-menu-divider" }),
|
|
@@ -3419,15 +3427,15 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3419
3427
|
onClick: c,
|
|
3420
3428
|
className: "p-1.5 rounded transition-colors text-purple-500 hover:bg-purple-50",
|
|
3421
3429
|
title: i ? "AI 优化" : "AI Optimize",
|
|
3422
|
-
children: /* @__PURE__ */ m(
|
|
3430
|
+
children: /* @__PURE__ */ m(qr, { size: 15 })
|
|
3423
3431
|
}
|
|
3424
3432
|
)
|
|
3425
3433
|
] })
|
|
3426
3434
|
}
|
|
3427
3435
|
);
|
|
3428
|
-
},
|
|
3436
|
+
}, ai = ({ editor: e }) => {
|
|
3429
3437
|
var E;
|
|
3430
|
-
const [t, n] = $(!1), [r, a] = $(!1), [i, o] = $(""), [c, s] = $(""), [l, d] = $(!1), g =
|
|
3438
|
+
const [t, n] = $(!1), [r, a] = $(!1), [i, o] = $(""), [c, s] = $(""), [l, d] = $(!1), g = W(null), u = e.extensionStorage.searchReplace, f = ((E = u == null ? void 0 : u.results) == null ? void 0 : E.length) ?? 0, p = (u == null ? void 0 : u.currentIndex) ?? -1;
|
|
3431
3439
|
M(() => {
|
|
3432
3440
|
const x = (w) => {
|
|
3433
3441
|
n(!0);
|
|
@@ -3474,7 +3482,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3474
3482
|
className: "find-replace-input"
|
|
3475
3483
|
}
|
|
3476
3484
|
),
|
|
3477
|
-
/* @__PURE__ */ m("span", { className: "find-replace-count", children:
|
|
3485
|
+
/* @__PURE__ */ m("span", { className: "find-replace-count", children: f > 0 ? `${p + 1}/${f}` : i ? "0" : "" })
|
|
3478
3486
|
] }),
|
|
3479
3487
|
/* @__PURE__ */ m(
|
|
3480
3488
|
"button",
|
|
@@ -3482,21 +3490,21 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3482
3490
|
onClick: y,
|
|
3483
3491
|
className: Y("find-replace-btn", l && "find-replace-btn--active"),
|
|
3484
3492
|
title: "Case Sensitive",
|
|
3485
|
-
children: /* @__PURE__ */ m(
|
|
3493
|
+
children: /* @__PURE__ */ m(Ur, { size: 15 })
|
|
3486
3494
|
}
|
|
3487
3495
|
),
|
|
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(
|
|
3496
|
+
/* @__PURE__ */ m("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ m(Wr, { size: 15 }) }),
|
|
3497
|
+
/* @__PURE__ */ m("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ m(Ut, { size: 15 }) }),
|
|
3490
3498
|
/* @__PURE__ */ m(
|
|
3491
3499
|
"button",
|
|
3492
3500
|
{
|
|
3493
3501
|
onClick: () => a((x) => !x),
|
|
3494
3502
|
className: Y("find-replace-btn", r && "find-replace-btn--active"),
|
|
3495
3503
|
title: "Toggle Replace",
|
|
3496
|
-
children: /* @__PURE__ */ m(
|
|
3504
|
+
children: /* @__PURE__ */ m(gt, { size: 15 })
|
|
3497
3505
|
}
|
|
3498
3506
|
),
|
|
3499
|
-
/* @__PURE__ */ m("button", { onClick: h, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ m(
|
|
3507
|
+
/* @__PURE__ */ m("button", { onClick: h, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ m(jr, { size: 15 }) })
|
|
3500
3508
|
] }),
|
|
3501
3509
|
r && /* @__PURE__ */ L("div", { className: "find-replace-row", children: [
|
|
3502
3510
|
/* @__PURE__ */ m(
|
|
@@ -3514,12 +3522,12 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3514
3522
|
className: "find-replace-input"
|
|
3515
3523
|
}
|
|
3516
3524
|
),
|
|
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(
|
|
3525
|
+
/* @__PURE__ */ m("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ m(gt, { size: 15 }) }),
|
|
3526
|
+
/* @__PURE__ */ m("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ m(Gr, { size: 15 }) })
|
|
3519
3527
|
] })
|
|
3520
3528
|
] }) : null;
|
|
3521
|
-
},
|
|
3522
|
-
const { editorLanguage: t } = I(), n = t === "zh", r =
|
|
3529
|
+
}, ii = ({ editor: e }) => {
|
|
3530
|
+
const { editorLanguage: t } = I(), n = t === "zh", r = At(() => {
|
|
3523
3531
|
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
3532
|
let l = 0;
|
|
3525
3533
|
return c !== s && (l = a.doc.textBetween(c, s, " ", "\0").replace(/\s/g, "").length), { charCount: o, selectionCount: l };
|
|
@@ -3536,27 +3544,27 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3536
3544
|
r.selectionCount
|
|
3537
3545
|
] })
|
|
3538
3546
|
] });
|
|
3539
|
-
},
|
|
3547
|
+
}, si = {
|
|
3540
3548
|
empty: "○",
|
|
3541
3549
|
filled: "●"
|
|
3542
|
-
},
|
|
3550
|
+
}, oi = {
|
|
3543
3551
|
empty: "text-gray-400",
|
|
3544
3552
|
filled: "text-green-500"
|
|
3545
|
-
},
|
|
3553
|
+
}, ci = /* @__PURE__ */ new Set([
|
|
3546
3554
|
"technical_field",
|
|
3547
3555
|
"background_art",
|
|
3548
3556
|
"summary",
|
|
3549
3557
|
"drawing_description",
|
|
3550
3558
|
"detailed_description"
|
|
3551
|
-
]),
|
|
3552
|
-
const { editorLanguage: t } = I(), n =
|
|
3559
|
+
]), li = ({ editor: e }) => {
|
|
3560
|
+
const { editorLanguage: t } = I(), n = H(t), [r, a] = $(!1), [i, o] = $(0);
|
|
3553
3561
|
M(() => {
|
|
3554
3562
|
const s = () => o((l) => l + 1);
|
|
3555
3563
|
return e.on("update", s), () => {
|
|
3556
3564
|
e.off("update", s);
|
|
3557
3565
|
};
|
|
3558
3566
|
}, [e]);
|
|
3559
|
-
const c =
|
|
3567
|
+
const c = At(() => {
|
|
3560
3568
|
const s = [];
|
|
3561
3569
|
let l = !1;
|
|
3562
3570
|
return e.state.doc.descendants((d, g) => {
|
|
@@ -3570,35 +3578,35 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3570
3578
|
charCount: 0
|
|
3571
3579
|
}), l = !0;
|
|
3572
3580
|
}
|
|
3573
|
-
const u = d.textContent || "",
|
|
3581
|
+
const u = d.textContent || "", f = u.trim().length > 0, p = typeof n.patentTitlePlaceholder == "string" ? n.patentTitlePlaceholder : "Patent Title";
|
|
3574
3582
|
return s.push({
|
|
3575
3583
|
type: "section",
|
|
3576
3584
|
pos: g,
|
|
3577
|
-
title:
|
|
3578
|
-
state:
|
|
3585
|
+
title: f ? u.trim() : p,
|
|
3586
|
+
state: f ? "filled" : "empty",
|
|
3579
3587
|
charCount: u.replace(/\s/g, "").length,
|
|
3580
3588
|
indent: !0
|
|
3581
3589
|
}), !1;
|
|
3582
3590
|
}
|
|
3583
3591
|
if (d.type.name === "patent_section") {
|
|
3584
|
-
const u = d.attrs.sectionType,
|
|
3592
|
+
const u = d.attrs.sectionType, f = ci.has(u), p = `sectionTitle_${u}`, b = typeof n[p] == "string" ? n[p] : u, h = d.textContent || "", y = h.trim().length > 0;
|
|
3585
3593
|
return s.push({
|
|
3586
3594
|
type: "section",
|
|
3587
3595
|
pos: g,
|
|
3588
3596
|
title: b,
|
|
3589
3597
|
state: y ? "filled" : "empty",
|
|
3590
3598
|
charCount: h.replace(/\s/g, "").length,
|
|
3591
|
-
indent:
|
|
3599
|
+
indent: f
|
|
3592
3600
|
}), !1;
|
|
3593
3601
|
}
|
|
3594
3602
|
if (d.type.name === "heading") {
|
|
3595
|
-
const u = d.attrs.level,
|
|
3596
|
-
return
|
|
3603
|
+
const u = d.attrs.level, f = d.textContent || "";
|
|
3604
|
+
return f.trim() && s.push({
|
|
3597
3605
|
type: "heading",
|
|
3598
3606
|
pos: g,
|
|
3599
|
-
title:
|
|
3607
|
+
title: f,
|
|
3600
3608
|
level: u,
|
|
3601
|
-
charCount:
|
|
3609
|
+
charCount: f.replace(/\s/g, "").length
|
|
3602
3610
|
}), !1;
|
|
3603
3611
|
}
|
|
3604
3612
|
return !0;
|
|
@@ -3610,11 +3618,11 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3610
3618
|
onClick: () => a(!1),
|
|
3611
3619
|
className: "outline-panel-toggle",
|
|
3612
3620
|
title: t === "zh" ? "展开大纲" : "Expand Outline",
|
|
3613
|
-
children: /* @__PURE__ */ m(
|
|
3621
|
+
children: /* @__PURE__ */ m(Vr, { size: 16 })
|
|
3614
3622
|
}
|
|
3615
3623
|
) }) : /* @__PURE__ */ L("div", { className: "outline-panel", children: [
|
|
3616
3624
|
/* @__PURE__ */ L("div", { className: "outline-panel-header", children: [
|
|
3617
|
-
/* @__PURE__ */ m(
|
|
3625
|
+
/* @__PURE__ */ m(qt, { size: 14 }),
|
|
3618
3626
|
/* @__PURE__ */ m("span", { children: t === "zh" ? "文档大纲" : "Outline" }),
|
|
3619
3627
|
/* @__PURE__ */ m(
|
|
3620
3628
|
"button",
|
|
@@ -3622,7 +3630,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3622
3630
|
onClick: () => a(!0),
|
|
3623
3631
|
className: "outline-panel-toggle ml-auto",
|
|
3624
3632
|
title: t === "zh" ? "收起大纲" : "Collapse Outline",
|
|
3625
|
-
children: /* @__PURE__ */ m(
|
|
3633
|
+
children: /* @__PURE__ */ m(Jr, { size: 14 })
|
|
3626
3634
|
}
|
|
3627
3635
|
)
|
|
3628
3636
|
] }),
|
|
@@ -3644,7 +3652,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3644
3652
|
}));
|
|
3645
3653
|
},
|
|
3646
3654
|
children: [
|
|
3647
|
-
s.type === "section" && s.state && /* @__PURE__ */ m("span", { className: Y("outline-item-state",
|
|
3655
|
+
s.type === "section" && s.state && /* @__PURE__ */ m("span", { className: Y("outline-item-state", oi[s.state]), children: si[s.state] || "○" }),
|
|
3648
3656
|
/* @__PURE__ */ m("span", { className: "outline-item-title", children: s.title }),
|
|
3649
3657
|
s.type !== "book-group" && /* @__PURE__ */ m("span", { className: "outline-item-count", children: s.charCount })
|
|
3650
3658
|
]
|
|
@@ -3653,7 +3661,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3653
3661
|
))
|
|
3654
3662
|
] })
|
|
3655
3663
|
] });
|
|
3656
|
-
},
|
|
3664
|
+
}, di = ({
|
|
3657
3665
|
editor: e,
|
|
3658
3666
|
mode: t = "edit",
|
|
3659
3667
|
className: n
|
|
@@ -3667,16 +3675,16 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3667
3675
|
t === "readonly" ? "cursor-default" : "cursor-text",
|
|
3668
3676
|
n
|
|
3669
3677
|
),
|
|
3670
|
-
children: /* @__PURE__ */ m(
|
|
3678
|
+
children: /* @__PURE__ */ m(In, { editor: e, className: "h-full" })
|
|
3671
3679
|
}
|
|
3672
|
-
)),
|
|
3680
|
+
)), cn = "patent-editor-draft", ui = 1500, mi = () => {
|
|
3673
3681
|
try {
|
|
3674
|
-
const e = localStorage.getItem(
|
|
3682
|
+
const e = localStorage.getItem(cn);
|
|
3675
3683
|
return e ? JSON.parse(e) : null;
|
|
3676
3684
|
} catch {
|
|
3677
3685
|
return null;
|
|
3678
3686
|
}
|
|
3679
|
-
},
|
|
3687
|
+
}, gi = ({
|
|
3680
3688
|
initialContent: e,
|
|
3681
3689
|
onChange: t,
|
|
3682
3690
|
className: n,
|
|
@@ -3685,7 +3693,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3685
3693
|
onEditorReady: i,
|
|
3686
3694
|
onSelectionOptimize: o
|
|
3687
3695
|
}) => {
|
|
3688
|
-
const { setEditor: c, setDocument: s, editorLanguage: l, autoSaveStatus: d, ai: g } = I(), { setAutoSaveStatus: u, setLastSavedAt:
|
|
3696
|
+
const { setEditor: c, setDocument: s, editorLanguage: l, autoSaveStatus: d, ai: g } = I(), { setAutoSaveStatus: u, setLastSavedAt: f } = I(), p = W(null), b = e || (t ? null : mi()) || {
|
|
3689
3697
|
type: "doc",
|
|
3690
3698
|
content: [
|
|
3691
3699
|
{
|
|
@@ -3695,18 +3703,18 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3695
3703
|
]
|
|
3696
3704
|
}, h = ae((T) => {
|
|
3697
3705
|
try {
|
|
3698
|
-
u("saving"), localStorage.setItem(
|
|
3706
|
+
u("saving"), localStorage.setItem(cn, JSON.stringify(T)), u("saved"), f(/* @__PURE__ */ new Date());
|
|
3699
3707
|
} catch {
|
|
3700
3708
|
u("error");
|
|
3701
3709
|
}
|
|
3702
|
-
}, [u,
|
|
3703
|
-
|
|
3710
|
+
}, [u, f]), y = Nn(
|
|
3711
|
+
Xa({
|
|
3704
3712
|
content: b,
|
|
3705
3713
|
onUpdate: ({ editor: T }) => {
|
|
3706
3714
|
const v = T.getJSON();
|
|
3707
|
-
s(v), B.notifyStateChange(T), t && t(v), t || (
|
|
3715
|
+
s(v), B.notifyStateChange(T), t && t(v), t || (p.current && clearTimeout(p.current), p.current = setTimeout(() => {
|
|
3708
3716
|
h(v);
|
|
3709
|
-
},
|
|
3717
|
+
}, ui));
|
|
3710
3718
|
},
|
|
3711
3719
|
onCreate: ({ editor: T }) => {
|
|
3712
3720
|
c(T), i == null || i(T), B.initializePlugins(T), B.notifyStateChange(T);
|
|
@@ -3720,7 +3728,7 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3720
3728
|
}
|
|
3721
3729
|
}
|
|
3722
3730
|
})
|
|
3723
|
-
), E =
|
|
3731
|
+
), E = W(!1);
|
|
3724
3732
|
if (M(() => {
|
|
3725
3733
|
if (!(!y || !e)) {
|
|
3726
3734
|
if (!E.current) {
|
|
@@ -3730,34 +3738,34 @@ const ti = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3730
3738
|
y.commands.setContent(e);
|
|
3731
3739
|
}
|
|
3732
3740
|
}, [y, e]), M(() => () => {
|
|
3733
|
-
|
|
3741
|
+
p.current && clearTimeout(p.current), y && (B.destroyPlugins(y), y.destroy());
|
|
3734
3742
|
}, [y]), M(() => {
|
|
3735
3743
|
y && B.notifyStateChange(y);
|
|
3736
3744
|
}, [y, l]), !y)
|
|
3737
3745
|
return null;
|
|
3738
|
-
const x =
|
|
3746
|
+
const x = H(l), w = d === "saving" ? x.autoSaveSaving : d === "saved" ? x.autoSaveSaved : d === "error" ? x.autoSaveError : "";
|
|
3739
3747
|
return /* @__PURE__ */ L("div", { className: `editor-container flex flex-col h-full ${n}`, children: [
|
|
3740
3748
|
!r && /* @__PURE__ */ L("div", { className: "flex items-center", children: [
|
|
3741
|
-
/* @__PURE__ */ m(
|
|
3749
|
+
/* @__PURE__ */ m(Qa, { editor: y }),
|
|
3742
3750
|
w && /* @__PURE__ */ m("span", { className: `auto-save-indicator auto-save-indicator--${d} ml-2`, children: w })
|
|
3743
3751
|
] }),
|
|
3744
|
-
!r && y && /* @__PURE__ */ m(
|
|
3745
|
-
!r && y && /* @__PURE__ */ m(
|
|
3746
|
-
!r && y && /* @__PURE__ */ m(
|
|
3752
|
+
!r && y && /* @__PURE__ */ m(ei, { editor: y }),
|
|
3753
|
+
!r && y && /* @__PURE__ */ m(ri, { editor: y, onSelectionOptimize: o }),
|
|
3754
|
+
!r && y && /* @__PURE__ */ m(ai, { editor: y }),
|
|
3747
3755
|
/* @__PURE__ */ L("div", { className: "flex flex-1 overflow-hidden", children: [
|
|
3748
|
-
!r && y && /* @__PURE__ */ m(
|
|
3756
|
+
!r && y && /* @__PURE__ */ m(li, { editor: y }),
|
|
3749
3757
|
/* @__PURE__ */ m("div", { className: "flex-1 overflow-y-auto bg-white p-4 relative", children: /* @__PURE__ */ m(
|
|
3750
|
-
|
|
3758
|
+
di,
|
|
3751
3759
|
{
|
|
3752
3760
|
editor: y,
|
|
3753
3761
|
mode: r || !a || g.status === "streaming" && g.activeSectionType === "claims" ? "readonly" : "edit"
|
|
3754
3762
|
}
|
|
3755
3763
|
) })
|
|
3756
3764
|
] }),
|
|
3757
|
-
!r && /* @__PURE__ */ m(
|
|
3765
|
+
!r && /* @__PURE__ */ m(ii, { editor: y })
|
|
3758
3766
|
] });
|
|
3759
3767
|
};
|
|
3760
|
-
function
|
|
3768
|
+
function ln(e) {
|
|
3761
3769
|
const t = e.getReader(), n = new TextDecoder();
|
|
3762
3770
|
let r = "";
|
|
3763
3771
|
return new ReadableStream({
|
|
@@ -3786,18 +3794,18 @@ function sn(e) {
|
|
|
3786
3794
|
return;
|
|
3787
3795
|
}
|
|
3788
3796
|
try {
|
|
3789
|
-
const u = JSON.parse(g),
|
|
3790
|
-
if (
|
|
3797
|
+
const u = JSON.parse(g), f = l || u.type;
|
|
3798
|
+
if (f === "delta" || !f && u.content != null)
|
|
3791
3799
|
a.enqueue({
|
|
3792
3800
|
type: "delta",
|
|
3793
3801
|
content: u.content ?? u.text ?? ((i = u.delta) == null ? void 0 : i.content) ?? ""
|
|
3794
3802
|
});
|
|
3795
|
-
else if (
|
|
3803
|
+
else if (f === "patch")
|
|
3796
3804
|
a.enqueue({ type: "patch", patch: u });
|
|
3797
|
-
else if (
|
|
3805
|
+
else if (f === "done") {
|
|
3798
3806
|
a.enqueue({ type: "done", usage: u.usage }), a.close();
|
|
3799
3807
|
return;
|
|
3800
|
-
} else
|
|
3808
|
+
} else f === "error" && a.enqueue({ type: "error", message: u.message || "Unknown error" });
|
|
3801
3809
|
} catch {
|
|
3802
3810
|
}
|
|
3803
3811
|
l = "";
|
|
@@ -3809,7 +3817,7 @@ function sn(e) {
|
|
|
3809
3817
|
}
|
|
3810
3818
|
});
|
|
3811
3819
|
}
|
|
3812
|
-
function
|
|
3820
|
+
function fi(e, t) {
|
|
3813
3821
|
let n = null;
|
|
3814
3822
|
return {
|
|
3815
3823
|
async request(r) {
|
|
@@ -3824,14 +3832,14 @@ function mi(e, t) {
|
|
|
3824
3832
|
throw new Error(`AI service error: ${i.status} ${i.statusText}`);
|
|
3825
3833
|
if (!i.body)
|
|
3826
3834
|
throw new Error("AI service returned no body");
|
|
3827
|
-
return
|
|
3835
|
+
return ln(i.body);
|
|
3828
3836
|
},
|
|
3829
3837
|
abort() {
|
|
3830
3838
|
n == null || n.abort(), n = null;
|
|
3831
3839
|
}
|
|
3832
3840
|
};
|
|
3833
3841
|
}
|
|
3834
|
-
function
|
|
3842
|
+
function pi(e, t) {
|
|
3835
3843
|
let n = null;
|
|
3836
3844
|
const r = e.replace(/\/+$/, "");
|
|
3837
3845
|
async function a(i, o) {
|
|
@@ -3878,28 +3886,28 @@ function gi(e, t) {
|
|
|
3878
3886
|
});
|
|
3879
3887
|
if (!s.ok) throw new Error(`Chat stream error: ${s.status} ${s.statusText}`);
|
|
3880
3888
|
if (!s.body) throw new Error("Chat stream returned no body");
|
|
3881
|
-
return
|
|
3889
|
+
return ln(s.body);
|
|
3882
3890
|
},
|
|
3883
3891
|
abort() {
|
|
3884
3892
|
n == null || n.abort(), n = null;
|
|
3885
3893
|
}
|
|
3886
3894
|
};
|
|
3887
3895
|
}
|
|
3888
|
-
const
|
|
3896
|
+
const hi = It(
|
|
3889
3897
|
({ 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
|
-
const { setEditorLanguage:
|
|
3898
|
+
const { setEditorLanguage: f, setAIService: p, setChatSessionAPI: b } = I(), h = W(null), y = ae((x) => {
|
|
3891
3899
|
h.current = x;
|
|
3892
|
-
}, []), E =
|
|
3900
|
+
}, []), E = Ee.useMemo(() => {
|
|
3893
3901
|
if (e) return e;
|
|
3894
|
-
if (t) return
|
|
3902
|
+
if (t) return tn(t);
|
|
3895
3903
|
}, [e, t]);
|
|
3896
|
-
return
|
|
3897
|
-
o &&
|
|
3898
|
-
}, [o,
|
|
3899
|
-
c ?
|
|
3900
|
-
}, [c, l, d,
|
|
3901
|
-
s ? b(s) : l && b(
|
|
3902
|
-
}, [s, l, d, b]),
|
|
3904
|
+
return Ee.useEffect(() => {
|
|
3905
|
+
o && f(o);
|
|
3906
|
+
}, [o, f]), Ee.useEffect(() => {
|
|
3907
|
+
c ? p(c) : l && p(fi(l, d));
|
|
3908
|
+
}, [c, l, d, p]), Ee.useEffect(() => {
|
|
3909
|
+
s ? b(s) : l && b(pi(l, d));
|
|
3910
|
+
}, [s, l, d, b]), Nt(u, () => ({
|
|
3903
3911
|
getContent: () => {
|
|
3904
3912
|
var x;
|
|
3905
3913
|
return ((x = h.current) == null ? void 0 : x.getJSON()) ?? null;
|
|
@@ -3909,13 +3917,13 @@ const fi = Et(
|
|
|
3909
3917
|
(w = h.current) == null || w.commands.setContent(x);
|
|
3910
3918
|
},
|
|
3911
3919
|
getEditor: () => h.current,
|
|
3912
|
-
execCommand: async (x, w) => h.current ?
|
|
3920
|
+
execCommand: async (x, w) => h.current ? ct(h.current).execCommand(x, w) : null,
|
|
3913
3921
|
focus: () => {
|
|
3914
3922
|
var x;
|
|
3915
3923
|
(x = h.current) == null || x.commands.focus();
|
|
3916
3924
|
}
|
|
3917
3925
|
})), /* @__PURE__ */ m(
|
|
3918
|
-
|
|
3926
|
+
gi,
|
|
3919
3927
|
{
|
|
3920
3928
|
initialContent: E,
|
|
3921
3929
|
onChange: n,
|
|
@@ -3928,13 +3936,13 @@ const fi = Et(
|
|
|
3928
3936
|
);
|
|
3929
3937
|
}
|
|
3930
3938
|
);
|
|
3931
|
-
|
|
3932
|
-
async function
|
|
3939
|
+
hi.displayName = "PatentEditor";
|
|
3940
|
+
async function js(e, t, n) {
|
|
3933
3941
|
var a, i, o, c;
|
|
3934
3942
|
let r = !1;
|
|
3935
|
-
(a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" &&
|
|
3943
|
+
(a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" && un(e, n.targetSectionPos);
|
|
3936
3944
|
try {
|
|
3937
|
-
let s =
|
|
3945
|
+
let s = dn(e, n);
|
|
3938
3946
|
for (; ; ) {
|
|
3939
3947
|
const { done: l, value: d } = await t.read();
|
|
3940
3948
|
if (l) break;
|
|
@@ -3943,30 +3951,30 @@ async function Us(e, t, n) {
|
|
|
3943
3951
|
const g = e.state.tr.insertText(d, s);
|
|
3944
3952
|
e.view.dispatch(g), s = g.mapping.map(s, 1);
|
|
3945
3953
|
}
|
|
3946
|
-
n.mode === "section" && typeof n.targetSectionPos == "number" &&
|
|
3954
|
+
n.mode === "section" && typeof n.targetSectionPos == "number" && nt(e, n.targetSectionPos), (o = n.onComplete) == null || o.call(n);
|
|
3947
3955
|
} catch (s) {
|
|
3948
3956
|
(c = n.onError) == null || c.call(n, s instanceof Error ? s : new Error(String(s)));
|
|
3949
3957
|
}
|
|
3950
3958
|
}
|
|
3951
|
-
async function
|
|
3959
|
+
async function Gs(e, t, n, r) {
|
|
3952
3960
|
var i, o, c, s, l, d, g, u;
|
|
3953
3961
|
const a = new AbortController();
|
|
3954
|
-
(i = r.onStart) == null || i.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" &&
|
|
3962
|
+
(i = r.onStart) == null || i.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" && un(e, r.targetSectionPos);
|
|
3955
3963
|
try {
|
|
3956
|
-
const
|
|
3964
|
+
const f = await fetch(t, {
|
|
3957
3965
|
method: "POST",
|
|
3958
3966
|
headers: { "Content-Type": "application/json" },
|
|
3959
3967
|
body: JSON.stringify(n),
|
|
3960
3968
|
signal: a.signal
|
|
3961
3969
|
});
|
|
3962
|
-
if (!
|
|
3963
|
-
throw new Error(`HTTP ${
|
|
3964
|
-
const
|
|
3965
|
-
if (!
|
|
3970
|
+
if (!f.ok)
|
|
3971
|
+
throw new Error(`HTTP ${f.status}: ${f.statusText}`);
|
|
3972
|
+
const p = (o = f.body) == null ? void 0 : o.getReader();
|
|
3973
|
+
if (!p) throw new Error("No response body");
|
|
3966
3974
|
const b = new TextDecoder();
|
|
3967
|
-
let h =
|
|
3975
|
+
let h = dn(e, r), y = "";
|
|
3968
3976
|
for (; ; ) {
|
|
3969
|
-
const { done: E, value: x } = await
|
|
3977
|
+
const { done: E, value: x } = await p.read();
|
|
3970
3978
|
if (E) break;
|
|
3971
3979
|
y += b.decode(x, { stream: !0 });
|
|
3972
3980
|
const w = y.split(`
|
|
@@ -3976,7 +3984,7 @@ async function Ws(e, t, n, r) {
|
|
|
3976
3984
|
if (!T.startsWith("data: ")) continue;
|
|
3977
3985
|
const v = T.slice(6).trim();
|
|
3978
3986
|
if (v === "[DONE]")
|
|
3979
|
-
return r.mode === "section" && typeof r.targetSectionPos == "number" &&
|
|
3987
|
+
return r.mode === "section" && typeof r.targetSectionPos == "number" && nt(e, r.targetSectionPos), (c = r.onComplete) == null || c.call(r), { abort: () => a.abort() };
|
|
3980
3988
|
try {
|
|
3981
3989
|
const _ = JSON.parse(v), C = _.content || _.text || ((s = _.delta) == null ? void 0 : s.content) || "";
|
|
3982
3990
|
if (!C) continue;
|
|
@@ -3987,13 +3995,13 @@ async function Ws(e, t, n, r) {
|
|
|
3987
3995
|
}
|
|
3988
3996
|
}
|
|
3989
3997
|
}
|
|
3990
|
-
r.mode === "section" && typeof r.targetSectionPos == "number" &&
|
|
3991
|
-
} catch (
|
|
3992
|
-
|
|
3998
|
+
r.mode === "section" && typeof r.targetSectionPos == "number" && nt(e, r.targetSectionPos), (d = r.onComplete) == null || d.call(r);
|
|
3999
|
+
} catch (f) {
|
|
4000
|
+
f.name === "AbortError" ? (g = r.onAbort) == null || g.call(r) : (u = r.onError) == null || u.call(r, f instanceof Error ? f : new Error(String(f)));
|
|
3993
4001
|
}
|
|
3994
4002
|
return { abort: () => a.abort() };
|
|
3995
4003
|
}
|
|
3996
|
-
function
|
|
4004
|
+
function dn(e, t) {
|
|
3997
4005
|
if (t.mode === "section" && typeof t.targetSectionPos == "number") {
|
|
3998
4006
|
const n = e.state.doc.nodeAt(t.targetSectionPos);
|
|
3999
4007
|
if (n && n.type.name === "patent_section")
|
|
@@ -4001,7 +4009,7 @@ function on(e, t) {
|
|
|
4001
4009
|
}
|
|
4002
4010
|
return e.state.selection.from;
|
|
4003
4011
|
}
|
|
4004
|
-
function
|
|
4012
|
+
function un(e, t) {
|
|
4005
4013
|
const n = e.state.doc.nodeAt(t);
|
|
4006
4014
|
if (!n || n.type.name !== "patent_section") return;
|
|
4007
4015
|
const r = t + 1, a = t + n.nodeSize - 1;
|
|
@@ -4010,7 +4018,7 @@ function cn(e, t) {
|
|
|
4010
4018
|
i.replaceWith(r, a, o), i.setMeta("addToHistory", !1), e.view.dispatch(i);
|
|
4011
4019
|
}
|
|
4012
4020
|
}
|
|
4013
|
-
function
|
|
4021
|
+
function nt(e, t) {
|
|
4014
4022
|
const n = e.state.doc.nodeAt(t);
|
|
4015
4023
|
if (!n || n.type.name !== "patent_section") return;
|
|
4016
4024
|
const r = e.state.tr, a = [];
|
|
@@ -4030,7 +4038,7 @@ function et(e, t) {
|
|
|
4030
4038
|
r.setMeta("addToHistory", !1), e.view.dispatch(r);
|
|
4031
4039
|
}
|
|
4032
4040
|
}
|
|
4033
|
-
const
|
|
4041
|
+
const Tt = {
|
|
4034
4042
|
technical_field: {
|
|
4035
4043
|
zh: "本发明涉及航天器自主导航与控制技术领域,具体涉及一种基于多传感器融合的航天器自主避障控制方法、系统、电子设备及计算机可读存储介质。该方法综合利用激光雷达、红外传感器和星敏感器的探测数据,通过实时环境感知与路径规划算法,实现航天器在复杂空间环境中的自主安全避障机动。",
|
|
4036
4044
|
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 +4108,7 @@ S103:局部实时避障控制。采用模型预测控制(MPC)策略,以
|
|
|
4100
4108
|
S104:安全验证。对计算得到的控制指令进行轨迹传播仿真,验证机动后轨迹在未来72小时内不会与TLE目录中的已知空间目标产生碰撞风险(miss distance > 1km)。`,
|
|
4101
4109
|
en: "The technical solution of the embodiments of the present invention will be described clearly and completely below with reference to the drawings."
|
|
4102
4110
|
}
|
|
4103
|
-
},
|
|
4111
|
+
}, Pe = {
|
|
4104
4112
|
"help-draft": {
|
|
4105
4113
|
zh: `当然可以帮你撰写技术方案!请先描述以下信息:
|
|
4106
4114
|
|
|
@@ -4160,7 +4168,7 @@ S104:安全验证。对计算得到的控制指令进行轨迹传播仿真,
|
|
|
4160
4168
|
en: "That is a great question. As an AI patent writing assistant, I can help you with..."
|
|
4161
4169
|
}
|
|
4162
4170
|
}, te = (e) => new Promise((t) => setTimeout(t, e));
|
|
4163
|
-
function
|
|
4171
|
+
function rt(e, t = 30) {
|
|
4164
4172
|
let n = !1;
|
|
4165
4173
|
return new ReadableStream({
|
|
4166
4174
|
async pull(r) {
|
|
@@ -4178,30 +4186,30 @@ function tt(e, t = 30) {
|
|
|
4178
4186
|
}
|
|
4179
4187
|
});
|
|
4180
4188
|
}
|
|
4181
|
-
function
|
|
4182
|
-
const t = [], n =
|
|
4189
|
+
function yi(e) {
|
|
4190
|
+
const t = [], n = $e(e, 3);
|
|
4183
4191
|
for (const r of n)
|
|
4184
4192
|
t.push({ type: "delta", content: r });
|
|
4185
4193
|
return t.push({ type: "done", usage: { tokens: e.length * 2 } }), t;
|
|
4186
4194
|
}
|
|
4187
|
-
function
|
|
4195
|
+
function $e(e, t) {
|
|
4188
4196
|
const n = [];
|
|
4189
4197
|
for (let r = 0; r < e.length; r += t)
|
|
4190
4198
|
n.push(e.slice(r, r + t));
|
|
4191
4199
|
return n;
|
|
4192
4200
|
}
|
|
4193
|
-
function
|
|
4201
|
+
function bi(e, t, n) {
|
|
4194
4202
|
const r = n === "zh", a = [];
|
|
4195
4203
|
let i;
|
|
4196
|
-
if (e.includes("技术方案") || e.includes("draft") ? i =
|
|
4204
|
+
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
4205
|
const o = r ? `正在分析引用的 ${t.length} 段文本并生成优化建议...
|
|
4198
4206
|
|
|
4199
4207
|
` : `Analyzing ${t.length} referenced text(s) and generating suggestions...
|
|
4200
4208
|
|
|
4201
4209
|
`;
|
|
4202
|
-
for (const c of
|
|
4210
|
+
for (const c of $e(o, 4))
|
|
4203
4211
|
a.push({ type: "delta", content: c });
|
|
4204
|
-
for (const c of
|
|
4212
|
+
for (const c of $e(i, 4))
|
|
4205
4213
|
a.push({ type: "delta", content: c });
|
|
4206
4214
|
for (let c = 0; c < t.length; c++) {
|
|
4207
4215
|
const s = t[c], l = s.text;
|
|
@@ -4234,33 +4242,33 @@ function hi(e, t, n) {
|
|
|
4234
4242
|
});
|
|
4235
4243
|
}
|
|
4236
4244
|
} else
|
|
4237
|
-
for (const o of
|
|
4245
|
+
for (const o of $e(i, 4))
|
|
4238
4246
|
a.push({ type: "delta", content: o });
|
|
4239
4247
|
return a.push({ type: "done", usage: { tokens: i.length * 2 } }), a;
|
|
4240
4248
|
}
|
|
4241
|
-
function
|
|
4249
|
+
function Vs() {
|
|
4242
4250
|
let e = null;
|
|
4243
4251
|
return {
|
|
4244
4252
|
async request(t) {
|
|
4245
4253
|
var c;
|
|
4246
4254
|
if (e = new AbortController(), await te(300), e.signal.aborted)
|
|
4247
4255
|
throw new DOMException("Aborted", "AbortError");
|
|
4248
|
-
const n = t.language === "zh" ? "zh" : "en", r = t.sectionType || "technical_field", a = ((c =
|
|
4256
|
+
const n = t.language === "zh" ? "zh" : "en", r = t.sectionType || "technical_field", a = ((c = Tt[r]) == null ? void 0 : c[n]) || Tt.technical_field[n];
|
|
4249
4257
|
let i = a;
|
|
4250
4258
|
t.instruction && (i = (n === "zh" ? `[基于指令"${t.instruction}"生成]
|
|
4251
4259
|
|
|
4252
4260
|
` : `[Generated based on instruction "${t.instruction}"]
|
|
4253
4261
|
|
|
4254
4262
|
`) + a);
|
|
4255
|
-
const o =
|
|
4256
|
-
return
|
|
4263
|
+
const o = yi(i);
|
|
4264
|
+
return rt(o, 25);
|
|
4257
4265
|
},
|
|
4258
4266
|
abort() {
|
|
4259
4267
|
e == null || e.abort(), e = null;
|
|
4260
4268
|
}
|
|
4261
4269
|
};
|
|
4262
4270
|
}
|
|
4263
|
-
function
|
|
4271
|
+
function Js() {
|
|
4264
4272
|
const e = /* @__PURE__ */ new Map();
|
|
4265
4273
|
let t = null, n = null;
|
|
4266
4274
|
return {
|
|
@@ -4303,7 +4311,7 @@ function Vs() {
|
|
|
4303
4311
|
status: "done",
|
|
4304
4312
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4305
4313
|
}), i.session.messageCount = i.messages.length, i.session.lastMessage = a.content, i.session.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4306
|
-
const c =
|
|
4314
|
+
const c = bi(
|
|
4307
4315
|
a.content,
|
|
4308
4316
|
a.references || [],
|
|
4309
4317
|
a.language
|
|
@@ -4315,10 +4323,10 @@ function Vs() {
|
|
|
4315
4323
|
const i = e.get(r);
|
|
4316
4324
|
if (!i) throw new Error("Session not found");
|
|
4317
4325
|
if (!n || n.messageId !== a)
|
|
4318
|
-
return
|
|
4326
|
+
return rt([{ type: "done" }]);
|
|
4319
4327
|
const o = n.events;
|
|
4320
4328
|
n = null;
|
|
4321
|
-
const c =
|
|
4329
|
+
const c = rt(o, 18), s = `${a}_a`;
|
|
4322
4330
|
let l = "";
|
|
4323
4331
|
for (const d of o)
|
|
4324
4332
|
d.type === "delta" && (l += d.content);
|
|
@@ -4335,7 +4343,7 @@ function Vs() {
|
|
|
4335
4343
|
}
|
|
4336
4344
|
};
|
|
4337
4345
|
}
|
|
4338
|
-
function
|
|
4346
|
+
function vi(e) {
|
|
4339
4347
|
const t = [], n = e.replace(/\r\n/g, `
|
|
4340
4348
|
`).trim();
|
|
4341
4349
|
if (!n) return t;
|
|
@@ -4350,12 +4358,12 @@ function yi(e) {
|
|
|
4350
4358
|
if (a.length === 0)
|
|
4351
4359
|
return t.push({ number: 1, text: n, dependsOn: [] }), t;
|
|
4352
4360
|
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 =
|
|
4361
|
+
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
4362
|
t.push({ number: d, text: l, dependsOn: g });
|
|
4355
4363
|
}
|
|
4356
4364
|
return t;
|
|
4357
4365
|
}
|
|
4358
|
-
function
|
|
4366
|
+
function wi(e, t) {
|
|
4359
4367
|
const n = [], r = /根据权利要求(\d+)(?:\s*[-~至到]\s*(\d+))?/g;
|
|
4360
4368
|
let a;
|
|
4361
4369
|
for (; (a = r.exec(e)) !== null; ) {
|
|
@@ -4371,18 +4379,18 @@ function bi(e, t) {
|
|
|
4371
4379
|
}
|
|
4372
4380
|
return [...new Set(n)].sort((o, c) => o - c);
|
|
4373
4381
|
}
|
|
4374
|
-
function
|
|
4375
|
-
return
|
|
4382
|
+
function Ks(e) {
|
|
4383
|
+
return vi(e).map((n) => ({
|
|
4376
4384
|
type: "paragraph",
|
|
4377
4385
|
content: n.text ? [{ type: "text", text: `${n.number}. ${n.text}` }] : [{ type: "text", text: `${n.number}. ` }]
|
|
4378
4386
|
}));
|
|
4379
4387
|
}
|
|
4380
|
-
const
|
|
4381
|
-
let
|
|
4382
|
-
function
|
|
4383
|
-
return
|
|
4388
|
+
const xi = -1, Ci = 1, Ti = 0, at = new we("docDiff");
|
|
4389
|
+
let Ye = null;
|
|
4390
|
+
function Si() {
|
|
4391
|
+
return Ye || (Ye = new Pt()), Ye;
|
|
4384
4392
|
}
|
|
4385
|
-
function
|
|
4393
|
+
function Ei(e, t, n) {
|
|
4386
4394
|
const r = [];
|
|
4387
4395
|
return e.nodesBetween(t, n, (a, i) => {
|
|
4388
4396
|
if (a.isTextblock) {
|
|
@@ -4392,36 +4400,36 @@ function Ti(e, t, n) {
|
|
|
4392
4400
|
return !0;
|
|
4393
4401
|
}), r;
|
|
4394
4402
|
}
|
|
4395
|
-
function
|
|
4396
|
-
const n = e.state.doc, r = n.content.size, { text: a, segments: i } =
|
|
4397
|
-
o.
|
|
4403
|
+
function Xs(e, t) {
|
|
4404
|
+
const n = e.state.doc, r = n.content.size, { text: a, segments: i } = Gt(e, 0, r), o = Si(), c = o.diff_main(t, a);
|
|
4405
|
+
o.diff_cleanupSemantic(c);
|
|
4398
4406
|
const s = [];
|
|
4399
4407
|
let l = 0;
|
|
4400
|
-
for (const [u,
|
|
4401
|
-
if (u ===
|
|
4402
|
-
l +=
|
|
4403
|
-
else if (u ===
|
|
4404
|
-
let
|
|
4405
|
-
for (;
|
|
4406
|
-
for (;
|
|
4407
|
-
if (
|
|
4408
|
-
const b =
|
|
4409
|
-
for (;
|
|
4410
|
-
const h =
|
|
4408
|
+
for (const [u, f] of c)
|
|
4409
|
+
if (u === Ti)
|
|
4410
|
+
l += f.length;
|
|
4411
|
+
else if (u === Ci) {
|
|
4412
|
+
let p = 0;
|
|
4413
|
+
for (; p < f.length; ) {
|
|
4414
|
+
for (; p < f.length && f[p] === "\0"; ) p++;
|
|
4415
|
+
if (p >= f.length) break;
|
|
4416
|
+
const b = p;
|
|
4417
|
+
for (; p < f.length && f[p] !== "\0"; ) p++;
|
|
4418
|
+
const h = ye(i, l + b), y = ye(i, l + p);
|
|
4411
4419
|
if (h >= 0 && y >= 0 && y > h)
|
|
4412
|
-
for (const E of
|
|
4420
|
+
for (const E of Ei(n, h, y))
|
|
4413
4421
|
s.push(
|
|
4414
4422
|
re.inline(E.from, E.to, { class: "patch-diff-insert-inline" })
|
|
4415
4423
|
);
|
|
4416
4424
|
}
|
|
4417
|
-
l +=
|
|
4418
|
-
} else if (u ===
|
|
4419
|
-
const
|
|
4420
|
-
if (
|
|
4421
|
-
const b =
|
|
4425
|
+
l += f.length;
|
|
4426
|
+
} else if (u === xi) {
|
|
4427
|
+
const p = ye(i, l);
|
|
4428
|
+
if (p >= 0) {
|
|
4429
|
+
const b = f.replace(/\0/g, " ");
|
|
4422
4430
|
s.push(
|
|
4423
4431
|
re.widget(
|
|
4424
|
-
|
|
4432
|
+
p,
|
|
4425
4433
|
() => {
|
|
4426
4434
|
const h = document.createElement("span");
|
|
4427
4435
|
return h.className = "patch-diff-delete", h.textContent = b, h;
|
|
@@ -4431,33 +4439,37 @@ function Js(e, t) {
|
|
|
4431
4439
|
);
|
|
4432
4440
|
}
|
|
4433
4441
|
}
|
|
4434
|
-
const d =
|
|
4435
|
-
key:
|
|
4442
|
+
const d = be.create(n, s), g = new Be({
|
|
4443
|
+
key: at,
|
|
4444
|
+
state: {
|
|
4445
|
+
init: () => d,
|
|
4446
|
+
apply: (u, f) => u.docChanged ? f.map(u.mapping, u.doc) : f
|
|
4447
|
+
},
|
|
4436
4448
|
props: {
|
|
4437
|
-
decorations() {
|
|
4438
|
-
return
|
|
4449
|
+
decorations(u) {
|
|
4450
|
+
return at.getState(u);
|
|
4439
4451
|
}
|
|
4440
4452
|
}
|
|
4441
4453
|
});
|
|
4442
4454
|
e.registerPlugin(g);
|
|
4443
4455
|
}
|
|
4444
|
-
function
|
|
4445
|
-
e.unregisterPlugin(
|
|
4456
|
+
function Ys(e) {
|
|
4457
|
+
e.unregisterPlugin(at);
|
|
4446
4458
|
}
|
|
4447
|
-
const
|
|
4459
|
+
const ki = /* @__PURE__ */ new Set([
|
|
4448
4460
|
"abstract",
|
|
4449
4461
|
"abstract_drawing",
|
|
4450
4462
|
"claims",
|
|
4451
4463
|
"drawing_figures"
|
|
4452
|
-
]),
|
|
4464
|
+
]), _i = /* @__PURE__ */ new Set([
|
|
4453
4465
|
"technical_field",
|
|
4454
4466
|
"background_art",
|
|
4455
4467
|
"summary",
|
|
4456
4468
|
"drawing_description",
|
|
4457
4469
|
"detailed_description"
|
|
4458
4470
|
]);
|
|
4459
|
-
function
|
|
4460
|
-
const n =
|
|
4471
|
+
function Ii(e, t) {
|
|
4472
|
+
const n = H(t), r = [];
|
|
4461
4473
|
return e.state.doc.descendants((a) => {
|
|
4462
4474
|
if (a.type.name === "patent_title") {
|
|
4463
4475
|
const i = a.textContent.trim();
|
|
@@ -4478,87 +4490,87 @@ function ki(e, t) {
|
|
|
4478
4490
|
return !0;
|
|
4479
4491
|
}), r;
|
|
4480
4492
|
}
|
|
4481
|
-
function
|
|
4482
|
-
return new
|
|
4483
|
-
children: [new
|
|
4484
|
-
alignment:
|
|
4493
|
+
function St(e) {
|
|
4494
|
+
return new He({
|
|
4495
|
+
children: [new qe({ text: e, bold: !0, size: 32, font: "黑体" })],
|
|
4496
|
+
alignment: it.CENTER,
|
|
4485
4497
|
spacing: { before: 400, after: 200 }
|
|
4486
4498
|
});
|
|
4487
4499
|
}
|
|
4488
|
-
function
|
|
4489
|
-
return new
|
|
4490
|
-
children: [new
|
|
4491
|
-
alignment:
|
|
4500
|
+
function Et(e) {
|
|
4501
|
+
return new He({
|
|
4502
|
+
children: [new qe({ text: e, bold: !0, size: 28, font: "黑体" })],
|
|
4503
|
+
alignment: it.CENTER,
|
|
4492
4504
|
spacing: { before: 240, after: 120 }
|
|
4493
4505
|
});
|
|
4494
4506
|
}
|
|
4495
|
-
function
|
|
4496
|
-
return new
|
|
4497
|
-
children: [new
|
|
4498
|
-
alignment:
|
|
4507
|
+
function Ni(e) {
|
|
4508
|
+
return new He({
|
|
4509
|
+
children: [new qe({ text: e, bold: !0, size: 36, font: "宋体" })],
|
|
4510
|
+
alignment: it.CENTER,
|
|
4499
4511
|
spacing: { before: 200, after: 200 }
|
|
4500
4512
|
});
|
|
4501
4513
|
}
|
|
4502
|
-
function
|
|
4503
|
-
return new
|
|
4504
|
-
children: [new
|
|
4514
|
+
function Ze(e) {
|
|
4515
|
+
return new He({
|
|
4516
|
+
children: [new qe({ text: e, size: 24, font: "宋体" })],
|
|
4505
4517
|
spacing: { line: 360 },
|
|
4506
|
-
indent: { firstLine:
|
|
4518
|
+
indent: { firstLine: he(7) }
|
|
4507
4519
|
});
|
|
4508
4520
|
}
|
|
4509
|
-
function
|
|
4510
|
-
const n =
|
|
4521
|
+
function Ai(e, t) {
|
|
4522
|
+
const n = H(t), r = [];
|
|
4511
4523
|
let a = !1;
|
|
4512
4524
|
for (const i of e) {
|
|
4513
|
-
if (
|
|
4514
|
-
r.push(
|
|
4525
|
+
if (ki.has(i.sectionType)) {
|
|
4526
|
+
r.push(St(i.title));
|
|
4515
4527
|
for (const o of i.paragraphs)
|
|
4516
|
-
r.push(
|
|
4528
|
+
r.push(Ze(o));
|
|
4517
4529
|
continue;
|
|
4518
4530
|
}
|
|
4519
4531
|
if (i.type === "patent_title") {
|
|
4520
4532
|
if (!a) {
|
|
4521
4533
|
const o = typeof n.bookTitle_description == "string" ? n.bookTitle_description : "说明书";
|
|
4522
|
-
r.push(
|
|
4534
|
+
r.push(St(o)), a = !0;
|
|
4523
4535
|
}
|
|
4524
4536
|
for (const o of i.paragraphs)
|
|
4525
|
-
r.push(
|
|
4537
|
+
r.push(Ni(o));
|
|
4526
4538
|
continue;
|
|
4527
4539
|
}
|
|
4528
|
-
if (
|
|
4529
|
-
r.push(
|
|
4540
|
+
if (_i.has(i.sectionType)) {
|
|
4541
|
+
r.push(Et(i.title));
|
|
4530
4542
|
for (const o of i.paragraphs)
|
|
4531
|
-
r.push(
|
|
4543
|
+
r.push(Ze(o));
|
|
4532
4544
|
continue;
|
|
4533
4545
|
}
|
|
4534
|
-
r.push(
|
|
4546
|
+
r.push(Et(i.title));
|
|
4535
4547
|
for (const o of i.paragraphs)
|
|
4536
|
-
r.push(
|
|
4548
|
+
r.push(Ze(o));
|
|
4537
4549
|
}
|
|
4538
4550
|
return r;
|
|
4539
4551
|
}
|
|
4540
|
-
async function
|
|
4541
|
-
const n =
|
|
4552
|
+
async function Zs(e, t) {
|
|
4553
|
+
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
4554
|
properties: {
|
|
4543
4555
|
page: {
|
|
4544
4556
|
margin: {
|
|
4545
|
-
top:
|
|
4546
|
-
bottom:
|
|
4547
|
-
left:
|
|
4548
|
-
right:
|
|
4557
|
+
top: he(25),
|
|
4558
|
+
bottom: he(25),
|
|
4559
|
+
left: he(25),
|
|
4560
|
+
right: he(20)
|
|
4549
4561
|
}
|
|
4550
4562
|
}
|
|
4551
4563
|
},
|
|
4552
4564
|
children: r
|
|
4553
|
-
}, c = new
|
|
4565
|
+
}, c = new Xr({
|
|
4554
4566
|
sections: [o]
|
|
4555
|
-
}), s = await
|
|
4556
|
-
|
|
4567
|
+
}), s = await Yr.toBlob(c);
|
|
4568
|
+
Zr(s, i);
|
|
4557
4569
|
}
|
|
4558
|
-
async function
|
|
4570
|
+
async function Qs(e) {
|
|
4559
4571
|
window.print();
|
|
4560
4572
|
}
|
|
4561
|
-
function
|
|
4573
|
+
function eo(e, t) {
|
|
4562
4574
|
const n = [], r = t === "zh";
|
|
4563
4575
|
let a = 0;
|
|
4564
4576
|
const i = () => `v_${++a}`;
|
|
@@ -4613,10 +4625,10 @@ function Zs(e, t) {
|
|
|
4613
4625
|
const d = /^(\d+)\s*[.、]/;
|
|
4614
4626
|
o.forEach((g, u) => {
|
|
4615
4627
|
if (g.type.name !== "paragraph") return;
|
|
4616
|
-
const
|
|
4617
|
-
if (!
|
|
4618
|
-
const b =
|
|
4619
|
-
|
|
4628
|
+
const f = g.textContent.trim(), p = d.exec(f);
|
|
4629
|
+
if (!p) return;
|
|
4630
|
+
const b = p[1];
|
|
4631
|
+
f.length > 0 && !f.endsWith("。") && !f.endsWith(".") && n.push({
|
|
4620
4632
|
id: i(),
|
|
4621
4633
|
severity: "warning",
|
|
4622
4634
|
message: r ? `权利要求${b}末尾应以句号结束` : `Claim ${b} should end with a period`,
|
|
@@ -4629,25 +4641,25 @@ function Zs(e, t) {
|
|
|
4629
4641
|
return !0;
|
|
4630
4642
|
}), n;
|
|
4631
4643
|
}
|
|
4632
|
-
const
|
|
4633
|
-
function
|
|
4644
|
+
const Li = /^(\d+)\s*[.、]\s*/, kt = /根据权利要求(\d+)(?:\s*[-~至到]\s*(\d+))?/g, _t = /claims?\s+(\d+)(?:\s*[-~to]+\s*(\d+))?/gi;
|
|
4645
|
+
function Pi(e, t) {
|
|
4634
4646
|
const n = [];
|
|
4635
4647
|
let r;
|
|
4636
|
-
for (
|
|
4648
|
+
for (kt.lastIndex = 0; (r = kt.exec(e)) !== null; ) {
|
|
4637
4649
|
const a = parseInt(r[1], 10), i = r[2] ? parseInt(r[2], 10) : a;
|
|
4638
4650
|
for (let o = a; o <= i; o++)
|
|
4639
4651
|
o !== t && o > 0 && n.push(o);
|
|
4640
4652
|
}
|
|
4641
|
-
for (
|
|
4653
|
+
for (_t.lastIndex = 0; (r = _t.exec(e)) !== null; ) {
|
|
4642
4654
|
const a = parseInt(r[1], 10), i = r[2] ? parseInt(r[2], 10) : a;
|
|
4643
4655
|
for (let o = a; o <= i; o++)
|
|
4644
4656
|
o !== t && o > 0 && n.push(o);
|
|
4645
4657
|
}
|
|
4646
4658
|
return [...new Set(n)].sort((a, i) => a - i);
|
|
4647
4659
|
}
|
|
4648
|
-
const
|
|
4660
|
+
const mn = (e) => {
|
|
4649
4661
|
if (e.type.name === "reference")
|
|
4650
|
-
return
|
|
4662
|
+
return Di(e);
|
|
4651
4663
|
if (e.type.name === "hardBreak")
|
|
4652
4664
|
return `
|
|
4653
4665
|
`;
|
|
@@ -4655,9 +4667,9 @@ const dn = (e) => {
|
|
|
4655
4667
|
return e.text || "";
|
|
4656
4668
|
let t = "";
|
|
4657
4669
|
return e.forEach((n) => {
|
|
4658
|
-
t +=
|
|
4670
|
+
t += mn(n);
|
|
4659
4671
|
}), t;
|
|
4660
|
-
},
|
|
4672
|
+
}, Di = (e) => {
|
|
4661
4673
|
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
4674
|
if (r)
|
|
4663
4675
|
return r;
|
|
@@ -4667,17 +4679,17 @@ const dn = (e) => {
|
|
|
4667
4679
|
}
|
|
4668
4680
|
const a = Number(e.attrs.resolvedNumber);
|
|
4669
4681
|
return Number.isFinite(a) ? t === "en" ? `Claim ${a}` : `权利要求${a}` : t === "en" ? "Claim ?" : "权利要求?";
|
|
4670
|
-
},
|
|
4682
|
+
}, to = (e) => {
|
|
4671
4683
|
const t = [];
|
|
4672
4684
|
return e.state.doc.descendants((n, r) => {
|
|
4673
4685
|
if (n.type.name === "patent_section")
|
|
4674
4686
|
return n.attrs.sectionType === "claims";
|
|
4675
4687
|
if (n.type.name !== "paragraph") return !0;
|
|
4676
|
-
const a =
|
|
4688
|
+
const a = mn(n).trim(), i = Li.exec(a);
|
|
4677
4689
|
if (!i) return !0;
|
|
4678
4690
|
const o = parseInt(i[1], 10);
|
|
4679
4691
|
if (!Number.isFinite(o) || o <= 0) return !0;
|
|
4680
|
-
const c = a.slice(i[0].length).trim(), s =
|
|
4692
|
+
const c = a.slice(i[0].length).trim(), s = Pi(c, o);
|
|
4681
4693
|
return t.push({
|
|
4682
4694
|
claimId: `claim_${o}`,
|
|
4683
4695
|
number: o,
|
|
@@ -4689,40 +4701,40 @@ const dn = (e) => {
|
|
|
4689
4701
|
}), t;
|
|
4690
4702
|
};
|
|
4691
4703
|
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
|
-
|
|
4704
|
+
gi as EditorView,
|
|
4705
|
+
jt as PatchDiffPluginKey,
|
|
4706
|
+
hi as PatentEditor,
|
|
4707
|
+
Hs as acceptAllPatches,
|
|
4708
|
+
Os as acceptPatch,
|
|
4709
|
+
Xs as applyDocDiffDecorations,
|
|
4710
|
+
Ws as buildAIContext,
|
|
4711
|
+
Ks as buildClaimsJSONContent,
|
|
4712
|
+
tn as buildPatentDocument,
|
|
4713
|
+
zs as clearPatches,
|
|
4714
|
+
pi as createChatSessionAPI,
|
|
4715
|
+
ct as createCommandExecutor,
|
|
4716
|
+
Xa as createEditorConfig,
|
|
4717
|
+
Vs as createMockAIService,
|
|
4718
|
+
Js as createMockChatSessionAPI,
|
|
4719
|
+
fi as createSSEAdapter,
|
|
4720
|
+
Qs as exportToPdf,
|
|
4721
|
+
Zs as exportToWord,
|
|
4722
|
+
to as extractClaimsFromEditor,
|
|
4723
|
+
on as findSectionAtCursor,
|
|
4724
|
+
ti as getAllSections,
|
|
4725
|
+
Us as getMissingSectionDeps,
|
|
4726
|
+
Fs as getPatches,
|
|
4727
|
+
Ms as onPatchChange,
|
|
4716
4728
|
B as pluginManager,
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4729
|
+
qs as rejectAllPatches,
|
|
4730
|
+
Bs as rejectPatch,
|
|
4731
|
+
Ys as removeDocDiffDecorations,
|
|
4732
|
+
Rs as resolvePatchTarget,
|
|
4733
|
+
sn as sectionContextDeps,
|
|
4734
|
+
$s as setPatches,
|
|
4723
4735
|
I as useEditorStore,
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4736
|
+
eo as validatePatentDocument,
|
|
4737
|
+
js as writeStream,
|
|
4738
|
+
Gs as writeStreamFromSSE
|
|
4727
4739
|
};
|
|
4728
4740
|
//# sourceMappingURL=lib.js.map
|