@epam/ai-dial-skills 1.3.0-dev.35 → 1.3.0-dev.355

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