@epam/ai-dial-skills 1.3.0-dev.37 → 1.3.0-dev.371

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