@epam/ai-dial-skills 1.3.0-dev.14 → 1.3.0-dev.142

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,100 @@
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, 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 te, IconEye as A, IconLock as j, IconStarFilled as M, IconTrash as ne } from "@tabler/icons-react";
5
+ import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
6
+ import { DialFileNodeType as I, DialFoldersTree as L } from "@epam/ai-dial-react-file-manager";
7
+ import { CatalogContentNodeType as R, DetailsPanel as z } from "@epam/ai-dial-catalog";
8
8
  //#region src/constants/public-class-names.ts
9
9
  var B = {
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
+ }, V = "max-h-[280px] max-w-[min(420px,calc(100vw-10px))] overflow-y-auto", H = /* @__PURE__ */ function(e) {
14
14
  return e.Deleted = "deleted", e.NotShared = "not-shared", e;
15
- }({}), H = ({ description: e, unsupportedMessage: t, unresolvedReason: n, deletedMessage: r, notSharedMessage: i, viewDetailsLabel: u = "View details", onViewDetails: d, viewDetailsTabIndex: f }) => {
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
16
  if (n != null) {
17
- let e = n === V.Deleted, t = e ? N : j, a = e ? r : i;
18
- return /* @__PURE__ */ I("div", {
17
+ let e = n === H.Deleted, t = e ? ne : j, a = e ? i : d;
18
+ return /* @__PURE__ */ F("div", {
19
19
  className: "flex flex-row items-center gap-2",
20
- children: [/* @__PURE__ */ F(t, {
20
+ children: [/* @__PURE__ */ P(t, {
21
21
  size: c.MD,
22
22
  stroke: l,
23
23
  "aria-hidden": !0,
24
24
  className: "shrink-0 text-secondary"
25
- }), /* @__PURE__ */ F("p", {
26
- className: "dial-tiny-text text-start text-primary",
25
+ }), /* @__PURE__ */ P("p", {
26
+ className: r(h, "text-start text-primary"),
27
27
  children: a
28
28
  })]
29
29
  });
30
30
  }
31
- return t == null ? /* @__PURE__ */ I("div", {
31
+ return t == null ? /* @__PURE__ */ F("div", {
32
32
  className: "flex flex-col gap-3",
33
- children: [e != null && e !== "" && /* @__PURE__ */ F("p", {
34
- className: "text-start",
33
+ children: [e != null && e !== "" && /* @__PURE__ */ P("p", {
34
+ className: r(h, "text-start"),
35
35
  children: e
36
- }), /* @__PURE__ */ F(a, {
36
+ }), /* @__PURE__ */ P(a, {
37
37
  variant: s.Primary,
38
38
  appearance: o.Link,
39
- className: "h-[24px] self-start",
40
- label: u,
41
- iconBefore: /* @__PURE__ */ F(A, {
39
+ size: u.Small,
40
+ className: "self-start",
41
+ label: f,
42
+ iconBefore: /* @__PURE__ */ P(A, {
42
43
  size: c.SM,
43
44
  stroke: l,
44
45
  "aria-hidden": !0
45
46
  }),
46
- onClick: d,
47
- tabIndex: f
47
+ onClick: p,
48
+ tabIndex: m
48
49
  })]
49
- }) : /* @__PURE__ */ F("p", {
50
- className: "text-start",
50
+ }) : /* @__PURE__ */ P("p", {
51
+ className: r(h, "text-start"),
51
52
  children: t
52
53
  });
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 = () => {
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 = () => {
55
56
  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, {
57
+ }, [C, w] = k(null), [T, E] = k(null);
58
+ return ee(() => {
59
+ if (!C) return;
60
+ let e = () => {
61
+ C.isConnected && E(C.getBoundingClientRect().width);
62
+ };
63
+ if (e(), typeof ResizeObserver > "u") return;
64
+ let t = new ResizeObserver(e);
65
+ return t.observe(C), () => t.disconnect();
66
+ }, [C, o]), /* @__PURE__ */ P(m, {
63
67
  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
+ placement: S.Top,
69
+ trigger: b ? h.Click : h.Hover,
70
+ contentClassName: V,
71
+ content: a == null ? i ? /* @__PURE__ */ P(U, { unsupportedMessage: p }) : /* @__PURE__ */ P(U, {
68
72
  description: n,
69
73
  viewDetailsLabel: f,
70
- onViewDetails: S
71
- }) : /* @__PURE__ */ F(H, {
74
+ onViewDetails: x
75
+ }) : /* @__PURE__ */ P(U, {
72
76
  unresolvedReason: a,
73
77
  deletedMessage: g,
74
78
  notSharedMessage: _
75
79
  }),
76
- children: /* @__PURE__ */ I("span", {
80
+ children: /* @__PURE__ */ F("span", {
77
81
  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),
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),
79
83
  "aria-label": `/${e}`,
80
- children: [/* @__PURE__ */ F("span", {
81
- ref: C,
84
+ children: [/* @__PURE__ */ P("span", {
85
+ ref: w,
82
86
  "aria-hidden": !0,
83
- className: "inset-inline-start-0 pointer-events-none absolute top-0 select-none",
87
+ className: "inset-inline-start-0 pointer-events-none absolute select-none",
84
88
  children: "/"
85
- }), /* @__PURE__ */ F("span", {
89
+ }), /* @__PURE__ */ P("span", {
86
90
  "aria-hidden": !0,
87
91
  className: "select-none",
88
- style: { paddingInlineStart: w ?? void 0 },
92
+ style: { paddingInlineStart: T ?? void 0 },
89
93
  children: e
90
94
  })]
91
95
  })
92
96
  }, v);
93
- }, W = {
97
+ }, G = {
94
98
  row: "_row_1v431_1",
95
99
  header: "_header_1v431_8",
96
100
  emptyHint: "_emptyHint_1v431_12",
@@ -101,127 +105,127 @@ var B = {
101
105
  rowLeaving: "_rowLeaving_1v431_32",
102
106
  rowFadeOut: "_rowFadeOut_1v431_1",
103
107
  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(() => {
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: te = "Star a skill to pin it here", browseLabel: A = "Browse", removeFromFavoritesLabel: j = "Remove from favorites", viewDetailsLabel: ne = "View details", noMatchingSkillsLabel: N = "No matching skills" } = y, I = 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
+ }), [L, R] = k(/* @__PURE__ */ new Set()), z = O(/* @__PURE__ */ new Map());
116
+ T(() => {
113
117
  let e = z.current;
114
118
  return () => {
115
119
  e.forEach((e) => clearTimeout(e)), e.clear();
116
120
  };
117
121
  }, []);
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) => {
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));
127
+ }, [n, h]);
128
+ let ce = (e, t) => {
125
129
  e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), i(t));
126
- }, oe = (e) => {
127
- te((t) => new Set(t).add(e));
130
+ }, le = (e) => {
131
+ R((t) => new Set(t).add(e));
128
132
  let t = setTimeout(() => {
129
- a?.(e), te((t) => {
133
+ a?.(e), R((t) => {
130
134
  let n = new Set(t);
131
135
  return n.delete(e), n;
132
136
  }), z.current.delete(e);
133
- }, ne);
137
+ }, ie);
134
138
  z.current.set(e, t);
135
139
  };
136
- return /* @__PURE__ */ I("div", {
137
- className: r("flex w-full flex-col desktop:w-[280px]", l, B.favoritesPanel),
138
- style: L,
140
+ return /* @__PURE__ */ F("div", {
141
+ className: r("flex w-full flex-col desktop:w-[280px]", u, B.favoritesPanel),
142
+ style: I,
139
143
  children: [
140
- /* @__PURE__ */ F("p", {
141
- id: J,
142
- className: r(S, G, W.header),
144
+ /* @__PURE__ */ P("p", {
145
+ id: Y,
146
+ className: r(C, re, G.header),
143
147
  children: D
144
148
  }),
145
- /* @__PURE__ */ F("div", {
146
- className: r("max-h-72 min-h-0 flex-1 overflow-y-auto", W.listContent),
147
- style: { maxHeight: $ },
148
- children: /* @__PURE__ */ F("div", {
149
+ /* @__PURE__ */ P("div", {
150
+ className: r("max-h-72 min-h-0 flex-1 overflow-y-auto", G.listContent),
151
+ style: { maxHeight: oe },
152
+ children: /* @__PURE__ */ P("div", {
149
153
  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,
154
+ children: Z.length > 0 ? /* @__PURE__ */ P("ul", {
155
+ id: g,
156
+ role: H ? "listbox" : q,
157
+ "aria-labelledby": H ? Y : void 0,
154
158
  className: "flex flex-col gap-1 px-1 pb-1",
155
159
  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,
160
+ let n = H ? `${g}-${encodeURIComponent(t.id)}` : void 0, o = H ? -1 : void 0, u = /* @__PURE__ */ F("div", {
161
+ role: J,
158
162
  id: n,
159
- "aria-selected": V ? n === g : void 0,
163
+ "aria-selected": H ? n === _ : void 0,
160
164
  "aria-label": t.name,
161
165
  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),
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),
163
167
  onClick: () => i(t),
164
- onKeyDown: (e) => ae(e, t),
168
+ onKeyDown: (e) => ce(e, t),
165
169
  children: [
166
- /* @__PURE__ */ F(e, {
170
+ /* @__PURE__ */ P(e, {
167
171
  size: c.MD,
168
172
  initialsName: t.name
169
173
  }),
170
- m == null ? /* @__PURE__ */ F("span", {
171
- className: r(x, "min-w-0 flex-1 truncate text-start"),
174
+ h == null ? /* @__PURE__ */ P("span", {
175
+ className: r(S, "min-w-0 flex-1 truncate text-start"),
172
176
  children: t.name
173
- }) : /* @__PURE__ */ F(f, {
177
+ }) : /* @__PURE__ */ P(p, {
174
178
  text: t.name,
175
- query: m,
179
+ query: h,
176
180
  maxLines: 1,
177
- className: r(x, "min-w-0 flex-1 text-start")
181
+ className: r(S, "min-w-0 flex-1 text-start")
178
182
  }),
179
- a && /* @__PURE__ */ F(y, {
180
- icon: /* @__PURE__ */ F(M, {
183
+ a && /* @__PURE__ */ P(b, {
184
+ icon: /* @__PURE__ */ P(M, {
181
185
  size: c.SM,
182
- className: W.star,
186
+ className: G.star,
183
187
  "aria-hidden": !0
184
188
  }),
185
189
  "aria-label": j,
186
190
  isSelected: !0,
187
191
  tabIndex: o,
188
192
  onClick: (e) => {
189
- e.stopPropagation(), oe(t.id);
193
+ e.stopPropagation(), le(t.id);
190
194
  }
191
195
  })
192
196
  ]
193
197
  });
194
- return /* @__PURE__ */ F("li", {
195
- role: K,
196
- className: R.has(t.id) ? W.rowLeaving : W.rowEnter,
197
- children: s ? /* @__PURE__ */ F(p, {
198
+ return /* @__PURE__ */ P("li", {
199
+ role: q,
200
+ className: L.has(t.id) ? G.rowLeaving : G.rowEnter,
201
+ children: s && !l ? /* @__PURE__ */ P(m, {
198
202
  asChild: !0,
199
- contentClassName: "max-w-[550px]",
200
- content: /* @__PURE__ */ F(H, {
203
+ contentClassName: V,
204
+ content: /* @__PURE__ */ P(U, {
201
205
  description: t.description,
202
- viewDetailsLabel: N,
206
+ viewDetailsLabel: ne,
203
207
  onViewDetails: () => s(t),
204
208
  viewDetailsTabIndex: o
205
209
  }),
206
- children: l
207
- }) : l
210
+ children: u
211
+ }) : u
208
212
  }, t.id);
209
213
  })
210
- }) : Y && X !== "" ? /* @__PURE__ */ F("p", {
214
+ }) : ae && X !== "" ? /* @__PURE__ */ P("p", {
211
215
  role: "status",
212
216
  "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
217
+ className: r(w, "px-4 py-4 text-start", G.emptyHint),
218
+ children: N
219
+ }) : /* @__PURE__ */ P("p", {
220
+ className: r(w, "px-4 py-4 text-start", G.emptyHint),
221
+ children: te
218
222
  })
219
223
  })
220
224
  }),
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
+ /* @__PURE__ */ P("div", {
226
+ className: r("border-t px-2 py-3", G.footer),
227
+ children: /* @__PURE__ */ P(f, {
228
+ role: W ? "menuitem" : void 0,
225
229
  label: A,
226
230
  className: "w-full justify-center",
227
231
  onClick: o
@@ -229,21 +233,21 @@ var B = {
229
233
  })
230
234
  ]
231
235
  });
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, {
236
+ }, J = ".zip,.md", Y = ({ isOpen: e, errorText: t, isUploading: n = !1, accept: r = J, labels: i, onClose: a, onFilesSelected: o, onFilesRejected: s }) => {
237
+ 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__ */ P(g, {
235
239
  open: e,
236
- size: g.Sm,
240
+ size: _.Sm,
237
241
  header: c,
238
242
  closeAriaLabel: m,
239
243
  onClose: a,
240
- children: /* @__PURE__ */ I("div", {
244
+ children: /* @__PURE__ */ F("div", {
241
245
  className: "flex flex-col gap-4 px-6 py-4",
242
- children: [/* @__PURE__ */ F(u, {
243
- label: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("span", {
246
+ children: [/* @__PURE__ */ P(d, {
247
+ label: /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("span", {
244
248
  className: "desktop:hidden",
245
- children: d
246
- }), /* @__PURE__ */ F("span", {
249
+ children: u
250
+ }), /* @__PURE__ */ P("span", {
247
251
  className: "hidden desktop:inline",
248
252
  children: l
249
253
  })] }),
@@ -254,56 +258,59 @@ var B = {
254
258
  errorText: n ? void 0 : t,
255
259
  onChange: o,
256
260
  onReject: s
257
- }), n && /* @__PURE__ */ F(v, { ariaLabel: _ })]
261
+ }), n && /* @__PURE__ */ P(y, { ariaLabel: h })]
258
262
  })
259
263
  });
260
- }, Y = ({ isOpen: e, onClose: t, onSelect: n, title: r, renderContent: i }) => /* @__PURE__ */ F(h, {
264
+ }, ae = ({ isOpen: e, onClose: t, onSelect: n, title: r, renderContent: i }) => /* @__PURE__ */ P(g, {
261
265
  open: e,
262
266
  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",
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",
265
269
  overlayClassName: "mobile:p-0",
266
270
  onClose: t,
267
- children: /* @__PURE__ */ F("div", {
271
+ children: /* @__PURE__ */ P("div", {
268
272
  className: "h-[min(80vh,840px)] overflow-auto mobile:h-full",
269
- children: /* @__PURE__ */ F(S, {
273
+ children: /* @__PURE__ */ P(C, {
270
274
  fallback: null,
271
275
  children: e && i(n, t)
272
276
  })
273
277
  })
274
- }), X = (e, t = null) => e.map((e) => e.type === te.Folder ? {
278
+ }), X = (e, t = null) => e.map((e) => e.type === R.Folder ? {
275
279
  path: e.id,
276
280
  name: e.name,
277
- nodeType: L.FOLDER,
281
+ nodeType: I.FOLDER,
278
282
  parentPath: t,
279
283
  folderId: e.id,
280
284
  items: X(e.items, e.id)
281
285
  } : {
282
286
  path: e.id,
283
287
  name: e.name,
284
- nodeType: L.ITEM,
288
+ nodeType: I.ITEM,
285
289
  parentPath: t,
286
290
  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, {
291
+ }), Z = ({ nodes: e, selectedFileId: t, expandedFolderIds: n, onToggleFolder: r, onSelectFile: i, onClose: a, ariaLabel: o }) => {
292
+ let s = D(() => X(e), [e]), c = D(() => new Set(n), [n]);
293
+ return /* @__PURE__ */ P(L, {
294
+ items: s,
295
+ showFiles: !0,
296
+ areHiddenFilesVisible: !0,
297
+ selectedPath: t,
298
+ expandedPaths: c,
299
+ onExpandedPathsChange: (e) => {
300
+ for (let t of e) n.has(t) || r(t);
301
+ for (let t of n) e.has(t) || r(t);
302
+ },
303
+ onItemClick: (e) => {
304
+ e.nodeType === I.ITEM && i(e.path);
305
+ },
306
+ ariaLabel: o,
307
+ autoFocus: !0,
308
+ onEscape: a
309
+ });
310
+ }, Q = (e) => /* @__PURE__ */ P(z, {
304
311
  ...e,
305
- renderContentFileTree: (e) => /* @__PURE__ */ F(Z, { ...e })
306
- }), $ = (e) => e == null || /[\s/]/.test(e), ie = (e, t, n) => {
312
+ renderContentFileTree: (e) => /* @__PURE__ */ P(Z, { ...e })
313
+ }), oe = (e) => e == null || /[\s/]/.test(e), se = (e, t, n) => {
307
314
  let r = [], i = 0;
308
315
  return t.forEach((t, a) => {
309
316
  let o = `/${n(t.url)}`, s = i;
@@ -311,7 +318,7 @@ var B = {
311
318
  let t = e.indexOf(o, s);
312
319
  if (t === -1) return;
313
320
  let n = t + o.length;
314
- if ($(e[n])) {
321
+ if (oe(e[n])) {
315
322
  r.push({
316
323
  skillIndex: a,
317
324
  start: t,
@@ -322,14 +329,14 @@ var B = {
322
329
  s = t + 1;
323
330
  }
324
331
  }), r;
325
- }, ae = (e, t) => {
332
+ }, ce = (e, t) => {
326
333
  let n = /* @__PURE__ */ new Map();
327
334
  t.forEach((e) => {
328
335
  e.name !== "" && !n.has(e.name) && n.set(e.name, e.url);
329
336
  });
330
337
  let r = [...n.keys()].sort((e, t) => t.length - e.length), i = [], a = e.indexOf("/");
331
338
  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);
339
+ 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);
333
340
  s != null && c != null ? (i.push({
334
341
  url: c,
335
342
  name: s,
@@ -338,7 +345,7 @@ var B = {
338
345
  }), a = e.indexOf("/", o + s.length)) : a = e.indexOf("/", o);
339
346
  }
340
347
  return i;
341
- }, oe = (e, t) => {
348
+ }, le = (e, t) => {
342
349
  let n = Math.min(e.length, t.length), r = 0;
343
350
  for (; r < n && e[r] === t[r];) r += 1;
344
351
  let i = n - r, a = 0;
@@ -348,13 +355,13 @@ var B = {
348
355
  deletedLength: e.length - r - a,
349
356
  insertedLength: t.length - r - a
350
357
  };
351
- }, se = (e, t) => {
358
+ }, ue = (e, t) => {
352
359
  let n = t.start + t.deletedLength, r = t.insertedLength - t.deletedLength;
353
360
  return e.reduce((e, i) => i.start + i.length <= t.start ? (e.push(i), e) : (i.start >= n && e.push({
354
361
  ...i,
355
362
  start: i.start + r
356
363
  }), e), []);
357
- }, ce = (e, t, n, r, i) => {
364
+ }, $ = (e, t, n, r, i) => {
358
365
  let a = r.length + 1, o = a + +!!i, s = e.map((e) => e.start >= t ? {
359
366
  ...e,
360
367
  start: e.start + o
@@ -365,31 +372,31 @@ var B = {
365
372
  length: a
366
373
  };
367
374
  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) => {
375
+ }, de = (e, t) => e.find((e) => e.start + e.length === t), fe = (e, t, n) => {
369
376
  let r = t;
370
377
  for (; r > 0 && !/\s/.test(e[r - 1]);) r--;
371
378
  let i = r;
372
379
  for (; i < e.length && !/\s/.test(e[i]);) i++;
373
380
  let a = e.slice(r, i);
374
- if (!(!a.startsWith(n) || a.slice(n.length).includes(n))) return {
381
+ if (a.startsWith(n) && !a.slice(n.length).includes(n)) return {
375
382
  start: r,
376
383
  end: i
377
384
  };
378
- }, de = (e, t, n) => {
385
+ }, pe = (e, t, n) => {
379
386
  if (n === "" || t.insertedLength < n.length) return;
380
387
  let r = e.indexOf(n, Math.max(0, t.start - n.length)), i = t.start + t.insertedLength - n.length;
381
388
  return r !== -1 && r <= i ? r : void 0;
382
- }, fe = () => {
389
+ }, me = () => {
383
390
  let [e, t] = k(""), [n, r] = k([]), i = O(e);
384
391
  i.current = e;
385
392
  let a = O(n);
386
393
  a.current = n;
387
- let o = O(null), s = C((e) => {
388
- let n = oe(i.current, e), a = o.current;
394
+ let o = O(null), s = w((e) => {
395
+ let n = le(i.current, e), a = o.current;
389
396
  o.current = null;
390
- let s = a == null ? void 0 : de(e, n, a.text);
397
+ let s = a == null ? void 0 : pe(e, n, a.text);
391
398
  r((t) => {
392
- let r = se(t, n);
399
+ let r = ue(t, n);
393
400
  if (a == null || s == null) return r;
394
401
  let i = a.mentions.map((e) => ({
395
402
  ...e,
@@ -397,23 +404,23 @@ var B = {
397
404
  })).filter((t) => e.startsWith(`/${t.name}`, t.start) && !r.some((e) => e.start < t.start + t.length && t.start < e.start + e.length));
398
405
  return [...r, ...i].sort((e, t) => e.start - t.start);
399
406
  }), i.current = e, t(e);
400
- }, []), c = C((e, n, a) => {
407
+ }, []), c = w((e, n, a) => {
401
408
  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) => {
409
+ return i.current = l, t(l), r((t) => $(t, a, e, n, s)), s;
410
+ }, []), l = w((e, n, a) => {
404
411
  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(() => {
412
+ i.current = c, t(c), r((t) => $(t, a, e, n, !1));
413
+ }, []), u = w((e) => de(a.current, e), []), d = D(() => {
407
414
  if (n.length !== 0) return n.map((e) => ({ url: e.url }));
408
- }, [n]), f = C((e, t) => {
415
+ }, [n]), f = w((e, t) => {
409
416
  o.current = t.length > 0 ? {
410
417
  text: e,
411
418
  mentions: t
412
419
  } : null;
413
- }, []), p = C(() => {
420
+ }, []), p = w(() => {
414
421
  t(""), r([]);
415
- }, []), m = C((e, n, i) => {
416
- let a = n ?? [], o = ie(e, a, i);
422
+ }, []), m = w((e, n, i) => {
423
+ let a = n ?? [], o = se(e, a, i);
417
424
  t(e), r(o.map((e) => {
418
425
  let t = a[e.skillIndex];
419
426
  return {
@@ -447,18 +454,18 @@ var B = {
447
454
  p,
448
455
  m
449
456
  ]);
450
- }, pe = (e) => ({
457
+ }, he = (e) => ({
451
458
  id: e.url,
452
459
  name: e.name,
453
460
  description: e.description
454
- }), me = (e) => {
461
+ }), ge = (e) => {
455
462
  let t = e.split("/").filter((e) => e.length > 0);
456
463
  return t[t.length - 1] ?? e;
457
- }, he = (e) => {
464
+ }, _e = (e) => {
458
465
  let t = e.split("/").filter((e) => e.length > 0);
459
466
  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(() => [
467
+ }, 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 }) => {
468
+ 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, A] = k(!1), [j, M] = k(null), [ne, N] = k(0), F = O(null), [I, L] = k(0), [R, z] = k(void 0), B = me(), V = D(() => [
462
469
  ...t,
463
470
  ...n ?? [],
464
471
  ...r ?? []
@@ -466,11 +473,11 @@ var B = {
466
473
  t,
467
474
  n,
468
475
  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) => ({
476
+ ]), 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) => ({
470
477
  start: t.start,
471
478
  length: t.length,
472
479
  isUnsupported: !e,
473
- render: () => /* @__PURE__ */ F(U, {
480
+ render: () => /* @__PURE__ */ P(W, {
474
481
  name: t.name,
475
482
  path: t.url,
476
483
  labelClassName: d,
@@ -479,8 +486,8 @@ var B = {
479
486
  detailsTrigger: f,
480
487
  onViewDetails: M,
481
488
  labels: {
482
- viewDetailsLabel: T?.viewDetailsLabel,
483
- unsupportedTooltipLabel: w
489
+ viewDetailsLabel: E?.viewDetailsLabel,
490
+ unsupportedTooltipLabel: T
484
491
  }
485
492
  })
486
493
  })), [
@@ -489,16 +496,16 @@ var B = {
489
496
  H,
490
497
  d,
491
498
  f,
492
- T,
493
- w
494
- ]), q = C((e, t, n) => {
499
+ E,
500
+ T
501
+ ]), K = w((e, t, n) => {
495
502
  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);
503
+ L((e) => e + 1), z(n + 1 + t.length + +!!r);
504
+ }, [B]), J = w((e) => {
505
+ let t = fe(B.draft, e, ye);
499
506
  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);
507
+ }, [B]), Y = w((e) => {
508
+ let t = fe(B.draft, e, ye);
502
509
  if (t == null) return;
503
510
  let n = B.anchors.find((e) => e.start === t.start && e.start + e.length === t.end);
504
511
  return {
@@ -506,49 +513,52 @@ var B = {
506
513
  text: B.draft.slice(t.start, t.end),
507
514
  mentionUrl: n?.url
508
515
  };
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) : []);
516
+ }, [B]), X = w(() => {
517
+ B.reset(), L((e) => e + 1), z(void 0);
518
+ }, [B]), { expectInsertion: Z } = B, Q = w((t) => {
519
+ Z(t, e ? ce(t, V) : []);
513
520
  }, [
514
- Q,
521
+ Z,
515
522
  e,
516
523
  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) => {
524
+ ]), oe = w((e, t) => {
525
+ B.seedFromMessage(e, t, U), L((e) => e + 1), z(void 0);
526
+ }, [B, U]), le = w((e, t) => {
520
527
  if (t == null || t.length === 0) return null;
521
- let n = ie(e, t, W), r = [], i = 0;
528
+ let n = se(e, t, U), r = [], i = 0;
522
529
  return n.forEach((n) => {
523
530
  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;
531
+ 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;
532
+ r.push({
533
+ text: e.slice(n.start, n.start + n.length),
534
+ node: /* @__PURE__ */ P(W, {
535
+ name: c,
536
+ path: a.url,
537
+ labelClassName: u,
538
+ description: s?.description,
539
+ unresolvedReason: l,
540
+ detailsTrigger: p,
541
+ onViewDetails: M,
542
+ labels: {
543
+ viewDetailsLabel: E?.viewDetailsLabel,
544
+ deletedTooltipLabel: x,
545
+ notSharedTooltipLabel: S
546
+ }
547
+ }, `${a.url}-${n.start}`)
548
+ }), i = n.start + n.length;
539
549
  }), i < e.length && r.push(e.slice(i)), r;
540
550
  }, [
541
- W,
551
+ U,
542
552
  H,
543
553
  u,
544
554
  p,
545
- T,
555
+ E,
546
556
  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, {
557
+ x,
558
+ S
559
+ ]), ue = w((e) => e == null || e.length === 0 ? null : e.map((e) => {
560
+ let t = H.get(e.url), n = t?.name ?? ge(e.url), r = t == null ? ve(e.url, o) : void 0;
561
+ return /* @__PURE__ */ P(W, {
552
562
  name: n,
553
563
  path: e.url,
554
564
  labelClassName: u,
@@ -557,162 +567,166 @@ var B = {
557
567
  detailsTrigger: p,
558
568
  onViewDetails: M,
559
569
  labels: {
560
- viewDetailsLabel: T?.viewDetailsLabel,
561
- deletedTooltipLabel: b,
562
- notSharedTooltipLabel: x
570
+ viewDetailsLabel: E?.viewDetailsLabel,
571
+ deletedTooltipLabel: x,
572
+ notSharedTooltipLabel: S
563
573
  }
564
574
  }, e.url);
565
575
  }), [
566
576
  H,
567
577
  u,
568
578
  p,
569
- T,
579
+ E,
570
580
  o,
571
- b,
572
- x
573
- ]), le = C((e, t) => /* @__PURE__ */ F(K, {
581
+ x,
582
+ S
583
+ ]), $ = w((e, t) => /* @__PURE__ */ P(q, {
574
584
  favorites: G,
575
585
  isMenu: !0,
576
586
  onSelect: (n) => {
577
- q(n.id, n.name, J(t)), e();
587
+ K(n.id, n.name, J(t)), e();
578
588
  },
579
589
  onToggleFavorite: s,
580
590
  onBrowse: () => {
581
- let n = X(t);
582
- P(J(t)), I.current = n ?? null, e(), A(!0);
591
+ let n = Y(t), r = J(t);
592
+ N(r), F.current = n ?? null, e(), A(!0);
583
593
  },
584
594
  onViewDetails: (n) => {
585
595
  J(t), e(), M(n.id);
586
596
  },
587
- labels: T
597
+ isRowTooltipHidden: m,
598
+ labels: E
588
599
  }), [
589
600
  G,
590
- q,
601
+ K,
591
602
  J,
592
- X,
603
+ Y,
593
604
  s,
594
- T
595
- ]);
605
+ m,
606
+ E
607
+ ]), de = D(() => e ? {
608
+ key: "skills",
609
+ title: _,
610
+ icon: /* @__PURE__ */ P(te, {
611
+ size: i,
612
+ "aria-hidden": !0,
613
+ stroke: l
614
+ }),
615
+ renderOverlay: $,
616
+ backLabel: v
617
+ } : void 0, [
618
+ e,
619
+ _,
620
+ v,
621
+ $
622
+ ]), pe = 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__ */ P(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
+ }), N(t), F.current = {
642
+ position: t,
643
+ text: r,
644
+ mentionUrl: i?.url
645
+ }, A(!0);
646
+ },
647
+ onViewDetails: (e) => {
648
+ n({ consumeQuery: !0 }), M(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
+ ]), _e = w(() => {
665
+ A(!1);
666
+ let e = F.current;
667
+ if (F.current = null, e == null) return;
668
+ let { position: t, text: n, mentionUrl: r } = e;
669
+ r == null ? B.onDraftChange(B.draft.slice(0, t) + n + B.draft.slice(t)) : B.restoreMention(r, n.slice(1), t), L((e) => e + 1), z(t + n.length);
670
+ }, [B]);
596
671
  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]),
672
+ skillMenuOverlay: de,
673
+ commandMenu: pe,
674
+ skillCatalogModal: /* @__PURE__ */ P(ae, {
675
+ isOpen: ee,
676
+ onClose: _e,
663
677
  onSelect: (e) => {
664
- I.current = null, q(e, W(e), N), A(!1);
678
+ F.current = null, K(e, U(e), ne), A(!1);
665
679
  },
666
- title: v,
667
- renderContent: m
680
+ title: y,
681
+ renderContent: h
668
682
  }),
669
- skillDetailsPanel: /* @__PURE__ */ F(S, {
683
+ skillDetailsPanel: /* @__PURE__ */ P(C, {
670
684
  fallback: null,
671
- children: /* @__PURE__ */ F(h, {
685
+ children: /* @__PURE__ */ P(g, {
672
686
  skillId: j,
673
687
  onClose: () => M(null)
674
688
  })
675
689
  }),
676
690
  message: B.draft,
677
- messageRevision: L,
678
- activeMentions: re,
691
+ messageRevision: I,
692
+ activeMentions: ie,
679
693
  onDraftChange: B.onDraftChange,
680
694
  onBackspaceAtCaret: B.onBackspaceAtCaret,
681
- caretPositionOverride: te,
682
- isSkillUnsupported: ne,
695
+ caretPositionOverride: R,
696
+ isSkillUnsupported: re,
683
697
  selectedSkills: B.orderedSkills,
684
- resetSkillMentions: Z,
698
+ resetSkillMentions: X,
685
699
  seedSkillMentions: oe,
686
- recognizeMentionsInInsertion: $,
687
- renderHistorySkillSegments: se,
688
- renderHistorySkills: ce
700
+ recognizeMentionsInInsertion: Q,
701
+ renderHistorySkillSegments: le,
702
+ renderHistorySkills: ue
689
703
  };
690
- }, ye = {
704
+ }, xe = {
691
705
  background: "_background_1ult0_1",
692
706
  border: "_border_1ult0_5",
693
707
  value: "_value_1ult0_9",
694
708
  clear: "_clear_1ult0_13",
695
709
  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, {
710
+ }, 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 }) => {
711
+ 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, te = i.length > 0 ? f.unsupportedTooltipLabel : void 0, A = !l && i.length === 0, j = A ? f.unavailableHintLabel ?? Ce : void 0, M = new Map(i.map((e) => [e, {
698
712
  id: e,
699
713
  name: o?.[e] || e
700
714
  }]));
701
- s.forEach((e) => N.set(e.id, e));
702
- let P = [...N.values()].map((t) => ({
715
+ s.forEach((e) => M.set(e.id, e));
716
+ let ne = [...M.values()].map((t) => ({
703
717
  value: t.id,
704
718
  label: t.name,
705
- labelNode: y.trim() ? /* @__PURE__ */ F(f, {
719
+ labelNode: y.trim() ? /* @__PURE__ */ P(p, {
706
720
  text: t.name,
707
721
  query: y,
708
722
  maxLines: 1
709
723
  }) : void 0,
710
- icon: /* @__PURE__ */ F(e, {
724
+ icon: /* @__PURE__ */ P(e, {
711
725
  size: c.SM,
712
726
  initialsName: t.name
713
727
  }),
714
728
  disabled: !l
715
- })), L = {
729
+ })), N = {
716
730
  ...t({
717
731
  "--ssf-text": h?.colors?.text,
718
732
  "--ssf-bg": h?.colors?.background,
@@ -721,57 +735,56 @@ var B = {
721
735
  }),
722
736
  ...h?.cssVars
723
737
  };
724
- return E(() => {
738
+ return ee(() => {
725
739
  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"));
740
+ e && (j ? e.setAttribute("aria-describedby", C) : e.removeAttribute("aria-describedby"), d || w ? e.setAttribute("aria-invalid", "true") : e.removeAttribute("aria-invalid"));
727
741
  }, [
728
- M,
742
+ j,
729
743
  C,
730
744
  d,
731
745
  u,
732
746
  w
733
- ]), /* @__PURE__ */ I("div", {
747
+ ]), /* @__PURE__ */ F("div", {
734
748
  ref: S,
735
749
  className: r("min-w-0", m, B.selectorField),
736
- style: L,
737
- children: [/* @__PURE__ */ F(b, {
738
- tooltip: A,
750
+ style: N,
751
+ children: [/* @__PURE__ */ P(x, {
752
+ tooltip: te,
739
753
  hideTooltip: l,
740
754
  triggerClassName: "block w-full min-w-0",
741
- children: /* @__PURE__ */ F("div", {
755
+ children: /* @__PURE__ */ P("div", {
742
756
  inert: u ? !0 : void 0,
743
- children: /* @__PURE__ */ F(_, {
757
+ children: /* @__PURE__ */ P(v, {
744
758
  multiple: !0,
745
759
  searchable: !0,
746
- open: ee,
760
+ open: D,
747
761
  onOpenChange: (e) => {
748
- e && !D || v(e);
762
+ (!e || T) && _(e);
749
763
  },
750
- onSearchQueryChange: x,
764
+ onSearchQueryChange: b,
751
765
  value: i,
752
766
  onChange: (e) => {
753
767
  u || a(Array.isArray(e) ? e : [e]);
754
768
  },
755
- options: P,
756
- placeholder: p.placeholder,
757
- labelProps: { label: p.fieldLabel },
769
+ options: ne,
770
+ placeholder: f.placeholder,
771
+ labelProps: { label: f.fieldLabel },
758
772
  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,
773
+ searchPlaceholder: f.searchPlaceholder ?? "Search skills",
774
+ emptyStateTitle: y.trim() ? f.noMatchingSkillsLabel ?? "No matching skills" : f.emptyLabel ?? "No skills available",
775
+ disabled: u || A,
763
776
  invalid: !!d || w,
764
777
  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),
778
+ fieldClassName: r(T ? "cursor-pointer" : "cursor-not-allowed", "--ssf-bg" in N && xe.background, "--ssf-border" in N && xe.border, "--ssf-text" in N && xe.value, (d || w) && xe.invalid, h?.typography?.fontClassName ?? "dial-small-text", h?.triggerClassName),
766
779
  listClassName: "w-[min(var(--reference-width),calc(100vw-2rem))] max-w-full"
767
780
  })
768
781
  })
769
- }), M && /* @__PURE__ */ F("span", {
782
+ }), j && /* @__PURE__ */ P("span", {
770
783
  id: C,
771
784
  className: "sr-only",
772
- children: M
785
+ children: j
773
786
  })]
774
787
  });
775
788
  };
776
789
  //#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 };
790
+ 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 };