@epam/ai-dial-skills 1.2.0-dev.99 → 1.2.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ChatSkill/ChatSkill.d.ts +3 -2
- package/components/ChatSkill/ChatSkill.d.ts.map +1 -1
- package/components/FavoriteSkillsPanel/FavoriteSkillsPanel.d.ts.map +1 -1
- package/components/SkillArchiveUploadDialog/SkillArchiveUploadDialog.d.ts.map +1 -1
- package/components/SkillContentFileTree/SkillContentFileTree.d.ts +11 -0
- package/components/SkillContentFileTree/SkillContentFileTree.d.ts.map +1 -0
- package/components/SkillDetailsSidePanel/SkillDetailsSidePanel.d.ts +2 -1
- package/components/SkillDetailsSidePanel/SkillDetailsSidePanel.d.ts.map +1 -1
- package/components/SkillInfoTooltipContent/SkillInfoTooltipContent.d.ts +1 -1
- package/components/SkillInfoTooltipContent/SkillInfoTooltipContent.d.ts.map +1 -1
- package/components/SkillSelectorField/SkillSelectorField.d.ts +5 -0
- package/components/SkillSelectorField/SkillSelectorField.d.ts.map +1 -0
- package/constants/public-class-names.d.ts +6 -5
- package/constants/public-class-names.d.ts.map +1 -1
- package/hooks/useSkillMentions/useSkillMentions.d.ts +59 -0
- package/hooks/useSkillMentions/useSkillMentions.d.ts.map +1 -0
- package/hooks/useSkillSelectorOverlay/useSkillSelectorOverlay.d.ts +5 -4
- package/hooks/useSkillSelectorOverlay/useSkillSelectorOverlay.d.ts.map +1 -1
- package/index.css +2 -2
- package/index.d.ts +13 -1
- package/index.d.ts.map +1 -1
- package/index.js +675 -271
- package/models/chat-skill-props.d.ts +30 -1
- package/models/chat-skill-props.d.ts.map +1 -1
- package/models/favorite-skill-item.d.ts +1 -1
- package/models/favorite-skill-item.d.ts.map +1 -1
- package/models/favorite-skills-panel-props.d.ts +32 -5
- package/models/favorite-skills-panel-props.d.ts.map +1 -1
- package/models/skill-archive-upload-dialog-props.d.ts +5 -1
- package/models/skill-archive-upload-dialog-props.d.ts.map +1 -1
- package/models/skill-info-tooltip-content-props.d.ts +19 -0
- package/models/skill-info-tooltip-content-props.d.ts.map +1 -1
- package/models/skill-mention-anchor.d.ts +12 -0
- package/models/skill-mention-anchor.d.ts.map +1 -0
- package/models/skill-selector-field-props.d.ts +72 -0
- package/models/skill-selector-field-props.d.ts.map +1 -0
- package/models/skill-selector-overlay.d.ts +151 -54
- package/models/skill-selector-overlay.d.ts.map +1 -1
- package/package.json +6 -5
- package/test-setup.d.ts +1 -0
- package/types/skill-unresolved-reason.d.ts +8 -0
- package/types/skill-unresolved-reason.d.ts.map +1 -0
- package/utils/catalog-content-dial-files.d.ts +10 -0
- package/utils/catalog-content-dial-files.d.ts.map +1 -0
- package/utils/skill-mention-matching.d.ts +34 -0
- package/utils/skill-mention-matching.d.ts.map +1 -0
- package/utils/skill-mention-tracking.d.ts +56 -0
- package/utils/skill-mention-tracking.d.ts.map +1 -0
- package/utils/skill-url.d.ts +1 -0
- package/utils/skill-url.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -1,370 +1,774 @@
|
|
|
1
|
-
import { DeploymentIcon as e, buildCssVars as t,
|
|
2
|
-
import { BASE_ICON_SIZE as
|
|
3
|
-
import { Suspense as
|
|
4
|
-
import { IconBlocks as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import {
|
|
1
|
+
import { DeploymentIcon as e, buildCssVars as t, isSkillSelectionUnsupported as n, mergeClasses as r } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { BASE_ICON_SIZE as i, Button as a, ButtonAppearance as o, ButtonVariant as s, DIAL_ICON_SIZE as c, DIAL_KIT_ICON_STROKE as l, FileDropzone as u, GhostButton as d, Highlight as f, InteractiveTooltip as p, InteractiveTooltipTrigger as m, Popup as h, PopupSize as g, Select as _, Spinner as v, ToggleIconButton as y, Tooltip as b, TooltipPlacement as x } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { Suspense as S, useCallback as C, useEffect as w, useId as T, useLayoutEffect as E, useMemo as D, useRef as O, useState as k } from "react";
|
|
4
|
+
import { IconBlocks as ee, IconEye as A, IconLock as j, IconStarFilled as M, IconTrash as N } from "@tabler/icons-react";
|
|
5
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
6
|
+
import { DialFileNodeType as L, DialFoldersTree as R } from "@epam/ai-dial-react-file-manager";
|
|
7
|
+
import { CatalogContentNodeType as te, DetailsPanel as z } from "@epam/ai-dial-catalog";
|
|
7
8
|
//#region src/constants/public-class-names.ts
|
|
8
|
-
var
|
|
9
|
+
var B = {
|
|
10
|
+
selectorField: "dial-skills-selector-field",
|
|
9
11
|
favoritesPanel: "dial-skills-favorites-panel",
|
|
10
12
|
chip: "dial-skills-chip"
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
}, V = /* @__PURE__ */ function(e) {
|
|
14
|
+
return e.Deleted = "deleted", e.NotShared = "not-shared", e;
|
|
15
|
+
}({}), H = ({ description: e, unsupportedMessage: t, unresolvedReason: n, deletedMessage: r, notSharedMessage: i, viewDetailsLabel: u = "View details", onViewDetails: d, viewDetailsTabIndex: f }) => {
|
|
16
|
+
if (n != null) {
|
|
17
|
+
let e = n === V.Deleted, t = e ? N : j, a = e ? r : i;
|
|
18
|
+
return /* @__PURE__ */ I("div", {
|
|
19
|
+
className: "flex flex-row items-center gap-2",
|
|
20
|
+
children: [/* @__PURE__ */ F(t, {
|
|
21
|
+
size: c.MD,
|
|
22
|
+
stroke: l,
|
|
23
|
+
"aria-hidden": !0,
|
|
24
|
+
className: "shrink-0 text-secondary"
|
|
25
|
+
}), /* @__PURE__ */ F("p", {
|
|
26
|
+
className: "dial-tiny-text text-start text-primary",
|
|
27
|
+
children: a
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return t == null ? /* @__PURE__ */ I("div", {
|
|
32
|
+
className: "flex flex-col gap-3",
|
|
33
|
+
children: [e != null && e !== "" && /* @__PURE__ */ F("p", {
|
|
34
|
+
className: "text-start",
|
|
35
|
+
children: e
|
|
36
|
+
}), /* @__PURE__ */ F(a, {
|
|
37
|
+
variant: s.Primary,
|
|
38
|
+
appearance: o.Link,
|
|
39
|
+
className: "h-[24px] self-start",
|
|
40
|
+
label: u,
|
|
41
|
+
iconBefore: /* @__PURE__ */ F(A, {
|
|
42
|
+
size: c.SM,
|
|
43
|
+
stroke: l,
|
|
44
|
+
"aria-hidden": !0
|
|
45
|
+
}),
|
|
46
|
+
onClick: d,
|
|
47
|
+
tabIndex: f
|
|
48
|
+
})]
|
|
49
|
+
}) : /* @__PURE__ */ F("p", {
|
|
14
50
|
className: "text-start",
|
|
15
|
-
children:
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})]
|
|
28
|
-
}) : /* @__PURE__ */ O("p", {
|
|
29
|
-
className: "text-start",
|
|
30
|
-
children: t
|
|
31
|
-
}), N = ({ name: e, path: t, description: r, isUnsupported: i = !1, labelClassName: a = "dial-body-paragraph-text", unsupportedLabelClassName: o = "text-error", unsupportedClassName: s = "bg-error", onViewDetails: c, labels: l = {} }) => {
|
|
32
|
-
let { viewDetailsLabel: d = "View details", unsupportedTooltipLabel: p = "Selected model does not support skills. Remove the skill or select different model to proceed." } = l, [m, h] = C(0);
|
|
33
|
-
return /* @__PURE__ */ O(f, {
|
|
51
|
+
children: t
|
|
52
|
+
});
|
|
53
|
+
}, U = ({ name: e, path: t, description: n, isUnsupported: i = !1, unresolvedReason: a, labelClassName: o = "dial-body-paragraph-text text-accent", unsupportedLabelClassName: s = "text-error", unsupportedClassName: c = "bg-error", detailsTrigger: l = "hover", onViewDetails: u, labels: d = {} }) => {
|
|
54
|
+
let { viewDetailsLabel: f = "View details", unsupportedTooltipLabel: h = "Selected model does not support skills. Remove the skill or select different model to proceed.", deletedTooltipLabel: g = "This skill has been deleted. Its details are no longer available.", notSharedTooltipLabel: _ = "You don't have access to this skill, so its details aren't shown. Ask the chat owner to share it with you." } = d, [v, y] = k(0), b = l === "click", S = () => {
|
|
55
|
+
y((e) => e + 1), u(t);
|
|
56
|
+
}, C = O(null), [w, T] = k(null);
|
|
57
|
+
return E(() => {
|
|
58
|
+
let e = C.current, t = () => T(e?.getBoundingClientRect().width ?? null);
|
|
59
|
+
if (t(), !e || typeof ResizeObserver > "u") return;
|
|
60
|
+
let n = new ResizeObserver(t);
|
|
61
|
+
return n.observe(e), () => n.disconnect();
|
|
62
|
+
}, [o]), /* @__PURE__ */ F(p, {
|
|
34
63
|
asChild: !0,
|
|
35
|
-
placement:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
64
|
+
placement: x.Top,
|
|
65
|
+
trigger: b ? m.Click : m.Hover,
|
|
66
|
+
contentClassName: "max-w-[min(550px,calc(100vw-10px))]",
|
|
67
|
+
content: a == null ? i ? /* @__PURE__ */ F(H, { unsupportedMessage: h }) : /* @__PURE__ */ F(H, {
|
|
68
|
+
description: n,
|
|
69
|
+
viewDetailsLabel: f,
|
|
70
|
+
onViewDetails: S
|
|
71
|
+
}) : /* @__PURE__ */ F(H, {
|
|
72
|
+
unresolvedReason: a,
|
|
73
|
+
deletedMessage: g,
|
|
74
|
+
notSharedMessage: _
|
|
43
75
|
}),
|
|
44
|
-
children: /* @__PURE__ */
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
76
|
+
children: /* @__PURE__ */ I("span", {
|
|
77
|
+
tabIndex: 0,
|
|
78
|
+
className: r("relative -me-1 -ms-1 inline cursor-pointer select-text rounded-full pe-1 ps-1", i ? c : "hover:bg-info focus-visible:bg-info active:bg-info", i ? r(o, s) : o, B.chip),
|
|
79
|
+
"aria-label": `/${e}`,
|
|
80
|
+
children: [/* @__PURE__ */ F("span", {
|
|
81
|
+
ref: C,
|
|
82
|
+
"aria-hidden": !0,
|
|
83
|
+
className: "inset-inline-start-0 pointer-events-none absolute top-0 select-none",
|
|
84
|
+
children: "/"
|
|
85
|
+
}), /* @__PURE__ */ F("span", {
|
|
86
|
+
"aria-hidden": !0,
|
|
87
|
+
className: "select-none",
|
|
88
|
+
style: { paddingInlineStart: w ?? void 0 },
|
|
89
|
+
children: e
|
|
90
|
+
})]
|
|
51
91
|
})
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
row: "
|
|
55
|
-
header: "
|
|
56
|
-
emptyHint: "
|
|
57
|
-
star: "
|
|
58
|
-
footer: "
|
|
59
|
-
rowEnter: "
|
|
60
|
-
rowFadeIn: "
|
|
61
|
-
rowLeaving: "
|
|
62
|
-
rowFadeOut: "
|
|
63
|
-
listContent: "
|
|
64
|
-
},
|
|
65
|
-
let { myCollectionLabel:
|
|
66
|
-
"--fs-row-hover-bg":
|
|
67
|
-
"--fs-header-text":
|
|
68
|
-
"--fs-empty-hint-text":
|
|
69
|
-
"--fs-star-color":
|
|
70
|
-
"--fs-footer-border":
|
|
71
|
-
}), [
|
|
72
|
-
|
|
73
|
-
let e =
|
|
92
|
+
}, v);
|
|
93
|
+
}, W = {
|
|
94
|
+
row: "_row_1v431_1",
|
|
95
|
+
header: "_header_1v431_8",
|
|
96
|
+
emptyHint: "_emptyHint_1v431_12",
|
|
97
|
+
star: "_star_1v431_16",
|
|
98
|
+
footer: "_footer_1v431_20",
|
|
99
|
+
rowEnter: "_rowEnter_1v431_28",
|
|
100
|
+
rowFadeIn: "_rowFadeIn_1v431_1",
|
|
101
|
+
rowLeaving: "_rowLeaving_1v431_32",
|
|
102
|
+
rowFadeOut: "_rowFadeOut_1v431_1",
|
|
103
|
+
listContent: "_listContent_1v431_60"
|
|
104
|
+
}, G = "px-3 pb-0.5 pt-2", ne = 180, re = 288, K = ({ favorites: n, onSelect: i, onToggleFavorite: a, onBrowse: o, onViewDetails: s, className: l, rowClassName: u, searchQuery: m, listboxId: h, activeOptionId: g, isMenu: _ = !1, labels: v = {}, colors: b, nameClassName: x = "dial-small-text", headerClassName: S = "dial-tiny-lead-semi-text", emptyHintClassName: C = "dial-small-text" }) => {
|
|
105
|
+
let { myCollectionLabel: D = "My Collection", emptyHintLabel: ee = "Star a skill to pin it here", browseLabel: A = "Browse", removeFromFavoritesLabel: j = "Remove from favorites", viewDetailsLabel: N = "View details", noMatchingSkillsLabel: P = "No matching skills" } = v, L = t({
|
|
106
|
+
"--fs-row-hover-bg": b?.rowHoverBackground,
|
|
107
|
+
"--fs-header-text": b?.headerText,
|
|
108
|
+
"--fs-empty-hint-text": b?.emptyHintText,
|
|
109
|
+
"--fs-star-color": b?.starColor,
|
|
110
|
+
"--fs-footer-border": b?.footerBorder
|
|
111
|
+
}), [R, te] = k(/* @__PURE__ */ new Set()), z = O(/* @__PURE__ */ new Map());
|
|
112
|
+
w(() => {
|
|
113
|
+
let e = z.current;
|
|
74
114
|
return () => {
|
|
75
115
|
e.forEach((e) => clearTimeout(e)), e.clear();
|
|
76
116
|
};
|
|
77
117
|
}, []);
|
|
78
|
-
let
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
118
|
+
let V = h != null, U = _ && !V, K = V || U ? "none" : void 0, q = "button";
|
|
119
|
+
V ? q = "option" : U && (q = "menuitem");
|
|
120
|
+
let J = T(), Y = m != null, X = m?.toLowerCase() ?? "", Z = Y ? n.filter((e) => e.name.toLowerCase().includes(X)) : n, Q = O(null), [$, ie] = k();
|
|
121
|
+
E(() => {
|
|
122
|
+
Q.current && ie(Math.min(Q.current.scrollHeight, re));
|
|
123
|
+
}, [n, m]);
|
|
124
|
+
let ae = (e, t) => {
|
|
83
125
|
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), i(t));
|
|
84
|
-
},
|
|
85
|
-
|
|
126
|
+
}, oe = (e) => {
|
|
127
|
+
te((t) => new Set(t).add(e));
|
|
86
128
|
let t = setTimeout(() => {
|
|
87
|
-
a(e),
|
|
129
|
+
a?.(e), te((t) => {
|
|
88
130
|
let n = new Set(t);
|
|
89
131
|
return n.delete(e), n;
|
|
90
|
-
}),
|
|
91
|
-
},
|
|
92
|
-
|
|
132
|
+
}), z.current.delete(e);
|
|
133
|
+
}, ne);
|
|
134
|
+
z.current.set(e, t);
|
|
93
135
|
};
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
className:
|
|
96
|
-
style:
|
|
136
|
+
return /* @__PURE__ */ I("div", {
|
|
137
|
+
className: r("flex w-full flex-col desktop:w-[280px]", l, B.favoritesPanel),
|
|
138
|
+
style: L,
|
|
97
139
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
|
|
100
|
-
|
|
140
|
+
/* @__PURE__ */ F("p", {
|
|
141
|
+
id: J,
|
|
142
|
+
className: r(S, G, W.header),
|
|
143
|
+
children: D
|
|
101
144
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
className:
|
|
104
|
-
style: { maxHeight:
|
|
105
|
-
children: /* @__PURE__ */
|
|
106
|
-
ref:
|
|
107
|
-
children:
|
|
145
|
+
/* @__PURE__ */ F("div", {
|
|
146
|
+
className: r("max-h-72 min-h-0 flex-1 overflow-y-auto", W.listContent),
|
|
147
|
+
style: { maxHeight: $ },
|
|
148
|
+
children: /* @__PURE__ */ F("div", {
|
|
149
|
+
ref: Q,
|
|
150
|
+
children: Z.length > 0 ? /* @__PURE__ */ F("ul", {
|
|
151
|
+
id: h,
|
|
152
|
+
role: V ? "listbox" : K,
|
|
153
|
+
"aria-labelledby": V ? J : void 0,
|
|
108
154
|
className: "flex flex-col gap-1 px-1 pb-1",
|
|
109
|
-
children:
|
|
110
|
-
let
|
|
111
|
-
role:
|
|
155
|
+
children: Z.map((t) => {
|
|
156
|
+
let n = V ? `${h}-${encodeURIComponent(t.id)}` : void 0, o = V ? -1 : void 0, l = /* @__PURE__ */ I("div", {
|
|
157
|
+
role: q,
|
|
158
|
+
id: n,
|
|
159
|
+
"aria-selected": V ? n === g : void 0,
|
|
160
|
+
"aria-label": t.name,
|
|
112
161
|
tabIndex: 0,
|
|
113
|
-
className:
|
|
162
|
+
className: r("flex cursor-pointer items-center gap-2 rounded-lg border border-transparent px-2 py-1.5 transition-colors", W.row, u),
|
|
114
163
|
onClick: () => i(t),
|
|
115
|
-
onKeyDown: (e) =>
|
|
164
|
+
onKeyDown: (e) => ae(e, t),
|
|
116
165
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
size:
|
|
166
|
+
/* @__PURE__ */ F(e, {
|
|
167
|
+
size: c.MD,
|
|
119
168
|
initialsName: t.name
|
|
120
169
|
}),
|
|
121
|
-
|
|
122
|
-
className:
|
|
170
|
+
m == null ? /* @__PURE__ */ F("span", {
|
|
171
|
+
className: r(x, "min-w-0 flex-1 truncate text-start"),
|
|
123
172
|
children: t.name
|
|
124
|
-
}) : /* @__PURE__ */
|
|
173
|
+
}) : /* @__PURE__ */ F(f, {
|
|
125
174
|
text: t.name,
|
|
126
|
-
query:
|
|
175
|
+
query: m,
|
|
127
176
|
maxLines: 1,
|
|
128
|
-
className:
|
|
177
|
+
className: r(x, "min-w-0 flex-1 text-start")
|
|
129
178
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
icon: /* @__PURE__ */
|
|
132
|
-
size:
|
|
133
|
-
className:
|
|
179
|
+
a && /* @__PURE__ */ F(y, {
|
|
180
|
+
icon: /* @__PURE__ */ F(M, {
|
|
181
|
+
size: c.SM,
|
|
182
|
+
className: W.star,
|
|
134
183
|
"aria-hidden": !0
|
|
135
184
|
}),
|
|
136
|
-
"aria-label":
|
|
185
|
+
"aria-label": j,
|
|
137
186
|
isSelected: !0,
|
|
187
|
+
tabIndex: o,
|
|
138
188
|
onClick: (e) => {
|
|
139
|
-
e.stopPropagation(),
|
|
189
|
+
e.stopPropagation(), oe(t.id);
|
|
140
190
|
}
|
|
141
191
|
})
|
|
142
192
|
]
|
|
143
193
|
});
|
|
144
|
-
return /* @__PURE__ */
|
|
145
|
-
|
|
146
|
-
|
|
194
|
+
return /* @__PURE__ */ F("li", {
|
|
195
|
+
role: K,
|
|
196
|
+
className: R.has(t.id) ? W.rowLeaving : W.rowEnter,
|
|
197
|
+
children: s ? /* @__PURE__ */ F(p, {
|
|
147
198
|
asChild: !0,
|
|
148
199
|
contentClassName: "max-w-[550px]",
|
|
149
|
-
content: /* @__PURE__ */
|
|
200
|
+
content: /* @__PURE__ */ F(H, {
|
|
150
201
|
description: t.description,
|
|
151
|
-
viewDetailsLabel:
|
|
152
|
-
onViewDetails: () =>
|
|
202
|
+
viewDetailsLabel: N,
|
|
203
|
+
onViewDetails: () => s(t),
|
|
204
|
+
viewDetailsTabIndex: o
|
|
153
205
|
}),
|
|
154
|
-
children:
|
|
155
|
-
})
|
|
206
|
+
children: l
|
|
207
|
+
}) : l
|
|
156
208
|
}, t.id);
|
|
157
209
|
})
|
|
158
|
-
}) :
|
|
210
|
+
}) : Y && X !== "" ? /* @__PURE__ */ F("p", {
|
|
159
211
|
role: "status",
|
|
160
212
|
"aria-live": "polite",
|
|
161
|
-
className:
|
|
162
|
-
children:
|
|
163
|
-
}) : /* @__PURE__ */
|
|
164
|
-
className:
|
|
165
|
-
children:
|
|
213
|
+
className: r(C, "px-4 py-4 text-start", W.emptyHint),
|
|
214
|
+
children: P
|
|
215
|
+
}) : /* @__PURE__ */ F("p", {
|
|
216
|
+
className: r(C, "px-4 py-4 text-start", W.emptyHint),
|
|
217
|
+
children: ee
|
|
166
218
|
})
|
|
167
219
|
})
|
|
168
220
|
}),
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
className:
|
|
171
|
-
children: /* @__PURE__ */
|
|
172
|
-
|
|
221
|
+
/* @__PURE__ */ F("div", {
|
|
222
|
+
className: r("border-t px-2 py-3", W.footer),
|
|
223
|
+
children: /* @__PURE__ */ F(d, {
|
|
224
|
+
role: U ? "menuitem" : void 0,
|
|
225
|
+
label: A,
|
|
173
226
|
className: "w-full justify-center",
|
|
174
227
|
onClick: o
|
|
175
228
|
})
|
|
176
229
|
})
|
|
177
230
|
]
|
|
178
231
|
});
|
|
179
|
-
},
|
|
180
|
-
let { dialogTitle:
|
|
181
|
-
return /* @__PURE__ */
|
|
232
|
+
}, q = ".zip,.md", J = ({ isOpen: e, errorText: t, isUploading: n = !1, accept: r = q, labels: i, onClose: a, onFilesSelected: o, onFilesRejected: s }) => {
|
|
233
|
+
let { dialogTitle: c = "Upload skill", dropZoneLabel: l = "Drag and drop it or click here to upload", dropZoneMobileLabel: d = "Click here to upload", formatsLabel: f = "File formats .zip and SKILL.md", fileInputAriaLabel: p = "Upload a skill ZIP archive or a SKILL.md file", closeAriaLabel: m = "Close", uploadingAriaLabel: _ = "Uploading skill" } = i ?? {};
|
|
234
|
+
return /* @__PURE__ */ F(h, {
|
|
182
235
|
open: e,
|
|
183
|
-
size:
|
|
184
|
-
header:
|
|
185
|
-
closeAriaLabel:
|
|
186
|
-
onClose:
|
|
187
|
-
children: /* @__PURE__ */
|
|
188
|
-
className: "px-6 py-4",
|
|
189
|
-
children: /* @__PURE__ */
|
|
190
|
-
label: /* @__PURE__ */
|
|
236
|
+
size: g.Sm,
|
|
237
|
+
header: c,
|
|
238
|
+
closeAriaLabel: m,
|
|
239
|
+
onClose: a,
|
|
240
|
+
children: /* @__PURE__ */ I("div", {
|
|
241
|
+
className: "flex flex-col gap-4 px-6 py-4",
|
|
242
|
+
children: [/* @__PURE__ */ F(u, {
|
|
243
|
+
label: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("span", {
|
|
191
244
|
className: "desktop:hidden",
|
|
192
|
-
children:
|
|
193
|
-
}), /* @__PURE__ */
|
|
245
|
+
children: d
|
|
246
|
+
}), /* @__PURE__ */ F("span", {
|
|
194
247
|
className: "hidden desktop:inline",
|
|
195
|
-
children:
|
|
248
|
+
children: l
|
|
196
249
|
})] }),
|
|
197
|
-
description:
|
|
198
|
-
ariaLabel:
|
|
199
|
-
accept:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
250
|
+
description: f,
|
|
251
|
+
ariaLabel: p,
|
|
252
|
+
accept: r,
|
|
253
|
+
disabled: n,
|
|
254
|
+
errorText: n ? void 0 : t,
|
|
255
|
+
onChange: o,
|
|
256
|
+
onReject: s
|
|
257
|
+
}), n && /* @__PURE__ */ F(v, { ariaLabel: _ })]
|
|
204
258
|
})
|
|
205
259
|
});
|
|
206
|
-
},
|
|
260
|
+
}, Y = ({ isOpen: e, onClose: t, onSelect: n, title: r, renderContent: i }) => /* @__PURE__ */ F(h, {
|
|
207
261
|
open: e,
|
|
208
262
|
header: r,
|
|
209
|
-
size:
|
|
263
|
+
size: g.Lg,
|
|
210
264
|
className: "h-[min(90vh,860px)] !max-w-[min(95vw,1200px)] overflow-hidden",
|
|
211
265
|
onClose: t,
|
|
212
|
-
children: /* @__PURE__ */
|
|
266
|
+
children: /* @__PURE__ */ F("div", {
|
|
213
267
|
className: "h-[min(80vh,840px)] overflow-auto",
|
|
214
|
-
children: /* @__PURE__ */
|
|
268
|
+
children: /* @__PURE__ */ F(S, {
|
|
215
269
|
fallback: null,
|
|
216
270
|
children: e && i(n, t)
|
|
217
271
|
})
|
|
218
272
|
})
|
|
219
|
-
}),
|
|
273
|
+
}), X = (e, t = null) => e.map((e) => e.type === te.Folder ? {
|
|
274
|
+
path: e.id,
|
|
275
|
+
name: e.name,
|
|
276
|
+
nodeType: L.FOLDER,
|
|
277
|
+
parentPath: t,
|
|
278
|
+
folderId: e.id,
|
|
279
|
+
items: X(e.items, e.id)
|
|
280
|
+
} : {
|
|
281
|
+
path: e.id,
|
|
282
|
+
name: e.name,
|
|
283
|
+
nodeType: L.ITEM,
|
|
284
|
+
parentPath: t,
|
|
285
|
+
folderId: t ?? ""
|
|
286
|
+
}), Z = ({ nodes: e, selectedFileId: t, expandedFolderIds: n, onToggleFolder: r, onSelectFile: i, onClose: a, ariaLabel: o }) => /* @__PURE__ */ F(R, {
|
|
287
|
+
items: D(() => X(e), [e]),
|
|
288
|
+
showFiles: !0,
|
|
289
|
+
areHiddenFilesVisible: !0,
|
|
290
|
+
selectedPath: t,
|
|
291
|
+
expandedPaths: D(() => new Set(n), [n]),
|
|
292
|
+
onExpandedPathsChange: (e) => {
|
|
293
|
+
for (let t of e) n.has(t) || r(t);
|
|
294
|
+
for (let t of n) e.has(t) || r(t);
|
|
295
|
+
},
|
|
296
|
+
onItemClick: (e) => {
|
|
297
|
+
e.nodeType === L.ITEM && i(e.path);
|
|
298
|
+
},
|
|
299
|
+
ariaLabel: o,
|
|
300
|
+
autoFocus: !0,
|
|
301
|
+
onEscape: a
|
|
302
|
+
}), Q = (e) => /* @__PURE__ */ F(z, {
|
|
303
|
+
...e,
|
|
304
|
+
renderContentFileTree: (e) => /* @__PURE__ */ F(Z, { ...e })
|
|
305
|
+
}), $ = (e) => e == null || /[\s/]/.test(e), ie = (e, t, n) => {
|
|
306
|
+
let r = [], i = 0;
|
|
307
|
+
return t.forEach((t, a) => {
|
|
308
|
+
let o = `/${n(t.url)}`, s = i;
|
|
309
|
+
for (; s <= e.length;) {
|
|
310
|
+
let t = e.indexOf(o, s);
|
|
311
|
+
if (t === -1) return;
|
|
312
|
+
let n = t + o.length;
|
|
313
|
+
if ($(e[n])) {
|
|
314
|
+
r.push({
|
|
315
|
+
skillIndex: a,
|
|
316
|
+
start: t,
|
|
317
|
+
length: o.length
|
|
318
|
+
}), i = n;
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
s = t + 1;
|
|
322
|
+
}
|
|
323
|
+
}), r;
|
|
324
|
+
}, ae = (e, t) => {
|
|
325
|
+
let n = /* @__PURE__ */ new Map();
|
|
326
|
+
t.forEach((e) => {
|
|
327
|
+
e.name !== "" && !n.has(e.name) && n.set(e.name, e.url);
|
|
328
|
+
});
|
|
329
|
+
let r = [...n.keys()].sort((e, t) => t.length - e.length), i = [], a = e.indexOf("/");
|
|
330
|
+
for (; a !== -1;) {
|
|
331
|
+
let t = a === 0 || /\s/.test(e[a - 1]), o = a + 1, s = t ? r.find((t) => e.startsWith(t, o) && $(e[o + t.length])) : void 0, c = s == null ? void 0 : n.get(s);
|
|
332
|
+
s != null && c != null ? (i.push({
|
|
333
|
+
url: c,
|
|
334
|
+
name: s,
|
|
335
|
+
start: a,
|
|
336
|
+
length: s.length + 1
|
|
337
|
+
}), a = e.indexOf("/", o + s.length)) : a = e.indexOf("/", o);
|
|
338
|
+
}
|
|
339
|
+
return i;
|
|
340
|
+
}, oe = (e, t) => {
|
|
341
|
+
let n = Math.min(e.length, t.length), r = 0;
|
|
342
|
+
for (; r < n && e[r] === t[r];) r += 1;
|
|
343
|
+
let i = n - r, a = 0;
|
|
344
|
+
for (; a < i && e[e.length - 1 - a] === t[t.length - 1 - a];) a += 1;
|
|
345
|
+
return {
|
|
346
|
+
start: r,
|
|
347
|
+
deletedLength: e.length - r - a,
|
|
348
|
+
insertedLength: t.length - r - a
|
|
349
|
+
};
|
|
350
|
+
}, se = (e, t) => {
|
|
351
|
+
let n = t.start + t.deletedLength, r = t.insertedLength - t.deletedLength;
|
|
352
|
+
return e.reduce((e, i) => i.start + i.length <= t.start ? (e.push(i), e) : (i.start >= n && e.push({
|
|
353
|
+
...i,
|
|
354
|
+
start: i.start + r
|
|
355
|
+
}), e), []);
|
|
356
|
+
}, ce = (e, t, n, r, i) => {
|
|
357
|
+
let a = r.length + 1, o = a + +!!i, s = e.map((e) => e.start >= t ? {
|
|
358
|
+
...e,
|
|
359
|
+
start: e.start + o
|
|
360
|
+
} : e), c = {
|
|
361
|
+
url: n,
|
|
362
|
+
name: r,
|
|
363
|
+
start: t,
|
|
364
|
+
length: a
|
|
365
|
+
};
|
|
366
|
+
return [...s, c].sort((e, t) => e.start - t.start);
|
|
367
|
+
}, le = (e, t) => e.find((e) => e.start + e.length === t), ue = (e, t, n) => {
|
|
368
|
+
let r = t;
|
|
369
|
+
for (; r > 0 && !/\s/.test(e[r - 1]);) r--;
|
|
370
|
+
let i = r;
|
|
371
|
+
for (; i < e.length && !/\s/.test(e[i]);) i++;
|
|
372
|
+
let a = e.slice(r, i);
|
|
373
|
+
if (!(!a.startsWith(n) || a.slice(n.length).includes(n))) return {
|
|
374
|
+
start: r,
|
|
375
|
+
end: i
|
|
376
|
+
};
|
|
377
|
+
}, de = (e, t, n) => {
|
|
378
|
+
if (n === "" || t.insertedLength < n.length) return;
|
|
379
|
+
let r = e.indexOf(n, Math.max(0, t.start - n.length)), i = t.start + t.insertedLength - n.length;
|
|
380
|
+
return r !== -1 && r <= i ? r : void 0;
|
|
381
|
+
}, fe = () => {
|
|
382
|
+
let [e, t] = k(""), [n, r] = k([]), i = O(e);
|
|
383
|
+
i.current = e;
|
|
384
|
+
let a = O(n);
|
|
385
|
+
a.current = n;
|
|
386
|
+
let o = O(null), s = C((e) => {
|
|
387
|
+
let n = oe(i.current, e), a = o.current;
|
|
388
|
+
o.current = null;
|
|
389
|
+
let s = a == null ? void 0 : de(e, n, a.text);
|
|
390
|
+
r((t) => {
|
|
391
|
+
let r = se(t, n);
|
|
392
|
+
if (a == null || s == null) return r;
|
|
393
|
+
let i = a.mentions.map((e) => ({
|
|
394
|
+
...e,
|
|
395
|
+
start: e.start + s
|
|
396
|
+
})).filter((t) => e.startsWith(`/${t.name}`, t.start) && !r.some((e) => e.start < t.start + t.length && t.start < e.start + e.length));
|
|
397
|
+
return [...r, ...i].sort((e, t) => e.start - t.start);
|
|
398
|
+
}), i.current = e, t(e);
|
|
399
|
+
}, []), c = C((e, n, a) => {
|
|
400
|
+
let o = i.current, s = !/^\s/.test(o.slice(a)), c = `/${n}${s ? " " : ""}`, l = o.slice(0, a) + c + o.slice(a);
|
|
401
|
+
return i.current = l, t(l), r((t) => ce(t, a, e, n, s)), s;
|
|
402
|
+
}, []), l = C((e, n, a) => {
|
|
403
|
+
let o = i.current, s = `/${n}`, c = o.slice(0, a) + s + o.slice(a);
|
|
404
|
+
i.current = c, t(c), r((t) => ce(t, a, e, n, !1));
|
|
405
|
+
}, []), u = C((e) => le(a.current, e), []), d = D(() => {
|
|
406
|
+
if (n.length !== 0) return n.map((e) => ({ url: e.url }));
|
|
407
|
+
}, [n]), f = C((e, t) => {
|
|
408
|
+
o.current = t.length > 0 ? {
|
|
409
|
+
text: e,
|
|
410
|
+
mentions: t
|
|
411
|
+
} : null;
|
|
412
|
+
}, []), p = C(() => {
|
|
413
|
+
t(""), r([]);
|
|
414
|
+
}, []), m = C((e, n, i) => {
|
|
415
|
+
let a = n ?? [], o = ie(e, a, i);
|
|
416
|
+
t(e), r(o.map((e) => {
|
|
417
|
+
let t = a[e.skillIndex];
|
|
418
|
+
return {
|
|
419
|
+
url: t.url,
|
|
420
|
+
name: i(t.url),
|
|
421
|
+
start: e.start,
|
|
422
|
+
length: e.length
|
|
423
|
+
};
|
|
424
|
+
}));
|
|
425
|
+
}, []);
|
|
426
|
+
return D(() => ({
|
|
427
|
+
draft: e,
|
|
428
|
+
anchors: n,
|
|
429
|
+
onDraftChange: s,
|
|
430
|
+
insertMention: c,
|
|
431
|
+
restoreMention: l,
|
|
432
|
+
onBackspaceAtCaret: u,
|
|
433
|
+
orderedSkills: d,
|
|
434
|
+
reset: p,
|
|
435
|
+
seedFromMessage: m,
|
|
436
|
+
expectInsertion: f
|
|
437
|
+
}), [
|
|
438
|
+
f,
|
|
439
|
+
e,
|
|
440
|
+
n,
|
|
441
|
+
s,
|
|
442
|
+
c,
|
|
443
|
+
l,
|
|
444
|
+
u,
|
|
445
|
+
d,
|
|
446
|
+
p,
|
|
447
|
+
m
|
|
448
|
+
]);
|
|
449
|
+
}, pe = (e) => ({
|
|
220
450
|
id: e.url,
|
|
221
451
|
name: e.name,
|
|
222
452
|
description: e.description
|
|
223
|
-
}),
|
|
453
|
+
}), me = (e) => {
|
|
224
454
|
let t = e.split("/").filter((e) => e.length > 0);
|
|
225
455
|
return t[t.length - 1] ?? e;
|
|
226
|
-
},
|
|
227
|
-
let
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
456
|
+
}, he = (e) => {
|
|
457
|
+
let t = e.split("/").filter((e) => e.length > 0);
|
|
458
|
+
return t[0] !== "skills" || t.length < 3 ? null : t[1];
|
|
459
|
+
}, ge = (e, t) => he(e) === t ? V.Deleted : V.NotShared, _e = "/", ve = ({ isSkillsSupported: e, skills: t, sharedWithMe: n, publicSkills: r, favoriteIds: a, viewerBucket: o, onToggleFavorite: s, labels: c, historyChipLabelClassName: u, activeMentionLabelClassName: d = "text-accent", activeMentionDetailsTrigger: f, historyDetailsTrigger: p, renderCatalogContent: m, detailsPanelComponent: h }) => {
|
|
460
|
+
let { addMenuLabel: g = "Skills", backLabel: _ = "Back", catalogModalTitleLabel: v = "Use skill", emptyQueryHintLabel: y = "Type to filter", deletedTooltipLabel: b, notSharedTooltipLabel: x, unsupportedTooltipLabel: w, panelLabels: T } = c ?? {}, [E, A] = k(!1), [j, M] = k(null), [N, P] = k(0), I = O(null), [L, R] = k(0), [te, z] = k(void 0), B = fe(), V = D(() => [
|
|
461
|
+
...t,
|
|
462
|
+
...n ?? [],
|
|
463
|
+
...r ?? []
|
|
231
464
|
], [
|
|
465
|
+
t,
|
|
232
466
|
n,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
467
|
+
r
|
|
468
|
+
]), H = D(() => new Map(V.map((e) => [e.url, e])), [V]), W = C((e) => H.get(e)?.name ?? me(e), [H]), G = D(() => V.filter((e) => a.has(e.url)).map((e) => pe(e)), [V, a]), ne = B.anchors.length > 0 && !e, re = D(() => B.anchors.map((t) => ({
|
|
469
|
+
start: t.start,
|
|
470
|
+
length: t.length,
|
|
471
|
+
isUnsupported: !e,
|
|
472
|
+
render: () => /* @__PURE__ */ F(U, {
|
|
473
|
+
name: t.name,
|
|
474
|
+
path: t.url,
|
|
475
|
+
labelClassName: d,
|
|
476
|
+
description: H.get(t.url)?.description,
|
|
477
|
+
isUnsupported: !e,
|
|
478
|
+
detailsTrigger: f,
|
|
479
|
+
onViewDetails: M,
|
|
480
|
+
labels: {
|
|
481
|
+
viewDetailsLabel: T?.viewDetailsLabel,
|
|
482
|
+
unsupportedTooltipLabel: w
|
|
483
|
+
}
|
|
484
|
+
})
|
|
485
|
+
})), [
|
|
486
|
+
B.anchors,
|
|
487
|
+
e,
|
|
488
|
+
H,
|
|
489
|
+
d,
|
|
490
|
+
f,
|
|
491
|
+
T,
|
|
492
|
+
w
|
|
493
|
+
]), q = C((e, t, n) => {
|
|
494
|
+
let r = B.insertMention(e, t, n);
|
|
495
|
+
R((e) => e + 1), z(n + 1 + t.length + +!!r);
|
|
496
|
+
}, [B]), J = C((e) => {
|
|
497
|
+
let t = ue(B.draft, e, _e);
|
|
498
|
+
return t == null ? e : (B.onDraftChange(B.draft.slice(0, t.start) + B.draft.slice(t.end)), t.start);
|
|
499
|
+
}, [B]), X = C((e) => {
|
|
500
|
+
let t = ue(B.draft, e, _e);
|
|
501
|
+
if (t == null) return;
|
|
502
|
+
let n = B.anchors.find((e) => e.start === t.start && e.start + e.length === t.end);
|
|
503
|
+
return {
|
|
504
|
+
position: t.start,
|
|
505
|
+
text: B.draft.slice(t.start, t.end),
|
|
506
|
+
mentionUrl: n?.url
|
|
507
|
+
};
|
|
508
|
+
}, [B]), Z = C(() => {
|
|
509
|
+
B.reset(), R((e) => e + 1), z(void 0);
|
|
510
|
+
}, [B]), { expectInsertion: Q } = B, $ = C((t) => {
|
|
511
|
+
Q(t, e ? ae(t, V) : []);
|
|
512
|
+
}, [
|
|
513
|
+
Q,
|
|
514
|
+
e,
|
|
515
|
+
V
|
|
516
|
+
]), oe = C((e, t) => {
|
|
517
|
+
B.seedFromMessage(e, t, W), R((e) => e + 1), z(void 0);
|
|
518
|
+
}, [B, W]), se = C((e, t) => {
|
|
519
|
+
if (t == null || t.length === 0) return null;
|
|
520
|
+
let n = ie(e, t, W), r = [], i = 0;
|
|
521
|
+
return n.forEach((n) => {
|
|
522
|
+
n.start > i && r.push(e.slice(i, n.start));
|
|
523
|
+
let a = t[n.skillIndex], s = H.get(a.url), c = s?.name ?? me(a.url), l = s == null ? ge(a.url, o) : void 0;
|
|
524
|
+
r.push(/* @__PURE__ */ F(U, {
|
|
525
|
+
name: c,
|
|
526
|
+
path: a.url,
|
|
527
|
+
labelClassName: u,
|
|
528
|
+
description: s?.description,
|
|
529
|
+
unresolvedReason: l,
|
|
530
|
+
detailsTrigger: p,
|
|
531
|
+
onViewDetails: M,
|
|
532
|
+
labels: {
|
|
533
|
+
viewDetailsLabel: T?.viewDetailsLabel,
|
|
534
|
+
deletedTooltipLabel: b,
|
|
535
|
+
notSharedTooltipLabel: x
|
|
536
|
+
}
|
|
537
|
+
}, `${a.url}-${n.start}`)), i = n.start + n.length;
|
|
538
|
+
}), i < e.length && r.push(e.slice(i)), r;
|
|
539
|
+
}, [
|
|
540
|
+
W,
|
|
541
|
+
H,
|
|
542
|
+
u,
|
|
543
|
+
p,
|
|
544
|
+
T,
|
|
545
|
+
o,
|
|
252
546
|
b,
|
|
253
|
-
|
|
254
|
-
]),
|
|
255
|
-
let t =
|
|
256
|
-
return /* @__PURE__ */
|
|
257
|
-
name:
|
|
547
|
+
x
|
|
548
|
+
]), ce = C((e) => e == null || e.length === 0 ? null : e.map((e) => {
|
|
549
|
+
let t = H.get(e.url), n = t?.name ?? me(e.url), r = t == null ? ge(e.url, o) : void 0;
|
|
550
|
+
return /* @__PURE__ */ F(U, {
|
|
551
|
+
name: n,
|
|
258
552
|
path: e.url,
|
|
259
553
|
labelClassName: u,
|
|
260
554
|
description: t?.description,
|
|
261
|
-
|
|
262
|
-
|
|
555
|
+
unresolvedReason: r,
|
|
556
|
+
detailsTrigger: p,
|
|
557
|
+
onViewDetails: M,
|
|
558
|
+
labels: {
|
|
559
|
+
viewDetailsLabel: T?.viewDetailsLabel,
|
|
560
|
+
deletedTooltipLabel: b,
|
|
561
|
+
notSharedTooltipLabel: x
|
|
562
|
+
}
|
|
263
563
|
}, e.url);
|
|
264
564
|
}), [
|
|
265
|
-
|
|
565
|
+
H,
|
|
266
566
|
u,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
567
|
+
p,
|
|
568
|
+
T,
|
|
569
|
+
o,
|
|
570
|
+
b,
|
|
571
|
+
x
|
|
572
|
+
]), le = C((e, t) => /* @__PURE__ */ F(K, {
|
|
573
|
+
favorites: G,
|
|
574
|
+
isMenu: !0,
|
|
575
|
+
onSelect: (n) => {
|
|
576
|
+
q(n.id, n.name, J(t)), e();
|
|
272
577
|
},
|
|
273
578
|
onToggleFavorite: s,
|
|
274
579
|
onBrowse: () => {
|
|
275
|
-
|
|
580
|
+
let n = X(t);
|
|
581
|
+
P(J(t)), I.current = n ?? null, e(), A(!0);
|
|
276
582
|
},
|
|
277
|
-
onViewDetails: (
|
|
278
|
-
e(),
|
|
583
|
+
onViewDetails: (n) => {
|
|
584
|
+
J(t), e(), M(n.id);
|
|
279
585
|
},
|
|
280
|
-
labels:
|
|
586
|
+
labels: T
|
|
281
587
|
}), [
|
|
282
|
-
|
|
283
|
-
|
|
588
|
+
G,
|
|
589
|
+
q,
|
|
590
|
+
J,
|
|
591
|
+
X,
|
|
284
592
|
s,
|
|
285
|
-
|
|
286
|
-
]), Y = x(() => S ? {
|
|
287
|
-
key: "skills",
|
|
288
|
-
title: p,
|
|
289
|
-
icon: /* @__PURE__ */ O(w, {
|
|
290
|
-
size: r,
|
|
291
|
-
"aria-hidden": !0,
|
|
292
|
-
stroke: c
|
|
293
|
-
}),
|
|
294
|
-
renderOverlay: J,
|
|
295
|
-
backLabel: m
|
|
296
|
-
} : void 0, [
|
|
297
|
-
S,
|
|
298
|
-
p,
|
|
299
|
-
m,
|
|
300
|
-
J
|
|
301
|
-
]), X = x(() => S ? {
|
|
302
|
-
triggerPrefix: "/",
|
|
303
|
-
menuLabel: p,
|
|
304
|
-
emptyQueryHint: g,
|
|
305
|
-
renderMenu: ({ query: e, close: t }) => /* @__PURE__ */ O(R, {
|
|
306
|
-
favorites: F,
|
|
307
|
-
searchQuery: e,
|
|
308
|
-
onSelect: (e) => {
|
|
309
|
-
t({ consumeQuery: !0 }), z(e.id);
|
|
310
|
-
},
|
|
311
|
-
onToggleFavorite: s,
|
|
312
|
-
onBrowse: () => {
|
|
313
|
-
t({ consumeQuery: !0 }), E(!0);
|
|
314
|
-
},
|
|
315
|
-
onViewDetails: (e) => {
|
|
316
|
-
t({ consumeQuery: !0 }), k(e.id);
|
|
317
|
-
},
|
|
318
|
-
labels: b
|
|
319
|
-
})
|
|
320
|
-
} : void 0, [
|
|
321
|
-
S,
|
|
322
|
-
p,
|
|
323
|
-
g,
|
|
324
|
-
F,
|
|
325
|
-
z,
|
|
326
|
-
s,
|
|
327
|
-
b
|
|
593
|
+
T
|
|
328
594
|
]);
|
|
329
|
-
return
|
|
330
|
-
skillMenuOverlay:
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
595
|
+
return {
|
|
596
|
+
skillMenuOverlay: D(() => e ? {
|
|
597
|
+
key: "skills",
|
|
598
|
+
title: g,
|
|
599
|
+
icon: /* @__PURE__ */ F(ee, {
|
|
600
|
+
size: i,
|
|
601
|
+
"aria-hidden": !0,
|
|
602
|
+
stroke: l
|
|
603
|
+
}),
|
|
604
|
+
renderOverlay: le,
|
|
605
|
+
backLabel: _
|
|
606
|
+
} : void 0, [
|
|
607
|
+
e,
|
|
608
|
+
g,
|
|
609
|
+
_,
|
|
610
|
+
le
|
|
611
|
+
]),
|
|
612
|
+
commandMenu: D(() => e ? {
|
|
613
|
+
triggerPrefix: _e,
|
|
614
|
+
menuLabel: g,
|
|
615
|
+
emptyQueryHint: y,
|
|
616
|
+
renderMenu: ({ query: e, caretPosition: t, close: n, listboxId: r, activeOptionId: i }) => /* @__PURE__ */ F(K, {
|
|
617
|
+
favorites: G,
|
|
618
|
+
searchQuery: e,
|
|
619
|
+
listboxId: r,
|
|
620
|
+
activeOptionId: i,
|
|
621
|
+
onSelect: (e) => {
|
|
622
|
+
n({ consumeQuery: !0 }), q(e.id, e.name, t);
|
|
623
|
+
},
|
|
624
|
+
onToggleFavorite: s,
|
|
625
|
+
onBrowse: () => {
|
|
626
|
+
let r = `${_e}${e}`, i = B.anchors.find((e) => e.start === t && e.length === r.length);
|
|
627
|
+
n({
|
|
628
|
+
consumeQuery: !0,
|
|
629
|
+
returnFocus: !1
|
|
630
|
+
}), P(t), I.current = {
|
|
631
|
+
position: t,
|
|
632
|
+
text: r,
|
|
633
|
+
mentionUrl: i?.url
|
|
634
|
+
}, A(!0);
|
|
635
|
+
},
|
|
636
|
+
onViewDetails: (e) => {
|
|
637
|
+
n({ consumeQuery: !0 }), M(e.id);
|
|
638
|
+
},
|
|
639
|
+
labels: T
|
|
640
|
+
})
|
|
641
|
+
} : void 0, [
|
|
642
|
+
e,
|
|
643
|
+
g,
|
|
644
|
+
y,
|
|
645
|
+
G,
|
|
646
|
+
q,
|
|
647
|
+
B.anchors,
|
|
648
|
+
s,
|
|
649
|
+
T
|
|
650
|
+
]),
|
|
651
|
+
skillCatalogModal: /* @__PURE__ */ F(Y, {
|
|
652
|
+
isOpen: E,
|
|
653
|
+
onClose: C(() => {
|
|
654
|
+
A(!1);
|
|
655
|
+
let e = I.current;
|
|
656
|
+
if (I.current = null, e == null) return;
|
|
657
|
+
let { position: t, text: n, mentionUrl: r } = e;
|
|
658
|
+
r == null ? B.onDraftChange(B.draft.slice(0, t) + n + B.draft.slice(t)) : B.restoreMention(r, n.slice(1), t), R((e) => e + 1), z(t + n.length);
|
|
659
|
+
}, [B]),
|
|
335
660
|
onSelect: (e) => {
|
|
336
|
-
|
|
661
|
+
I.current = null, q(e, W(e), N), A(!1);
|
|
337
662
|
},
|
|
338
|
-
title:
|
|
339
|
-
renderContent:
|
|
663
|
+
title: v,
|
|
664
|
+
renderContent: m
|
|
340
665
|
}),
|
|
341
|
-
skillDetailsPanel: /* @__PURE__ */
|
|
666
|
+
skillDetailsPanel: /* @__PURE__ */ F(S, {
|
|
342
667
|
fallback: null,
|
|
343
|
-
children: /* @__PURE__ */
|
|
344
|
-
skillId:
|
|
345
|
-
onClose: () =>
|
|
668
|
+
children: /* @__PURE__ */ F(h, {
|
|
669
|
+
skillId: j,
|
|
670
|
+
onClose: () => M(null)
|
|
346
671
|
})
|
|
347
672
|
}),
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
673
|
+
message: B.draft,
|
|
674
|
+
messageRevision: L,
|
|
675
|
+
activeMentions: re,
|
|
676
|
+
onDraftChange: B.onDraftChange,
|
|
677
|
+
onBackspaceAtCaret: B.onBackspaceAtCaret,
|
|
678
|
+
caretPositionOverride: te,
|
|
679
|
+
isSkillUnsupported: ne,
|
|
680
|
+
selectedSkills: B.orderedSkills,
|
|
681
|
+
resetSkillMentions: Z,
|
|
682
|
+
seedSkillMentions: oe,
|
|
683
|
+
recognizeMentionsInInsertion: $,
|
|
684
|
+
renderHistorySkillSegments: se,
|
|
685
|
+
renderHistorySkills: ce
|
|
686
|
+
};
|
|
687
|
+
}, ye = {
|
|
688
|
+
background: "_background_1ult0_1",
|
|
689
|
+
border: "_border_1ult0_5",
|
|
690
|
+
value: "_value_1ult0_9",
|
|
691
|
+
clear: "_clear_1ult0_13",
|
|
692
|
+
invalid: "_invalid_1ult0_17"
|
|
693
|
+
}, be = [], xe = "Selected model does not support skills. Select a different model to use a skill.", Se = ({ value: i, onChange: a, displayNames: o, skills: s = be, isSkillsSupported: l, isDisabled: u = !1, error: d, labels: p, className: m, styles: h }) => {
|
|
694
|
+
let [g, v] = k(!1), [y, x] = k(""), S = O(null), C = T(), w = i.some((e) => n(e, l)), D = l && !u, ee = g && D, A = i.length > 0 ? p.unsupportedTooltipLabel : p.unavailableTooltipLabel ?? xe, j = !l && i.length === 0, M = d ?? (j ? A : void 0), N = new Map(i.map((e) => [e, {
|
|
695
|
+
id: e,
|
|
696
|
+
name: o?.[e] || e
|
|
697
|
+
}]));
|
|
698
|
+
s.forEach((e) => N.set(e.id, e));
|
|
699
|
+
let P = [...N.values()].map((t) => ({
|
|
700
|
+
value: t.id,
|
|
701
|
+
label: t.name,
|
|
702
|
+
labelNode: y.trim() ? /* @__PURE__ */ F(f, {
|
|
703
|
+
text: t.name,
|
|
704
|
+
query: y,
|
|
705
|
+
maxLines: 1
|
|
706
|
+
}) : void 0,
|
|
707
|
+
icon: /* @__PURE__ */ F(e, {
|
|
708
|
+
size: c.SM,
|
|
709
|
+
initialsName: t.name
|
|
710
|
+
}),
|
|
711
|
+
disabled: !l
|
|
712
|
+
})), L = {
|
|
713
|
+
...t({
|
|
714
|
+
"--ssf-text": h?.colors?.text,
|
|
715
|
+
"--ssf-bg": h?.colors?.background,
|
|
716
|
+
"--ssf-border": h?.colors?.border,
|
|
717
|
+
"--ssf-error": h?.colors?.error
|
|
718
|
+
}),
|
|
719
|
+
...h?.cssVars
|
|
367
720
|
};
|
|
721
|
+
return E(() => {
|
|
722
|
+
let e = S.current?.querySelector("[role=\"combobox\"]");
|
|
723
|
+
e && (M ? e.setAttribute("aria-describedby", C) : e.removeAttribute("aria-describedby"), d || w ? e.setAttribute("aria-invalid", "true") : e.removeAttribute("aria-invalid"));
|
|
724
|
+
}, [
|
|
725
|
+
M,
|
|
726
|
+
C,
|
|
727
|
+
d,
|
|
728
|
+
u,
|
|
729
|
+
w
|
|
730
|
+
]), /* @__PURE__ */ I("div", {
|
|
731
|
+
ref: S,
|
|
732
|
+
className: r("min-w-0", m, B.selectorField),
|
|
733
|
+
style: L,
|
|
734
|
+
children: [/* @__PURE__ */ F(b, {
|
|
735
|
+
tooltip: A,
|
|
736
|
+
hideTooltip: l,
|
|
737
|
+
triggerClassName: "block w-full min-w-0",
|
|
738
|
+
children: /* @__PURE__ */ F("div", {
|
|
739
|
+
inert: u ? !0 : void 0,
|
|
740
|
+
children: /* @__PURE__ */ F(_, {
|
|
741
|
+
multiple: !0,
|
|
742
|
+
searchable: !0,
|
|
743
|
+
open: ee,
|
|
744
|
+
onOpenChange: (e) => {
|
|
745
|
+
e && !D || v(e);
|
|
746
|
+
},
|
|
747
|
+
onSearchQueryChange: x,
|
|
748
|
+
value: i,
|
|
749
|
+
onChange: (e) => {
|
|
750
|
+
u || a(Array.isArray(e) ? e : [e]);
|
|
751
|
+
},
|
|
752
|
+
options: P,
|
|
753
|
+
placeholder: p.placeholder,
|
|
754
|
+
labelProps: { label: p.fieldLabel },
|
|
755
|
+
error: d,
|
|
756
|
+
caption: j ? A : void 0,
|
|
757
|
+
searchPlaceholder: p.searchPlaceholder ?? "Search skills",
|
|
758
|
+
emptyStateTitle: y.trim() ? p.noMatchingSkillsLabel ?? "No matching skills" : p.emptyLabel ?? "No skills available",
|
|
759
|
+
disabled: u || j,
|
|
760
|
+
invalid: !!d || w,
|
|
761
|
+
className: "w-full min-w-0",
|
|
762
|
+
fieldClassName: r(D ? "cursor-pointer" : "cursor-not-allowed", "--ssf-bg" in L && ye.background, "--ssf-border" in L && ye.border, "--ssf-text" in L && ye.value, (d || w) && ye.invalid, h?.typography?.fontClassName ?? "dial-small-text", h?.triggerClassName),
|
|
763
|
+
listClassName: "w-[min(var(--reference-width),calc(100vw-2rem))] max-w-full"
|
|
764
|
+
})
|
|
765
|
+
})
|
|
766
|
+
}), M && /* @__PURE__ */ F("span", {
|
|
767
|
+
id: C,
|
|
768
|
+
className: "sr-only",
|
|
769
|
+
children: M
|
|
770
|
+
})]
|
|
771
|
+
});
|
|
368
772
|
};
|
|
369
773
|
//#endregion
|
|
370
|
-
export {
|
|
774
|
+
export { U as ChatSkill, K as FavoriteSkillsPanel, B as SKILLS_CLASS, J as SkillArchiveUploadDialog, Y as SkillCatalogModal, Z as SkillContentFileTree, Q as SkillDetailsSidePanel, H as SkillInfoTooltipContent, Se as SkillSelectorField, V as SkillUnresolvedReason, pe as buildFavoriteSkillItem, oe as diffTextChange, le as findMentionAtCaret, me as getSkillFallbackName, ce as insertAnchor, ie as matchSkillMentions, se as reconcileAnchors, fe as useSkillMentions, ve as useSkillSelectorOverlay };
|