patent-editor 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib.js CHANGED
@@ -1,60 +1,60 @@
1
- var Nn = Object.defineProperty;
2
- var _n = (e, t, n) => t in e ? Nn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var De = (e, t, n) => _n(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsx as f, jsxs as L, Fragment as we } from "react/jsx-runtime";
5
- import Me, { forwardRef as jt, useState as z, useEffect as B, useCallback as de, useImperativeHandle as Wt, useRef as X, useMemo as Te } from "react";
6
- import { Extension as Je, ReactRenderer as kn, Node as ee, mergeAttributes as ae, NodeViewWrapper as An, ReactNodeViewRenderer as Gt, useEditorState as Ln, EditorContent as Pn, useEditor as Dn } from "@tiptap/react";
7
- import Mn from "@tiptap/extension-document";
8
- import Rn from "@tiptap/extension-paragraph";
9
- import $n from "@tiptap/extension-text";
10
- import On from "@tiptap/extension-heading";
11
- import Fn from "@tiptap/extension-bullet-list";
12
- import zn from "@tiptap/extension-ordered-list";
13
- import Bn from "@tiptap/extension-list-item";
14
- import Hn from "@tiptap/extension-blockquote";
15
- import Un from "@tiptap/extension-code-block";
16
- import jn from "@tiptap/extension-horizontal-rule";
17
- import Wn from "@tiptap/extension-task-list";
18
- import Gn from "@tiptap/extension-task-item";
19
- import qn from "@tiptap/extension-image";
20
- import { Table as Vn } from "@tiptap/extension-table";
21
- import Kn from "@tiptap/extension-table-row";
22
- import Jn from "@tiptap/extension-table-cell";
23
- import Xn from "@tiptap/extension-table-header";
24
- import Qn from "@tiptap/extension-placeholder";
25
- import Yn from "@tiptap/extension-history";
26
- import { dropCursor as Zn } from "prosemirror-dropcursor";
27
- import { gapCursor as er } from "prosemirror-gapcursor";
28
- import tr from "@tiptap/extension-text-align";
29
- import { PluginKey as ke, Plugin as Xe, TextSelection as Ie } from "@tiptap/pm/state";
30
- import nr from "@tiptap/suggestion";
31
- import rr from "tippy.js";
32
- import { create as ar } from "zustand";
33
- import { DecorationSet as Ne, Decoration as le } from "@tiptap/pm/view";
34
- import { diff_match_patch as qt } from "diff-match-patch";
35
- import sr from "@tiptap/extension-bold";
36
- import ir from "@tiptap/extension-italic";
37
- import or from "@tiptap/extension-underline";
38
- import cr from "@tiptap/extension-strike";
39
- import lr from "@tiptap/extension-code";
40
- import dr from "@tiptap/extension-superscript";
41
- import ur from "@tiptap/extension-subscript";
42
- import mr from "@tiptap/extension-link";
43
- import { TextStyle as fr } from "@tiptap/extension-text-style";
44
- import gr from "@tiptap/extension-color";
45
- import pr from "@tiptap/extension-highlight";
46
- import hr from "katex";
1
+ var Rn = Object.defineProperty;
2
+ var On = (e, t, n) => t in e ? Rn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var $e = (e, t, n) => On(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { jsx as f, jsxs as L, Fragment as Se } from "react/jsx-runtime";
5
+ import Fe, { forwardRef as qt, useState as z, useEffect as B, useCallback as de, useImperativeHandle as Vt, useRef as X, useMemo as Ee } from "react";
6
+ import { Extension as Ze, ReactRenderer as $n, Node as ee, mergeAttributes as se, NodeViewWrapper as Fn, ReactNodeViewRenderer as Kt, useEditorState as zn, EditorContent as Bn, useEditor as Hn } from "@tiptap/react";
7
+ import Un from "@tiptap/extension-document";
8
+ import jn from "@tiptap/extension-paragraph";
9
+ import Wn from "@tiptap/extension-text";
10
+ import Gn from "@tiptap/extension-heading";
11
+ import qn from "@tiptap/extension-bullet-list";
12
+ import Vn from "@tiptap/extension-ordered-list";
13
+ import Kn from "@tiptap/extension-list-item";
14
+ import Jn from "@tiptap/extension-blockquote";
15
+ import Xn from "@tiptap/extension-code-block";
16
+ import Yn from "@tiptap/extension-horizontal-rule";
17
+ import Qn from "@tiptap/extension-task-list";
18
+ import Zn from "@tiptap/extension-task-item";
19
+ import er from "@tiptap/extension-image";
20
+ import { Table as tr } from "@tiptap/extension-table";
21
+ import nr from "@tiptap/extension-table-row";
22
+ import rr from "@tiptap/extension-table-cell";
23
+ import ar from "@tiptap/extension-table-header";
24
+ import sr from "@tiptap/extension-placeholder";
25
+ import ir from "@tiptap/extension-history";
26
+ import { dropCursor as or } from "prosemirror-dropcursor";
27
+ import { gapCursor as cr } from "prosemirror-gapcursor";
28
+ import lr from "@tiptap/extension-text-align";
29
+ import { PluginKey as Le, Plugin as et, TextSelection as Ne } from "@tiptap/pm/state";
30
+ import dr from "@tiptap/suggestion";
31
+ import ur from "tippy.js";
32
+ import { create as mr } from "zustand";
33
+ import { DecorationSet as ke, Decoration as le } from "@tiptap/pm/view";
34
+ import { diff_match_patch as Jt } from "diff-match-patch";
35
+ import fr from "@tiptap/extension-bold";
36
+ import gr from "@tiptap/extension-italic";
37
+ import pr from "@tiptap/extension-underline";
38
+ import hr from "@tiptap/extension-strike";
39
+ import yr from "@tiptap/extension-code";
40
+ import br from "@tiptap/extension-superscript";
41
+ import vr from "@tiptap/extension-subscript";
42
+ import Cr from "@tiptap/extension-link";
43
+ import { TextStyle as wr } from "@tiptap/extension-text-style";
44
+ import xr from "@tiptap/extension-color";
45
+ import Sr from "@tiptap/extension-highlight";
46
+ import Tr from "katex";
47
47
  import "katex/dist/katex.min.css";
48
48
  import "mathlive";
49
- import { findWrapping as yr } from "@tiptap/pm/transform";
50
- import { Slice as br, Fragment as vr } from "@tiptap/pm/model";
51
- import { createPortal as Cr } from "react-dom";
52
- import { Undo2 as wr, Redo2 as xr, Bold as Vt, Italic as Kt, Underline as Jt, Strikethrough as Xt, Code as Qt, Superscript as Yt, Subscript as Zt, Pilcrow as Sr, Heading1 as Tr, Heading2 as Ir, Heading3 as Er, AlignLeft as Nr, AlignCenter as _r, AlignRight as kr, AlignJustify as Ar, List as Lr, ListOrdered as Pr, Quote as Dr, FileCode2 as Mr, Table as Rr, Minus as $r, CheckSquare as Or, Image as en, Link2 as ht, FileText as tn, Box as Fr, Workflow as zr, FunctionSquare as Br, Sigma as Hr, GitGraph as Ur, Square as It, Download as jr, ChevronDown as nn, Trash2 as Wr, Highlighter as Gr, Sparkles as qr, CaseSensitive as Vr, ChevronUp as Kr, Replace as Et, X as Jr, ReplaceAll as Xr, PanelLeft as Qr, PanelLeftClose as Yr } from "lucide-react";
53
- import re from "clsx";
54
- import { convertMillimetersToTwip as Se, Document as Zr, Packer as ea, Paragraph as Qe, AlignmentType as yt, TextRun as Ye } from "docx";
55
- import { saveAs as ta } from "file-saver";
56
- import { BubbleMenu as na } from "@tiptap/react/menus";
57
- const ra = new ke("slashCommand"), aa = Je.create({
49
+ import { findWrapping as Ir } from "@tiptap/pm/transform";
50
+ import { Slice as Er, Fragment as Nr } from "@tiptap/pm/model";
51
+ import { createPortal as _r } from "react-dom";
52
+ import { Undo2 as kr, Redo2 as Ar, Bold as Xt, Italic as Yt, Underline as Qt, Strikethrough as Zt, Code as en, Superscript as tn, Subscript as nn, Pilcrow as Lr, Heading1 as Pr, Heading2 as Dr, Heading3 as Mr, AlignLeft as Rr, AlignCenter as Or, AlignRight as $r, AlignJustify as Fr, List as zr, ListOrdered as Br, Quote as Hr, FileCode2 as Ur, Table as jr, Minus as Wr, CheckSquare as Gr, Image as rn, Link2 as vt, FileText as an, Box as qr, Workflow as Vr, FunctionSquare as Kr, Sigma as Jr, GitGraph as Xr, Square as _t, Download as Yr, ChevronDown as sn, Trash2 as Qr, Highlighter as Zr, Sparkles as ea, CaseSensitive as ta, ChevronUp as na, Replace as kt, X as ra, ReplaceAll as aa, PanelLeft as sa, PanelLeftClose as ia } from "lucide-react";
53
+ import ae from "clsx";
54
+ import { convertMillimetersToTwip as Ie, Document as oa, Packer as ca, Paragraph as tt, AlignmentType as Ct, TextRun as nt } from "docx";
55
+ import { saveAs as la } from "file-saver";
56
+ import { BubbleMenu as da } from "@tiptap/react/menus";
57
+ const ua = new Le("slashCommand"), ma = Ze.create({
58
58
  name: "slashCommand",
59
59
  addOptions() {
60
60
  return {
@@ -68,14 +68,14 @@ const ra = new ke("slashCommand"), aa = Je.create({
68
68
  },
69
69
  addProseMirrorPlugins() {
70
70
  return [
71
- nr({
71
+ dr({
72
72
  editor: this.editor,
73
73
  ...this.options.suggestion,
74
- pluginKey: ra
74
+ pluginKey: ua
75
75
  })
76
76
  ];
77
77
  }
78
- }), sa = {
78
+ }), fa = {
79
79
  visible: !0,
80
80
  activeTab: "chat",
81
81
  activeSectionType: null,
@@ -83,7 +83,7 @@ const ra = new ke("slashCommand"), aa = Je.create({
83
83
  regenerate: !1,
84
84
  chatReferences: [],
85
85
  pendingChatMessage: null
86
- }, k = ar((e) => ({
86
+ }, k = mr((e) => ({
87
87
  editor: null,
88
88
  document: null,
89
89
  selection: null,
@@ -94,7 +94,7 @@ const ra = new ke("slashCommand"), aa = Je.create({
94
94
  aiService: null,
95
95
  chatSessionAPI: null,
96
96
  chatSessionId: null,
97
- rightPanel: { ...sa },
97
+ rightPanel: { ...fa },
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 ra = new ke("slashCommand"), aa = Je.create({
162
162
  setPendingChatMessage: (t) => e((n) => ({
163
163
  rightPanel: { ...n.rightPanel, pendingChatMessage: t }
164
164
  }))
165
- })), rn = jt(
165
+ })), on = qt(
166
166
  ({ items: e, command: t }, n) => {
167
167
  const [r, a] = z(0);
168
168
  B(() => {
@@ -175,7 +175,7 @@ const ra = new ke("slashCommand"), aa = Je.create({
175
175
  },
176
176
  [e, t]
177
177
  );
178
- return Wt(n, () => ({
178
+ return Vt(n, () => ({
179
179
  onKeyDown: ({ event: i }) => i.key === "ArrowUp" ? (a((l) => (l + e.length - 1) % e.length), !0) : i.key === "ArrowDown" ? (a((l) => (l + 1) % e.length), !0) : i.key === "Enter" ? (s(r), !0) : !1
180
180
  })), e.length ? /* @__PURE__ */ f("div", { className: "slash-menu", children: e.map((i, l) => /* @__PURE__ */ L(
181
181
  "button",
@@ -195,8 +195,8 @@ const ra = new ke("slashCommand"), aa = Je.create({
195
195
  )) }) : /* @__PURE__ */ f("div", { className: "slash-menu", children: /* @__PURE__ */ f("div", { className: "slash-menu-empty", children: "No results" }) });
196
196
  }
197
197
  );
198
- rn.displayName = "SlashMenuList";
199
- function ia(e) {
198
+ on.displayName = "SlashMenuList";
199
+ function ga(e) {
200
200
  const t = e === "zh";
201
201
  return [
202
202
  {
@@ -301,16 +301,16 @@ function ia(e) {
301
301
  description: t ? "插入权利要求条目 (Ctrl+Shift+C)" : "Insert a patent claim block (Ctrl+Shift+C)",
302
302
  icon: "§",
303
303
  command: ({ editor: n, range: r }) => {
304
- n.chain().focus().deleteRange(r).run(), Ae(n).execCommand("insertClaim");
304
+ n.chain().focus().deleteRange(r).run(), Pe(n).execCommand("insertClaim");
305
305
  }
306
306
  }
307
307
  ];
308
308
  }
309
- function oa() {
309
+ function pa() {
310
310
  return {
311
311
  char: "/",
312
312
  items: ({ query: e }) => {
313
- const t = k.getState().editorLanguage, n = ia(t);
313
+ const t = k.getState().editorLanguage, n = ga(t);
314
314
  if (!e) return n;
315
315
  const r = e.toLowerCase();
316
316
  return n.filter(
@@ -321,10 +321,10 @@ function oa() {
321
321
  let e = null, t = null;
322
322
  return {
323
323
  onStart: (n) => {
324
- e = new kn(rn, {
324
+ e = new $n(on, {
325
325
  props: n,
326
326
  editor: n.editor
327
- }), n.clientRect && (t = rr("body", {
327
+ }), n.clientRect && (t = ur("body", {
328
328
  getReferenceClientRect: n.clientRect,
329
329
  appendTo: () => document.body,
330
330
  content: e.element,
@@ -351,8 +351,8 @@ function oa() {
351
351
  }
352
352
  };
353
353
  }
354
- const ca = new ke("searchReplace");
355
- function Re(e, t, n) {
354
+ const ha = new Le("searchReplace");
355
+ function ze(e, t, n) {
356
356
  if (!t) return [];
357
357
  const r = [], a = e.textBetween(0, e.content.size, `
358
358
  `, "\0"), s = n ? t : t.toLowerCase(), i = n ? a : a.toLowerCase();
@@ -377,7 +377,7 @@ function Re(e, t, n) {
377
377
  }
378
378
  return r;
379
379
  }
380
- const la = Je.create({
380
+ const ya = Ze.create({
381
381
  name: "searchReplace",
382
382
  addStorage() {
383
383
  return {
@@ -390,30 +390,30 @@ const la = Je.create({
390
390
  },
391
391
  addCommands() {
392
392
  return {
393
- setSearchTerm: (e) => ({ editor: t }) => (this.storage.searchTerm = e, this.storage.results = Re(t.state.doc, e, this.storage.caseSensitive), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
393
+ setSearchTerm: (e) => ({ editor: t }) => (this.storage.searchTerm = e, this.storage.results = ze(t.state.doc, e, this.storage.caseSensitive), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
394
394
  setReplaceTerm: (e) => () => (this.storage.replaceTerm = e, !0),
395
- setCaseSensitive: (e) => ({ editor: t }) => (this.storage.caseSensitive = e, this.storage.results = Re(t.state.doc, this.storage.searchTerm, e), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
395
+ setCaseSensitive: (e) => ({ editor: t }) => (this.storage.caseSensitive = e, this.storage.results = ze(t.state.doc, this.storage.searchTerm, e), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
396
396
  nextSearchResult: () => ({ editor: e }) => {
397
397
  if (this.storage.results.length === 0) return !1;
398
398
  this.storage.currentIndex = (this.storage.currentIndex + 1) % this.storage.results.length;
399
399
  const t = this.storage.results[this.storage.currentIndex];
400
- return t && (e.commands.setTextSelection(t), Nt(e)), e.view.dispatch(e.state.tr), !0;
400
+ return t && (e.commands.setTextSelection(t), At(e)), e.view.dispatch(e.state.tr), !0;
401
401
  },
402
402
  previousSearchResult: () => ({ editor: e }) => {
403
403
  if (this.storage.results.length === 0) return !1;
404
404
  this.storage.currentIndex = (this.storage.currentIndex - 1 + this.storage.results.length) % this.storage.results.length;
405
405
  const t = this.storage.results[this.storage.currentIndex];
406
- return t && (e.commands.setTextSelection(t), Nt(e)), e.view.dispatch(e.state.tr), !0;
406
+ return t && (e.commands.setTextSelection(t), At(e)), e.view.dispatch(e.state.tr), !0;
407
407
  },
408
408
  replaceCurrent: () => ({ editor: e }) => {
409
409
  if (this.storage.results.length === 0 || this.storage.currentIndex < 0) return !1;
410
410
  const t = this.storage.results[this.storage.currentIndex];
411
- return t ? (e.chain().focus().insertContentAt(t, this.storage.replaceTerm).run(), this.storage.results = Re(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;
411
+ return t ? (e.chain().focus().insertContentAt(t, this.storage.replaceTerm).run(), this.storage.results = ze(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;
412
412
  },
413
413
  replaceAll: () => ({ editor: e }) => {
414
414
  if (this.storage.results.length === 0) return !1;
415
415
  const { searchTerm: t, replaceTerm: n, caseSensitive: r } = this.storage;
416
- let a = Re(e.state.doc, t, r);
416
+ let a = ze(e.state.doc, t, r);
417
417
  const s = e.state.tr;
418
418
  let i = 0;
419
419
  for (const l of a) {
@@ -440,24 +440,24 @@ const la = Je.create({
440
440
  addProseMirrorPlugins() {
441
441
  const e = this.storage;
442
442
  return [
443
- new Xe({
444
- key: ca,
443
+ new et({
444
+ key: ha,
445
445
  props: {
446
446
  decorations: (t) => {
447
447
  if (!e.searchTerm || e.results.length === 0)
448
- return Ne.empty;
448
+ return ke.empty;
449
449
  const n = e.results.map((r, a) => {
450
450
  const s = a === e.currentIndex ? "search-highlight search-highlight--current" : "search-highlight";
451
451
  return le.inline(r.from, r.to, { class: s });
452
452
  });
453
- return Ne.create(t.doc, n);
453
+ return ke.create(t.doc, n);
454
454
  }
455
455
  }
456
456
  })
457
457
  ];
458
458
  }
459
459
  });
460
- function Nt(e) {
460
+ function At(e) {
461
461
  requestAnimationFrame(() => {
462
462
  const t = e.view.domAtPos(e.state.selection.from);
463
463
  if (t != null && t.node) {
@@ -466,17 +466,17 @@ function Nt(e) {
466
466
  }
467
467
  });
468
468
  }
469
- const da = -1, ua = 1, _t = 0;
470
- let nt = null;
471
- function ma() {
472
- return nt || (nt = new qt()), nt;
469
+ const ba = -1, va = 1, Lt = 0;
470
+ let st = null;
471
+ function Ca() {
472
+ return st || (st = new Jt()), st;
473
473
  }
474
- const an = new ke("patchDiff");
475
- function fa(e, t) {
474
+ const cn = new Le("patchDiff");
475
+ function wa(e, t) {
476
476
  let n = null;
477
477
  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;
478
478
  }
479
- function sn(e, t, n) {
479
+ function ln(e, t, n) {
480
480
  const r = [];
481
481
  let a = "", s = !0;
482
482
  return e.state.doc.nodesBetween(t, n, (i, l) => {
@@ -486,26 +486,26 @@ function sn(e, t, n) {
486
486
  } else i.isLeaf ? (a += "\0", s = !1) : !s && i.isBlock && (a += "\0", s = !0);
487
487
  }), { text: a, segments: r };
488
488
  }
489
- function Ee(e, t) {
489
+ function _e(e, t) {
490
490
  for (const n of e)
491
491
  if (t >= n.textIdx && t <= n.textIdx + n.len)
492
492
  return n.docPos + (t - n.textIdx);
493
493
  return -1;
494
494
  }
495
- function kt(e, t, n, r, a) {
496
- const { text: s, segments: i } = sn(e, n, r);
495
+ function Pt(e, t, n, r, a) {
496
+ const { text: s, segments: i } = ln(e, n, r);
497
497
  let l = 0;
498
498
  for (; l <= s.length - t.length; ) {
499
499
  const c = s.indexOf(t, l);
500
500
  if (c === -1) return null;
501
- const d = Ee(i, c), o = Ee(i, c + t.length);
501
+ const d = _e(i, c), o = _e(i, c + t.length);
502
502
  if (d >= 0 && o >= 0 && !(a && a.has(d)))
503
503
  return { from: d, to: o };
504
504
  l = c + 1;
505
505
  }
506
506
  return null;
507
507
  }
508
- function Ki(e, t, n, r, a) {
508
+ function no(e, t, n, r, a) {
509
509
  const s = t.target;
510
510
  let i = null;
511
511
  const l = /* @__PURE__ */ new Set();
@@ -515,15 +515,15 @@ function Ki(e, t, n, r, a) {
515
515
  if (!s)
516
516
  t.from != null && t.to != null && (i = { from: t.from, to: t.to });
517
517
  else if (s.type === "section" && s.sectionType)
518
- i = fa(e, s.sectionType);
518
+ i = wa(e, s.sectionType);
519
519
  else if (s.type === "ref" && s.refIndex != null) {
520
520
  const o = n[s.refIndex];
521
521
  (o == null ? void 0 : o.from) != null && (o == null ? void 0 : o.to) != null && (i = { from: o.from, to: o.to });
522
- } else s.type === "search" && s.searchText && (i = kt(e, s.searchText, 0, e.state.doc.content.size, l));
522
+ } else s.type === "search" && s.searchText && (i = Pt(e, s.searchText, 0, e.state.doc.content.size, l));
523
523
  if (!i) return null;
524
524
  let c = i;
525
525
  if (t.search) {
526
- const o = kt(e, t.search, i.from, i.to, l);
526
+ const o = Pt(e, t.search, i.from, i.to, l);
527
527
  o && (c = o);
528
528
  }
529
529
  const d = c.from < c.to ? e.state.doc.textBetween(c.from, c.to, " ", "\0") : "";
@@ -538,26 +538,26 @@ function Ki(e, t, n, r, a) {
538
538
  status: "pending"
539
539
  };
540
540
  }
541
- let G = [], Ue = [];
542
- function Ji(e) {
543
- return Ue.push(e), () => {
544
- Ue = Ue.filter((t) => t !== e);
541
+ let q = [], qe = [];
542
+ function ro(e) {
543
+ return qe.push(e), () => {
544
+ qe = qe.filter((t) => t !== e);
545
545
  };
546
546
  }
547
- function be() {
548
- Ue.forEach((e) => e());
547
+ function ve() {
548
+ qe.forEach((e) => e());
549
549
  }
550
- function Xi() {
551
- return [...G];
550
+ function ao() {
551
+ return [...q];
552
552
  }
553
- function Qi(e) {
554
- G = e, be();
553
+ function so(e) {
554
+ q = e, ve();
555
555
  }
556
- function Yi() {
557
- G = [], be();
556
+ function io() {
557
+ q = [], ve();
558
558
  }
559
- function Zi(e, t) {
560
- const n = G.find((s) => s.id === t);
559
+ function oo(e, t) {
560
+ const n = q.find((s) => s.id === t);
561
561
  if (!n || n.status !== "pending") return !1;
562
562
  n.status = "accepted";
563
563
  const { tr: r } = e.state;
@@ -565,45 +565,45 @@ function Zi(e, t) {
565
565
  r.delete(n.from, n.to);
566
566
  else if (n.type === "insert")
567
567
  r.insertText(n.content, n.from);
568
- else if (on(e, n.from, n.to)) {
569
- const i = cn(e, n.content);
568
+ else if (dn(e, n.from, n.to)) {
569
+ const i = un(e, n.content);
570
570
  r.replaceWith(n.from, n.to, i);
571
571
  } else
572
572
  r.insertText(n.content, n.from, n.to);
573
573
  e.view.dispatch(r);
574
574
  const a = r.mapping;
575
- for (const s of G) {
575
+ for (const s of q) {
576
576
  if (s.id === t || s.status !== "pending") continue;
577
577
  const i = a.map(s.from, 1), l = a.map(s.to, -1);
578
578
  i >= l && s.type !== "insert" ? s.status = "rejected" : (s.from = i, s.to = s.type === "insert" ? i : l);
579
579
  }
580
- return G = G.filter((s) => s.id !== t && s.status === "pending"), Ze(e), be(), !0;
580
+ return q = q.filter((s) => s.id !== t && s.status === "pending"), rt(e), ve(), !0;
581
581
  }
582
- function eo(e, t) {
583
- const n = G.find((r) => r.id === t);
584
- return !n || n.status !== "pending" ? !1 : (n.status = "rejected", G = G.filter((r) => r.id !== t), Ze(e), be(), !0);
582
+ function co(e, t) {
583
+ const n = q.find((r) => r.id === t);
584
+ return !n || n.status !== "pending" ? !1 : (n.status = "rejected", q = q.filter((r) => r.id !== t), rt(e), ve(), !0);
585
585
  }
586
- function to(e) {
587
- const n = [...G.filter((a) => a.status === "pending")].sort((a, s) => s.from - a.from), { tr: r } = e.state;
586
+ function lo(e) {
587
+ const n = [...q.filter((a) => a.status === "pending")].sort((a, s) => s.from - a.from), { tr: r } = e.state;
588
588
  for (const a of n)
589
589
  if (a.type === "delete")
590
590
  r.delete(a.from, a.to);
591
591
  else if (a.type === "insert")
592
592
  r.insertText(a.content, a.from);
593
- else if (on(e, a.from, a.to)) {
594
- const i = cn(e, a.content);
593
+ else if (dn(e, a.from, a.to)) {
594
+ const i = un(e, a.content);
595
595
  r.replaceWith(a.from, a.to, i);
596
596
  } else
597
597
  r.insertText(a.content, a.from, a.to);
598
- e.view.dispatch(r), G = [], Ze(e), be();
598
+ e.view.dispatch(r), q = [], rt(e), ve();
599
599
  }
600
- function no(e) {
601
- G = [], Ze(e), be();
600
+ function uo(e) {
601
+ q = [], rt(e), ve();
602
602
  }
603
- function Ze(e) {
604
- e.view.dispatch(e.state.tr.setMeta(an, !0));
603
+ function rt(e) {
604
+ e.view.dispatch(e.state.tr.setMeta(cn, !0));
605
605
  }
606
- function ga(e, t, n) {
606
+ function xa(e, t, n) {
607
607
  const r = [];
608
608
  return e.nodesBetween(t, n, (a, s) => {
609
609
  if (a.isTextblock) {
@@ -613,7 +613,7 @@ function ga(e, t, n) {
613
613
  return !0;
614
614
  }), r;
615
615
  }
616
- function pa(e, t) {
616
+ function Sa(e, t) {
617
617
  if (!t.originalText || !t.content) return null;
618
618
  try {
619
619
  const l = e.resolve(t.from), c = e.resolve(t.to);
@@ -621,16 +621,16 @@ function pa(e, t) {
621
621
  } catch {
622
622
  return null;
623
623
  }
624
- const n = ma(), r = n.diff_main(t.originalText, t.content);
624
+ const n = Ca(), r = n.diff_main(t.originalText, t.content);
625
625
  n.diff_cleanupSemantic(r);
626
- const a = r.filter(([l]) => l === _t).reduce((l, [, c]) => l + c.length, 0);
626
+ const a = r.filter(([l]) => l === Lt).reduce((l, [, c]) => l + c.length, 0);
627
627
  if (t.originalText.length > 0 && a / t.originalText.length < 0.3) return null;
628
628
  const s = [];
629
629
  let i = t.from;
630
630
  for (const [l, c] of r)
631
- if (l === _t)
631
+ if (l === Lt)
632
632
  i += c.length;
633
- else if (l === da) {
633
+ else if (l === ba) {
634
634
  const d = i + c.length;
635
635
  s.push(
636
636
  le.inline(i, d, {
@@ -638,7 +638,7 @@ function pa(e, t) {
638
638
  "data-patch-id": t.id
639
639
  })
640
640
  ), i = d;
641
- } else l === ua && s.push(
641
+ } else l === va && s.push(
642
642
  le.widget(i, () => {
643
643
  const d = document.createElement("span");
644
644
  return d.className = "patch-diff-insert-inline", d.textContent = c, d.setAttribute("data-patch-id", t.id), d;
@@ -646,24 +646,24 @@ function pa(e, t) {
646
646
  );
647
647
  return s;
648
648
  }
649
- function ha() {
650
- return new Xe({
651
- key: an,
649
+ function Ta() {
650
+ return new et({
651
+ key: cn,
652
652
  props: {
653
653
  decorations(e) {
654
- const t = G.filter((r) => r.status === "pending");
655
- if (t.length === 0) return Ne.empty;
654
+ const t = q.filter((r) => r.status === "pending");
655
+ if (t.length === 0) return ke.empty;
656
656
  const n = [];
657
657
  for (const r of t) {
658
658
  if (r.type === "replace") {
659
- const a = pa(e.doc, r);
659
+ const a = Sa(e.doc, r);
660
660
  if (a) {
661
661
  n.push(...a);
662
662
  continue;
663
663
  }
664
664
  }
665
665
  if (r.type === "delete" || r.type === "replace") {
666
- const a = ga(e.doc, r.from, r.to);
666
+ const a = xa(e.doc, r.from, r.to);
667
667
  for (const s of a)
668
668
  n.push(
669
669
  le.inline(s.from, s.to, {
@@ -689,17 +689,17 @@ function ha() {
689
689
  })
690
690
  );
691
691
  }
692
- return Ne.create(e.doc, n);
692
+ return ke.create(e.doc, n);
693
693
  }
694
694
  }
695
695
  });
696
696
  }
697
- function on(e, t, n) {
697
+ function dn(e, t, n) {
698
698
  var s;
699
699
  const r = e.state.doc.resolve(t);
700
700
  return !!((s = r.parent.type.spec.content) != null && s.includes("block") && t === r.start() && n === r.end());
701
701
  }
702
- function cn(e, t) {
702
+ function un(e, t) {
703
703
  const n = e.state.schema;
704
704
  return t.split(/\n\n+/).filter((a) => a.trim().length > 0).map((a) => {
705
705
  const s = a.replace(/\n/g, " ").trim();
@@ -709,7 +709,7 @@ function cn(e, t) {
709
709
  );
710
710
  });
711
711
  }
712
- const ya = ee.create({
712
+ const Ia = ee.create({
713
713
  name: "hardBreak",
714
714
  inline: !0,
715
715
  group: "inline",
@@ -730,40 +730,40 @@ const ya = ee.create({
730
730
  }
731
731
  };
732
732
  }
733
- }), ba = Je.create({
733
+ }), Ea = Ze.create({
734
734
  name: "dragDropUX",
735
735
  addProseMirrorPlugins() {
736
736
  return [
737
- Zn({
737
+ or({
738
738
  width: 3,
739
739
  color: "#2563eb"
740
740
  }),
741
- er()
741
+ cr()
742
742
  ];
743
743
  }
744
- }), va = Je.create({
744
+ }), Na = Ze.create({
745
745
  name: "patchDiff",
746
746
  addProseMirrorPlugins() {
747
- return [ha()];
747
+ return [Ta()];
748
748
  }
749
- }), Ca = [
750
- Mn,
751
- Rn,
752
- $n,
753
- ba,
754
- On.configure({
755
- levels: [1, 2, 3, 4, 5, 6]
756
- }),
757
- Fn,
758
- zn,
759
- Bn,
760
- Hn,
749
+ }), _a = [
761
750
  Un,
762
- ya,
763
751
  jn,
764
752
  Wn,
765
- Gn.configure({ nested: !0 }),
766
- qn.extend({
753
+ Ea,
754
+ Gn.configure({
755
+ levels: [1, 2, 3, 4, 5, 6]
756
+ }),
757
+ qn,
758
+ Vn,
759
+ Kn,
760
+ Jn,
761
+ Xn,
762
+ Ia,
763
+ Yn,
764
+ Qn,
765
+ Zn.configure({ nested: !0 }),
766
+ er.extend({
767
767
  addAttributes() {
768
768
  var e;
769
769
  return {
@@ -779,46 +779,46 @@ const ya = ee.create({
779
779
  inline: !0,
780
780
  allowBase64: !0
781
781
  }),
782
- Vn.configure({
782
+ tr.configure({
783
783
  resizable: !0
784
784
  }),
785
- Kn,
786
- Jn,
787
- Xn,
788
- Qn.configure({
785
+ nr,
786
+ rr,
787
+ ar,
788
+ sr.configure({
789
789
  placeholder: ({ node: e }) => e.type.name === "heading" ? "Heading" : "Type / for commands..."
790
790
  }),
791
- Yn,
792
- aa.configure({
793
- suggestion: oa()
791
+ ir,
792
+ ma.configure({
793
+ suggestion: pa()
794
794
  }),
795
- la,
796
- tr.configure({
795
+ ya,
796
+ lr.configure({
797
797
  types: ["heading", "paragraph"],
798
798
  defaultAlignment: "left"
799
799
  }),
800
- va
801
- ], wa = [
802
- sr,
803
- ir,
804
- or,
805
- cr,
806
- lr,
807
- dr,
808
- ur,
809
- mr.configure({
810
- openOnClick: !1
811
- }),
800
+ Na
801
+ ], ka = [
812
802
  fr,
813
803
  gr,
814
- pr.configure({ multicolor: !0 })
815
- ], xa = [
816
- ...Ca,
817
- ...wa
804
+ pr,
805
+ hr,
806
+ yr,
807
+ br,
808
+ vr,
809
+ Cr.configure({
810
+ openOnClick: !1
811
+ }),
812
+ wr,
813
+ xr,
814
+ Sr.configure({ multicolor: !0 })
815
+ ], Aa = [
816
+ ..._a,
817
+ ...ka
818
818
  ];
819
- class Sa {
819
+ class La {
820
820
  constructor() {
821
- De(this, "commands", /* @__PURE__ */ new Map());
821
+ $e(this, "commands", /* @__PURE__ */ new Map());
822
822
  }
823
823
  normalizeCommand(t) {
824
824
  return typeof t == "function" ? {
@@ -882,11 +882,11 @@ class Sa {
882
882
  return Array.from(this.commands.keys()).sort();
883
883
  }
884
884
  }
885
- const ge = new Sa();
886
- class Ta {
885
+ const pe = new La();
886
+ class Pa {
887
887
  constructor() {
888
- De(this, "plugins", /* @__PURE__ */ new Map());
889
- De(this, "lifecycleOrder", ["register", "init", "stateSync", "destroy"]);
888
+ $e(this, "plugins", /* @__PURE__ */ new Map());
889
+ $e(this, "lifecycleOrder", ["register", "init", "stateSync", "destroy"]);
890
890
  }
891
891
  logLifecycle(t, n) {
892
892
  t !== "stateSync" && console.info(`[PluginManager:${t}] ${n}`);
@@ -896,7 +896,7 @@ class Ta {
896
896
  }
897
897
  registerPluginCommands(t) {
898
898
  t.commands && Object.entries(t.commands).forEach(([n, r]) => {
899
- ge.register(n, r, { namespace: t.name });
899
+ pe.register(n, r, { namespace: t.name });
900
900
  });
901
901
  }
902
902
  register(t) {
@@ -932,22 +932,22 @@ class Ta {
932
932
  });
933
933
  }
934
934
  executeCommand(t, n, r, a) {
935
- return ge.execute(t, n, r, a);
935
+ return pe.execute(t, n, r, a);
936
936
  }
937
937
  canExecuteCommand(t, n, r) {
938
- return ge.canExecute(t, n, r);
938
+ return pe.canExecute(t, n, r);
939
939
  }
940
940
  isCommandActive(t, n) {
941
- return ge.isActive(t, n);
941
+ return pe.isActive(t, n);
942
942
  }
943
943
  getCommandNames() {
944
- return ge.getCommands();
944
+ return pe.getCommands();
945
945
  }
946
946
  getLifecycleOrder() {
947
947
  return [...this.lifecycleOrder];
948
948
  }
949
949
  getCommandMeta(t) {
950
- return ge.getCommand(t);
950
+ return pe.getCommand(t);
951
951
  }
952
952
  getToolbarItems() {
953
953
  const t = [];
@@ -968,7 +968,7 @@ class Ta {
968
968
  });
969
969
  }
970
970
  }
971
- const W = new Ta(), At = {
971
+ const G = new Pa(), Dt = {
972
972
  zh: {
973
973
  language: "语言",
974
974
  bold: "加粗",
@@ -1135,13 +1135,13 @@ const W = new Ta(), At = {
1135
1135
  autoSaveSaved: "Saved",
1136
1136
  autoSaveError: "Save failed"
1137
1137
  }
1138
- }, U = (e) => e === "en" ? At.en : At.zh, he = (e, t, n, r) => e === "en" ? t === "forward_reference" ? `Claim ${n} references later claim ${r}.` : t === "self_reference" ? `Claim ${n} references itself.` : `Claim ${n} has circular dependency.` : t === "forward_reference" ? `权利要求${n}引用了后置项权利要求${r}。` : t === "self_reference" ? `权利要求${n}引用了自身。` : `权利要求${n}存在循环依赖。`;
1139
- let $e = 0;
1140
- const Oe = () => {
1138
+ }, j = (e) => e === "en" ? Dt.en : Dt.zh, ye = (e, t, n, r) => e === "en" ? t === "forward_reference" ? `Claim ${n} references later claim ${r}.` : t === "self_reference" ? `Claim ${n} references itself.` : `Claim ${n} has circular dependency.` : t === "forward_reference" ? `权利要求${n}引用了后置项权利要求${r}。` : t === "self_reference" ? `权利要求${n}引用了自身。` : `权利要求${n}存在循环依赖。`;
1139
+ let Be = 0;
1140
+ const He = () => {
1141
1141
  document.querySelectorAll('body > svg[id^="standalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
1142
1142
  (e.id.startsWith("dmermaid") || e.id.startsWith("dstandalone")) && e.remove();
1143
1143
  }), 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());
1144
- }, Ia = ee.create({
1144
+ }, Da = ee.create({
1145
1145
  name: "mermaid",
1146
1146
  group: "block",
1147
1147
  atom: !0,
@@ -1154,7 +1154,7 @@ const Oe = () => {
1154
1154
  return [{ tag: 'div[data-type="mermaid"]' }];
1155
1155
  },
1156
1156
  renderHTML({ HTMLAttributes: e }) {
1157
- return ["div", ae(e, { "data-type": "mermaid" })];
1157
+ return ["div", se(e, { "data-type": "mermaid" })];
1158
1158
  },
1159
1159
  addNodeView() {
1160
1160
  return ({ editor: e, node: t, getPos: n }) => {
@@ -1193,13 +1193,13 @@ const Oe = () => {
1193
1193
  }
1194
1194
  try {
1195
1195
  const N = await import("mermaid");
1196
- N.default.initialize({ startOnLoad: !1, theme: "default" }), $e += 1;
1197
- const M = `standalone-mermaid-${$e}`, { svg: R } = await N.default.render(M, T);
1196
+ N.default.initialize({ startOnLoad: !1, theme: "default" }), Be += 1;
1197
+ const M = `standalone-mermaid-${Be}`, { svg: R } = await N.default.render(M, T);
1198
1198
  l.innerHTML = R, w = T;
1199
1199
  } catch {
1200
1200
  l.innerHTML = "", w = "";
1201
1201
  } finally {
1202
- Oe();
1202
+ He();
1203
1203
  }
1204
1204
  }
1205
1205
  }, v = () => {
@@ -1213,11 +1213,11 @@ const Oe = () => {
1213
1213
  if (T)
1214
1214
  try {
1215
1215
  const N = await import("mermaid");
1216
- N.default.initialize({ startOnLoad: !1, theme: "default" }), $e += 1;
1217
- const M = `standalone-mermaid-${$e}`, { svg: R } = await N.default.render(M, T);
1218
- l.innerHTML = R, w = T, Oe();
1216
+ N.default.initialize({ startOnLoad: !1, theme: "default" }), Be += 1;
1217
+ const M = `standalone-mermaid-${Be}`, { svg: R } = await N.default.render(M, T);
1218
+ l.innerHTML = R, w = T, He();
1219
1219
  } catch {
1220
- Oe();
1220
+ He();
1221
1221
  const N = k.getState().editorLanguage;
1222
1222
  m.textContent = N === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", m.style.display = "inline";
1223
1223
  return;
@@ -1232,7 +1232,7 @@ const Oe = () => {
1232
1232
  h.stopPropagation(), C();
1233
1233
  }), o.addEventListener("mousedown", (h) => h.stopPropagation()), o.addEventListener("keydown", (h) => h.stopPropagation()), o.addEventListener("keypress", (h) => h.stopPropagation());
1234
1234
  const I = () => {
1235
- const h = k.getState().editorLanguage, T = U(h), N = typeof r.attrs.code == "string" ? r.attrs.code : "";
1235
+ const h = k.getState().editorLanguage, T = j(h), N = typeof r.attrs.code == "string" ? r.attrs.code : "";
1236
1236
  i.style.display = a ? "none" : "block", d.style.display = a ? "block" : "none", g.textContent = T.mermaidSaveAndRender || "保存并渲染", p.textContent = T.mermaidCancel || "取消";
1237
1237
  const M = N.trim().length > 0, R = l.querySelector("svg") !== null;
1238
1238
  a || (M && R ? (c.textContent = T.mermaidDoubleClickToEdit || "双击编辑", c.className = "mermaid-view-hint mermaid-view-hint--subtle") : (c.textContent = T.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", c.className = "mermaid-view-hint mermaid-view-hint--empty")), !a && N.trim() !== w && b(N);
@@ -1250,15 +1250,15 @@ const Oe = () => {
1250
1250
  ignoreMutation: () => !0,
1251
1251
  update: (h) => h.type.name !== "mermaid" ? !1 : (r = h, I(), !0),
1252
1252
  destroy: () => {
1253
- P(), Oe();
1253
+ P(), He();
1254
1254
  }
1255
1255
  };
1256
1256
  };
1257
1257
  }
1258
- }), Ea = {
1258
+ }), Ma = {
1259
1259
  name: "mermaid",
1260
1260
  version: "1.0.0",
1261
- extensions: [Ia],
1261
+ extensions: [Da],
1262
1262
  toolbarItems: [
1263
1263
  {
1264
1264
  id: "mermaid-insert",
@@ -1282,7 +1282,7 @@ const Oe = () => {
1282
1282
  }
1283
1283
  }
1284
1284
  }
1285
- }, Na = ee.create({
1285
+ }, Ra = ee.create({
1286
1286
  name: "drawio",
1287
1287
  group: "block",
1288
1288
  atom: !0,
@@ -1296,7 +1296,7 @@ const Oe = () => {
1296
1296
  return [{ tag: 'div[data-type="drawio"]' }];
1297
1297
  },
1298
1298
  renderHTML({ HTMLAttributes: e }) {
1299
- return ["div", ae(e, { "data-type": "drawio" })];
1299
+ return ["div", se(e, { "data-type": "drawio" })];
1300
1300
  },
1301
1301
  addNodeView() {
1302
1302
  return ({ editor: e, node: t, getPos: n }) => {
@@ -1338,20 +1338,20 @@ const Oe = () => {
1338
1338
  return;
1339
1339
  }
1340
1340
  if (N.event === "init") {
1341
- const Y = typeof r.attrs.xml == "string" ? r.attrs.xml : "";
1341
+ const Q = typeof r.attrs.xml == "string" ? r.attrs.xml : "";
1342
1342
  (M = h.contentWindow) == null || M.postMessage(
1343
- JSON.stringify({ action: "load", autosave: 0, xml: Y || "" }),
1343
+ JSON.stringify({ action: "load", autosave: 0, xml: Q || "" }),
1344
1344
  "*"
1345
1345
  );
1346
1346
  } else if (N.event === "save") {
1347
- const Y = N.xml || "";
1347
+ const Q = N.xml || "";
1348
1348
  (R = h.contentWindow) == null || R.postMessage(
1349
1349
  JSON.stringify({ action: "export", format: "svg" }),
1350
1350
  "*"
1351
- ), d({ xml: Y });
1351
+ ), d({ xml: Q });
1352
1352
  } else if (N.event === "export") {
1353
- const Y = N.data || "";
1354
- d({ svg: Y }), g();
1353
+ const Q = N.data || "";
1354
+ d({ svg: Q }), g();
1355
1355
  } else N.event === "exit" && g();
1356
1356
  }, window.addEventListener("message", o);
1357
1357
  }, g = () => {
@@ -1361,7 +1361,7 @@ const Oe = () => {
1361
1361
  v.preventDefault(), v.stopPropagation(), p();
1362
1362
  });
1363
1363
  const y = () => {
1364
- const v = k.getState().editorLanguage, C = U(v), x = typeof r.attrs.svg == "string" ? r.attrs.svg : "";
1364
+ const v = k.getState().editorLanguage, C = j(v), x = typeof r.attrs.svg == "string" ? r.attrs.svg : "";
1365
1365
  x ? (l.src = x, l.style.display = "block") : (l.src = "", l.style.display = "none"), x ? (c.textContent = C.mermaidDoubleClickToEdit || "双击编辑", c.className = "drawio-view-hint drawio-view-hint--subtle") : (c.textContent = C.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", c.className = "drawio-view-hint drawio-view-hint--empty");
1366
1366
  };
1367
1367
  let w = k.getState().editorLanguage;
@@ -1378,10 +1378,10 @@ const Oe = () => {
1378
1378
  };
1379
1379
  };
1380
1380
  }
1381
- }), _a = {
1381
+ }), Oa = {
1382
1382
  name: "drawio",
1383
1383
  version: "1.0.0",
1384
- extensions: [Na],
1384
+ extensions: [Ra],
1385
1385
  toolbarItems: [
1386
1386
  {
1387
1387
  id: "drawio-insert",
@@ -1405,7 +1405,7 @@ const Oe = () => {
1405
1405
  }
1406
1406
  }
1407
1407
  }
1408
- }, ln = ({
1408
+ }, mn = ({
1409
1409
  node: e,
1410
1410
  updateAttributes: t,
1411
1411
  selected: n,
@@ -1458,7 +1458,7 @@ const Oe = () => {
1458
1458
  }, [e.attrs.latex, s]);
1459
1459
  let p = "";
1460
1460
  try {
1461
- p = hr.renderToString(e.attrs.latex || "", {
1461
+ p = Tr.renderToString(e.attrs.latex || "", {
1462
1462
  throwOnError: !1,
1463
1463
  displayMode: l
1464
1464
  });
@@ -1466,7 +1466,7 @@ const Oe = () => {
1466
1466
  p = e.attrs.latex || "";
1467
1467
  }
1468
1468
  return /* @__PURE__ */ f(
1469
- An,
1469
+ Fn,
1470
1470
  {
1471
1471
  as: l ? "div" : "span",
1472
1472
  className: l ? "math-block" : "math-inline",
@@ -1483,7 +1483,7 @@ const Oe = () => {
1483
1483
  ] })
1484
1484
  }
1485
1485
  );
1486
- }, ka = ee.create({
1486
+ }, $a = ee.create({
1487
1487
  name: "math_inline",
1488
1488
  group: "inline",
1489
1489
  inline: !0,
@@ -1506,17 +1506,17 @@ const Oe = () => {
1506
1506
  ];
1507
1507
  },
1508
1508
  renderHTML({ HTMLAttributes: e }) {
1509
- return ["span", ae(e, { "data-type": "math_inline" })];
1509
+ return ["span", se(e, { "data-type": "math_inline" })];
1510
1510
  },
1511
1511
  addNodeView() {
1512
- return Gt(ln, {
1512
+ return Kt(mn, {
1513
1513
  stopEvent: ({ event: e }) => {
1514
1514
  const t = e.target;
1515
1515
  return t.tagName.toLowerCase() === "math-field" || t.closest("math-field") !== null;
1516
1516
  }
1517
1517
  });
1518
1518
  }
1519
- }), Aa = ee.create({
1519
+ }), Fa = ee.create({
1520
1520
  name: "math_block",
1521
1521
  group: "block",
1522
1522
  atom: !0,
@@ -1529,20 +1529,20 @@ const Oe = () => {
1529
1529
  return [{ tag: 'div[data-type="math_block"]' }];
1530
1530
  },
1531
1531
  renderHTML({ HTMLAttributes: e }) {
1532
- return ["div", ae(e, { "data-type": "math_block" })];
1532
+ return ["div", se(e, { "data-type": "math_block" })];
1533
1533
  },
1534
1534
  addNodeView() {
1535
- return Gt(ln, {
1535
+ return Kt(mn, {
1536
1536
  stopEvent: ({ event: e }) => {
1537
1537
  const t = e.target;
1538
1538
  return t.tagName.toLowerCase() === "math-field" || t.closest("math-field") !== null;
1539
1539
  }
1540
1540
  });
1541
1541
  }
1542
- }), La = {
1542
+ }), za = {
1543
1543
  name: "math",
1544
1544
  version: "1.0.0",
1545
- extensions: [ka, Aa],
1545
+ extensions: [$a, Fa],
1546
1546
  toolbarItems: [
1547
1547
  {
1548
1548
  id: "math-inline-insert",
@@ -1585,14 +1585,14 @@ const Oe = () => {
1585
1585
  }
1586
1586
  }
1587
1587
  }
1588
- }, bt = (e, t, n = {}) => {
1588
+ }, wt = (e, t, n = {}) => {
1589
1589
  const r = n.from ?? 0, a = n.to ?? e.state.doc.content.size;
1590
1590
  let s = null;
1591
1591
  return e.state.doc.nodesBetween(r, a, (i, l) => s ? !1 : i.type.name === t ? (s = { node: i, pos: l }, !1) : !0), s;
1592
- }, vt = (e, t, n = {}) => {
1592
+ }, xt = (e, t, n = {}) => {
1593
1593
  const r = n.from ?? 0, a = n.to ?? e.state.doc.content.size, s = [];
1594
1594
  return e.state.doc.nodesBetween(r, a, (i, l) => (t(i, l) && s.push({ node: i, pos: l }), !0)), s;
1595
- }, ye = (e, t) => {
1595
+ }, be = (e, t) => {
1596
1596
  const { $from: n } = e.state.selection;
1597
1597
  for (let r = n.depth; r >= 0; r -= 1) {
1598
1598
  const a = n.node(r);
@@ -1603,7 +1603,7 @@ const Oe = () => {
1603
1603
  };
1604
1604
  }
1605
1605
  return null;
1606
- }, Pa = (e) => {
1606
+ }, Ba = (e) => {
1607
1607
  const { $from: t } = e.state.selection;
1608
1608
  for (let n = t.depth; n >= 0; n -= 1) {
1609
1609
  const r = t.node(n);
@@ -1614,19 +1614,19 @@ const Oe = () => {
1614
1614
  };
1615
1615
  }
1616
1616
  return null;
1617
- }, Da = (e, t) => e.state.schema.nodes[t] || null, Ma = (e) => {
1617
+ }, Ha = (e, t) => e.state.schema.nodes[t] || null, Ua = (e) => {
1618
1618
  const t = Array.isArray(e.content) ? e.content : e.content ? [e.content] : void 0;
1619
1619
  return {
1620
1620
  type: e.type,
1621
1621
  attrs: e.attrs,
1622
1622
  content: t
1623
1623
  };
1624
- }, Ve = (e, t) => {
1625
- const n = Ma(t);
1624
+ }, Ye = (e, t) => {
1625
+ const n = Ua(t);
1626
1626
  return typeof t.position == "number" ? e.chain().focus().insertContentAt(t.position, n).run() : e.chain().focus().insertContent(n).run();
1627
- }, pe = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
1627
+ }, he = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
1628
1628
  var c;
1629
- const s = typeof t.position == "number" ? t.position : (c = bt(e, t.type || "")) == null ? void 0 : c.pos;
1629
+ const s = typeof t.position == "number" ? t.position : (c = wt(e, t.type || "")) == null ? void 0 : c.pos;
1630
1630
  if (typeof s != "number")
1631
1631
  return !1;
1632
1632
  const i = r.doc.nodeAt(s);
@@ -1634,31 +1634,31 @@ const Oe = () => {
1634
1634
  return !1;
1635
1635
  const l = { ...i.attrs, ...t.attrs };
1636
1636
  return n.setNodeMarkup(s, void 0, l), a && a(n), !0;
1637
- }), Ct = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
1637
+ }), St = (e, t) => typeof t.position != "number" && !t.type ? !1 : e.commands.command(({ tr: n, state: r, dispatch: a }) => {
1638
1638
  var l;
1639
- const s = typeof t.position == "number" ? t.position : (l = bt(e, t.type || "")) == null ? void 0 : l.pos;
1639
+ const s = typeof t.position == "number" ? t.position : (l = wt(e, t.type || "")) == null ? void 0 : l.pos;
1640
1640
  if (typeof s != "number")
1641
1641
  return !1;
1642
1642
  const i = r.doc.nodeAt(s);
1643
1643
  return !i || t.type && i.type.name !== t.type ? !1 : (n.delete(s, s + i.nodeSize), a && a(n), !0);
1644
- }), dn = (e, t) => {
1645
- const n = Da(e, t.type);
1644
+ }), fn = (e, t) => {
1645
+ const n = Ha(e, t.type);
1646
1646
  return n ? e.commands.command(({ tr: r, state: a, dispatch: s }) => {
1647
1647
  const { from: i, to: l } = a.selection, c = a.selection.$from.blockRange(a.selection.$to);
1648
1648
  if (!c)
1649
1649
  return !1;
1650
- const d = yr(c, n, t.attrs);
1650
+ const d = Ir(c, n, t.attrs);
1651
1651
  return d ? (r.wrap(c, d), s && s(r.scrollIntoView()), i <= l) : !1;
1652
1652
  }) : !1;
1653
- }, Ra = (e, t) => {
1653
+ }, ja = (e, t) => {
1654
1654
  if (t.length === 0)
1655
1655
  return !1;
1656
1656
  const n = e.getJSON();
1657
1657
  for (const r of t)
1658
- if (!(r.type === "insertNode" ? Ve(e, r.payload) : r.type === "updateNodeAttrs" ? pe(e, r.payload) : r.type === "removeNode" ? Ct(e, r.payload) : dn(e, r.payload)))
1658
+ if (!(r.type === "insertNode" ? Ye(e, r.payload) : r.type === "updateNodeAttrs" ? he(e, r.payload) : r.type === "removeNode" ? St(e, r.payload) : fn(e, r.payload)))
1659
1659
  return e.commands.setContent(n), !1;
1660
1660
  return !0;
1661
- }, $a = () => `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`, Oa = ee.create({
1661
+ }, Wa = () => `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`, Ga = ee.create({
1662
1662
  name: "claim",
1663
1663
  group: "block",
1664
1664
  content: "inline*",
@@ -1677,14 +1677,14 @@ const Oe = () => {
1677
1677
  renderHTML({ HTMLAttributes: e }) {
1678
1678
  return [
1679
1679
  "p",
1680
- ae(e, { "data-type": "claim", class: "claim-line" }),
1680
+ se(e, { "data-type": "claim", class: "claim-line" }),
1681
1681
  0
1682
1682
  ];
1683
1683
  },
1684
1684
  addKeyboardShortcuts() {
1685
1685
  return {
1686
1686
  Enter: () => {
1687
- const { state: e, dispatch: t } = this.editor.view, { $from: n, empty: r } = e.selection, a = Lt(n);
1687
+ const { state: e, dispatch: t } = this.editor.view, { $from: n, empty: r } = e.selection, a = Mt(n);
1688
1688
  if (a === null) return !1;
1689
1689
  const s = n.node(a), l = n.before(a) + s.nodeSize;
1690
1690
  if (!r || n.pos !== l - 1) return !1;
@@ -1694,24 +1694,24 @@ const Oe = () => {
1694
1694
  const o = e.schema.nodes.claim.create(
1695
1695
  {
1696
1696
  number: d + 1,
1697
- claimId: $a(),
1697
+ claimId: Wa(),
1698
1698
  dependsOn: [],
1699
1699
  dependsOnClaimIds: []
1700
1700
  }
1701
1701
  ), u = e.tr.insert(c, o), m = c + 1;
1702
- return u.setSelection(Ie.create(u.doc, m)), t(u), !0;
1702
+ return u.setSelection(Ne.create(u.doc, m)), t(u), !0;
1703
1703
  },
1704
1704
  Backspace: () => {
1705
1705
  const { state: e, dispatch: t } = this.editor.view, { $from: n, empty: r } = e.selection;
1706
1706
  if (!r) return !1;
1707
- const a = Lt(n);
1707
+ const a = Mt(n);
1708
1708
  if (a === null) return !1;
1709
1709
  const s = n.node(a);
1710
1710
  if (s.content.size > 0) return !1;
1711
1711
  let i = 0;
1712
1712
  if (e.doc.descendants((m) => (m.type.name === "claim" && i++, !0)), i <= 1) return !1;
1713
1713
  const l = n.before(a), c = l + s.nodeSize, d = e.tr.delete(l, c), o = Math.min(l, d.doc.content.size), u = d.doc.resolve(o);
1714
- return d.setSelection(Ie.near(u)), t(d), !0;
1714
+ return d.setSelection(Ne.near(u)), t(d), !0;
1715
1715
  }
1716
1716
  };
1717
1717
  },
@@ -1725,7 +1725,7 @@ const Oe = () => {
1725
1725
  const i = document.createElement("span");
1726
1726
  i.className = "claim-body";
1727
1727
  const l = () => {
1728
- const o = k.getState().editorLanguage, u = U(o), m = Number(r.attrs.number || 1);
1728
+ const o = k.getState().editorLanguage, u = j(o), m = Number(r.attrs.number || 1);
1729
1729
  s.textContent = `${u.claimLabel(m)}. `, r.content.size > 0 ? (i.removeAttribute("data-placeholder"), a.classList.remove("claim-line--empty")) : (i.setAttribute("data-placeholder", o === "en" ? "Type claim content... (Enter to add next)" : "输入权利要求内容… (Enter 添加下一条)"), a.classList.add("claim-line--empty"));
1730
1730
  };
1731
1731
  let c = k.getState().editorLanguage;
@@ -1737,7 +1737,7 @@ const Oe = () => {
1737
1737
  if (!(u instanceof HTMLElement) || u === i || i.contains(u)) return;
1738
1738
  const m = typeof n == "function" ? n() : null;
1739
1739
  if (typeof m != "number") return;
1740
- const p = m + r.nodeSize - 1, g = Ie.create(e.state.doc, p);
1740
+ const p = m + r.nodeSize - 1, g = Ne.create(e.state.doc, p);
1741
1741
  e.view.dispatch(e.state.tr.setSelection(g));
1742
1742
  }), a.append(s, i), l(), {
1743
1743
  dom: a,
@@ -1748,67 +1748,69 @@ const Oe = () => {
1748
1748
  };
1749
1749
  }
1750
1750
  });
1751
- function Lt(e) {
1751
+ function Mt(e) {
1752
1752
  for (let t = e.depth; t >= 0; t--)
1753
1753
  if (e.node(t).type.name === "claim") return t;
1754
1754
  return null;
1755
1755
  }
1756
- let Fe = 0;
1757
- const dt = [];
1758
- let ze = !1;
1759
- const Fa = 2e4, Pt = 6e4;
1760
- let q = null, je = !1, ce = null, xe = null;
1761
- const ut = /* @__PURE__ */ new Map();
1762
- function Dt() {
1763
- ce && (window.removeEventListener("message", ce), ce = null), q && (q.src = "about:blank", q.remove(), q = null), je = !1;
1756
+ let Ue = 0;
1757
+ const ft = [];
1758
+ let je = !1;
1759
+ const qa = 2e4, Rt = 6e4;
1760
+ let U = null, Ve = !1, ce = null, Te = null;
1761
+ const gt = /* @__PURE__ */ new Map();
1762
+ function Ot() {
1763
+ ce && (window.removeEventListener("message", ce), ce = null), U && (U.src = "about:blank", U.remove(), U = null), Ve = !1;
1764
1764
  }
1765
- function za(e, t) {
1766
- const n = ut.get(e);
1765
+ function Va(e, t) {
1766
+ const n = gt.get(e);
1767
1767
  if (n) {
1768
1768
  t(n);
1769
1769
  return;
1770
1770
  }
1771
- dt.push({ xml: e, callback: t }), mt();
1771
+ ft.push({ xml: e, callback: t }), pt();
1772
1772
  }
1773
- function mt() {
1774
- if (ze || dt.length === 0) return;
1775
- ze = !0, xe && (clearTimeout(xe), xe = null);
1776
- const { xml: e, callback: t } = dt.shift(), n = ut.get(e);
1773
+ function pt() {
1774
+ if (je || ft.length === 0) return;
1775
+ je = !0, Te && (clearTimeout(Te), Te = null);
1776
+ const { xml: e, callback: t } = ft.shift(), n = gt.get(e);
1777
1777
  if (n) {
1778
- t(n), ze = !1, xe = setTimeout(Dt, Pt), mt();
1778
+ t(n), je = !1, Te = setTimeout(Ot, Rt), pt();
1779
1779
  return;
1780
1780
  }
1781
1781
  ce && (window.removeEventListener("message", ce), ce = null);
1782
1782
  let r = null;
1783
1783
  const a = (i) => {
1784
- r && (clearTimeout(r), r = null), i && ut.set(e, i), t(i), ze = !1, xe = setTimeout(Dt, Pt), mt();
1784
+ r && (clearTimeout(r), r = null), i && gt.set(e, i), t(i), je = !1, Te = setTimeout(Ot, Rt), pt();
1785
1785
  }, s = () => {
1786
1786
  var i;
1787
- (i = q.contentWindow) == null || i.postMessage(
1787
+ (i = U.contentWindow) == null || i.postMessage(
1788
1788
  JSON.stringify({ action: "load", autosave: 0, xml: e || "" }),
1789
1789
  "*"
1790
1790
  );
1791
1791
  };
1792
1792
  ce = (i) => {
1793
- var c;
1794
- if (!q || i.source !== q.contentWindow) return;
1793
+ if (!U || i.source !== U.contentWindow) return;
1795
1794
  let l;
1796
1795
  try {
1797
1796
  l = typeof i.data == "string" ? JSON.parse(i.data) : i.data;
1798
1797
  } catch {
1799
1798
  return;
1800
1799
  }
1801
- l.event === "init" ? (je = !0, s()) : l.event === "load" ? (c = q.contentWindow) == null || c.postMessage(
1802
- JSON.stringify({ action: "export", format: "svg" }),
1803
- "*"
1804
- ) : l.event === "export" && a(l.data || "");
1805
- }, window.addEventListener("message", ce), r = setTimeout(() => a(""), Fa), q ? je && s() : (q = document.createElement("iframe"), q.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:1px;height:1px;opacity:0;pointer-events:none;", document.body.appendChild(q), je = !1, q.src = "https://embed.diagrams.net/?embed=1&proto=json&spin=0&chrome=0");
1800
+ l.event === "init" ? (Ve = !0, s()) : l.event === "load" ? setTimeout(() => {
1801
+ var c;
1802
+ (c = U == null ? void 0 : U.contentWindow) == null || c.postMessage(
1803
+ JSON.stringify({ action: "export", format: "svg" }),
1804
+ "*"
1805
+ );
1806
+ }, 500) : l.event === "export" && a(l.data || "");
1807
+ }, window.addEventListener("message", ce), r = setTimeout(() => a(""), qa), U ? Ve && s() : (U = document.createElement("iframe"), U.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:1px;height:1px;opacity:0;pointer-events:none;", document.body.appendChild(U), Ve = !1, U.src = "https://embed.diagrams.net/?embed=1&proto=json&spin=0&chrome=0");
1806
1808
  }
1807
- const Be = () => {
1809
+ const We = () => {
1808
1810
  document.querySelectorAll('body > svg[id^="fig-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
1809
1811
  (e.id.startsWith("dmermaid") || e.id.startsWith("dfi")) && e.remove();
1810
1812
  }), document.querySelectorAll("body > #dmermaid-svg").forEach((e) => e.remove()), document.querySelectorAll("body > style[data-mermaid-style]").forEach((e) => e.remove());
1811
- }, Ba = ee.create({
1813
+ }, Ka = ee.create({
1812
1814
  name: "figure",
1813
1815
  group: "block",
1814
1816
  content: "inline*",
@@ -1830,7 +1832,7 @@ const Be = () => {
1830
1832
  renderHTML({ HTMLAttributes: e }) {
1831
1833
  return [
1832
1834
  "figure",
1833
- ae(e, { "data-type": "figure", class: "figure-block" }),
1835
+ se(e, { "data-type": "figure", class: "figure-block" }),
1834
1836
  ["figcaption", { class: "figure-caption" }, 0]
1835
1837
  ];
1836
1838
  },
@@ -1883,8 +1885,8 @@ const Be = () => {
1883
1885
  M.className = "figure-caption-content", T.append(N, M), i.append(l, T);
1884
1886
  const R = (E) => {
1885
1887
  const _ = typeof n == "function" ? n() : null;
1886
- typeof _ == "number" && e.commands.command(({ tr: D, dispatch: j }) => (D.setNodeMarkup(_, void 0, { ...r.attrs, ...E }), j && j(D), !0));
1887
- }, Y = (E) => {
1888
+ typeof _ == "number" && e.commands.command(({ tr: D, dispatch: W }) => (D.setNodeMarkup(_, void 0, { ...r.attrs, ...E }), W && W(D), !0));
1889
+ }, Q = (E) => {
1888
1890
  if (!E || E.length === 0) return;
1889
1891
  const _ = E[0];
1890
1892
  if (!_.type.startsWith("image/")) return;
@@ -1893,7 +1895,7 @@ const Be = () => {
1893
1895
  typeof D.result == "string" && R({ imageSrc: D.result });
1894
1896
  }, D.readAsDataURL(_);
1895
1897
  };
1896
- u.addEventListener("change", () => Y(u.files)), d.addEventListener("click", () => u.click()), m.addEventListener("click", (E) => {
1898
+ u.addEventListener("change", () => Q(u.files)), d.addEventListener("click", () => u.click()), m.addEventListener("click", (E) => {
1897
1899
  E.stopPropagation(), u.click();
1898
1900
  }), l.addEventListener("dragover", (E) => {
1899
1901
  r.attrs.contentType === "image" && (E.preventDefault(), E.stopPropagation(), d.classList.add("figure-upload-area--dragover"));
@@ -1901,12 +1903,12 @@ const Be = () => {
1901
1903
  d.classList.remove("figure-upload-area--dragover");
1902
1904
  }), l.addEventListener("drop", (E) => {
1903
1905
  var _;
1904
- d.classList.remove("figure-upload-area--dragover"), r.attrs.contentType === "image" && (E.preventDefault(), E.stopPropagation(), Y(((_ = E.dataTransfer) == null ? void 0 : _.files) ?? null));
1906
+ d.classList.remove("figure-upload-area--dragover"), r.attrs.contentType === "image" && (E.preventDefault(), E.stopPropagation(), Q(((_ = E.dataTransfer) == null ? void 0 : _.files) ?? null));
1905
1907
  });
1906
- const Le = () => {
1907
- a || (a = !0, b.value = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "", I.textContent = "", I.style.display = "none", se(), requestAnimationFrame(() => b.focus()));
1908
+ const De = () => {
1909
+ a || (a = !0, b.value = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "", I.textContent = "", I.style.display = "none", te(), requestAnimationFrame(() => b.focus()));
1908
1910
  }, S = () => {
1909
- a = !1, se();
1911
+ a = !1, te();
1910
1912
  }, H = async () => {
1911
1913
  const E = b.value;
1912
1914
  I.textContent = "", I.style.display = "none";
@@ -1914,116 +1916,124 @@ const Be = () => {
1914
1916
  if (_)
1915
1917
  try {
1916
1918
  const D = await import("mermaid");
1917
- D.default.initialize({ startOnLoad: !1, theme: "default" }), Fe += 1;
1918
- const j = `fig-mermaid-${Fe}`, { svg: F } = await D.default.render(j, _);
1919
- g.innerHTML = F, Be();
1919
+ D.default.initialize({ startOnLoad: !1, theme: "default" }), Ue += 1;
1920
+ const W = `fig-mermaid-${Ue}`, { svg: F } = await D.default.render(W, _);
1921
+ g.innerHTML = F, We();
1920
1922
  } catch {
1921
- Be();
1923
+ We();
1922
1924
  const D = k.getState().editorLanguage;
1923
1925
  I.textContent = D === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", I.style.display = "inline";
1924
1926
  return;
1925
1927
  }
1926
- R({ mermaidCode: E }), a = !1, se();
1928
+ R({ mermaidCode: E }), a = !1, te();
1927
1929
  };
1928
1930
  p.addEventListener("dblclick", (E) => {
1929
- E.preventDefault(), E.stopPropagation(), Le();
1931
+ E.preventDefault(), E.stopPropagation(), De();
1930
1932
  }), C.addEventListener("click", (E) => {
1931
1933
  E.stopPropagation(), H();
1932
1934
  }), x.addEventListener("click", (E) => {
1933
1935
  E.stopPropagation(), S();
1934
1936
  }), b.addEventListener("mousedown", (E) => E.stopPropagation()), b.addEventListener("keydown", (E) => E.stopPropagation()), b.addEventListener("keypress", (E) => E.stopPropagation());
1935
- let $ = null, O = null, K = null;
1936
- const Tn = () => {
1937
+ let O = null, $ = null, K = null;
1938
+ const Nn = () => {
1937
1939
  if (s) return;
1938
- s = !0, se(), O = document.createElement("div"), O.className = "drawio-modal-overlay";
1940
+ s = !0, te(), $ = document.createElement("div"), $.className = "drawio-modal-overlay";
1939
1941
  const E = document.createElement("div");
1940
1942
  E.className = "drawio-modal-content";
1941
1943
  const _ = document.createElement("div");
1942
1944
  _.className = "drawio-modal-header";
1943
- const D = document.createElement("span"), j = k.getState().editorLanguage;
1944
- D.textContent = j === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", D.className = "drawio-modal-title";
1945
+ const D = document.createElement("span"), W = k.getState().editorLanguage;
1946
+ D.textContent = W === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", D.className = "drawio-modal-title";
1945
1947
  const F = document.createElement("button");
1946
- F.className = "drawio-modal-close-btn", F.textContent = "✕", F.type = "button", F.addEventListener("click", () => et()), _.append(D, F), K = document.createElement("iframe"), K.className = "drawio-modal-iframe", K.setAttribute("frameborder", "0"), E.append(_, K), O.appendChild(E), document.body.appendChild(O);
1947
- const Ce = j === "en" ? "en" : "zh";
1948
- K.src = `https://embed.diagrams.net/?embed=1&proto=json&spin=1&lang=${Ce}`;
1949
- const te = K;
1950
- $ = (ne) => {
1951
- var ue, Pe;
1952
- if (!te || ne.source !== te.contentWindow) return;
1948
+ F.className = "drawio-modal-close-btn", F.textContent = "✕", F.type = "button", F.addEventListener("click", () => at()), _.append(D, F), K = document.createElement("iframe"), K.className = "drawio-modal-iframe", K.setAttribute("frameborder", "0"), E.append(_, K), $.appendChild(E), document.body.appendChild($);
1949
+ const xe = W === "en" ? "en" : "zh";
1950
+ K.src = `https://embed.diagrams.net/?embed=1&proto=json&spin=1&lang=${xe}`;
1951
+ const ne = K;
1952
+ O = (re) => {
1953
+ var me, Oe;
1954
+ if (!ne || re.source !== ne.contentWindow) return;
1953
1955
  let J;
1954
1956
  try {
1955
- J = typeof ne.data == "string" ? JSON.parse(ne.data) : ne.data;
1957
+ J = typeof re.data == "string" ? JSON.parse(re.data) : re.data;
1956
1958
  } catch {
1957
1959
  return;
1958
1960
  }
1959
1961
  if (J.event === "init") {
1960
- const me = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
1961
- (ue = te.contentWindow) == null || ue.postMessage(
1962
- JSON.stringify({ action: "load", autosave: 0, xml: me || "" }),
1962
+ const fe = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
1963
+ (me = ne.contentWindow) == null || me.postMessage(
1964
+ JSON.stringify({ action: "load", autosave: 0, xml: fe || "" }),
1963
1965
  "*"
1964
1966
  );
1965
1967
  } else if (J.event === "save") {
1966
- const me = J.xml || "";
1967
- (Pe = te.contentWindow) == null || Pe.postMessage(
1968
+ const fe = J.xml || "";
1969
+ (Oe = ne.contentWindow) == null || Oe.postMessage(
1968
1970
  JSON.stringify({ action: "export", format: "svg" }),
1969
1971
  "*"
1970
- ), R({ drawioXml: me });
1972
+ ), R({ drawioXml: fe });
1971
1973
  } else if (J.event === "export") {
1972
- const me = J.data || "";
1973
- R({ drawioSvg: me }), et();
1974
- } else J.event === "exit" && et();
1975
- }, window.addEventListener("message", $);
1976
- }, et = () => {
1977
- s = !1, $ && (window.removeEventListener("message", $), $ = null), K && (K.src = "about:blank", K = null), O && (O.remove(), O = null), se();
1974
+ const fe = J.data || "";
1975
+ R({ drawioSvg: fe }), at();
1976
+ } else J.event === "exit" && at();
1977
+ }, window.addEventListener("message", O);
1978
+ }, at = () => {
1979
+ s = !1, O && (window.removeEventListener("message", O), O = null), K && (K.src = "about:blank", K = null), $ && ($.remove(), $ = null), te();
1978
1980
  };
1979
1981
  A.addEventListener("dblclick", (E) => {
1980
- E.preventDefault(), E.stopPropagation(), Tn();
1982
+ E.preventDefault(), E.stopPropagation(), Nn();
1981
1983
  }), i.addEventListener("mousedown", (E) => {
1982
1984
  const _ = E.target;
1983
1985
  if (!(_ instanceof HTMLElement) || _ === M || M.contains(_) || _ === b || w.contains(_) || _ === d || d.contains(_) || _ === m || _ === u || p.contains(_) || A.contains(_)) return;
1984
1986
  const D = typeof n == "function" ? n() : null;
1985
1987
  if (typeof D != "number") return;
1986
- const j = D + r.nodeSize - 1, F = Ie.create(e.state.doc, j);
1988
+ const W = D + r.nodeSize - 1, F = Ne.create(e.state.doc, W);
1987
1989
  e.view.dispatch(e.state.tr.setSelection(F));
1988
1990
  });
1989
- let tt = !1, ve = "";
1990
- const In = async (E) => {
1991
+ let Me = !1, ue = null, Ce = null, Re = 0;
1992
+ const _n = 2, kn = 1500, An = 3e3;
1993
+ let we = "";
1994
+ const Ln = async (E) => {
1991
1995
  const _ = E.trim();
1992
- if (_ !== ve) {
1996
+ if (_ !== we) {
1993
1997
  if (!_) {
1994
- g.innerHTML = "", ve = "";
1998
+ g.innerHTML = "", we = "";
1995
1999
  return;
1996
2000
  }
1997
2001
  try {
1998
2002
  const D = await import("mermaid");
1999
- D.default.initialize({ startOnLoad: !1, theme: "default" }), Fe += 1;
2000
- const j = `fig-mermaid-${Fe}`, { svg: F } = await D.default.render(j, _);
2001
- g.innerHTML = F, ve = _;
2003
+ D.default.initialize({ startOnLoad: !1, theme: "default" }), Ue += 1;
2004
+ const W = `fig-mermaid-${Ue}`, { svg: F } = await D.default.render(W, _);
2005
+ g.innerHTML = F, we = _;
2002
2006
  } catch {
2003
- g.innerHTML = "", ve = "";
2007
+ g.innerHTML = "", we = "";
2004
2008
  } finally {
2005
- Be();
2009
+ We();
2006
2010
  }
2007
2011
  }
2008
- }, se = () => {
2009
- const E = k.getState().editorLanguage, _ = U(E), D = ["image", "mermaid", "drawio"].includes(r.attrs.contentType) ? r.attrs.contentType : "image", j = typeof r.attrs.id == "string" ? r.attrs.id.trim() : "", F = typeof r.attrs.imageSrc == "string" ? r.attrs.imageSrc : "", Ce = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "";
2010
- j ? (N.textContent = `[${j}] `, N.style.display = "inline") : (N.textContent = "", N.style.display = "none");
2011
- const te = D === "image", ne = D === "mermaid", J = D === "drawio";
2012
- c.style.display = te && F ? "block" : "none", d.style.display = te && !F ? "flex" : "none", m.style.display = te && F ? "block" : "none", p.style.display = ne && !a ? "block" : "none", w.style.display = ne && a ? "block" : "none", A.style.display = J ? "flex" : "none", te && F && (c.src = F);
2013
- const ue = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
2014
- J && (ue ? (P.src = ue, P.style.display = "block") : (P.src = "", P.style.display = "none")), o.textContent = _.figureUploadHint || "点击上传或拖拽图片", m.textContent = _.figureReplaceImage || "更换图片", C.textContent = _.mermaidSaveAndRender || "保存并渲染", x.textContent = _.mermaidCancel || "取消";
2015
- const Pe = Ce.trim().length > 0, me = g.querySelector("svg") !== null;
2016
- ne && !a && (Pe && me ? (y.textContent = _.mermaidDoubleClickToEdit || "双击编辑", y.className = "figure-mermaid-view-hint figure-mermaid-view-hint--subtle") : (y.textContent = _.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", y.className = "figure-mermaid-view-hint figure-mermaid-view-hint--empty")), J && !s && (ue ? (h.textContent = _.mermaidDoubleClickToEdit || "双击编辑", h.className = "figure-drawio-view-hint figure-mermaid-view-hint--subtle") : (h.textContent = _.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", h.className = "figure-drawio-view-hint figure-mermaid-view-hint--empty")), ne && !a && Ce.trim() !== ve && In(Ce);
2017
- const St = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
2018
- J && St && !ue && !tt && !s && (tt = !0, za(St, (Tt) => {
2019
- Tt && R({ drawioSvg: Tt }), tt = !1;
2020
- }));
2012
+ }, te = () => {
2013
+ const E = k.getState().editorLanguage, _ = j(E), D = ["image", "mermaid", "drawio"].includes(r.attrs.contentType) ? r.attrs.contentType : "image", W = typeof r.attrs.id == "string" ? r.attrs.id.trim() : "", F = typeof r.attrs.imageSrc == "string" ? r.attrs.imageSrc : "", xe = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "";
2014
+ W ? (N.textContent = `[${W}] `, N.style.display = "inline") : (N.textContent = "", N.style.display = "none");
2015
+ const ne = D === "image", re = D === "mermaid", J = D === "drawio";
2016
+ c.style.display = ne && F ? "block" : "none", d.style.display = ne && !F ? "flex" : "none", m.style.display = ne && F ? "block" : "none", p.style.display = re && !a ? "block" : "none", w.style.display = re && a ? "block" : "none", A.style.display = J ? "flex" : "none", ne && F && (c.src = F);
2017
+ const me = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
2018
+ J && (me ? (P.src = me, P.style.display = "block") : (P.src = "", P.style.display = "none")), o.textContent = _.figureUploadHint || "点击上传或拖拽图片", m.textContent = _.figureReplaceImage || "更换图片", C.textContent = _.mermaidSaveAndRender || "保存并渲染", x.textContent = _.mermaidCancel || "取消";
2019
+ const Oe = xe.trim().length > 0, fe = g.querySelector("svg") !== null;
2020
+ re && !a && (Oe && fe ? (y.textContent = _.mermaidDoubleClickToEdit || "双击编辑", y.className = "figure-mermaid-view-hint figure-mermaid-view-hint--subtle") : (y.textContent = _.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", y.className = "figure-mermaid-view-hint figure-mermaid-view-hint--empty")), J && !s && (me ? (h.textContent = _.mermaidDoubleClickToEdit || "双击编辑", h.className = "figure-drawio-view-hint figure-mermaid-view-hint--subtle") : (h.textContent = _.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", h.className = "figure-drawio-view-hint figure-mermaid-view-hint--empty")), re && !a && xe.trim() !== we && Ln(xe);
2021
+ const Dn = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
2022
+ J && Dn && !me && !Me && !s && (ue && clearTimeout(ue), ue = setTimeout(() => {
2023
+ ue = null;
2024
+ const Et = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "", Mn = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
2025
+ !Et || Mn || Me || (Me = !0, Va(Et, (Nt) => {
2026
+ Me = !1, Nt ? (Re = 0, R({ drawioSvg: Nt })) : Re < _n && (Re++, Ce = setTimeout(() => {
2027
+ Ce = null, te();
2028
+ }, An * Re));
2029
+ }));
2030
+ }, kn));
2021
2031
  };
2022
- let xt = k.getState().editorLanguage;
2023
- const En = k.subscribe((E) => {
2024
- E.editorLanguage !== xt && (xt = E.editorLanguage, se());
2032
+ let It = k.getState().editorLanguage;
2033
+ const Pn = k.subscribe((E) => {
2034
+ E.editorLanguage !== It && (It = E.editorLanguage, te());
2025
2035
  });
2026
- return se(), {
2036
+ return te(), {
2027
2037
  dom: i,
2028
2038
  contentDOM: M,
2029
2039
  stopEvent: (E) => {
@@ -2034,14 +2044,14 @@ const Be = () => {
2034
2044
  const _ = E.target;
2035
2045
  return !!(l.contains(_) || N.contains(_));
2036
2046
  },
2037
- update: (E) => E.type.name !== "figure" ? !1 : (r = E, se(), !0),
2047
+ update: (E) => E.type.name !== "figure" ? !1 : (r = E, te(), !0),
2038
2048
  destroy: () => {
2039
- En(), Be(), $ && (window.removeEventListener("message", $), $ = null), K && (K.src = "about:blank", K = null), O && (O.remove(), O = null);
2049
+ ue && (clearTimeout(ue), ue = null), Ce && (clearTimeout(Ce), Ce = null), Pn(), We(), O && (window.removeEventListener("message", O), O = null), K && (K.src = "about:blank", K = null), $ && ($.remove(), $ = null);
2040
2050
  }
2041
2051
  };
2042
2052
  };
2043
2053
  }
2044
- }), Ha = ee.create({
2054
+ }), Ja = ee.create({
2045
2055
  name: "reference",
2046
2056
  group: "inline",
2047
2057
  inline: !0,
@@ -2091,7 +2101,7 @@ const Be = () => {
2091
2101
  const t = e.lang === "en" ? "en" : "zh", r = (e.targetType === "figure" ? "figure" : "claim") === "figure" ? e.resolvedFigureId || (t === "en" ? "Figure ?" : "附图?") : t === "en" ? `Claim ${e.resolvedNumber ? String(e.resolvedNumber) : "?"}` : `权利要求${e.resolvedNumber ? String(e.resolvedNumber) : "?"}`, a = e.displayText || r;
2092
2102
  return [
2093
2103
  "span",
2094
- ae(e, {
2104
+ se(e, {
2095
2105
  "data-type": "reference",
2096
2106
  class: `reference-link${e.invalid ? " reference-link-invalid" : ""}`
2097
2107
  }),
@@ -2102,7 +2112,7 @@ const Be = () => {
2102
2112
  return ({ node: e, editor: t }) => {
2103
2113
  let n = e;
2104
2114
  const r = document.createElement("span"), a = () => {
2105
- const s = n.attrs.lang === "en" ? "en" : "zh", i = U(s), l = n.attrs.targetType === "figure" ? "figure" : "claim", c = Number(n.attrs.resolvedNumber), d = typeof n.attrs.resolvedFigureId == "string" && n.attrs.resolvedFigureId ? n.attrs.resolvedFigureId : null, o = l === "figure" ? d || (s === "en" ? "Figure ?" : "附图?") : Number.isFinite(c) ? i.claimLabel(c) : s === "en" ? "Claim ?" : "权利要求?", u = n.attrs.displayText || o;
2115
+ const s = n.attrs.lang === "en" ? "en" : "zh", i = j(s), l = n.attrs.targetType === "figure" ? "figure" : "claim", c = Number(n.attrs.resolvedNumber), d = typeof n.attrs.resolvedFigureId == "string" && n.attrs.resolvedFigureId ? n.attrs.resolvedFigureId : null, o = l === "figure" ? d || (s === "en" ? "Figure ?" : "附图?") : Number.isFinite(c) ? i.claimLabel(c) : s === "en" ? "Claim ?" : "权利要求?", u = n.attrs.displayText || o;
2106
2116
  r.textContent = u, 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 ? i.referenceNavigateDisabledTitle : i.referenceNavigateTitle;
2107
2117
  };
2108
2118
  return a(), r.addEventListener("click", () => {
@@ -2124,7 +2134,7 @@ const Be = () => {
2124
2134
  };
2125
2135
  };
2126
2136
  }
2127
- }), Mt = {
2137
+ }), $t = {
2128
2138
  technical_field: "sectionTitle_technical_field",
2129
2139
  background_art: "sectionTitle_background_art",
2130
2140
  summary: "sectionTitle_summary",
@@ -2139,7 +2149,7 @@ const Be = () => {
2139
2149
  design_description: "sectionTitle_design_description",
2140
2150
  design_views: "sectionTitle_design_views",
2141
2151
  design_brief: "sectionTitle_design_brief"
2142
- }, Ua = /* @__PURE__ */ new Set([
2152
+ }, Xa = /* @__PURE__ */ new Set([
2143
2153
  "abstract",
2144
2154
  "abstract_drawing",
2145
2155
  "claims",
@@ -2150,22 +2160,22 @@ const Be = () => {
2150
2160
  "design_description",
2151
2161
  "design_views",
2152
2162
  "design_brief"
2153
- ]), ja = /* @__PURE__ */ new Set([
2163
+ ]), Ya = /* @__PURE__ */ new Set([
2154
2164
  "technical_field",
2155
2165
  "background_art",
2156
2166
  "summary",
2157
2167
  "drawing_description",
2158
2168
  "detailed_description"
2159
- ]), wt = (e) => {
2169
+ ]), Tt = (e) => {
2160
2170
  if (e.isText)
2161
2171
  return (e.text ?? "").trim().length > 0;
2162
2172
  if (e.isAtom || e.isLeaf || !["patent_section", "patent_title", "paragraph"].includes(e.type.name))
2163
2173
  return !0;
2164
2174
  let t = !1;
2165
2175
  return e.forEach((n) => {
2166
- !t && wt(n) && (t = !0);
2176
+ !t && Tt(n) && (t = !0);
2167
2177
  }), t;
2168
- }, Wa = ee.create({
2178
+ }, Qa = ee.create({
2169
2179
  name: "patent_title",
2170
2180
  group: "block",
2171
2181
  content: "inline*",
@@ -2178,7 +2188,7 @@ const Be = () => {
2178
2188
  renderHTML({ HTMLAttributes: e }) {
2179
2189
  return [
2180
2190
  "h1",
2181
- ae(e, {
2191
+ se(e, {
2182
2192
  "data-type": "patent-title",
2183
2193
  class: "patent-title"
2184
2194
  }),
@@ -2208,9 +2218,9 @@ const Be = () => {
2208
2218
  };
2209
2219
  i.addEventListener("click", o), l.addEventListener("focusin", d), l.addEventListener("click", d);
2210
2220
  const u = () => {
2211
- const y = k.getState(), w = U(y.editorLanguage), b = typeof w.bookTitle_description == "string" ? w.bookTitle_description : "说明书", v = typeof w.patentTitlePlaceholder == "string" ? w.patentTitlePlaceholder : "专利名称";
2221
+ const y = k.getState(), w = j(y.editorLanguage), b = typeof w.bookTitle_description == "string" ? w.bookTitle_description : "说明书", v = typeof w.patentTitlePlaceholder == "string" ? w.patentTitlePlaceholder : "专利名称";
2212
2222
  s.textContent = b;
2213
- const C = wt(r), x = y.rightPanel.activeSectionPos === c();
2223
+ const C = Tt(r), x = y.rightPanel.activeSectionPos === c();
2214
2224
  i.textContent = `[${v}]`, i.style.display = C ? "none" : "", i.classList.toggle("ps-placeholder--active", x && !C), l.classList.toggle("pt-title-content--has-content", C);
2215
2225
  };
2216
2226
  let m = k.getState().editorLanguage, p = k.getState().rightPanel.activeSectionPos;
@@ -2228,7 +2238,7 @@ const Be = () => {
2228
2238
  };
2229
2239
  };
2230
2240
  }
2231
- }), Ga = ee.create({
2241
+ }), Za = ee.create({
2232
2242
  name: "patent_section",
2233
2243
  group: "block",
2234
2244
  content: "block+",
@@ -2247,7 +2257,7 @@ const Be = () => {
2247
2257
  renderHTML({ HTMLAttributes: e }) {
2248
2258
  return [
2249
2259
  "section",
2250
- ae(e, {
2260
+ se(e, {
2251
2261
  "data-type": "patent-section",
2252
2262
  "data-section-type": e.sectionType,
2253
2263
  class: "patent-section"
@@ -2260,15 +2270,15 @@ const Be = () => {
2260
2270
  const n = [];
2261
2271
  return t.forEach((r) => {
2262
2272
  r.type.name === "patent_section" || r.type.name === "patent_title" ? e(r.content).forEach((s) => n.push(s)) : r.isBlock && r.content.size > 0 ? n.push(r.copy(e(r.content))) : n.push(r);
2263
- }), vr.from(n);
2273
+ }), Nr.from(n);
2264
2274
  };
2265
2275
  return [
2266
- new Xe({
2267
- key: new ke("patentSectionLock"),
2276
+ new et({
2277
+ key: new Le("patentSectionLock"),
2268
2278
  props: {
2269
2279
  transformPasted: (t) => {
2270
2280
  const n = e(t.content);
2271
- return new br(n, t.openStart, t.openEnd);
2281
+ return new Er(n, t.openStart, t.openEnd);
2272
2282
  }
2273
2283
  },
2274
2284
  filterTransaction: (t, n) => {
@@ -2325,11 +2335,11 @@ const Be = () => {
2325
2335
  dependsOn: [],
2326
2336
  dependsOnClaimIds: []
2327
2337
  }), h = e.state.tr.insert(A, P), T = A + 1;
2328
- h.setSelection(Ie.create(h.doc, T)), e.view.dispatch(h), e.view.focus();
2338
+ h.setSelection(Ne.create(h.doc, T)), e.view.dispatch(h), e.view.focus();
2329
2339
  };
2330
2340
  l.addEventListener("click", m), c.addEventListener("focusin", u), c.addEventListener("click", u), d.addEventListener("mousedown", p);
2331
2341
  const g = () => {
2332
- const v = k.getState(), C = U(v.editorLanguage), x = Object.keys(Mt).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", I = Ua.has(x), A = ja.has(x), P = x === "claims", h = Mt[x], T = typeof C[h] == "string" ? C[h] : x, N = wt(r), M = v.rightPanel.activeSectionPos === o();
2342
+ const v = k.getState(), C = j(v.editorLanguage), x = Object.keys($t).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", I = Xa.has(x), A = Ya.has(x), P = x === "claims", h = $t[x], T = typeof C[h] == "string" ? C[h] : x, N = Tt(r), M = v.rightPanel.activeSectionPos === o();
2333
2343
  a.className = `ps${N ? "" : " ps--empty"}${A ? " ps--sub" : ""}`, a.setAttribute("data-section-type", x), s.className = I ? "pb-heading" : "ps-heading ps-heading--sub", s.textContent = T, l.textContent = `[${T}]`, l.style.display = N ? "none" : "", l.classList.toggle("ps-placeholder--active", M && !N), c.classList.toggle("ps-content--has-content", N), P ? (d.style.display = "", d.textContent = v.editorLanguage === "en" ? "+ Add Claim" : "+ 添加权利要求") : d.style.display = "none";
2334
2344
  };
2335
2345
  let y = k.getState().editorLanguage, w = k.getState().rightPanel.activeSectionPos;
@@ -2347,27 +2357,27 @@ const Be = () => {
2347
2357
  };
2348
2358
  };
2349
2359
  }
2350
- }), qa = [
2360
+ }), es = [
2351
2361
  "abstract",
2352
2362
  // 说明书摘要
2353
2363
  "abstract_drawing"
2354
2364
  // 摘要附图
2355
- ], Va = [
2365
+ ], ts = [
2356
2366
  "technical_field",
2357
2367
  "background_art",
2358
2368
  "summary",
2359
2369
  "drawing_description",
2360
2370
  "detailed_description"
2361
- ], Ka = [
2371
+ ], ns = [
2362
2372
  "drawing_figures"
2363
2373
  // 说明书附图
2364
- ], Ja = [
2374
+ ], rs = [
2365
2375
  "design_product_name",
2366
2376
  "design_usage",
2367
2377
  "design_description",
2368
2378
  "design_views",
2369
2379
  "design_brief"
2370
- ], We = (e) => ({
2380
+ ], Ke = (e) => ({
2371
2381
  type: "patent_section",
2372
2382
  attrs: {
2373
2383
  sectionType: e,
@@ -2378,26 +2388,26 @@ const Be = () => {
2378
2388
  type: "paragraph"
2379
2389
  }
2380
2390
  ]
2381
- }), un = () => ({
2391
+ }), gn = () => ({
2382
2392
  type: "patent_title",
2383
2393
  content: []
2384
- }), Xa = () => [
2385
- ...qa.map(We),
2386
- un(),
2387
- ...Va.map(We),
2388
- ...Ka.map(We)
2389
- ], Qa = () => [
2390
- un(),
2391
- ...Ja.map(We)
2392
- ], mn = (e = "invention") => ({ type: "doc", content: e === "design" ? Qa() : Xa() }), Rt = 400, V = {
2394
+ }), as = () => [
2395
+ ...es.map(Ke),
2396
+ gn(),
2397
+ ...ts.map(Ke),
2398
+ ...ns.map(Ke)
2399
+ ], ss = () => [
2400
+ gn(),
2401
+ ...rs.map(Ke)
2402
+ ], pn = (e = "invention") => ({ type: "doc", content: e === "design" ? ss() : as() }), Ft = 400, V = {
2393
2403
  lastClaimWarningSignature: "",
2394
2404
  lastInvalidReferenceSignature: "",
2395
2405
  lastClaimGraphSignature: "",
2396
2406
  invalidReferenceHandler: null,
2397
2407
  claimGraphHandler: null
2398
- }, fe = (e) => vt(e, (t) => t.type.name === "claim"), _e = (e) => vt(e, (t) => t.type.name === "figure"), fn = () => `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`, Z = (e) => typeof e != "string" ? "" : e.trim(), $t = (e) => {
2408
+ }, ge = (e) => xt(e, (t) => t.type.name === "claim"), Ae = (e) => xt(e, (t) => t.type.name === "figure"), hn = () => `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`, Z = (e) => typeof e != "string" ? "" : e.trim(), zt = (e) => {
2399
2409
  const n = k.getState().editorLanguage === "en" ? "Fig." : "图", r = /* @__PURE__ */ new Set();
2400
- _e(e).forEach((s) => {
2410
+ Ae(e).forEach((s) => {
2401
2411
  const i = Z(s.node.attrs.id);
2402
2412
  i && r.add(i);
2403
2413
  });
@@ -2405,14 +2415,14 @@ const Be = () => {
2405
2415
  for (; r.has(`${n}${a}`); )
2406
2416
  a += 1;
2407
2417
  return `${n}${a}`;
2408
- }, Ya = /^(Fig\.|图)(\d+)$/, Za = (e) => {
2409
- const n = k.getState().editorLanguage === "en" ? "Fig." : "图", r = _e(e);
2418
+ }, is = /^(Fig\.|图)(\d+)$/, os = (e) => {
2419
+ const n = k.getState().editorLanguage === "en" ? "Fig." : "图", r = Ae(e);
2410
2420
  if (r.length === 0) return;
2411
2421
  const a = [];
2412
2422
  let s = 1;
2413
2423
  for (const l of r) {
2414
2424
  const c = Z(l.node.attrs.id);
2415
- if (!Ya.exec(c)) continue;
2425
+ if (!is.exec(c)) continue;
2416
2426
  const o = `${n}${s}`;
2417
2427
  c !== o && a.push({ pos: l.pos, expectedId: o, currentId: c }), s++;
2418
2428
  }
@@ -2423,28 +2433,28 @@ const Be = () => {
2423
2433
  !c || c.type.name !== "figure" || i.setNodeMarkup(l.pos, void 0, { ...c.attrs, id: l.expectedId });
2424
2434
  }
2425
2435
  i.steps.length > 0 && (i.setMeta("addToHistory", !1), e.view.dispatch(i));
2426
- }, Ge = (e) => {
2436
+ }, Je = (e) => {
2427
2437
  if (!Array.isArray(e))
2428
2438
  return [];
2429
2439
  const t = e.map((n) => Number(n)).filter((n) => Number.isFinite(n) && n > 0);
2430
2440
  return Array.from(new Set(t)).sort((n, r) => n - r);
2431
- }, rt = (e) => {
2441
+ }, it = (e) => {
2432
2442
  if (!Array.isArray(e))
2433
2443
  return [];
2434
2444
  const t = e.map((n) => typeof n == "string" ? n.trim() : "").filter(Boolean);
2435
2445
  return Array.from(new Set(t));
2436
- }, Ot = (e, t) => {
2446
+ }, Bt = (e, t) => {
2437
2447
  if (e.length !== t.length)
2438
2448
  return !1;
2439
2449
  for (let n = 0; n < e.length; n += 1)
2440
2450
  if (e[n] !== t[n])
2441
2451
  return !1;
2442
2452
  return !0;
2443
- }, ft = (e, t, n, r, a) => {
2444
- const s = U(e);
2453
+ }, ht = (e, t, n, r, a) => {
2454
+ const s = j(e);
2445
2455
  return a ? t === "figure" ? s.invalidFigureReference : s.invalidClaimReference : t === "figure" ? r || (e === "en" ? "Figure ?" : "附图?") : typeof n != "number" ? s.invalidClaimReference : s.claimLabel(n);
2446
- }, Ke = () => k.getState().editorLanguage === "en" ? "en" : "zh", es = (e) => {
2447
- const t = [], n = Ke(), r = new Map(e.map((d) => [d.claimId, d.number]));
2456
+ }, Qe = () => k.getState().editorLanguage === "en" ? "en" : "zh", cs = (e) => {
2457
+ const t = [], n = Qe(), r = new Map(e.map((d) => [d.claimId, d.number]));
2448
2458
  e.forEach((d) => {
2449
2459
  d.dependsOnClaimIds.forEach((o) => {
2450
2460
  const u = r.get(o);
@@ -2452,13 +2462,13 @@ const Be = () => {
2452
2462
  claimId: d.claimId,
2453
2463
  code: "self_reference",
2454
2464
  claimNumber: d.number,
2455
- message: he(n, "self_reference", d.number)
2465
+ message: ye(n, "self_reference", d.number)
2456
2466
  }), typeof u == "number" && u >= d.number && t.push({
2457
2467
  claimId: d.claimId,
2458
2468
  code: "forward_reference",
2459
2469
  claimNumber: d.number,
2460
2470
  targetNumber: u,
2461
- message: he(n, "forward_reference", d.number, u)
2471
+ message: ye(n, "forward_reference", d.number, u)
2462
2472
  });
2463
2473
  });
2464
2474
  });
@@ -2477,19 +2487,19 @@ const Be = () => {
2477
2487
  claimId: d,
2478
2488
  code: "cycle_dependency",
2479
2489
  claimNumber: o.number,
2480
- message: he(n, "cycle_dependency", o.number)
2490
+ message: ye(n, "cycle_dependency", o.number)
2481
2491
  });
2482
2492
  }), t;
2483
2493
  }, ie = (e) => {
2484
- const t = fe(e), n = /* @__PURE__ */ new Set(), r = t.map((o, u) => {
2485
- const m = typeof o.node.attrs.claimId == "string" ? o.node.attrs.claimId : "", p = m && !n.has(m) ? m : fn();
2494
+ const t = ge(e), n = /* @__PURE__ */ new Set(), r = t.map((o, u) => {
2495
+ const m = typeof o.node.attrs.claimId == "string" ? o.node.attrs.claimId : "", p = m && !n.has(m) ? m : hn();
2486
2496
  return n.add(p), { pos: o.pos, node: o.node, claimId: p, number: u + 1 };
2487
2497
  }), a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
2488
2498
  r.forEach((o) => {
2489
2499
  a.set(o.number, o.claimId), s.set(o.claimId, o.number);
2490
2500
  });
2491
2501
  const i = r.map((o) => {
2492
- const u = rt(o.node.attrs.dependsOnClaimIds), p = Ge(o.node.attrs.dependsOn).map((v) => a.get(v)).filter((v) => typeof v == "string"), y = (u.length > 0 ? u : p).filter((v, C, x) => x.indexOf(v) === C).filter((v) => v !== o.claimId && s.has(v)), w = y.map((v) => s.get(v)).filter((v) => typeof v == "number").sort((v, C) => v - C), b = {
2502
+ const u = it(o.node.attrs.dependsOnClaimIds), p = Je(o.node.attrs.dependsOn).map((v) => a.get(v)).filter((v) => typeof v == "string"), y = (u.length > 0 ? u : p).filter((v, C, x) => x.indexOf(v) === C).filter((v) => v !== o.claimId && s.has(v)), w = y.map((v) => s.get(v)).filter((v) => typeof v == "number").sort((v, C) => v - C), b = {
2493
2503
  ...o.node.attrs,
2494
2504
  claimId: o.claimId,
2495
2505
  number: o.number,
@@ -2497,23 +2507,23 @@ const Be = () => {
2497
2507
  dependsOnClaimIds: y
2498
2508
  };
2499
2509
  return { claimId: o.claimId, number: o.number, dependsOnClaimIds: y, pos: o.pos, attrs: b };
2500
- }), l = es(i), c = e.commands.command(({ tr: o, dispatch: u }) => {
2510
+ }), l = cs(i), c = e.commands.command(({ tr: o, dispatch: u }) => {
2501
2511
  let m = !1;
2502
2512
  return i.forEach((p) => {
2503
2513
  const g = e.state.doc.nodeAt(p.pos);
2504
2514
  if (!g || g.type.name !== "claim")
2505
2515
  return;
2506
2516
  const y = { ...p.attrs };
2507
- (g.attrs.number !== y.number || g.attrs.claimId !== y.claimId || !Ot(Ge(g.attrs.dependsOn), Ge(y.dependsOn)) || !Ot(
2508
- rt(g.attrs.dependsOnClaimIds),
2509
- rt(y.dependsOnClaimIds)
2517
+ (g.attrs.number !== y.number || g.attrs.claimId !== y.claimId || !Bt(Je(g.attrs.dependsOn), Je(y.dependsOn)) || !Bt(
2518
+ it(g.attrs.dependsOnClaimIds),
2519
+ it(y.dependsOnClaimIds)
2510
2520
  )) && (o.setNodeMarkup(p.pos, void 0, y), m = !0);
2511
2521
  }), m && u && u(o), !0;
2512
2522
  }), d = l.map((o) => `${o.claimId}:${o.code}`).join("|");
2513
2523
  return d !== V.lastClaimGraphSignature && (V.lastClaimGraphSignature = d, V.claimGraphHandler && V.claimGraphHandler({ issues: l }), l.length > 0 && console.warn(`Claim graph validation found ${l.length} issue(s).`)), c;
2514
- }, gn = (e) => {
2524
+ }, yn = (e) => {
2515
2525
  const t = /* @__PURE__ */ new Map();
2516
- return fe(e).forEach((n) => {
2526
+ return ge(e).forEach((n) => {
2517
2527
  const r = typeof n.node.attrs.claimId == "string" ? n.node.attrs.claimId : "", a = Number(n.node.attrs.number);
2518
2528
  !r || Number.isNaN(a) || t.set(r, {
2519
2529
  number: a,
@@ -2521,23 +2531,23 @@ const Be = () => {
2521
2531
  pos: n.pos
2522
2532
  });
2523
2533
  }), t;
2524
- }, pn = (e) => {
2534
+ }, bn = (e) => {
2525
2535
  const t = /* @__PURE__ */ new Map();
2526
- return _e(e).forEach((n) => {
2536
+ return Ae(e).forEach((n) => {
2527
2537
  const r = Z(n.node.attrs.id);
2528
2538
  r && t.set(r, {
2529
2539
  id: r,
2530
2540
  pos: n.pos
2531
2541
  });
2532
2542
  }), t;
2533
- }, Q = (e) => {
2534
- const t = gn(e), n = pn(e), r = [], a = Ke();
2543
+ }, Y = (e) => {
2544
+ const t = yn(e), n = bn(e), r = [], a = Qe();
2535
2545
  if (!e.commands.command(({ tr: l, state: c, dispatch: d }) => {
2536
2546
  let o = !1;
2537
2547
  return c.doc.descendants((u, m) => {
2538
2548
  if (u.type.name !== "reference")
2539
2549
  return !0;
2540
- const p = u.attrs.targetType === "figure" ? "figure" : "claim", g = typeof u.attrs.targetClaimId == "string" && u.attrs.targetClaimId ? u.attrs.targetClaimId : null, y = typeof u.attrs.targetFigureId == "string" && u.attrs.targetFigureId ? Z(u.attrs.targetFigureId) : null, w = p === "claim" && g ? t.get(g) : void 0, b = p === "figure" && y ? n.get(y) : void 0, v = w ? w.number : null, C = b ? b.id : null, x = p === "figure" ? !b : !w, I = ft(a, p, v, C, x), A = p === "figure" ? C || u.attrs.target || y || null : w ? String(w.number) : u.attrs.target || g || null, P = {
2550
+ const p = u.attrs.targetType === "figure" ? "figure" : "claim", g = typeof u.attrs.targetClaimId == "string" && u.attrs.targetClaimId ? u.attrs.targetClaimId : null, y = typeof u.attrs.targetFigureId == "string" && u.attrs.targetFigureId ? Z(u.attrs.targetFigureId) : null, w = p === "claim" && g ? t.get(g) : void 0, b = p === "figure" && y ? n.get(y) : void 0, v = w ? w.number : null, C = b ? b.id : null, x = p === "figure" ? !b : !w, I = ht(a, p, v, C, x), A = p === "figure" ? C || u.attrs.target || y || null : w ? String(w.number) : u.attrs.target || g || null, P = {
2541
2551
  ...u.attrs,
2542
2552
  targetType: p,
2543
2553
  targetClaimId: g,
@@ -2559,8 +2569,8 @@ const Be = () => {
2559
2569
  return i !== V.lastInvalidReferenceSignature && (V.lastInvalidReferenceSignature = i, r.forEach((l) => {
2560
2570
  V.invalidReferenceHandler && V.invalidReferenceHandler(l);
2561
2571
  })), !0;
2562
- }, Ft = (e) => {
2563
- const t = ye(e, "claim"), n = t && typeof t.node.attrs.claimId == "string" ? t.node.attrs.claimId : null;
2572
+ }, Ht = (e) => {
2573
+ const t = be(e, "claim"), n = t && typeof t.node.attrs.claimId == "string" ? t.node.attrs.claimId : null;
2564
2574
  return e.commands.command(({ tr: r, state: a, dispatch: s }) => {
2565
2575
  let i = !1;
2566
2576
  return a.doc.descendants((l, c) => {
@@ -2570,27 +2580,27 @@ const Be = () => {
2570
2580
  return l.attrs.highlight !== d && (r.setNodeMarkup(c, void 0, { ...l.attrs, highlight: d }), i = !0), !0;
2571
2581
  }), i && s && s(r), !0;
2572
2582
  });
2573
- }, ts = (e) => {
2574
- const t = fe(e).map((r) => ({ pos: r.pos, length: r.node.textContent.length })).filter((r) => r.length > Rt), n = t.map((r) => `${r.pos}:${r.length}`).join("|");
2575
- n !== V.lastClaimWarningSignature && (V.lastClaimWarningSignature = n, t.length !== 0 && console.warn(`Claim content is too long for ${t.length} block(s). Suggested max: ${Rt}.`));
2576
- }, at = (e, t) => {
2583
+ }, ls = (e) => {
2584
+ const t = ge(e).map((r) => ({ pos: r.pos, length: r.node.textContent.length })).filter((r) => r.length > Ft), n = t.map((r) => `${r.pos}:${r.length}`).join("|");
2585
+ n !== V.lastClaimWarningSignature && (V.lastClaimWarningSignature = n, t.length !== 0 && console.warn(`Claim content is too long for ${t.length} block(s). Suggested max: ${Ft}.`));
2586
+ }, ot = (e, t) => {
2577
2587
  if (typeof t == "number")
2578
2588
  return t;
2579
- const n = ye(e, "claim");
2589
+ const n = be(e, "claim");
2580
2590
  if (n)
2581
2591
  return n.pos;
2582
- const r = fe(e)[0];
2592
+ const r = ge(e)[0];
2583
2593
  return r ? r.pos : null;
2584
- }, ns = (e, t, n) => e.commands.command(({ tr: r, state: a, dispatch: s }) => {
2594
+ }, ds = (e, t, n) => e.commands.command(({ tr: r, state: a, dispatch: s }) => {
2585
2595
  const i = a.doc.nodeAt(t);
2586
2596
  if (!i || i.type.name !== "claim")
2587
2597
  return !1;
2588
2598
  const l = t + 1, c = t + i.nodeSize - 1;
2589
2599
  return n.trim().length === 0 ? r.delete(l, c) : r.replaceWith(l, c, a.schema.text(n)), s && s(r), !0;
2590
- }), rs = {
2600
+ }), us = {
2591
2601
  name: "patent",
2592
2602
  version: "1.0.0",
2593
- extensions: [Oa, Ba, Ha, Wa, Ga],
2603
+ extensions: [Ga, Ka, Ja, Qa, Za],
2594
2604
  toolbarItems: [
2595
2605
  {
2596
2606
  id: "patent-claim-insert",
@@ -2618,55 +2628,55 @@ const Be = () => {
2618
2628
  shortcut: "Ctrl+Shift+C",
2619
2629
  isActive: ({ editor: e }) => e.isActive("claim"),
2620
2630
  execute: ({ editor: e }, t) => {
2621
- const n = typeof t == "object" && t ? t : {}, r = n.placement || "current", a = typeof n.text == "string" ? n.text : "", s = fe(e).length, i = {
2631
+ const n = typeof t == "object" && t ? t : {}, r = n.placement || "current", a = typeof n.text == "string" ? n.text : "", s = ge(e).length, i = {
2622
2632
  number: n.number || s + 1,
2623
- claimId: fn(),
2633
+ claimId: hn(),
2624
2634
  dependsOn: [],
2625
2635
  dependsOnClaimIds: []
2626
2636
  }, l = a ? [{ type: "text", text: a }] : [];
2627
2637
  let c;
2628
2638
  if (r === "end") {
2629
- const o = fe(e).at(-1), u = o ? o.pos + o.node.nodeSize : e.state.doc.content.size;
2630
- c = Ve(e, { type: "claim", position: u, attrs: i, content: l });
2639
+ const o = ge(e).at(-1), u = o ? o.pos + o.node.nodeSize : e.state.doc.content.size;
2640
+ c = Ye(e, { type: "claim", position: u, attrs: i, content: l });
2631
2641
  } else
2632
- c = Ve(e, { type: "claim", attrs: i, content: l });
2633
- return !c || !ie(e) ? !1 : Q(e);
2642
+ c = Ye(e, { type: "claim", attrs: i, content: l });
2643
+ return !c || !ie(e) ? !1 : Y(e);
2634
2644
  }
2635
2645
  },
2636
2646
  updateClaim: {
2637
2647
  description: "Update claim attrs and content",
2638
2648
  category: "patent",
2639
2649
  execute: ({ editor: e }, t) => {
2640
- const n = typeof t == "object" && t ? t : {}, r = at(e, n.position);
2650
+ const n = typeof t == "object" && t ? t : {}, r = ot(e, n.position);
2641
2651
  if (typeof r != "number")
2642
2652
  return !1;
2643
2653
  const a = {};
2644
- return typeof n.number == "number" && (a.number = n.number), !(Object.keys(a).length === 0 ? !0 : pe(e, { type: "claim", position: r, attrs: a })) || !(typeof n.text == "string" ? ns(e, r, n.text) : !0) || !ie(e) ? !1 : Q(e);
2654
+ return typeof n.number == "number" && (a.number = n.number), !(Object.keys(a).length === 0 ? !0 : he(e, { type: "claim", position: r, attrs: a })) || !(typeof n.text == "string" ? ds(e, r, n.text) : !0) || !ie(e) ? !1 : Y(e);
2645
2655
  }
2646
2656
  },
2647
2657
  setClaimDependency: {
2648
2658
  description: "Set claim dependency and regenerate prefix",
2649
2659
  category: "patent",
2650
2660
  execute: ({ editor: e }, t) => {
2651
- const n = typeof t == "object" && t ? t : {}, r = at(e, n.position);
2661
+ const n = typeof t == "object" && t ? t : {}, r = ot(e, n.position);
2652
2662
  if (typeof r != "number")
2653
2663
  return !1;
2654
2664
  const a = e.state.doc.nodeAt(r);
2655
2665
  if (!a || a.type.name !== "claim")
2656
2666
  return !1;
2657
2667
  const s = Number(a.attrs.number), i = typeof a.attrs.claimId == "string" ? a.attrs.claimId : "", l = /* @__PURE__ */ new Map();
2658
- fe(e).forEach((m) => {
2668
+ ge(e).forEach((m) => {
2659
2669
  const p = Number(m.node.attrs.number), g = typeof m.node.attrs.claimId == "string" ? m.node.attrs.claimId : "";
2660
2670
  Number.isFinite(p) && p > 0 && g && l.set(p, g);
2661
2671
  });
2662
- const c = Ge(n.dependsOn).filter(
2672
+ const c = Je(n.dependsOn).filter(
2663
2673
  (m) => Number.isFinite(s) && m > 0 && m < s
2664
2674
  ), d = c.map((m) => l.get(m)).filter((m) => typeof m == "string" && m.length > 0 && m !== i);
2665
- return !pe(e, {
2675
+ return !he(e, {
2666
2676
  type: "claim",
2667
2677
  position: r,
2668
2678
  attrs: { dependsOn: c, dependsOnClaimIds: d }
2669
- }) || !ie(e) ? !1 : Q(e);
2679
+ }) || !ie(e) ? !1 : Y(e);
2670
2680
  }
2671
2681
  },
2672
2682
  setReferenceLanguage: {
@@ -2678,14 +2688,14 @@ const Be = () => {
2678
2688
  return !1;
2679
2689
  const r = n.lang === "en" ? "en" : "zh";
2680
2690
  k.getState().setEditorLanguage(r);
2681
- const s = (n.scope || "all") === "current" ? ye(e, "reference") : null;
2691
+ const s = (n.scope || "all") === "current" ? be(e, "reference") : null;
2682
2692
  return e.commands.command(({ tr: l, state: c, dispatch: d }) => {
2683
2693
  let o = !1;
2684
2694
  return c.doc.descendants((u, m) => (u.type.name !== "reference" || s && m !== s.pos || u.attrs.lang !== r && (l.setNodeMarkup(m, void 0, {
2685
2695
  ...u.attrs,
2686
2696
  lang: r
2687
2697
  }), o = !0), !0)), o && d && d(l), !0;
2688
- }) ? Q(e) : !1;
2698
+ }) ? Y(e) : !1;
2689
2699
  }
2690
2700
  },
2691
2701
  validateClaimGraph: {
@@ -2697,19 +2707,19 @@ const Be = () => {
2697
2707
  description: "Delete claim node and reorder numbers",
2698
2708
  category: "patent",
2699
2709
  execute: ({ editor: e }, t) => {
2700
- const r = at(e, (typeof t == "object" && t ? t : {}).position);
2701
- return typeof r != "number" || !Ct(e, { type: "claim", position: r }) || !ie(e) ? !1 : Q(e);
2710
+ const r = ot(e, (typeof t == "object" && t ? t : {}).position);
2711
+ return typeof r != "number" || !St(e, { type: "claim", position: r }) || !ie(e) ? !1 : Y(e);
2702
2712
  }
2703
2713
  },
2704
2714
  reorderClaims: {
2705
2715
  description: "Reorder all claim numbers by document order",
2706
2716
  category: "patent",
2707
- execute: ({ editor: e }) => ie(e) ? Q(e) : !1
2717
+ execute: ({ editor: e }) => ie(e) ? Y(e) : !1
2708
2718
  },
2709
2719
  normalizeClaims: {
2710
2720
  description: "Normalize claim ids, numbering, dependencies and references",
2711
2721
  category: "patent",
2712
- execute: ({ editor: e }) => ie(e) ? Q(e) : !1
2722
+ execute: ({ editor: e }) => ie(e) ? Y(e) : !1
2713
2723
  },
2714
2724
  insertFigure: {
2715
2725
  description: "Insert patent figure block",
@@ -2717,7 +2727,7 @@ const Be = () => {
2717
2727
  shortcut: "Ctrl+Shift+F",
2718
2728
  isActive: ({ editor: e }) => e.isActive("figure"),
2719
2729
  execute: ({ editor: e }, t) => {
2720
- const n = typeof t == "object" && t ? t : {}, r = Z(n.id) || $t(e), a = n.contentType && ["image", "mermaid", "drawio"].includes(n.contentType) ? n.contentType : "image";
2730
+ const n = typeof t == "object" && t ? t : {}, r = Z(n.id) || zt(e), a = n.contentType && ["image", "mermaid", "drawio"].includes(n.contentType) ? n.contentType : "image";
2721
2731
  return e.chain().focus().insertContent({
2722
2732
  type: "figure",
2723
2733
  attrs: { id: r, contentType: a, imageSrc: "", mermaidCode: "", drawioXml: "" },
@@ -2729,17 +2739,17 @@ const Be = () => {
2729
2739
  description: "Update figure attributes",
2730
2740
  category: "patent",
2731
2741
  execute: ({ editor: e }, t) => {
2732
- const n = typeof t == "object" && t ? t : {}, r = ye(e, "figure"), a = typeof n.position == "number" ? n.position : r == null ? void 0 : r.pos;
2742
+ const n = typeof t == "object" && t ? t : {}, r = be(e, "figure"), a = typeof n.position == "number" ? n.position : r == null ? void 0 : r.pos;
2733
2743
  if (typeof a != "number")
2734
2744
  return !1;
2735
2745
  const s = e.state.doc.nodeAt(a);
2736
2746
  if (!s || s.type.name !== "figure")
2737
2747
  return !1;
2738
- const l = (typeof n.id == "string" ? Z(n.id) : Z(s.attrs.id)) || $t(e);
2739
- if (_e(e).some((o) => o.pos === a ? !1 : Z(o.node.attrs.id) === l))
2748
+ const l = (typeof n.id == "string" ? Z(n.id) : Z(s.attrs.id)) || zt(e);
2749
+ if (Ae(e).some((o) => o.pos === a ? !1 : Z(o.node.attrs.id) === l))
2740
2750
  return !1;
2741
2751
  const d = { id: l };
2742
- return typeof n.contentType == "string" && ["image", "mermaid", "drawio"].includes(n.contentType) && (d.contentType = n.contentType), typeof n.imageSrc == "string" && (d.imageSrc = n.imageSrc), typeof n.mermaidCode == "string" && (d.mermaidCode = n.mermaidCode), typeof n.drawioXml == "string" && (d.drawioXml = n.drawioXml), pe(e, {
2752
+ return typeof n.contentType == "string" && ["image", "mermaid", "drawio"].includes(n.contentType) && (d.contentType = n.contentType), typeof n.imageSrc == "string" && (d.imageSrc = n.imageSrc), typeof n.mermaidCode == "string" && (d.mermaidCode = n.mermaidCode), typeof n.drawioXml == "string" && (d.drawioXml = n.drawioXml), he(e, {
2743
2753
  type: "figure",
2744
2754
  position: a,
2745
2755
  attrs: d
@@ -2752,7 +2762,7 @@ const Be = () => {
2752
2762
  execute: ({ editor: e }) => {
2753
2763
  const t = /* @__PURE__ */ new Set();
2754
2764
  let n = !1;
2755
- return _e(e).forEach((r) => {
2765
+ return Ae(e).forEach((r) => {
2756
2766
  const a = Z(r.node.attrs.id);
2757
2767
  if (a) {
2758
2768
  if (t.has(a)) {
@@ -2776,13 +2786,13 @@ const Be = () => {
2776
2786
  return typeof n.targetClaimId == "string" && n.targetClaimId.trim().length > 0;
2777
2787
  },
2778
2788
  execute: ({ editor: e }, t) => {
2779
- const n = typeof t == "object" && t ? t : {}, r = gn(e), a = typeof n.targetClaimId == "string" ? n.targetClaimId.trim() : "";
2789
+ const n = typeof t == "object" && t ? t : {}, r = yn(e), a = typeof n.targetClaimId == "string" ? n.targetClaimId.trim() : "";
2780
2790
  if (!a)
2781
2791
  return !1;
2782
2792
  const s = r.get(a);
2783
2793
  if (!s)
2784
2794
  return !1;
2785
- const i = s.number, l = n.lang || Ke(), c = n.displayText || ft(l, "claim", i, null, !1);
2795
+ const i = s.number, l = n.lang || Qe(), c = n.displayText || ht(l, "claim", i, null, !1);
2786
2796
  return e.chain().focus().insertContent({
2787
2797
  type: "reference",
2788
2798
  attrs: {
@@ -2797,7 +2807,7 @@ const Be = () => {
2797
2807
  target: n.target || String(i),
2798
2808
  highlight: !1
2799
2809
  }
2800
- }).run() ? Q(e) : !1;
2810
+ }).run() ? Y(e) : !1;
2801
2811
  }
2802
2812
  },
2803
2813
  insertFigureReference: {
@@ -2812,13 +2822,13 @@ const Be = () => {
2812
2822
  return typeof n.targetFigureId == "string" && n.targetFigureId.trim().length > 0;
2813
2823
  },
2814
2824
  execute: ({ editor: e }, t) => {
2815
- const n = typeof t == "object" && t ? t : {}, r = pn(e), a = typeof n.targetFigureId == "string" ? Z(n.targetFigureId) : "";
2825
+ const n = typeof t == "object" && t ? t : {}, r = bn(e), a = typeof n.targetFigureId == "string" ? Z(n.targetFigureId) : "";
2816
2826
  if (!a)
2817
2827
  return !1;
2818
2828
  const s = r.get(a);
2819
2829
  if (!s)
2820
2830
  return !1;
2821
- const i = n.lang || Ke(), l = n.displayText || ft(i, "figure", null, s.id, !1);
2831
+ const i = n.lang || Qe(), l = n.displayText || ht(i, "figure", null, s.id, !1);
2822
2832
  return e.chain().focus().insertContent({
2823
2833
  type: "reference",
2824
2834
  attrs: {
@@ -2833,7 +2843,7 @@ const Be = () => {
2833
2843
  target: n.target || s.id,
2834
2844
  highlight: !1
2835
2845
  }
2836
- }).run() ? Q(e) : !1;
2846
+ }).run() ? Y(e) : !1;
2837
2847
  }
2838
2848
  },
2839
2849
  repairReferences: {
@@ -2850,7 +2860,7 @@ const Be = () => {
2850
2860
  targetFigureId: null,
2851
2861
  invalid: !1
2852
2862
  }), l = !0), !0)), l && i && i(a), l;
2853
- }) ? !1 : Q(e);
2863
+ }) ? !1 : Y(e);
2854
2864
  }
2855
2865
  },
2856
2866
  setInvalidReferenceHandler: {
@@ -2867,7 +2877,7 @@ const Be = () => {
2867
2877
  description: "Insert patent document skeleton with all sections",
2868
2878
  category: "patent",
2869
2879
  execute: ({ editor: e }, t) => {
2870
- const n = typeof t == "object" && t ? t : {}, r = n.patentType === "utility_model" ? "utility_model" : n.patentType === "design" ? "design" : "invention", a = mn(r);
2880
+ const n = typeof t == "object" && t ? t : {}, r = n.patentType === "utility_model" ? "utility_model" : n.patentType === "design" ? "design" : "invention", a = pn(r);
2871
2881
  return e.commands.setContent(a);
2872
2882
  }
2873
2883
  },
@@ -2875,10 +2885,10 @@ const Be = () => {
2875
2885
  description: "Toggle patent section collapse state",
2876
2886
  category: "patent",
2877
2887
  execute: ({ editor: e }, t) => {
2878
- const n = typeof t == "object" && t ? t : {}, r = ye(e, "patent_section"), a = typeof n.position == "number" ? n.position : r == null ? void 0 : r.pos;
2888
+ const n = typeof t == "object" && t ? t : {}, r = be(e, "patent_section"), a = typeof n.position == "number" ? n.position : r == null ? void 0 : r.pos;
2879
2889
  if (typeof a != "number") return !1;
2880
2890
  const s = e.state.doc.nodeAt(a);
2881
- return !s || s.type.name !== "patent_section" ? !1 : pe(e, {
2891
+ return !s || s.type.name !== "patent_section" ? !1 : he(e, {
2882
2892
  type: "patent_section",
2883
2893
  position: a,
2884
2894
  attrs: { collapsed: !s.attrs.collapsed }
@@ -2887,58 +2897,58 @@ const Be = () => {
2887
2897
  }
2888
2898
  },
2889
2899
  onStateChange: (e) => {
2890
- ie(e) && (Q(e), Ft(e), ts(e), Za(e));
2900
+ ie(e) && (Y(e), Ht(e), ls(e), os(e));
2891
2901
  },
2892
2902
  onSelectionChange: (e) => {
2893
- Ft(e);
2903
+ Ht(e);
2894
2904
  }
2895
- }, as = [Ea, _a, La, rs];
2896
- as.forEach((e) => W.register(e));
2897
- const ss = (e = {}) => {
2905
+ }, ms = [Ma, Oa, za, us];
2906
+ ms.forEach((e) => G.register(e));
2907
+ const fs = (e = {}) => {
2898
2908
  const t = [
2899
- ...xa,
2900
- ...W.getExtensions(),
2909
+ ...Aa,
2910
+ ...G.getExtensions(),
2901
2911
  ...e.extensions || []
2902
2912
  ];
2903
2913
  return {
2904
2914
  ...e,
2905
2915
  extensions: t
2906
2916
  };
2907
- }, st = (e) => {
2917
+ }, ct = (e) => {
2908
2918
  const { from: t, to: n } = e.state.selection;
2909
2919
  return {
2910
2920
  editor: e,
2911
2921
  selection: { from: t, to: n },
2912
2922
  store: k.getState()
2913
2923
  };
2914
- }, Ae = (e) => ({
2915
- execCommand: (t, n, r) => W.executeCommand(t, st(e), n, r),
2916
- canExecCommand: (t, n) => W.canExecuteCommand(t, st(e), n),
2917
- isCommandActive: (t) => W.isCommandActive(t, st(e)),
2918
- listCommands: () => W.getCommandNames(),
2919
- insertNode: (t) => Ve(e, t),
2920
- updateNodeAttrs: (t) => pe(e, t),
2921
- removeNode: (t) => Ct(e, t),
2922
- wrapSelection: (t) => dn(e, t),
2923
- applyTransactionBatch: (t) => Ra(e, t),
2924
- findNodeByType: (t, n) => bt(e, t, n),
2925
- findAncestorNode: (t) => ye(e, t),
2926
- findCurrentBlock: () => Pa(e),
2927
- findNodesByPredicate: (t, n) => vt(e, t, n)
2928
- }), is = /* @__PURE__ */ new Set([
2924
+ }, Pe = (e) => ({
2925
+ execCommand: (t, n, r) => G.executeCommand(t, ct(e), n, r),
2926
+ canExecCommand: (t, n) => G.canExecuteCommand(t, ct(e), n),
2927
+ isCommandActive: (t) => G.isCommandActive(t, ct(e)),
2928
+ listCommands: () => G.getCommandNames(),
2929
+ insertNode: (t) => Ye(e, t),
2930
+ updateNodeAttrs: (t) => he(e, t),
2931
+ removeNode: (t) => St(e, t),
2932
+ wrapSelection: (t) => fn(e, t),
2933
+ applyTransactionBatch: (t) => ja(e, t),
2934
+ findNodeByType: (t, n) => wt(e, t, n),
2935
+ findAncestorNode: (t) => be(e, t),
2936
+ findCurrentBlock: () => Ba(e),
2937
+ findNodesByPredicate: (t, n) => xt(e, t, n)
2938
+ }), gs = /* @__PURE__ */ new Set([
2929
2939
  "abstract",
2930
2940
  "abstract_drawing",
2931
2941
  "claims",
2932
2942
  "drawing_figures"
2933
- ]), os = /* @__PURE__ */ new Set([
2943
+ ]), ps = /* @__PURE__ */ new Set([
2934
2944
  "technical_field",
2935
2945
  "background_art",
2936
2946
  "summary",
2937
2947
  "drawing_description",
2938
2948
  "detailed_description"
2939
2949
  ]);
2940
- function cs(e, t) {
2941
- const n = U(t), r = [];
2950
+ function hs(e, t) {
2951
+ const n = j(t), r = [];
2942
2952
  return e.state.doc.descendants((a) => {
2943
2953
  if (a.type.name === "patent_title") {
2944
2954
  const s = a.textContent.trim();
@@ -2959,87 +2969,87 @@ function cs(e, t) {
2959
2969
  return !0;
2960
2970
  }), r;
2961
2971
  }
2962
- function zt(e) {
2963
- return new Qe({
2964
- children: [new Ye({ text: e, bold: !0, size: 32, font: "黑体" })],
2965
- alignment: yt.CENTER,
2972
+ function Ut(e) {
2973
+ return new tt({
2974
+ children: [new nt({ text: e, bold: !0, size: 32, font: "黑体" })],
2975
+ alignment: Ct.CENTER,
2966
2976
  spacing: { before: 400, after: 200 }
2967
2977
  });
2968
2978
  }
2969
- function Bt(e) {
2970
- return new Qe({
2971
- children: [new Ye({ text: e, bold: !0, size: 28, font: "黑体" })],
2972
- alignment: yt.CENTER,
2979
+ function jt(e) {
2980
+ return new tt({
2981
+ children: [new nt({ text: e, bold: !0, size: 28, font: "黑体" })],
2982
+ alignment: Ct.CENTER,
2973
2983
  spacing: { before: 240, after: 120 }
2974
2984
  });
2975
2985
  }
2976
- function ls(e) {
2977
- return new Qe({
2978
- children: [new Ye({ text: e, bold: !0, size: 36, font: "宋体" })],
2979
- alignment: yt.CENTER,
2986
+ function ys(e) {
2987
+ return new tt({
2988
+ children: [new nt({ text: e, bold: !0, size: 36, font: "宋体" })],
2989
+ alignment: Ct.CENTER,
2980
2990
  spacing: { before: 200, after: 200 }
2981
2991
  });
2982
2992
  }
2983
- function it(e) {
2984
- return new Qe({
2985
- children: [new Ye({ text: e, size: 24, font: "宋体" })],
2993
+ function lt(e) {
2994
+ return new tt({
2995
+ children: [new nt({ text: e, size: 24, font: "宋体" })],
2986
2996
  spacing: { line: 360 },
2987
- indent: { firstLine: Se(7) }
2997
+ indent: { firstLine: Ie(7) }
2988
2998
  });
2989
2999
  }
2990
- function ds(e, t) {
2991
- const n = U(t), r = [];
3000
+ function bs(e, t) {
3001
+ const n = j(t), r = [];
2992
3002
  let a = !1;
2993
3003
  for (const s of e) {
2994
- if (is.has(s.sectionType)) {
2995
- r.push(zt(s.title));
3004
+ if (gs.has(s.sectionType)) {
3005
+ r.push(Ut(s.title));
2996
3006
  for (const i of s.paragraphs)
2997
- r.push(it(i));
3007
+ r.push(lt(i));
2998
3008
  continue;
2999
3009
  }
3000
3010
  if (s.type === "patent_title") {
3001
3011
  if (!a) {
3002
3012
  const i = typeof n.bookTitle_description == "string" ? n.bookTitle_description : "说明书";
3003
- r.push(zt(i)), a = !0;
3013
+ r.push(Ut(i)), a = !0;
3004
3014
  }
3005
3015
  for (const i of s.paragraphs)
3006
- r.push(ls(i));
3016
+ r.push(ys(i));
3007
3017
  continue;
3008
3018
  }
3009
- if (os.has(s.sectionType)) {
3010
- r.push(Bt(s.title));
3019
+ if (ps.has(s.sectionType)) {
3020
+ r.push(jt(s.title));
3011
3021
  for (const i of s.paragraphs)
3012
- r.push(it(i));
3022
+ r.push(lt(i));
3013
3023
  continue;
3014
3024
  }
3015
- r.push(Bt(s.title));
3025
+ r.push(jt(s.title));
3016
3026
  for (const i of s.paragraphs)
3017
- r.push(it(i));
3027
+ r.push(lt(i));
3018
3028
  }
3019
3029
  return r;
3020
3030
  }
3021
- async function Ht(e, t) {
3022
- const n = cs(e, t), r = ds(n, t), a = n.find((d) => d.type === "patent_title"), s = a != null && a.paragraphs[0] ? `${a.paragraphs[0]}.docx` : "patent-document.docx", i = {
3031
+ async function Wt(e, t) {
3032
+ const n = hs(e, t), r = bs(n, t), a = n.find((d) => d.type === "patent_title"), s = a != null && a.paragraphs[0] ? `${a.paragraphs[0]}.docx` : "patent-document.docx", i = {
3023
3033
  properties: {
3024
3034
  page: {
3025
3035
  margin: {
3026
- top: Se(25),
3027
- bottom: Se(25),
3028
- left: Se(25),
3029
- right: Se(20)
3036
+ top: Ie(25),
3037
+ bottom: Ie(25),
3038
+ left: Ie(25),
3039
+ right: Ie(20)
3030
3040
  }
3031
3041
  }
3032
3042
  },
3033
3043
  children: r
3034
- }, l = new Zr({
3044
+ }, l = new oa({
3035
3045
  sections: [i]
3036
- }), c = await ea.toBlob(l);
3037
- ta(c, s);
3046
+ }), c = await ca.toBlob(l);
3047
+ la(c, s);
3038
3048
  }
3039
- async function us(e) {
3049
+ async function vs(e) {
3040
3050
  window.print();
3041
3051
  }
3042
- const ms = ["history", "text", "structure", "format", "technical", "patent"], ot = (e) => e.split("_").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), ct = ({ btn: e, items: t }) => {
3052
+ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt = (e) => e.split("_").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), ut = ({ btn: e, items: t }) => {
3043
3053
  const [n, r] = z(!1), a = X(null), s = X(null), [i, l] = z({ top: 0, left: 0 }), c = de(() => {
3044
3054
  if (!a.current) return;
3045
3055
  const d = a.current.getBoundingClientRect();
@@ -3062,7 +3072,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3062
3072
  {
3063
3073
  onClick: e.run,
3064
3074
  disabled: e.disabled,
3065
- className: re(
3075
+ className: ae(
3066
3076
  "p-2 rounded-l transition-colors",
3067
3077
  e.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200",
3068
3078
  e.isActive ? "bg-gray-300 text-blue-600" : "text-gray-700"
@@ -3076,15 +3086,15 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3076
3086
  {
3077
3087
  ref: a,
3078
3088
  onClick: () => r((d) => !d),
3079
- className: re(
3089
+ className: ae(
3080
3090
  "px-1 py-2 rounded-r transition-colors border-l border-gray-200",
3081
3091
  e.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200 text-gray-500"
3082
3092
  ),
3083
3093
  disabled: e.disabled,
3084
- children: /* @__PURE__ */ f(nn, { size: 12 })
3094
+ children: /* @__PURE__ */ f(sn, { size: 12 })
3085
3095
  }
3086
3096
  ),
3087
- n && Cr(
3097
+ n && _r(
3088
3098
  /* @__PURE__ */ f(
3089
3099
  "div",
3090
3100
  {
@@ -3107,21 +3117,21 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3107
3117
  document.body
3108
3118
  )
3109
3119
  ] });
3110
- }, fs = ({
3120
+ }, ws = ({
3111
3121
  editor: e,
3112
- groupOrder: t = ms,
3122
+ groupOrder: t = Cs,
3113
3123
  collapsibleGroups: n = !0,
3114
3124
  defaultCollapsedGroups: r = []
3115
3125
  }) => {
3116
- const [a, s] = z(() => new Set(r)), { editorLanguage: i, setEditorLanguage: l } = k(), c = U(i);
3126
+ const [a, s] = z(() => new Set(r)), { editorLanguage: i, setEditorLanguage: l } = k(), c = j(i);
3117
3127
  if (!e)
3118
3128
  return null;
3119
- const d = Ae(e), o = i === "zh", u = [
3129
+ const d = Pe(e), o = i === "zh", u = [
3120
3130
  {
3121
3131
  id: "core-undo",
3122
3132
  label: "Undo",
3123
3133
  group: "history",
3124
- icon: wr,
3134
+ icon: kr,
3125
3135
  tooltip: "Undo (Ctrl+Z)",
3126
3136
  isActive: !1,
3127
3137
  disabled: !e.can().chain().focus().undo().run(),
@@ -3133,7 +3143,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3133
3143
  id: "core-redo",
3134
3144
  label: "Redo",
3135
3145
  group: "history",
3136
- icon: xr,
3146
+ icon: Ar,
3137
3147
  tooltip: "Redo (Ctrl+Y)",
3138
3148
  isActive: !1,
3139
3149
  disabled: !e.can().chain().focus().redo().run(),
@@ -3145,7 +3155,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3145
3155
  id: "core-bold",
3146
3156
  label: "Bold",
3147
3157
  group: "text",
3148
- icon: Vt,
3158
+ icon: Xt,
3149
3159
  tooltip: "Bold",
3150
3160
  isActive: e.isActive("bold"),
3151
3161
  disabled: !1,
@@ -3157,7 +3167,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3157
3167
  id: "core-italic",
3158
3168
  label: "Italic",
3159
3169
  group: "text",
3160
- icon: Kt,
3170
+ icon: Yt,
3161
3171
  tooltip: "Italic",
3162
3172
  isActive: e.isActive("italic"),
3163
3173
  disabled: !1,
@@ -3169,7 +3179,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3169
3179
  id: "core-underline",
3170
3180
  label: "Underline",
3171
3181
  group: "text",
3172
- icon: Jt,
3182
+ icon: Qt,
3173
3183
  tooltip: "Underline",
3174
3184
  isActive: e.isActive("underline"),
3175
3185
  disabled: !1,
@@ -3181,7 +3191,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3181
3191
  id: "core-strike",
3182
3192
  label: "Strike",
3183
3193
  group: "text",
3184
- icon: Xt,
3194
+ icon: Zt,
3185
3195
  tooltip: "Strike",
3186
3196
  isActive: e.isActive("strike"),
3187
3197
  disabled: !1,
@@ -3193,7 +3203,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3193
3203
  id: "core-code",
3194
3204
  label: "Code",
3195
3205
  group: "text",
3196
- icon: Qt,
3206
+ icon: en,
3197
3207
  tooltip: "Code",
3198
3208
  isActive: e.isActive("code"),
3199
3209
  disabled: !1,
@@ -3205,7 +3215,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3205
3215
  id: "core-superscript",
3206
3216
  label: "Superscript",
3207
3217
  group: "text",
3208
- icon: Yt,
3218
+ icon: tn,
3209
3219
  tooltip: "Superscript (Ctrl+.)",
3210
3220
  isActive: e.isActive("superscript"),
3211
3221
  disabled: !1,
@@ -3217,7 +3227,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3217
3227
  id: "core-subscript",
3218
3228
  label: "Subscript",
3219
3229
  group: "text",
3220
- icon: Zt,
3230
+ icon: nn,
3221
3231
  tooltip: "Subscript (Ctrl+,)",
3222
3232
  isActive: e.isActive("subscript"),
3223
3233
  disabled: !1,
@@ -3229,7 +3239,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3229
3239
  id: "core-paragraph",
3230
3240
  label: "Paragraph",
3231
3241
  group: "structure",
3232
- icon: Sr,
3242
+ icon: Lr,
3233
3243
  tooltip: "Paragraph",
3234
3244
  isActive: e.isActive("paragraph"),
3235
3245
  disabled: !1,
@@ -3241,7 +3251,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3241
3251
  id: "core-heading1",
3242
3252
  label: "H1",
3243
3253
  group: "structure",
3244
- icon: Tr,
3254
+ icon: Pr,
3245
3255
  tooltip: "Heading 1",
3246
3256
  isActive: e.isActive("heading", { level: 1 }),
3247
3257
  disabled: !1,
@@ -3253,7 +3263,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3253
3263
  id: "core-heading2",
3254
3264
  label: "H2",
3255
3265
  group: "structure",
3256
- icon: Ir,
3266
+ icon: Dr,
3257
3267
  tooltip: "Heading 2",
3258
3268
  isActive: e.isActive("heading", { level: 2 }),
3259
3269
  disabled: !1,
@@ -3265,7 +3275,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3265
3275
  id: "core-heading3",
3266
3276
  label: "H3",
3267
3277
  group: "structure",
3268
- icon: Er,
3278
+ icon: Mr,
3269
3279
  tooltip: "Heading 3",
3270
3280
  isActive: e.isActive("heading", { level: 3 }),
3271
3281
  disabled: !1,
@@ -3277,7 +3287,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3277
3287
  id: "core-align-left",
3278
3288
  label: o ? "左对齐" : "Align Left",
3279
3289
  group: "format",
3280
- icon: Nr,
3290
+ icon: Rr,
3281
3291
  tooltip: o ? "左对齐" : "Align Left",
3282
3292
  isActive: e.isActive({ textAlign: "left" }),
3283
3293
  disabled: !1,
@@ -3289,7 +3299,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3289
3299
  id: "core-align-center",
3290
3300
  label: o ? "居中" : "Center",
3291
3301
  group: "format",
3292
- icon: _r,
3302
+ icon: Or,
3293
3303
  tooltip: o ? "居中对齐" : "Align Center",
3294
3304
  isActive: e.isActive({ textAlign: "center" }),
3295
3305
  disabled: !1,
@@ -3301,7 +3311,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3301
3311
  id: "core-align-right",
3302
3312
  label: o ? "右对齐" : "Align Right",
3303
3313
  group: "format",
3304
- icon: kr,
3314
+ icon: $r,
3305
3315
  tooltip: o ? "右对齐" : "Align Right",
3306
3316
  isActive: e.isActive({ textAlign: "right" }),
3307
3317
  disabled: !1,
@@ -3313,7 +3323,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3313
3323
  id: "core-align-justify",
3314
3324
  label: o ? "两端对齐" : "Justify",
3315
3325
  group: "format",
3316
- icon: Ar,
3326
+ icon: Fr,
3317
3327
  tooltip: o ? "两端对齐" : "Justify",
3318
3328
  isActive: e.isActive({ textAlign: "justify" }),
3319
3329
  disabled: !1,
@@ -3325,7 +3335,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3325
3335
  id: "core-bullet-list",
3326
3336
  label: "Bullet List",
3327
3337
  group: "structure",
3328
- icon: Lr,
3338
+ icon: zr,
3329
3339
  tooltip: "Bullet List",
3330
3340
  isActive: e.isActive("bulletList"),
3331
3341
  disabled: !1,
@@ -3337,7 +3347,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3337
3347
  id: "core-ordered-list",
3338
3348
  label: "Ordered List",
3339
3349
  group: "structure",
3340
- icon: Pr,
3350
+ icon: Br,
3341
3351
  tooltip: "Ordered List",
3342
3352
  isActive: e.isActive("orderedList"),
3343
3353
  disabled: !1,
@@ -3349,7 +3359,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3349
3359
  id: "core-blockquote",
3350
3360
  label: "Blockquote",
3351
3361
  group: "structure",
3352
- icon: Dr,
3362
+ icon: Hr,
3353
3363
  tooltip: "Blockquote",
3354
3364
  isActive: e.isActive("blockquote"),
3355
3365
  disabled: !1,
@@ -3361,7 +3371,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3361
3371
  id: "core-code-block",
3362
3372
  label: "Code Block",
3363
3373
  group: "structure",
3364
- icon: Mr,
3374
+ icon: Ur,
3365
3375
  tooltip: "Code Block",
3366
3376
  isActive: e.isActive("codeBlock"),
3367
3377
  disabled: !1,
@@ -3373,7 +3383,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3373
3383
  id: "core-table",
3374
3384
  label: "Insert Table",
3375
3385
  group: "structure",
3376
- icon: Rr,
3386
+ icon: jr,
3377
3387
  tooltip: "Insert Table",
3378
3388
  isActive: !1,
3379
3389
  disabled: !1,
@@ -3385,7 +3395,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3385
3395
  id: "core-horizontal-rule",
3386
3396
  label: "Horizontal Rule",
3387
3397
  group: "structure",
3388
- icon: $r,
3398
+ icon: Wr,
3389
3399
  tooltip: "Horizontal Rule",
3390
3400
  isActive: !1,
3391
3401
  disabled: !1,
@@ -3397,7 +3407,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3397
3407
  id: "core-task-list",
3398
3408
  label: "Task List",
3399
3409
  group: "structure",
3400
- icon: Or,
3410
+ icon: Gr,
3401
3411
  tooltip: "Task List",
3402
3412
  isActive: e.isActive("taskList"),
3403
3413
  disabled: !1,
@@ -3406,21 +3416,21 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3406
3416
  }
3407
3417
  }
3408
3418
  ], m = {
3409
- GitGraph: Ur,
3410
- Sigma: Hr,
3411
- FunctionSquare: Br,
3412
- Workflow: zr,
3413
- Box: Fr,
3414
- FileText: tn,
3415
- Link2: ht,
3416
- Image: en
3417
- }, p = W.getToolbarItems().map((h) => {
3418
- const T = W.getCommandMeta(h.command), N = h.tooltip || (T == null ? void 0 : T.description) || h.label, M = h.shortcut || (T == null ? void 0 : T.shortcut), R = M ? `${N} (${M})` : N;
3419
+ GitGraph: Xr,
3420
+ Sigma: Jr,
3421
+ FunctionSquare: Kr,
3422
+ Workflow: Vr,
3423
+ Box: qr,
3424
+ FileText: an,
3425
+ Link2: vt,
3426
+ Image: rn
3427
+ }, p = G.getToolbarItems().map((h) => {
3428
+ const T = G.getCommandMeta(h.command), N = h.tooltip || (T == null ? void 0 : T.description) || h.label, M = h.shortcut || (T == null ? void 0 : T.shortcut), R = M ? `${N} (${M})` : N;
3419
3429
  return {
3420
3430
  id: h.id,
3421
3431
  label: h.label,
3422
3432
  group: h.group || "technical",
3423
- icon: h.icon ? m[h.icon] || It : It,
3433
+ icon: h.icon ? m[h.icon] || _t : _t,
3424
3434
  isActive: d.isCommandActive(h.command),
3425
3435
  disabled: !d.canExecCommand(h.command),
3426
3436
  tooltip: R,
@@ -3432,14 +3442,14 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3432
3442
  id: "core-export",
3433
3443
  label: o ? "导出" : "Export",
3434
3444
  group: "patent",
3435
- icon: jr,
3445
+ icon: Yr,
3436
3446
  tooltip: o ? "导出文档" : "Export Document",
3437
3447
  isActive: !1,
3438
3448
  disabled: !1,
3439
- run: () => void Ht(e, i)
3449
+ run: () => void Wt(e, i)
3440
3450
  }, y = [
3441
- { label: o ? "导出 Word (.docx)" : "Export Word (.docx)", onClick: () => void Ht(e, i) },
3442
- { label: o ? "导出 PDF (打印)" : "Export PDF (Print)", onClick: () => void us() }
3451
+ { label: o ? "导出 Word (.docx)" : "Export Word (.docx)", onClick: () => void Wt(e, i) },
3452
+ { label: o ? "导出 PDF (打印)" : "Export PDF (Print)", onClick: () => void vs() }
3443
3453
  ], w = [...u, ...p, g], b = w.map((h) => h.group).filter((h, T, N) => N.indexOf(h) === T && !t.includes(h)), C = [...t, ...b].map((h) => ({
3444
3454
  group: h,
3445
3455
  items: w.filter((T) => T.group === h)
@@ -3464,12 +3474,12 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3464
3474
  { label: c.insertImageFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "image" }) },
3465
3475
  { label: c.insertMermaidFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "mermaid" }) },
3466
3476
  { label: c.insertDrawioFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "drawio" }) }
3467
- ], P = (h) => h.id === "core-table" ? /* @__PURE__ */ f(ct, { btn: h, items: I }, h.id) : h.id === "core-export" ? /* @__PURE__ */ f(ct, { btn: h, items: y }, h.id) : h.id === "patent-figure-insert" ? /* @__PURE__ */ f(ct, { btn: h, items: A }, h.id) : /* @__PURE__ */ f(
3477
+ ], P = (h) => h.id === "core-table" ? /* @__PURE__ */ f(ut, { btn: h, items: I }, h.id) : h.id === "core-export" ? /* @__PURE__ */ f(ut, { btn: h, items: y }, h.id) : h.id === "patent-figure-insert" ? /* @__PURE__ */ f(ut, { btn: h, items: A }, h.id) : /* @__PURE__ */ f(
3468
3478
  "button",
3469
3479
  {
3470
3480
  onClick: h.run,
3471
3481
  disabled: h.disabled,
3472
- className: re(
3482
+ className: ae(
3473
3483
  "p-2 rounded transition-colors",
3474
3484
  h.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200",
3475
3485
  h.isActive ? "bg-gray-300 text-blue-600" : "text-gray-700"
@@ -3507,16 +3517,16 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3507
3517
  x(h.group);
3508
3518
  },
3509
3519
  className: "px-2 py-1 text-xs rounded bg-gray-200 text-gray-700 hover:bg-gray-300",
3510
- title: T ? `Expand ${ot(h.group)}` : `Collapse ${ot(h.group)}`,
3511
- children: ot(h.group)
3520
+ title: T ? `Expand ${dt(h.group)}` : `Collapse ${dt(h.group)}`,
3521
+ children: dt(h.group)
3512
3522
  }
3513
3523
  ),
3514
3524
  (!n || !T) && h.items.map(P)
3515
3525
  ] }, h.group);
3516
3526
  })
3517
3527
  ] }) });
3518
- }, gs = ({ editor: e }) => {
3519
- const [t, n] = z(0), [r, a] = z(""), [s, i] = z(""), l = k((S) => S.editorLanguage), c = U(l);
3528
+ }, xs = ({ editor: e }) => {
3529
+ const [t, n] = z(0), [r, a] = z(""), [s, i] = z(""), l = k((S) => S.editorLanguage), c = j(l);
3520
3530
  if (B(() => {
3521
3531
  if (!e) return;
3522
3532
  const S = () => n((H) => H + 1);
@@ -3524,14 +3534,14 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3524
3534
  e.off("selectionUpdate", S), e.off("update", S);
3525
3535
  };
3526
3536
  }, [e]), !e) return null;
3527
- const d = Ae(e), o = [];
3537
+ const d = Pe(e), o = [];
3528
3538
  e.state.doc.descendants((S) => {
3529
3539
  if (S.type.name !== "claim") return !0;
3530
- const H = typeof S.attrs.claimId == "string" ? S.attrs.claimId : "", $ = Number(S.attrs.number);
3531
- return !H || !Number.isFinite($) || o.push({
3540
+ const H = typeof S.attrs.claimId == "string" ? S.attrs.claimId : "", O = Number(S.attrs.number);
3541
+ return !H || !Number.isFinite(O) || o.push({
3532
3542
  id: H,
3533
- number: $,
3534
- label: l === "en" ? `Claim ${$}` : `权利要求${$}`
3543
+ number: O,
3544
+ label: l === "en" ? `Claim ${O}` : `权利要求${O}`
3535
3545
  }), !0;
3536
3546
  });
3537
3547
  const u = [];
@@ -3544,16 +3554,16 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3544
3554
  (S) => Number.isFinite(g) && S.number < g
3545
3555
  ), b = new Set(y), v = !!p, C = (S) => {
3546
3556
  if (!v) return;
3547
- const H = b.has(S) ? y.filter(($) => $ !== S) : [...y, S].sort(($, O) => $ - O);
3557
+ const H = b.has(S) ? y.filter((O) => O !== S) : [...y, S].sort((O, $) => O - $);
3548
3558
  d.execCommand("patent.setClaimDependency", { dependsOn: H });
3549
3559
  }, x = d.findAncestorNode("figure"), I = !!x, A = x && typeof x.node.attrs.id == "string" ? x.node.attrs.id.trim() : "", P = x && typeof x.node.attrs.contentType == "string" ? x.node.attrs.contentType : "image", [h, T] = z(""), N = X(null), M = X(null), R = (x == null ? void 0 : x.pos) ?? null;
3550
3560
  R !== M.current && (M.current = R, I && A !== h && T(A));
3551
- const Y = (S) => {
3561
+ const Q = (S) => {
3552
3562
  x && d.execCommand("patent.updateFigure", {
3553
3563
  position: x.pos,
3554
3564
  contentType: S
3555
3565
  });
3556
- }, Le = () => {
3566
+ }, De = () => {
3557
3567
  if (!x) return;
3558
3568
  const S = h.trim();
3559
3569
  S !== A && d.execCommand("patent.updateFigure", {
@@ -3562,7 +3572,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3562
3572
  });
3563
3573
  };
3564
3574
  return /* @__PURE__ */ f("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: [
3565
- o.length > 0 && /* @__PURE__ */ L(we, { children: [
3575
+ o.length > 0 && /* @__PURE__ */ L(Se, { children: [
3566
3576
  /* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.referenceTarget }),
3567
3577
  /* @__PURE__ */ L(
3568
3578
  "select",
@@ -3587,11 +3597,11 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3587
3597
  },
3588
3598
  className: "p-2 hover:bg-blue-50 text-blue-600 rounded",
3589
3599
  title: c.insertReference,
3590
- children: /* @__PURE__ */ f(ht, { size: 16 })
3600
+ children: /* @__PURE__ */ f(vt, { size: 16 })
3591
3601
  }
3592
3602
  )
3593
3603
  ] }),
3594
- u.length > 0 && /* @__PURE__ */ L(we, { children: [
3604
+ u.length > 0 && /* @__PURE__ */ L(Se, { children: [
3595
3605
  /* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.figureReferenceTarget }),
3596
3606
  /* @__PURE__ */ L(
3597
3607
  "select",
@@ -3616,12 +3626,12 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3616
3626
  },
3617
3627
  className: "p-2 hover:bg-blue-50 text-blue-600 rounded",
3618
3628
  title: c.insertFigureReference,
3619
- children: /* @__PURE__ */ f(en, { size: 16 })
3629
+ children: /* @__PURE__ */ f(rn, { size: 16 })
3620
3630
  }
3621
3631
  )
3622
3632
  ] }),
3623
3633
  /* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
3624
- I && /* @__PURE__ */ L(we, { children: [
3634
+ I && /* @__PURE__ */ L(Se, { children: [
3625
3635
  /* @__PURE__ */ f("span", { className: "text-xs font-medium text-gray-700", children: c.currentFigure }),
3626
3636
  /* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.figureId }),
3627
3637
  /* @__PURE__ */ f(
@@ -3631,9 +3641,9 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3631
3641
  type: "text",
3632
3642
  value: h,
3633
3643
  onChange: (S) => T(S.target.value),
3634
- onBlur: Le,
3644
+ onBlur: De,
3635
3645
  onKeyDown: (S) => {
3636
- S.key === "Enter" && (Le(), S.target.blur());
3646
+ S.key === "Enter" && (De(), S.target.blur());
3637
3647
  },
3638
3648
  className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white w-20",
3639
3649
  placeholder: l === "en" ? "Fig.1" : "图1"
@@ -3644,7 +3654,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3644
3654
  "select",
3645
3655
  {
3646
3656
  value: P,
3647
- onChange: (S) => Y(S.target.value),
3657
+ onChange: (S) => Q(S.target.value),
3648
3658
  className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white",
3649
3659
  children: [
3650
3660
  /* @__PURE__ */ f("option", { value: "image", children: c.figureContentTypeImage }),
@@ -3657,21 +3667,21 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3657
3667
  ] }),
3658
3668
  e.isActive("image") && (() => {
3659
3669
  const H = e.getAttributes("image").width || "";
3660
- return /* @__PURE__ */ L(we, { children: [
3670
+ return /* @__PURE__ */ L(Se, { children: [
3661
3671
  /* @__PURE__ */ f("span", { className: "text-xs font-medium text-gray-700", children: l === "zh" ? "图片" : "Image" }),
3662
- ["25%", "50%", "75%", "100%"].map((O) => /* @__PURE__ */ f(
3672
+ ["25%", "50%", "75%", "100%"].map(($) => /* @__PURE__ */ f(
3663
3673
  "button",
3664
3674
  {
3665
- onClick: () => e.chain().focus().updateAttributes("image", { width: O }).run(),
3666
- className: `text-xs px-2 py-0.5 rounded border ${H === O ? "bg-blue-50 text-blue-700 border-blue-200" : "bg-white text-gray-600 border-gray-200 hover:bg-gray-50"}`,
3667
- children: O
3675
+ onClick: () => e.chain().focus().updateAttributes("image", { width: $ }).run(),
3676
+ className: `text-xs px-2 py-0.5 rounded border ${H === $ ? "bg-blue-50 text-blue-700 border-blue-200" : "bg-white text-gray-600 border-gray-200 hover:bg-gray-50"}`,
3677
+ children: $
3668
3678
  },
3669
- O
3679
+ $
3670
3680
  )),
3671
3681
  /* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" })
3672
3682
  ] });
3673
3683
  })(),
3674
- v ? /* @__PURE__ */ L(we, { children: [
3684
+ v ? /* @__PURE__ */ L(Se, { children: [
3675
3685
  /* @__PURE__ */ f("span", { className: "text-xs font-medium text-gray-700", children: c.currentClaim(g) }),
3676
3686
  w.length > 0 && /* @__PURE__ */ L("div", { className: "flex flex-wrap gap-1 items-center", children: [
3677
3687
  /* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.dependsOn }),
@@ -3697,21 +3707,21 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3697
3707
  },
3698
3708
  className: "p-2 hover:bg-red-50 text-red-600 rounded",
3699
3709
  title: c.deleteSelection,
3700
- children: /* @__PURE__ */ f(Wr, { size: 16 })
3710
+ children: /* @__PURE__ */ f(Qr, { size: 16 })
3701
3711
  }
3702
3712
  )
3703
3713
  ] }) });
3704
- }, ps = (e) => {
3714
+ }, Ss = (e) => {
3705
3715
  if (!Array.isArray(e))
3706
3716
  return [];
3707
3717
  const t = e.map((n) => Number(n)).filter((n) => Number.isFinite(n) && n > 0);
3708
3718
  return Array.from(new Set(t)).sort((n, r) => n - r);
3709
- }, hs = (e) => {
3719
+ }, Ts = (e) => {
3710
3720
  if (!Array.isArray(e))
3711
3721
  return [];
3712
3722
  const t = e.map((n) => typeof n == "string" ? n.trim() : "").filter(Boolean);
3713
3723
  return Array.from(new Set(t));
3714
- }, ys = (e) => {
3724
+ }, Is = (e) => {
3715
3725
  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() : "";
3716
3726
  if (r)
3717
3727
  return r;
@@ -3721,9 +3731,9 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3721
3731
  }
3722
3732
  const a = Number(e.attrs.resolvedNumber);
3723
3733
  return Number.isFinite(a) ? t === "en" ? `Claim ${a}` : `权利要求${a}` : t === "en" ? "Claim ?" : "权利要求?";
3724
- }, hn = (e) => {
3734
+ }, vn = (e) => {
3725
3735
  if (e.type.name === "reference")
3726
- return ys(e);
3736
+ return Is(e);
3727
3737
  if (e.type.name === "hardBreak")
3728
3738
  return `
3729
3739
  `;
@@ -3731,9 +3741,9 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3731
3741
  return e.text || "";
3732
3742
  let t = "";
3733
3743
  return e.forEach((n) => {
3734
- t += hn(n);
3744
+ t += vn(n);
3735
3745
  }), t;
3736
- }, bs = (e) => {
3746
+ }, Es = (e) => {
3737
3747
  const t = [];
3738
3748
  e.state.doc.descendants((r, a) => {
3739
3749
  if (r.type.name !== "claim")
@@ -3742,9 +3752,9 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3742
3752
  return !Number.isFinite(i) || i <= 0 || t.push({
3743
3753
  claimId: s,
3744
3754
  number: i,
3745
- dependsOn: ps(r.attrs.dependsOn),
3746
- dependsOnClaimIds: hs(r.attrs.dependsOnClaimIds),
3747
- body: hn(r).trim(),
3755
+ dependsOn: Ss(r.attrs.dependsOn),
3756
+ dependsOnClaimIds: Ts(r.attrs.dependsOnClaimIds),
3757
+ body: vn(r).trim(),
3748
3758
  pos: a
3749
3759
  }), !0;
3750
3760
  });
@@ -3756,7 +3766,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3756
3766
  dependsOnClaimIds: Array.from(new Set(s))
3757
3767
  };
3758
3768
  });
3759
- }, vs = (e, t = "zh") => {
3769
+ }, Ns = (e, t = "zh") => {
3760
3770
  const n = [], r = new Map(e.map((o) => [o.claimId, o.number]));
3761
3771
  e.forEach((o) => {
3762
3772
  o.dependsOnClaimIds.forEach((u) => {
@@ -3764,11 +3774,11 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3764
3774
  u === o.claimId && n.push({
3765
3775
  claimId: o.claimId,
3766
3776
  code: "self_reference",
3767
- message: he(t, "self_reference", o.number)
3777
+ message: ye(t, "self_reference", o.number)
3768
3778
  }), typeof m == "number" && m >= o.number && n.push({
3769
3779
  claimId: o.claimId,
3770
3780
  code: "forward_reference",
3771
- message: he(t, "forward_reference", o.number, m)
3781
+ message: ye(t, "forward_reference", o.number, m)
3772
3782
  });
3773
3783
  });
3774
3784
  });
@@ -3784,7 +3794,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3784
3794
  u && n.push({
3785
3795
  claimId: o,
3786
3796
  code: "cycle_dependency",
3787
- message: he(t, "cycle_dependency", u.number)
3797
+ message: ye(t, "cycle_dependency", u.number)
3788
3798
  });
3789
3799
  });
3790
3800
  const d = e.filter((o) => o.dependsOn.length === 0);
@@ -3808,7 +3818,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3808
3818
  });
3809
3819
  }
3810
3820
  }), n;
3811
- }, Cs = (e) => {
3821
+ }, _s = (e) => {
3812
3822
  const t = new Map(e.map((o) => [o.claimId, o.dependsOnClaimIds])), n = /* @__PURE__ */ new Map();
3813
3823
  e.forEach((o) => {
3814
3824
  o.dependsOnClaimIds.forEach((u) => {
@@ -3830,14 +3840,14 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3830
3840
  }), (n.get(o) || []).map((g) => i.get(g)).filter((g) => !!g).sort((g, y) => g.number - y.number).map((g) => g.claimId).forEach((g) => d(g, u + 1));
3831
3841
  };
3832
3842
  return s.forEach((o) => d(o, 0)), l;
3833
- }, ws = ({ editor: e }) => {
3834
- const [t, n] = z(!1), r = k((o) => o.editorLanguage), a = U(r), s = Ln({
3843
+ }, ks = ({ editor: e }) => {
3844
+ const [t, n] = z(!1), r = k((o) => o.editorLanguage), a = j(r), s = zn({
3835
3845
  editor: e,
3836
- selector: (o) => bs(o.editor)
3837
- }), i = Te(
3838
- () => vs(s, r),
3846
+ selector: (o) => Es(o.editor)
3847
+ }), i = Ee(
3848
+ () => Ns(s, r),
3839
3849
  [s, r]
3840
- ), l = Te(() => Cs(s), [s]), c = Te(
3850
+ ), l = Ee(() => _s(s), [s]), c = Ee(
3841
3851
  () => new Map(s.map((o) => [o.claimId, o.pos])),
3842
3852
  [s]
3843
3853
  ), d = (o) => {
@@ -3881,7 +3891,7 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3881
3891
  )) })
3882
3892
  ] })
3883
3893
  ] });
3884
- }, yn = {
3894
+ }, Cn = {
3885
3895
  // Invention & Utility Model
3886
3896
  technical_field: [],
3887
3897
  background_art: ["technical_field"],
@@ -3899,10 +3909,10 @@ const ms = ["history", "text", "structure", "format", "technical", "patent"], ot
3899
3909
  design_views: ["design_description"],
3900
3910
  design_brief: ["design_description", "design_views"]
3901
3911
  };
3902
- function ro(e, t) {
3903
- return (yn[e] || []).filter((r) => !t.has(r));
3912
+ function mo(e, t) {
3913
+ return (Cn[e] || []).filter((r) => !t.has(r));
3904
3914
  }
3905
- function xs(e) {
3915
+ function As(e) {
3906
3916
  const t = [];
3907
3917
  return e.state.doc.descendants((n, r) => n.type.name === "patent_title" ? (t.push({
3908
3918
  sectionType: "patent_title",
@@ -3914,7 +3924,7 @@ function xs(e) {
3914
3924
  content: n.textContent || ""
3915
3925
  }), !1) : !0), t;
3916
3926
  }
3917
- function bn(e) {
3927
+ function wn(e) {
3918
3928
  const { from: t } = e.state.selection, n = e.state.doc.resolve(t);
3919
3929
  for (let r = n.depth; r >= 0; r--) {
3920
3930
  const a = n.node(r);
@@ -3933,10 +3943,10 @@ function bn(e) {
3933
3943
  }
3934
3944
  return null;
3935
3945
  }
3936
- function Ss(e, t) {
3937
- const n = yn[t];
3946
+ function Ls(e, t) {
3947
+ const n = Cn[t];
3938
3948
  if (!n || n.length === 0) return [];
3939
- const r = xs(e), a = new Map(r.map((s) => [s.sectionType, s]));
3949
+ const r = As(e), a = new Map(r.map((s) => [s.sectionType, s]));
3940
3950
  return n.map((s) => {
3941
3951
  const i = a.get(s);
3942
3952
  return !i || i.content.trim().length === 0 ? null : {
@@ -3945,14 +3955,14 @@ function Ss(e, t) {
3945
3955
  };
3946
3956
  }).filter((s) => s !== null && s.content.length > 0);
3947
3957
  }
3948
- function ao(e, t = {}) {
3958
+ function fo(e, t = {}) {
3949
3959
  const n = k.getState().editorLanguage, { from: r, to: a } = e.state.selection, s = r !== a ? e.state.doc.textBetween(r, a, " ", "\0") : void 0;
3950
3960
  let i = t.sectionType, l = t.targetSectionPos;
3951
3961
  if (!i) {
3952
- const u = bn(e);
3962
+ const u = wn(e);
3953
3963
  u && (i = u.sectionType, l = u.pos);
3954
3964
  }
3955
- const c = t.scope || (i ? "section" : s ? "selection" : "document"), d = i ? Ss(e, i) : void 0;
3965
+ const c = t.scope || (i ? "section" : s ? "selection" : "document"), d = i ? Ls(e, i) : void 0;
3956
3966
  let o;
3957
3967
  if (c === "selection" && r !== a) {
3958
3968
  const m = Math.max(0, r - 200), p = Math.min(e.state.doc.content.size, a + 200), g = e.state.doc.textBetween(m, r, " ", "\0"), y = e.state.doc.textBetween(a, p, " ", "\0");
@@ -3969,14 +3979,14 @@ function ao(e, t = {}) {
3969
3979
  language: n
3970
3980
  };
3971
3981
  }
3972
- const Ts = ({ editor: e, onSelectionOptimize: t }) => {
3973
- const { addChatReference: n, openChatPanel: r, editorLanguage: a } = k(), s = a === "zh", i = (d) => re(
3982
+ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
3983
+ const { addChatReference: n, openChatPanel: r, editorLanguage: a } = k(), s = a === "zh", i = (d) => ae(
3974
3984
  "p-1.5 rounded transition-colors",
3975
3985
  d ? "bg-blue-100 text-blue-600" : "text-gray-600 hover:bg-gray-100"
3976
3986
  ), l = () => {
3977
3987
  const { from: d, to: o } = e.state.selection;
3978
3988
  if (d === o) return;
3979
- const u = e.state.doc.textBetween(d, o, " "), m = bn(e);
3989
+ const u = e.state.doc.textBetween(d, o, " "), m = wn(e);
3980
3990
  if (t) {
3981
3991
  t({ text: u, from: d, to: o, sectionType: m == null ? void 0 : m.sectionType });
3982
3992
  return;
@@ -3987,7 +3997,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
3987
3997
  o !== null && (o === "" ? e.chain().focus().extendMarkRange("link").unsetLink().run() : e.chain().focus().extendMarkRange("link").setLink({ href: o }).run());
3988
3998
  };
3989
3999
  return /* @__PURE__ */ f(
3990
- na,
4000
+ da,
3991
4001
  {
3992
4002
  editor: e,
3993
4003
  shouldShow: ({ editor: d, state: o }) => {
@@ -4001,7 +4011,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4001
4011
  onClick: () => e.chain().focus().toggleBold().run(),
4002
4012
  className: i(e.isActive("bold")),
4003
4013
  title: "Bold",
4004
- children: /* @__PURE__ */ f(Vt, { size: 15 })
4014
+ children: /* @__PURE__ */ f(Xt, { size: 15 })
4005
4015
  }
4006
4016
  ),
4007
4017
  /* @__PURE__ */ f(
@@ -4010,7 +4020,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4010
4020
  onClick: () => e.chain().focus().toggleItalic().run(),
4011
4021
  className: i(e.isActive("italic")),
4012
4022
  title: "Italic",
4013
- children: /* @__PURE__ */ f(Kt, { size: 15 })
4023
+ children: /* @__PURE__ */ f(Yt, { size: 15 })
4014
4024
  }
4015
4025
  ),
4016
4026
  /* @__PURE__ */ f(
@@ -4019,7 +4029,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4019
4029
  onClick: () => e.chain().focus().toggleUnderline().run(),
4020
4030
  className: i(e.isActive("underline")),
4021
4031
  title: "Underline",
4022
- children: /* @__PURE__ */ f(Jt, { size: 15 })
4032
+ children: /* @__PURE__ */ f(Qt, { size: 15 })
4023
4033
  }
4024
4034
  ),
4025
4035
  /* @__PURE__ */ f(
@@ -4028,7 +4038,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4028
4038
  onClick: () => e.chain().focus().toggleStrike().run(),
4029
4039
  className: i(e.isActive("strike")),
4030
4040
  title: "Strikethrough",
4031
- children: /* @__PURE__ */ f(Xt, { size: 15 })
4041
+ children: /* @__PURE__ */ f(Zt, { size: 15 })
4032
4042
  }
4033
4043
  ),
4034
4044
  /* @__PURE__ */ f(
@@ -4037,7 +4047,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4037
4047
  onClick: () => e.chain().focus().toggleCode().run(),
4038
4048
  className: i(e.isActive("code")),
4039
4049
  title: "Code",
4040
- children: /* @__PURE__ */ f(Qt, { size: 15 })
4050
+ children: /* @__PURE__ */ f(en, { size: 15 })
4041
4051
  }
4042
4052
  ),
4043
4053
  /* @__PURE__ */ f(
@@ -4046,7 +4056,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4046
4056
  onClick: () => e.chain().focus().toggleSuperscript().run(),
4047
4057
  className: i(e.isActive("superscript")),
4048
4058
  title: "Superscript",
4049
- children: /* @__PURE__ */ f(Yt, { size: 15 })
4059
+ children: /* @__PURE__ */ f(tn, { size: 15 })
4050
4060
  }
4051
4061
  ),
4052
4062
  /* @__PURE__ */ f(
@@ -4055,7 +4065,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4055
4065
  onClick: () => e.chain().focus().toggleSubscript().run(),
4056
4066
  className: i(e.isActive("subscript")),
4057
4067
  title: "Subscript",
4058
- children: /* @__PURE__ */ f(Zt, { size: 15 })
4068
+ children: /* @__PURE__ */ f(nn, { size: 15 })
4059
4069
  }
4060
4070
  ),
4061
4071
  /* @__PURE__ */ f("div", { className: "bubble-menu-divider" }),
@@ -4065,7 +4075,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4065
4075
  onClick: () => e.chain().focus().toggleHighlight().run(),
4066
4076
  className: i(e.isActive("highlight")),
4067
4077
  title: "Highlight",
4068
- children: /* @__PURE__ */ f(Gr, { size: 15 })
4078
+ children: /* @__PURE__ */ f(Zr, { size: 15 })
4069
4079
  }
4070
4080
  ),
4071
4081
  /* @__PURE__ */ f(
@@ -4074,7 +4084,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4074
4084
  onClick: c,
4075
4085
  className: i(e.isActive("link")),
4076
4086
  title: "Link",
4077
- children: /* @__PURE__ */ f(ht, { size: 15 })
4087
+ children: /* @__PURE__ */ f(vt, { size: 15 })
4078
4088
  }
4079
4089
  ),
4080
4090
  /* @__PURE__ */ f("div", { className: "bubble-menu-divider" }),
@@ -4084,13 +4094,13 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4084
4094
  onClick: l,
4085
4095
  className: "p-1.5 rounded transition-colors text-purple-500 hover:bg-purple-50",
4086
4096
  title: s ? "AI 优化" : "AI Optimize",
4087
- children: /* @__PURE__ */ f(qr, { size: 15 })
4097
+ children: /* @__PURE__ */ f(ea, { size: 15 })
4088
4098
  }
4089
4099
  )
4090
4100
  ] })
4091
4101
  }
4092
4102
  );
4093
- }, Is = ({ editor: e }) => {
4103
+ }, Ds = ({ editor: e }) => {
4094
4104
  var v;
4095
4105
  const [t, n] = z(!1), [r, a] = z(!1), [s, i] = z(""), [l, c] = z(""), [d, o] = z(!1), u = X(null), m = e.extensionStorage.searchReplace, p = ((v = m == null ? void 0 : m.results) == null ? void 0 : v.length) ?? 0, g = (m == null ? void 0 : m.currentIndex) ?? -1;
4096
4106
  B(() => {
@@ -4145,23 +4155,23 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4145
4155
  "button",
4146
4156
  {
4147
4157
  onClick: b,
4148
- className: re("find-replace-btn", d && "find-replace-btn--active"),
4158
+ className: ae("find-replace-btn", d && "find-replace-btn--active"),
4149
4159
  title: "Case Sensitive",
4150
- children: /* @__PURE__ */ f(Vr, { size: 15 })
4160
+ children: /* @__PURE__ */ f(ta, { size: 15 })
4151
4161
  }
4152
4162
  ),
4153
- /* @__PURE__ */ f("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ f(Kr, { size: 15 }) }),
4154
- /* @__PURE__ */ f("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ f(nn, { size: 15 }) }),
4163
+ /* @__PURE__ */ f("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ f(na, { size: 15 }) }),
4164
+ /* @__PURE__ */ f("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ f(sn, { size: 15 }) }),
4155
4165
  /* @__PURE__ */ f(
4156
4166
  "button",
4157
4167
  {
4158
4168
  onClick: () => a((C) => !C),
4159
- className: re("find-replace-btn", r && "find-replace-btn--active"),
4169
+ className: ae("find-replace-btn", r && "find-replace-btn--active"),
4160
4170
  title: "Toggle Replace",
4161
- children: /* @__PURE__ */ f(Et, { size: 15 })
4171
+ children: /* @__PURE__ */ f(kt, { size: 15 })
4162
4172
  }
4163
4173
  ),
4164
- /* @__PURE__ */ f("button", { onClick: w, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ f(Jr, { size: 15 }) })
4174
+ /* @__PURE__ */ f("button", { onClick: w, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ f(ra, { size: 15 }) })
4165
4175
  ] }),
4166
4176
  r && /* @__PURE__ */ L("div", { className: "find-replace-row", children: [
4167
4177
  /* @__PURE__ */ f(
@@ -4179,12 +4189,12 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4179
4189
  className: "find-replace-input"
4180
4190
  }
4181
4191
  ),
4182
- /* @__PURE__ */ f("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ f(Et, { size: 15 }) }),
4183
- /* @__PURE__ */ f("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ f(Xr, { size: 15 }) })
4192
+ /* @__PURE__ */ f("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ f(kt, { size: 15 }) }),
4193
+ /* @__PURE__ */ f("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ f(aa, { size: 15 }) })
4184
4194
  ] })
4185
4195
  ] }) : null;
4186
- }, Es = ({ editor: e }) => {
4187
- const { editorLanguage: t } = k(), n = t === "zh", r = Te(() => {
4196
+ }, Ms = ({ editor: e }) => {
4197
+ const { editorLanguage: t } = k(), n = t === "zh", r = Ee(() => {
4188
4198
  const a = e.state, i = a.doc.textBetween(0, a.doc.content.size, " ", "\0").replace(/\s/g, "").length, { from: l, to: c } = a.selection;
4189
4199
  let d = 0;
4190
4200
  return l !== c && (d = a.doc.textBetween(l, c, " ", "\0").replace(/\s/g, "").length), { charCount: i, selectionCount: d };
@@ -4201,27 +4211,27 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4201
4211
  r.selectionCount
4202
4212
  ] })
4203
4213
  ] });
4204
- }, Ns = {
4214
+ }, Rs = {
4205
4215
  empty: "○",
4206
4216
  filled: "●"
4207
- }, _s = {
4217
+ }, Os = {
4208
4218
  empty: "text-gray-400",
4209
4219
  filled: "text-green-500"
4210
- }, ks = /* @__PURE__ */ new Set([
4220
+ }, $s = /* @__PURE__ */ new Set([
4211
4221
  "technical_field",
4212
4222
  "background_art",
4213
4223
  "summary",
4214
4224
  "drawing_description",
4215
4225
  "detailed_description"
4216
- ]), As = ({ editor: e }) => {
4217
- const { editorLanguage: t } = k(), n = U(t), [r, a] = z(!1), [s, i] = z(0);
4226
+ ]), Fs = ({ editor: e }) => {
4227
+ const { editorLanguage: t } = k(), n = j(t), [r, a] = z(!1), [s, i] = z(0);
4218
4228
  B(() => {
4219
4229
  const c = () => i((d) => d + 1);
4220
4230
  return e.on("update", c), () => {
4221
4231
  e.off("update", c);
4222
4232
  };
4223
4233
  }, [e]);
4224
- const l = Te(() => {
4234
+ const l = Ee(() => {
4225
4235
  const c = [];
4226
4236
  let d = !1;
4227
4237
  return e.state.doc.descendants((o, u) => {
@@ -4246,7 +4256,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4246
4256
  }), !1;
4247
4257
  }
4248
4258
  if (o.type.name === "patent_section") {
4249
- const m = o.attrs.sectionType, p = ks.has(m), g = `sectionTitle_${m}`, y = typeof n[g] == "string" ? n[g] : m, w = o.textContent || "", b = w.trim().length > 0;
4259
+ const m = o.attrs.sectionType, p = $s.has(m), g = `sectionTitle_${m}`, y = typeof n[g] == "string" ? n[g] : m, w = o.textContent || "", b = w.trim().length > 0;
4250
4260
  return c.push({
4251
4261
  type: "section",
4252
4262
  pos: u,
@@ -4275,11 +4285,11 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4275
4285
  onClick: () => a(!1),
4276
4286
  className: "outline-panel-toggle",
4277
4287
  title: t === "zh" ? "展开大纲" : "Expand Outline",
4278
- children: /* @__PURE__ */ f(Qr, { size: 16 })
4288
+ children: /* @__PURE__ */ f(sa, { size: 16 })
4279
4289
  }
4280
4290
  ) }) : /* @__PURE__ */ L("div", { className: "outline-panel", children: [
4281
4291
  /* @__PURE__ */ L("div", { className: "outline-panel-header", children: [
4282
- /* @__PURE__ */ f(tn, { size: 14 }),
4292
+ /* @__PURE__ */ f(an, { size: 14 }),
4283
4293
  /* @__PURE__ */ f("span", { children: t === "zh" ? "文档大纲" : "Outline" }),
4284
4294
  /* @__PURE__ */ f(
4285
4295
  "button",
@@ -4287,7 +4297,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4287
4297
  onClick: () => a(!0),
4288
4298
  className: "outline-panel-toggle ml-auto",
4289
4299
  title: t === "zh" ? "收起大纲" : "Collapse Outline",
4290
- children: /* @__PURE__ */ f(Yr, { size: 14 })
4300
+ children: /* @__PURE__ */ f(ia, { size: 14 })
4291
4301
  }
4292
4302
  )
4293
4303
  ] }),
@@ -4296,7 +4306,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4296
4306
  l.map((c, d) => /* @__PURE__ */ L(
4297
4307
  "button",
4298
4308
  {
4299
- className: re(
4309
+ className: ae(
4300
4310
  "outline-panel-item",
4301
4311
  c.type === "heading" && `outline-panel-item--h${c.level}`,
4302
4312
  c.type === "book-group" && "outline-panel-item--book",
@@ -4309,7 +4319,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4309
4319
  }));
4310
4320
  },
4311
4321
  children: [
4312
- c.type === "section" && c.state && /* @__PURE__ */ f("span", { className: re("outline-item-state", _s[c.state]), children: Ns[c.state] || "○" }),
4322
+ c.type === "section" && c.state && /* @__PURE__ */ f("span", { className: ae("outline-item-state", Os[c.state]), children: Rs[c.state] || "○" }),
4313
4323
  /* @__PURE__ */ f("span", { className: "outline-item-title", children: c.title }),
4314
4324
  c.type !== "book-group" && /* @__PURE__ */ f("span", { className: "outline-item-count", children: c.charCount })
4315
4325
  ]
@@ -4318,7 +4328,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4318
4328
  ))
4319
4329
  ] })
4320
4330
  ] });
4321
- }, Ls = ({
4331
+ }, zs = ({
4322
4332
  editor: e,
4323
4333
  mode: t = "edit",
4324
4334
  className: n
@@ -4327,21 +4337,21 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4327
4337
  }, [e, t]), /* @__PURE__ */ f(
4328
4338
  "div",
4329
4339
  {
4330
- className: re(
4340
+ className: ae(
4331
4341
  "h-full",
4332
4342
  t === "readonly" ? "cursor-default" : "cursor-text",
4333
4343
  n
4334
4344
  ),
4335
- children: /* @__PURE__ */ f(Pn, { editor: e, className: "h-full" })
4345
+ children: /* @__PURE__ */ f(Bn, { editor: e, className: "h-full" })
4336
4346
  }
4337
- )), vn = "patent-editor-draft", Ps = 1500, Ds = () => {
4347
+ )), xn = "patent-editor-draft", Bs = 1500, Hs = () => {
4338
4348
  try {
4339
- const e = localStorage.getItem(vn);
4349
+ const e = localStorage.getItem(xn);
4340
4350
  return e ? JSON.parse(e) : null;
4341
4351
  } catch {
4342
4352
  return null;
4343
4353
  }
4344
- }, Ms = ({
4354
+ }, Us = ({
4345
4355
  initialContent: e,
4346
4356
  onChange: t,
4347
4357
  className: n,
@@ -4350,7 +4360,7 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4350
4360
  onEditorReady: s,
4351
4361
  onSelectionOptimize: i
4352
4362
  }) => {
4353
- const { setEditor: l, setDocument: c, editorLanguage: d, autoSaveStatus: o, ai: u } = k(), { setAutoSaveStatus: m, setLastSavedAt: p } = k(), g = X(null), y = e || (t ? null : Ds()) || {
4363
+ const { setEditor: l, setDocument: c, editorLanguage: d, autoSaveStatus: o, ai: u } = k(), { setAutoSaveStatus: m, setLastSavedAt: p } = k(), g = X(null), y = e || (t ? null : Hs()) || {
4354
4364
  type: "doc",
4355
4365
  content: [
4356
4366
  {
@@ -4360,24 +4370,24 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4360
4370
  ]
4361
4371
  }, w = de((I) => {
4362
4372
  try {
4363
- m("saving"), localStorage.setItem(vn, JSON.stringify(I)), m("saved"), p(/* @__PURE__ */ new Date());
4373
+ m("saving"), localStorage.setItem(xn, JSON.stringify(I)), m("saved"), p(/* @__PURE__ */ new Date());
4364
4374
  } catch {
4365
4375
  m("error");
4366
4376
  }
4367
- }, [m, p]), b = Dn(
4368
- ss({
4377
+ }, [m, p]), b = Hn(
4378
+ fs({
4369
4379
  content: y,
4370
4380
  onUpdate: ({ editor: I }) => {
4371
4381
  const A = I.getJSON();
4372
- c(A), W.notifyStateChange(I), t && t(A), t || (g.current && clearTimeout(g.current), g.current = setTimeout(() => {
4382
+ c(A), G.notifyStateChange(I), t && t(A), t || (g.current && clearTimeout(g.current), g.current = setTimeout(() => {
4373
4383
  w(A);
4374
- }, Ps));
4384
+ }, Bs));
4375
4385
  },
4376
4386
  onCreate: ({ editor: I }) => {
4377
- l(I), s == null || s(I), W.initializePlugins(I), Ae(I).execCommand("patent.normalizeClaims"), W.notifyStateChange(I);
4387
+ l(I), s == null || s(I), G.initializePlugins(I), Pe(I).execCommand("patent.normalizeClaims"), G.notifyStateChange(I);
4378
4388
  },
4379
4389
  onSelectionUpdate: ({ editor: I }) => {
4380
- W.notifySelectionChange(I);
4390
+ G.notifySelectionChange(I);
4381
4391
  },
4382
4392
  editorProps: {
4383
4393
  attributes: {
@@ -4395,35 +4405,35 @@ const Ts = ({ editor: e, onSelectionOptimize: t }) => {
4395
4405
  b.commands.setContent(e);
4396
4406
  }
4397
4407
  }, [b, e]), B(() => () => {
4398
- g.current && clearTimeout(g.current), b && (W.destroyPlugins(b), b.destroy());
4408
+ g.current && clearTimeout(g.current), b && (G.destroyPlugins(b), b.destroy());
4399
4409
  }, [b]), B(() => {
4400
- b && W.notifyStateChange(b);
4410
+ b && G.notifyStateChange(b);
4401
4411
  }, [b, d]), !b)
4402
4412
  return null;
4403
- const C = U(d), x = o === "saving" ? C.autoSaveSaving : o === "saved" ? C.autoSaveSaved : o === "error" ? C.autoSaveError : "";
4413
+ const C = j(d), x = o === "saving" ? C.autoSaveSaving : o === "saved" ? C.autoSaveSaved : o === "error" ? C.autoSaveError : "";
4404
4414
  return /* @__PURE__ */ L("div", { className: `editor-container flex flex-col h-full ${n}`, children: [
4405
4415
  !r && /* @__PURE__ */ L("div", { className: "flex items-center", children: [
4406
- /* @__PURE__ */ f(fs, { editor: b }),
4416
+ /* @__PURE__ */ f(ws, { editor: b }),
4407
4417
  x && /* @__PURE__ */ f("span", { className: `auto-save-indicator auto-save-indicator--${o} ml-2`, children: x })
4408
4418
  ] }),
4409
- !r && b && /* @__PURE__ */ f(gs, { editor: b }),
4410
- !r && b && /* @__PURE__ */ f(ws, { editor: b }),
4411
- !r && b && /* @__PURE__ */ f(Ts, { editor: b, onSelectionOptimize: i }),
4412
- !r && b && /* @__PURE__ */ f(Is, { editor: b }),
4419
+ !r && b && /* @__PURE__ */ f(xs, { editor: b }),
4420
+ !r && b && /* @__PURE__ */ f(ks, { editor: b }),
4421
+ !r && b && /* @__PURE__ */ f(Ps, { editor: b, onSelectionOptimize: i }),
4422
+ !r && b && /* @__PURE__ */ f(Ds, { editor: b }),
4413
4423
  /* @__PURE__ */ L("div", { className: "flex flex-1 overflow-hidden", children: [
4414
- !r && b && /* @__PURE__ */ f(As, { editor: b }),
4424
+ !r && b && /* @__PURE__ */ f(Fs, { editor: b }),
4415
4425
  /* @__PURE__ */ f("div", { className: "flex-1 overflow-y-auto bg-white p-4 relative", children: /* @__PURE__ */ f(
4416
- Ls,
4426
+ zs,
4417
4427
  {
4418
4428
  editor: b,
4419
4429
  mode: r || !a || u.status === "streaming" && u.activeSectionType === "claims" ? "readonly" : "edit"
4420
4430
  }
4421
4431
  ) })
4422
4432
  ] }),
4423
- !r && /* @__PURE__ */ f(Es, { editor: b })
4433
+ !r && /* @__PURE__ */ f(Ms, { editor: b })
4424
4434
  ] });
4425
4435
  };
4426
- function Cn(e) {
4436
+ function Sn(e) {
4427
4437
  const t = e.getReader(), n = new TextDecoder();
4428
4438
  let r = "";
4429
4439
  return new ReadableStream({
@@ -4475,7 +4485,7 @@ function Cn(e) {
4475
4485
  }
4476
4486
  });
4477
4487
  }
4478
- function Rs(e, t) {
4488
+ function js(e, t) {
4479
4489
  let n = null;
4480
4490
  return {
4481
4491
  async request(r) {
@@ -4490,14 +4500,14 @@ function Rs(e, t) {
4490
4500
  throw new Error(`AI service error: ${s.status} ${s.statusText}`);
4491
4501
  if (!s.body)
4492
4502
  throw new Error("AI service returned no body");
4493
- return Cn(s.body);
4503
+ return Sn(s.body);
4494
4504
  },
4495
4505
  abort() {
4496
4506
  n == null || n.abort(), n = null;
4497
4507
  }
4498
4508
  };
4499
4509
  }
4500
- function $s(e, t) {
4510
+ function Ws(e, t) {
4501
4511
  let n = null;
4502
4512
  const r = e.replace(/\/+$/, "");
4503
4513
  async function a(s, i) {
@@ -4544,28 +4554,28 @@ function $s(e, t) {
4544
4554
  });
4545
4555
  if (!c.ok) throw new Error(`Chat stream error: ${c.status} ${c.statusText}`);
4546
4556
  if (!c.body) throw new Error("Chat stream returned no body");
4547
- return Cn(c.body);
4557
+ return Sn(c.body);
4548
4558
  },
4549
4559
  abort() {
4550
4560
  n == null || n.abort(), n = null;
4551
4561
  }
4552
4562
  };
4553
4563
  }
4554
- const Os = jt(
4564
+ const Gs = qt(
4555
4565
  ({ initialContent: e, patentType: t, onChange: n, className: r, readOnly: a = !1, editable: s = !0, language: i, aiService: l, chatSessionAPI: c, aiBaseUrl: d, aiHeaders: o, onSelectionOptimize: u }, m) => {
4556
4566
  const { setEditorLanguage: p, setAIService: g, setChatSessionAPI: y } = k(), w = X(null), b = de((C) => {
4557
4567
  w.current = C;
4558
- }, []), v = Me.useMemo(() => {
4568
+ }, []), v = Fe.useMemo(() => {
4559
4569
  if (e) return e;
4560
- if (t) return mn(t);
4570
+ if (t) return pn(t);
4561
4571
  }, [e, t]);
4562
- return Me.useEffect(() => {
4572
+ return Fe.useEffect(() => {
4563
4573
  i && p(i);
4564
- }, [i, p]), Me.useEffect(() => {
4565
- l ? g(l) : d && g(Rs(d, o));
4566
- }, [l, d, o, g]), Me.useEffect(() => {
4567
- c ? y(c) : d && y($s(d, o));
4568
- }, [c, d, o, y]), Wt(m, () => ({
4574
+ }, [i, p]), Fe.useEffect(() => {
4575
+ l ? g(l) : d && g(js(d, o));
4576
+ }, [l, d, o, g]), Fe.useEffect(() => {
4577
+ c ? y(c) : d && y(Ws(d, o));
4578
+ }, [c, d, o, y]), Vt(m, () => ({
4569
4579
  getContent: () => {
4570
4580
  var C;
4571
4581
  return ((C = w.current) == null ? void 0 : C.getJSON()) ?? null;
@@ -4575,13 +4585,13 @@ const Os = jt(
4575
4585
  (x = w.current) == null || x.commands.setContent(C);
4576
4586
  },
4577
4587
  getEditor: () => w.current,
4578
- execCommand: async (C, x) => w.current ? Ae(w.current).execCommand(C, x) : null,
4588
+ execCommand: async (C, x) => w.current ? Pe(w.current).execCommand(C, x) : null,
4579
4589
  focus: () => {
4580
4590
  var C;
4581
4591
  (C = w.current) == null || C.commands.focus();
4582
4592
  }
4583
4593
  })), /* @__PURE__ */ f(
4584
- Ms,
4594
+ Us,
4585
4595
  {
4586
4596
  initialContent: v,
4587
4597
  onChange: n,
@@ -4594,13 +4604,13 @@ const Os = jt(
4594
4604
  );
4595
4605
  }
4596
4606
  );
4597
- Os.displayName = "PatentEditor";
4598
- async function so(e, t, n) {
4607
+ Gs.displayName = "PatentEditor";
4608
+ async function go(e, t, n) {
4599
4609
  var a, s, i, l;
4600
4610
  let r = !1;
4601
- (a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" && xn(e, n.targetSectionPos);
4611
+ (a = n.onStart) == null || a.call(n), n.mode === "section" && typeof n.targetSectionPos == "number" && In(e, n.targetSectionPos);
4602
4612
  try {
4603
- let c = wn(e, n);
4613
+ let c = Tn(e, n);
4604
4614
  for (; ; ) {
4605
4615
  const { done: d, value: o } = await t.read();
4606
4616
  if (d) break;
@@ -4609,15 +4619,15 @@ async function so(e, t, n) {
4609
4619
  const u = e.state.tr.insertText(o, c);
4610
4620
  e.view.dispatch(u), c = u.mapping.map(c, 1);
4611
4621
  }
4612
- n.mode === "section" && typeof n.targetSectionPos == "number" && gt(e, n.targetSectionPos), (i = n.onComplete) == null || i.call(n);
4622
+ n.mode === "section" && typeof n.targetSectionPos == "number" && yt(e, n.targetSectionPos), (i = n.onComplete) == null || i.call(n);
4613
4623
  } catch (c) {
4614
4624
  (l = n.onError) == null || l.call(n, c instanceof Error ? c : new Error(String(c)));
4615
4625
  }
4616
4626
  }
4617
- async function io(e, t, n, r) {
4627
+ async function po(e, t, n, r) {
4618
4628
  var s, i, l, c, d, o, u, m;
4619
4629
  const a = new AbortController();
4620
- (s = r.onStart) == null || s.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" && xn(e, r.targetSectionPos);
4630
+ (s = r.onStart) == null || s.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" && In(e, r.targetSectionPos);
4621
4631
  try {
4622
4632
  const p = await fetch(t, {
4623
4633
  method: "POST",
@@ -4630,7 +4640,7 @@ async function io(e, t, n, r) {
4630
4640
  const g = (i = p.body) == null ? void 0 : i.getReader();
4631
4641
  if (!g) throw new Error("No response body");
4632
4642
  const y = new TextDecoder();
4633
- let w = wn(e, r), b = "";
4643
+ let w = Tn(e, r), b = "";
4634
4644
  for (; ; ) {
4635
4645
  const { done: v, value: C } = await g.read();
4636
4646
  if (v) break;
@@ -4642,7 +4652,7 @@ async function io(e, t, n, r) {
4642
4652
  if (!I.startsWith("data: ")) continue;
4643
4653
  const A = I.slice(6).trim();
4644
4654
  if (A === "[DONE]")
4645
- return r.mode === "section" && typeof r.targetSectionPos == "number" && gt(e, r.targetSectionPos), (l = r.onComplete) == null || l.call(r), { abort: () => a.abort() };
4655
+ return r.mode === "section" && typeof r.targetSectionPos == "number" && yt(e, r.targetSectionPos), (l = r.onComplete) == null || l.call(r), { abort: () => a.abort() };
4646
4656
  try {
4647
4657
  const P = JSON.parse(A), h = P.content || P.text || ((c = P.delta) == null ? void 0 : c.content) || "";
4648
4658
  if (!h) continue;
@@ -4653,13 +4663,13 @@ async function io(e, t, n, r) {
4653
4663
  }
4654
4664
  }
4655
4665
  }
4656
- r.mode === "section" && typeof r.targetSectionPos == "number" && gt(e, r.targetSectionPos), (o = r.onComplete) == null || o.call(r);
4666
+ r.mode === "section" && typeof r.targetSectionPos == "number" && yt(e, r.targetSectionPos), (o = r.onComplete) == null || o.call(r);
4657
4667
  } catch (p) {
4658
4668
  p.name === "AbortError" ? (u = r.onAbort) == null || u.call(r) : (m = r.onError) == null || m.call(r, p instanceof Error ? p : new Error(String(p)));
4659
4669
  }
4660
4670
  return { abort: () => a.abort() };
4661
4671
  }
4662
- function wn(e, t) {
4672
+ function Tn(e, t) {
4663
4673
  if (t.mode === "section" && typeof t.targetSectionPos == "number") {
4664
4674
  const n = e.state.doc.nodeAt(t.targetSectionPos);
4665
4675
  if (n && n.type.name === "patent_section")
@@ -4667,7 +4677,7 @@ function wn(e, t) {
4667
4677
  }
4668
4678
  return e.state.selection.from;
4669
4679
  }
4670
- function xn(e, t) {
4680
+ function In(e, t) {
4671
4681
  const n = e.state.doc.nodeAt(t);
4672
4682
  if (!n || n.type.name !== "patent_section") return;
4673
4683
  const r = t + 1, a = t + n.nodeSize - 1;
@@ -4676,7 +4686,7 @@ function xn(e, t) {
4676
4686
  s.replaceWith(r, a, i), s.setMeta("addToHistory", !1), e.view.dispatch(s);
4677
4687
  }
4678
4688
  }
4679
- function gt(e, t) {
4689
+ function yt(e, t) {
4680
4690
  const n = e.state.doc.nodeAt(t);
4681
4691
  if (!n || n.type.name !== "patent_section") return;
4682
4692
  const r = e.state.tr, a = [];
@@ -4696,7 +4706,7 @@ function gt(e, t) {
4696
4706
  r.setMeta("addToHistory", !1), e.view.dispatch(r);
4697
4707
  }
4698
4708
  }
4699
- const Ut = {
4709
+ const Gt = {
4700
4710
  technical_field: {
4701
4711
  zh: "本发明涉及航天器自主导航与控制技术领域,具体涉及一种基于多传感器融合的航天器自主避障控制方法、系统、电子设备及计算机可读存储介质。该方法综合利用激光雷达、红外传感器和星敏感器的探测数据,通过实时环境感知与路径规划算法,实现航天器在复杂空间环境中的自主安全避障机动。",
4702
4712
  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."
@@ -4766,7 +4776,7 @@ S103:局部实时避障控制。采用模型预测控制(MPC)策略,以
4766
4776
  S104:安全验证。对计算得到的控制指令进行轨迹传播仿真,验证机动后轨迹在未来72小时内不会与TLE目录中的已知空间目标产生碰撞风险(miss distance > 1km)。`,
4767
4777
  en: "The technical solution of the embodiments of the present invention will be described clearly and completely below with reference to the drawings."
4768
4778
  }
4769
- }, He = {
4779
+ }, Ge = {
4770
4780
  "help-draft": {
4771
4781
  zh: `当然可以帮你撰写技术方案!请先描述以下信息:
4772
4782
 
@@ -4826,7 +4836,7 @@ S104:安全验证。对计算得到的控制指令进行轨迹传播仿真,
4826
4836
  en: "That is a great question. As an AI patent writing assistant, I can help you with..."
4827
4837
  }
4828
4838
  }, oe = (e) => new Promise((t) => setTimeout(t, e));
4829
- function pt(e, t = 30) {
4839
+ function bt(e, t = 30) {
4830
4840
  let n = !1;
4831
4841
  return new ReadableStream({
4832
4842
  async pull(r) {
@@ -4844,30 +4854,30 @@ function pt(e, t = 30) {
4844
4854
  }
4845
4855
  });
4846
4856
  }
4847
- function Fs(e) {
4848
- const t = [], n = qe(e, 3);
4857
+ function qs(e) {
4858
+ const t = [], n = Xe(e, 3);
4849
4859
  for (const r of n)
4850
4860
  t.push({ type: "delta", content: r });
4851
4861
  return t.push({ type: "done", usage: { tokens: e.length * 2 } }), t;
4852
4862
  }
4853
- function qe(e, t) {
4863
+ function Xe(e, t) {
4854
4864
  const n = [];
4855
4865
  for (let r = 0; r < e.length; r += t)
4856
4866
  n.push(e.slice(r, r + t));
4857
4867
  return n;
4858
4868
  }
4859
- function zs(e, t, n) {
4869
+ function Vs(e, t, n) {
4860
4870
  const r = n === "zh", a = [];
4861
4871
  let s;
4862
- if (e.includes("技术方案") || e.includes("draft") ? s = He["help-draft"][r ? "zh" : "en"] : e.includes("审查") || e.includes("review") || e.includes("Review") ? s = He.review[r ? "zh" : "en"] : e.includes("权利要求") || e.includes("claims") || e.includes("Optimize") ? s = He.claims[r ? "zh" : "en"] : s = He.default[r ? "zh" : "en"], t.length > 0) {
4872
+ if (e.includes("技术方案") || e.includes("draft") ? s = Ge["help-draft"][r ? "zh" : "en"] : e.includes("审查") || e.includes("review") || e.includes("Review") ? s = Ge.review[r ? "zh" : "en"] : e.includes("权利要求") || e.includes("claims") || e.includes("Optimize") ? s = Ge.claims[r ? "zh" : "en"] : s = Ge.default[r ? "zh" : "en"], t.length > 0) {
4863
4873
  const i = r ? `正在分析引用的 ${t.length} 段文本并生成优化建议...
4864
4874
 
4865
4875
  ` : `Analyzing ${t.length} referenced text(s) and generating suggestions...
4866
4876
 
4867
4877
  `;
4868
- for (const l of qe(i, 4))
4878
+ for (const l of Xe(i, 4))
4869
4879
  a.push({ type: "delta", content: l });
4870
- for (const l of qe(s, 4))
4880
+ for (const l of Xe(s, 4))
4871
4881
  a.push({ type: "delta", content: l });
4872
4882
  for (let l = 0; l < t.length; l++) {
4873
4883
  const c = t[l], d = c.text;
@@ -4900,33 +4910,33 @@ function zs(e, t, n) {
4900
4910
  });
4901
4911
  }
4902
4912
  } else
4903
- for (const i of qe(s, 4))
4913
+ for (const i of Xe(s, 4))
4904
4914
  a.push({ type: "delta", content: i });
4905
4915
  return a.push({ type: "done", usage: { tokens: s.length * 2 } }), a;
4906
4916
  }
4907
- function oo() {
4917
+ function ho() {
4908
4918
  let e = null;
4909
4919
  return {
4910
4920
  async request(t) {
4911
4921
  var l;
4912
4922
  if (e = new AbortController(), await oe(300), e.signal.aborted)
4913
4923
  throw new DOMException("Aborted", "AbortError");
4914
- const n = t.language === "zh" ? "zh" : "en", r = t.sectionType || "technical_field", a = ((l = Ut[r]) == null ? void 0 : l[n]) || Ut.technical_field[n];
4924
+ const n = t.language === "zh" ? "zh" : "en", r = t.sectionType || "technical_field", a = ((l = Gt[r]) == null ? void 0 : l[n]) || Gt.technical_field[n];
4915
4925
  let s = a;
4916
4926
  t.instruction && (s = (n === "zh" ? `[基于指令"${t.instruction}"生成]
4917
4927
 
4918
4928
  ` : `[Generated based on instruction "${t.instruction}"]
4919
4929
 
4920
4930
  `) + a);
4921
- const i = Fs(s);
4922
- return pt(i, 25);
4931
+ const i = qs(s);
4932
+ return bt(i, 25);
4923
4933
  },
4924
4934
  abort() {
4925
4935
  e == null || e.abort(), e = null;
4926
4936
  }
4927
4937
  };
4928
4938
  }
4929
- function co() {
4939
+ function yo() {
4930
4940
  const e = /* @__PURE__ */ new Map();
4931
4941
  let t = null, n = null;
4932
4942
  return {
@@ -4969,7 +4979,7 @@ function co() {
4969
4979
  status: "done",
4970
4980
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4971
4981
  }), s.session.messageCount = s.messages.length, s.session.lastMessage = a.content, s.session.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
4972
- const l = zs(
4982
+ const l = Vs(
4973
4983
  a.content,
4974
4984
  a.references || [],
4975
4985
  a.language
@@ -4981,10 +4991,10 @@ function co() {
4981
4991
  const s = e.get(r);
4982
4992
  if (!s) throw new Error("Session not found");
4983
4993
  if (!n || n.messageId !== a)
4984
- return pt([{ type: "done" }]);
4994
+ return bt([{ type: "done" }]);
4985
4995
  const i = n.events;
4986
4996
  n = null;
4987
- const l = pt(i, 18), c = `${a}_a`;
4997
+ const l = bt(i, 18), c = `${a}_a`;
4988
4998
  let d = "";
4989
4999
  for (const o of i)
4990
5000
  o.type === "delta" && (d += o.content);
@@ -5001,7 +5011,7 @@ function co() {
5001
5011
  }
5002
5012
  };
5003
5013
  }
5004
- function Bs(e) {
5014
+ function Ks(e) {
5005
5015
  const t = [], n = e.replace(/\r\n/g, `
5006
5016
  `).trim();
5007
5017
  if (!n) return t;
@@ -5016,12 +5026,12 @@ function Bs(e) {
5016
5026
  if (a.length === 0)
5017
5027
  return t.push({ number: 1, text: n, dependsOn: [] }), t;
5018
5028
  for (let i = 0; i < a.length; i++) {
5019
- const l = a[i].index + a[i].matchLength, c = i + 1 < a.length ? a[i + 1].index : n.length, d = n.slice(l, c).trim(), o = a[i].number, u = Hs(d, o);
5029
+ const l = a[i].index + a[i].matchLength, c = i + 1 < a.length ? a[i + 1].index : n.length, d = n.slice(l, c).trim(), o = a[i].number, u = Js(d, o);
5020
5030
  t.push({ number: o, text: d, dependsOn: u });
5021
5031
  }
5022
5032
  return t;
5023
5033
  }
5024
- function Hs(e, t) {
5034
+ function Js(e, t) {
5025
5035
  const n = [], r = /根据权利要求(\d+)(?:\s*[-~至到]\s*(\d+))?/g;
5026
5036
  let a;
5027
5037
  for (; (a = r.exec(e)) !== null; ) {
@@ -5037,27 +5047,27 @@ function Hs(e, t) {
5037
5047
  }
5038
5048
  return [...new Set(n)].sort((i, l) => i - l);
5039
5049
  }
5040
- function Us() {
5050
+ function Xs() {
5041
5051
  return `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
5042
5052
  }
5043
- function lo(e) {
5044
- return Bs(e).map((n) => ({
5053
+ function bo(e) {
5054
+ return Ks(e).map((n) => ({
5045
5055
  type: "claim",
5046
5056
  attrs: {
5047
5057
  number: n.number,
5048
- claimId: Us(),
5058
+ claimId: Xs(),
5049
5059
  dependsOn: n.dependsOn,
5050
5060
  dependsOnClaimIds: []
5051
5061
  },
5052
5062
  content: n.text ? [{ type: "text", text: n.text }] : void 0
5053
5063
  }));
5054
5064
  }
5055
- const js = -1, Ws = 1, Gs = 0, Sn = new ke("docDiff");
5056
- let lt = null;
5057
- function qs() {
5058
- return lt || (lt = new qt()), lt;
5065
+ const Ys = -1, Qs = 1, Zs = 0, En = new Le("docDiff");
5066
+ let mt = null;
5067
+ function ei() {
5068
+ return mt || (mt = new Jt()), mt;
5059
5069
  }
5060
- function Vs(e, t, n) {
5070
+ function ti(e, t, n) {
5061
5071
  const r = [];
5062
5072
  return e.nodesBetween(t, n, (a, s) => {
5063
5073
  if (a.isTextblock) {
@@ -5067,31 +5077,31 @@ function Vs(e, t, n) {
5067
5077
  return !0;
5068
5078
  }), r;
5069
5079
  }
5070
- function uo(e, t) {
5071
- const n = e.state.doc, r = n.content.size, { text: a, segments: s } = sn(e, 0, r), i = qs(), l = i.diff_main(t, a);
5080
+ function vo(e, t) {
5081
+ const n = e.state.doc, r = n.content.size, { text: a, segments: s } = ln(e, 0, r), i = ei(), l = i.diff_main(t, a);
5072
5082
  i.diff_cleanupSemantic(l);
5073
5083
  const c = [];
5074
5084
  let d = 0;
5075
5085
  for (const [m, p] of l)
5076
- if (m === Gs)
5086
+ if (m === Zs)
5077
5087
  d += p.length;
5078
- else if (m === Ws) {
5088
+ else if (m === Qs) {
5079
5089
  let g = 0;
5080
5090
  for (; g < p.length; ) {
5081
5091
  for (; g < p.length && p[g] === "\0"; ) g++;
5082
5092
  if (g >= p.length) break;
5083
5093
  const y = g;
5084
5094
  for (; g < p.length && p[g] !== "\0"; ) g++;
5085
- const w = Ee(s, d + y), b = Ee(s, d + g);
5095
+ const w = _e(s, d + y), b = _e(s, d + g);
5086
5096
  if (w >= 0 && b >= 0 && b > w)
5087
- for (const v of Vs(n, w, b))
5097
+ for (const v of ti(n, w, b))
5088
5098
  c.push(
5089
5099
  le.inline(v.from, v.to, { class: "patch-diff-insert-inline" })
5090
5100
  );
5091
5101
  }
5092
5102
  d += p.length;
5093
- } else if (m === js) {
5094
- const g = Ee(s, d);
5103
+ } else if (m === Ys) {
5104
+ const g = _e(s, d);
5095
5105
  if (g >= 0) {
5096
5106
  const y = p.replace(/\0/g, " ");
5097
5107
  c.push(
@@ -5106,8 +5116,8 @@ function uo(e, t) {
5106
5116
  );
5107
5117
  }
5108
5118
  }
5109
- const o = Ne.create(n, c), u = new Xe({
5110
- key: Sn,
5119
+ const o = ke.create(n, c), u = new et({
5120
+ key: En,
5111
5121
  props: {
5112
5122
  decorations() {
5113
5123
  return o;
@@ -5116,10 +5126,10 @@ function uo(e, t) {
5116
5126
  });
5117
5127
  e.registerPlugin(u);
5118
5128
  }
5119
- function mo(e) {
5120
- e.unregisterPlugin(Sn);
5129
+ function Co(e) {
5130
+ e.unregisterPlugin(En);
5121
5131
  }
5122
- function fo(e, t) {
5132
+ function wo(e, t) {
5123
5133
  const n = [], r = t === "zh";
5124
5134
  let a = 0;
5125
5135
  const s = () => `v_${++a}`;
@@ -5185,40 +5195,40 @@ function fo(e, t) {
5185
5195
  }), n;
5186
5196
  }
5187
5197
  export {
5188
- Ms as EditorView,
5189
- an as PatchDiffPluginKey,
5190
- Os as PatentEditor,
5191
- to as acceptAllPatches,
5192
- Zi as acceptPatch,
5193
- uo as applyDocDiffDecorations,
5194
- ao as buildAIContext,
5195
- lo as buildClaimsJSONContent,
5196
- mn as buildPatentDocument,
5197
- Yi as clearPatches,
5198
- $s as createChatSessionAPI,
5199
- Ae as createCommandExecutor,
5200
- ss as createEditorConfig,
5201
- oo as createMockAIService,
5202
- co as createMockChatSessionAPI,
5203
- Rs as createSSEAdapter,
5204
- us as exportToPdf,
5205
- Ht as exportToWord,
5206
- bs as extractClaimsFromEditor,
5207
- bn as findSectionAtCursor,
5208
- xs as getAllSections,
5209
- ro as getMissingSectionDeps,
5210
- Xi as getPatches,
5211
- Ji as onPatchChange,
5212
- W as pluginManager,
5213
- no as rejectAllPatches,
5214
- eo as rejectPatch,
5215
- mo as removeDocDiffDecorations,
5216
- Ki as resolvePatchTarget,
5217
- yn as sectionContextDeps,
5218
- Qi as setPatches,
5198
+ Us as EditorView,
5199
+ cn as PatchDiffPluginKey,
5200
+ Gs as PatentEditor,
5201
+ lo as acceptAllPatches,
5202
+ oo as acceptPatch,
5203
+ vo as applyDocDiffDecorations,
5204
+ fo as buildAIContext,
5205
+ bo as buildClaimsJSONContent,
5206
+ pn as buildPatentDocument,
5207
+ io as clearPatches,
5208
+ Ws as createChatSessionAPI,
5209
+ Pe as createCommandExecutor,
5210
+ fs as createEditorConfig,
5211
+ ho as createMockAIService,
5212
+ yo as createMockChatSessionAPI,
5213
+ js as createSSEAdapter,
5214
+ vs as exportToPdf,
5215
+ Wt as exportToWord,
5216
+ Es as extractClaimsFromEditor,
5217
+ wn as findSectionAtCursor,
5218
+ As as getAllSections,
5219
+ mo as getMissingSectionDeps,
5220
+ ao as getPatches,
5221
+ ro as onPatchChange,
5222
+ G as pluginManager,
5223
+ uo as rejectAllPatches,
5224
+ co as rejectPatch,
5225
+ Co as removeDocDiffDecorations,
5226
+ no as resolvePatchTarget,
5227
+ Cn as sectionContextDeps,
5228
+ so as setPatches,
5219
5229
  k as useEditorStore,
5220
- fo as validatePatentDocument,
5221
- so as writeStream,
5222
- io as writeStreamFromSSE
5230
+ wo as validatePatentDocument,
5231
+ go as writeStream,
5232
+ po as writeStreamFromSSE
5223
5233
  };
5224
5234
  //# sourceMappingURL=lib.js.map