@freecallai/pro 0.0.10 → 0.0.12

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.
Files changed (53) hide show
  1. package/README.md +1 -1
  2. package/dist/{FkpRichText.vue_vue_type_script_setup_true_lang-D2sgT7XP.js → FkpRichText.vue_vue_type_script_setup_true_lang-DiS7CZdc.js} +1470 -1455
  3. package/dist/{KnowledgeArea-Sbfs_E0C.js → KnowledgeArea-FGgCcubh.js} +1 -1
  4. package/dist/{KnowledgeArea.vue_vue_type_script_setup_true_lang-BNDRTWXW.js → KnowledgeArea.vue_vue_type_script_setup_true_lang-JH_F4CFe.js} +523 -519
  5. package/dist/{ToolForm-_ZTW7lwU.js → ToolForm-CHmdyhjh.js} +1 -1
  6. package/dist/agent-prompt-editor/index.js +304 -293
  7. package/dist/agent-prompt-editor/legacy-converter/index.js +98 -94
  8. package/dist/{choice-BqjECVyx.js → choice-CUCsR2dN.js} +1 -1
  9. package/dist/edition-info/index.js +1 -1
  10. package/dist/{guard-BmLOamCj.js → guard-DgExtfXo.js} +199 -185
  11. package/dist/{index-7x1OTv0m.js → index-B2CCZeff.js} +4 -4
  12. package/dist/{index-BDinNJn_.js → index-BwZXmefJ.js} +1 -1
  13. package/dist/{index-6VSUucFX.js → index-C54ce9Tn.js} +1 -1
  14. package/dist/index-CMl5mgFR.js +5 -0
  15. package/dist/index-CbmRr3rH.js +949 -0
  16. package/dist/index-Cs38tTe4.js +5 -0
  17. package/dist/{index-CCwmXuSJ.js → index-DIMONp3g.js} +1 -1
  18. package/dist/{index-CN2knQcE.js → index-DaGfiqBX.js} +1 -1
  19. package/dist/{index-gS1h8iW8.js → index-DqJvaPTD.js} +1 -1
  20. package/dist/{index-0BXLYaKG.js → index-dnsGFj0F.js} +2 -2
  21. package/dist/{index-B1rTu0jX.js → index-pdr6mUf0.js} +1 -1
  22. package/dist/index.js +7 -7
  23. package/dist/{inline-CRGzAti7.js → inline-BpwAryXp.js} +1 -1
  24. package/dist/{knowledge-DNDouB-s.js → knowledge-DIzYk2iM.js} +1 -1
  25. package/dist/media-extensions-YYbGuUQa.js +341 -0
  26. package/dist/{media-migration-D1KoHKoP.js → media-migration-Bnfn27i9.js} +1 -1
  27. package/dist/media-policy-tG5OHWSj.js +215 -0
  28. package/dist/{media-upload-C5N6YWHu.js → media-upload-_xeZtn3i.js} +1 -1
  29. package/dist/{model-BVh9EZ9G.js → model-DlAjlPai.js} +1 -1
  30. package/dist/navigation/index.js +1 -1
  31. package/dist/rich-text/index.js +6 -6
  32. package/dist/rich-text/legacy-converter/index.js +357 -355
  33. package/dist/style.css +1 -1
  34. package/dist/types/agent-prompt-editor/FkpAgentPromptEditor.vue.d.ts +4 -0
  35. package/dist/types/navigation/FkpNavigation.vue.d.ts +12 -3
  36. package/dist/types/navigation/NavigationGroup.vue.d.ts +1 -0
  37. package/dist/types/navigation/NavigationNodes.vue.d.ts +9 -2
  38. package/dist/types/navigation/{use-navigation-tree.d.ts → hooks/use-navigation-tree.d.ts} +1 -1
  39. package/dist/types/navigation/hooks/use-submenu-indicator.d.ts +10 -0
  40. package/dist/types/navigation/index.d.ts +1 -1
  41. package/dist/types/navigation/types.d.ts +11 -0
  42. package/dist/types/rich-text/FkpRichText.vue.d.ts +2 -0
  43. package/dist/types/rich-text/model/qianniu-video.d.ts +2 -0
  44. package/dist/types/rich-text/public/types.d.ts +2 -2
  45. package/dist/types/rich-text/runtime/media-sources.d.ts +1 -1
  46. package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +1 -0
  47. package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +11 -2
  48. package/package.json +4 -4
  49. package/dist/index-CAczgwau.js +0 -5
  50. package/dist/index-Ck8RYpuE.js +0 -816
  51. package/dist/index-faGbB8v6.js +0 -5
  52. package/dist/media-extensions-wlcCEdtg.js +0 -324
  53. package/dist/media-policy-D3-Qglzz.js +0 -158
@@ -1,22 +1,22 @@
1
- import { defineComponent as Dt, shallowRef as Rt, ref as Y, onBeforeUnmount as Le, watch as ne, nextTick as $e, onMounted as Bt, openBlock as L, createElementBlock as U, createVNode as Fe, unref as W, createBlock as Ot, withCtx as pe, createElementVNode as D, normalizeStyle as me, createCommentVNode as re, toDisplayString as He, createTextVNode as Pt } from "vue";
1
+ import { defineComponent as Dt, shallowRef as Rt, ref as Y, onBeforeUnmount as Le, watch as ne, nextTick as $e, onMounted as Bt, openBlock as L, createElementBlock as q, createVNode as Fe, unref as W, createBlock as Ot, withCtx as pe, createElementVNode as D, normalizeStyle as me, createCommentVNode as re, toDisplayString as He, createTextVNode as Pt } from "vue";
2
2
  import { EditorContent as zt, Editor as Vt } from "@tiptap/vue-3";
3
3
  import { Popover as Lt, Tag as $t } from "@freecallai/ui";
4
- import { Plugin as Ge, PluginKey as Ft, TextSelection as $, NodeSelection as Ht, Selection as Ut } from "@tiptap/pm/state";
5
- import _t from "@tiptap/starter-kit";
6
- import qt from "@tiptap/extension-placeholder";
4
+ import { Plugin as Ge, PluginKey as Ft, TextSelection as $, NodeSelection as Ht, Selection as qt } from "@tiptap/pm/state";
5
+ import Ut from "@tiptap/starter-kit";
6
+ import _t from "@tiptap/extension-placeholder";
7
7
  import { Extension as Kt, Node as he } from "@tiptap/core";
8
8
  import { DOMSerializer as je, DOMParser as Jt } from "@tiptap/pm/model";
9
9
  import { DecorationSet as Yt, Decoration as ge } from "@tiptap/pm/view";
10
10
  import { c as ae } from "./media-id-b2dgniSy.js";
11
11
  import { icons as Xt } from "@freecallai/icons";
