@freecallai/pro 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +23 -23
  3. package/dist/FkpKnowledgeTypePicker.vue_vue_type_script_setup_true_lang--MPtqZY_.js +193 -0
  4. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-bw74hFS9.js +4980 -0
  5. package/dist/KnowledgeArea-CEX1esVZ.js +4 -0
  6. package/dist/KnowledgeArea.vue_vue_type_script_setup_true_lang-Bg1e7xYT.js +1653 -0
  7. package/dist/ToolForm-DA-EFBhw.js +196 -0
  8. package/dist/agent-prompt-editor/index.js +917 -0
  9. package/dist/agent-prompt-editor/legacy-converter/index.js +490 -0
  10. package/dist/{choice-Bt2xhoN_.js → choice-2dbddjJU.js} +1 -1
  11. package/dist/edition-info/index.js +1 -1
  12. package/dist/filters/index.js +1 -1
  13. package/dist/{guard-B7U3S4F1.js → guard-Cr_ny-sR.js} +255 -237
  14. package/dist/index-7x1OTv0m.js +98 -0
  15. package/dist/{index-BF6MRSMb.js → index-BBxrpF3v.js} +1 -1
  16. package/dist/{index-sjDmbR5o.js → index-CgRisH4B.js} +1 -1
  17. package/dist/index-Ck8RYpuE.js +816 -0
  18. package/dist/index-CnjG7Mj4.js +5 -0
  19. package/dist/{index-lNhA3N9x.js → index-DBQsQ1ZK.js} +1 -0
  20. package/dist/index-DCZKt14c.js +5 -0
  21. package/dist/{index-D9yqpH_4.js → index-DiaPY8Db.js} +2 -2
  22. package/dist/{index-trxE5T0w.js → index-DmdrsEvk.js} +1 -1
  23. package/dist/index-DnmCPdCI.js +168 -0
  24. package/dist/{index-B4-2_sJI.js → index-DwDYy2lj.js} +1 -1
  25. package/dist/{index-BBv72oZe.js → index-FQQfN6nm.js} +1 -1
  26. package/dist/{index-DYeJRJY1.js → index-aic1yCBs.js} +1 -1
  27. package/dist/index.js +13 -13
  28. package/dist/{inline-KPGqYMIR.js → inline-8aNfINLF.js} +1 -1
  29. package/dist/knowledge-type-picker/index.js +1 -1
  30. package/dist/{knowledge-CupkY2rK.js → knowledge-y2j0ijgx.js} +1 -1
  31. package/dist/{media-extensions-DhRlLKYM.js → media-extensions-wlcCEdtg.js} +27 -24
  32. package/dist/media-id-b2dgniSy.js +15 -0
  33. package/dist/{media-migration-CbMT2wS0.js → media-migration-Dy_rbdkK.js} +1 -1
  34. package/dist/media-policy-BwKjZPWt.js +158 -0
  35. package/dist/{media-upload-P9WeUHHr.js → media-upload-NzWYyCm3.js} +1 -1
  36. package/dist/model-DvukseoR.js +146 -0
  37. package/dist/navigation/index.js +1 -1
  38. package/dist/rich-text/index.js +75 -73
  39. package/dist/rich-text/legacy-converter/index.js +988 -867
  40. package/dist/style.css +1 -1
  41. package/dist/switcher/index.js +1 -1
  42. package/dist/types/agent-prompt-editor/FkpAgentPromptEditor.vue.d.ts +550 -0
  43. package/dist/types/agent-prompt-editor/agent-size-chart.d.ts +3 -0
  44. package/dist/types/agent-prompt-editor/document-adapter.d.ts +3 -0
  45. package/dist/types/agent-prompt-editor/index.d.ts +6 -0
  46. package/dist/types/agent-prompt-editor/legacy-converter-index.d.ts +2 -0
  47. package/dist/types/agent-prompt-editor/legacy-converter.d.ts +26 -0
  48. package/dist/types/agent-prompt-editor/model.d.ts +21 -0
  49. package/dist/types/agent-prompt-editor/types.d.ts +56 -0
  50. package/dist/types/edition-info/FkpEditionInfo.vue.d.ts +1 -3
  51. package/dist/types/edition-info/presets.d.ts +8 -0
  52. package/dist/types/edition-info/types.d.ts +1 -0
  53. package/dist/types/filters/FkpFilter.vue.d.ts +2 -2
  54. package/dist/types/filters/FkpFilterDateRange.vue.d.ts +2 -2
  55. package/dist/types/filters/FkpFilterPeriod.vue.d.ts +2 -2
  56. package/dist/types/filters/FkpSearchableMultiSelect.vue.d.ts +2 -2
  57. package/dist/types/index.d.ts +4 -1
  58. package/dist/types/navigation/FkpNavigation.vue.d.ts +20 -29
  59. package/dist/types/navigation/NavigationButton.vue.d.ts +26 -0
  60. package/dist/types/navigation/NavigationGroup.vue.d.ts +45 -0
  61. package/dist/types/navigation/NavigationIcon.vue.d.ts +28 -0
  62. package/dist/types/navigation/NavigationNodes.vue.d.ts +40 -0
  63. package/dist/types/navigation/index.d.ts +1 -1
  64. package/dist/types/navigation/types.d.ts +43 -5
  65. package/dist/types/navigation/use-navigation-tree.d.ts +13 -0
  66. package/dist/types/rich-text/FkpRichText.vue.d.ts +28 -8
  67. package/dist/types/rich-text/config/descriptor.d.ts +1 -0
  68. package/dist/types/rich-text/config/resolve.d.ts +1 -1
  69. package/dist/types/rich-text/index.d.ts +4 -1
  70. package/dist/types/rich-text/knowledge-document-adapter.d.ts +2 -0
  71. package/dist/types/rich-text/model/question-text.d.ts +1 -1
  72. package/dist/types/rich-text/plugins/registry.d.ts +2 -1
  73. package/dist/types/rich-text/public/types.d.ts +12 -0
  74. package/dist/types/rich-text/runtime/document-adapter.d.ts +9 -0
  75. package/dist/types/rich-text/runtime/knowledge-clipboard.d.ts +9 -3
  76. package/dist/types/rich-text/runtime/media-sources.d.ts +7 -0
  77. package/dist/types/rich-text/runtime/media-upload-session.d.ts +2 -0
  78. package/dist/types/rich-text/ui/FkpKnowledgeTypePicker.vue.d.ts +3 -3
  79. package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +18 -3
  80. package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +190 -0
  81. package/dist/types/rich-text/ui/ToolForm.vue.d.ts +2 -2
  82. package/dist/types/rich-text/ui/token-renderer.d.ts +3 -0
  83. package/dist/types/rich-text/ui/useMediaHint.d.ts +6 -0
  84. package/dist/types/switcher/FkpSwitcher.vue.d.ts +2 -2
  85. package/dist/types-PvYB5e85.js +14 -0
  86. package/package.json +13 -5
  87. package/dist/FkpKnowledgeTypePicker.vue_vue_type_script_setup_true_lang-xR8ZhhdJ.js +0 -187
  88. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-CaHRIHab.js +0 -4864
  89. package/dist/KnowledgeArea-_rsydhnt.js +0 -1438
  90. package/dist/ToolForm-Czg67cDT.js +0 -185
  91. package/dist/index-BQrYBmwR.js +0 -5
  92. package/dist/index-CS2xQQ8W.js +0 -168
  93. package/dist/index-D0bJAQSN.js +0 -327
  94. package/dist/index-DCmHHi07.js +0 -71
  95. package/dist/index-uCVrA6xK.js +0 -5
