@freecallai/pro 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) 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-DIIFWISD.js +4995 -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-Ch1YRmMw.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-C1SxozNA.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-CXpVx8UR.js → guard-Cr_ny-sR.js} +226 -213
  14. package/dist/{index-B8jg37Wj.js → index-5FRWdHnd.js} +1 -1
  15. package/dist/index-7x1OTv0m.js +98 -0
  16. package/dist/{index-CM0MN2DT.js → index-BBxrpF3v.js} +1 -1
  17. package/dist/index-CEjD03Kk.js +5 -0
  18. package/dist/{index-UjI4WA5F.js → index-CK_CrdQW.js} +1 -1
  19. package/dist/index-Ck8RYpuE.js +816 -0
  20. package/dist/{index-lNhA3N9x.js → index-DBQsQ1ZK.js} +1 -0
  21. package/dist/{index-BqXNMfLG.js → index-DiaPY8Db.js} +2 -2
  22. package/dist/{index-bSNw0XAf.js → index-DmdrsEvk.js} +1 -1
  23. package/dist/index-DnmCPdCI.js +168 -0
  24. package/dist/{index-Cy4DqT8R.js → index-DwDYy2lj.js} +1 -1
  25. package/dist/{index-CZc2Gyjb.js → index-aic1yCBs.js} +1 -1
  26. package/dist/index-sWjZ9xuV.js +5 -0
  27. package/dist/index.js +13 -13
  28. package/dist/{inline-Zj7Hqg-_.js → inline-8aNfINLF.js} +1 -1
  29. package/dist/knowledge-type-picker/index.js +1 -1
  30. package/dist/{knowledge-DaTnF2IW.js → knowledge-y2j0ijgx.js} +1 -1
  31. package/dist/media-id-b2dgniSy.js +15 -0
  32. package/dist/{media-migration-C2QLMSpd.js → media-migration-Dy_rbdkK.js} +1 -1
  33. package/dist/media-policy-BwKjZPWt.js +158 -0
  34. package/dist/{media-upload-D9MYBbLg.js → media-upload-BetGuTLJ.js} +1 -1
  35. package/dist/model-DvukseoR.js +146 -0
  36. package/dist/navigation/index.js +1 -1
  37. package/dist/rich-text/index.js +75 -73
  38. package/dist/rich-text/legacy-converter/index.js +822 -799
  39. package/dist/style.css +1 -1
  40. package/dist/switcher/index.js +1 -1
  41. package/dist/types/agent-prompt-editor/FkpAgentPromptEditor.vue.d.ts +550 -0
  42. package/dist/types/agent-prompt-editor/agent-size-chart.d.ts +3 -0
  43. package/dist/types/agent-prompt-editor/document-adapter.d.ts +3 -0
  44. package/dist/types/agent-prompt-editor/index.d.ts +6 -0
  45. package/dist/types/agent-prompt-editor/legacy-converter-index.d.ts +2 -0
  46. package/dist/types/agent-prompt-editor/legacy-converter.d.ts +26 -0
  47. package/dist/types/agent-prompt-editor/model.d.ts +21 -0
  48. package/dist/types/agent-prompt-editor/types.d.ts +56 -0
  49. package/dist/types/edition-info/FkpEditionInfo.vue.d.ts +1 -3
  50. package/dist/types/edition-info/presets.d.ts +8 -0
  51. package/dist/types/edition-info/types.d.ts +1 -0
  52. package/dist/types/filters/FkpFilter.vue.d.ts +2 -2
  53. package/dist/types/filters/FkpFilterDateRange.vue.d.ts +2 -2
  54. package/dist/types/filters/FkpFilterPeriod.vue.d.ts +2 -2
  55. package/dist/types/filters/FkpSearchableMultiSelect.vue.d.ts +2 -2
  56. package/dist/types/index.d.ts +4 -1
  57. package/dist/types/navigation/FkpNavigation.vue.d.ts +20 -29
  58. package/dist/types/navigation/NavigationButton.vue.d.ts +26 -0
  59. package/dist/types/navigation/NavigationGroup.vue.d.ts +45 -0
  60. package/dist/types/navigation/NavigationIcon.vue.d.ts +28 -0
  61. package/dist/types/navigation/NavigationNodes.vue.d.ts +40 -0
  62. package/dist/types/navigation/index.d.ts +1 -1
  63. package/dist/types/navigation/types.d.ts +43 -5
  64. package/dist/types/navigation/use-navigation-tree.d.ts +13 -0
  65. package/dist/types/rich-text/FkpRichText.vue.d.ts +31 -9
  66. package/dist/types/rich-text/config/descriptor.d.ts +1 -0
  67. package/dist/types/rich-text/config/resolve.d.ts +1 -1
  68. package/dist/types/rich-text/index.d.ts +4 -1
  69. package/dist/types/rich-text/knowledge-document-adapter.d.ts +2 -0
  70. package/dist/types/rich-text/model/question-text.d.ts +1 -1
  71. package/dist/types/rich-text/plugins/registry.d.ts +2 -1
  72. package/dist/types/rich-text/public/types.d.ts +16 -0
  73. package/dist/types/rich-text/runtime/document-adapter.d.ts +9 -0
  74. package/dist/types/rich-text/runtime/knowledge-clipboard.d.ts +9 -3
  75. package/dist/types/rich-text/runtime/media-sources.d.ts +7 -0
  76. package/dist/types/rich-text/runtime/media-upload-session.d.ts +2 -0
  77. package/dist/types/rich-text/ui/FkpKnowledgeTypePicker.vue.d.ts +3 -3
  78. package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +18 -3
  79. package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +190 -0
  80. package/dist/types/rich-text/ui/ToolForm.vue.d.ts +2 -2
  81. package/dist/types/rich-text/ui/token-renderer.d.ts +3 -0
  82. package/dist/types/rich-text/ui/useMediaHint.d.ts +6 -0
  83. package/dist/types/switcher/FkpSwitcher.vue.d.ts +2 -2
  84. package/dist/types-PvYB5e85.js +14 -0
  85. package/package.json +13 -5
  86. package/dist/FkpKnowledgeTypePicker.vue_vue_type_script_setup_true_lang-DYwu7oQs.js +0 -187
  87. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-BowbZoTQ.js +0 -4885
  88. package/dist/KnowledgeArea-BH-_uF6R.js +0 -1438
  89. package/dist/ToolForm-C6XW31Y7.js +0 -185
  90. package/dist/index-CS2xQQ8W.js +0 -168
  91. package/dist/index-D0bJAQSN.js +0 -327
  92. package/dist/index-DAZ1ulyA.js +0 -5
  93. package/dist/index-DCmHHi07.js +0 -71
  94. package/dist/index-F7lDP1lI.js +0 -5
