@freecallai/pro 0.0.11 → 0.0.13

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 (60) hide show
  1. package/README.md +23 -2
  2. package/dist/{FkpRichText.vue_vue_type_script_setup_true_lang-D2sgT7XP.js → FkpRichText.vue_vue_type_script_setup_true_lang-D-SOdFra.js} +1811 -1781
  3. package/dist/{KnowledgeArea-Sbfs_E0C.js → KnowledgeArea-ClZoLiaZ.js} +1 -1
  4. package/dist/KnowledgeArea.vue_vue_type_script_setup_true_lang-CoFF-WCe.js +1830 -0
  5. package/dist/{ToolForm-_ZTW7lwU.js → ToolForm-BK9epxdr.js} +1 -1
  6. package/dist/agent-prompt-editor/index.js +575 -549
  7. package/dist/agent-prompt-editor/legacy-converter/index.js +98 -94
  8. package/dist/{choice-BqjECVyx.js → choice-UgePgrSl.js} +1 -1
  9. package/dist/{guard-BmLOamCj.js → guard-DPwe4mCm.js} +200 -185
  10. package/dist/{index-gS1h8iW8.js → index-BIi3k45j.js} +1 -1
  11. package/dist/index-BMHUPL5x.js +5 -0
  12. package/dist/{index-B1rTu0jX.js → index-CaA13lC9.js} +1 -1
  13. package/dist/{index-6VSUucFX.js → index-ChuzFuNm.js} +1 -1
  14. package/dist/index-DJLfgC4v.js +5 -0
  15. package/dist/{index-0BXLYaKG.js → index-DfKH-RZq.js} +2 -2
  16. package/dist/{index-CN2knQcE.js → index-DiLMgNEe.js} +1 -1
  17. package/dist/{index-BDinNJn_.js → index-RHu4JIw7.js} +1 -1
  18. package/dist/{index-CCwmXuSJ.js → index-v1UD08i6.js} +1 -1
  19. package/dist/index.js +3 -3
  20. package/dist/{inline-CRGzAti7.js → inline-CVF1zEsG.js} +1 -1
  21. package/dist/{knowledge-DNDouB-s.js → knowledge-DWM6tWnP.js} +1 -1
  22. package/dist/media-extensions-YYbGuUQa.js +341 -0
  23. package/dist/{media-migration-D1KoHKoP.js → media-migration-BctCLEuT.js} +1 -1
  24. package/dist/media-policy-B1UuSN2e.js +215 -0
  25. package/dist/{media-upload-C5N6YWHu.js → media-upload-DtH-oCtw.js} +1 -1
  26. package/dist/{model-BVh9EZ9G.js → model-VLLhEQfn.js} +1 -1
  27. package/dist/rich-text/index.js +6 -6
  28. package/dist/rich-text/legacy-converter/index.js +357 -355
  29. package/dist/style.css +1 -1
  30. package/dist/types/agent-prompt-editor/FkpAgentPromptEditor.vue.d.ts +37 -2
  31. package/dist/types/agent-prompt-editor/index.d.ts +1 -0
  32. package/dist/types/agent-prompt-editor/types.d.ts +4 -0
  33. package/dist/types/filters/FkpFilter.vue.d.ts +2 -2
  34. package/dist/types/filters/FkpFilterDateRange.vue.d.ts +2 -2
  35. package/dist/types/filters/FkpFilterPeriod.vue.d.ts +2 -2
  36. package/dist/types/filters/FkpSearchableMultiSelect.vue.d.ts +2 -2
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/rich-text/FkpRichText.vue.d.ts +20 -2
  39. package/dist/types/rich-text/index.d.ts +1 -0
  40. package/dist/types/rich-text/model/qianniu-video.d.ts +2 -0
  41. package/dist/types/rich-text/plugins/attribute/token.d.ts +1 -0
  42. package/dist/types/rich-text/plugins/tableKnowledge/token.d.ts +1 -0
  43. package/dist/types/rich-text/plugins/ticket/token.d.ts +2 -1
  44. package/dist/types/rich-text/plugins/token-catalog.d.ts +4 -1
  45. package/dist/types/rich-text/plugins/token-definition.d.ts +2 -0
  46. package/dist/types/rich-text/public/types.d.ts +7 -2
  47. package/dist/types/rich-text/runtime/document-adapter.d.ts +3 -0
  48. package/dist/types/rich-text/runtime/media-sources.d.ts +1 -1
  49. package/dist/types/rich-text/runtime/tag-validity.d.ts +46 -0
  50. package/dist/types/rich-text/ui/FkpKnowledgeTypePicker.vue.d.ts +2 -2
  51. package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +10 -0
  52. package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +23 -14
  53. package/dist/types/rich-text/ui/ToolForm.vue.d.ts +2 -2
  54. package/dist/types/switcher/FkpSwitcher.vue.d.ts +2 -2
  55. package/package.json +5 -4
  56. package/dist/KnowledgeArea.vue_vue_type_script_setup_true_lang-BNDRTWXW.js +0 -1659
  57. package/dist/index-CAczgwau.js +0 -5
  58. package/dist/index-faGbB8v6.js +0 -5
  59. package/dist/media-extensions-wlcCEdtg.js +0 -324
  60. package/dist/media-policy-D3-Qglzz.js +0 -158