12
- import { g as be, d as Q, t as _, o as ye, q as Gt, c as jt, r as We, b as Qe, i as Z, u as oe, C as Wt, v as Qt, w as Zt, x as en, y as Ue, z as tn } from "./guard-BmLOamCj.js";
13
- import { a as nn, c as _e } from "./media-policy-D3-Qglzz.js";
14
- function X(a, o) {
12
+ import { g as be, d as Q, t as U, q as ke, r as Gt, c as jt, u as We, b as Qe, i as Z, v as oe, C as Wt, w as Qt, x as Zt, y as en, z as qe, A as tn } from "./guard-DgExtfXo.js";
13
+ import { a as nn, c as Ue } from "./media-policy-tG5OHWSj.js";
14
+ function X(r, o) {
15
15
  const d = (c) => [
16
16
  `http://www.w3.org/2000/svg ${c.tag}`,
17
17
  c.attrs,
18
18
  ...c.children.map(d)
19
- ], s = Xt[a];
19
+ ], s = Xt[r];
20
20
  return [
21
21
  "http://www.w3.org/2000/svg svg",
22
22
  {
@@ -28,28 +28,28 @@ function X(a, o) {
28
28
  ...s.children.map(d)
29
29
  ];
30
30
  }
31
- function rn(a) {
32
- var k;
33
- const o = (k = be(a.kind)) == null ? void 0 : k.present(a), d = String(a.kind || ""), s = (o == null ? void 0 : o.label) || String(a.label || a.key || ""), c = (i) => [
31
+ function rn(r) {
32
+ var y;
33
+ const o = (y = be(r.kind)) == null ? void 0 : y.present(r), d = String(r.kind || ""), s = (o == null ? void 0 : o.label) || String(r.label || r.key || ""), c = (i) => [
34
34
  "span",
35
35
  { class: i },
36
36
  s
37
37
  ];
38
- let m = [s];
39
- return (o == null ? void 0 : o.layout) === "choice" && (m = [
38
+ let g = [s];
39
+ return (o == null ? void 0 : o.layout) === "choice" && (g = [
40
40
  X(o.icon, `fkp-choice-token-icon fkp-${d}-token-icon`),
41
41
  c(`fkp-choice-token-label fkp-${d}-token-label`),
42
42
  X(
43
43
  "arrow-down",
44
44
  `fkp-choice-token-arrow fkp-${d}-token-arrow`
45
45
  )
46
- ]), (o == null ? void 0 : o.layout) === "inline" && (m = [
46
+ ]), (o == null ? void 0 : o.layout) === "inline" && (g = [
47
47
  X(o.icon, "fkp-inline-token-icon"),
48
48
  c("fkp-inline-token-label")
49
- ]), (o == null ? void 0 : o.layout) === "tool" && (m = [
49
+ ]), (o == null ? void 0 : o.layout) === "tool" && (g = [
50
50
  X(o.icon, "fkp-tool-token-icon"),
51
51
  c("fkp-tool-token-label")
52
- ]), (o == null ? void 0 : o.layout) === "toolNote" && (m = [
52
+ ]), (o == null ? void 0 : o.layout) === "toolNote" && (g = [
53
53
  X(o.icon, "fkp-tool-note-icon"),
54
54
  c("fkp-tool-note-label"),
55
55
  ...o.summary ? [
@@ -68,65 +68,65 @@ function rn(a) {
68
68
  {
69
69
  "data-business-token": "",
70
70
  "data-fkp-node": "business-token",
71
- "data-kind": a.kind,
72
- "data-key": a.key,
73
- "data-node-id": a.id,
74
- "data-token": a.token,
75
- ...a.params ? { "data-fkp-params": JSON.stringify(a.params) } : {},
76
- ...o ? { "data-label": a.label, "aria-label": o.ariaLabel } : {},
71
+ "data-kind": r.kind,
72
+ "data-key": r.key,
73
+ "data-node-id": r.id,
74
+ "data-token": r.token,
75
+ ...r.params ? { "data-fkp-params": JSON.stringify(r.params) } : {},
76
+ ...o ? { "data-label": r.label, "aria-label": o.ariaLabel } : {},
77
77
  class: `fk-token fk-token--${d} fkp-knowledge-tag fkp-knowledge-tag--${d}${(o == null ? void 0 : o.layout) === "choice" ? " fkp-choice-token" : ""}${o != null && o.className ? ` ${o.className}` : ""}`,
78
78
  contenteditable: "false"
79
79
  },
80
- ...m
80
+ ...g
81
81
  ];
82
82
  }
83
- function Ze(a) {
83
+ function Ze(r) {
84
84
  var o;
85
- return ((o = be(a.kind)) == null ? void 0 : o.serialize(a)) || String(a.label || a.key || "");
85
+ return ((o = be(r.kind)) == null ? void 0 : o.serialize(r)) || String(r.label || r.key || "");
86
86
  }
87
87
  const an = Kt.create({
88
88
  name: "uniqueExtensionNodeIds",
89
89
  addProseMirrorPlugins() {
90
90
  return [
91
91
  new Ge({
92
- appendTransaction(a, o, d) {
93
- if (!a.some((g) => g.docChanged))
92
+ appendTransaction(r, o, d) {
93
+ if (!r.some((p) => p.docChanged))
94
94
  return null;
95
95
  const s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
96
- o.doc.descendants((g, b) => {
97
- if (!Q(g.type.name) || !g.attrs.id) return;
98
- c.set(String(g.attrs.id), g);
99
- let v = b;
100
- for (const M of a)
96
+ o.doc.descendants((p, h) => {
97
+ if (!Q(p.type.name) || !p.attrs.id) return;
98
+ c.set(String(p.attrs.id), p);
99
+ let v = h;
100
+ for (const M of r)
101
101
  v = M.mapping.mapResult(v, 1).pos;
102
102
  const u = d.doc.nodeAt(v);
103
- (u == null ? void 0 : u.type.name) === g.type.name && u.attrs.id === g.attrs.id && s.set(String(g.attrs.id), v);
103
+ (u == null ? void 0 : u.type.name) === p.type.name && u.attrs.id === p.attrs.id && s.set(String(p.attrs.id), v);
104
104
  });
105
- const m = /* @__PURE__ */ new Set();
106
- for (const g of a) {
107
- const b = g.getMeta(_);
108
- Array.isArray(b) && b.forEach((v) => {
109
- typeof v == "string" && v && m.add(v);
105
+ const g = /* @__PURE__ */ new Set();
106
+ for (const p of r) {
107
+ const h = p.getMeta(U);
108
+ Array.isArray(h) && h.forEach((v) => {
109
+ typeof v == "string" && v && g.add(v);
110
110
  });
111
111
  }
112
- const k = /* @__PURE__ */ new Set();
113
- d.doc.descendants((g) => {
114
- Q(g.type.name) && g.attrs.id && k.add(String(g.attrs.id));
112
+ const y = /* @__PURE__ */ new Set();
113
+ d.doc.descendants((p) => {
114
+ Q(p.type.name) && p.attrs.id && y.add(String(p.attrs.id));
115
115
  });
116
- const i = /* @__PURE__ */ new Set(), { tr: T } = d, S = a.some(
117
- (g) => g.getMeta("uiEvent") === "drop"
116
+ const i = /* @__PURE__ */ new Set(), { tr: S } = d, T = r.some(
117
+ (p) => p.getMeta("uiEvent") === "drop"
118
118
  );
119
- return d.doc.descendants((g, b) => {
119
+ return d.doc.descendants((p, h) => {
120
120
  var N;
121
- if (!Q(g.type.name)) return;
122
- let v = String(g.attrs.id || "");
121
+ if (!Q(p.type.name)) return;
122
+ let v = String(p.attrs.id || "");
123
123
  const u = s.get(v);
124
- !!v && !i.has(v) && (u === b || S && u === void 0 && ((N = c.get(v)) == null ? void 0 : N.eq(g)) || u === void 0 && m.has(v)) || (v = ye(k, ae), T.setNodeMarkup(b, void 0, {
125
- ...g.attrs,
124
+ !!v && !i.has(v) && (u === h || T && u === void 0 && ((N = c.get(v)) == null ? void 0 : N.eq(p)) || u === void 0 && g.has(v)) || (v = ke(y, ae), S.setNodeMarkup(h, void 0, {
125
+ ...p.attrs,
126
126
  id: v,
127
127
  nodeVersion: 0
128
- }), k.add(v)), i.add(v);
129
- }), T.docChanged ? T.setMeta("addToHistory", !1) : null;
128
+ }), y.add(v)), i.add(v);
129
+ }), S.docChanged ? S.setMeta("addToHistory", !1) : null;
130
130
  }
131
131
  })
132
132
  ];
@@ -152,13 +152,13 @@ const an = Kt.create({
152
152
  return [
153
153
  {
154
154
  tag: "span[data-business-token]",
155
- getAttrs: (a) => ({
156
- kind: a.getAttribute("data-kind"),
157
- key: a.getAttribute("data-key"),
158
- label: a.getAttribute("data-label") || a.textContent,
159
- token: a.getAttribute("data-token"),
155
+ getAttrs: (r) => ({
156
+ kind: r.getAttribute("data-kind"),
157
+ key: r.getAttribute("data-key"),
158
+ label: r.getAttribute("data-label") || r.textContent,
159
+ token: r.getAttribute("data-token"),
160
160
  params: (() => {
161
- const o = a.getAttribute("data-fkp-params");
161
+ const o = r.getAttribute("data-fkp-params");
162
162
  if (!o || o.length > 8192) return null;
163
163
  try {
164
164
  return JSON.parse(o);
@@ -170,23 +170,23 @@ const an = Kt.create({
170
170
  }
171
171
  ];
172
172
  },
173
- renderHTML: ({ node: a }) => rn(a.attrs),
174
- renderText: ({ node: a }) => Ze(a.attrs)
175
- }), qe = new Ft(
173
+ renderHTML: ({ node: r }) => rn(r.attrs),
174
+ renderText: ({ node: r }) => Ze(r.attrs)
175
+ }), _e = new Ft(
176
176
  "inlineReplyNeighbors"
177
177
  );
178
- function Ke(a) {
178
+ function Ke(r) {
179
179
  const o = [];
180
- a.forEach((s, c) => {
180
+ r.forEach((s, c) => {
181
181
  o.push({ node: s, position: c });
182
182
  });
183
183
  const d = /* @__PURE__ */ new Set();
184
184
  return o.forEach(({ node: s }, c) => {
185
- var m;
186
- if (!(s.type.name !== "originalReply" || s.childCount !== 1 || ((m = s.firstChild) == null ? void 0 : m.type.name) !== "paragraph"))
187
- for (const k of [o[c - 1], o[c + 1]])
188
- (k == null ? void 0 : k.node.type.name) === "paragraph" && d.add(k.position);
189
- }), Yt.create(a, [
185
+ var g;
186
+ if (!(s.type.name !== "originalReply" || s.childCount !== 1 || ((g = s.firstChild) == null ? void 0 : g.type.name) !== "paragraph"))
187
+ for (const y of [o[c - 1], o[c + 1]])
188
+ (y == null ? void 0 : y.node.type.name) === "paragraph" && d.add(y.position);
189
+ }), Yt.create(r, [
190
190
  ...o.filter(({ node: s }) => s.type.name === "originalReply").map(
191
191
  ({ position: s }) => ge.widget(
192
192
  s + 1,
@@ -200,20 +200,20 @@ function Ke(a) {
200
200
  )
201
201
  ),
202
202
  ...[...d].flatMap((s) => {
203
- const c = a.nodeAt(s), m = ge.node(
203
+ const c = r.nodeAt(s), g = ge.node(
204
204
  s,
205
205
  s + c.nodeSize,
206
206
  {
207
207
  class: c.content.size ? "fk-inline-reply-neighbor" : "fk-inline-reply-neighbor fk-inline-reply-neighbor--empty"
208
208
  }
209
209
  );
210
- return c.content.size ? [m] : [
211
- m,
210
+ return c.content.size ? [g] : [
211
+ g,
212
212
  ge.widget(
213
213
  s + 1,
214
214
  () => {
215
- const k = document.createElement("span");
216
- return k.className = "fkp-reply-caret-anchor", k.setAttribute("aria-hidden", "true"), k.textContent = "​", k;
215
+ const y = document.createElement("span");
216
+ return y.className = "fkp-reply-caret-anchor", y.setAttribute("aria-hidden", "true"), y.textContent = "​", y;
217
217
  },
218
218
  { side: -1, ignoreSelection: !0 }
219
219
  )
@@ -221,46 +221,46 @@ function Ke(a) {
221
221
  })
222
222
  ]);
223
223
  }
224
- function Je(a) {
224
+ function Je(r) {
225
225
  var o;
226
- return a.type.name === "originalReply" && a.childCount === 1 && ((o = a.firstChild) == null ? void 0 : o.type.name) === "paragraph" && a.firstChild.content.size === 0;
226
+ return r.type.name === "originalReply" && r.childCount === 1 && ((o = r.firstChild) == null ? void 0 : o.type.name) === "paragraph" && r.firstChild.content.size === 0;
227
227
  }
228
- function ke(a, o) {
229
- var b;
230
- const { state: d } = a, { empty: s, $from: c } = d.selection;
231
- if (!a.editable || a.composing || !s || !(d.selection instanceof $) || c.parent.type.name !== "paragraph")
228
+ function ye(r, o) {
229
+ var h;
230
+ const { state: d } = r, { empty: s, $from: c } = d.selection;
231
+ if (!r.editable || r.composing || !s || !(d.selection instanceof $) || c.parent.type.name !== "paragraph")
232
232
  return !1;
233
- const m = (v, u) => {
233
+ const g = (v, u) => {
234
234
  const M = d.tr.delete(v, v + u.nodeSize);
235
235
  return M.setSelection(
236
236
  $.near(
237
237
  M.doc.resolve(Math.min(v, M.doc.content.size)),
238
238
  o ? -1 : 1
239
239
  )
240
- ), a.dispatch(M.scrollIntoView()), !0;
241
- }, k = c.depth - 1;
242
- if (k < 1 || c.node(k).type.name !== "originalReply") {
240
+ ), r.dispatch(M.scrollIntoView()), !0;
241
+ }, y = c.depth - 1;
242
+ if (y < 1 || c.node(y).type.name !== "originalReply") {
243
243
  if (c.parentOffset !== (o ? 0 : c.parent.content.size))
244
244
  return !1;
245
245
  const v = o ? c.before() : c.after(), u = d.doc.resolve(v), M = o ? u.nodeBefore : u.nodeAfter;
246
246
  if ((M == null ? void 0 : M.type.name) !== "originalReply") return !1;
247
247
  const N = o ? v - M.nodeSize : v;
248
- return Je(M) ? m(N, M) : (a.dispatch(
248
+ return Je(M) ? g(N, M) : (r.dispatch(
249
249
  d.tr.setSelection(Ht.create(d.doc, N)).scrollIntoView()
250
250
  ), !0);
251
251
  }
252
- const i = c.node(k);
253
- if (Je(i)) return m(c.before(k), i);
254
- if (c.parent.childCount !== 1 || !((b = c.parent.firstChild) != null && b.isText) || c.parentOffset !== (o ? c.parent.content.size : 0))
252
+ const i = c.node(y);
253
+ if (Je(i)) return g(c.before(y), i);
254
+ if (c.parent.childCount !== 1 || !((h = c.parent.firstChild) != null && h.isText) || c.parentOffset !== (o ? c.parent.content.size : 0))
255
255
  return !1;
256
- const T = c.parent.textContent;
256
+ const S = c.parent.textContent;
257
257
  if ((typeof Intl.Segmenter == "function" ? [
258
258
  ...new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(
259
- T
259
+ S
260
260
  )
261
- ] : Array.from(T)).length !== 1) return !1;
262
- const g = d.tr.delete(c.start(), c.end());
263
- return g.setSelection($.create(g.doc, c.start())), a.dispatch(g.scrollIntoView()), !0;
261
+ ] : Array.from(S)).length !== 1) return !1;
262
+ const p = d.tr.delete(c.start(), c.end());
263
+ return p.setSelection($.create(p.doc, c.start())), r.dispatch(p.scrollIntoView()), !0;
264
264
  }
265
265
  const sn = he.create({
266
266
  name: "originalReply",
@@ -286,76 +286,76 @@ const sn = he.create({
286
286
  ];
287
287
  },
288
288
  addKeyboardShortcuts() {
289
- const a = (o) => {
290
- const { state: d, view: s } = this.editor, { empty: c, $from: m } = d.selection, { paragraph: k } = d.schema.nodes;
291
- if (!this.editor.isEditable || s.composing || !c || !(d.selection instanceof $) || m.parent.type !== k || m.parentOffset !== (o === 1 ? m.parent.content.size : 0))
289
+ const r = (o) => {
290
+ const { state: d, view: s } = this.editor, { empty: c, $from: g } = d.selection, { paragraph: y } = d.schema.nodes;
291
+ if (!this.editor.isEditable || s.composing || !c || !(d.selection instanceof $) || g.parent.type !== y || g.parentOffset !== (o === 1 ? g.parent.content.size : 0))
292
292
  return !1;
293
- const { tr: i } = d, T = m.depth - 1;
294
- if (T > 0 && m.node(T).type === this.type) {
295
- const S = o === 1 ? m.end(T) - 1 : m.start(T) + 1;
296
- if (m.pos !== S) return !1;
297
- const g = o === 1 ? m.after(T) : m.before(T), b = d.doc.resolve(g), v = o === 1 ? b.nodeAfter : b.nodeBefore;
293
+ const { tr: i } = d, S = g.depth - 1;
294
+ if (S > 0 && g.node(S).type === this.type) {
295
+ const T = o === 1 ? g.end(S) - 1 : g.start(S) + 1;
296
+ if (g.pos !== T) return !1;
297
+ const p = o === 1 ? g.after(S) : g.before(S), h = d.doc.resolve(p), v = o === 1 ? h.nodeAfter : h.nodeBefore;
298
298
  let u;
299
- if ((v == null ? void 0 : v.type) === k)
300
- u = o === 1 ? g + 1 : g - 1;
299
+ if ((v == null ? void 0 : v.type) === y)
300
+ u = o === 1 ? p + 1 : p - 1;
301
301
  else {
302
- const M = b.index();
303
- if (!b.parent.canReplaceWith(M, M, k))
302
+ const M = h.index();
303
+ if (!h.parent.canReplaceWith(M, M, y))
304
304
  return !1;
305
- i.insert(g, k.create()), u = g + 1;
305
+ i.insert(p, y.create()), u = p + 1;
306
306
  }
307
307
  i.setSelection($.create(i.doc, u));
308
308
  } else {
309
- const S = o === 1 ? m.after() : m.before(), g = d.doc.resolve(S), b = o === 1 ? g.nodeAfter : g.nodeBefore;
310
- if ((b == null ? void 0 : b.type) !== this.type) return !1;
311
- const v = o === 1 ? b.firstChild : b.lastChild;
312
- if ((v == null ? void 0 : v.type) !== k) return !1;
313
- const u = o === 1 ? S + 2 : S - 2;
309
+ const T = o === 1 ? g.after() : g.before(), p = d.doc.resolve(T), h = o === 1 ? p.nodeAfter : p.nodeBefore;
310
+ if ((h == null ? void 0 : h.type) !== this.type) return !1;
311
+ const v = o === 1 ? h.firstChild : h.lastChild;
312
+ if ((v == null ? void 0 : v.type) !== y) return !1;
313
+ const u = o === 1 ? T + 2 : T - 2;
314
314
  i.setSelection($.create(i.doc, u));
315
315
  }
316
316
  return s.dispatch(i.scrollIntoView()), !0;
317
317
  };
318
318
  return {
319
- Backspace: () => ke(this.editor.view, !0),
320
- Delete: () => ke(this.editor.view, !1),
321
- ArrowLeft: () => a(-1),
322
- ArrowRight: () => a(1)
319
+ Backspace: () => ye(this.editor.view, !0),
320
+ Delete: () => ye(this.editor.view, !1),
321
+ ArrowLeft: () => r(-1),
322
+ ArrowRight: () => r(1)
323
323
  };
324
324
  },
325
325
  addProseMirrorPlugins() {
326
326
  return [
327
327
  new Ge({
328
- key: qe,
328
+ key: _e,
329
329
  state: {
330
- init: (a, o) => Ke(o.doc),
331
- apply: (a, o) => a.docChanged ? Ke(a.doc) : o
330
+ init: (r, o) => Ke(o.doc),
331
+ apply: (r, o) => r.docChanged ? Ke(r.doc) : o
332
332
  },
333
333
  props: {
334
334
  handleDOMEvents: {
335
- beforeinput: (a, o) => {
335
+ beforeinput: (r, o) => {
336
336
  if (!o.cancelable || o.isComposing) return !1;
337
337
  const d = o.inputType === "deleteContentBackward";
338
- return !d && o.inputType !== "deleteContentForward" || !ke(a, d) ? !1 : (o.preventDefault(), !0);
338
+ return !d && o.inputType !== "deleteContentForward" || !ye(r, d) ? !1 : (o.preventDefault(), !0);
339
339
  },
340
- mousedown: (a, o) => {
341
- var m;
342
- if (!a.editable || a.composing || o.button !== 0 || o.shiftKey || o.ctrlKey || o.metaKey || o.altKey || o.detail > 1 || !(o.target instanceof Element))
340
+ mousedown: (r, o) => {
341
+ var g;
342
+ if (!r.editable || r.composing || o.button !== 0 || o.shiftKey || o.ctrlKey || o.metaKey || o.altKey || o.detail > 1 || !(o.target instanceof Element))
343
343
  return !1;
344
344
  const d = o.target.closest("p");
345
- if (!d || !a.dom.contains(d) || !((m = d.parentElement) != null && m.matches(
345
+ if (!d || !r.dom.contains(d) || !((g = d.parentElement) != null && g.matches(
346
346
  "section[data-original-reply]"
347
347
  )))
348
348
  return !1;
349
- const s = a.posAtDOM(d, 0), c = a.state.doc.resolve(s);
350
- return c.parent.type !== a.state.schema.nodes.paragraph || c.parent.content.size !== 0 || c.node(c.depth - 1).type !== this.type ? !1 : (o.preventDefault(), a.dispatch(
351
- a.state.tr.setSelection(
352
- $.create(a.state.doc, s)
349
+ const s = r.posAtDOM(d, 0), c = r.state.doc.resolve(s);
350
+ return c.parent.type !== r.state.schema.nodes.paragraph || c.parent.content.size !== 0 || c.node(c.depth - 1).type !== this.type ? !1 : (o.preventDefault(), r.dispatch(
351
+ r.state.tr.setSelection(
352
+ $.create(r.state.doc, s)
353
353
  )
354
- ), a.focus(), !0);
354
+ ), r.focus(), !0);
355
355
  }
356
356
  },
357
- decorations(a) {
358
- return qe.getState(a);
357
+ decorations(r) {
358
+ return _e.getState(r);
359
359
  }
360
360
  }
361
361
  })
@@ -409,261 +409,264 @@ const sn = he.create({
409
409
  "OL",
410
410
  "LI"
411
411
  ]);
412
- function pn(a, o, d, s) {
412
+ function pn(r, o, d, s) {
413
413
  if (!o.content.size) return !1;
414
414
  const c = document.createElement("div");
415
415
  c.appendChild(
416
416
  je.fromSchema(d).serializeFragment(o.content)
417
417
  );
418
- const m = o.content.textBetween(
418
+ const g = o.content.textBetween(
419
419
  0,
420
420
  o.content.size,
421
421
  `
422
422
  `,
423
- (k) => {
424
- var T;
425
- if (k.type.name === "mediaBlock")
426
- return `[${k.attrs.kind === "video" ? "视频" : "图片"}:${k.attrs.name || ""}]`;
427
- if (k.type.name === "businessToken")
428
- return Ze(k.attrs);
429
- const i = (T = s == null ? void 0 : s.serializeNode) == null ? void 0 : T.call(s, k);
430
- return i !== void 0 ? i : k.type.name === "messageSeparator" ? "{分隔符}" : "";
423
+ (y) => {
424
+ var S;
425
+ if (y.type.name === "mediaBlock")
426
+ return y.attrs.sourceType === "qianniuVideo" ? y.attrs.src : `[${y.attrs.kind === "video" ? "视频" : "图片"}:${y.attrs.name || ""}]`;
427
+ if (y.type.name === "businessToken")
428
+ return Ze(y.attrs);
429
+ const i = (S = s == null ? void 0 : s.serializeNode) == null ? void 0 : S.call(s, y);
430
+ return i !== void 0 ? i : y.type.name === "messageSeparator" ? "{分隔符}" : "";
431
431
  }
432
432
  );
433
433
  try {
434
- return a.setData("text/plain", m), a.setData("text/html", c.innerHTML), !0;
434
+ return r.setData("text/plain", g), r.setData("text/html", c.innerHTML), !0;
435
435
  } catch {
436
436
  return !1;
437
437
  }
438
438
  }
439
- function mn(a, o, d, s) {
439
+ function mn(r, o, d, s) {
440
440
  var v;
441
- const c = a.getAttribute("data-kind"), m = a.getAttribute("data-key"), k = a.getAttribute("data-label"), i = a.getAttribute("data-token");
442
- if (!Gt(c) || !m || !k || s != null && s.allowBusinessToken && !s.allowBusinessToken(c, m) || d && ((v = be(c)) == null ? void 0 : v.allowInOriginalReply) === !1 || !o.has(`${c}:knowledgeInline`))
441
+ const c = r.getAttribute("data-kind"), g = r.getAttribute("data-key"), y = r.getAttribute("data-label"), i = r.getAttribute("data-token");
442
+ if (!Gt(c) || !g || !y || s != null && s.allowBusinessToken && !s.allowBusinessToken(c, g) || d && ((v = be(c)) == null ? void 0 : v.allowInOriginalReply) === !1 || !o.has(`${c}:knowledgeInline`))
443
443
  return null;
444
- const T = a.getAttribute("data-fkp-params");
445
- let S = null;
446
- if (T != null) {
447
- if (T.length > 8192) return null;
444
+ const S = r.getAttribute("data-fkp-params");
445
+ let T = null;
446
+ if (S != null) {
447
+ if (S.length > 8192) return null;
448
448
  try {
449
- const u = JSON.parse(T);
449
+ const u = JSON.parse(S);
450
450
  if (!u || typeof u != "object" || Array.isArray(u))
451
451
  return null;
452
- S = u;
452
+ T = u;
453
453
  } catch {
454
454
  return null;
455
455
  }
456
456
  }
457
- if (c === "tool" && (!S || m === "small_payment" && !jt(S.amount) || m === "order_note" && !We(S)) || Qe({
457
+ if (c === "tool" && (!T || g === "small_payment" && !jt(T.amount) || g === "order_note" && !We(T)) || Qe({
458
458
  type: "doc",
459
459
  content: [
460
- { type: "paragraph", content: [{ type: "businessToken", attrs: { kind: c, key: m, label: k, token: i, params: S } }] }
460
+ { type: "paragraph", content: [{ type: "businessToken", attrs: { kind: c, key: g, label: y, token: i, params: T } }] }
461
461
  ]
462
462
  }))
463
463
  return null;
464
- const b = document.createElement("span");
465
- return b.setAttribute("data-business-token", ""), b.setAttribute("data-fkp-node", "business-token"), b.setAttribute("data-kind", c), b.setAttribute("data-key", m), b.setAttribute("data-label", k), i && b.setAttribute("data-token", i), S && b.setAttribute("data-fkp-params", JSON.stringify(S)), b.textContent = a.textContent, b;
464
+ const h = document.createElement("span");
465
+ return h.setAttribute("data-business-token", ""), h.setAttribute("data-fkp-node", "business-token"), h.setAttribute("data-kind", c), h.setAttribute("data-key", g), h.setAttribute("data-label", y), i && h.setAttribute("data-token", i), T && h.setAttribute("data-fkp-params", JSON.stringify(T)), h.textContent = r.textContent, h;
466
466
  }
467
- function gn(a, o, d) {
468
- var S, g;
469
- const s = a.tagName === "IMG" || a.tagName === "VIDEO" ? a : a.querySelector("img,video");
467
+ function gn(r, o, d) {
468
+ var T, p;
469
+ const s = r.tagName === "IMG" || r.tagName === "VIDEO" ? r : r.querySelector("img,video");
470
470
  if (!s) return !1;
471
- const c = s.tagName === "VIDEO" ? "video" : "image", m = s.getAttribute("src") || (c === "video" ? (S = s.querySelector("source[src]")) == null ? void 0 : S.getAttribute("src") : null);
472
- let k = "";
473
- if (Z(m))
471
+ const c = s.tagName === "VIDEO" ? "video" : "image", g = s.getAttribute("src") || (c === "video" ? (T = s.querySelector("source[src]")) == null ? void 0 : T.getAttribute("src") : null);
472
+ let y = "";
473
+ if (Z(g))
474
474
  try {
475
- k = decodeURIComponent(
476
- new URL(m).pathname.split("/").pop() || ""
475
+ y = decodeURIComponent(
476
+ new URL(g).pathname.split("/").pop() || ""
477
477
  );
478
478
  } catch {
479
- k = "";
479
+ y = "";
480
480
  }
481
481
  const i = [
482
- a.getAttribute("data-name"),
483
- (g = a.querySelector("figcaption")) == null ? void 0 : g.textContent,
482
+ r.getAttribute("data-name"),
483
+ (p = r.querySelector("figcaption")) == null ? void 0 : p.textContent,
484
484
  s.getAttribute("alt"),
485
- k
486
- ].filter((b) => !!(b != null && b.trim())).map((b) => b.trim().toLowerCase());
485
+ y
486
+ ].filter((h) => !!(h != null && h.trim())).map((h) => h.trim().toLowerCase());
487
487
  if (!i.length) return !1;
488
- const T = o.findIndex(
489
- (b, v) => {
488
+ const S = o.findIndex(
489
+ (h, v) => {
490
490
  var u;
491
- return !d.has(v) && ((u = nn(b)) == null ? void 0 : u.kind) === c && i.includes(b.name.toLowerCase());
491
+ return !d.has(v) && ((u = nn(h)) == null ? void 0 : u.kind) === c && i.includes(h.name.toLowerCase());
492
492
  }
493
493
  );
494
- return T < 0 ? !1 : (d.add(T), !0);
494
+ return S < 0 ? !1 : (d.add(S), !0);
495
495
  }
496
- function kn(a, o) {
497
- var v, u;
498
- const d = a.tagName === "IMG" || a.tagName === "VIDEO" ? a : a.querySelector("img,video"), s = a.getAttribute("data-kind") || ((d == null ? void 0 : d.tagName) === "VIDEO" ? "video" : "image"), c = (d == null ? void 0 : d.getAttribute("src")) || ((d == null ? void 0 : d.tagName) === "VIDEO" ? (v = d.querySelector("source[src]")) == null ? void 0 : v.getAttribute("src") : null), m = d == null ? void 0 : d.getAttribute("poster");
499
- if (a.getAttribute("data-fkp-node") === "media-block" && a.getAttribute("status") !== "ready" || d && (s === "image" && d.tagName !== "IMG" || s === "video" && d.tagName !== "VIDEO") || !["image", "video"].includes(s) || !o.has(`${s}:knowledgeBlock`) || !Z(c) || m && !Z(m))
496
+ function yn(r, o) {
497
+ var u, M;
498
+ const d = r.tagName === "IMG" || r.tagName === "VIDEO" ? r : r.querySelector("img,video") || (r.getAttribute("data-source-type") === "qianniuVideo" ? r.querySelector("a[href]") : null), s = r.getAttribute("data-kind") || ((d == null ? void 0 : d.tagName) === "VIDEO" ? "video" : "image"), c = (d == null ? void 0 : d.getAttribute("src")) || (d == null ? void 0 : d.getAttribute("href")) || ((d == null ? void 0 : d.tagName) === "VIDEO" ? (u = d.querySelector("source[src]")) == null ? void 0 : u.getAttribute("src") : null), g = d == null ? void 0 : d.getAttribute("poster");
499
+ if (r.getAttribute("data-fkp-node") === "media-block" && r.hasAttribute("status") && r.getAttribute("status") !== "ready" || d && (s === "image" && d.tagName !== "IMG" || s === "video" && d.tagName !== "VIDEO" && !(r.getAttribute("data-source-type") === "qianniuVideo" && d.tagName === "A")) || !["image", "video"].includes(s) || !o.has(`${s}:knowledgeBlock`) || !Z(c) || g && !Z(g))
500
500
  return null;
501
- const k = a.getAttribute("data-name") || ((u = a.querySelector("figcaption")) == null ? void 0 : u.textContent) || (d == null ? void 0 : d.getAttribute("alt")) || "", i = a.getAttribute("data-asset-id"), T = {
501
+ const y = r.getAttribute("data-name") || ((M = r.querySelector("figcaption")) == null ? void 0 : M.textContent) || (d == null ? void 0 : d.getAttribute("alt")) || "", i = r.getAttribute("data-asset-id"), S = r.getAttribute("data-source-type"), T = {
502
502
  id: ae(),
503
503
  kind: s,
504
504
  src: c,
505
- name: k,
505
+ name: y,
506
506
  status: "ready",
507
- ...m ? { poster: m } : {},
508
- ...i ? { assetId: i } : {}
507
+ ...g ? { poster: g } : {},
508
+ ...i ? { assetId: i } : {},
509
+ ...S ? { sourceType: S } : {}
509
510
  };
510
511
  if (Qe({
511
512
  type: "doc",
512
513
  content: [{ type: "mediaBlock", attrs: T }]
513
514
  }))
514
515
  return null;
515
- const S = document.createElement("figure");
516
- S.setAttribute("data-media-block", ""), S.setAttribute("data-fkp-node", "media-block"), S.setAttribute("data-id", T.id), S.setAttribute("data-kind", s), i && S.setAttribute("data-asset-id", i);
517
- const g = document.createElement(s === "video" ? "video" : "img");
518
- g.setAttribute("src", c), m && g.setAttribute("poster", m), S.appendChild(g);
519
- const b = document.createElement("figcaption");
520
- return b.textContent = k, S.appendChild(b), S;
516
+ const p = document.createElement("figure");
517
+ p.setAttribute("data-media-block", ""), p.setAttribute("data-fkp-node", "media-block"), p.setAttribute("data-id", T.id), p.setAttribute("data-kind", s), i && p.setAttribute("data-asset-id", i), T.sourceType && p.setAttribute("data-source-type", T.sourceType);
518
+ const h = document.createElement(
519
+ T.sourceType === "qianniuVideo" ? "a" : s === "video" ? "video" : "img"
520
+ );
521
+ h.setAttribute(T.sourceType === "qianniuVideo" ? "href" : "src", c), T.sourceType === "qianniuVideo" && (h.textContent = c), g && h.setAttribute("poster", g), p.appendChild(h);
522
+ const v = document.createElement("figcaption");
523
+ return v.textContent = y, p.appendChild(v), p;
521
524
  }
522
- function yn(a, o, d, s = [], c) {
525
+ function kn(r, o, d, s = [], c) {
523
526
  var v;
524
- if (!a || a.length > cn)
527
+ if (!r || r.length > cn)
525
528
  return { slice: null, handled: !1 };
526
- const m = new Set(
529
+ const g = new Set(
527
530
  d.map((u) => `${u.id}:${u.slot}`)
528
- ), k = new DOMParser().parseFromString(
529
- a.replace(
531
+ ), y = new DOMParser().parseFromString(
532
+ r.replace(
530
533
  /<video\b((?:[^"'<>]|"[^"]*"|'[^']*')*)\/>/giu,
531
534
  "<video$1></video>"
532
535
  ),
533
536
  "text/html"
534
- ), i = document.createElement("div"), T = /* @__PURE__ */ new Set();
535
- let S = 0, g = !1;
536
- const b = (u, M = !1) => {
537
- var q;
538
- if (++S > dn)
537
+ ), i = document.createElement("div"), S = /* @__PURE__ */ new Set();
538
+ let T = 0, p = !1;
539
+ const h = (u, M = !1) => {
540
+ var _;
541
+ if (++T > dn)
539
542
  throw new Error("Clipboard HTML is too large");
540
543
  if (u.nodeType === Node.TEXT_NODE)
541
544
  return document.createTextNode(u.textContent || "");
542
545
  if (!(u instanceof Element) || un.has(u.tagName))
543
546
  return null;
544
- const N = (q = c == null ? void 0 : c.sanitizeInlineNode) == null ? void 0 : q.call(c, u);
547
+ const N = (_ = c == null ? void 0 : c.sanitizeInlineNode) == null ? void 0 : _.call(c, u);
545
548
  if (N !== void 0)
546
- return N || (g = !0), N;
549
+ return N || (p = !0), N;
547
550
  if (u.hasAttribute("data-agent-size-chart"))
548
- return g = !0, null;
551
+ return p = !0, null;
549
552
  if (u.getAttribute("data-fkp-node") === "business-token") {
550
- const w = mn(u, m, M, c);
551
- return w || (g = !0), w;
553
+ const w = mn(u, g, M, c);
554
+ return w || (p = !0), w;
552
555
  }
553
556
  if (u.getAttribute("data-fkp-node") === "media-block" || u.tagName === "IMG" || u.tagName === "VIDEO" || u.tagName === "FIGURE" && u.querySelector("img,video")) {
554
- if (gn(u, s, T))
555
- return g = !0, null;
556
- const w = kn(u, m);
557
- return w || (g = !0), w;
557
+ if (gn(u, s, S))
558
+ return p = !0, null;
559
+ const w = yn(u, g);
560
+ return w || (p = !0), w;
558
561
  }
559
562
  if (u.getAttribute("data-fkp-node") === "message-separator") {
560
- if (!m.has("separator:knowledgeInline"))
561
- return g = !0, null;
563
+ if (!g.has("separator:knowledgeInline"))
564
+ return p = !0, null;
562
565
  const w = document.createElement("div");
563
566
  return w.setAttribute("data-message-separator", ""), w;
564
567
  }
565
568
  if (u.getAttribute("data-fkp-node") === "original-reply") {
566
- const w = m.has("originalReply:knowledgeBlock");
567
- w || (g = !0);
569
+ const w = g.has("originalReply:knowledgeBlock");
570
+ w || (p = !0);
568
571
  const O = w ? document.createElement("section") : document.createDocumentFragment();
569
572
  return O instanceof HTMLElement && O.setAttribute("data-original-reply", ""), u.childNodes.forEach((K) => {
570
- const B = b(K, w);
573
+ const B = h(K, w);
571
574
  B && O.appendChild(B);
572
575
  }), O;
573
576
  }
574
577
  if (u.hasAttribute("data-fkp-node") || u.hasAttribute("data-business-token") || u.hasAttribute("data-message-separator") || u.getAttribute("data-tag") === "true" || u.getAttribute("data-variable") === "true" || u.getAttribute("data-divider") === "true")
575
- return g = !0, null;
578
+ return p = !0, null;
576
579
  const F = fn.has(u.tagName) ? document.createElement(u.tagName.toLowerCase()) : u.tagName === "BR" ? document.createElement("br") : document.createDocumentFragment();
577
580
  return u.childNodes.forEach((w) => {
578
- const O = b(w, M);
581
+ const O = h(w, M);
579
582
  O && F.appendChild(O);
580
583
  }), F;
581
584
  };
582
585
  try {
583
- if (k.body.childNodes.forEach((M) => {
584
- const N = b(M);
586
+ if (y.body.childNodes.forEach((M) => {
587
+ const N = h(M);
585
588
  N && i.appendChild(N);
586
589
  }), !((v = i.textContent) != null && v.trim()) && !i.querySelector(
587
590
  "figure, [data-message-separator], [data-original-reply]"
588
591
  ))
589
- return { slice: null, handled: g };
592
+ return { slice: null, handled: p };
590
593
  const u = Jt.fromSchema(o).parseSlice(i, {
591
594
  preserveWhitespace: !0
592
595
  });
593
- return u.content.size ? { slice: u, handled: !0 } : { slice: null, handled: g };
596
+ return u.content.size ? { slice: u, handled: !0 } : { slice: null, handled: p };
594
597
  } catch {
595
598
  return { slice: null, handled: !1 };
596
599
  }
597
600
  }
598
- function hn(a) {
599
- return et(a, a.state.selection.getBookmark());
601
+ function hn(r) {
602
+ return et(r, r.state.selection.getBookmark());
600
603
  }
601
- function Ye(a, o) {
602
- if (a.isDestroyed || !Number.isInteger(o) || o < 0 || o > a.state.doc.content.size)
604
+ function Ye(r, o) {
605
+ if (r.isDestroyed || !Number.isInteger(o) || o < 0 || o > r.state.doc.content.size)
603
606
  return null;
604
607
  let d = o, s = !0, c = !0;
605
- const m = ({ transaction: k }) => {
606
- const i = k.mapping.mapResult(d, 1);
608
+ const g = ({ transaction: y }) => {
609
+ const i = y.mapping.mapResult(d, 1);
607
610
  i.deletedAcross && (c = !1), d = i.pos;
608
611
  };
609
- return a.on("transaction", m), {
612
+ return r.on("transaction", g), {
610
613
  status() {
611
- return !s || a.isDestroyed ? "disposed" : c ? "ready" : "lost";
614
+ return !s || r.isDestroyed ? "disposed" : c ? "ready" : "lost";
612
615
  },
613
- insert(k) {
614
- if (!s || !c || a.isDestroyed) return !1;
616
+ insert(y) {
617
+ if (!s || !c || r.isDestroyed) return !1;
615
618
  try {
616
- return a.chain().setMeta(_, oe(k)).insertContentAt(d, k).run();
619
+ return r.chain().setMeta(U, oe(y)).insertContentAt(d, y).run();
617
620
  } catch {
618
621
  return !1;
619
622
  }
620
623
  },
621
624
  dispose() {
622
- s && (s = !1, a.off("transaction", m));
625
+ s && (s = !1, r.off("transaction", g));
623
626
  }
624
627
  };
625
628
  }
626
- function Xe(a, o) {
627
- if (a.isDestroyed || !Number.isInteger(o) || o < 0 || o > a.state.doc.content.size)
629
+ function Xe(r, o) {
630
+ if (r.isDestroyed || !Number.isInteger(o) || o < 0 || o > r.state.doc.content.size)
628
631
  return null;
629
632
  try {
630
- const d = Ut.near(
631
- a.state.doc.resolve(o)
633
+ const d = qt.near(
634
+ r.state.doc.resolve(o)
632
635
  ).getBookmark();
633
- return et(a, d);
636
+ return et(r, d);
634
637
  } catch {
635
638
  return null;
636
639
  }
637
640
  }
638
- function et(a, o) {
639
- let d = o, s = !0, c = !0, m = !1, { from: k, to: i } = o.resolve(a.state.doc);
640
- const T = ({ transaction: S }) => {
641
- const g = S.mapping.mapResult(k, 1), b = S.mapping.mapResult(i, -1);
642
- !m && (g.deletedAcross || b.deletedAcross) && (c = !1), k = g.pos, i = b.pos, d = d.map(S.mapping);
641
+ function et(r, o) {
642
+ let d = o, s = !0, c = !0, g = !1, { from: y, to: i } = o.resolve(r.state.doc);
643
+ const S = ({ transaction: T }) => {
644
+ const p = T.mapping.mapResult(y, 1), h = T.mapping.mapResult(i, -1);
645
+ !g && (p.deletedAcross || h.deletedAcross) && (c = !1), y = p.pos, i = h.pos, d = d.map(T.mapping);
643
646
  };
644
- return a.on("transaction", T), {
647
+ return r.on("transaction", S), {
645
648
  status() {
646
- return !s || a.isDestroyed ? "disposed" : c ? "ready" : "lost";
649
+ return !s || r.isDestroyed ? "disposed" : c ? "ready" : "lost";
647
650
  },
648
- insert(S) {
649
- if (!s || !c || a.isDestroyed) return !1;
651
+ insert(T) {
652
+ if (!s || !c || r.isDestroyed) return !1;
650
653
  try {
651
- const g = d.resolve(a.state.doc);
652
- m = !0;
654
+ const p = d.resolve(r.state.doc);
655
+ g = !0;
653
656
  try {
654
- return a.chain().setMeta(_, oe(S)).insertContentAt(
655
- { from: g.from, to: g.to },
656
- S
657
+ return r.chain().setMeta(U, oe(T)).insertContentAt(
658
+ { from: p.from, to: p.to },
659
+ T
657
660
  ).run();
658
661
  } finally {
659
- m = !1;
662
+ g = !1;
660
663
  }
661
664
  } catch {
662
665
  return !1;
663
666
  }
664
667
  },
665
668
  dispose() {
666
- s && (s = !1, a.off("transaction", T));
669
+ s && (s = !1, r.off("transaction", S));
667
670
  }
668
671
  };
669
672
  }
@@ -674,7 +677,7 @@ const bn = {
674
677
  }, vn = { class: "fkp-order-remark-detail-title" }, An = {
675
678
  key: 0,
676
679
  class: "fkp-order-remark-extract"
677
- }, Sn = { class: "fkp-order-remark-detail-content" }, Tn = { class: "fkp-order-remark-detail-row" }, Cn = { key: 0 }, Mn = ["aria-label"], En = { class: "fkp-order-remark-detail-row" }, Nn = {
680
+ }, Tn = { class: "fkp-order-remark-detail-content" }, Sn = { class: "fkp-order-remark-detail-row" }, Cn = { key: 0 }, Mn = ["aria-label"], En = { class: "fkp-order-remark-detail-row" }, Nn = {
678
681
  key: 2,
679
682
  class: "fkp-reference-placeholder",
680
683
  "aria-hidden": "true"
@@ -691,20 +694,20 @@ const bn = {
691
694
  documentAdapter: {}
692
695
  },
693
696
  emits: ["update:modelValue", "retry-media", "load-error", "edit-tool", "choice-menu", "leave-choice"],
694
- setup(a, { expose: o, emit: d }) {
695
- const s = a;
697
+ setup(r, { expose: o, emit: d }) {
698
+ const s = r;
696
699
  let c = !1;
697
- const m = d, k = /* @__PURE__ */ new Map(), i = Rt();
698
- let T = () => {
700
+ const g = d, y = /* @__PURE__ */ new Map(), i = Rt();
701
+ let S = () => {
699
702
  };
700
- const S = new Promise((e) => {
701
- T = e;
702
- }), g = Y(), b = Y(!0), v = Y(!1), u = Y(null), M = Y({});
703
+ const T = new Promise((e) => {
704
+ S = e;
705
+ }), p = Y(), h = Y(!0), v = Y(!1), u = Y(null), M = Y({});
703
706
  let N = null;
704
707
  function F() {
705
708
  N && clearTimeout(N), N = null;
706
709
  }
707
- function q() {
710
+ function _() {
708
711
  F(), N = setTimeout(() => {
709
712
  u.value = null;
710
713
  }, 150);
@@ -715,10 +718,10 @@ const bn = {
715
718
  const n = t.closest(
716
719
  '[data-business-token][data-key="order_note"]'
717
720
  );
718
- n != null && n.dataset.nodeId && (F(), i.value.state.doc.descendants((r) => {
719
- if (r.type.name !== "businessToken" || r.attrs.id !== n.dataset.nodeId)
721
+ n != null && n.dataset.nodeId && (F(), i.value.state.doc.descendants((a) => {
722
+ if (a.type.name !== "businessToken" || a.attrs.id !== n.dataset.nodeId)
720
723
  return !0;
721
- u.value = We(r.attrs.params) ? r.attrs.params : null;
724
+ u.value = We(a.attrs.params) ? a.attrs.params : null;
722
725
  const l = n.getBoundingClientRect();
723
726
  return M.value = {
724
727
  left: `${l.left}px`,
@@ -732,17 +735,17 @@ const bn = {
732
735
  const { target: t } = e;
733
736
  if (!(t instanceof Element)) return;
734
737
  const n = t.closest('[data-business-token][data-key="order_note"]');
735
- n && (!(e.relatedTarget instanceof Node) || !n.contains(e.relatedTarget)) && q();
738
+ n && (!(e.relatedTarget instanceof Node) || !n.contains(e.relatedTarget)) && _();
736
739
  }
737
740
  Le(F);
738
741
  let K = !1, B = null;
739
- const x = Y(null);
742
+ const I = Y(null);
740
743
  let P = null, H = null;
741
744
  function ee() {
742
745
  P = null, H !== null && cancelAnimationFrame(H), H = null;
743
746
  }
744
747
  function z() {
745
- ee(), B = null, x.value = null;
748
+ ee(), B = null, I.value = null;
746
749
  }
747
750
  function ve(e) {
748
751
  e.key === "Escape" && z();
@@ -752,8 +755,8 @@ const bn = {
752
755
  const e = Ee({
753
756
  clientX: P.x,
754
757
  clientY: P.y
755
- }), t = e === null ? null : Me(e, "file"), n = x.value;
756
- (t == null ? void 0 : t.pos) === (n == null ? void 0 : n.pos) && (t == null ? void 0 : t.top) === (n == null ? void 0 : n.top) && (t == null ? void 0 : t.left) === (n == null ? void 0 : n.left) && (t == null ? void 0 : t.width) === (n == null ? void 0 : n.width) && (t == null ? void 0 : t.kind) === (n == null ? void 0 : n.kind) || (x.value = t);
758
+ }), t = e === null ? null : Me(e, "file"), n = I.value;
759
+ (t == null ? void 0 : t.pos) === (n == null ? void 0 : n.pos) && (t == null ? void 0 : t.top) === (n == null ? void 0 : n.top) && (t == null ? void 0 : t.left) === (n == null ? void 0 : n.left) && (t == null ? void 0 : t.width) === (n == null ? void 0 : n.width) && (t == null ? void 0 : t.kind) === (n == null ? void 0 : n.kind) || (I.value = t);
757
760
  }
758
761
  ne(
759
762
  () => s.editable,
@@ -763,40 +766,40 @@ const bn = {
763
766
  );
764
767
  function Ae() {
765
768
  H = null;
766
- const e = g.value, t = P;
769
+ const e = p.value, t = P;
767
770
  if (!e || !t || !s.editable) return;
768
- const n = e.getBoundingClientRect(), r = Math.min(40, n.height / 3);
769
- if (r <= 0) return;
770
- const l = t.y < n.top + r ? -Math.ceil(12 * Math.min(1, (n.top + r - t.y) / r)) : t.y > n.bottom - r ? Math.ceil(12 * Math.min(1, (t.y - n.bottom + r) / r)) : 0, f = e.scrollHeight - e.clientHeight;
771
+ const n = e.getBoundingClientRect(), a = Math.min(40, n.height / 3);
772
+ if (a <= 0) return;
773
+ const l = t.y < n.top + a ? -Math.ceil(12 * Math.min(1, (n.top + a - t.y) / a)) : t.y > n.bottom - a ? Math.ceil(12 * Math.min(1, (t.y - n.bottom + a) / a)) : 0, f = e.scrollHeight - e.clientHeight;
771
774
  if (!l || f <= 0) return;
772
- const y = Math.max(0, Math.min(f, e.scrollTop + l));
773
- y !== e.scrollTop && (e.scrollTop = y, H = requestAnimationFrame(Ae));
775
+ const k = Math.max(0, Math.min(f, e.scrollTop + l));
776
+ k !== e.scrollTop && (e.scrollTop = k, H = requestAnimationFrame(Ae));
774
777
  }
775
778
  function tt() {
776
- u.value = null, P ? se() : x.value = null;
779
+ u.value = null, P ? se() : I.value = null;
777
780
  }
778
781
  let te = null, ie = !1;
779
- const Se = `[data-business-token]:is(${Wt.map(
782
+ const Te = `[data-business-token]:is(${Wt.map(
780
783
  (e) => `[data-kind="${e}"]`
781
784
  ).join(", ")})`;
782
785
  function G(e) {
783
- const t = k.get(e);
784
- t && (URL.revokeObjectURL(t), k.delete(e));
786
+ const t = y.get(e);
787
+ t && (URL.revokeObjectURL(t), y.delete(e));
785
788
  }
786
789
  function le(e) {
787
- return !s.editable || !(e.target instanceof Element) ? null : e.target.closest(Se);
790
+ return !s.editable || !(e.target instanceof Element) ? null : e.target.closest(Te);
788
791
  }
789
792
  function nt(e) {
790
793
  const t = le(e);
791
- !t || e.relatedTarget instanceof Node && t.contains(e.relatedTarget) || Te(t);
794
+ !t || e.relatedTarget instanceof Node && t.contains(e.relatedTarget) || Se(t);
792
795
  }
793
796
  function rt(e) {
794
797
  const t = le(e);
795
- t && (!(e.relatedTarget instanceof Node) || !t.contains(e.relatedTarget)) && m("leave-choice");
798
+ t && (!(e.relatedTarget instanceof Node) || !t.contains(e.relatedTarget)) && g("leave-choice");
796
799
  }
797
- function Te(e) {
800
+ function Se(e) {
798
801
  const { nodeId: t } = e.dataset;
799
- !t || !i.value || i.value.state.doc.descendants((n) => n.type.name !== "businessToken" || n.attrs.id !== t ? !0 : (en(n.attrs.kind) && m("choice-menu", {
802
+ !t || !i.value || i.value.state.doc.descendants((n) => n.type.name !== "businessToken" || n.attrs.id !== t ? !0 : (en(n.attrs.kind) && g("choice-menu", {
800
803
  nodeId: t,
801
804
  nodeVersion: Number(n.attrs.nodeVersion) || 0,
802
805
  key: String(n.attrs.key),
@@ -810,31 +813,31 @@ const bn = {
810
813
  if (!(t instanceof Element)) return;
811
814
  const n = le(e);
812
815
  if (n) {
813
- Te(n);
816
+ Se(n);
814
817
  return;
815
818
  }
816
- const r = t.closest(
819
+ const a = t.closest(
817
820
  '[data-business-token][data-kind="tool"]'
818
821
  );
819
- r && (u.value = null);
820
- const l = r == null ? void 0 : r.dataset.nodeId;
822
+ a && (u.value = null);
823
+ const l = a == null ? void 0 : a.dataset.nodeId;
821
824
  l && i.value.state.doc.descendants((f) => {
822
825
  if (f.type.name !== "businessToken" || f.attrs.id !== l)
823
826
  return !0;
824
- const { params: y } = f.attrs;
825
- return m("edit-tool", {
827
+ const { params: k } = f.attrs;
828
+ return g("edit-tool", {
826
829
  nodeId: l,
827
830
  nodeVersion: Number(f.attrs.nodeVersion) || 0,
828
831
  key: String(f.attrs.key),
829
832
  label: String(f.attrs.label || f.attrs.key),
830
- params: y && typeof y == "object" && !Array.isArray(y) ? y : null
833
+ params: k && typeof k == "object" && !Array.isArray(k) ? k : null
831
834
  }), !1;
832
835
  });
833
836
  }
834
837
  function ot(e) {
835
838
  if (!s.editable || !i.value) return;
836
839
  const { target: t } = e;
837
- if (t === g.value || t === i.value.view.dom.parentElement) {
840
+ if (t === p.value || t === i.value.view.dom.parentElement) {
838
841
  i.value.commands.focus("end");
839
842
  return;
840
843
  }
@@ -842,7 +845,7 @@ const bn = {
842
845
  }
843
846
  function Ce() {
844
847
  var e;
845
- (e = g.value) == null || e.querySelectorAll(Se).forEach(
848
+ (e = p.value) == null || e.querySelectorAll(Te).forEach(
846
849
  (t) => t.classList.toggle(
847
850
  "is-menu-open",
848
851
  !!s.activeChoiceId && t.dataset.nodeId === s.activeChoiceId
@@ -856,18 +859,18 @@ const bn = {
856
859
  function st(e) {
857
860
  var n;
858
861
  const t = e.target instanceof Element ? e.target.closest(".fk-media[data-drag-handle]") : null;
859
- !s.editable || !(t != null && t.dataset.mediaId) || (B = t.dataset.mediaId, x.value = null, (n = e.dataTransfer) == null || n.setData("application/x-fkp-media-id", B), e.dataTransfer && (e.dataTransfer.effectAllowed = "move"), e.stopPropagation());
862
+ !s.editable || !(t != null && t.dataset.mediaId) || (B = t.dataset.mediaId, I.value = null, (n = e.dataTransfer) == null || n.setData("application/x-fkp-media-id", B), e.dataTransfer && (e.dataTransfer.effectAllowed = "move"), e.stopPropagation());
860
863
  }
861
864
  function Me(e, t) {
862
- const n = i.value, r = g.value;
863
- if (!n || !r) return null;
864
- const { doc: l } = n.state, f = e === l.content.size, y = l.lastChild, p = f && y ? e - y.nodeSize : e, h = n.view.nodeDOM(p);
865
- if (!(h instanceof HTMLElement)) return null;
866
- const A = h.getBoundingClientRect(), C = r.getBoundingClientRect();
865
+ const n = i.value, a = p.value;
866
+ if (!n || !a) return null;
867
+ const { doc: l } = n.state, f = e === l.content.size, k = l.lastChild, m = f && k ? e - k.nodeSize : e, b = n.view.nodeDOM(m);
868
+ if (!(b instanceof HTMLElement)) return null;
869
+ const A = b.getBoundingClientRect(), C = a.getBoundingClientRect();
867
870
  return {
868
- top: (f ? A.bottom : A.top) - C.top + r.scrollTop,
869
- left: r.scrollLeft,
870
- width: r.clientWidth || C.right - C.left,
871
+ top: (f ? A.bottom : A.top) - C.top + a.scrollTop,
872
+ left: a.scrollLeft,
873
+ width: a.clientWidth || C.right - C.left,
871
874
  pos: e,
872
875
  kind: t
873
876
  };
@@ -875,42 +878,42 @@ const bn = {
875
878
  function Ee(e) {
876
879
  const t = i.value;
877
880
  if (!t) return null;
878
- const { view: n } = t, r = n.posAtCoords({ left: e.clientX, top: e.clientY });
879
- if (!r) {
881
+ const { view: n } = t, a = n.posAtCoords({ left: e.clientX, top: e.clientY });
882
+ if (!a) {
880
883
  const C = n.dom.children;
881
- let E = 0, I = C.length;
882
- for (; E < I; ) {
883
- const V = Math.floor((E + I) / 2), R = C[V].getBoundingClientRect();
884
- e.clientY > R.top + R.height / 2 ? E = V + 1 : I = V;
884
+ let E = 0, x = C.length;
885
+ for (; E < x; ) {
886
+ const V = Math.floor((E + x) / 2), R = C[V].getBoundingClientRect();
887
+ e.clientY > R.top + R.height / 2 ? E = V + 1 : x = V;
885
888
  }
886
889
  if (E === C.length) return n.state.doc.content.size;
887
890
  const J = n.state.doc.resolve(n.posAtDOM(C[E], 0));
888
891
  return J.depth ? J.before(1) : J.pos;
889
892
  }
890
- const { doc: l } = n.state, f = l.resolve(r.pos);
891
- let y = f.depth ? f.before(1) : r.pos;
892
- y === l.content.size && l.lastChild && (y -= l.lastChild.nodeSize);
893
- const p = l.nodeAt(y), h = n.nodeDOM(y);
894
- if (!p || !(h instanceof HTMLElement)) return null;
895
- const A = h.getBoundingClientRect();
896
- return e.clientY > A.top + A.height / 2 ? y + p.nodeSize : y;
893
+ const { doc: l } = n.state, f = l.resolve(a.pos);
894
+ let k = f.depth ? f.before(1) : a.pos;
895
+ k === l.content.size && l.lastChild && (k -= l.lastChild.nodeSize);
896
+ const m = l.nodeAt(k), b = n.nodeDOM(k);
897
+ if (!m || !(b instanceof HTMLElement)) return null;
898
+ const A = b.getBoundingClientRect();
899
+ return e.clientY > A.top + A.height / 2 ? k + m.nodeSize : k;
897
900
  }
898
901
  function Ne(e, t) {
899
902
  const n = i.value;
900
903
  if (!n) return null;
901
- const r = /* @__PURE__ */ new Map();
904
+ const a = /* @__PURE__ */ new Map();
902
905
  n.state.doc.descendants((A, C) => {
903
- A.type.name === "mediaBlock" && typeof A.attrs.id == "string" && r.set(A.attrs.id, { pos: C, size: A.nodeSize });
906
+ A.type.name === "mediaBlock" && typeof A.attrs.id == "string" && a.set(A.attrs.id, { pos: C, size: A.nodeSize });
904
907
  });
905
- const l = r.get(t);
908
+ const l = a.get(t);
906
909
  if (!l) return null;
907
- const f = e.target instanceof Element ? e.target.closest(".fk-media[data-media-id]") : null, y = f == null ? void 0 : f.dataset.mediaId;
908
- if (y === t) return null;
909
- const p = y ? r.get(y) : void 0;
910
- let h;
911
- if (p && f) {
912
- const A = l.pos < p.pos;
913
- h = p.pos + (A ? p.size : 0);
910
+ const f = e.target instanceof Element ? e.target.closest(".fk-media[data-media-id]") : null, k = f == null ? void 0 : f.dataset.mediaId;
911
+ if (k === t) return null;
912
+ const m = k ? a.get(k) : void 0;
913
+ let b;
914
+ if (m && f) {
915
+ const A = l.pos < m.pos;
916
+ b = m.pos + (A ? m.size : 0);
914
917
  } else {
915
918
  const A = n.view.posAtCoords({
916
919
  left: e.clientX,
@@ -918,13 +921,13 @@ const bn = {
918
921
  });
919
922
  if (!A) return null;
920
923
  const C = [0];
921
- n.state.doc.forEach((E, I) => {
922
- C.push(I + E.nodeSize);
923
- }), h = C.reduce(
924
- (E, I) => Math.abs(I - A.pos) < Math.abs(E - A.pos) ? I : E
924
+ n.state.doc.forEach((E, x) => {
925
+ C.push(x + E.nodeSize);
926
+ }), b = C.reduce(
927
+ (E, x) => Math.abs(x - A.pos) < Math.abs(E - A.pos) ? x : E
925
928
  );
926
929
  }
927
- return h === l.pos || h === l.pos + l.size ? null : { source: l, insertion: h };
930
+ return b === l.pos || b === l.pos + l.size ? null : { source: l, insertion: b };
928
931
  }
929
932
  function it(e) {
930
933
  var t;
@@ -932,65 +935,65 @@ const bn = {
932
935
  if (B) {
933
936
  e.preventDefault(), e.stopPropagation(), e.dataTransfer && (e.dataTransfer.dropEffect = "move");
934
937
  const n = Ne(e, B);
935
- x.value = n ? Me(n.insertion, "media") : null;
938
+ I.value = n ? Me(n.insertion, "media") : null;
936
939
  return;
937
940
  }
938
941
  !s.schemaPlan.mediaBlock || !Array.from(((t = e.dataTransfer) == null ? void 0 : t.types) || []).includes("Files") || (e.preventDefault(), e.stopPropagation(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"), P = { x: e.clientX, y: e.clientY }, se(), H === null && (H = requestAnimationFrame(Ae)));
939
942
  }
940
943
  }
941
944
  function lt(e) {
942
- var p;
945
+ var m;
943
946
  ee();
944
947
  const t = B;
945
948
  if (!t) {
946
- (p = e.dataTransfer) != null && p.files.length || (x.value = null);
949
+ (m = e.dataTransfer) != null && m.files.length || (I.value = null);
947
950
  return;
948
951
  }
949
- B = null, x.value = null, e.preventDefault(), e.stopPropagation();
952
+ B = null, I.value = null, e.preventDefault(), e.stopPropagation();
950
953
  const n = i.value;
951
954
  if (!s.editable || !n || n.isDestroyed) return;
952
- const r = Ne(e, t);
953
- if (!r) return;
954
- const { source: l, insertion: f } = r, y = n.state.doc.nodeAt(l.pos);
955
- if (!(!y || y.type.name !== "mediaBlock"))
955
+ const a = Ne(e, t);
956
+ if (!a) return;
957
+ const { source: l, insertion: f } = a, k = n.state.doc.nodeAt(l.pos);
958
+ if (!(!k || k.type.name !== "mediaBlock"))
956
959
  try {
957
- const h = n.state.tr.delete(
960
+ const b = n.state.tr.delete(
958
961
  l.pos,
959
962
  l.pos + l.size
960
963
  );
961
- h.insert(h.mapping.map(f), y), h.setMeta("uiEvent", "drop"), h.setMeta(_, [t]), n.view.dispatch(h);
964
+ b.insert(b.mapping.map(f), k), b.setMeta("uiEvent", "drop"), b.setMeta(U, [t]), n.view.dispatch(b);
962
965
  } catch {
963
966
  }
964
967
  }
965
968
  function ct(e) {
966
- const t = g.value;
967
- if (!t || !x.value || e.relatedTarget instanceof Node && t.contains(e.relatedTarget))
969
+ const t = p.value;
970
+ if (!t || !I.value || e.relatedTarget instanceof Node && t.contains(e.relatedTarget))
968
971
  return;
969
972
  const n = t.getBoundingClientRect();
970
- e.clientX >= n.left && e.clientX <= n.right && e.clientY >= n.top && e.clientY <= n.bottom || (ee(), x.value = null);
973
+ e.clientX >= n.left && e.clientX <= n.right && e.clientY >= n.top && e.clientY <= n.bottom || (ee(), I.value = null);
971
974
  }
972
975
  function dt() {
973
976
  z();
974
977
  }
975
978
  function ce(e) {
976
- const t = /* @__PURE__ */ new Set(), n = (r) => {
979
+ const t = /* @__PURE__ */ new Set(), n = (a) => {
977
980
  var l, f;
978
- r.type === "mediaBlock" && typeof ((l = r.attrs) == null ? void 0 : l.id) == "string" && t.add(r.attrs.id), (f = r.content) == null || f.forEach(n);
981
+ a.type === "mediaBlock" && typeof ((l = a.attrs) == null ? void 0 : l.id) == "string" && t.add(a.attrs.id), (f = a.content) == null || f.forEach(n);
979
982
  };
980
983
  n(e);
981
- for (const r of k.keys()) t.has(r) || G(r);
984
+ for (const a of y.keys()) t.has(a) || G(a);
982
985
  }
983
986
  function we(e) {
984
987
  i.value = new Vt({
985
988
  content: s.modelValue,
986
989
  editable: s.editable,
987
990
  extensions: [
988
- _t.configure({
991
+ Ut.configure({
989
992
  heading: !1,
990
993
  dropcursor: { color: "#4884e4", width: 2 },
991
994
  link: { openOnClick: !1, isAllowedUri: (t) => Z(t) }
992
995
  }),
993
- qt.configure({
996
+ _t.configure({
994
997
  placeholder: () => s.referencePlaceholder ? "" : s.placeholder || s.documentAdapter.placeholder
995
998
  }),
996
999
  an,
@@ -1009,21 +1012,21 @@ const bn = {
1009
1012
  }
1010
1013
  },
1011
1014
  onUpdate: ({ editor: t }) => {
1012
- b.value = t.isEmpty;
1015
+ h.value = t.isEmpty;
1013
1016
  const n = t.getJSON();
1014
- ce(n), c || m("update:modelValue", n);
1017
+ ce(n), c || g("update:modelValue", n);
1015
1018
  }
1016
- }), b.value = i.value.isEmpty, T(!0), Ce(), ze();
1019
+ }), h.value = i.value.isEmpty, S(!0), Ce(), ze();
1017
1020
  }
1018
1021
  Bt(() => {
1019
1022
  if (document.addEventListener("keydown", ve), document.addEventListener("dragend", z), document.addEventListener("drop", z), !s.schemaPlan.mediaBlock) {
1020
1023
  we([]);
1021
1024
  return;
1022
1025
  }
1023
- import("./media-extensions-wlcCEdtg.js").then(({ MediaBlock: e }) => {
1026
+ import("./media-extensions-YYbGuUQa.js").then(({ MediaBlock: e }) => {
1024
1027
  K || we([e.configure({ sceneStyle: !0 })]);
1025
1028
  }).catch(() => {
1026
- K || (v.value = !0, T(!1), m("load-error", "媒体编辑器加载失败,请刷新页面重试"));
1029
+ K || (v.value = !0, S(!1), g("load-error", "媒体编辑器加载失败,请刷新页面重试"));
1027
1030
  });
1028
1031
  }), ne(
1029
1032
  () => s.editable,
@@ -1034,40 +1037,40 @@ const bn = {
1034
1037
  ), ne(
1035
1038
  () => s.modelValue,
1036
1039
  (e) => {
1037
- if (i.value && _e(e) !== _e(i.value.getJSON())) {
1040
+ if (i.value && Ue(e) !== Ue(i.value.getJSON())) {
1038
1041
  const t = Oe();
1039
- i.value.chain().setMeta(_, oe(e)).setContent(e, { emitUpdate: !1 }).run(), b.value = i.value.isEmpty, ce(e), P && se(), t && Pe(i.value, t);
1042
+ i.value.chain().setMeta(U, oe(e)).setContent(e, { emitUpdate: !1 }).run(), h.value = i.value.isEmpty, ce(e), P && se(), t && Pe(i.value, t);
1040
1043
  }
1041
1044
  },
1042
1045
  { deep: !0 }
1043
1046
  ), Le(() => {
1044
1047
  var e;
1045
- K = !0, T(!1), document.removeEventListener("keydown", ve), document.removeEventListener("dragend", z), document.removeEventListener("drop", z), z();
1046
- for (const t of k.keys()) G(t);
1048
+ K = !0, S(!1), document.removeEventListener("keydown", ve), document.removeEventListener("dragend", z), document.removeEventListener("drop", z), z();
1049
+ for (const t of y.keys()) G(t);
1047
1050
  (e = i.value) == null || e.destroy();
1048
1051
  });
1049
- function de(e, t, n, r, l) {
1052
+ function de(e, t, n, a, l) {
1050
1053
  var f;
1051
1054
  return !s.editable || !s.schemaPlan.businessToken ? !1 : !!((f = i.value) != null && f.chain().focus().insertContent([
1052
- { type: "businessToken", attrs: { kind: e, key: t, label: n, token: r, params: l } },
1055
+ { type: "businessToken", attrs: { kind: e, key: t, label: n, token: a, params: l } },
1053
1056
  { type: "text", text: " " }
1054
1057
  ]).run());
1055
1058
  }
1056
- function ut(e, t, n, r) {
1059
+ function ut(e, t, n, a) {
1057
1060
  const l = i.value;
1058
1061
  if (!s.editable || !s.schemaPlan.businessToken || !l)
1059
1062
  return !1;
1060
1063
  const f = [];
1061
- if (l.state.doc.descendants((h, A) => {
1062
- h.type.name === "businessToken" && h.attrs.kind === e && h.attrs.key === t && f.push(A);
1064
+ if (l.state.doc.descendants((b, A) => {
1065
+ b.type.name === "businessToken" && b.attrs.kind === e && b.attrs.key === t && f.push(A);
1063
1066
  }), f.length > 1) return !1;
1064
- if (!f.length) return de(e, t, n, void 0, r);
1065
- const y = f[0], p = l.state.doc.nodeAt(y);
1066
- return p ? (l.view.dispatch(
1067
- l.state.tr.setNodeMarkup(y, void 0, {
1068
- ...p.attrs,
1069
- params: r,
1070
- nodeVersion: Number(p.attrs.nodeVersion || 0) + 1
1067
+ if (!f.length) return de(e, t, n, void 0, a);
1068
+ const k = f[0], m = l.state.doc.nodeAt(k);
1069
+ return m ? (l.view.dispatch(
1070
+ l.state.tr.setNodeMarkup(k, void 0, {
1071
+ ...m.attrs,
1072
+ params: a,
1073
+ nodeVersion: Number(m.attrs.nodeVersion || 0) + 1
1071
1074
  })
1072
1075
  ), !0) : !1;
1073
1076
  }
@@ -1076,19 +1079,19 @@ const bn = {
1076
1079
  const e = i.value;
1077
1080
  if (!e) return !1;
1078
1081
  e.commands.focus();
1079
- const { from: t, to: n } = e.state.selection, r = e.commands.insertContentAt(
1082
+ const { from: t, to: n } = e.state.selection, a = e.commands.insertContentAt(
1080
1083
  { from: t, to: n },
1081
1084
  { type: "originalReply", content: [{ type: "paragraph" }] }
1082
1085
  );
1083
- return r && Ie(), r;
1086
+ return a && xe(), a;
1084
1087
  }
1085
1088
  function pt() {
1086
1089
  return de("separator", "separator", "分隔符", "{分隔符}");
1087
1090
  }
1088
1091
  function mt(e, t) {
1089
- var r;
1092
+ var a;
1090
1093
  const n = i.value;
1091
- return !s.editable || !n || !((r = s.documentAdapter.extensions) != null && r.some(
1094
+ return !s.editable || !n || !((a = s.documentAdapter.extensions) != null && a.some(
1092
1095
  (l) => l.name === e
1093
1096
  )) ? !1 : n.chain().focus().insertContent([
1094
1097
  { type: e, attrs: t },
@@ -1097,74 +1100,75 @@ const bn = {
1097
1100
  }
1098
1101
  function gt(e, t = "lastCaret", n = !1) {
1099
1102
  var l;
1100
- const r = i.value;
1101
- if (!s.editable || !r || !e) return !1;
1103
+ const a = i.value;
1104
+ if (!s.editable || !a || !e) return !1;
1102
1105
  if (t === "end") {
1103
- const f = r.state.doc.childCount === 1 && ((l = r.state.doc.firstChild) == null ? void 0 : l.isTextblock) && r.state.doc.firstChild.content.size === 0, y = f ? 0 : r.state.doc.content.size, p = e.split(/\r\n?|\n/u).map((h) => ({
1106
+ const f = a.state.doc.childCount === 1 && ((l = a.state.doc.firstChild) == null ? void 0 : l.isTextblock) && a.state.doc.firstChild.content.size === 0, k = f ? 0 : a.state.doc.content.size, m = e.split(/\r\n?|\n/u).map((b) => ({
1104
1107
  type: "paragraph",
1105
- ...h ? { content: [{ type: "text", text: h }] } : {}
1108
+ ...b ? { content: [{ type: "text", text: b }] } : {}
1106
1109
  }));
1107
- if (!r.commands.insertContentAt(
1108
- f ? { from: 0, to: r.state.doc.content.size } : y,
1109
- p
1110
+ if (!a.commands.insertContentAt(
1111
+ f ? { from: 0, to: a.state.doc.content.size } : k,
1112
+ m
1110
1113
  ))
1111
1114
  return !1;
1112
1115
  if (n) {
1113
- const h = r.state.doc.content.size;
1114
- r.commands.setTextSelection({
1115
- from: Math.min(y + 1, h),
1116
- to: Math.max(y + 1, h - 1)
1116
+ const b = a.state.doc.content.size;
1117
+ a.commands.setTextSelection({
1118
+ from: Math.min(k + 1, b),
1119
+ to: Math.max(k + 1, b - 1)
1117
1120
  });
1118
1121
  }
1119
- return r.commands.focus(), !0;
1122
+ return a.commands.focus(), !0;
1120
1123
  }
1121
- return r.chain().focus().insertContent(e).run();
1124
+ return a.chain().focus().insertContent(e).run();
1122
1125
  }
1123
- function Ie() {
1126
+ function xe() {
1124
1127
  const e = i.value;
1125
1128
  if (!e) return;
1126
1129
  const t = e.state.selection.from;
1127
1130
  let n = null;
1128
- e.state.doc.descendants((r, l) => {
1129
- r.type.name === "originalReply" && l < t && (n = l);
1131
+ e.state.doc.descendants((a, l) => {
1132
+ a.type.name === "originalReply" && l < t && (n = l);
1130
1133
  }), n !== null && e.commands.setTextSelection(n + 2);
1131
1134
  }
1132
- function xe(e, t, n) {
1135
+ function Ie(e, t, n) {
1133
1136
  if (!s.editable || !i.value || !e.length) return null;
1134
1137
  c = !0;
1135
1138
  try {
1136
- const r = t.insert(e);
1137
- return r && e.some((l) => l.type === "originalReply") && Ie(), r && n && i.value.commands.focus(), r ? i.value.getJSON() : null;
1139
+ const a = t.insert(e);
1140
+ return a && e.some((l) => l.type === "originalReply") && xe(), a && n && i.value.commands.focus(), a ? i.value.getJSON() : null;
1138
1141
  } finally {
1139
1142
  c = !1;
1140
1143
  }
1141
1144
  }
1142
- function kt(e) {
1145
+ function yt(e) {
1143
1146
  if (!(!i.value || i.value.isDestroyed)) {
1144
1147
  c = !0;
1145
1148
  try {
1146
- i.value.chain().setMeta("addToHistory", !1).setMeta(_, oe(e)).setContent(e, { emitUpdate: !1 }).run(), b.value = i.value.isEmpty, ce(e);
1149
+ i.value.chain().setMeta("addToHistory", !1).setMeta(U, oe(e)).setContent(e, { emitUpdate: !1 }).run(), h.value = i.value.isEmpty, ce(e);
1147
1150
  } finally {
1148
1151
  c = !1;
1149
1152
  }
1150
1153
  }
1151
1154
  }
1152
- function yt() {
1155
+ function kt() {
1153
1156
  var t;
1154
- const e = new Set(k.keys());
1157
+ const e = new Set(y.keys());
1155
1158
  return (t = i.value) == null || t.state.doc.descendants((n) => {
1156
1159
  n.attrs.id && e.add(String(n.attrs.id));
1157
- }), ye(e, ae);
1160
+ }), ke(e, ae);
1158
1161
  }
1159
- function ht(e, t, n, r) {
1162
+ function ht(e, t, n, a) {
1160
1163
  if (!s.editable || !s.schemaPlan.mediaBlock) return null;
1161
1164
  const l = [
1162
1165
  {
1163
1166
  type: "mediaBlock",
1164
1167
  attrs: {
1165
- id: yt(),
1168
+ id: kt(),
1166
1169
  nodeVersion: 0,
1167
1170
  assetId: e.id || null,
1171
+ sourceType: e.sourceType || null,
1168
1172
  src: e.url,
1169
1173
  kind: e.kind,
1170
1174
  name: t,
@@ -1174,33 +1178,33 @@ const bn = {
1174
1178
  },
1175
1179
  { type: "paragraph" }
1176
1180
  ];
1177
- return xe(l, n, r);
1181
+ return Ie(l, n, a);
1178
1182
  }
1179
1183
  function bt(e, t, n) {
1180
- var r;
1181
- return ((r = De([{ file: e, kind: t }], n)) == null ? void 0 : r[0]) || null;
1184
+ var a;
1185
+ return ((a = De([{ file: e, kind: t }], n)) == null ? void 0 : a[0]) || null;
1182
1186
  }
1183
1187
  function De(e, t) {
1184
1188
  if (!s.editable || !s.schemaPlan.mediaBlock || !i.value || !e.length)
1185
1189
  return null;
1186
- const n = new Set(k.keys());
1190
+ const n = new Set(y.keys());
1187
1191
  i.value.state.doc.descendants((f) => {
1188
1192
  f.attrs.id && n.add(String(f.attrs.id));
1189
1193
  });
1190
- const r = [], l = [];
1194
+ const a = [], l = [];
1191
1195
  try {
1192
- for (const { file: f, kind: y } of e) {
1193
- const p = ye(n, ae);
1194
- n.add(p);
1195
- const h = URL.createObjectURL(f);
1196
- k.set(p, h), r.push(p), l.push({
1196
+ for (const { file: f, kind: k } of e) {
1197
+ const m = ke(n, ae);
1198
+ n.add(m);
1199
+ const b = URL.createObjectURL(f);
1200
+ y.set(m, b), a.push(m), l.push({
1197
1201
  type: "mediaBlock",
1198
1202
  attrs: {
1199
- id: p,
1203
+ id: m,
1200
1204
  nodeVersion: 0,
1201
1205
  assetId: null,
1202
- src: h,
1203
- kind: y,
1206
+ src: b,
1207
+ kind: k,
1204
1208
  name: f.name,
1205
1209
  poster: null,
1206
1210
  status: "uploading",
@@ -1208,54 +1212,54 @@ const bn = {
1208
1212
  }
1209
1213
  });
1210
1214
  }
1211
- if (l.push({ type: "paragraph" }), t.insert(l)) return r;
1215
+ if (l.push({ type: "paragraph" }), t.insert(l)) return a;
1212
1216
  } catch {
1213
1217
  }
1214
- return r.forEach(G), null;
1218
+ return a.forEach(G), null;
1215
1219
  }
1216
1220
  function ue(e) {
1217
1221
  const t = i.value;
1218
1222
  if (!t || t.isDestroyed) return null;
1219
1223
  let n = null;
1220
- return t.state.doc.descendants((r) => {
1221
- r.type.name === "mediaBlock" && r.attrs.id === e && Number.isSafeInteger(r.attrs.nodeVersion) && r.attrs.nodeVersion >= 0 && (n = {
1222
- kind: r.attrs.kind,
1223
- status: r.attrs.status,
1224
- nodeVersion: r.attrs.nodeVersion
1224
+ return t.state.doc.descendants((a) => {
1225
+ a.type.name === "mediaBlock" && a.attrs.id === e && Number.isSafeInteger(a.attrs.nodeVersion) && a.attrs.nodeVersion >= 0 && (n = {
1226
+ kind: a.attrs.kind,
1227
+ status: a.attrs.status,
1228
+ nodeVersion: a.attrs.nodeVersion
1225
1229
  });
1226
1230
  }), n;
1227
1231
  }
1228
- function fe(e, t, n, r) {
1232
+ function fe(e, t, n, a) {
1229
1233
  const l = i.value;
1230
1234
  if (!l || l.isDestroyed || !Number.isSafeInteger(t) || t < 0 || t >= Number.MAX_SAFE_INTEGER)
1231
1235
  return !1;
1232
1236
  let f = null;
1233
- if (l.state.doc.descendants((p, h) => {
1234
- p.type.name === "mediaBlock" && p.attrs.id === e && (f = h);
1237
+ if (l.state.doc.descendants((m, b) => {
1238
+ m.type.name === "mediaBlock" && m.attrs.id === e && (f = b);
1235
1239
  }), f === null) return !1;
1236
- const y = l.state.doc.nodeAt(f);
1237
- return !y || y.attrs.nodeVersion !== t || y.attrs.status !== n ? !1 : (l.view.dispatch(
1240
+ const k = l.state.doc.nodeAt(f);
1241
+ return !k || k.attrs.nodeVersion !== t || k.attrs.status !== n ? !1 : (l.view.dispatch(
1238
1242
  l.state.tr.setNodeMarkup(f, void 0, {
1239
- ...y.attrs,
1240
- ...r,
1243
+ ...k.attrs,
1244
+ ...a,
1241
1245
  nodeVersion: t + 1
1242
1246
  }).setMeta("addToHistory", !1)
1243
1247
  ), !0);
1244
1248
  }
1245
1249
  function vt(e, t) {
1246
- var y, p, h, A;
1250
+ var k, m, b, A;
1247
1251
  const n = i.value;
1248
1252
  if (!s.editable || !n || n.isDestroyed) return !1;
1249
- let r = null, l = 0;
1253
+ let a = null, l = 0;
1250
1254
  if (n.state.doc.descendants((C, E) => {
1251
- C.type.name === "mediaBlock" && C.attrs.id === e.nodeId && (r = E, l++);
1252
- }), l !== 1 || r === null) return !1;
1253
- const f = n.state.doc.nodeAt(r);
1254
- if (!f || f.attrs.kind !== t || f.attrs.status !== "uploading" || f.attrs.nodeVersion !== e.expectedNodeVersion || e.node.type !== "mediaBlock" || ((y = e.node.attrs) == null ? void 0 : y.id) !== e.nodeId || ((p = e.node.attrs) == null ? void 0 : p.kind) !== t || ((h = e.node.attrs) == null ? void 0 : h.nodeVersion) !== e.expectedNodeVersion + 1)
1255
+ C.type.name === "mediaBlock" && C.attrs.id === e.nodeId && (a = E, l++);
1256
+ }), l !== 1 || a === null) return !1;
1257
+ const f = n.state.doc.nodeAt(a);
1258
+ if (!f || f.attrs.kind !== t || f.attrs.status !== "uploading" || f.attrs.nodeVersion !== e.expectedNodeVersion || e.node.type !== "mediaBlock" || ((k = e.node.attrs) == null ? void 0 : k.id) !== e.nodeId || ((m = e.node.attrs) == null ? void 0 : m.kind) !== t || ((b = e.node.attrs) == null ? void 0 : b.nodeVersion) !== e.expectedNodeVersion + 1)
1255
1259
  return !1;
1256
1260
  try {
1257
1261
  n.view.dispatch(
1258
- n.state.tr.setNodeMarkup(r, void 0, e.node.attrs).setMeta("addToHistory", !1)
1262
+ n.state.tr.setNodeMarkup(a, void 0, e.node.attrs).setMeta("addToHistory", !1)
1259
1263
  );
1260
1264
  } catch {
1261
1265
  return !1;
@@ -1263,37 +1267,37 @@ const bn = {
1263
1267
  return ((A = ue(e.nodeId)) == null ? void 0 : A.status) !== "ready" ? !1 : (G(e.nodeId), !0);
1264
1268
  }
1265
1269
  function Re(e, t) {
1266
- var f, y;
1270
+ var f, k;
1267
1271
  const n = i.value;
1268
1272
  if (!s.editable || !n || n.isDestroyed || !e.length)
1269
1273
  return null;
1270
- const r = /* @__PURE__ */ new Set(), l = [];
1271
- for (const p of e) {
1272
- if (r.has(p.nodeId)) return null;
1273
- r.add(p.nodeId);
1274
- let h = null, A = 0;
1275
- if (n.state.doc.descendants((E, I) => {
1276
- Q(E.type.name) && E.attrs.id === p.nodeId && (h = I, A++);
1277
- }), A !== 1 || h === null) return null;
1278
- const C = n.state.doc.nodeAt(h);
1279
- if (!C || Ue(C.type.name, C.attrs) !== t || C.attrs.nodeVersion !== p.expectedNodeVersion || C.type.name === "originalReply" && tn(C.toJSON()) || p.kind === "updateNode" && (C.type.name === "mediaBlock" || p.node.type !== C.type.name || ((f = p.node.attrs) == null ? void 0 : f.id) !== p.nodeId || ((y = p.node.attrs) == null ? void 0 : y.nodeVersion) !== p.expectedNodeVersion + 1 || Ue(p.node.type, p.node.attrs) !== t))
1274
+ const a = /* @__PURE__ */ new Set(), l = [];
1275
+ for (const m of e) {
1276
+ if (a.has(m.nodeId)) return null;
1277
+ a.add(m.nodeId);
1278
+ let b = null, A = 0;
1279
+ if (n.state.doc.descendants((E, x) => {
1280
+ Q(E.type.name) && E.attrs.id === m.nodeId && (b = x, A++);
1281
+ }), A !== 1 || b === null) return null;
1282
+ const C = n.state.doc.nodeAt(b);
1283
+ if (!C || qe(C.type.name, C.attrs) !== t || C.attrs.nodeVersion !== m.expectedNodeVersion || C.type.name === "originalReply" && tn(C.toJSON()) || m.kind === "updateNode" && (C.type.name === "mediaBlock" || m.node.type !== C.type.name || ((f = m.node.attrs) == null ? void 0 : f.id) !== m.nodeId || ((k = m.node.attrs) == null ? void 0 : k.nodeVersion) !== m.expectedNodeVersion + 1 || qe(m.node.type, m.node.attrs) !== t))
1280
1284
  return null;
1281
- l.push({ plan: p, position: h, size: C.nodeSize });
1285
+ l.push({ plan: m, position: b, size: C.nodeSize });
1282
1286
  }
1283
1287
  try {
1284
- let p = n.state.tr;
1285
- for (const { plan: h, position: A, size: C } of l.sort(
1286
- (E, I) => I.position - E.position
1288
+ let m = n.state.tr;
1289
+ for (const { plan: b, position: A, size: C } of l.sort(
1290
+ (E, x) => x.position - E.position
1287
1291
  ))
1288
- h.kind === "removeNode" ? p = p.delete(A, A + C) : p = p.replaceWith(
1292
+ b.kind === "removeNode" ? m = m.delete(A, A + C) : m = m.replaceWith(
1289
1293
  A,
1290
1294
  A + C,
1291
- n.schema.nodeFromJSON(h.node)
1295
+ n.schema.nodeFromJSON(b.node)
1292
1296
  );
1293
- return p.doc.check(), p.setMeta(
1294
- _,
1295
- e.filter((h) => h.kind === "updateNode").map((h) => h.nodeId)
1296
- ), { transaction: p, requestedIds: r };
1297
+ return m.doc.check(), m.setMeta(
1298
+ U,
1299
+ e.filter((b) => b.kind === "updateNode").map((b) => b.nodeId)
1300
+ ), { transaction: m, requestedIds: a };
1297
1301
  } catch {
1298
1302
  return null;
1299
1303
  }
@@ -1303,33 +1307,33 @@ const bn = {
1303
1307
  return ((n = Re(e, t)) == null ? void 0 : n.transaction.doc.toJSON()) || null;
1304
1308
  }
1305
1309
  function Be(e, t) {
1306
- const n = Re(e, t), r = i.value;
1307
- if (!n || !r || r.isDestroyed) return !1;
1310
+ const n = Re(e, t), a = i.value;
1311
+ if (!n || !a || a.isDestroyed) return !1;
1308
1312
  const { transaction: l, requestedIds: f } = n;
1309
1313
  try {
1310
- r.view.dispatch(l);
1314
+ a.view.dispatch(l);
1311
1315
  } catch {
1312
1316
  return !1;
1313
1317
  }
1314
- const y = /* @__PURE__ */ new Map();
1315
- return r.state.doc.descendants((p) => {
1316
- Q(p.type.name) && f.has(p.attrs.id) && y.set(p.attrs.id, p.attrs.nodeVersion);
1318
+ const k = /* @__PURE__ */ new Map();
1319
+ return a.state.doc.descendants((m) => {
1320
+ Q(m.type.name) && f.has(m.attrs.id) && k.set(m.attrs.id, m.attrs.nodeVersion);
1317
1321
  }), e.every(
1318
- (p) => p.kind === "removeNode" ? !y.has(p.nodeId) : y.get(p.nodeId) === p.expectedNodeVersion + 1
1322
+ (m) => m.kind === "removeNode" ? !k.has(m.nodeId) : k.get(m.nodeId) === m.expectedNodeVersion + 1
1319
1323
  );
1320
1324
  }
1321
- function St(e, t) {
1325
+ function Tt(e, t) {
1322
1326
  return Be([e], t);
1323
1327
  }
1324
- function Tt(e, t, n) {
1328
+ function St(e, t, n) {
1325
1329
  return fe(e, n, "uploading", {
1326
1330
  status: "error",
1327
1331
  error: t
1328
1332
  });
1329
1333
  }
1330
1334
  function Ct(e, t, n) {
1331
- const r = ue(e);
1332
- if ((r == null ? void 0 : r.kind) !== n.kind || !Z(n.url)) return !1;
1335
+ const a = ue(e);
1336
+ if ((a == null ? void 0 : a.kind) !== n.kind || !Z(n.url)) return !1;
1333
1337
  const l = fe(e, t, "uploading", {
1334
1338
  status: "ready",
1335
1339
  src: n.url,
@@ -1346,13 +1350,13 @@ const bn = {
1346
1350
  });
1347
1351
  }
1348
1352
  function Et(e, t, n) {
1349
- const r = i.value;
1350
- if (!r || r.isDestroyed || !Number.isFinite(n))
1353
+ const a = i.value;
1354
+ if (!a || a.isDestroyed || !Number.isFinite(n))
1351
1355
  return !1;
1352
1356
  let l = !1;
1353
- return r.state.doc.descendants((f) => {
1357
+ return a.state.doc.descendants((f) => {
1354
1358
  f.type.name === "mediaBlock" && f.attrs.id === e && f.attrs.status === "uploading" && f.attrs.nodeVersion === t && (l = !0);
1355
- }), l ? (r.view.dom.dispatchEvent(
1359
+ }), l ? (a.view.dom.dispatchEvent(
1356
1360
  new CustomEvent("fkp-media-progress", {
1357
1361
  detail: { id: e, percent: Math.round(Math.max(0, Math.min(100, n))) }
1358
1362
  })
@@ -1361,7 +1365,7 @@ const bn = {
1361
1365
  function Nt(e) {
1362
1366
  var n;
1363
1367
  const t = (n = e.detail) == null ? void 0 : n.id;
1364
- typeof t == "string" && m("retry-media", t);
1368
+ typeof t == "string" && g("retry-media", t);
1365
1369
  }
1366
1370
  function Oe() {
1367
1371
  const e = i.value;
@@ -1369,25 +1373,25 @@ const bn = {
1369
1373
  const { selection: t } = e.state;
1370
1374
  let n;
1371
1375
  if (t instanceof $ && t.empty) {
1372
- const { $from: r } = t, l = r.start();
1373
- if (r.parent.forEach((f, y) => {
1376
+ const { $from: a } = t, l = a.start();
1377
+ if (a.parent.forEach((f, k) => {
1374
1378
  if (f.type.name !== "businessToken" || !f.attrs.id) return;
1375
- const p = t.from - (l + y + f.nodeSize);
1376
- p >= 0 && p <= 1 && (n = {
1379
+ const m = t.from - (l + k + f.nodeSize);
1380
+ m >= 0 && m <= 1 && (n = {
1377
1381
  id: String(f.attrs.id),
1378
1382
  kind: "inlineAfter",
1379
- offset: p
1383
+ offset: m
1380
1384
  });
1381
- }), !n && r.depth >= 1 && r.parent.isTextblock && r.parentOffset <= 1) {
1382
- const f = r.depth - 1, y = r.index(f), p = r.node(f);
1383
- for (let h = y - 1; h >= 0; h--) {
1384
- const A = p.child(h);
1385
+ }), !n && a.depth >= 1 && a.parent.isTextblock && a.parentOffset <= 1) {
1386
+ const f = a.depth - 1, k = a.index(f), m = a.node(f);
1387
+ for (let b = k - 1; b >= 0; b--) {
1388
+ const A = m.child(b);
1385
1389
  if (A.type.name === "mediaBlock" && A.attrs.id) {
1386
1390
  n = {
1387
1391
  id: String(A.attrs.id),
1388
1392
  kind: "blockAfter",
1389
- offset: r.parentOffset,
1390
- siblingOffset: y - h
1393
+ offset: a.parentOffset,
1394
+ siblingOffset: k - b
1391
1395
  };
1392
1396
  break;
1393
1397
  }
@@ -1404,39 +1408,39 @@ const bn = {
1404
1408
  }
1405
1409
  function Pe(e, t) {
1406
1410
  const n = e.state.doc.content.size;
1407
- let r;
1411
+ let a;
1408
1412
  const { nodeCaret: l } = t;
1409
- l && t.from === t.to && e.state.doc.descendants((h, A) => {
1410
- if (h.attrs.id !== l.id) return;
1413
+ l && t.from === t.to && e.state.doc.descendants((b, A) => {
1414
+ if (b.attrs.id !== l.id) return;
1411
1415
  if (l.kind === "inlineAfter") {
1412
- if (h.type.name !== "businessToken") return;
1416
+ if (b.type.name !== "businessToken") return;
1413
1417
  const R = e.state.doc.resolve(A).end();
1414
- r = Math.min(
1415
- A + h.nodeSize + l.offset,
1418
+ a = Math.min(
1419
+ A + b.nodeSize + l.offset,
1416
1420
  R
1417
1421
  );
1418
1422
  return;
1419
1423
  }
1420
- if (h.type.name !== "mediaBlock") return;
1421
- const C = e.state.doc.resolve(A), { parent: E } = C, I = C.index(), J = I + l.siblingOffset, V = E.maybeChild(J);
1424
+ if (b.type.name !== "mediaBlock") return;
1425
+ const C = e.state.doc.resolve(A), { parent: E } = C, x = C.index(), J = x + l.siblingOffset, V = E.maybeChild(J);
1422
1426
  if (V != null && V.isTextblock && Array.from(
1423
1427
  { length: l.siblingOffset - 1 },
1424
- (R, j) => E.child(I + j + 1)
1428
+ (R, j) => E.child(x + j + 1)
1425
1429
  ).every((R) => R.isTextblock && R.content.size === 0)) {
1426
1430
  let R = A;
1427
- for (let j = I; j < J; j++)
1431
+ for (let j = x; j < J; j++)
1428
1432
  R += E.child(j).nodeSize;
1429
- r = Math.min(
1433
+ a = Math.min(
1430
1434
  R + 1 + l.offset,
1431
1435
  R + V.nodeSize - 1
1432
1436
  );
1433
1437
  }
1434
1438
  });
1435
1439
  const f = {
1436
- from: r ?? Math.min(t.from, n),
1437
- to: r ?? Math.min(t.to, n)
1438
- }, y = document.activeElement;
1439
- t.focused && (!y || y === document.body || y === e.view.dom || !y.isConnected) ? e.chain().setTextSelection(f).focus().run() : e.commands.setTextSelection(f);
1440
+ from: a ?? Math.min(t.from, n),
1441
+ to: a ?? Math.min(t.to, n)
1442
+ }, k = document.activeElement;
1443
+ t.focused && (!k || k === document.body || k === e.view.dom || !k.isConnected) ? e.chain().setTextSelection(f).focus().run() : e.commands.setTextSelection(f);
1440
1444
  }
1441
1445
  async function ze() {
1442
1446
  if (!(ie || !te)) {
@@ -1463,7 +1467,7 @@ const bn = {
1463
1467
  function Ve(e) {
1464
1468
  const t = e.clipboardData, n = i.value;
1465
1469
  if (!s.editable || !n || !t) return null;
1466
- const r = () => t.files.length ? Ye(n, n.state.selection.to) : null, l = t.getData("text/html"), { slice: f, handled: y } = yn(
1470
+ const a = () => t.files.length ? Ye(n, n.state.selection.to) : null, l = t.getData("text/html"), { slice: f, handled: k } = kn(
1467
1471
  l,
1468
1472
  n.state.schema,
1469
1473
  s.pasteCapabilities || [],
@@ -1473,12 +1477,12 @@ const bn = {
1473
1477
  if (f)
1474
1478
  return n.view.dispatch(
1475
1479
  n.state.tr.replaceSelection(f).setMeta("uiEvent", "paste")
1476
- ), r();
1477
- if (y) return null;
1478
- const p = t.getData("text/plain");
1479
- return p && n.view.pasteText(p, new Event("paste")), p ? r() : null;
1480
+ ), a();
1481
+ if (k) return null;
1482
+ const m = t.getData("text/plain");
1483
+ return m && n.view.pasteText(m, new Event("paste")), m ? a() : null;
1480
1484
  }
1481
- function It(e) {
1485
+ function xt(e) {
1482
1486
  const t = i.value;
1483
1487
  !t || !e.clipboardData || !(e.target instanceof Element) || !e.target.closest(".fkp-knowledge-document") || pn(
1484
1488
  e.clipboardData,
@@ -1487,7 +1491,7 @@ const bn = {
1487
1491
  s.documentAdapter.clipboard
1488
1492
  ) && (e.preventDefault(), e.stopPropagation());
1489
1493
  }
1490
- function xt(e) {
1494
+ function It(e) {
1491
1495
  var t;
1492
1496
  e.defaultPrevented || (t = e.clipboardData) != null && t.files.length || !(e.target instanceof Element) || !e.target.closest(".fkp-knowledge-document") || (e.preventDefault(), e.stopPropagation(), Ve(e));
1493
1497
  }
@@ -1508,16 +1512,16 @@ const bn = {
1508
1512
  insertText: gt,
1509
1513
  insertOriginal: ft,
1510
1514
  insertSeparator: pt,
1511
- insertBatch: xe,
1512
- restoreDoc: kt,
1515
+ insertBatch: Ie,
1516
+ restoreDoc: yt,
1513
1517
  insertMedia: ht,
1514
1518
  insertPendingMedia: bt,
1515
1519
  insertPendingMediaBatch: De,
1516
1520
  applyNodeUpdate: vt,
1517
- applyPluginNodeOperation: St,
1521
+ applyPluginNodeOperation: Tt,
1518
1522
  applyPluginNodeOperations: Be,
1519
1523
  previewPluginNodeOperations: At,
1520
- failMedia: Tt,
1524
+ failMedia: St,
1521
1525
  completeMedia: Ct,
1522
1526
  retryMedia: Mt,
1523
1527
  getMediaState: ue,
@@ -1525,7 +1529,7 @@ const bn = {
1525
1529
  captureSelection: Oe,
1526
1530
  restoreSelection: wt,
1527
1531
  captureMediaTarget: () => i.value ? hn(i.value) : null,
1528
- whenReady: () => S,
1532
+ whenReady: () => T,
1529
1533
  captureEndTarget: () => {
1530
1534
  var n;
1531
1535
  const e = i.value;
@@ -1534,8 +1538,8 @@ const bn = {
1534
1538
  return (n = t.lastChild) != null && n.isTextblock ? Xe(e, t.content.size - 1) : Ye(e, t.content.size);
1535
1539
  },
1536
1540
  captureMediaTargetAt: (e, t) => {
1537
- const n = i.value, r = n ? Ee({ clientX: e, clientY: t }) : null;
1538
- return ee(), x.value = null, n && r !== null ? Xe(n, r) : null;
1541
+ const n = i.value, a = n ? Ee({ clientX: e, clientY: t }) : null;
1542
+ return ee(), I.value = null, n && a !== null ? Xe(n, a) : null;
1539
1543
  },
1540
1544
  focus: () => {
1541
1545
  var e;
@@ -1545,10 +1549,10 @@ const bn = {
1545
1549
  var e;
1546
1550
  return (e = i.value) == null ? void 0 : e.getJSON();
1547
1551
  }
1548
- }), (e, t) => v.value ? (L(), U("div", bn, "媒体编辑器加载失败,请刷新页面重试")) : (L(), U("div", {
1552
+ }), (e, t) => v.value ? (L(), q("div", bn, "媒体编辑器加载失败,请刷新页面重试")) : (L(), q("div", {
1549
1553
  key: 1,
1550
1554
  ref_key: "areaRoot",
1551
- ref: g,
1555
+ ref: p,
1552
1556
  class: "fkp-knowledge-area",
1553
1557
  onFkpMediaRetry: Nt,
1554
1558
  onClick: ot,
@@ -1559,14 +1563,14 @@ const bn = {
1559
1563
  rt(n), O(n);
1560
1564
  }),
1561
1565
  onFocusin: w,
1562
- onFocusout: q,
1566
+ onFocusout: _,
1563
1567
  onDragstartCapture: st,
1564
1568
  onDragoverCapture: it,
1565
1569
  onDragleaveCapture: ct,
1566
1570
  onDropCapture: lt,
1567
1571
  onDragendCapture: dt,
1568
- onCopyCapture: It,
1569
- onPasteCapture: xt,
1572
+ onCopyCapture: xt,
1573
+ onPasteCapture: It,
1570
1574
  onScrollCapture: tt
1571
1575
  }, [
1572
1576
  Fe(W(zt), {
@@ -1593,16 +1597,16 @@ const bn = {
1593
1597
  D("div", {
1594
1598
  class: "fkp-order-remark-detail",
1595
1599
  onMouseenter: F,
1596
- onMouseleave: q
1600
+ onMouseleave: _
1597
1601
  }, [
1598
1602
  D("div", vn, [
1599
1603
  t[2] || (t[2] = D("strong", null, "订单备注", -1)),
1600
- u.value.contentMode === "smart" ? (L(), U("span", An, "智能提取")) : re("", !0)
1604
+ u.value.contentMode === "smart" ? (L(), q("span", An, "智能提取")) : re("", !0)
1601
1605
  ]),
1602
- D("div", Sn, He(u.value.content), 1),
1603
- D("div", Tn, [
1606
+ D("div", Tn, He(u.value.content), 1),
1607
+ D("div", Sn, [
1604
1608
  t[3] || (t[3] = D("span", null, "备注插旗", -1)),
1605
- u.value.flag === "none" ? (L(), U("span", Cn, "不标记")) : (L(), U("span", {
1609
+ u.value.flag === "none" ? (L(), q("span", Cn, "不标记")) : (L(), q("span", {
1606
1610
  key: 1,
1607
1611
  class: "fkp-order-remark-detail-flag",
1608
1612
  role: "img",
@@ -1626,17 +1630,17 @@ const bn = {
1626
1630
  ]),
1627
1631
  _: 1
1628
1632
  })) : re("", !0),
1629
- x.value ? (L(), U("div", {
1633
+ I.value ? (L(), q("div", {
1630
1634
  key: 1,
1631
1635
  class: "fkp-media-drop-line",
1632
1636
  style: me({
1633
- top: `${x.value.top}px`,
1634
- left: `${x.value.left}px`,
1635
- width: `${x.value.width}px`
1637
+ top: `${I.value.top}px`,
1638
+ left: `${I.value.left}px`,
1639
+ width: `${I.value.width}px`
1636
1640
  }),
1637
1641
  "aria-hidden": "true"
1638
1642
  }, null, 4)) : re("", !0),
1639
- e.referencePlaceholder && b.value ? (L(), U("div", Nn, [
1643
+ e.referencePlaceholder && h.value ? (L(), q("div", Nn, [
1640
1644
  t[6] || (t[6] = D("span", { class: "fkp-reference-bracket" }, "<", -1)),
1641
1645
  Fe(W($t), {
1642
1646
  color: "arcoblue",