@@ -0,0 +1,816 @@
1
+ import { defineComponent as R, openBlock as r, createElementBlock as K, renderSlot as T, createBlock as B, unref as h, createCommentVNode as N, computed as U, normalizeClass as F, createVNode as M, withCtx as u, toDisplayString as E, createElementVNode as $, shallowRef as G, ref as _, watch as D, withKeys as j, withModifiers as A, createSlots as O, normalizeProps as x, guardReactiveProps as ee, nextTick as te, useSlots as ae, Fragment as Z, renderList as W, mergeProps as J, isVNode as re, Comment as de, Text as pe, onBeforeUnmount as ue } from "vue";
2
+ import { Trigger as Q, Menu as se, SubMenu as ce, MenuItem as ye, SortableList as fe, Tooltip as me } from "@freecallai/ui";
3
+ import { IconMore as ke } from "@freecallai/ui/es/icon/index.js";
4
+ import ve from "@freecallai/icons";
5
+ const ge = { class: "fkp-navigation-item-icon" }, be = ["src"], H = /* @__PURE__ */ R({
6
+ __name: "NavigationIcon",
7
+ props: {
8
+ icon: {},
9
+ iconUrl: {},
10
+ size: { default: 24 }
11
+ },
12
+ setup(g) {
13
+ return (b, d) => (r(), K("span", ge, [
14
+ T(b.$slots, "default", {}, () => [
15
+ b.iconUrl ? (r(), K("img", {
16
+ key: 0,
17
+ src: b.iconUrl,
18
+ alt: ""
19
+ }, null, 8, be)) : b.icon ? (r(), B(h(ve), {
20
+ key: 1,
21
+ name: b.icon,
22
+ size: b.size
23
+ }, null, 8, ["name", "size"])) : N("", !0)
24
+ ])
25
+ ]));
26
+ }
27
+ }), ie = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M5.33325%2010.6667L10.9999%205'%20stroke='%23C9CDD4'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M5%205H11V11'%20stroke='%23C9CDD4'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e", he = ["aria-label", "aria-current", "disabled", "data-item-key"], Ke = {
28
+ key: 0,
29
+ class: "fkp-navigation-item-label"
30
+ }, $e = {
31
+ key: 1,
32
+ class: "fkp-navigation-open",
33
+ "aria-hidden": "true"
34
+ }, Ce = ["src"], oe = /* @__PURE__ */ R({
35
+ __name: "NavigationButton",
36
+ props: {
37
+ item: {},
38
+ section: {},
39
+ selectedKey: {},
40
+ collapsed: { type: Boolean }
41
+ },
42
+ emits: ["select"],
43
+ setup(g, { emit: b }) {
44
+ const d = g, c = b, k = U(
45
+ () => !d.item.opensInNewTab && d.selectedKey === d.item.key
46
+ );
47
+ return (f, S) => (r(), K("button", {
48
+ type: "button",
49
+ class: F(["fkp-navigation-item", { "is-selected": k.value }]),
50
+ "aria-label": f.item.label,
51
+ "aria-current": k.value ? "page" : void 0,
52
+ disabled: f.item.disabled,
53
+ "data-item-key": f.item.key,
54
+ onClick: S[0] || (S[0] = (w) => c("select", f.item.key))
55
+ }, [
56
+ M(H, {
57
+ icon: f.item.icon,
58
+ "icon-url": f.item.iconUrl
59
+ }, {
60
+ default: u(() => [
61
+ T(f.$slots, "item-icon", {
62
+ item: f.item,
63
+ section: f.section,
64
+ level: 0
65
+ })
66
+ ]),
67
+ _: 3
68
+ }, 8, ["icon", "icon-url"]),
69
+ f.collapsed ? N("", !0) : (r(), K("span", Ke, E(f.item.label), 1)),
70
+ f.item.opensInNewTab && !f.collapsed ? (r(), K("span", $e, [
71
+ $("img", {
72
+ src: h(ie),
73
+ alt: ""
74
+ }, null, 8, Ce)
75
+ ])) : N("", !0)
76
+ ], 10, he));
77
+ }
78
+ }), we = ["disabled", "data-item-key", "aria-label", "aria-expanded"], Se = {
79
+ key: 0,
80
+ class: "fkp-navigation-menu-label"
81
+ }, Pe = { class: "fkp-navigation-group-popup-title" }, Ie = ["tabindex", "aria-label", "aria-expanded", "aria-disabled"], Ne = /* @__PURE__ */ R({
82
+ __name: "NavigationGroup",
83
+ props: {
84
+ item: {},
85
+ section: {},
86
+ level: {},
87
+ selectedKey: {},
88
+ expandedKeys: {},
89
+ collapsed: { type: Boolean, default: !1 },
90
+ inPopup: { type: Boolean, default: !1 },
91
+ disabled: { type: Boolean, default: !1 },
92
+ panelVisible: { type: Boolean, default: !1 },
93
+ activeGroupKey: {}
94
+ },
95
+ emits: ["group-open", "select"],
96
+ setup(g, { emit: b }) {
97
+ const d = g, c = b, k = G(!1), f = _(), S = _(), w = G(!1), z = U(() => d.collapsed || d.inPopup), y = U(() => d.disabled || !!d.item.disabled), o = U(() => {
98
+ const e = (v) => v.some(
99
+ (C) => {
100
+ var q;
101
+ return (q = C.children) != null && q.length ? e(C.children) : !C.opensInNewTab && C.key === d.selectedKey;
102
+ }
103
+ );
104
+ return e(d.item.children ?? []);
105
+ }), a = (e = !1) => {
106
+ var v;
107
+ k.value = !1, w.value = !1, e && ((v = f.value) == null || v.focus());
108
+ }, l = async () => {
109
+ var v;
110
+ if (!w.value || !k.value) return;
111
+ await te();
112
+ const e = (v = S.value) == null ? void 0 : v.querySelector(
113
+ '[tabindex="0"], button:not(:disabled)'
114
+ );
115
+ e && (e.focus(), w.value = !1);
116
+ }, m = (e) => {
117
+ e && y.value || (k.value = e, e ? (c("group-open"), l()) : w.value = !1);
118
+ }, p = (e) => {
119
+ if (e.key === "Escape")
120
+ e.preventDefault(), e.stopPropagation(), a(!0);
121
+ else if (e.key === "Enter" || e.key === " ") {
122
+ if (e.preventDefault(), e.stopPropagation(), y.value) return;
123
+ w.value = !k.value, m(!k.value);
124
+ } else if (e.key === "ArrowRight" || e.key === "ArrowDown") {
125
+ if (e.preventDefault(), e.stopPropagation(), y.value) return;
126
+ w.value = !0, m(!0);
127
+ }
128
+ }, V = (e) => {
129
+ e.key !== "Enter" && e.key !== " " || (e.preventDefault(), e.stopPropagation(), y.value || e.currentTarget.click());
130
+ }, I = (e) => {
131
+ y.value && e.stopPropagation();
132
+ }, L = (e) => {
133
+ a(), c("select", e);
134
+ };
135
+ return D(
136
+ () => d.activeGroupKey,
137
+ (e) => {
138
+ e !== void 0 && e !== d.item.key && a();
139
+ }
140
+ ), D(
141
+ () => d.collapsed,
142
+ () => a()
143
+ ), D(
144
+ () => d.panelVisible,
145
+ (e) => {
146
+ e && a();
147
+ }
148
+ ), D(y, (e) => {
149
+ e && a();
150
+ }), (e, v) => z.value ? (r(), B(h(Q), {
151
+ key: 0,
152
+ "popup-visible": k.value,
153
+ trigger: ["hover", "click"],
154
+ disabled: y.value,
155
+ position: "rt",
156
+ "popup-offset": 24,
157
+ "mouse-leave-delay": 180,
158
+ "auto-fit-popup-min-width": !1,
159
+ "onUpdate:popupVisible": m,
160
+ onShow: l
161
+ }, {
162
+ content: u(() => [
163
+ $("div", {
164
+ ref_key: "popupContent",
165
+ ref: S,
166
+ class: "fkp-navigation-group-popup",
167
+ onKeydown: v[1] || (v[1] = j(A((C) => a(!0), ["stop", "prevent"]), ["esc"]))
168
+ }, [
169
+ $("strong", Pe, E(e.item.label), 1),
170
+ M(h(se), {
171
+ "prefix-cls": "arco-trigger-menu",
172
+ "selected-keys": o.value && e.selectedKey ? [e.selectedKey] : [],
173
+ "auto-open-selected": !1
174
+ }, {
175
+ default: u(() => [
176
+ M(X, {
177
+ items: e.item.children || [],
178
+ section: e.section,
179
+ level: e.level + 1,
180
+ "selected-key": e.selectedKey,
181
+ "expanded-keys": e.expandedKeys,
182
+ "in-popup": !0,
183
+ disabled: y.value,
184
+ "panel-visible": e.panelVisible,
185
+ onSelect: L,
186
+ onGroupOpen: v[0] || (v[0] = (C) => c("group-open"))
187
+ }, O({ _: 2 }, [
188
+ e.$slots["item-icon"] ? {
189
+ name: "item-icon",
190
+ fn: u((C) => [
191
+ T(e.$slots, "item-icon", x(ee(C)))
192
+ ]),
193
+ key: "0"
194
+ } : void 0
195
+ ]), 1032, ["items", "section", "level", "selected-key", "expanded-keys", "disabled", "panel-visible"])
196
+ ]),
197
+ _: 3
198
+ }, 8, ["selected-keys"])
199
+ ], 544)
200
+ ]),
201
+ default: u(() => [
202
+ $("button", {
203
+ ref_key: "triggerButton",
204
+ ref: f,
205
+ type: "button",
206
+ class: F(["fkp-navigation-group", [
207
+ e.inPopup ? "arco-trigger-menu-pop-header" : "arco-menu-pop-header",
208
+ {
209
+ "is-disabled": y.value,
210
+ "arco-menu-selected": o.value && !e.inPopup,
211
+ "arco-trigger-menu-selected": o.value && e.inPopup
212
+ }
213
+ ]]),
214
+ disabled: y.value,
215
+ "data-item-key": e.item.key,
216
+ "aria-label": e.item.label,
217
+ "aria-haspopup": "menu",
218
+ "aria-expanded": k.value,
219
+ onKeydown: p
220
+ }, [
221
+ $("span", {
222
+ class: F(e.inPopup ? "arco-trigger-menu-icon" : "arco-menu-icon")
223
+ }, [
224
+ M(H, {
225
+ icon: e.item.icon,
226
+ "icon-url": e.item.iconUrl,
227
+ size: 16
228
+ }, {
229
+ default: u(() => [
230
+ T(e.$slots, "item-icon", {
231
+ item: e.item,
232
+ section: e.section,
233
+ level: e.level
234
+ })
235
+ ]),
236
+ _: 3
237
+ }, 8, ["icon", "icon-url"])
238
+ ], 2),
239
+ e.inPopup ? (r(), K("span", Se, E(e.item.label), 1)) : N("", !0)
240
+ ], 42, we)
241
+ ]),
242
+ _: 3
243
+ }, 8, ["popup-visible", "disabled"])) : (r(), B(h(ce), {
244
+ key: e.item.key,
245
+ class: F(["fkp-navigation-group", { "is-disabled": y.value }]),
246
+ "aria-disabled": y.value || void 0,
247
+ "data-item-key": e.item.key,
248
+ onClickCapture: I
249
+ }, {
250
+ icon: u(() => [
251
+ M(H, {
252
+ icon: e.item.icon,
253
+ "icon-url": e.item.iconUrl,
254
+ size: 16
255
+ }, {
256
+ default: u(() => [
257
+ T(e.$slots, "item-icon", {
258
+ item: e.item,
259
+ section: e.section,
260
+ level: e.level
261
+ })
262
+ ]),
263
+ _: 3
264
+ }, 8, ["icon", "icon-url"])
265
+ ]),
266
+ title: u(() => [
267
+ $("span", {
268
+ class: "fkp-navigation-group-label",
269
+ role: "button",
270
+ tabindex: y.value ? -1 : 0,
271
+ "aria-label": e.item.label,
272
+ "aria-expanded": e.expandedKeys.includes(e.item.key),
273
+ "aria-disabled": y.value || void 0,
274
+ onKeydown: V
275
+ }, E(e.item.label), 41, Ie)
276
+ ]),
277
+ default: u(() => [
278
+ M(X, {
279
+ items: e.item.children || [],
280
+ section: e.section,
281
+ level: e.level + 1,
282
+ "selected-key": e.selectedKey,
283
+ "expanded-keys": e.expandedKeys,
284
+ disabled: y.value,
285
+ "panel-visible": e.panelVisible,
286
+ onSelect: v[2] || (v[2] = (C) => c("select", C)),
287
+ onGroupOpen: v[3] || (v[3] = (C) => c("group-open"))
288
+ }, O({ _: 2 }, [
289
+ e.$slots["item-icon"] ? {
290
+ name: "item-icon",
291
+ fn: u((C) => [
292
+ T(e.$slots, "item-icon", x(ee(C)))
293
+ ]),
294
+ key: "0"
295
+ } : void 0
296
+ ]), 1032, ["items", "section", "level", "selected-key", "expanded-keys", "disabled", "panel-visible"])
297
+ ]),
298
+ _: 3
299
+ }, 8, ["class", "aria-disabled", "data-item-key"]));
300
+ }
301
+ }), Te = { class: "fkp-navigation-menu-label" }, Ve = {
302
+ key: 0,
303
+ class: "fkp-navigation-open",
304
+ "aria-hidden": "true"
305
+ }, Be = ["src"], X = /* @__PURE__ */ R({
306
+ name: "NavigationNodes",
307
+ __name: "NavigationNodes",
308
+ props: {
309
+ items: {},
310
+ section: {},
311
+ level: { default: 0 },
312
+ selectedKey: {},
313
+ expandedKeys: { default: () => [] },
314
+ disabled: { type: Boolean, default: !1 },
315
+ collapsed: { type: Boolean, default: !1 },
316
+ inPopup: { type: Boolean, default: !1 },
317
+ panelVisible: { type: Boolean, default: !1 }
318
+ },
319
+ emits: ["group-open", "select"],
320
+ setup(g, { emit: b }) {
321
+ const d = g, c = b, k = ae(), f = G(), S = (o) => Array.isArray(o) ? o.some(S) : typeof o == "string" ? o.trim().length > 0 : !re(o) || o.type === de ? !1 : o.type === Z || o.type === pe ? S(o.children) : !0, w = (o) => {
322
+ var a;
323
+ return !d.level || o.icon || o.iconUrl ? !0 : S(
324
+ (a = k["item-icon"]) == null ? void 0 : a.call(k, { item: o, section: d.section, level: d.level })
325
+ );
326
+ }, z = (o) => {
327
+ f.value = o, c("group-open");
328
+ }, y = (o, a) => {
329
+ o.key !== "Enter" && o.key !== " " || (o.preventDefault(), o.stopPropagation(), a || o.currentTarget.click());
330
+ };
331
+ return (o, a) => (r(!0), K(Z, null, W(o.items, (l) => {
332
+ var m;
333
+ return r(), K(Z, {
334
+ key: l.key
335
+ }, [
336
+ (m = l.children) != null && m.length ? (r(), B(Ne, {
337
+ key: 0,
338
+ item: l,
339
+ section: o.section,
340
+ level: o.level,
341
+ "selected-key": o.selectedKey,
342
+ "expanded-keys": o.expandedKeys,
343
+ disabled: o.disabled,
344
+ collapsed: o.collapsed,
345
+ "in-popup": o.inPopup,
346
+ "panel-visible": o.panelVisible,
347
+ "active-group-key": f.value,
348
+ onSelect: a[0] || (a[0] = (p) => c("select", p)),
349
+ onGroupOpen: (p) => z(l.key)
350
+ }, O({ _: 2 }, [
351
+ o.$slots["item-icon"] ? {
352
+ name: "item-icon",
353
+ fn: u((p) => [
354
+ T(o.$slots, "item-icon", J({ ref_for: !0 }, p))
355
+ ]),
356
+ key: "0"
357
+ } : void 0
358
+ ]), 1032, ["item", "section", "level", "selected-key", "expanded-keys", "disabled", "collapsed", "in-popup", "panel-visible", "active-group-key", "onGroupOpen"])) : (r(), B(h(ye), {
359
+ key: l.key,
360
+ disabled: o.disabled || l.disabled,
361
+ "data-item-key": l.key,
362
+ role: "menuitem",
363
+ tabindex: o.disabled || l.disabled ? -1 : 0,
364
+ "aria-label": l.label,
365
+ "aria-disabled": o.disabled || l.disabled || void 0,
366
+ "aria-current": !l.opensInNewTab && o.selectedKey === l.key ? "page" : void 0,
367
+ onKeydown: (p) => y(p, o.disabled || !!l.disabled),
368
+ onClick: (p) => c("select", l.key)
369
+ }, O({
370
+ default: u(() => [
371
+ $("span", Te, E(l.label), 1),
372
+ l.opensInNewTab ? (r(), K("span", Ve, [
373
+ $("img", {
374
+ src: h(ie),
375
+ alt: ""
376
+ }, null, 8, Be)
377
+ ])) : N("", !0)
378
+ ]),
379
+ _: 2
380
+ }, [
381
+ w(l) ? {
382
+ name: "icon",
383
+ fn: u(() => [
384
+ M(H, {
385
+ icon: l.icon,
386
+ "icon-url": l.iconUrl,
387
+ size: o.level ? 16 : 24
388
+ }, {
389
+ default: u(() => [
390
+ T(o.$slots, "item-icon", {
391
+ item: l,
392
+ section: o.section,
393
+ level: o.level
394
+ })
395
+ ]),
396
+ _: 2
397
+ }, 1032, ["icon", "icon-url", "size"])
398
+ ]),
399
+ key: "0"
400
+ } : void 0
401
+ ]), 1032, ["disabled", "data-item-key", "tabindex", "aria-label", "aria-disabled", "aria-current", "onKeydown", "onClick"]))
402
+ ], 64);
403
+ }), 128));
404
+ }
405
+ }), ne = (g, b) => g.length === b.length && g.every((d, c) => d === b[c]), Me = (g, b) => {
406
+ const d = G([]), c = U(() => {
407
+ const o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), l = (m, p, V, I) => {
408
+ var L;
409
+ for (const e of m) {
410
+ const v = I || !!e.disabled;
411
+ a.set(e.key, { item: e, sectionKey: p, ancestorKeys: V, disabled: v }), (L = e.children) != null && L.length && (o.add(e.key), l(
412
+ e.children,
413
+ p,
414
+ [...V, e.key],
415
+ v
416
+ ));
417
+ }
418
+ };
419
+ return g.sections.forEach(
420
+ (m) => l(m.items, m.key, [], !1)
421
+ ), { groupKeys: o, entries: a };
422
+ }), k = U(
423
+ () => [...g.expandedKeys ?? d.value].filter(
424
+ (o) => c.value.groupKeys.has(o)
425
+ )
426
+ ), f = U(
427
+ () => g.selectedKey !== void 0 ? c.value.entries.get(g.selectedKey) : void 0
428
+ ), S = U(() => {
429
+ var a, l;
430
+ const o = (a = f.value) == null ? void 0 : a.item;
431
+ return o && !o.opensInNewTab && !((l = o.children) != null && l.length) ? [o.key] : [];
432
+ }), w = (o) => {
433
+ const a = [...new Set(o)].filter(
434
+ (l) => c.value.groupKeys.has(l)
435
+ );
436
+ g.expandedKeys === void 0 && (d.value = a), (g.expandedKeys === void 0 || !ne(a, g.expandedKeys)) && b(a);
437
+ }, z = (o, a) => {
438
+ const l = k.value.filter(
439
+ (m) => {
440
+ var p;
441
+ return ((p = c.value.entries.get(m)) == null ? void 0 : p.sectionKey) !== o;
442
+ }
443
+ );
444
+ w([...l, ...a]);
445
+ }, y = (o) => {
446
+ var l;
447
+ const a = c.value.entries.get(o);
448
+ return a && !a.disabled && !((l = a.item.children) != null && l.length) ? a.item : void 0;
449
+ };
450
+ return D(
451
+ () => g.selectedKey,
452
+ () => {
453
+ var o;
454
+ w([
455
+ ...k.value,
456
+ ...((o = f.value) == null ? void 0 : o.ancestorKeys) ?? []
457
+ ]);
458
+ },
459
+ { immediate: !0 }
460
+ ), D(
461
+ () => [...c.value.groupKeys],
462
+ (o, a) => {
463
+ var V;
464
+ if (a && ne(o, a)) return;
465
+ const l = new Set(a), m = o.filter((I) => !l.has(I)), p = g.expandedKeys ?? [
466
+ ...k.value,
467
+ ...m
468
+ ];
469
+ w([
470
+ ...p,
471
+ ...((V = f.value) == null ? void 0 : V.ancestorKeys) ?? []
472
+ ]);
473
+ },
474
+ { immediate: !0 }
475
+ ), {
476
+ expandedKeys: k,
477
+ selectedKeys: S,
478
+ updateSectionExpandedKeys: z,
479
+ getSelectableItem: y
480
+ };
481
+ }, Ue = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.33325%2014H14.3333'%20stroke='%2386909C'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M3.66675%208.90663V11.3333H6.10581L13.0001%204.43603L10.5651%202L3.66675%208.90663Z'%20stroke='%2386909C'%20stroke-linejoin='round'/%3e%3c/svg%3e", De = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.33341%203.33333C6.33341%204.0697%205.73645%204.66667%205.00008%204.66667C4.26371%204.66667%203.66675%204.0697%203.66675%203.33333C3.66675%202.59695%204.26371%202%205.00008%202C5.73645%202%206.33341%202.59695%206.33341%203.33333ZM5.00008%209.33333C5.73645%209.33333%206.33341%208.73637%206.33341%208C6.33341%207.26363%205.73645%206.66667%205.00008%206.66667C4.26371%206.66667%203.66675%207.26363%203.66675%208C3.66675%208.73637%204.26371%209.33333%205.00008%209.33333ZM5.00008%2014C5.73645%2014%206.33341%2013.403%206.33341%2012.6667C6.33341%2011.9303%205.73645%2011.3333%205.00008%2011.3333C4.26371%2011.3333%203.66675%2011.9303%203.66675%2012.6667C3.66675%2013.403%204.26371%2014%205.00008%2014Z'%20fill='%2386909C'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.3334%203.33333C12.3334%204.0697%2011.7364%204.66667%2011.0001%204.66667C10.2637%204.66667%209.66675%204.0697%209.66675%203.33333C9.66675%202.59695%2010.2637%202%2011.0001%202C11.7364%202%2012.3334%202.59695%2012.3334%203.33333ZM11.0001%209.33333C11.7364%209.33333%2012.3334%208.73637%2012.3334%208C12.3334%207.26363%2011.7364%206.66667%2011.0001%206.66667C10.2637%206.66667%209.66675%207.26363%209.66675%208C9.66675%208.73637%2010.2637%209.33333%2011.0001%209.33333ZM11.0001%2014C11.7364%2014%2012.3334%2013.403%2012.3334%2012.6667C12.3334%2011.9303%2011.7364%2011.3333%2011.0001%2011.3333C10.2637%2011.3333%209.66675%2011.9303%209.66675%2012.6667C9.66675%2013.403%2010.2637%2014%2011.0001%2014Z'%20fill='%2386909C'/%3e%3c/svg%3e", Ee = ["aria-label"], ze = { class: "fkp-navigation-scroll" }, Le = ["data-section-key"], Fe = { key: 0 }, Ge = ["aria-label", "aria-expanded", "disabled", "onKeydown"], Oe = ["src"], Ze = ["aria-label"], je = { class: "fkp-navigation-editor-title" }, Ae = {
482
+ key: 0,
483
+ class: "fkp-navigation-editor-divider",
484
+ role: "separator"
485
+ }, He = ["src"], Re = { class: "fkp-navigation-editor-label" }, qe = {
486
+ key: 1,
487
+ class: "fkp-navigation-items"
488
+ }, We = ["aria-expanded", "onKeydown"], Je = { class: "fkp-navigation-item-icon" }, Qe = { key: 0 }, Xe = /* @__PURE__ */ R({
489
+ name: "FkpNavigation",
490
+ __name: "FkpNavigation",
491
+ props: {
492
+ sections: {},
493
+ selectedKey: {},
494
+ expandedKeys: {},
495
+ collapsed: { type: Boolean, default: !1 },
496
+ showSectionTitles: { type: Boolean, default: !0 },
497
+ reordering: { type: Boolean, default: !1 },
498
+ ariaLabel: { default: "导航" }
499
+ },
500
+ emits: ["open", "update:expandedKeys", "reorder", "panel-open", "select"],
501
+ setup(g, { emit: b }) {
502
+ const d = g, c = b, k = U(
503
+ () => d.sections.filter((n) => n.items.length > 0).map((n) => {
504
+ const i = n.items.every((P) => {
505
+ var Y;
506
+ return !((Y = P.children) != null && Y.length);
507
+ }), { maxVisible: t } = n, s = i && t !== void 0 && Number.isInteger(t) && t > 0 ? t : n.items.length;
508
+ return {
509
+ section: n,
510
+ isFlat: i,
511
+ visibleLimit: s,
512
+ sortable: i && !!n.sortable,
513
+ visibleItems: n.items.slice(0, s),
514
+ overflowItems: n.items.slice(s)
515
+ };
516
+ })
517
+ ), {
518
+ expandedKeys: f,
519
+ selectedKeys: S,
520
+ updateSectionExpandedKeys: w,
521
+ getSelectableItem: z
522
+ } = Me(d, (n) => c("update:expandedKeys", n)), y = G(), o = G(), a = G(), l = {
523
+ more: /* @__PURE__ */ new Map(),
524
+ sort: /* @__PURE__ */ new Map()
525
+ }, m = (n, i) => {
526
+ var t;
527
+ return ((t = y.value) == null ? void 0 : t.sectionKey) === n && y.value.panel === i;
528
+ }, p = (n = !1) => {
529
+ var t;
530
+ const i = y.value;
531
+ i && (y.value = void 0, o.value = void 0, c("panel-open", { ...i, visible: !1 }), n && ((t = a.value) == null || t.focus()));
532
+ }, V = (n, i, t) => {
533
+ if (!t) {
534
+ m(n, i) && p();
535
+ return;
536
+ }
537
+ m(n, i) || (p(), y.value = { sectionKey: n, panel: i }, c("panel-open", { sectionKey: n, panel: i, visible: !0 }));
538
+ }, I = (n) => {
539
+ a.value = n.currentTarget;
540
+ }, L = (n, i, t) => {
541
+ t instanceof HTMLElement ? l[i].set(n, t) : l[i].delete(n);
542
+ }, e = async (n, i) => {
543
+ var s, P;
544
+ if (((s = o.value) == null ? void 0 : s.sectionKey) !== n || o.value.panel !== i || !m(n, i))
545
+ return;
546
+ await te();
547
+ const t = (P = l[i].get(n)) == null ? void 0 : P.querySelector('button:not(:disabled), [tabindex="0"]');
548
+ t && (t.focus(), o.value = void 0);
549
+ }, v = (n, i, t) => {
550
+ n.key !== "Enter" && n.key !== " " || (n.preventDefault(), n.stopPropagation(), !n.currentTarget.disabled && (I(n), V(i, t, !0), o.value = { sectionKey: i, panel: t }, e(i, t)));
551
+ };
552
+ D(
553
+ () => d.collapsed,
554
+ () => p()
555
+ ), D(
556
+ k,
557
+ () => {
558
+ const n = y.value;
559
+ if (!n) return;
560
+ const i = k.value.find(
561
+ (t) => t.section.key === n.sectionKey
562
+ );
563
+ (!i || (n.panel === "more" ? !i.overflowItems.length : !i.sortable || i.section.items.length < 2)) && p();
564
+ },
565
+ { deep: !0 }
566
+ ), ue(() => p());
567
+ const C = (n) => {
568
+ const i = z(n);
569
+ i && (i.opensInNewTab ? c("open", i.key, i) : c("select", i.key), p());
570
+ }, q = (n, i) => {
571
+ if (d.reordering || !n.sortable || n.items.some((s) => {
572
+ var P;
573
+ return (P = s.children) == null ? void 0 : P.length;
574
+ }))
575
+ return;
576
+ const t = i.map((s) => String(s.key));
577
+ t.length !== n.items.length || new Set(t).size !== t.length || t.some((s) => !n.items.some((P) => P.key === s)) || c("reorder", { sectionKey: n.key, keys: t });
578
+ }, le = {
579
+ class: "fkp-navigation-group-popup",
580
+ popupOffset: 24,
581
+ mouseLeaveDelay: 180,
582
+ autoFitPopupMinWidth: !1
583
+ };
584
+ return (n, i) => (r(), K("nav", {
585
+ class: F(["fkp-navigation", { "fkp-navigation-collapsed": n.collapsed }]),
586
+ "aria-label": n.ariaLabel
587
+ }, [
588
+ $("div", ze, [
589
+ (r(!0), K(Z, null, W(k.value, (t) => (r(), K("section", {
590
+ key: t.section.key,
591
+ class: "fkp-navigation-section",
592
+ "data-section-key": t.section.key
593
+ }, [
594
+ !n.collapsed && (n.showSectionTitles && t.section.title || t.sortable) ? (r(), K("div", {
595
+ key: 0,
596
+ class: F(["fkp-navigation-heading", {
597
+ "is-editing": m(t.section.key, "sort"),
598
+ "is-toolbar": !n.showSectionTitles || !t.section.title
599
+ }])
600
+ }, [
601
+ n.showSectionTitles && t.section.title ? (r(), K("span", Fe, E(t.section.title), 1)) : N("", !0),
602
+ t.sortable ? (r(), B(h(Q), {
603
+ key: 1,
604
+ "popup-visible": m(t.section.key, "sort"),
605
+ trigger: "click",
606
+ position: "rt",
607
+ "popup-offset": 8,
608
+ "show-arrow": !1,
609
+ "onUpdate:popupVisible": (s) => V(t.section.key, "sort", s),
610
+ onShow: (s) => e(t.section.key, "sort")
611
+ }, {
612
+ content: u(() => [
613
+ $("div", {
614
+ ref_for: !0,
615
+ ref: (s) => L(t.section.key, "sort", s),
616
+ class: "fkp-navigation-editor",
617
+ role: "dialog",
618
+ "aria-label": `调整${t.section.title || "导航"}顺序`,
619
+ onKeydown: i[1] || (i[1] = j(A((s) => p(!0), ["stop", "prevent"]), ["esc"]))
620
+ }, [
621
+ $("div", je, E(t.section.title || "导航") + "(可拖拽排序)", 1),
622
+ m(t.section.key, "sort") ? (r(), B(h(fe), {
623
+ key: 0,
624
+ class: "fkp-navigation-editor-list",
625
+ "model-value": [...t.section.items],
626
+ disabled: n.reordering,
627
+ "handle-label": "拖拽排序",
628
+ "onUpdate:modelValue": (s) => q(t.section, s)
629
+ }, {
630
+ "before-item": u(({ index: s }) => [
631
+ t.overflowItems.length && s === t.visibleLimit ? (r(), K("div", Ae)) : N("", !0)
632
+ ]),
633
+ handle: u(() => [
634
+ $("img", {
635
+ src: h(De),
636
+ alt: ""
637
+ }, null, 8, He)
638
+ ]),
639
+ default: u(({ item: s }) => [
640
+ M(H, {
641
+ icon: s.icon,
642
+ "icon-url": s.iconUrl
643
+ }, {
644
+ default: u(() => [
645
+ T(n.$slots, "item-icon", {
646
+ item: s,
647
+ section: t.section,
648
+ level: 0
649
+ })
650
+ ]),
651
+ _: 2
652
+ }, 1032, ["icon", "icon-url"]),
653
+ $("span", Re, E(s.label), 1)
654
+ ]),
655
+ _: 2
656
+ }, 1032, ["model-value", "disabled", "onUpdate:modelValue"])) : N("", !0)
657
+ ], 40, Ze)
658
+ ]),
659
+ default: u(() => [
660
+ $("button", {
661
+ type: "button",
662
+ class: "fkp-navigation-edit",
663
+ "aria-label": `调整${t.section.title || "导航"}顺序`,
664
+ "aria-haspopup": "dialog",
665
+ "aria-expanded": m(t.section.key, "sort"),
666
+ disabled: n.reordering || t.section.items.length < 2,
667
+ onPointerdown: I,
668
+ onFocus: I,
669
+ onKeydown: [
670
+ (s) => v(s, t.section.key, "sort"),
671
+ i[0] || (i[0] = j(A((s) => p(!0), ["stop", "prevent"]), ["esc"]))
672
+ ]
673
+ }, [
674
+ $("img", {
675
+ src: h(Ue),
676
+ alt: ""
677
+ }, null, 8, Oe)
678
+ ], 40, Ge)
679
+ ]),
680
+ _: 2
681
+ }, 1032, ["popup-visible", "onUpdate:popupVisible", "onShow"])) : N("", !0)
682
+ ], 2)) : N("", !0),
683
+ t.isFlat ? (r(), K("div", qe, [
684
+ (r(!0), K(Z, null, W(t.visibleItems, (s) => (r(), B(h(me), {
685
+ key: s.key,
686
+ content: s.label,
687
+ disabled: !n.collapsed,
688
+ position: "right"
689
+ }, {
690
+ default: u(() => [
691
+ M(oe, {
692
+ item: s,
693
+ section: t.section,
694
+ "selected-key": n.selectedKey,
695
+ collapsed: n.collapsed,
696
+ onSelect: C
697
+ }, O({ _: 2 }, [
698
+ n.$slots["item-icon"] ? {
699
+ name: "item-icon",
700
+ fn: u((P) => [
701
+ T(n.$slots, "item-icon", J({ ref_for: !0 }, P))
702
+ ]),
703
+ key: "0"
704
+ } : void 0
705
+ ]), 1032, ["item", "section", "selected-key", "collapsed"])
706
+ ]),
707
+ _: 2
708
+ }, 1032, ["content", "disabled"]))), 128)),
709
+ t.overflowItems.length ? (r(), B(h(Q), {
710
+ key: 0,
711
+ "popup-visible": m(t.section.key, "more"),
712
+ trigger: ["hover", "click"],
713
+ position: "rt",
714
+ "popup-offset": 24,
715
+ "mouse-leave-delay": 180,
716
+ "show-arrow": !1,
717
+ "onUpdate:popupVisible": (s) => V(t.section.key, "more", s),
718
+ onShow: (s) => e(t.section.key, "more")
719
+ }, {
720
+ content: u(() => [
721
+ $("div", {
722
+ ref_for: !0,
723
+ ref: (s) => L(t.section.key, "more", s),
724
+ class: "fkp-navigation-more",
725
+ role: "dialog",
726
+ "aria-label": "更多导航",
727
+ onKeydown: i[3] || (i[3] = j(A((s) => p(!0), ["stop", "prevent"]), ["esc"]))
728
+ }, [
729
+ (r(!0), K(Z, null, W(t.overflowItems, (s) => (r(), B(oe, {
730
+ key: s.key,
731
+ item: s,
732
+ section: t.section,
733
+ "selected-key": n.selectedKey,
734
+ onSelect: C
735
+ }, O({ _: 2 }, [
736
+ n.$slots["item-icon"] ? {
737
+ name: "item-icon",
738
+ fn: u((P) => [
739
+ T(n.$slots, "item-icon", J({ ref_for: !0 }, P))
740
+ ]),
741
+ key: "0"
742
+ } : void 0
743
+ ]), 1032, ["item", "section", "selected-key"]))), 128))
744
+ ], 544)
745
+ ]),
746
+ default: u(() => [
747
+ $("button", {
748
+ type: "button",
749
+ class: F(["fkp-navigation-item fkp-navigation-more-trigger", {
750
+ "is-selected": t.overflowItems.some(
751
+ (s) => !s.opensInNewTab && s.key === n.selectedKey
752
+ )
753
+ }]),
754
+ "aria-label": "更多导航",
755
+ "aria-haspopup": "dialog",
756
+ "aria-expanded": m(t.section.key, "more"),
757
+ onPointerenter: I,
758
+ onPointerdown: I,
759
+ onFocus: I,
760
+ onKeydown: [
761
+ (s) => v(s, t.section.key, "more"),
762
+ i[2] || (i[2] = j(A((s) => p(!0), ["stop", "prevent"]), ["esc"]))
763
+ ]
764
+ }, [
765
+ $("span", Je, [
766
+ M(h(ke))
767
+ ]),
768
+ n.collapsed ? N("", !0) : (r(), K("span", Qe, "更多"))
769
+ ], 42, We)
770
+ ]),
771
+ _: 2
772
+ }, 1032, ["popup-visible", "onUpdate:popupVisible", "onShow"])) : N("", !0)
773
+ ])) : (r(), B(h(se), {
774
+ key: 2,
775
+ class: "fkp-navigation-menu",
776
+ collapsed: n.collapsed,
777
+ "selected-keys": h(S),
778
+ "open-keys": h(f),
779
+ "auto-open-selected": !1,
780
+ "trigger-props": le,
781
+ "onUpdate:openKeys": (s) => h(w)(t.section.key, s)
782
+ }, {
783
+ default: u(() => [
784
+ M(X, {
785
+ items: t.section.items,
786
+ section: t.section,
787
+ "selected-key": n.selectedKey,
788
+ "expanded-keys": h(f),
789
+ collapsed: n.collapsed,
790
+ "panel-visible": !!y.value,
791
+ onSelect: C,
792
+ onGroupOpen: i[4] || (i[4] = (s) => p())
793
+ }, O({ _: 2 }, [
794
+ n.$slots["item-icon"] ? {
795
+ name: "item-icon",
796
+ fn: u((s) => [
797
+ T(n.$slots, "item-icon", J({ ref_for: !0 }, s))
798
+ ]),
799
+ key: "0"
800
+ } : void 0
801
+ ]), 1032, ["items", "section", "selected-key", "expanded-keys", "collapsed", "panel-visible"])
802
+ ]),
803
+ _: 2
804
+ }, 1032, ["collapsed", "selected-keys", "open-keys", "onUpdate:openKeys"]))
805
+ ], 8, Le))), 128))
806
+ ])
807
+ ], 10, Ee));
808
+ }
809
+ }), oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
810
+ __proto__: null,
811
+ FkpNavigation: Xe
812
+ }, Symbol.toStringTag, { value: "Module" }));
813
+ export {
814
+ oo as N,
815
+ Xe as _
816
+ };