@@ -1,1659 +0,0 @@
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";
2
- import { EditorContent as zt, Editor as Vt } from "@tiptap/vue-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";
7
- import { Extension as Kt, Node as he } from "@tiptap/core";
8
- import { DOMSerializer as je, DOMParser as Jt } from "@tiptap/pm/model";
9
- import { DecorationSet as Yt, Decoration as ge } from "@tiptap/pm/view";
10
- import { c as ae } from "./media-id-b2dgniSy.js";
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) {
15
- const d = (c) => [
16
- `http://www.w3.org/2000/svg ${c.tag}`,
17
- c.attrs,
18
- ...c.children.map(d)
19
- ], s = Xt[a];
20
- return [
21
- "http://www.w3.org/2000/svg svg",
22
- {
23
- ...s.attrs,
24
- class: `fkp-icon ${o}`,
25
- "aria-hidden": "true",
26
- focusable: "false"
27
- },
28
- ...s.children.map(d)
29
- ];
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) => [
34
- "span",
35
- { class: i },
36
- s
37
- ];
38
- let m = [s];
39
- return (o == null ? void 0 : o.layout) === "choice" && (m = [
40
- X(o.icon, `fkp-choice-token-icon fkp-${d}-token-icon`),
41
- c(`fkp-choice-token-label fkp-${d}-token-label`),
42
- X(
43
- "arrow-down",
44
- `fkp-choice-token-arrow fkp-${d}-token-arrow`
45
- )
46
- ]), (o == null ? void 0 : o.layout) === "inline" && (m = [
47
- X(o.icon, "fkp-inline-token-icon"),
48
- c("fkp-inline-token-label")
49
- ]), (o == null ? void 0 : o.layout) === "tool" && (m = [
50
- X(o.icon, "fkp-tool-token-icon"),
51
- c("fkp-tool-token-label")
52
- ]), (o == null ? void 0 : o.layout) === "toolNote" && (m = [
53
- X(o.icon, "fkp-tool-note-icon"),
54
- c("fkp-tool-note-label"),
55
- ...o.summary ? [
56
- [
57
- "span",
58
- { class: "fkp-tool-note-divider", "aria-hidden": "true" }
59
- ],
60
- [
61
- "span",
62
- { class: "fkp-tool-note-summary" },
63
- o.summary
64
- ]
65
- ] : []
66
- ]), [
67
- "span",
68
- {
69
- "data-business-token": "",
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 } : {},
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
- contenteditable: "false"
79
- },
80
- ...m
81
- ];
82
- }
83
- function Ze(a) {
84
- var o;
85
- return ((o = be(a.kind)) == null ? void 0 : o.serialize(a)) || String(a.label || a.key || "");
86
- }
87
- const an = Kt.create({
88
- name: "uniqueExtensionNodeIds",
89
- addProseMirrorPlugins() {
90
- return [
91
- new Ge({
92
- appendTransaction(a, o, d) {
93
- if (!a.some((g) => g.docChanged))
94
- return null;
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)
101
- v = M.mapping.mapResult(v, 1).pos;
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);
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);
110
- });
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));
115
- });
116
- const i = /* @__PURE__ */ new Set(), { tr: T } = d, S = a.some(
117
- (g) => g.getMeta("uiEvent") === "drop"
118
- );
119
- return d.doc.descendants((g, b) => {
120
- var N;
121
- if (!Q(g.type.name)) return;
122
- let v = String(g.attrs.id || "");
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,
126
- id: v,
127
- nodeVersion: 0
128
- }), k.add(v)), i.add(v);
129
- }), T.docChanged ? T.setMeta("addToHistory", !1) : null;
130
- }
131
- })
132
- ];
133
- }
134
- }), on = he.create({
135
- name: "businessToken",
136
- group: "inline",
137
- inline: !0,
138
- atom: !0,
139
- selectable: !0,
140
- addAttributes() {
141
- return {
142
- id: { default: "" },
143
- nodeVersion: { default: 0 },
144
- kind: { default: "variable" },
145
- key: { default: "" },
146
- label: { default: "" },
147
- token: { default: null },
148
- params: { default: null }
149
- };
150
- },
151
- parseHTML() {
152
- return [
153
- {
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"),
160
- params: (() => {
161
- const o = a.getAttribute("data-fkp-params");
162
- if (!o || o.length > 8192) return null;
163
- try {
164
- return JSON.parse(o);
165
- } catch {
166
- return null;
167
- }
168
- })()
169
- })
170
- }
171
- ];
172
- },
173
- renderHTML: ({ node: a }) => rn(a.attrs),
174
- renderText: ({ node: a }) => Ze(a.attrs)
175
- }), qe = new Ft(
176
- "inlineReplyNeighbors"
177
- );
178
- function Ke(a) {
179
- const o = [];
180
- a.forEach((s, c) => {
181
- o.push({ node: s, position: c });
182
- });
183
- const d = /* @__PURE__ */ new Set();
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, [
190
- ...o.filter(({ node: s }) => s.type.name === "originalReply").map(
191
- ({ position: s }) => ge.widget(
192
- s + 1,
193
- () => {
194
- const c = document.createElement("span");
195
- return c.className = "fkp-original-reply-label", c.setAttribute("aria-hidden", "true"), c.append(
196
- je.renderSpec(document, X("quote", "")).dom
197
- ), c;
198
- },
199
- { side: -1, ignoreSelection: !0 }
200
- )
201
- ),
202
- ...[...d].flatMap((s) => {
203
- const c = a.nodeAt(s), m = ge.node(
204
- s,
205
- s + c.nodeSize,
206
- {
207
- class: c.content.size ? "fk-inline-reply-neighbor" : "fk-inline-reply-neighbor fk-inline-reply-neighbor--empty"
208
- }
209
- );
210
- return c.content.size ? [m] : [
211
- m,
212
- ge.widget(
213
- s + 1,
214
- () => {
215
- const k = document.createElement("span");
216
- return k.className = "fkp-reply-caret-anchor", k.setAttribute("aria-hidden", "true"), k.textContent = "​", k;
217
- },
218
- { side: -1, ignoreSelection: !0 }
219
- )
220
- ];
221
- })
222
- ]);
223
- }
224
- function Je(a) {
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;
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")
232
- return !1;
233
- const m = (v, u) => {
234
- const M = d.tr.delete(v, v + u.nodeSize);
235
- return M.setSelection(
236
- $.near(
237
- M.doc.resolve(Math.min(v, M.doc.content.size)),
238
- o ? -1 : 1
239
- )
240
- ), a.dispatch(M.scrollIntoView()), !0;
241
- }, k = c.depth - 1;
242
- if (k < 1 || c.node(k).type.name !== "originalReply") {
243
- if (c.parentOffset !== (o ? 0 : c.parent.content.size))
244
- return !1;
245
- const v = o ? c.before() : c.after(), u = d.doc.resolve(v), M = o ? u.nodeBefore : u.nodeAfter;
246
- if ((M == null ? void 0 : M.type.name) !== "originalReply") return !1;
247
- const N = o ? v - M.nodeSize : v;
248
- return Je(M) ? m(N, M) : (a.dispatch(
249
- d.tr.setSelection(Ht.create(d.doc, N)).scrollIntoView()
250
- ), !0);
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))
255
- return !1;
256
- const T = c.parent.textContent;
257
- if ((typeof Intl.Segmenter == "function" ? [
258
- ...new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(
259
- T
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;
264
- }
265
- const sn = he.create({
266
- name: "originalReply",
267
- group: "block",
268
- content: "(paragraph | mediaBlock | messageSeparator)+",
269
- defining: !0,
270
- isolating: !0,
271
- addAttributes() {
272
- return { id: { default: "" }, nodeVersion: { default: 0 } };
273
- },
274
- parseHTML() {
275
- return [{ tag: "section[data-original-reply]" }];
276
- },
277
- renderHTML() {
278
- return [
279
- "section",
280
- {
281
- "data-original-reply": "",
282
- "data-fkp-node": "original-reply",
283
- class: "fk-original-reply"
284
- },
285
- 0
286
- ];
287
- },
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))
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;
298
- let u;
299
- if ((v == null ? void 0 : v.type) === k)
300
- u = o === 1 ? g + 1 : g - 1;
301
- else {
302
- const M = b.index();
303
- if (!b.parent.canReplaceWith(M, M, k))
304
- return !1;
305
- i.insert(g, k.create()), u = g + 1;
306
- }
307
- i.setSelection($.create(i.doc, u));
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;
314
- i.setSelection($.create(i.doc, u));
315
- }
316
- return s.dispatch(i.scrollIntoView()), !0;
317
- };
318
- return {
319
- Backspace: () => ke(this.editor.view, !0),
320
- Delete: () => ke(this.editor.view, !1),
321
- ArrowLeft: () => a(-1),
322
- ArrowRight: () => a(1)
323
- };
324
- },
325
- addProseMirrorPlugins() {
326
- return [
327
- new Ge({
328
- key: qe,
329
- state: {
330
- init: (a, o) => Ke(o.doc),
331
- apply: (a, o) => a.docChanged ? Ke(a.doc) : o
332
- },
333
- props: {
334
- handleDOMEvents: {
335
- beforeinput: (a, o) => {
336
- if (!o.cancelable || o.isComposing) return !1;
337
- const d = o.inputType === "deleteContentBackward";
338
- return !d && o.inputType !== "deleteContentForward" || !ke(a, d) ? !1 : (o.preventDefault(), !0);
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))
343
- return !1;
344
- const d = o.target.closest("p");
345
- if (!d || !a.dom.contains(d) || !((m = d.parentElement) != null && m.matches(
346
- "section[data-original-reply]"
347
- )))
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)
353
- )
354
- ), a.focus(), !0);
355
- }
356
- },
357
- decorations(a) {
358
- return qe.getState(a);
359
- }
360
- }
361
- })
362
- ];
363
- }
364
- }), ln = he.create({
365
- name: "messageSeparator",
366
- group: "block",
367
- atom: !0,
368
- selectable: !0,
369
- addAttributes() {
370
- return { id: { default: "" }, nodeVersion: { default: 0 } };
371
- },
372
- parseHTML() {
373
- return [{ tag: "div[data-message-separator]" }];
374
- },
375
- renderHTML() {
376
- return [
377
- "div",
378
- {
379
- "data-message-separator": "",
380
- "data-fkp-node": "message-separator",
381
- class: "fk-message-separator"
382
- },
383
- [
384
- "span",
385
- {
386
- class: "fk-separator-tag fkp-knowledge-tag fkp-knowledge-tag--primary"
387
- },
388
- "分隔符"
389
- ]
390
- ];
391
- },
392
- renderText() {
393
- return `
394
- {分隔符}
395
- `;
396
- }
397
- }), cn = 1024 * 1024, dn = 1e4, un = /* @__PURE__ */ new Set([
398
- "SCRIPT",
399
- "STYLE",
400
- "SVG",
401
- "IFRAME",
402
- "OBJECT",
403
- "TEMPLATE"
404
- ]), fn = /* @__PURE__ */ new Set([
405
- "P",
406
- "DIV",
407
- "BLOCKQUOTE",
408
- "UL",
409
- "OL",
410
- "LI"
411
- ]);
412
- function pn(a, o, d, s) {
413
- if (!o.content.size) return !1;
414
- const c = document.createElement("div");
415
- c.appendChild(
416
- je.fromSchema(d).serializeFragment(o.content)
417
- );
418
- const m = o.content.textBetween(
419
- 0,
420
- o.content.size,
421
- `
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" ? "{分隔符}" : "";
431
- }
432
- );
433
- try {
434
- return a.setData("text/plain", m), a.setData("text/html", c.innerHTML), !0;
435
- } catch {
436
- return !1;
437
- }
438
- }
439
- function mn(a, o, d, s) {
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`))
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;
448
- try {
449
- const u = JSON.parse(T);
450
- if (!u || typeof u != "object" || Array.isArray(u))
451
- return null;
452
- S = u;
453
- } catch {
454
- return null;
455
- }
456
- }
457
- if (c === "tool" && (!S || m === "small_payment" && !jt(S.amount) || m === "order_note" && !We(S)) || Qe({
458
- type: "doc",
459
- content: [
460
- { type: "paragraph", content: [{ type: "businessToken", attrs: { kind: c, key: m, label: k, token: i, params: S } }] }
461
- ]
462
- }))
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;
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");
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))
474
- try {
475
- k = decodeURIComponent(
476
- new URL(m).pathname.split("/").pop() || ""
477
- );
478
- } catch {
479
- k = "";
480
- }
481
- const i = [
482
- a.getAttribute("data-name"),
483
- (g = a.querySelector("figcaption")) == null ? void 0 : g.textContent,
484
- s.getAttribute("alt"),
485
- k
486
- ].filter((b) => !!(b != null && b.trim())).map((b) => b.trim().toLowerCase());
487
- if (!i.length) return !1;
488
- const T = o.findIndex(
489
- (b, v) => {
490
- var u;
491
- return !d.has(v) && ((u = nn(b)) == null ? void 0 : u.kind) === c && i.includes(b.name.toLowerCase());
492
- }
493
- );
494
- return T < 0 ? !1 : (d.add(T), !0);
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))
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 = {
502
- id: ae(),
503
- kind: s,
504
- src: c,
505
- name: k,
506
- status: "ready",
507
- ...m ? { poster: m } : {},
508
- ...i ? { assetId: i } : {}
509
- };
510
- if (Qe({
511
- type: "doc",
512
- content: [{ type: "mediaBlock", attrs: T }]
513
- }))
514
- 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;
521
- }
522
- function yn(a, o, d, s = [], c) {
523
- var v;
524
- if (!a || a.length > cn)
525
- return { slice: null, handled: !1 };
526
- const m = new Set(
527
- d.map((u) => `${u.id}:${u.slot}`)
528
- ), k = new DOMParser().parseFromString(
529
- a.replace(
530
- /<video\b((?:[^"'<>]|"[^"]*"|'[^']*')*)\/>/giu,
531
- "<video$1></video>"
532
- ),
533
- "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)
539
- throw new Error("Clipboard HTML is too large");
540
- if (u.nodeType === Node.TEXT_NODE)
541
- return document.createTextNode(u.textContent || "");
542
- if (!(u instanceof Element) || un.has(u.tagName))
543
- return null;
544
- const N = (q = c == null ? void 0 : c.sanitizeInlineNode) == null ? void 0 : q.call(c, u);
545
- if (N !== void 0)
546
- return N || (g = !0), N;
547
- if (u.hasAttribute("data-agent-size-chart"))
548
- return g = !0, null;
549
- if (u.getAttribute("data-fkp-node") === "business-token") {
550
- const w = mn(u, m, M, c);
551
- return w || (g = !0), w;
552
- }
553
- 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;
558
- }
559
- if (u.getAttribute("data-fkp-node") === "message-separator") {
560
- if (!m.has("separator:knowledgeInline"))
561
- return g = !0, null;
562
- const w = document.createElement("div");
563
- return w.setAttribute("data-message-separator", ""), w;
564
- }
565
- if (u.getAttribute("data-fkp-node") === "original-reply") {
566
- const w = m.has("originalReply:knowledgeBlock");
567
- w || (g = !0);
568
- const O = w ? document.createElement("section") : document.createDocumentFragment();
569
- return O instanceof HTMLElement && O.setAttribute("data-original-reply", ""), u.childNodes.forEach((K) => {
570
- const B = b(K, w);
571
- B && O.appendChild(B);
572
- }), O;
573
- }
574
- 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;
576
- const F = fn.has(u.tagName) ? document.createElement(u.tagName.toLowerCase()) : u.tagName === "BR" ? document.createElement("br") : document.createDocumentFragment();
577
- return u.childNodes.forEach((w) => {
578
- const O = b(w, M);
579
- O && F.appendChild(O);
580
- }), F;
581
- };
582
- try {
583
- if (k.body.childNodes.forEach((M) => {
584
- const N = b(M);
585
- N && i.appendChild(N);
586
- }), !((v = i.textContent) != null && v.trim()) && !i.querySelector(
587
- "figure, [data-message-separator], [data-original-reply]"
588
- ))
589
- return { slice: null, handled: g };
590
- const u = Jt.fromSchema(o).parseSlice(i, {
591
- preserveWhitespace: !0
592
- });
593
- return u.content.size ? { slice: u, handled: !0 } : { slice: null, handled: g };
594
- } catch {
595
- return { slice: null, handled: !1 };
596
- }
597
- }
598
- function hn(a) {
599
- return et(a, a.state.selection.getBookmark());
600
- }
601
- function Ye(a, o) {
602
- if (a.isDestroyed || !Number.isInteger(o) || o < 0 || o > a.state.doc.content.size)
603
- return null;
604
- let d = o, s = !0, c = !0;
605
- const m = ({ transaction: k }) => {
606
- const i = k.mapping.mapResult(d, 1);
607
- i.deletedAcross && (c = !1), d = i.pos;
608
- };
609
- return a.on("transaction", m), {
610
- status() {
611
- return !s || a.isDestroyed ? "disposed" : c ? "ready" : "lost";
612
- },
613
- insert(k) {
614
- if (!s || !c || a.isDestroyed) return !1;
615
- try {
616
- return a.chain().setMeta(_, oe(k)).insertContentAt(d, k).run();
617
- } catch {
618
- return !1;
619
- }
620
- },
621
- dispose() {
622
- s && (s = !1, a.off("transaction", m));
623
- }
624
- };
625
- }
626
- function Xe(a, o) {
627
- if (a.isDestroyed || !Number.isInteger(o) || o < 0 || o > a.state.doc.content.size)
628
- return null;
629
- try {
630
- const d = Ut.near(
631
- a.state.doc.resolve(o)
632
- ).getBookmark();
633
- return et(a, d);
634
- } catch {
635
- return null;
636
- }
637
- }
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);
643
- };
644
- return a.on("transaction", T), {
645
- status() {
646
- return !s || a.isDestroyed ? "disposed" : c ? "ready" : "lost";
647
- },
648
- insert(S) {
649
- if (!s || !c || a.isDestroyed) return !1;
650
- try {
651
- const g = d.resolve(a.state.doc);
652
- m = !0;
653
- try {
654
- return a.chain().setMeta(_, oe(S)).insertContentAt(
655
- { from: g.from, to: g.to },
656
- S
657
- ).run();
658
- } finally {
659
- m = !1;
660
- }
661
- } catch {
662
- return !1;
663
- }
664
- },
665
- dispose() {
666
- s && (s = !1, a.off("transaction", T));
667
- }
668
- };
669
- }
670
- const bn = {
671
- key: 0,
672
- class: "fkp-knowledge-area",
673
- role: "alert"
674
- }, vn = { class: "fkp-order-remark-detail-title" }, An = {
675
- key: 0,
676
- 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 = {
678
- key: 2,
679
- class: "fkp-reference-placeholder",
680
- "aria-hidden": "true"
681
- }, Hn = /* @__PURE__ */ Dt({
682
- __name: "KnowledgeArea",
683
- props: {
684
- modelValue: {},
685
- editable: { type: Boolean },
686
- placeholder: {},
687
- referencePlaceholder: { type: Boolean },
688
- schemaPlan: {},
689
- pasteCapabilities: {},
690
- activeChoiceId: {},
691
- documentAdapter: {}
692
- },
693
- emits: ["update:modelValue", "retry-media", "load-error", "edit-tool", "choice-menu", "leave-choice"],
694
- setup(a, { expose: o, emit: d }) {
695
- const s = a;
696
- let c = !1;
697
- const m = d, k = /* @__PURE__ */ new Map(), i = Rt();
698
- let T = () => {
699
- };
700
- const S = new Promise((e) => {
701
- T = e;
702
- }), g = Y(), b = Y(!0), v = Y(!1), u = Y(null), M = Y({});
703
- let N = null;
704
- function F() {
705
- N && clearTimeout(N), N = null;
706
- }
707
- function q() {
708
- F(), N = setTimeout(() => {
709
- u.value = null;
710
- }, 150);
711
- }
712
- function w(e) {
713
- const { target: t } = e;
714
- if (!(t instanceof Element) || !i.value) return;
715
- const n = t.closest(
716
- '[data-business-token][data-key="order_note"]'
717
- );
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)
720
- return !0;
721
- u.value = We(r.attrs.params) ? r.attrs.params : null;
722
- const l = n.getBoundingClientRect();
723
- return M.value = {
724
- left: `${l.left}px`,
725
- top: `${l.top}px`,
726
- width: `${l.width}px`,
727
- height: `${l.height}px`
728
- }, !1;
729
- }));
730
- }
731
- function O(e) {
732
- const { target: t } = e;
733
- if (!(t instanceof Element)) return;
734
- const n = t.closest('[data-business-token][data-key="order_note"]');
735
- n && (!(e.relatedTarget instanceof Node) || !n.contains(e.relatedTarget)) && q();
736
- }
737
- Le(F);
738
- let K = !1, B = null;
739
- const x = Y(null);
740
- let P = null, H = null;
741
- function ee() {
742
- P = null, H !== null && cancelAnimationFrame(H), H = null;
743
- }
744
- function z() {
745
- ee(), B = null, x.value = null;
746
- }
747
- function ve(e) {
748
- e.key === "Escape" && z();
749
- }
750
- function se() {
751
- if (!P) return;
752
- const e = Ee({
753
- clientX: P.x,
754
- 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);
757
- }
758
- ne(
759
- () => s.editable,
760
- (e) => {
761
- e || z();
762
- }
763
- );
764
- function Ae() {
765
- H = null;
766
- const e = g.value, t = P;
767
- 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
- 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));
774
- }
775
- function tt() {
776
- u.value = null, P ? se() : x.value = null;
777
- }
778
- let te = null, ie = !1;
779
- const Se = `[data-business-token]:is(${Wt.map(
780
- (e) => `[data-kind="${e}"]`
781
- ).join(", ")})`;
782
- function G(e) {
783
- const t = k.get(e);
784
- t && (URL.revokeObjectURL(t), k.delete(e));
785
- }
786
- function le(e) {
787
- return !s.editable || !(e.target instanceof Element) ? null : e.target.closest(Se);
788
- }
789
- function nt(e) {
790
- const t = le(e);
791
- !t || e.relatedTarget instanceof Node && t.contains(e.relatedTarget) || Te(t);
792
- }
793
- function rt(e) {
794
- const t = le(e);
795
- t && (!(e.relatedTarget instanceof Node) || !t.contains(e.relatedTarget)) && m("leave-choice");
796
- }
797
- function Te(e) {
798
- 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", {
800
- nodeId: t,
801
- nodeVersion: Number(n.attrs.nodeVersion) || 0,
802
- key: String(n.attrs.key),
803
- kind: n.attrs.kind,
804
- anchor: e
805
- }), !1));
806
- }
807
- function at(e) {
808
- if (!s.editable || !i.value) return;
809
- const { target: t } = e;
810
- if (!(t instanceof Element)) return;
811
- const n = le(e);
812
- if (n) {
813
- Te(n);
814
- return;
815
- }
816
- const r = t.closest(
817
- '[data-business-token][data-kind="tool"]'
818
- );
819
- r && (u.value = null);
820
- const l = r == null ? void 0 : r.dataset.nodeId;
821
- l && i.value.state.doc.descendants((f) => {
822
- if (f.type.name !== "businessToken" || f.attrs.id !== l)
823
- return !0;
824
- const { params: y } = f.attrs;
825
- return m("edit-tool", {
826
- nodeId: l,
827
- nodeVersion: Number(f.attrs.nodeVersion) || 0,
828
- key: String(f.attrs.key),
829
- label: String(f.attrs.label || f.attrs.key),
830
- params: y && typeof y == "object" && !Array.isArray(y) ? y : null
831
- }), !1;
832
- });
833
- }
834
- function ot(e) {
835
- if (!s.editable || !i.value) return;
836
- const { target: t } = e;
837
- if (t === g.value || t === i.value.view.dom.parentElement) {
838
- i.value.commands.focus("end");
839
- return;
840
- }
841
- at(e);
842
- }
843
- function Ce() {
844
- var e;
845
- (e = g.value) == null || e.querySelectorAll(Se).forEach(
846
- (t) => t.classList.toggle(
847
- "is-menu-open",
848
- !!s.activeChoiceId && t.dataset.nodeId === s.activeChoiceId
849
- )
850
- );
851
- }
852
- ne(
853
- [() => s.activeChoiceId, () => s.modelValue],
854
- () => void $e(Ce)
855
- );
856
- function st(e) {
857
- var n;
858
- 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());
860
- }
861
- 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();
867
- 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
- pos: e,
872
- kind: t
873
- };
874
- }
875
- function Ee(e) {
876
- const t = i.value;
877
- if (!t) return null;
878
- const { view: n } = t, r = n.posAtCoords({ left: e.clientX, top: e.clientY });
879
- if (!r) {
880
- 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;
885
- }
886
- if (E === C.length) return n.state.doc.content.size;
887
- const J = n.state.doc.resolve(n.posAtDOM(C[E], 0));
888
- return J.depth ? J.before(1) : J.pos;
889
- }
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;
897
- }
898
- function Ne(e, t) {
899
- const n = i.value;
900
- if (!n) return null;
901
- const r = /* @__PURE__ */ new Map();
902
- 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 });
904
- });
905
- const l = r.get(t);
906
- 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);
914
- } else {
915
- const A = n.view.posAtCoords({
916
- left: e.clientX,
917
- top: e.clientY
918
- });
919
- if (!A) return null;
920
- 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
925
- );
926
- }
927
- return h === l.pos || h === l.pos + l.size ? null : { source: l, insertion: h };
928
- }
929
- function it(e) {
930
- var t;
931
- if (s.editable) {
932
- if (B) {
933
- e.preventDefault(), e.stopPropagation(), e.dataTransfer && (e.dataTransfer.dropEffect = "move");
934
- const n = Ne(e, B);
935
- x.value = n ? Me(n.insertion, "media") : null;
936
- return;
937
- }
938
- !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
- }
940
- }
941
- function lt(e) {
942
- var p;
943
- ee();
944
- const t = B;
945
- if (!t) {
946
- (p = e.dataTransfer) != null && p.files.length || (x.value = null);
947
- return;
948
- }
949
- B = null, x.value = null, e.preventDefault(), e.stopPropagation();
950
- const n = i.value;
951
- 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"))
956
- try {
957
- const h = n.state.tr.delete(
958
- l.pos,
959
- l.pos + l.size
960
- );
961
- h.insert(h.mapping.map(f), y), h.setMeta("uiEvent", "drop"), h.setMeta(_, [t]), n.view.dispatch(h);
962
- } catch {
963
- }
964
- }
965
- function ct(e) {
966
- const t = g.value;
967
- if (!t || !x.value || e.relatedTarget instanceof Node && t.contains(e.relatedTarget))
968
- return;
969
- 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);
971
- }
972
- function dt() {
973
- z();
974
- }
975
- function ce(e) {
976
- const t = /* @__PURE__ */ new Set(), n = (r) => {
977
- 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);
979
- };
980
- n(e);
981
- for (const r of k.keys()) t.has(r) || G(r);
982
- }
983
- function we(e) {
984
- i.value = new Vt({
985
- content: s.modelValue,
986
- editable: s.editable,
987
- extensions: [
988
- _t.configure({
989
- heading: !1,
990
- dropcursor: { color: "#4884e4", width: 2 },
991
- link: { openOnClick: !1, isAllowedUri: (t) => Z(t) }
992
- }),
993
- qt.configure({
994
- placeholder: () => s.referencePlaceholder ? "" : s.placeholder || s.documentAdapter.placeholder
995
- }),
996
- an,
997
- ...s.schemaPlan.businessToken ? [on] : [],
998
- ...s.schemaPlan.originalReply ? [sn] : [],
999
- ...s.schemaPlan.separator ? [ln] : [],
1000
- ...s.documentAdapter.extensions || [],
1001
- ...e
1002
- ],
1003
- editorProps: {
1004
- attributes: {
1005
- class: "fkp-knowledge-document",
1006
- role: "textbox",
1007
- "aria-label": s.documentAdapter.ariaLabel,
1008
- "aria-multiline": "true"
1009
- }
1010
- },
1011
- onUpdate: ({ editor: t }) => {
1012
- b.value = t.isEmpty;
1013
- const n = t.getJSON();
1014
- ce(n), c || m("update:modelValue", n);
1015
- }
1016
- }), b.value = i.value.isEmpty, T(!0), Ce(), ze();
1017
- }
1018
- Bt(() => {
1019
- if (document.addEventListener("keydown", ve), document.addEventListener("dragend", z), document.addEventListener("drop", z), !s.schemaPlan.mediaBlock) {
1020
- we([]);
1021
- return;
1022
- }
1023
- import("./media-extensions-wlcCEdtg.js").then(({ MediaBlock: e }) => {
1024
- K || we([e.configure({ sceneStyle: !0 })]);
1025
- }).catch(() => {
1026
- K || (v.value = !0, T(!1), m("load-error", "媒体编辑器加载失败,请刷新页面重试"));
1027
- });
1028
- }), ne(
1029
- () => s.editable,
1030
- (e) => {
1031
- var t;
1032
- return (t = i.value) == null ? void 0 : t.setEditable(e);
1033
- }
1034
- ), ne(
1035
- () => s.modelValue,
1036
- (e) => {
1037
- if (i.value && _e(e) !== _e(i.value.getJSON())) {
1038
- 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);
1040
- }
1041
- },
1042
- { deep: !0 }
1043
- ), Le(() => {
1044
- 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);
1047
- (e = i.value) == null || e.destroy();
1048
- });
1049
- function de(e, t, n, r, l) {
1050
- var f;
1051
- 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 } },
1053
- { type: "text", text: " " }
1054
- ]).run());
1055
- }
1056
- function ut(e, t, n, r) {
1057
- const l = i.value;
1058
- if (!s.editable || !s.schemaPlan.businessToken || !l)
1059
- return !1;
1060
- 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);
1063
- }), 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
1071
- })
1072
- ), !0) : !1;
1073
- }
1074
- function ft() {
1075
- if (!s.editable || !s.schemaPlan.originalReply) return !1;
1076
- const e = i.value;
1077
- if (!e) return !1;
1078
- e.commands.focus();
1079
- const { from: t, to: n } = e.state.selection, r = e.commands.insertContentAt(
1080
- { from: t, to: n },
1081
- { type: "originalReply", content: [{ type: "paragraph" }] }
1082
- );
1083
- return r && Ie(), r;
1084
- }
1085
- function pt() {
1086
- return de("separator", "separator", "分隔符", "{分隔符}");
1087
- }
1088
- function mt(e, t) {
1089
- var r;
1090
- const n = i.value;
1091
- return !s.editable || !n || !((r = s.documentAdapter.extensions) != null && r.some(
1092
- (l) => l.name === e
1093
- )) ? !1 : n.chain().focus().insertContent([
1094
- { type: e, attrs: t },
1095
- { type: "text", text: " " }
1096
- ]).run() || !1;
1097
- }
1098
- function gt(e, t = "lastCaret", n = !1) {
1099
- var l;
1100
- const r = i.value;
1101
- if (!s.editable || !r || !e) return !1;
1102
- 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) => ({
1104
- type: "paragraph",
1105
- ...h ? { content: [{ type: "text", text: h }] } : {}
1106
- }));
1107
- if (!r.commands.insertContentAt(
1108
- f ? { from: 0, to: r.state.doc.content.size } : y,
1109
- p
1110
- ))
1111
- return !1;
1112
- 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)
1117
- });
1118
- }
1119
- return r.commands.focus(), !0;
1120
- }
1121
- return r.chain().focus().insertContent(e).run();
1122
- }
1123
- function Ie() {
1124
- const e = i.value;
1125
- if (!e) return;
1126
- const t = e.state.selection.from;
1127
- let n = null;
1128
- e.state.doc.descendants((r, l) => {
1129
- r.type.name === "originalReply" && l < t && (n = l);
1130
- }), n !== null && e.commands.setTextSelection(n + 2);
1131
- }
1132
- function xe(e, t, n) {
1133
- if (!s.editable || !i.value || !e.length) return null;
1134
- c = !0;
1135
- 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;
1138
- } finally {
1139
- c = !1;
1140
- }
1141
- }
1142
- function kt(e) {
1143
- if (!(!i.value || i.value.isDestroyed)) {
1144
- c = !0;
1145
- try {
1146
- i.value.chain().setMeta("addToHistory", !1).setMeta(_, oe(e)).setContent(e, { emitUpdate: !1 }).run(), b.value = i.value.isEmpty, ce(e);
1147
- } finally {
1148
- c = !1;
1149
- }
1150
- }
1151
- }
1152
- function yt() {
1153
- var t;
1154
- const e = new Set(k.keys());
1155
- return (t = i.value) == null || t.state.doc.descendants((n) => {
1156
- n.attrs.id && e.add(String(n.attrs.id));
1157
- }), ye(e, ae);
1158
- }
1159
- function ht(e, t, n, r) {
1160
- if (!s.editable || !s.schemaPlan.mediaBlock) return null;
1161
- const l = [
1162
- {
1163
- type: "mediaBlock",
1164
- attrs: {
1165
- id: yt(),
1166
- nodeVersion: 0,
1167
- assetId: e.id || null,
1168
- src: e.url,
1169
- kind: e.kind,
1170
- name: t,
1171
- poster: e.posterUrl || null,
1172
- status: "ready"
1173
- }
1174
- },
1175
- { type: "paragraph" }
1176
- ];
1177
- return xe(l, n, r);
1178
- }
1179
- function bt(e, t, n) {
1180
- var r;
1181
- return ((r = De([{ file: e, kind: t }], n)) == null ? void 0 : r[0]) || null;
1182
- }
1183
- function De(e, t) {
1184
- if (!s.editable || !s.schemaPlan.mediaBlock || !i.value || !e.length)
1185
- return null;
1186
- const n = new Set(k.keys());
1187
- i.value.state.doc.descendants((f) => {
1188
- f.attrs.id && n.add(String(f.attrs.id));
1189
- });
1190
- const r = [], l = [];
1191
- 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({
1197
- type: "mediaBlock",
1198
- attrs: {
1199
- id: p,
1200
- nodeVersion: 0,
1201
- assetId: null,
1202
- src: h,
1203
- kind: y,
1204
- name: f.name,
1205
- poster: null,
1206
- status: "uploading",
1207
- error: ""
1208
- }
1209
- });
1210
- }
1211
- if (l.push({ type: "paragraph" }), t.insert(l)) return r;
1212
- } catch {
1213
- }
1214
- return r.forEach(G), null;
1215
- }
1216
- function ue(e) {
1217
- const t = i.value;
1218
- if (!t || t.isDestroyed) return null;
1219
- 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
1225
- });
1226
- }), n;
1227
- }
1228
- function fe(e, t, n, r) {
1229
- const l = i.value;
1230
- if (!l || l.isDestroyed || !Number.isSafeInteger(t) || t < 0 || t >= Number.MAX_SAFE_INTEGER)
1231
- return !1;
1232
- let f = null;
1233
- if (l.state.doc.descendants((p, h) => {
1234
- p.type.name === "mediaBlock" && p.attrs.id === e && (f = h);
1235
- }), 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(
1238
- l.state.tr.setNodeMarkup(f, void 0, {
1239
- ...y.attrs,
1240
- ...r,
1241
- nodeVersion: t + 1
1242
- }).setMeta("addToHistory", !1)
1243
- ), !0);
1244
- }
1245
- function vt(e, t) {
1246
- var y, p, h, A;
1247
- const n = i.value;
1248
- if (!s.editable || !n || n.isDestroyed) return !1;
1249
- let r = null, l = 0;
1250
- 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
- return !1;
1256
- try {
1257
- n.view.dispatch(
1258
- n.state.tr.setNodeMarkup(r, void 0, e.node.attrs).setMeta("addToHistory", !1)
1259
- );
1260
- } catch {
1261
- return !1;
1262
- }
1263
- return ((A = ue(e.nodeId)) == null ? void 0 : A.status) !== "ready" ? !1 : (G(e.nodeId), !0);
1264
- }
1265
- function Re(e, t) {
1266
- var f, y;
1267
- const n = i.value;
1268
- if (!s.editable || !n || n.isDestroyed || !e.length)
1269
- 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))
1280
- return null;
1281
- l.push({ plan: p, position: h, size: C.nodeSize });
1282
- }
1283
- 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
1287
- ))
1288
- h.kind === "removeNode" ? p = p.delete(A, A + C) : p = p.replaceWith(
1289
- A,
1290
- A + C,
1291
- n.schema.nodeFromJSON(h.node)
1292
- );
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
- } catch {
1298
- return null;
1299
- }
1300
- }
1301
- function At(e, t) {
1302
- var n;
1303
- return ((n = Re(e, t)) == null ? void 0 : n.transaction.doc.toJSON()) || null;
1304
- }
1305
- function Be(e, t) {
1306
- const n = Re(e, t), r = i.value;
1307
- if (!n || !r || r.isDestroyed) return !1;
1308
- const { transaction: l, requestedIds: f } = n;
1309
- try {
1310
- r.view.dispatch(l);
1311
- } catch {
1312
- return !1;
1313
- }
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);
1317
- }), e.every(
1318
- (p) => p.kind === "removeNode" ? !y.has(p.nodeId) : y.get(p.nodeId) === p.expectedNodeVersion + 1
1319
- );
1320
- }
1321
- function St(e, t) {
1322
- return Be([e], t);
1323
- }
1324
- function Tt(e, t, n) {
1325
- return fe(e, n, "uploading", {
1326
- status: "error",
1327
- error: t
1328
- });
1329
- }
1330
- 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;
1333
- const l = fe(e, t, "uploading", {
1334
- status: "ready",
1335
- src: n.url,
1336
- assetId: n.id || null,
1337
- poster: n.posterUrl || null,
1338
- error: ""
1339
- });
1340
- return l && G(e), l;
1341
- }
1342
- function Mt(e, t) {
1343
- return fe(e, t, "error", {
1344
- status: "uploading",
1345
- error: ""
1346
- });
1347
- }
1348
- function Et(e, t, n) {
1349
- const r = i.value;
1350
- if (!r || r.isDestroyed || !Number.isFinite(n))
1351
- return !1;
1352
- let l = !1;
1353
- return r.state.doc.descendants((f) => {
1354
- f.type.name === "mediaBlock" && f.attrs.id === e && f.attrs.status === "uploading" && f.attrs.nodeVersion === t && (l = !0);
1355
- }), l ? (r.view.dom.dispatchEvent(
1356
- new CustomEvent("fkp-media-progress", {
1357
- detail: { id: e, percent: Math.round(Math.max(0, Math.min(100, n))) }
1358
- })
1359
- ), !0) : !1;
1360
- }
1361
- function Nt(e) {
1362
- var n;
1363
- const t = (n = e.detail) == null ? void 0 : n.id;
1364
- typeof t == "string" && m("retry-media", t);
1365
- }
1366
- function Oe() {
1367
- const e = i.value;
1368
- if (!e || e.isDestroyed) return null;
1369
- const { selection: t } = e.state;
1370
- let n;
1371
- if (t instanceof $ && t.empty) {
1372
- const { $from: r } = t, l = r.start();
1373
- if (r.parent.forEach((f, y) => {
1374
- if (f.type.name !== "businessToken" || !f.attrs.id) return;
1375
- const p = t.from - (l + y + f.nodeSize);
1376
- p >= 0 && p <= 1 && (n = {
1377
- id: String(f.attrs.id),
1378
- kind: "inlineAfter",
1379
- offset: p
1380
- });
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
- if (A.type.name === "mediaBlock" && A.attrs.id) {
1386
- n = {
1387
- id: String(A.attrs.id),
1388
- kind: "blockAfter",
1389
- offset: r.parentOffset,
1390
- siblingOffset: y - h
1391
- };
1392
- break;
1393
- }
1394
- if (!A.isTextblock || A.content.size > 0) break;
1395
- }
1396
- }
1397
- }
1398
- return {
1399
- from: t.from,
1400
- to: t.to,
1401
- focused: e.isFocused,
1402
- ...n ? { nodeCaret: n } : {}
1403
- };
1404
- }
1405
- function Pe(e, t) {
1406
- const n = e.state.doc.content.size;
1407
- let r;
1408
- const { nodeCaret: l } = t;
1409
- l && t.from === t.to && e.state.doc.descendants((h, A) => {
1410
- if (h.attrs.id !== l.id) return;
1411
- if (l.kind === "inlineAfter") {
1412
- if (h.type.name !== "businessToken") return;
1413
- const R = e.state.doc.resolve(A).end();
1414
- r = Math.min(
1415
- A + h.nodeSize + l.offset,
1416
- R
1417
- );
1418
- return;
1419
- }
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);
1422
- if (V != null && V.isTextblock && Array.from(
1423
- { length: l.siblingOffset - 1 },
1424
- (R, j) => E.child(I + j + 1)
1425
- ).every((R) => R.isTextblock && R.content.size === 0)) {
1426
- let R = A;
1427
- for (let j = I; j < J; j++)
1428
- R += E.child(j).nodeSize;
1429
- r = Math.min(
1430
- R + 1 + l.offset,
1431
- R + V.nodeSize - 1
1432
- );
1433
- }
1434
- });
1435
- 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
- }
1441
- async function ze() {
1442
- if (!(ie || !te)) {
1443
- ie = !0;
1444
- try {
1445
- for (let e = 0; e < 5 && !K; e++) {
1446
- await $e();
1447
- const t = i.value;
1448
- if (!t || t.isDestroyed || !t.view.dom.isConnected)
1449
- continue;
1450
- const n = te;
1451
- if (te = null, !n) return;
1452
- Pe(t, n);
1453
- return;
1454
- }
1455
- } finally {
1456
- ie = !1;
1457
- }
1458
- }
1459
- }
1460
- function wt(e) {
1461
- e && (te = e, ze());
1462
- }
1463
- function Ve(e) {
1464
- const t = e.clipboardData, n = i.value;
1465
- 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(
1467
- l,
1468
- n.state.schema,
1469
- s.pasteCapabilities || [],
1470
- Array.from(t.files),
1471
- s.documentAdapter.clipboard
1472
- );
1473
- if (f)
1474
- return n.view.dispatch(
1475
- 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
- }
1481
- function It(e) {
1482
- const t = i.value;
1483
- !t || !e.clipboardData || !(e.target instanceof Element) || !e.target.closest(".fkp-knowledge-document") || pn(
1484
- e.clipboardData,
1485
- t.state.selection.content(),
1486
- t.state.schema,
1487
- s.documentAdapter.clipboard
1488
- ) && (e.preventDefault(), e.stopPropagation());
1489
- }
1490
- function xt(e) {
1491
- var t;
1492
- 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
- }
1494
- return o({
1495
- pasteClipboardContent: Ve,
1496
- isSelectionInsideOriginalReply: () => {
1497
- const e = i.value;
1498
- if (!e) return !1;
1499
- const { selection: t } = e.state;
1500
- for (let { depth: n } = t.$from; n > 0; n--)
1501
- if (t.$from.node(n).type.name === "originalReply")
1502
- return !0;
1503
- return !1;
1504
- },
1505
- insertToken: de,
1506
- upsertToken: ut,
1507
- insertInlineNode: mt,
1508
- insertText: gt,
1509
- insertOriginal: ft,
1510
- insertSeparator: pt,
1511
- insertBatch: xe,
1512
- restoreDoc: kt,
1513
- insertMedia: ht,
1514
- insertPendingMedia: bt,
1515
- insertPendingMediaBatch: De,
1516
- applyNodeUpdate: vt,
1517
- applyPluginNodeOperation: St,
1518
- applyPluginNodeOperations: Be,
1519
- previewPluginNodeOperations: At,
1520
- failMedia: Tt,
1521
- completeMedia: Ct,
1522
- retryMedia: Mt,
1523
- getMediaState: ue,
1524
- reportMediaProgress: Et,
1525
- captureSelection: Oe,
1526
- restoreSelection: wt,
1527
- captureMediaTarget: () => i.value ? hn(i.value) : null,
1528
- whenReady: () => S,
1529
- captureEndTarget: () => {
1530
- var n;
1531
- const e = i.value;
1532
- if (!e) return null;
1533
- const { doc: t } = e.state;
1534
- return (n = t.lastChild) != null && n.isTextblock ? Xe(e, t.content.size - 1) : Ye(e, t.content.size);
1535
- },
1536
- 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;
1539
- },
1540
- focus: () => {
1541
- var e;
1542
- return (e = i.value) == null ? void 0 : e.commands.focus();
1543
- },
1544
- getJSON: () => {
1545
- var e;
1546
- return (e = i.value) == null ? void 0 : e.getJSON();
1547
- }
1548
- }), (e, t) => v.value ? (L(), U("div", bn, "媒体编辑器加载失败,请刷新页面重试")) : (L(), U("div", {
1549
- key: 1,
1550
- ref_key: "areaRoot",
1551
- ref: g,
1552
- class: "fkp-knowledge-area",
1553
- onFkpMediaRetry: Nt,
1554
- onClick: ot,
1555
- onMouseover: t[0] || (t[0] = (n) => {
1556
- nt(n), w(n);
1557
- }),
1558
- onMouseout: t[1] || (t[1] = (n) => {
1559
- rt(n), O(n);
1560
- }),
1561
- onFocusin: w,
1562
- onFocusout: q,
1563
- onDragstartCapture: st,
1564
- onDragoverCapture: it,
1565
- onDragleaveCapture: ct,
1566
- onDropCapture: lt,
1567
- onDragendCapture: dt,
1568
- onCopyCapture: It,
1569
- onPasteCapture: xt,
1570
- onScrollCapture: tt
1571
- }, [
1572
- Fe(W(zt), {
1573
- class: "fkp-knowledge-editor",
1574
- editor: i.value
1575
- }, null, 8, ["editor"]),
1576
- u.value ? (L(), Ot(W(Lt), {
1577
- key: 0,
1578
- "popup-visible": !0,
1579
- trigger: [],
1580
- position: "tl",
1581
- "content-class": "fkp-order-remark-popover",
1582
- "content-style": {
1583
- width: "326px",
1584
- maxWidth: "calc(100vw - 32px)",
1585
- padding: "16px",
1586
- border: "none",
1587
- boxSizing: "border-box",
1588
- maxHeight: "420px",
1589
- overflowY: "auto"
1590
- }
1591
- }, {
1592
- content: pe(() => [
1593
- D("div", {
1594
- class: "fkp-order-remark-detail",
1595
- onMouseenter: F,
1596
- onMouseleave: q
1597
- }, [
1598
- D("div", vn, [
1599
- t[2] || (t[2] = D("strong", null, "订单备注", -1)),
1600
- u.value.contentMode === "smart" ? (L(), U("span", An, "智能提取")) : re("", !0)
1601
- ]),
1602
- D("div", Sn, He(u.value.content), 1),
1603
- D("div", Tn, [
1604
- t[3] || (t[3] = D("span", null, "备注插旗", -1)),
1605
- u.value.flag === "none" ? (L(), U("span", Cn, "不标记")) : (L(), U("span", {
1606
- key: 1,
1607
- class: "fkp-order-remark-detail-flag",
1608
- role: "img",
1609
- "aria-label": W(Zt)[u.value.flag],
1610
- style: me({
1611
- backgroundColor: W(Qt)[u.value.flag]
1612
- })
1613
- }, null, 12, Mn))
1614
- ]),
1615
- D("div", En, [
1616
- t[4] || (t[4] = D("span", null, "备注位置", -1)),
1617
- D("span", null, He(u.value.position === "first" ? "最前" : "最后"), 1)
1618
- ])
1619
- ], 32)
1620
- ]),
1621
- default: pe(() => [
1622
- D("span", {
1623
- class: "fkp-order-remark-anchor",
1624
- style: me(M.value)
1625
- }, null, 4)
1626
- ]),
1627
- _: 1
1628
- })) : re("", !0),
1629
- x.value ? (L(), U("div", {
1630
- key: 1,
1631
- class: "fkp-media-drop-line",
1632
- style: me({
1633
- top: `${x.value.top}px`,
1634
- left: `${x.value.left}px`,
1635
- width: `${x.value.width}px`
1636
- }),
1637
- "aria-hidden": "true"
1638
- }, null, 4)) : re("", !0),
1639
- e.referencePlaceholder && b.value ? (L(), U("div", Nn, [
1640
- t[6] || (t[6] = D("span", { class: "fkp-reference-bracket" }, "<", -1)),
1641
- Fe(W($t), {
1642
- color: "arcoblue",
1643
- size: "small",
1644
- bordered: ""
1645
- }, {
1646
- default: pe(() => t[5] || (t[5] = [
1647
- Pt("参考话术")
1648
- ])),
1649
- _: 1
1650
- }),
1651
- t[7] || (t[7] = D("span", null, "请填写参考话术", -1)),
1652
- t[8] || (t[8] = D("span", { class: "fkp-reference-bracket" }, ">", -1))
1653
- ])) : re("", !0)
1654
- ], 544));
1655
- }
1656
- });
1657
- export {
1658
- Hn as _
1659
- };