@epam/ai-dial-skills 1.3.0-dev.96 → 1.3.0-rc.0

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