@@ -1,4 +1,8 @@
1
- const be = [
1
+ const ae = [
2
+ "若使用千牛内部应用接待:",
3
+ "「辅助接待」模式,将顾客标记为“需介入”;",
4
+ "「全自动接待」模式,将按千牛分流规则直接转接(不支持福客转接方案)"
5
+ ], he = [
2
6
  {
3
7
  id: "todo",
4
8
  apiVersion: 1,
@@ -9,13 +13,14 @@ const be = [
9
13
  actions: [{ id: "todo.questionAction.apply", requiredPorts: [] }],
10
14
  order: 10,
11
15
  types: ["normal"],
12
- icon: "Followup",
16
+ icon: "rte-todo",
13
17
  menu: {
14
18
  title: "待办标签",
15
19
  searchLabel: "搜索标签名称",
16
20
  classes: ["is-todo-menu"],
17
21
  width: 296,
18
22
  helpClass: "fkp-todo-help",
23
+ warning: ae,
19
24
  guidanceClass: "fkp-todo-guidance",
20
25
  guidance: [
21
26
  "常规知识可直接开启待办标签;",
@@ -38,13 +43,14 @@ const be = [
38
43
  actions: [{ id: "todo.knowledgeInline.apply", requiredPorts: [] }],
39
44
  order: 10,
40
45
  types: ["reasoning"],
41
- icon: "Followup",
46
+ icon: "rte-todo",
42
47
  menu: {
43
48
  title: "待办标签",
44
49
  searchLabel: "搜索标签名称",
45
50
  classes: ["is-todo-menu"],
46
51
  width: 296,
47
52
  helpClass: "fkp-todo-help",
53
+ warning: ae,
48
54
  guidanceClass: "fkp-todo-guidance",
49
55
  guidance: [
50
56
  "常规知识可直接开启待办标签;",
@@ -56,7 +62,7 @@ const be = [
56
62
  optionSource: "flatTags",
57
63
  optionTrigger: "hover"
58
64
  }
59
- ], we = [
65
+ ], $e = [
60
66
  {
61
67
  id: "tableKnowledge",
62
68
  apiVersion: 1,
@@ -81,7 +87,7 @@ const be = [
81
87
  optionSource: "flatTags",
82
88
  optionTrigger: "hover"
83
89
  }
84
- ], he = [
90
+ ], Se = [
85
91
  {
86
92
  id: "ticket",
87
93
  apiVersion: 1,
@@ -114,7 +120,7 @@ const be = [
114
120
  optionSource: "flatTags",
115
121
  optionTrigger: "hover"
116
122
  }
117
- ], $e = [
123
+ ], Ae = [
118
124
  {
119
125
  id: "originalReply",
120
126
  apiVersion: 1,
@@ -141,7 +147,7 @@ const be = [
141
147
  types: ["reasoning"],
142
148
  icon: "quote"
143
149
  }
144
- ], Se = [
150
+ ], Te = [
145
151
  {
146
152
  id: "memory",
147
153
  apiVersion: 1,
@@ -154,7 +160,7 @@ const be = [
154
160
  types: ["normal", "reasoning", "agent"],
155
161
  icon: "memory"
156
162
  }
157
- ], Ae = [
163
+ ], Ie = [
158
164
  {
159
165
  id: "tagged",
160
166
  apiVersion: 1,
@@ -165,13 +171,14 @@ const be = [
165
171
  actions: [{ id: "tagged.questionAction.apply", requiredPorts: [] }],
166
172
  order: 40,
167
173
  types: ["normal", "reasoning", "agent"],
168
- icon: "tag",
174
+ icon: "rte-tag",
169
175
  menu: {
170
176
  title: "顾客标签",
171
177
  searchLabel: "搜索标签名称",
172
178
  classes: ["is-todo-menu", "is-tagged-menu"],
173
179
  width: 336,
174
180
  helpClass: "fkp-todo-help",
181
+ warning: ["此功能千牛内部应用接待不生效"],
175
182
  guidanceClass: "fkp-tagged-guidance",
176
183
  guidance: ["顾客消息命中此场景后,将对其打上所选顾客标签"]
177
184
  },
@@ -180,7 +187,7 @@ const be = [
180
187
  optionTrigger: "hover",
181
188
  questionTag: { kind: "default", protocolLabel: "顾客标签" }
182
189
  }
183
- ], Te = [
190
+ ], xe = [
184
191
  {
185
192
  id: "attribute",
186
193
  apiVersion: 1,
@@ -191,7 +198,7 @@ const be = [
191
198
  actions: [{ id: "attribute.knowledgeInline.apply", requiredPorts: [] }],
192
199
  order: 30,
193
200
  types: ["reasoning"],
194
- icon: "data",
201
+ icon: "prte-reference",
195
202
  menu: {
196
203
  title: "属性",
197
204
  searchLabel: "搜索属性名称",
@@ -208,7 +215,7 @@ const be = [
208
215
  optionTrigger: "hover",
209
216
  optionHierarchy: "tree"
210
217
  }
211
- ], Ie = [
218
+ ], ve = [
212
219
  {
213
220
  id: "tool",
214
221
  apiVersion: 1,
@@ -219,7 +226,7 @@ const be = [
219
226
  actions: [{ id: "tool.knowledgeInline.apply", requiredPorts: [] }],
220
227
  order: 40,
221
228
  types: ["reasoning"],
222
- icon: "tool",
229
+ icon: "rte-tool",
223
230
  menu: {
224
231
  title: "工具",
225
232
  searchLabel: "搜索工具名称",
@@ -237,7 +244,7 @@ const be = [
237
244
  optionHierarchy: "tree",
238
245
  uiPorts: ["getToolForm"]
239
246
  }
240
- ], ve = [
247
+ ], Pe = [
241
248
  {
242
249
  id: "variable",
243
250
  apiVersion: 1,
@@ -248,7 +255,7 @@ const be = [
248
255
  actions: [{ id: "variable.knowledgeInline.apply", requiredPorts: [] }],
249
256
  order: 50,
250
257
  types: ["normal", "reasoning"],
251
- icon: "variate",
258
+ icon: "hashtag",
252
259
  menu: {
253
260
  title: "变量",
254
261
  searchLabel: "搜索变量名称",
@@ -263,7 +270,7 @@ const be = [
263
270
  optionTrigger: "hover"
264
271
  }
265
272
  ];
266
- const it = {
273
+ const st = {
267
274
  agents: "searchAgents",
268
275
  variables: "listVariables",
269
276
  flatTags: "listCapabilityOptions",
@@ -286,7 +293,7 @@ const w = {
286
293
  requiredPorts: [],
287
294
  optionalPorts: ["getReasoningTemplate", "listCapabilityOptions"]
288
295
  }
289
- }, xe = [
296
+ }, qe = [
290
297
  {
291
298
  id: "image",
292
299
  apiVersion: 1,
@@ -301,7 +308,7 @@ const w = {
301
308
  icon: "pic",
302
309
  optionKind: "media"
303
310
  }
304
- ], Pe = [
311
+ ], Oe = [
305
312
  {
306
313
  id: "video",
307
314
  apiVersion: 1,
@@ -313,10 +320,10 @@ const w = {
313
320
  primaryActionId: "video.upload",
314
321
  order: 70,
315
322
  types: ["normal", "reasoning"],
316
- icon: "video2",
323
+ icon: "video3",
317
324
  optionKind: "media"
318
325
  }
319
- ], Oe = [
326
+ ], Ve = [
320
327
  {
321
328
  id: "separator",
322
329
  apiVersion: 1,
@@ -329,7 +336,7 @@ const w = {
329
336
  types: ["normal", "reasoning"],
330
337
  icon: "sep"
331
338
  }
332
- ], qe = [
339
+ ], _e = [
333
340
  {
334
341
  id: "reasoningPolish",
335
342
  apiVersion: 1,
@@ -343,7 +350,7 @@ const w = {
343
350
  types: ["reasoning"],
344
351
  icon: "AI"
345
352
  }
346
- ], Ve = [
353
+ ], je = [
347
354
  {
348
355
  id: "reasoningTemplate",
349
356
  apiVersion: 1,
@@ -355,7 +362,7 @@ const w = {
355
362
  primaryActionId: "reasoningTemplate.load",
356
363
  order: 100,
357
364
  types: ["reasoning"],
358
- icon: "tabs",
365
+ icon: "rte-template",
359
366
  menu: {
360
367
  title: "模板",
361
368
  searchLabel: "搜索模板名称",
@@ -366,7 +373,7 @@ const w = {
366
373
  optionKind: "selection",
367
374
  optionSource: "reasoningTemplates"
368
375
  }
369
- ], je = [
376
+ ], Le = [
370
377
  {
371
378
  id: "agentSelect",
372
379
  apiVersion: 1,
@@ -378,7 +385,7 @@ const w = {
378
385
  readPorts: ["getAgentPrompt"],
379
386
  order: 10,
380
387
  types: ["agent"],
381
- icon: "Agent",
388
+ icon: "rte-agent",
382
389
  menu: {
383
390
  title: "自定义Agent",
384
391
  searchLabel: "搜索标签名称",
@@ -394,56 +401,56 @@ const w = {
394
401
  optionSource: "agents",
395
402
  optionTrigger: "hover"
396
403
  }
397
- ], q = [
398
- ...be,
404
+ ], O = [
399
405
  ...he,
400
- ...we,
401
- ...$e,
402
406
  ...Se,
407
+ ...$e,
403
408
  ...Ae,
404
409
  ...Te,
405
410
  ...Ie,
406
- ...ve,
407
411
  ...xe,
412
+ ...ve,
408
413
  ...Pe,
409
- ...Oe,
410
414
  ...qe,
415
+ ...Oe,
411
416
  ...Ve,
412
- ...je
417
+ ..._e,
418
+ ...je,
419
+ ...Le
413
420
  ];
414
- function ce(e, t = "") {
415
- const r = /* @__PURE__ */ new Set(), i = (o, a, n) => {
416
- if (o === null || typeof o == "string" || typeof o == "boolean")
421
+ function pe(e, t = "") {
422
+ const r = /* @__PURE__ */ new Set(), o = (i, a, n) => {
423
+ if (i === null || typeof i == "string" || typeof i == "boolean")
417
424
  return null;
418
- if (typeof o == "number")
419
- return Number.isFinite(o) ? null : a;
420
- if (typeof o != "object" || n > 64 || r.has(o))
425
+ if (typeof i == "number")
426
+ return Number.isFinite(i) ? null : a;
427
+ if (typeof i != "object" || n > 64 || r.has(i))
421
428
  return a;
422
- if (!Array.isArray(o)) {
423
- const c = Object.getPrototypeOf(o);
429
+ if (!Array.isArray(i)) {
430
+ const c = Object.getPrototypeOf(i);
424
431
  if (c !== Object.prototype && c !== null) return a;
425
432
  }
426
- const s = Reflect.ownKeys(o);
433
+ const s = Reflect.ownKeys(i);
427
434
  if (s.some((c) => typeof c == "symbol")) return a;
428
- if (Array.isArray(o)) {
429
- if (s.length !== o.length + 1) return a;
430
- for (let c = 0; c < o.length; c++)
431
- if (!Object.prototype.hasOwnProperty.call(o, c))
435
+ if (Array.isArray(i)) {
436
+ if (s.length !== i.length + 1) return a;
437
+ for (let c = 0; c < i.length; c++)
438
+ if (!Object.prototype.hasOwnProperty.call(i, c))
432
439
  return `${a}[${c}]`;
433
440
  }
434
- r.add(o);
441
+ r.add(i);
435
442
  for (const c of s) {
436
- if (Array.isArray(o) && c === "length") continue;
437
- const l = Object.getOwnPropertyDescriptor(o, c), u = Array.isArray(o) ? `${a}[${String(c)}]` : a ? `${a}.${String(c)}` : String(c);
438
- if (!l || !("value" in l) || !Array.isArray(o) && !l.enumerable)
443
+ if (Array.isArray(i) && c === "length") continue;
444
+ const l = Object.getOwnPropertyDescriptor(i, c), u = Array.isArray(i) ? `${a}[${String(c)}]` : a ? `${a}.${String(c)}` : String(c);
445
+ if (!l || !("value" in l) || !Array.isArray(i) && !l.enumerable)
439
446
  return u;
440
- const d = i(l.value, u, n + 1);
447
+ const d = o(l.value, u, n + 1);
441
448
  if (d !== null) return d;
442
449
  }
443
- return r.delete(o), null;
450
+ return r.delete(i), null;
444
451
  };
445
452
  try {
446
- return i(e, t, 0);
453
+ return o(e, t, 0);
447
454
  } catch {
448
455
  return t;
449
456
  }
@@ -451,35 +458,35 @@ function ce(e, t = "") {
451
458
  function S(e, t, r) {
452
459
  return {
453
460
  choice: !0,
454
- present: (i) => ({
461
+ present: (o) => ({
455
462
  layout: "choice",
456
463
  icon: t,
457
- label: String(i.label || ""),
458
- ariaLabel: `${e}:${i.label || ""}`
464
+ label: String(o.label || ""),
465
+ ariaLabel: `${e}:${o.label || ""}`
459
466
  }),
460
467
  serialize: r
461
468
  };
462
469
  }
463
- const Le = S(
470
+ const Re = S(
464
471
  "待办",
465
- "Followup",
472
+ "rte-todo",
466
473
  (e) => e.label === "默认" && e.token === "{待办}" ? "{待办}" : `{待办@${e.label || e.key}}`
467
474
  );
468
- function st(e) {
475
+ function at(e) {
469
476
  const t = e.match(/^\{智能工单@name=([^{};\r\n]+);id=([^\s{};]+)\}$/u);
470
477
  if (t && t[1].trim())
471
478
  return { key: t[2], label: t[1], params: { protocol: "legacy" } };
472
479
  const r = e.match(/^\{智能建单@([^\s{}:]+):([^{}\r\n]+)\}$/u);
473
480
  return r && r[2].trim() ? { key: r[1], label: r[2] } : null;
474
481
  }
475
- function _e(e, t, r) {
482
+ function Ce(e, t, r) {
476
483
  return (r == null ? void 0 : r.protocol) === "legacy" ? `{智能工单@name=${t};id=${e}}` : `{智能建单@${e}:${t}}`;
477
484
  }
478
- const Re = {
485
+ const De = {
479
486
  ...S(
480
487
  "工单",
481
488
  "AI-ticket",
482
- (e) => _e(
489
+ (e) => Ce(
483
490
  String(e.key || ""),
484
491
  String(e.label || ""),
485
492
  e.params
@@ -489,29 +496,29 @@ const Re = {
489
496
  validate(e) {
490
497
  return e.params != null && (typeof e.params != "object" || Array.isArray(e.params) || Object.keys(e.params).length !== 1 || e.params.protocol !== "legacy") ? "params" : typeof e.key != "string" || !/^[^\s{}:]+$/u.test(e.key) ? "key" : typeof e.label != "string" || !e.label.trim() || /[{}\r\n]/u.test(e.label) || e.params != null && /[;]/u.test(e.label) ? "label" : e.params != null && /[;]/u.test(e.key) ? "key" : null;
491
498
  }
492
- }, Ce = {
499
+ }, Be = {
493
500
  ...S(
494
501
  "表格知识",
495
502
  "table-knowledge",
496
503
  (e) => `##${e.label}##`
497
504
  ),
498
505
  validate: (e) => typeof e.label != "string" || !e.label.trim() || /[#\r\n]/u.test(e.label) ? "label" : null
499
- }, De = {
500
- ...S("属性", "data", (e) => `{属性@${e.key}}`),
506
+ }, Ne = {
507
+ ...S("属性", "prte-reference", (e) => `{属性@${e.key}}`),
501
508
  allowInOriginalReply: !1
502
- }, Be = {
509
+ }, Ke = {
503
510
  requiresInsertToken: !0,
504
511
  present(e) {
505
512
  const t = String(e.label || e.key || "");
506
513
  return {
507
514
  layout: "inline",
508
- icon: "variate",
515
+ icon: "hashtag",
509
516
  label: t.startsWith("#") && t.endsWith("#") ? t : `#${t}#`,
510
517
  ariaLabel: String(e.label || "")
511
518
  };
512
519
  },
513
520
  serialize: (e) => String(e.token || `#${e.key}#`)
514
- }, Ne = {
521
+ }, Me = {
515
522
  present: (e) => ({
516
523
  layout: "inline",
517
524
  icon: "sep",
@@ -520,27 +527,27 @@ const Re = {
520
527
  }),
521
528
  serialize: () => "{分隔符}"
522
529
  };
523
- function Ke(e, t) {
530
+ function Fe(e, t) {
524
531
  if (e !== "order_note" && e !== "small_payment") return null;
525
532
  const r = t && typeof t == "object" && !Array.isArray(t) ? t : {};
526
533
  if (e === "small_payment") {
527
- const o = typeof r.amount == "string" ? r.amount : "", a = /^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/.test(o), [n = "", s = ""] = o.split(".");
534
+ const i = typeof r.amount == "string" ? r.amount : "", a = /^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/.test(i), [n = "", s = ""] = i.split(".");
528
535
  return {
529
536
  label: "小额打款",
530
- icon: "tool",
537
+ icon: "rte-tool",
531
538
  summary: a ? `¥${n}.${s.padEnd(2, "0")}` : ""
532
539
  };
533
540
  }
534
541
  return { label: "备注", icon: "msg-tag", summary: r.contentMode === "smart" ? "智能提取" : typeof r.content == "string" ? r.content.replace(/\s+/g, " ").trim() : "" };
535
542
  }
536
- const ue = (e) => typeof e == "string" && /^(?:[1-9]|[1-9]\d)$/.test(e), pe = (e) => typeof e == "string" && /^(?:rmk_[a-z0-9]{8}|[1-9]\d*)$/.test(e), $ = {
543
+ const de = (e) => typeof e == "string" && /^(?:[1-9]|[1-9]\d)$/.test(e), ge = (e) => typeof e == "string" && /^(?:rmk_[a-z0-9]{8}|[1-9]\d*)$/.test(e), $ = {
537
544
  none: "不标记",
538
545
  red: "红色",
539
546
  yellow: "黄色",
540
547
  green: "绿色",
541
548
  blue: "蓝色",
542
549
  purple: "紫色"
543
- }, at = {
550
+ }, lt = {
544
551
  none: "",
545
552
  red: "#f53f3f",
546
553
  yellow: "#ff7d00",
@@ -551,21 +558,21 @@ const ue = (e) => typeof e == "string" && /^(?:[1-9]|[1-9]\d)$/.test(e), pe = (e
551
558
  function A(e) {
552
559
  if (!e || typeof e != "object" || Array.isArray(e)) return !1;
553
560
  const t = e;
554
- return pe(t.id) && (t.contentMode === "fixed" || t.contentMode === "smart") && typeof t.content == "string" && !!t.content.trim() && [...t.content.trim()].length <= 500 && !/\^\^|\$\$|¥¥/.test(t.content) && !t.content.endsWith("^") && Object.hasOwn($, String(t.flag)) && typeof t.preserveFlag == "boolean" && (t.position === "first" || t.position === "last");
561
+ return ge(t.id) && (t.contentMode === "fixed" || t.contentMode === "smart") && typeof t.content == "string" && !!t.content.trim() && [...t.content.trim()].length <= 500 && !/\^\^|\$\$|¥¥/.test(t.content) && !t.content.endsWith("^") && Object.hasOwn($, String(t.flag)) && typeof t.preserveFlag == "boolean" && (t.position === "first" || t.position === "last");
555
562
  }
556
- function ae() {
563
+ function le() {
557
564
  return `rmk_${crypto.randomUUID().replace(/-/g, "").slice(0, 8)}`;
558
565
  }
559
- function lt(e, t, r, i, o) {
566
+ function ct(e, t, r, o, i) {
560
567
  if (e !== "small_payment" && e !== "order_note")
561
568
  return { ok: !0, params: t };
562
569
  let a = 0;
563
570
  const n = /* @__PURE__ */ new Set(), s = (u) => {
564
571
  var d, y, g;
565
- u.type === "businessToken" && ((d = u.attrs) == null ? void 0 : d.kind) === "tool" && (!o || u.attrs.id !== o) && (u.attrs.key === "small_payment" && a++, u.attrs.key === "order_note" && n.add(String(((y = u.attrs.params) == null ? void 0 : y.id) || ""))), (g = u.content) == null || g.forEach(s);
572
+ u.type === "businessToken" && ((d = u.attrs) == null ? void 0 : d.kind) === "tool" && (!i || u.attrs.id !== i) && (u.attrs.key === "small_payment" && a++, u.attrs.key === "order_note" && n.add(String(((y = u.attrs.params) == null ? void 0 : y.id) || ""))), (g = u.content) == null || g.forEach(s);
566
573
  };
567
- if (i && s(i), e === "small_payment")
568
- return ue(t.amount) ? a ? {
574
+ if (o && s(o), e === "small_payment")
575
+ return de(t.amount) ? a ? {
569
576
  ok: !1,
570
577
  code: "TOOL_LIMIT_REACHED",
571
578
  message: "最多配置一个小额打款工具"
@@ -574,9 +581,9 @@ function lt(e, t, r, i, o) {
574
581
  code: "TOOL_PARAMS_INVALID",
575
582
  message: "打款金额必须是1-99的整数元"
576
583
  };
577
- let c = pe(r.id) ? r.id : ae();
578
- if (!o)
579
- for (; n.has(c); ) c = ae();
584
+ let c = ge(r.id) ? r.id : le();
585
+ if (!i)
586
+ for (; n.has(c); ) c = le();
580
587
  if (n.has(c))
581
588
  return {
582
589
  ok: !1,
@@ -590,7 +597,7 @@ function lt(e, t, r, i, o) {
590
597
  message: "订单备注内容或配置不合法"
591
598
  };
592
599
  }
593
- function ct(e) {
600
+ function ut(e) {
594
601
  const t = /^\{外部方法@([^\s{}:]+):([^{}\r\n]+)\}$/u.exec(e);
595
602
  if (t && t[2].trim())
596
603
  return {
@@ -615,38 +622,38 @@ function ct(e) {
615
622
  }
616
623
  };
617
624
  }
618
- const i = /^\^\^订单备注-(固定话术|智能提取)@编号=(rmk_[a-z0-9]{8}|[1-9]\d*);插旗=([^;]+);保留已有旗帜=(是|否);位置=(最前|最后);内容=([\s\S]+)\^\^$/u.exec(
625
+ const o = /^\^\^订单备注-(固定话术|智能提取)@编号=(rmk_[a-z0-9]{8}|[1-9]\d*);插旗=([^;]+);保留已有旗帜=(是|否);位置=(最前|最后);内容=([\s\S]+)\^\^$/u.exec(
619
626
  e
620
627
  );
621
- if (!i) return null;
622
- const o = Object.keys($).find(
623
- (n) => $[n] === i[3]
624
- );
625
628
  if (!o) return null;
629
+ const i = Object.keys($).find(
630
+ (n) => $[n] === o[3]
631
+ );
632
+ if (!i) return null;
626
633
  const a = {
627
- id: i[2],
628
- contentMode: i[1] === "固定话术" ? "fixed" : "smart",
629
- content: i[6],
630
- flag: o,
631
- preserveFlag: i[4] === "是",
632
- position: i[5] === "最前" ? "first" : "last"
634
+ id: o[2],
635
+ contentMode: o[1] === "固定话术" ? "fixed" : "smart",
636
+ content: o[6],
637
+ flag: i,
638
+ preserveFlag: o[4] === "是",
639
+ position: o[5] === "最前" ? "first" : "last"
633
640
  };
634
641
  return A(a) ? {
635
642
  type: "businessToken",
636
643
  attrs: { kind: "tool", key: "order_note", label: "订单备注", params: a }
637
644
  } : null;
638
645
  }
639
- function Fe(e) {
646
+ function ce(e) {
640
647
  var r;
641
648
  if (e.type !== "businessToken" || ((r = e.attrs) == null ? void 0 : r.kind) !== "tool") return null;
642
649
  const { params: t } = e.attrs;
643
650
  if (e.attrs.key === "external_method") {
644
- const { sceneId: i, sceneName: o } = t || {};
645
- return typeof i == "string" && /^[^\s{}:]+$/u.test(i) && typeof o == "string" && o.trim() && !/[{}\r\n]/u.test(o) ? `{外部方法@${i}:${o}}` : null;
651
+ const { sceneId: o, sceneName: i } = t || {};
652
+ return typeof o == "string" && /^[^\s{}:]+$/u.test(o) && typeof i == "string" && i.trim() && !/[{}\r\n]/u.test(i) ? `{外部方法@${o}:${i}}` : null;
646
653
  }
647
- return e.attrs.key === "small_payment" ? ue(t == null ? void 0 : t.amount) ? `$$小额打款@${Number(t.amount) * 100}$$` : null : e.attrs.key !== "order_note" || !A(t) ? null : `^^订单备注-${t.contentMode === "fixed" ? "固定话术" : "智能提取"}@编号=${t.id};插旗=${$[t.flag]};保留已有旗帜=${t.preserveFlag ? "是" : "否"};位置=${t.position === "first" ? "最前" : "最后"};内容=${t.content}^^`;
654
+ return e.attrs.key === "small_payment" ? de(t == null ? void 0 : t.amount) ? `$$小额打款@${Number(t.amount) * 100}$$` : null : e.attrs.key !== "order_note" || !A(t) ? null : `^^订单备注-${t.contentMode === "fixed" ? "固定话术" : "智能提取"}@编号=${t.id};插旗=${$[t.flag]};保留已有旗帜=${t.preserveFlag ? "是" : "否"};位置=${t.position === "first" ? "最前" : "最后"};内容=${t.content}^^`;
648
655
  }
649
- function ut(e) {
656
+ function pt(e) {
650
657
  try {
651
658
  const t = JSON.parse(decodeURIComponent(e)), r = {
652
659
  id: String(t.id || ""),
@@ -664,10 +671,15 @@ function ut(e) {
664
671
  return null;
665
672
  }
666
673
  }
667
- const Me = {
674
+ const Ee = {
668
675
  allowsParams: !0,
676
+ validate(e) {
677
+ return ["small_payment", "order_note", "external_method"].includes(
678
+ String(e.key)
679
+ ) ? ce({ type: "businessToken", attrs: { ...e } }) ? null : "params" : null;
680
+ },
669
681
  present(e) {
670
- const t = Ke(e.key, e.params);
682
+ const t = Fe(e.key, e.params);
671
683
  return t ? {
672
684
  layout: "toolNote",
673
685
  icon: t.icon,
@@ -677,7 +689,7 @@ const Me = {
677
689
  summary: t.summary
678
690
  } : {
679
691
  layout: "tool",
680
- icon: "tool",
692
+ icon: "rte-tool",
681
693
  label: String(e.label || ""),
682
694
  ariaLabel: `工具:${e.label || ""}`
683
695
  };
@@ -686,7 +698,7 @@ const Me = {
686
698
  if (["small_payment", "order_note", "external_method"].includes(
687
699
  String(e.key)
688
700
  )) {
689
- const t = Fe({
701
+ const t = ce({
690
702
  type: "businessToken",
691
703
  attrs: { ...e }
692
704
  });
@@ -695,63 +707,63 @@ const Me = {
695
707
  }
696
708
  return `{工具@${e.key}}`;
697
709
  }
698
- }, de = {
699
- todo: Le,
700
- ticket: Re,
701
- tableKnowledge: Ce,
702
- variable: Be,
703
- attribute: De,
704
- tool: Me,
705
- separator: Ne
706
- }, P = de;
710
+ }, fe = {
711
+ todo: Re,
712
+ ticket: De,
713
+ tableKnowledge: Be,
714
+ variable: Ke,
715
+ attribute: Ne,
716
+ tool: Ee,
717
+ separator: Me
718
+ }, P = fe;
707
719
  function I(e) {
708
720
  return typeof e == "string" && Object.prototype.hasOwnProperty.call(P, e) ? P[e] : void 0;
709
721
  }
710
- const ge = Object.keys(
711
- de
712
- ), Ee = ge.filter(
722
+ const ye = Object.keys(
723
+ fe
724
+ ), Ue = ye.filter(
713
725
  (e) => P[e].choice
714
- ), Ue = ["image", "video"], ze = new Set(ge), We = new Set(Ee), He = new Set(Ue), fe = (e) => typeof e == "string" && ze.has(e), pt = (e) => typeof e == "string" && We.has(e), ye = (e) => typeof e == "string" && He.has(e), Je = /* @__PURE__ */ new Set([
726
+ ), ze = ["image", "video"], We = new Set(ye), He = new Set(Ue), Je = new Set(ze), me = (e) => typeof e == "string" && We.has(e), dt = (e) => typeof e == "string" && He.has(e), ke = (e) => typeof e == "string" && Je.has(e), Qe = /* @__PURE__ */ new Set([
715
727
  "businessToken",
716
728
  "originalReply",
717
729
  "messageSeparator",
718
730
  "mediaBlock"
719
- ]), V = (e) => Je.has(e);
720
- function Qe(e, t) {
721
- return e === "businessToken" ? fe(t == null ? void 0 : t.kind) ? t.kind : null : e === "mediaBlock" ? ye(t == null ? void 0 : t.kind) ? t.kind : null : e === "originalReply" ? "originalReply" : e === "messageSeparator" ? "separator" : null;
731
+ ]), V = (e) => Qe.has(e);
732
+ function Ge(e, t) {
733
+ return e === "businessToken" ? me(t == null ? void 0 : t.kind) ? t.kind : null : e === "mediaBlock" ? ke(t == null ? void 0 : t.kind) ? t.kind : null : e === "originalReply" ? "originalReply" : e === "messageSeparator" ? "separator" : null;
722
734
  }
723
- function Ge(e) {
724
- const t = Qe(e.type || "", e.attrs);
735
+ function Ye(e) {
736
+ const t = Ge(e.type || "", e.attrs);
725
737
  return t ? {
726
738
  id: t,
727
739
  slot: e.type === "businessToken" || e.type === "messageSeparator" ? "knowledgeInline" : "knowledgeBlock"
728
740
  } : null;
729
741
  }
730
- function Ye(e) {
742
+ function Xe(e) {
731
743
  var t;
732
744
  return !!((t = e.content) != null && t.some(
733
- (r) => typeof r.type == "string" && V(r.type) || Ye(r)
745
+ (r) => typeof r.type == "string" && V(r.type) || Xe(r)
734
746
  ));
735
747
  }
736
- const dt = "fkpTrustedNodeIds";
737
- function gt(e) {
738
- const t = [], r = (i) => {
739
- var o, a;
740
- i.type && V(i.type) && typeof ((o = i.attrs) == null ? void 0 : o.id) == "string" && i.attrs.id && t.push(i.attrs.id), (a = i.content) == null || a.forEach(r);
748
+ const gt = "fkpTrustedNodeIds";
749
+ function ft(e) {
750
+ const t = [], r = (o) => {
751
+ var i, a;
752
+ o.type && V(o.type) && typeof ((i = o.attrs) == null ? void 0 : i.id) == "string" && o.attrs.id && t.push(o.attrs.id), (a = o.content) == null || a.forEach(r);
741
753
  };
742
754
  return Array.isArray(e) ? e.forEach(r) : r(e), t;
743
755
  }
744
- function ft(e, t) {
756
+ function yt(e, t) {
745
757
  for (let a = 0; a < 8; a++) {
746
758
  const n = t();
747
759
  if (n && !e.has(n)) return n;
748
760
  }
749
761
  const r = t() || "node";
750
- let i = r, o = 1;
751
- for (; e.has(i); ) i = `${r}-${o++}`;
752
- return i;
762
+ let o = r, i = 1;
763
+ for (; e.has(o); ) o = `${r}-${i++}`;
764
+ return o;
753
765
  }
754
- function O(e) {
766
+ function q(e) {
755
767
  if (typeof e != "string" || !/^https?:\/\/[^\s]+$/i.test(e))
756
768
  return !1;
757
769
  try {
@@ -761,40 +773,46 @@ function O(e) {
761
773
  return !1;
762
774
  }
763
775
  }
764
- function Xe(e) {
765
- return e.includes("[") || e.includes("]") || /[【】\r\n]/u.test(e);
776
+ function Ze(e) {
777
+ if (e.includes("[") || e.includes("]") || /[\r\n]/u.test(e))
778
+ return !0;
779
+ let t = 0;
780
+ for (const r of e)
781
+ if (r === "【") t++;
782
+ else if (r === "】" && --t < 0) return !0;
783
+ return t !== 0;
766
784
  }
767
- function me(e) {
785
+ function be(e) {
768
786
  return /[{}\r\n]/u.test(e);
769
787
  }
770
- function Ze(e, t) {
788
+ function et(e, t) {
771
789
  var n;
772
790
  const r = (n = e.extensionState[t]) == null ? void 0 : n.data;
773
791
  if (!r || typeof r != "object" || Array.isArray(r)) return null;
774
- const { tag: i } = r;
775
- if (!i || typeof i != "object" || Array.isArray(i)) return null;
776
- const { id: o, label: a } = i;
777
- return typeof o != "string" || !o.trim() || typeof a != "string" || !a.trim() ? null : { id: o, label: a };
792
+ const { tag: o } = r;
793
+ if (!o || typeof o != "object" || Array.isArray(o)) return null;
794
+ const { id: i, label: a } = o;
795
+ return typeof i != "string" || !i.trim() || typeof a != "string" || !a.trim() ? null : { id: i, label: a };
778
796
  }
779
- function et(e) {
780
- return q.filter(
797
+ function tt(e) {
798
+ return O.filter(
781
799
  (t) => t.slot === "questionAction" && t.questionTag && t.types.includes(e.type)
782
800
  ).sort((t, r) => t.order - r.order).flatMap(({ id: t, questionTag: r }) => {
783
801
  var s;
784
- const i = r.protocolLabel, o = (s = e.extensionState[t]) == null ? void 0 : s.data, a = o && typeof o == "object" && !Array.isArray(o) ? o.enabled === !0 : !1, n = a ? Ze(e, t) : null;
785
- if (a && !n) throw new Error(`${i}已开启但未选择方案`);
786
- if (n && me(n.label))
802
+ const o = r.protocolLabel, i = (s = e.extensionState[t]) == null ? void 0 : s.data, a = i && typeof i == "object" && !Array.isArray(i) ? i.enabled === !0 : !1, n = a ? et(e, t) : null;
803
+ if (a && !n) throw new Error(`${o}已开启但未选择方案`);
804
+ if (n && be(n.label))
787
805
  throw new Error("方案名称包含协议保留字符");
788
- return n ? [`{${i}@${n.label}}`] : [];
806
+ return n ? [`{${o}@${n.label}}`] : [];
789
807
  }).join("");
790
808
  }
791
- function yt(e) {
809
+ function mt(e) {
792
810
  var t;
793
- if (typeof ((t = e.question) == null ? void 0 : t.text) != "string" || Xe(e.question.text))
794
- throw new Error("意图文字中不可填写方括号或换行,请修改");
795
- return `[${e.question.text}]${et(e)}`;
811
+ if (typeof ((t = e.question) == null ? void 0 : t.text) != "string" || Ze(e.question.text))
812
+ throw new Error("意图文字不能包含半角方括号、换行或未配对的【】");
813
+ return `[${e.question.text}]${tt(e)}`;
796
814
  }
797
- const ke = /* @__PURE__ */ new Set([
815
+ const we = /* @__PURE__ */ new Set([
798
816
  "doc",
799
817
  "paragraph",
800
818
  "text",
@@ -809,14 +827,14 @@ const ke = /* @__PURE__ */ new Set([
809
827
  "originalReply",
810
828
  "messageSeparator",
811
829
  "mediaBlock"
812
- ]), mt = (e) => ke.has(e), tt = /* @__PURE__ */ new Set([
830
+ ]), kt = (e) => we.has(e), nt = /* @__PURE__ */ new Set([
813
831
  "bold",
814
832
  "italic",
815
833
  "strike",
816
834
  "code",
817
835
  "link",
818
836
  "underline"
819
- ]), v = /* @__PURE__ */ new Set([
837
+ ]), x = /* @__PURE__ */ new Set([
820
838
  "paragraph",
821
839
  "bulletList",
822
840
  "orderedList",
@@ -826,16 +844,16 @@ const ke = /* @__PURE__ */ new Set([
826
844
  "originalReply",
827
845
  "messageSeparator",
828
846
  "mediaBlock"
829
- ]), le = {
830
- doc: v,
847
+ ]), ue = {
848
+ doc: x,
831
849
  paragraph: /* @__PURE__ */ new Set(["text", "hardBreak", "businessToken"]),
832
850
  bulletList: /* @__PURE__ */ new Set(["listItem"]),
833
851
  orderedList: /* @__PURE__ */ new Set(["listItem"]),
834
- listItem: /* @__PURE__ */ new Set(["paragraph", ...v]),
835
- blockquote: v,
852
+ listItem: /* @__PURE__ */ new Set(["paragraph", ...x]),
853
+ blockquote: x,
836
854
  codeBlock: /* @__PURE__ */ new Set(["text"]),
837
855
  originalReply: /* @__PURE__ */ new Set(["paragraph", "mediaBlock", "messageSeparator"])
838
- }, nt = {
856
+ }, rt = {
839
857
  orderedList: /* @__PURE__ */ new Set(["start", "type"]),
840
858
  codeBlock: /* @__PURE__ */ new Set(["language"]),
841
859
  businessToken: /* @__PURE__ */ new Set([
@@ -861,32 +879,32 @@ const ke = /* @__PURE__ */ new Set([
861
879
  "error"
862
880
  ])
863
881
  };
864
- function rt(e) {
882
+ function it(e) {
865
883
  if (!e || typeof e != "object" || Array.isArray(e)) return !1;
866
884
  const t = e;
867
- if (typeof t.type != "string" || !tt.has(t.type) || Object.keys(t).some((o) => !["type", "attrs"].includes(o)) || t.attrs !== void 0 && (!t.attrs || typeof t.attrs != "object" || Array.isArray(t.attrs)))
885
+ if (typeof t.type != "string" || !nt.has(t.type) || Object.keys(t).some((i) => !["type", "attrs"].includes(i)) || t.attrs !== void 0 && (!t.attrs || typeof t.attrs != "object" || Array.isArray(t.attrs)))
868
886
  return !1;
869
887
  const r = t.attrs || {};
870
888
  if (t.type !== "link") return Object.keys(r).length === 0;
871
889
  if (Object.keys(r).some(
872
- (o) => !["href", "target", "rel", "class", "title"].includes(o)
873
- ) || !O(r.href))
890
+ (i) => !["href", "target", "rel", "class", "title"].includes(i)
891
+ ) || !q(r.href))
874
892
  return !1;
875
- const i = (o) => o == null || typeof o == "string";
876
- return !i(r.rel) || !i(r.class) || !i(r.title) || r.target !== void 0 && r.target !== null && !["_blank", "_self"].includes(String(r.target)) ? !1 : r.target !== "_blank" || typeof r.rel == "string" && r.rel.split(/\s+/).includes("noopener");
893
+ const o = (i) => i == null || typeof i == "string";
894
+ return !o(r.rel) || !o(r.class) || !o(r.title) || r.target !== void 0 && r.target !== null && !["_blank", "_self"].includes(String(r.target)) ? !1 : r.target !== "_blank" || typeof r.rel == "string" && r.rel.split(/\s+/).includes("noopener");
877
895
  }
878
896
  function k(e, t, r = "") {
879
- const i = Object.keys(e).find(
880
- (o) => !t.includes(o)
897
+ const o = Object.keys(e).find(
898
+ (i) => !t.includes(i)
881
899
  );
882
- return i ? r ? `${r}.${i}` : i : null;
900
+ return o ? r ? `${r}.${o}` : o : null;
883
901
  }
884
- function x(e, t = "knowledge.doc", r = !1) {
902
+ function v(e, t = "knowledge.doc", r = !1) {
885
903
  if (e === null) return null;
886
- const i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new WeakSet();
904
+ const o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new WeakSet();
887
905
  function a(n, s, c, l = !1) {
888
- var d, y, g, m, f, b, j, L, _, R, h, C, D, B, N, K, F, M, E, U, z, W, H, J, Q, G, Y, X, Z, ee, te, ne, re, oe, ie;
889
- if (!n || typeof n != "object" || !n.type || !ke.has(n.type) || o.has(n) || (o.add(n), c ? !((d = le[c]) != null && d.has(n.type)) : n.type !== "doc") || !r && l && n.type === "businessToken" && ((g = I((y = n.attrs) == null ? void 0 : y.kind)) == null ? void 0 : g.allowInOriginalReply) === !1)
906
+ var d, y, g, m, f, b, _, j, L, R, h, C, D, B, N, K, M, F, E, U, z, W, H, J, Q, G, Y, X, Z, ee, te, ne, re, ie, oe;
907
+ if (!n || typeof n != "object" || !n.type || !we.has(n.type) || i.has(n) || (i.add(n), c ? !((d = ue[c]) != null && d.has(n.type)) : n.type !== "doc") || !r && l && n.type === "businessToken" && ((g = I((y = n.attrs) == null ? void 0 : y.kind)) == null ? void 0 : g.allowInOriginalReply) === !1)
890
908
  return s;
891
909
  for (const p of Object.keys(n))
892
910
  if (!["type", "attrs", "content", "marks", "text"].includes(p))
@@ -898,20 +916,20 @@ function x(e, t = "knowledge.doc", r = !1) {
898
916
  ) && !((m = n.content) != null && m.length))
899
917
  return `${s}.content`;
900
918
  if (n.type === "listItem" && ((b = (f = n.content) == null ? void 0 : f[0]) == null ? void 0 : b.type) !== "paragraph")
901
- return (j = n.content) != null && j.length ? `${s}.content[0]` : `${s}.content`;
919
+ return (_ = n.content) != null && _.length ? `${s}.content[0]` : `${s}.content`;
902
920
  if (n.text !== void 0 && n.type !== "text") return `${s}.text`;
903
921
  if (n.type === "text" && (typeof n.text != "string" || n.text.length === 0))
904
922
  return `${s}.text`;
905
923
  if (n.type === "text" && n.content !== void 0)
906
924
  return `${s}.content`;
907
- if ((L = n.content) != null && L.length && !le[n.type])
925
+ if ((j = n.content) != null && j.length && !ue[n.type])
908
926
  return `${s}.content`;
909
927
  if (n.attrs !== void 0 && (!n.attrs || typeof n.attrs != "object" || Array.isArray(n.attrs)))
910
928
  return `${s}.attrs`;
911
- const u = nt[n.type] || /* @__PURE__ */ new Set();
929
+ const u = rt[n.type] || /* @__PURE__ */ new Set();
912
930
  for (const p of Object.keys(n.attrs || {}))
913
931
  if (!u.has(p)) return `${s}.attrs.${p}`;
914
- if (n.type === "businessToken" && !fe((_ = n.attrs) == null ? void 0 : _.kind))
932
+ if (n.type === "businessToken" && !me((L = n.attrs) == null ? void 0 : L.kind))
915
933
  return `${s}.attrs.kind`;
916
934
  if (n.type === "businessToken") {
917
935
  const p = (C = (h = I(
@@ -925,9 +943,9 @@ function x(e, t = "knowledge.doc", r = !1) {
925
943
  return `${s}.attrs.label`;
926
944
  if (n.type === "businessToken" && ((N = n.attrs) == null ? void 0 : N.token) !== void 0 && n.attrs.token !== null && typeof n.attrs.token != "string")
927
945
  return `${s}.attrs.token`;
928
- if (n.type === "businessToken" && ((K = n.attrs) == null ? void 0 : K.params) != null && (!((F = I(n.attrs.kind)) != null && F.allowsParams) || typeof n.attrs.params != "object" || Array.isArray(n.attrs.params) || ce(n.attrs.params) !== null || JSON.stringify(n.attrs.params).length > 8192))
946
+ if (n.type === "businessToken" && ((K = n.attrs) == null ? void 0 : K.params) != null && (!((M = I(n.attrs.kind)) != null && M.allowsParams) || typeof n.attrs.params != "object" || Array.isArray(n.attrs.params) || pe(n.attrs.params) !== null || JSON.stringify(n.attrs.params).length > 8192))
929
947
  return `${s}.attrs.params`;
930
- if (n.type === "mediaBlock" && !ye((M = n.attrs) == null ? void 0 : M.kind))
948
+ if (n.type === "mediaBlock" && !ke((F = n.attrs) == null ? void 0 : F.kind))
931
949
  return `${s}.attrs.kind`;
932
950
  if (n.type === "mediaBlock") {
933
951
  if (((E = n.attrs) == null ? void 0 : E.assetId) !== void 0 && n.attrs.assetId !== null && typeof n.attrs.assetId != "string")
@@ -939,16 +957,16 @@ function x(e, t = "knowledge.doc", r = !1) {
939
957
  if (((W = n.attrs) == null ? void 0 : W.status) !== void 0 && !["ready", "uploading", "error"].includes(String(n.attrs.status)))
940
958
  return `${s}.attrs.status`;
941
959
  const p = (((H = n.attrs) == null ? void 0 : H.status) === "uploading" || ((J = n.attrs) == null ? void 0 : J.status) === "error") && typeof ((Q = n.attrs) == null ? void 0 : Q.src) == "string" && n.attrs.src.startsWith("blob:");
942
- if (!O((G = n.attrs) == null ? void 0 : G.src) && !p)
960
+ if (!q((G = n.attrs) == null ? void 0 : G.src) && !p)
943
961
  return `${s}.attrs.src`;
944
- if (((Y = n.attrs) == null ? void 0 : Y.poster) !== void 0 && n.attrs.poster !== null && !O(n.attrs.poster))
962
+ if (((Y = n.attrs) == null ? void 0 : Y.poster) !== void 0 && n.attrs.poster !== null && !q(n.attrs.poster))
945
963
  return `${s}.attrs.poster`;
946
964
  }
947
965
  if (V(n.type)) {
948
966
  const p = (X = n.attrs) == null ? void 0 : X.id;
949
- if ((n.type === "mediaBlock" || p !== void 0) && (typeof p != "string" || !p.trim() || i.has(p)))
967
+ if ((n.type === "mediaBlock" || p !== void 0) && (typeof p != "string" || !p.trim() || o.has(p)))
950
968
  return `${s}.attrs.id`;
951
- if (typeof p == "string" && i.add(p), ((Z = n.attrs) == null ? void 0 : Z.nodeVersion) !== void 0 && (!Number.isSafeInteger(n.attrs.nodeVersion) || n.attrs.nodeVersion < 0))
969
+ if (typeof p == "string" && o.add(p), ((Z = n.attrs) == null ? void 0 : Z.nodeVersion) !== void 0 && (!Number.isSafeInteger(n.attrs.nodeVersion) || n.attrs.nodeVersion < 0))
952
970
  return `${s}.attrs.nodeVersion`;
953
971
  }
954
972
  if (n.type === "orderedList" && ((ee = n.attrs) == null ? void 0 : ee.start) !== void 0 && (!Number.isSafeInteger(n.attrs.start) || n.attrs.start < 1))
@@ -960,9 +978,9 @@ function x(e, t = "knowledge.doc", r = !1) {
960
978
  if (n.marks !== void 0 && !Array.isArray(n.marks))
961
979
  return `${s}.marks`;
962
980
  if (c === "codeBlock" && ((re = n.marks) != null && re.length)) return `${s}.marks`;
963
- if ((oe = n.marks) != null && oe.some((p) => !rt(p)))
981
+ if ((ie = n.marks) != null && ie.some((p) => !it(p)))
964
982
  return `${s}.marks`;
965
- if ((ie = n.marks) != null && ie.length) {
983
+ if ((oe = n.marks) != null && oe.length) {
966
984
  const p = n.marks.map((T) => T.type);
967
985
  if (new Set(p).size !== p.length || p.includes("code") && p.length > 1)
968
986
  return `${s}.marks`;
@@ -982,35 +1000,35 @@ function x(e, t = "knowledge.doc", r = !1) {
982
1000
  }
983
1001
  function ot(e, t, r = "knowledge.doc") {
984
1002
  if (!e) return null;
985
- const i = /* @__PURE__ */ new WeakSet(), o = (a, n) => {
986
- if (i.has(a)) return n;
987
- i.add(a);
988
- const s = Ge(a);
989
- if (s && !q.some(
1003
+ const o = /* @__PURE__ */ new WeakSet(), i = (a, n) => {
1004
+ if (o.has(a)) return n;
1005
+ o.add(a);
1006
+ const s = Ye(a);
1007
+ if (s && !O.some(
990
1008
  (c) => c.id === s.id && c.slot === s.slot && c.types.includes(t)
991
1009
  ))
992
1010
  return n;
993
1011
  for (const [c, l] of (a.content || []).entries()) {
994
- const u = o(l, `${n}.content[${c}]`);
1012
+ const u = i(l, `${n}.content[${c}]`);
995
1013
  if (u) return u;
996
1014
  }
997
1015
  return null;
998
1016
  };
999
- return o(e, r);
1017
+ return i(e, r);
1000
1018
  }
1001
- function kt(e) {
1019
+ function bt(e) {
1002
1020
  if (!e || typeof e != "object" || Array.isArray(e)) return !1;
1003
- const t = e, r = t.question, i = t.knowledge;
1004
- return ["normal", "reasoning", "agent"].includes(String(t.type)) && !!r && typeof r == "object" && !Array.isArray(r) && typeof r.text == "string" && !!i && typeof i == "object" && !Array.isArray(i) && Object.prototype.hasOwnProperty.call(i, "doc") && !!t.extensionState && typeof t.extensionState == "object" && !Array.isArray(t.extensionState);
1021
+ const t = e, r = t.question, o = t.knowledge;
1022
+ return ["normal", "reasoning", "agent"].includes(String(t.type)) && !!r && typeof r == "object" && !Array.isArray(r) && typeof r.text == "string" && !!o && typeof o == "object" && !Array.isArray(o) && Object.prototype.hasOwnProperty.call(o, "doc") && !!t.extensionState && typeof t.extensionState == "object" && !Array.isArray(t.extensionState);
1005
1023
  }
1006
- function bt(e) {
1024
+ function wt(e) {
1007
1025
  if (!e || typeof e != "object" || Array.isArray(e))
1008
1026
  return "modelValue";
1009
- const t = ce(e);
1027
+ const t = pe(e);
1010
1028
  if (t !== null) return t || "modelValue";
1011
1029
  const r = e;
1012
1030
  if (r.schemaVersion !== 1) return "schemaVersion";
1013
- const i = k(r, [
1031
+ const o = k(r, [
1014
1032
  "schemaVersion",
1015
1033
  "id",
1016
1034
  "type",
@@ -1018,17 +1036,17 @@ function bt(e) {
1018
1036
  "knowledge",
1019
1037
  "extensionState"
1020
1038
  ]);
1021
- if (i) return i;
1039
+ if (o) return o;
1022
1040
  if (r.id !== void 0 && typeof r.id != "string") return "id";
1023
1041
  if (!["normal", "reasoning", "agent"].includes(r.type)) return "type";
1024
1042
  if (!r.question || typeof r.question != "object" || Array.isArray(r.question) || typeof r.question.text != "string")
1025
1043
  return "question.text";
1026
- const o = k(
1044
+ const i = k(
1027
1045
  r.question,
1028
1046
  ["text"],
1029
1047
  "question"
1030
1048
  );
1031
- if (o) return o;
1049
+ if (i) return i;
1032
1050
  if (!r.knowledge || typeof r.knowledge != "object" || Array.isArray(r.knowledge))
1033
1051
  return "knowledge";
1034
1052
  const a = k(
@@ -1057,14 +1075,14 @@ function bt(e) {
1057
1075
  );
1058
1076
  if (u) return u;
1059
1077
  }
1060
- const n = x(r.knowledge.doc);
1078
+ const n = v(r.knowledge.doc);
1061
1079
  if (n) return n;
1062
1080
  const s = ot(
1063
1081
  r.knowledge.doc,
1064
1082
  r.type
1065
1083
  );
1066
1084
  if (s) return s;
1067
- const c = x(
1085
+ const c = v(
1068
1086
  r.knowledge.retainedDoc ?? null,
1069
1087
  "knowledge.retainedDoc",
1070
1088
  r.type === "agent"
@@ -1073,7 +1091,7 @@ function bt(e) {
1073
1091
  if (r.type === "agent") {
1074
1092
  if (r.knowledge.agentBody && r.knowledge.retainedDoc)
1075
1093
  return "knowledge.agentBody";
1076
- const l = x(
1094
+ const l = v(
1077
1095
  r.knowledge.agentBody ?? null,
1078
1096
  "knowledge.agentBody",
1079
1097
  !0
@@ -1083,7 +1101,7 @@ function bt(e) {
1083
1101
  if (!r.extensionState || typeof r.extensionState != "object" || Array.isArray(r.extensionState))
1084
1102
  return "extensionState";
1085
1103
  for (const [l, u] of Object.entries(r.extensionState)) {
1086
- const d = q.find(
1104
+ const d = O.find(
1087
1105
  (g) => g.id === l && g.types.includes(r.type) && g.implementation === "plugin"
1088
1106
  );
1089
1107
  if (!d) return `extensionState.${l}`;
@@ -1110,7 +1128,7 @@ function bt(e) {
1110
1128
  const f = m;
1111
1129
  if (typeof f.id != "string" || !f.id.trim())
1112
1130
  return `extensionState.${l}.data.tag.id`;
1113
- if (typeof f.label != "string" || !f.label.trim() || me(f.label))
1131
+ if (typeof f.label != "string" || !f.label.trim() || be(f.label))
1114
1132
  return `extensionState.${l}.data.tag.label`;
1115
1133
  const b = k(
1116
1134
  f,
@@ -1124,40 +1142,40 @@ function bt(e) {
1124
1142
  return null;
1125
1143
  }
1126
1144
  export {
1127
- q as A,
1128
- it as B,
1129
- Ee as C,
1130
- Ge as D,
1131
- mt as E,
1132
- kt as F,
1133
- me as G,
1134
- ge as H,
1135
- Ze as I,
1136
- Ue as M,
1137
- et as a,
1138
- O as b,
1139
- bt as c,
1140
- _e as d,
1141
- st as e,
1145
+ O as A,
1146
+ st as B,
1147
+ Ue as C,
1148
+ Ye as D,
1149
+ kt as E,
1150
+ bt as F,
1151
+ be as G,
1152
+ ye as H,
1153
+ et as I,
1154
+ ze as M,
1155
+ pe as a,
1156
+ v as b,
1157
+ de as c,
1158
+ V as d,
1159
+ tt as e,
1142
1160
  ce as f,
1143
1161
  I as g,
1144
- Xe as h,
1145
- V as i,
1146
- Fe as j,
1147
- ct as k,
1148
- ut as l,
1149
- ft as m,
1150
- fe as n,
1151
- ue as o,
1152
- lt as p,
1153
- A as q,
1154
- x as r,
1155
- yt as s,
1156
- dt as t,
1157
- gt as u,
1158
- at as v,
1162
+ Ze as h,
1163
+ q as i,
1164
+ wt as j,
1165
+ Ce as k,
1166
+ at as l,
1167
+ ut as m,
1168
+ pt as n,
1169
+ yt as o,
1170
+ ct as p,
1171
+ me as q,
1172
+ A as r,
1173
+ mt as s,
1174
+ gt as t,
1175
+ ft as u,
1176
+ lt as v,
1159
1177
  $ as w,
1160
- pt as x,
1161
- Qe as y,
1162
- Ye as z
1178
+ dt as x,
1179
+ Ge as y,
1180
+ Xe as z
1163
1181
  };