@epam/ai-dial-skill-editor 1.2.0-dev.3 → 1.2.0-dev.300

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,129 +1,647 @@
1
- import { MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as e, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as t, buildCssVars as n, formatFileSize as r, mergeClasses as i, useAvailableHeightCap as a } from "@epam/ai-dial-chat-shared";
2
- import { Accordion as o, CaptionText as s, DIAL_ICON_SIZE as c, DIAL_KIT_ICON_STROKE as l, EditorThemes as u, ErrorText as d, FileDropzone as f, GhostButton as ee, GhostIconButton as te, Input as p, NeutralButton as m, Popup as ne, PopupSize as re, PrimaryButton as ie, Spinner as h, Textarea as g } from "@epam/ai-dial-ui-kit";
3
- import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
4
- import { IconArrowNarrowLeft as b, IconFileText as ae, IconPlus as oe, IconTrashX as se, IconUpload as x } from "@tabler/icons-react";
5
- import { Suspense as S, lazy as C, useCallback as w, useEffect as T, useId as E, useMemo as D, useRef as O, useState as k } from "react";
6
- import { DialFileNodeType as A, DialFoldersTree as ce } from "@epam/ai-dial-react-file-manager";
7
- import { LazyMarkdownEditor as j } from "@epam/ai-dial-ui-kit/editors";
8
- var M = {
1
+ import { MARKDOWN_EDITOR_FILL_HEIGHT_CLASS_NAME as e, MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as t, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as n, RESIZABLE_TEXTAREA_CLASS_NAME as r, TAG_INPUT_TAG_CLASS_NAME as i, TextRefinementField as a, buildCssVars as o, formatFileSize as s, mergeClasses as c, useAvailableHeightCap as l, useTextRefinement as u } from "@epam/ai-dial-chat-shared";
2
+ import { Accordion as d, ButtonAppearance as f, ButtonDropdown as p, ButtonVariant as m, CaptionText as h, DIAL_ICON_SIZE as g, DIAL_KIT_ICON_STROKE as _, DangerIconButton as v, EditorThemes as y, ElementSize as b, ErrorText as x, FileDropzone as S, GhostButton as C, GhostIconButton as w, Input as T, Label as E, LinkButton as D, NeutralButton as O, Popup as k, PopupSize as ee, PrimaryButton as A, Select as te, Spinner as ne, TagInput as j, Textarea as M, TextareaResize as N } from "@epam/ai-dial-ui-kit";
3
+ import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
4
+ import { IconArrowNarrowLeft as L, IconDatabase as re, IconFileText as ie, IconFileZip as ae, IconFolderPlus as oe, IconPhoto as se, IconPlus as ce, IconTrashX as le, IconUpload as ue } from "@tabler/icons-react";
5
+ import { Suspense as de, lazy as R, memo as fe, useCallback as z, useEffect as pe, useId as me, useMemo as B, useRef as V, useState as H } from "react";
6
+ import { DialFileNodeType as he, DialFoldersTree as ge } from "@epam/ai-dial-react-file-manager";
7
+ import { LazyMarkdownEditor as _e } from "@epam/ai-dial-ui-kit/editors";
8
+ c("flex flex-col desktop:min-h-0 desktop:overflow-y-auto", {
9
+ body: "_body_1xd7h_2",
10
+ sideColumn: "_sideColumn_1xd7h_6",
11
+ reservedColumn: "_reservedColumn_1xd7h_10"
12
+ }.sideColumn);
13
+ //#endregion
14
+ //#region ../builder-form/src/constants/public-class-names.ts
15
+ var ve = {
16
+ layout: "dial-builder-form-layout",
17
+ section: "dial-builder-form-section",
18
+ metadataSection: "dial-builder-form-metadata-section",
19
+ setupSection: "dial-builder-form-setup-section"
20
+ }, ye = {
21
+ section: "_section_l1mnx_1",
22
+ title: "_title_l1mnx_5"
23
+ }, be = ({ title: e, children: t, styles: n, className: r }) => {
24
+ let i = o({
25
+ "--es-border-color": n?.colors?.borderColor,
26
+ "--es-title-color": n?.colors?.titleColor
27
+ });
28
+ return /* @__PURE__ */ I("section", {
29
+ className: c("flex h-full flex-col gap-4 rounded border p-6", ye.section, r, ve.section),
30
+ style: i,
31
+ children: [e != null && /* @__PURE__ */ F("h2", {
32
+ className: c("dial-h3-text", ye.title),
33
+ children: e
34
+ }), t]
35
+ });
36
+ }, xe = {
9
37
  headerBorder: "_headerBorder_1kidu_1",
10
38
  footerBorder: "_footerBorder_1kidu_5",
11
39
  sidebarBorder: "_sidebarBorder_1kidu_9"
12
- }, N = ({ title: e, onBack: t, backAriaLabel: r = "Back", actions: a, leftContent: o, rightContent: s, isSaving: u = !1, labels: d, styles: f, dir: ee }) => {
13
- let p = E(), m = u ? d?.savingStatusLabel ?? "Saving" : "";
14
- return /* @__PURE__ */ y("div", {
15
- dir: ee,
16
- className: "flex min-h-0 flex-1 flex-col",
17
- style: n({
18
- "--el-header-border-color": f?.colors?.headerBorderColor,
19
- "--el-sidebar-border-color": f?.colors?.sidebarBorderColor
20
- }),
40
+ }, Se = ({ title: e, onBack: t, backAriaLabel: n = "Back", actions: r, leftContent: i, rightContent: a, isSaving: s = !1, labels: l, styles: u, dir: d }) => {
41
+ let f = me(), p = s ? l?.savingStatusLabel ?? "Saving" : "", m = o({
42
+ "--el-header-border-color": u?.colors?.headerBorderColor,
43
+ "--el-sidebar-border-color": u?.colors?.sidebarBorderColor
44
+ });
45
+ return /* @__PURE__ */ I("div", {
46
+ dir: d,
47
+ className: c("flex min-h-0 flex-1 flex-col", ve.layout),
48
+ style: m,
21
49
  children: [
22
- /* @__PURE__ */ v("span", {
50
+ /* @__PURE__ */ F("span", {
23
51
  role: "status",
24
52
  "aria-live": "polite",
25
53
  className: "sr-only",
26
- id: p,
27
- children: m
54
+ id: f,
55
+ children: p
28
56
  }),
29
- /* @__PURE__ */ y("div", {
30
- className: i("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", M.headerBorder),
31
- children: [/* @__PURE__ */ y("div", {
57
+ /* @__PURE__ */ I("div", {
58
+ className: c("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", xe.headerBorder),
59
+ children: [/* @__PURE__ */ I("div", {
32
60
  className: "flex min-w-0 flex-1 items-center gap-2",
33
- children: [/* @__PURE__ */ v(te, {
34
- icon: /* @__PURE__ */ v(b, {
35
- size: c.LG,
36
- stroke: l,
61
+ children: [/* @__PURE__ */ F(w, {
62
+ icon: /* @__PURE__ */ F(L, {
63
+ size: g.LG,
64
+ stroke: _,
37
65
  "aria-hidden": !0,
38
66
  className: "rtl:scale-x-[-1]"
39
67
  }),
40
- "aria-label": r,
68
+ "aria-label": n,
41
69
  onClick: t
42
- }), /* @__PURE__ */ v("h1", {
70
+ }), /* @__PURE__ */ F("h1", {
43
71
  className: "dial-h2-text min-w-0 truncate",
44
72
  children: e
45
73
  })]
46
- }), a != null && /* @__PURE__ */ v("div", {
74
+ }), r != null && /* @__PURE__ */ F("div", {
47
75
  className: "hidden shrink-0 items-center gap-2 desktop:flex",
48
- children: a
76
+ children: r
49
77
  })]
50
78
  }),
51
- /* @__PURE__ */ y("div", {
79
+ /* @__PURE__ */ I("div", {
52
80
  className: "flex flex-1 flex-col overflow-y-auto desktop:flex-row desktop:overflow-hidden",
53
- children: [/* @__PURE__ */ v("div", {
54
- className: i(s == null ? "desktop:flex-1" : "desktop:w-[360px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", "desktop:overflow-y-auto", s == null ? void 0 : M.sidebarBorder),
55
- children: o
56
- }), s != null && /* @__PURE__ */ v("div", {
57
- className: "desktop:flex-1 desktop:overflow-y-auto",
58
- children: s
81
+ children: [/* @__PURE__ */ F("div", {
82
+ className: c(a == null ? "desktop:flex-1" : "desktop:w-[400px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", "desktop:overflow-y-auto", a == null ? void 0 : xe.sidebarBorder),
83
+ children: i
84
+ }), a != null && /* @__PURE__ */ F("div", {
85
+ className: "desktop:flex desktop:min-h-0 desktop:flex-1 desktop:flex-col desktop:overflow-y-auto",
86
+ children: a
59
87
  })]
60
88
  }),
61
- a != null && /* @__PURE__ */ v("div", {
62
- className: i("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", M.footerBorder),
63
- children: a
89
+ r != null && /* @__PURE__ */ F("div", {
90
+ className: c("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", xe.footerBorder),
91
+ children: r
64
92
  })
65
93
  ]
66
94
  });
67
- }, P = (e) => !!e.dataTransfer?.types.includes("Files"), le = (e) => {
68
- let [t, n] = k(!1), r = O(0);
69
- return {
70
- isDragActive: t,
71
- dropZoneHandlers: {
72
- onDragEnter: w((e) => {
73
- P(e) && (e.preventDefault(), r.current += 1, n(!0));
74
- }, []),
75
- onDragLeave: w((e) => {
76
- P(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
77
- }, []),
78
- onDragOver: w((e) => {
79
- P(e) && e.preventDefault();
80
- }, []),
81
- onDrop: w((t) => {
82
- if (!P(t)) return;
83
- t.preventDefault(), r.current = 0, n(!1);
84
- let i = Array.from(t.dataTransfer?.files ?? []);
85
- i.length > 0 && e(i);
86
- }, [e])
95
+ }, Ce = {
96
+ box: "_box_c9as8_1",
97
+ icon: "_icon_c9as8_6",
98
+ caption: "_caption_c9as8_10"
99
+ }, we = ({ label: e, avatarUrl: t, avatarAlt: n = "", addAvatarLabel: r = "Add avatar", captionText: i = "PNG, JPG or SVG (max 1 MB)", onAddAvatarClick: a, styles: s, className: l }) => {
100
+ let u = o({
101
+ "--aa-box-bg": s?.colors?.boxBackgroundColor,
102
+ "--aa-box-border": s?.colors?.boxBorderColor,
103
+ "--aa-icon": s?.colors?.placeholderIconColor,
104
+ "--aa-caption": s?.colors?.captionColor
105
+ });
106
+ return /* @__PURE__ */ I("div", {
107
+ className: c("flex flex-col gap-2", l),
108
+ style: u,
109
+ children: [/* @__PURE__ */ F(E, { label: e }), /* @__PURE__ */ I("div", {
110
+ className: "flex items-start gap-3",
111
+ children: [/* @__PURE__ */ F("div", {
112
+ className: c("flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border", Ce.box),
113
+ children: t ? /* @__PURE__ */ F("img", {
114
+ src: t,
115
+ alt: n,
116
+ className: "h-16 w-16 object-cover"
117
+ }) : /* @__PURE__ */ F(se, {
118
+ size: g.LG,
119
+ stroke: _,
120
+ "aria-hidden": !0,
121
+ className: Ce.icon
122
+ })
123
+ }), /* @__PURE__ */ I("div", {
124
+ className: "flex flex-col gap-3",
125
+ children: [/* @__PURE__ */ F(C, {
126
+ size: b.Small,
127
+ iconBefore: /* @__PURE__ */ F(ce, {
128
+ size: g.SM,
129
+ stroke: _,
130
+ "aria-hidden": !0
131
+ }),
132
+ className: "w-fit",
133
+ label: r,
134
+ onClick: a
135
+ }), /* @__PURE__ */ F("span", {
136
+ className: c("dial-tiny-text", Ce.caption),
137
+ children: i
138
+ })]
139
+ })]
140
+ })]
141
+ });
142
+ }, Te = ({ isOpen: e, onClose: t, onAttach: n, bucket: r, FileManagerModal: i, allowedMimeTypes: a, maxFileSizeBytes: o, labels: s }) => {
143
+ let c = z((e) => e.length === 1 ? s.deleteConfirmTitleSingle : s.deleteConfirmTitleMultiple, [s.deleteConfirmTitleSingle, s.deleteConfirmTitleMultiple]), l = z((e) => /* @__PURE__ */ F("div", {
144
+ className: "dial-small-text px-6 py-3",
145
+ children: /* @__PURE__ */ F("p", {
146
+ className: "mb-3 text-secondary",
147
+ children: e.length === 1 ? /* @__PURE__ */ I(P, { children: [
148
+ s.deleteConfirmSingleText,
149
+ " ",
150
+ /* @__PURE__ */ I("span", {
151
+ className: "break-words text-primary",
152
+ children: [
153
+ "\"",
154
+ e[0].split("/").pop(),
155
+ "\"?"
156
+ ]
157
+ })
158
+ ] }) : /* @__PURE__ */ I(P, { children: [
159
+ s.deleteConfirmMultipleText,
160
+ " ",
161
+ /* @__PURE__ */ I("span", {
162
+ className: "text-primary",
163
+ children: [
164
+ e.length,
165
+ " ",
166
+ s.deleteConfirmItemsLabel
167
+ ]
168
+ })
169
+ ] })
170
+ })
171
+ }), [
172
+ s.deleteConfirmSingleText,
173
+ s.deleteConfirmMultipleText,
174
+ s.deleteConfirmItemsLabel
175
+ ]);
176
+ return /* @__PURE__ */ F(de, {
177
+ fallback: null,
178
+ children: e && /* @__PURE__ */ F(i, {
179
+ isOpen: e,
180
+ onClose: t,
181
+ onAttach: n,
182
+ bucket: r,
183
+ allowedTypes: a,
184
+ maxSelectableFileSize: o,
185
+ maximumAttachmentsAmount: 1,
186
+ canAttachFolders: !1,
187
+ title: s.title,
188
+ attachLabel: s.attachLabel,
189
+ emptyTitle: s.emptyTitle,
190
+ emptyDescription: s.emptyDescription,
191
+ errorMessage: s.errorMessage,
192
+ retryLabel: s.retryLabel,
193
+ hiddenFilesLabel: s.hiddenFilesLabel,
194
+ showHiddenFilesLabel: s.showHiddenFilesLabel,
195
+ hideHiddenFilesLabel: s.hideHiddenFilesLabel,
196
+ getSelectionLabel: s.getSelectionLabel,
197
+ uploadFilesLabel: s.uploadFilesLabel,
198
+ newFolderLabel: s.newFolderLabel,
199
+ downloadLabel: s.downloadLabel,
200
+ downloadingLabel: s.downloadingLabel,
201
+ deleteLabel: s.deleteLabel,
202
+ deletingLabel: s.deletingLabel,
203
+ deleteConfirmTitle: c,
204
+ deleteConfirmBody: l,
205
+ deleteConfirmLabel: s.deleteConfirmLabel,
206
+ deleteCancelLabel: s.deleteCancelLabel
207
+ })
208
+ });
209
+ }, U = /* @__PURE__ */ function(e) {
210
+ return e.Avatar = "avatar", e.Name = "name", e.Version = "version", e.Description = "description", e.Locales = "locales", e.Tags = "tags", e;
211
+ }({}), Ee = [
212
+ "avatar",
213
+ "name",
214
+ "version",
215
+ "description",
216
+ "locales",
217
+ "tags"
218
+ ], W = (e, t, n) => ({
219
+ id: e,
220
+ language: n.find((e) => !t.has(e.code))?.code ?? "",
221
+ name: "",
222
+ description: ""
223
+ }), De = ({ value: e, onChange: t, availableLocaleOptions: n = [], labels: i, className: a, summaryClassName: o = "dial-body-text text-secondary", rowLabelClassName: s = "dial-tiny-lead-text text-secondary" }) => {
224
+ let { summaryLabel: l, addLabel: u, editLabel: d, popupTitle: p, addLocaleLabel: h, localeRowLabel: y = "Locale", languageLabel: x, nameLabel: S, namePlaceholder: C, descriptionLabel: w, descriptionPlaceholder: E, deleteAriaLabel: O, cancelLabel: ee = "Cancel", saveLabel: A = "Save" } = i, [ne, j] = H(!1), [P, L] = H([]), re = V(0);
225
+ pe(() => {
226
+ ne && L(e.length > 0 ? e : [W(`locale-row-${++re.current}`, /* @__PURE__ */ new Set(), n)]);
227
+ }, [
228
+ ne,
229
+ e,
230
+ n
231
+ ]);
232
+ let ie = () => j(!0), ae = () => j(!1), oe = () => {
233
+ t(P.filter((e) => e.language && e.name)), j(!1);
234
+ }, se = () => {
235
+ let e = new Set(P.map((e) => e.language).filter(Boolean));
236
+ L((t) => [...t, W(`locale-row-${++re.current}`, e, n)]);
237
+ }, ue = (e, t) => {
238
+ L((n) => n.map((n) => n.id === e ? {
239
+ ...n,
240
+ ...t
241
+ } : n));
242
+ }, de = (e) => {
243
+ L((t) => t.filter((t) => t.id !== e));
244
+ }, R = (e) => n.find((t) => t.code === e)?.label ?? e.toUpperCase(), fe = P.some((e) => !e.language || !e.name);
245
+ return n.length === 0 ? null : /* @__PURE__ */ I("div", {
246
+ className: c("flex items-center gap-2", a),
247
+ children: [
248
+ e.length > 0 && /* @__PURE__ */ F("span", {
249
+ className: o,
250
+ children: `${l}: ${e.map((e) => `[${R(e.language)}]`).join(", ")}`
251
+ }),
252
+ /* @__PURE__ */ F(D, {
253
+ label: e.length > 0 ? d : u,
254
+ iconBefore: /* @__PURE__ */ F(ce, {
255
+ size: g.SM,
256
+ "aria-hidden": !0,
257
+ stroke: _
258
+ }),
259
+ className: "!px-0",
260
+ onClick: ie
261
+ }),
262
+ /* @__PURE__ */ F(k, {
263
+ open: ne,
264
+ header: p,
265
+ onClose: ae,
266
+ mainButtons: [{
267
+ label: ee,
268
+ onClick: ae
269
+ }, {
270
+ label: A,
271
+ variant: m.Primary,
272
+ disabled: fe,
273
+ onClick: oe
274
+ }],
275
+ children: /* @__PURE__ */ I("div", {
276
+ className: "flex flex-col gap-8 px-6 py-3",
277
+ children: [P.map((e, t) => {
278
+ let i = new Set(P.filter((t) => t.id !== e.id).map((e) => e.language).filter(Boolean));
279
+ return /* @__PURE__ */ I("div", {
280
+ className: "flex flex-col gap-2",
281
+ children: [/* @__PURE__ */ I("div", {
282
+ className: "flex items-center justify-between",
283
+ children: [/* @__PURE__ */ I("span", {
284
+ className: s,
285
+ children: [
286
+ y,
287
+ " ",
288
+ t + 1
289
+ ]
290
+ }), /* @__PURE__ */ F(v, {
291
+ appearance: f.Ghost,
292
+ size: b.Small,
293
+ icon: /* @__PURE__ */ F(le, {
294
+ size: g.SM,
295
+ "aria-hidden": !0,
296
+ stroke: _
297
+ }),
298
+ "aria-label": `${O} ${t + 1}`,
299
+ onClick: () => de(e.id)
300
+ })]
301
+ }), /* @__PURE__ */ I("div", {
302
+ role: "group",
303
+ "aria-label": `${y} ${t + 1}`,
304
+ className: "flex flex-col gap-5",
305
+ children: [/* @__PURE__ */ I("div", {
306
+ className: "flex flex-col gap-5 desktop:flex-row desktop:items-start",
307
+ children: [/* @__PURE__ */ F(te, {
308
+ id: `${e.id}-language`,
309
+ labelProps: {
310
+ label: x,
311
+ required: !0
312
+ },
313
+ className: "desktop:shrink-0 desktop:basis-40",
314
+ options: n.map((e) => ({
315
+ value: e.code,
316
+ label: e.label,
317
+ disabled: i.has(e.code)
318
+ })),
319
+ value: e.language,
320
+ onChange: (t) => ue(e.id, { language: t })
321
+ }), /* @__PURE__ */ F(T, {
322
+ id: `${e.id}-name`,
323
+ containerClassName: "min-w-0 flex-1",
324
+ required: !0,
325
+ value: e.name,
326
+ onChange: (t) => ue(e.id, { name: t ?? "" }),
327
+ labelProps: {
328
+ label: S,
329
+ required: !0
330
+ },
331
+ placeholder: C
332
+ })]
333
+ }), /* @__PURE__ */ F(M, {
334
+ id: `${e.id}-description`,
335
+ className: r,
336
+ resize: N.Vertical,
337
+ value: e.description,
338
+ onChange: (t) => ue(e.id, { description: t }),
339
+ labelProps: { label: w },
340
+ placeholder: E
341
+ })]
342
+ })]
343
+ }, e.id);
344
+ }), /* @__PURE__ */ F(D, {
345
+ label: h,
346
+ iconBefore: /* @__PURE__ */ F(ce, {
347
+ size: g.SM,
348
+ "aria-hidden": !0,
349
+ stroke: _
350
+ }),
351
+ className: "self-start",
352
+ onClick: se,
353
+ disabled: P.length >= n.length
354
+ })]
355
+ })
356
+ })
357
+ ]
358
+ });
359
+ }, Oe = "Add tags, comma separated", G = "deployment-creation-form-description", ke = ({ values: e, errors: t, onChange: n, onNameBlur: a, onVersionBlur: o, iconPreviewUrl: s, onAddAvatarClick: l, labels: u, styles: d, availableLocaleOptions: f = [], fields: p = Ee, isNameReadOnly: m = !1, nameCaption: h, isDescriptionRequired: g = !1, renderDescription: _, focusRequestKey: v }) => {
360
+ let y = V(null), b = V(null), x = V(null), S = V(!1), C = (e) => p.includes(e), w = C(U.Name), E = C(U.Version), D = !!(t.name || t.version || t.description), O = V(v);
361
+ pe(() => {
362
+ let e = () => {
363
+ t.name ? y.current?.focus() : t.version ? b.current?.focus() : t.description && x.current?.focus();
364
+ };
365
+ if (v !== void 0) {
366
+ v !== O.current && (O.current = v, e());
367
+ return;
87
368
  }
88
- };
89
- }, F = "SKILL.md", I = /* @__PURE__ */ function(e) {
369
+ D && !S.current && e(), S.current = D;
370
+ }, [
371
+ v,
372
+ D,
373
+ t.name,
374
+ t.version,
375
+ t.description
376
+ ]);
377
+ let k = /* @__PURE__ */ F(M, {
378
+ id: G,
379
+ ref: x,
380
+ value: e.description,
381
+ onChange: (e) => n({ description: e }),
382
+ "aria-required": g || void 0,
383
+ labelProps: _ ? void 0 : {
384
+ label: u.description.label,
385
+ required: g
386
+ },
387
+ placeholder: u.description.placeholder,
388
+ error: t.description || void 0,
389
+ invalid: !!t.description,
390
+ containerClassName: _ ? void 0 : d?.field,
391
+ className: r,
392
+ resize: N.Vertical
393
+ });
394
+ return /* @__PURE__ */ I("div", {
395
+ role: u.ariaLabel ? "group" : void 0,
396
+ "aria-label": u.ariaLabel,
397
+ className: c("flex flex-col gap-4", d?.root),
398
+ children: [
399
+ C(U.Avatar) && /* @__PURE__ */ F(we, {
400
+ label: u.iconUrl.label,
401
+ avatarUrl: s,
402
+ addAvatarLabel: u.iconUrl.addAvatarLabel,
403
+ captionText: u.iconUrl.captionText,
404
+ onAddAvatarClick: l,
405
+ className: d?.field
406
+ }),
407
+ (w || E) && /* @__PURE__ */ I("div", {
408
+ className: c("flex items-start gap-4", d?.field),
409
+ children: [w && /* @__PURE__ */ F(T, {
410
+ id: "deployment-creation-form-name",
411
+ inputRef: y,
412
+ value: e.name,
413
+ onChange: (e) => n({ name: e ?? "" }),
414
+ onBlur: a,
415
+ readOnly: m,
416
+ labelProps: {
417
+ label: u.name.label,
418
+ required: !0
419
+ },
420
+ placeholder: u.name.placeholder,
421
+ caption: h,
422
+ error: t.name || void 0,
423
+ invalid: !!t.name,
424
+ containerClassName: E ? "min-w-0 basis-0 grow-[2]" : "min-w-0 flex-1"
425
+ }), E && /* @__PURE__ */ F(T, {
426
+ id: "deployment-creation-form-version",
427
+ inputRef: b,
428
+ value: e.version,
429
+ onChange: (e) => n({ version: e ?? "" }),
430
+ onBlur: o,
431
+ labelProps: { label: u.version.label },
432
+ placeholder: u.version.placeholder,
433
+ error: t.version || void 0,
434
+ invalid: !!t.version,
435
+ containerClassName: w ? "min-w-0 basis-0 grow-[1]" : "min-w-0 flex-1"
436
+ })]
437
+ }),
438
+ C(U.Description) && (_ ? /* @__PURE__ */ F("div", {
439
+ className: d?.field,
440
+ children: _(k, G)
441
+ }) : k),
442
+ C(U.Locales) && /* @__PURE__ */ F(De, {
443
+ value: e.otherLocales,
444
+ onChange: (e) => n({ otherLocales: e }),
445
+ availableLocaleOptions: f,
446
+ labels: u.otherLocales,
447
+ className: d?.field
448
+ }),
449
+ C(U.Tags) && /* @__PURE__ */ F("div", {
450
+ className: d?.field,
451
+ children: /* @__PURE__ */ F(j, {
452
+ id: "deployment-creation-form-topics",
453
+ labelProps: { label: u.topics.label },
454
+ placeholder: u.topics.placeholder ?? Oe,
455
+ value: e.topics,
456
+ onChange: (e) => n({ topics: e }),
457
+ tagClassName: i
458
+ })
459
+ })
460
+ ]
461
+ });
462
+ }, Ae = "border-0 p-4 desktop:p-8", je = "desktop:flex-1", Me = "px-4 pt-4 desktop:px-6 desktop:pt-6", Ne = fe(({ title: e, onBack: t, onCancel: n, onSubmit: r, submitLabel: i, isSubmitting: a = !1, isSubmitDisabled: o = !1, extraActions: s, hideStandardActions: l = !1, metadata: u, metadataTitle: d, metadataFooter: f, setup: p, setupTitle: m, alert: h, metadataSectionClassName: g, setupSectionClassName: _, labels: v, styles: y, dir: b }) => {
463
+ let x = h == null ? null : /* @__PURE__ */ F("div", {
464
+ role: "alert",
465
+ className: Me,
466
+ children: h
467
+ }), S = p != null;
468
+ return /* @__PURE__ */ F(Se, {
469
+ title: e,
470
+ onBack: t,
471
+ backAriaLabel: v?.backAriaLabel ?? "Back",
472
+ isSaving: a,
473
+ labels: { savingStatusLabel: v?.savingStatusLabel ?? "Saving" },
474
+ styles: y?.layout,
475
+ dir: b,
476
+ actions: /* @__PURE__ */ I(P, { children: [s, !l && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(O, {
477
+ label: v?.cancelLabel ?? "Cancel",
478
+ disabled: a,
479
+ onClick: n
480
+ }), /* @__PURE__ */ F(A, {
481
+ label: i,
482
+ disabled: a || o,
483
+ onClick: r
484
+ })] })] }),
485
+ leftContent: /* @__PURE__ */ I(P, { children: [
486
+ !S && x,
487
+ /* @__PURE__ */ F(be, {
488
+ title: d === null ? void 0 : d ?? v?.metadataTitle ?? "Metadata",
489
+ styles: y?.section,
490
+ className: c(Ae, g, ve.metadataSection),
491
+ children: u
492
+ }),
493
+ f
494
+ ] }),
495
+ rightContent: S ? /* @__PURE__ */ I(P, { children: [x, /* @__PURE__ */ F(be, {
496
+ title: m === null ? void 0 : m ?? v?.setupTitle ?? "Setup",
497
+ styles: y?.section,
498
+ className: c(Ae, je, _, ve.setupSection),
499
+ children: p
500
+ })] }) : void 0
501
+ });
502
+ }), Pe = {
503
+ name: {
504
+ label: "Name",
505
+ placeholder: "Enter name"
506
+ },
507
+ description: {
508
+ label: "Description",
509
+ placeholder: "Enter description"
510
+ },
511
+ iconUrl: {
512
+ label: "Avatar",
513
+ addAvatarLabel: "Add avatar",
514
+ captionText: "PNG, JPG or SVG (max 1 MB)"
515
+ },
516
+ version: {
517
+ label: "Version",
518
+ placeholder: "e.g. 1.0.0"
519
+ },
520
+ topics: {
521
+ label: "Tags",
522
+ placeholder: "Add tags, comma separated"
523
+ },
524
+ otherLocales: {
525
+ summaryLabel: "Locales",
526
+ addLabel: "Add locales",
527
+ editLabel: "Edit locales",
528
+ popupTitle: "Add locale",
529
+ addLocaleLabel: "Add locale",
530
+ localeRowLabel: "Locale",
531
+ languageLabel: "Language",
532
+ nameLabel: "Name",
533
+ namePlaceholder: "Enter name",
534
+ descriptionLabel: "About",
535
+ descriptionPlaceholder: "Enter brief description",
536
+ deleteAriaLabel: "Delete locale",
537
+ cancelLabel: "Cancel",
538
+ saveLabel: "Save"
539
+ },
540
+ ariaLabel: "Metadata"
541
+ }, Fe = {
542
+ title: "Add avatar",
543
+ attachLabel: "Attach",
544
+ emptyTitle: "This folder is empty",
545
+ emptyDescription: "",
546
+ errorMessage: "Failed to load files",
547
+ retryLabel: "Retry",
548
+ hiddenFilesLabel: "Hidden files",
549
+ showHiddenFilesLabel: "Show hidden files",
550
+ hideHiddenFilesLabel: "Hide hidden files",
551
+ getSelectionLabel: (e) => e === 1 ? "item selected" : "items selected",
552
+ uploadFilesLabel: "Files",
553
+ newFolderLabel: "Folder",
554
+ downloadLabel: "Download",
555
+ downloadingLabel: "Preparing download…",
556
+ deleteLabel: "Delete",
557
+ deletingLabel: "Deleting…",
558
+ deleteConfirmTitleSingle: "Confirm deleting",
559
+ deleteConfirmTitleMultiple: "Confirm deleting items",
560
+ deleteConfirmSingleText: "Are you sure you want to delete",
561
+ deleteConfirmMultipleText: "Do you want to delete following",
562
+ deleteConfirmItemsLabel: "items?",
563
+ deleteConfirmLabel: "Delete",
564
+ deleteCancelLabel: "Cancel"
565
+ }, Ie = fe(({ values: e, errors: t, onChange: n, onNameBlur: r, onVersionBlur: i, avatarPicker: a, availableLocaleOptions: o, fields: s = Ee, isNameReadOnly: c, nameCaption: l, isDescriptionRequired: u, renderDescription: d, focusRequestKey: f, labels: p }) => {
566
+ let [m, h] = H(!1), g = B(() => a ? s : s.filter((e) => e !== U.Avatar), [a, s]), _ = e.iconUrl, v = a?.resolveIconUrl, y = B(() => v ? v(_) : void 0, [_, v]), b = z(() => h(!0), []), x = z(() => h(!1), []), S = a?.resolveAttachedIconUrl, C = z((e) => {
567
+ let t = S?.(e);
568
+ t && n({ iconUrl: t }), h(!1);
569
+ }, [n, S]);
570
+ return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(ke, {
571
+ values: e,
572
+ errors: t,
573
+ onChange: n,
574
+ onNameBlur: r,
575
+ onVersionBlur: i,
576
+ iconPreviewUrl: y,
577
+ onAddAvatarClick: b,
578
+ labels: p?.form ?? Pe,
579
+ availableLocaleOptions: o,
580
+ fields: g,
581
+ isNameReadOnly: c,
582
+ nameCaption: l,
583
+ isDescriptionRequired: u,
584
+ renderDescription: d,
585
+ focusRequestKey: f
586
+ }), a && /* @__PURE__ */ F(Te, {
587
+ isOpen: m,
588
+ onClose: x,
589
+ onAttach: C,
590
+ bucket: a.bucket,
591
+ FileManagerModal: a.FileManagerModal,
592
+ allowedMimeTypes: a.allowedMimeTypes,
593
+ maxFileSizeBytes: a.maxFileSizeBytes,
594
+ labels: p?.avatarPicker ?? Fe
595
+ })] });
596
+ }), Le = /* @__PURE__ */ function(e) {
597
+ return e.Required = "required", e.InvalidFormat = "invalid-format", e.TooLong = "too-long", e.ControlCharacters = "control-characters", e;
598
+ }({});
599
+ new Set([Le.TooLong, Le.ControlCharacters]);
600
+ //#endregion
601
+ //#region src/constants/public-class-names.ts
602
+ var Re = {
603
+ root: "dial-skill-editor-root",
604
+ refineFeedback: "dial-skill-editor-refine-feedback"
605
+ }, K = "SKILL.md", q = /* @__PURE__ */ function(e) {
90
606
  return e.File = "file", e.Folder = "folder", e;
91
- }({}), L = (e) => {
607
+ }({}), ze = /* @__PURE__ */ function(e) {
608
+ return e.Header = "header", e.Child = "child", e.Sibling = "sibling", e;
609
+ }({}), J = (e) => {
92
610
  let t = e.lastIndexOf("/");
93
611
  return t === -1 ? null : e.slice(0, t);
94
- }, R = (e) => {
612
+ }, Be = (e) => {
95
613
  let t = e.lastIndexOf("/");
96
614
  return t === -1 ? e : e.slice(t + 1);
97
- }, ue = (e) => {
615
+ }, Ve = (e) => {
98
616
  let t = /* @__PURE__ */ new Map(), n = (e) => {
99
617
  let n = t.get(e);
100
618
  if (n) return n;
101
619
  let r = {
102
620
  path: e,
103
- name: R(e),
104
- nodeType: A.FOLDER,
105
- parentPath: L(e),
621
+ name: Be(e),
622
+ nodeType: he.FOLDER,
623
+ parentPath: J(e),
106
624
  folderId: e,
107
625
  items: []
108
626
  };
109
627
  return t.set(e, r), r;
110
628
  };
111
629
  for (let r of e) {
112
- if (r.kind === I.Folder) {
113
- n(r.path);
630
+ if (r.kind === q.Folder) {
631
+ n(r.path).name = r.name;
114
632
  continue;
115
633
  }
116
634
  t.set(r.path, {
117
635
  path: r.path,
118
636
  name: r.name,
119
- nodeType: A.ITEM,
120
- parentPath: L(r.path),
121
- folderId: L(r.path) ?? ""
637
+ nodeType: he.ITEM,
638
+ parentPath: J(r.path),
639
+ folderId: J(r.path) ?? ""
122
640
  });
123
641
  }
124
642
  for (let t of [...e]) {
125
- let e = L(t.path);
126
- for (; e != null;) n(e), e = L(e);
643
+ let e = J(t.path);
644
+ for (; e != null;) n(e), e = J(e);
127
645
  }
128
646
  let r = [];
129
647
  for (let e of t.values()) {
@@ -135,462 +653,781 @@ var M = {
135
653
  n ? n.items = [...n.items ?? [], e] : r.push(e);
136
654
  }
137
655
  return r;
138
- }, de = ({ isVisible: e, labels: t }) => {
656
+ }, He = (e, t) => e ? `${e}/${t}` : t, Ue = (e) => J(e) ?? "", We = (e, t) => {
657
+ if (!t) return "";
658
+ switch (e) {
659
+ case ze.Child: return t.path;
660
+ case ze.Sibling: return Ue(t.path);
661
+ case ze.Header: return t.kind === q.Folder ? t.path : "";
662
+ }
663
+ }, Ge = (e, t) => {
664
+ let n = t ? `${t}/` : "", r = /* @__PURE__ */ new Set();
665
+ for (let { path: i } of e) {
666
+ if (!i.startsWith(n) || i === t) continue;
667
+ let e = i.slice(n.length);
668
+ r.add(e.split("/")[0]);
669
+ }
670
+ return r;
671
+ }, Ke = (e, t, n) => {
672
+ let r = e.trim();
673
+ if (!r) return n.required;
674
+ if (/[/\\]/.test(r) || r === "." || r === "..") return n.invalid;
675
+ if (t.has(r)) return n.duplicate;
676
+ }, qe = "\\new-folder", Je = ({ files: e, fileActions: t, defaultName: n, messages: r, onRevealFolder: i, onCreated: a }) => {
677
+ let [o, s] = H(null), c = o?.parentPath ?? null, l = V([]), u = c == null ? void 0 : He(c, qe), d = B(() => u == null ? void 0 : {
678
+ path: u,
679
+ name: n,
680
+ kind: q.Folder
681
+ }, [u, n]), f = z((n, i) => {
682
+ let a = Ge(e, i);
683
+ return i === "" && a.add(K), Ke(n, a, r) ?? t.validateFolderPath?.(He(i, n.trim()));
684
+ }, [
685
+ e,
686
+ r,
687
+ t
688
+ ]), p = z((e, t) => {
689
+ l.current = [], s({
690
+ parentPath: e,
691
+ pane: t
692
+ }), e !== "" && i(e);
693
+ }, [i]), m = z((e, t) => {
694
+ if (c == null || t.path !== u) return null;
695
+ let n = f(e, c);
696
+ return l.current = [...l.current.slice(-1), {
697
+ value: e,
698
+ isValid: n == null
699
+ }], n ?? null;
700
+ }, [
701
+ c,
702
+ u,
703
+ f
704
+ ]), h = z(() => {
705
+ l.current = [], s(null);
706
+ }, []), g = z((e) => {
707
+ if (c == null) return;
708
+ let [n] = l.current;
709
+ if (l.current.length === 2 && n != null && !n.isValid && n.value !== e || f(e, c) != null) {
710
+ h();
711
+ return;
712
+ }
713
+ let r = He(c, e.trim());
714
+ h(), t.onCreateFolder?.(r), a(r);
715
+ }, [
716
+ c,
717
+ f,
718
+ h,
719
+ t,
720
+ a
721
+ ]);
722
+ return {
723
+ draftNode: d,
724
+ draftPath: u,
725
+ draftPane: o?.pane,
726
+ startDraft: p,
727
+ handleValidate: m,
728
+ handleSave: g,
729
+ handleCancel: h
730
+ };
731
+ }, Ye = (e) => !!e.dataTransfer?.types.includes("Files"), Xe = (e) => {
732
+ let [t, n] = H(!1), r = V(0);
733
+ return {
734
+ isDragActive: t,
735
+ dropZoneHandlers: {
736
+ onDragEnter: z((e) => {
737
+ Ye(e) && (e.preventDefault(), r.current += 1, n(!0));
738
+ }, []),
739
+ onDragLeave: z((e) => {
740
+ Ye(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
741
+ }, []),
742
+ onDragOver: z((e) => {
743
+ Ye(e) && e.preventDefault();
744
+ }, []),
745
+ onDrop: z((t) => {
746
+ if (!Ye(t)) return;
747
+ t.preventDefault(), r.current = 0, n(!1);
748
+ let i = Array.from(t.dataTransfer?.files ?? []);
749
+ i.length > 0 && e(i);
750
+ }, [e])
751
+ }
752
+ };
753
+ }, Ze = /* @__PURE__ */ function(e) {
754
+ return e.Files = "files", e.Archive = "archive", e;
755
+ }({}), Y = /* @__PURE__ */ function(e) {
756
+ return e.Mobile = "mobile", e.Desktop = "desktop", e;
757
+ }({}), Qe = (e, t, n = g.MD) => /* @__PURE__ */ F(e, {
758
+ size: n,
759
+ className: t,
760
+ "aria-hidden": !0,
761
+ stroke: _
762
+ }), $e = ({ isVisible: e, labels: t }) => {
139
763
  if (!e) return null;
140
764
  let n = t ?? {};
141
- return /* @__PURE__ */ v("div", {
765
+ return /* @__PURE__ */ F("div", {
142
766
  role: "status",
143
767
  "aria-live": "polite",
144
- className: i("pointer-events-none absolute inset-0 z-[100] flex items-center justify-center backdrop-blur-sm"),
145
- children: /* @__PURE__ */ y("div", {
768
+ className: c("pointer-events-none absolute inset-0 z-[100] flex items-center justify-center backdrop-blur-sm"),
769
+ children: /* @__PURE__ */ I("div", {
146
770
  className: "flex flex-col items-center text-center",
147
771
  children: [
148
- /* @__PURE__ */ v(x, {
772
+ /* @__PURE__ */ F(ue, {
149
773
  size: 100,
150
774
  className: "text-accent-primary",
151
775
  "aria-hidden": !0,
152
- stroke: l
776
+ stroke: _
153
777
  }),
154
- /* @__PURE__ */ v("span", {
778
+ /* @__PURE__ */ F("span", {
155
779
  className: "dial-h3-text mt-5",
156
780
  children: n.dropOverlayTitle ?? "Upload files"
157
781
  }),
158
- /* @__PURE__ */ v("span", {
782
+ /* @__PURE__ */ F("span", {
159
783
  className: "dial-small-text mt-4",
160
784
  children: n.dropOverlaySubtitle ?? "Drop files here to add them to this skill"
161
785
  })
162
786
  ]
163
787
  })
164
788
  });
165
- }, fe = /* @__PURE__ */ function(e) {
789
+ }, et = /* @__PURE__ */ function(e) {
166
790
  return e.SupportingFile = "supporting-file", e.Manifest = "manifest", e;
167
- }({}), z = /* @__PURE__ */ function(e) {
791
+ }({}), tt = /* @__PURE__ */ function(e) {
168
792
  return e.Valid = "valid", e.Invalid = "invalid", e;
169
- }({}), B = (e) => (e.webkitRelativePath || e.name).replace(/\\/g, "/"), V = 0, H = () => `skill-file-candidate-${++V}`, pe = ({ isOpen: e, onClose: t, fileActions: n, initialFiles: i, labels: a }) => {
170
- let o = a ?? {}, [s, c] = k([]), [u, p] = k(/* @__PURE__ */ new Map()), [m, g] = k([]), [b, oe] = k(!1), [x, S] = k(), [C, w] = k(!1), D = E(), O = (e) => {
171
- let t = e.map((e) => ({
172
- id: H(),
173
- file: e,
174
- path: B(e)
175
- }));
176
- S(void 0), c((e) => [...e, ...t]);
177
- }, A = (e) => {
178
- c((t) => t.filter((t) => t.id !== e));
793
+ }({}), nt = (e) => (e.webkitRelativePath || e.name).replace(/\\/g, "/"), rt = ".zip,application/zip", X = 0, it = () => `skill-file-candidate-${++X}`, at = (e, t, n) => ({
794
+ id: it(),
795
+ file: e,
796
+ path: He(n, t.replace(/\\/g, "/"))
797
+ }), ot = ({ isOpen: e, onClose: t, fileActions: n, mode: r = Ze.Files, targetFolderPath: i = "", initialFiles: a, initialEntries: o, labels: c }) => {
798
+ let l = c ?? {}, [u, d] = H([]), [p, h] = H(/* @__PURE__ */ new Map()), [g, v] = H([]), [y, b] = H(!1), [C, T] = H(), [E, D] = H(!1), [O, A] = H(), [te, j] = H(0), M = V(0), N = r === Ze.Archive, L = l.uploadArchiveErrorMessage ?? "Couldn't read this archive", re = me(), ae = (e) => {
799
+ T(void 0), d((t) => [...t, ...e]);
800
+ }, oe = async (e) => {
801
+ let { extractArchive: t } = n;
802
+ if (!t) return;
803
+ let r = M.current;
804
+ A(void 0), j((e) => e + 1);
805
+ try {
806
+ let n = await Promise.all(e.map((e) => t(e)));
807
+ if (r !== M.current) return;
808
+ let a = n.flat();
809
+ if (a.length === 0) {
810
+ A(l.uploadArchiveEmptyMessage ?? "This archive has no files");
811
+ return;
812
+ }
813
+ ae(a.map((e) => at(e.file, e.path, i)));
814
+ } catch {
815
+ if (r !== M.current) return;
816
+ A(L);
817
+ } finally {
818
+ r === M.current && j((e) => e - 1);
819
+ }
820
+ }, se = (e) => {
821
+ if (N) {
822
+ oe(e);
823
+ return;
824
+ }
825
+ ae(e.map((e) => at(e, nt(e), i)));
826
+ }, ce = (e) => {
827
+ d((t) => t.filter((t) => t.id !== e));
179
828
  };
180
- T(() => {
181
- e && (c((i ?? []).map((e) => ({
182
- id: H(),
183
- file: e,
184
- path: B(e)
185
- }))), p(/* @__PURE__ */ new Map()), g([]), S(void 0));
186
- }, [e]), T(() => {
829
+ pe(() => {
830
+ e && (M.current += 1, d([...(a ?? []).map((e) => at(e, nt(e), i)), ...(o ?? []).map((e) => at(e.file, e.path, i))]), h(/* @__PURE__ */ new Map()), v([]), T(void 0), A(void 0), j(0));
831
+ }, [e]), pe(() => {
187
832
  if (!e) return;
188
833
  let t = !1;
189
- if (s.length === 0) {
190
- p(/* @__PURE__ */ new Map()), g([]);
834
+ if (u.length === 0) {
835
+ h(/* @__PURE__ */ new Map()), v([]);
191
836
  return;
192
837
  }
193
- return oe(!0), n.validateBatch(s).then(({ results: e, batchErrors: n }) => {
194
- t || (p(new Map(e.map((e) => [e.candidateId, e]))), g(n.map((e) => e.message)));
838
+ return b(!0), n.validateBatch(u).then(({ results: e, batchErrors: n }) => {
839
+ t || (h(new Map(e.map((e) => [e.candidateId, e]))), v(n.map((e) => e.message)));
195
840
  }).finally(() => {
196
- t || oe(!1);
841
+ t || b(!1);
197
842
  }), () => {
198
843
  t = !0;
199
844
  };
200
- }, [s, e]);
201
- let ce = s.some((e) => u.get(e.id)?.status === z.Invalid), j = s.length > 0 && s.every((e) => u.get(e.id)?.status === z.Invalid), M = s.length > 0 && !ce && m.length === 0 && !b && !C, N = async () => {
202
- w(!0), S(void 0);
845
+ }, [u, e]);
846
+ let ue = u.some((e) => p.get(e.id)?.status === tt.Invalid), de = u.length > 0 && u.every((e) => p.get(e.id)?.status === tt.Invalid), R = u.length > 0 && !ue && g.length === 0 && !y && !E && te === 0, fe = async () => {
847
+ D(!0), T(void 0);
203
848
  try {
204
- let { results: e, batchErrors: r } = await n.validateBatch(s), i = new Map(e.map((e) => [e.candidateId, e]));
205
- if (p(i), g(r.map((e) => e.message)), s.some((e) => i.get(e.id)?.status === z.Invalid) || r.length > 0) return;
206
- let a = await n.commitBatch(s);
849
+ let { results: e, batchErrors: r } = await n.validateBatch(u), i = new Map(e.map((e) => [e.candidateId, e]));
850
+ if (h(i), v(r.map((e) => e.message)), u.some((e) => i.get(e.id)?.status === tt.Invalid) || r.length > 0) return;
851
+ let a = await n.commitBatch(u);
207
852
  if (a.error) {
208
- S(a.error);
853
+ T(a.error);
209
854
  return;
210
855
  }
211
856
  t();
212
857
  } finally {
213
- w(!1);
858
+ D(!1);
214
859
  }
215
860
  };
216
- return /* @__PURE__ */ v(ne, {
861
+ return /* @__PURE__ */ F(k, {
217
862
  open: e,
218
- header: o.uploadDialogTitle ?? "Upload files from device",
219
- size: re.Sm,
220
- closeAriaLabel: o.uploadDialogCloseAriaLabel ?? "Close",
863
+ header: N ? l.uploadArchiveDialogTitle ?? "Upload archive from device" : l.uploadDialogTitle ?? "Upload files from device",
864
+ size: ee.Sm,
865
+ closeAriaLabel: l.uploadDialogCloseAriaLabel ?? "Close",
221
866
  onClose: t,
222
- footer: /* @__PURE__ */ y("div", {
223
- className: "flex min-h-[44px] items-center justify-end gap-2 px-6 py-4",
224
- children: [/* @__PURE__ */ v(ee, {
225
- label: o.uploadCancelLabel ?? "Cancel",
226
- onClick: t
227
- }), /* @__PURE__ */ v(ie, {
228
- label: o.uploadConfirmLabel ?? "Add",
229
- iconBefore: C ? /* @__PURE__ */ v(h, {
230
- size: 16,
231
- ariaLabel: ""
232
- }) : void 0,
233
- onClick: () => void N(),
234
- disabled: !M
235
- })]
236
- }),
237
- children: /* @__PURE__ */ y("div", {
867
+ mainButtons: [{
868
+ label: l.uploadCancelLabel ?? "Cancel",
869
+ variant: m.Primary,
870
+ appearance: f.Ghost,
871
+ onClick: t
872
+ }, {
873
+ label: l.uploadConfirmLabel ?? "Add",
874
+ variant: m.Primary,
875
+ iconBefore: E ? /* @__PURE__ */ F(ne, {
876
+ size: 16,
877
+ ariaLabel: ""
878
+ }) : void 0,
879
+ onClick: () => void fe(),
880
+ disabled: !R
881
+ }],
882
+ children: /* @__PURE__ */ I("div", {
238
883
  className: "flex flex-col gap-4 px-6 py-4",
239
884
  children: [
240
- /* @__PURE__ */ v(f, {
241
- label: /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("span", {
885
+ /* @__PURE__ */ F(S, {
886
+ label: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("span", {
242
887
  className: "desktop:hidden",
243
- children: o.uploadDropZoneMobileLabel ?? "Click here to upload"
244
- }), /* @__PURE__ */ v("span", {
888
+ children: N ? l.uploadArchiveDropZoneMobileLabel ?? "Click here to upload a .zip archive" : l.uploadDropZoneMobileLabel ?? "Click here to upload"
889
+ }), /* @__PURE__ */ F("span", {
245
890
  className: "hidden desktop:inline",
246
- children: o.uploadDropZoneLabel ?? "Drag and drop it or click here to upload"
891
+ children: N ? l.uploadArchiveDropZoneLabel ?? "Drag and drop a .zip archive or click here to upload" : l.uploadDropZoneLabel ?? "Drag and drop it or click here to upload"
247
892
  })] }),
248
- ariaLabel: o.uploadDropZoneAriaLabel ?? "Upload files",
893
+ ariaLabel: l.uploadDropZoneAriaLabel ?? "Upload files",
249
894
  multiple: !0,
250
- className: j ? "border-error hover:border-error" : void 0,
251
- onChange: O
895
+ accept: N ? rt : void 0,
896
+ className: de ? "border-error hover:border-error" : void 0,
897
+ onChange: se,
898
+ onReject: N ? () => A(L) : void 0
899
+ }),
900
+ te > 0 && /* @__PURE__ */ F(ne, { ariaLabel: l.uploadArchiveExtractingAriaLabel ?? "Reading archive" }),
901
+ /* @__PURE__ */ F("div", {
902
+ role: "alert",
903
+ children: O && /* @__PURE__ */ F(x, { text: O })
252
904
  }),
253
- /* @__PURE__ */ v("span", {
905
+ /* @__PURE__ */ F("span", {
254
906
  role: "status",
255
907
  "aria-live": "polite",
256
908
  className: "sr-only",
257
- id: D,
258
- children: m.map((e) => `${o.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
909
+ id: re,
910
+ children: g.map((e) => `${l.uploadBatchErrorAriaPrefix ?? "Upload error: "}${e}`).join(" ")
259
911
  }),
260
- m.map((e) => /* @__PURE__ */ v(d, { text: e }, e)),
261
- s.length > 0 && /* @__PURE__ */ v("ul", {
912
+ g.map((e) => /* @__PURE__ */ F(x, { text: e }, e)),
913
+ u.length > 0 && /* @__PURE__ */ F("ul", {
262
914
  className: "flex flex-col gap-2",
263
- children: s.map((e) => {
264
- let t = u.get(e.id), n = t?.kind === fe.Manifest, i = t?.status === z.Invalid;
265
- return /* @__PURE__ */ y("li", {
915
+ children: u.map((e) => {
916
+ let t = p.get(e.id), n = t?.kind === et.Manifest, r = t?.status === tt.Invalid;
917
+ return /* @__PURE__ */ I("li", {
266
918
  className: "flex items-center gap-2 rounded-lg border border-tertiary p-2",
267
919
  children: [
268
- /* @__PURE__ */ v(ae, {
920
+ /* @__PURE__ */ F(ie, {
269
921
  size: 20,
270
922
  "aria-hidden": !0,
271
- stroke: l
923
+ stroke: _
272
924
  }),
273
- /* @__PURE__ */ y("div", {
925
+ /* @__PURE__ */ I("div", {
274
926
  className: "flex min-w-0 flex-1 flex-col",
275
927
  children: [
276
- /* @__PURE__ */ v("span", {
928
+ /* @__PURE__ */ F("span", {
277
929
  className: "dial-small-text truncate",
278
930
  children: e.path
279
931
  }),
280
- /* @__PURE__ */ v("span", {
932
+ /* @__PURE__ */ F("span", {
281
933
  className: "dial-tiny-text text-secondary",
282
- children: r(e.file.size)
934
+ children: s(e.file.size)
283
935
  }),
284
- i && t?.error && /* @__PURE__ */ v(d, { text: t.error }),
285
- n && !i && /* @__PURE__ */ v("span", {
936
+ r && t?.error && /* @__PURE__ */ F(x, { text: t.error }),
937
+ n && !r && /* @__PURE__ */ F("span", {
286
938
  className: "dial-tiny-text text-secondary",
287
- children: o.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
939
+ children: l.uploadManifestRowNote ?? "Will replace this Skill's name, description, and instructions"
288
940
  })
289
941
  ]
290
942
  }),
291
- /* @__PURE__ */ v(te, {
292
- icon: /* @__PURE__ */ v(se, {
943
+ /* @__PURE__ */ F(w, {
944
+ icon: /* @__PURE__ */ F(le, {
293
945
  size: 16,
294
946
  "aria-hidden": !0,
295
- stroke: l
947
+ stroke: _
296
948
  }),
297
- "aria-label": o.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
298
- onClick: () => A(e.id)
949
+ "aria-label": l.uploadRemoveCandidateLabel?.(e.path) ?? `Remove ${e.path}`,
950
+ onClick: () => ce(e.id)
299
951
  })
300
952
  ]
301
953
  }, e.id);
302
954
  })
303
955
  }),
304
- x && /* @__PURE__ */ v(d, { text: x })
956
+ C && /* @__PURE__ */ F(x, { text: C })
305
957
  ]
306
958
  })
307
959
  });
308
- }, U = {
309
- title: "_title_65glc_1",
310
- helperText: "_helperText_65glc_5"
311
- }, me = C(async () => {
312
- let { MarkdownEditor: e } = await j();
960
+ }, st = {
961
+ title: "_title_5md1a_1",
962
+ helperText: "_helperText_5md1a_5",
963
+ refineFeedback: "_refineFeedback_5md1a_9",
964
+ refineError: "_refineError_5md1a_13"
965
+ }, ct = {
966
+ mode: Ze.Files,
967
+ targetFolderPath: ""
968
+ }, lt = [U.Name, U.Description], ut = 24, dt = 300, ft = "desktop:px-8 desktop:py-6", pt = "gap-4 px-4 py-6 desktop:gap-5 desktop:px-8 desktop:py-6", mt = R(async () => {
969
+ let { MarkdownEditor: e } = await _e();
313
970
  return { default: e };
314
- }), W = ({ initialValues: r, files: f, selectedPath: te, onSelectedPathChange: ne, expandedPaths: re, onExpandedPathsChange: b, isLoading: ae = !1, hasLoadError: x = !1, isSubmitting: C = !1, errors: E, submitError: A, conflict: j, onReloadLatest: M, isNameReadOnly: P = !1, onDirtyChange: L, fileActions: R, supportingFileContent: fe, onSubmit: z, onCancel: B, onBack: V, backAriaLabel: H, title: W, onRetry: he, labels: ge, styles: _e, dir: ve, instructionsEditorTheme: ye = u.light }) => {
315
- let [G, K] = k({
971
+ }), ht = ({ initialValues: r, files: i, selectedPath: s, onSelectedPathChange: v, expandedPaths: S, onExpandedPathsChange: w, isLoading: T = !1, hasLoadError: D = !1, isSubmitting: O = !1, errors: k, submitError: ee, conflict: te, onReloadLatest: j, isNameReadOnly: M = !1, onDirtyChange: N, onValuesChange: L, onRefineDescription: ie, onRefineInstructions: se, fileActions: R, supportingFileContent: fe, onSubmit: _e, onCancel: ve, onBack: ye, backAriaLabel: be, title: xe, onRetry: Se, onRetrySubmit: Ce, labels: we, styles: Te, dir: U, instructionsEditorTheme: Ee = y.light }) => {
972
+ let [W, De] = H({
316
973
  name: r?.name ?? "",
317
974
  description: r?.description ?? "",
318
975
  instructions: r?.instructions ?? ""
319
- }), be = a(), xe = O(r), Se = xe.current !== r, Ce = O(f);
320
- T(() => {
321
- xe.current = r, K({
976
+ }), Oe = me(), G = V(void 0), ke = l({
977
+ bottomGap: ut,
978
+ minHeight: dt
979
+ }), Ae = V(W), je = (e) => {
980
+ let t = {
981
+ ...Ae.current,
982
+ ...e
983
+ };
984
+ Ae.current = t, De(t), L?.(t);
985
+ }, Me = (e) => e ? async (t, n) => {
986
+ if (G.current && !G.current.aborted) throw new DOMException("Busy", "AbortError");
987
+ G.current = n;
988
+ try {
989
+ return await e(t, n);
990
+ } finally {
991
+ G.current === n && (G.current = void 0);
992
+ }
993
+ } : void 0, Fe = u({
994
+ value: W.description,
995
+ onChange: (e) => je({ description: e }),
996
+ onRefine: Me(ie),
997
+ disabled: O || T || D,
998
+ resetKey: r
999
+ }), Le = u({
1000
+ value: W.instructions,
1001
+ onChange: (e) => je({ instructions: e }),
1002
+ onRefine: Me(se),
1003
+ disabled: O || T || D,
1004
+ resetKey: r
1005
+ }), J = Fe.isPending || Le.isPending, Be = () => {
1006
+ Fe.reset(), Le.reset();
1007
+ }, He = () => {
1008
+ Be(), ve();
1009
+ }, Ue = () => {
1010
+ Be(), ye();
1011
+ }, Ge = () => {
1012
+ O || T || D || G.current && !G.current.aborted || _e(W);
1013
+ }, Ke = V(r), qe = Ke.current !== r, Ye = V(i);
1014
+ pe(() => {
1015
+ Ke.current = r;
1016
+ let e = {
322
1017
  name: r?.name ?? "",
323
1018
  description: r?.description ?? "",
324
1019
  instructions: r?.instructions ?? ""
325
- }), Ce.current = f;
1020
+ };
1021
+ Ae.current = e, De(e), Ye.current = i;
326
1022
  }, [r]);
327
- let we = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), Te = O(!1);
328
- T(() => {
329
- if (Se) return;
1023
+ let et = (e) => JSON.stringify([...e].sort((e, t) => e.path.localeCompare(t.path))), tt = V(!1);
1024
+ pe(() => {
1025
+ if (qe) return;
330
1026
  let e = {
331
1027
  name: r?.name ?? "",
332
1028
  description: r?.description ?? "",
333
1029
  instructions: r?.instructions ?? ""
334
- }, t = JSON.stringify(G) !== JSON.stringify(e) || we(f) !== we(Ce.current);
335
- t !== Te.current && (Te.current = t, L?.(t));
1030
+ }, t = JSON.stringify(W) !== JSON.stringify(e) || et(i) !== et(Ye.current);
1031
+ t !== tt.current && (tt.current = t, N?.(t));
336
1032
  }, [
337
- G,
338
- f,
1033
+ W,
1034
+ i,
339
1035
  r,
340
- Se,
341
- L
1036
+ qe,
1037
+ N
342
1038
  ]);
343
- let [Ee, De] = k(F), q = te ?? Ee, J = w((e) => {
344
- De(e), ne?.(e);
345
- }, [ne]), [Oe, ke] = k([]), Ae = re ?? Oe, je = D(() => new Set(Ae), [Ae]), Me = w((e) => {
1039
+ let [nt, rt] = H(K), X = s ?? nt, it = z((e) => {
1040
+ rt(e), v?.(e);
1041
+ }, [v]), [at, ht] = H([]), gt = S ?? at, _t = B(() => new Set(gt), [gt]), vt = z((e) => {
346
1042
  let t = [...e];
347
- ke(t), b?.(t);
348
- }, [b]), [Y, Ne] = k(!1), [Pe, Fe] = k(), [Ie, Le] = k(!1), { isDragActive: Re, dropZoneHandlers: ze } = le(w((e) => {
349
- Y || (Fe(e), Ne(!0));
350
- }, [Y])), X = ge ?? {}, Z = _e?.colors, Q = _e?.typography ?? {}, Be = Q.titleClassName ?? "dial-body-semi-text", Ve = Q.helperTextClassName ?? "dial-tiny-semi-text", He = Q.removeIconClassName ?? "text-secondary", Ue = n({
351
- "--se-title-color": Z?.title,
352
- "--se-helper-text-color": Z?.helperText
353
- }), We = Z?.border ? { colors: {
354
- headerBorderColor: Z.border,
355
- sidebarBorderColor: Z.border
356
- } } : void 0, Ge = D(() => ue([{
357
- path: F,
358
- name: F,
359
- kind: I.File
360
- }, ...f]), [f]), $ = D(() => f.find((e) => e.path === q), [f, q]), Ke = w((e) => {
361
- J(e.path);
362
- }, [J]), qe = w((e) => {
363
- R.onRemoveNode(e), q === e && J(F);
1043
+ ht(t), w?.(t);
1044
+ }, [w]), [yt, bt] = H(!1), [xt, St] = H(ct), Z = z((e) => {
1045
+ St(e), bt(!0);
1046
+ }, []), [Ct, wt] = H(!1), { isDragActive: Tt, dropZoneHandlers: Et } = Xe(z((e) => {
1047
+ yt || Z({
1048
+ ...ct,
1049
+ initialFiles: e
1050
+ });
1051
+ }, [yt, Z])), Q = we ?? {}, $ = Te?.colors, Dt = Te?.typography ?? {}, Ot = Dt.titleClassName ?? "dial-body-semi-text", kt = Dt.helperTextClassName ?? "dial-tiny-semi-text", At = Dt.removeIconClassName, jt = Dt.menuIconClassName ?? "text-secondary", Mt = o({
1052
+ "--se-title-color": $?.title,
1053
+ "--se-helper-text-color": $?.helperText,
1054
+ "--se-refine-action-text": $?.refineActionText,
1055
+ "--se-refine-error-text": $?.refineErrorText
1056
+ }), Nt = {
1057
+ feedbackClassName: c($?.refineActionText && st.refineFeedback, Dt.refineFeedbackClassName, Re.refineFeedback),
1058
+ errorClassName: st.refineError
1059
+ }, Pt = {
1060
+ layout: $?.border ? { colors: {
1061
+ headerBorderColor: $.border,
1062
+ sidebarBorderColor: $.border
1063
+ } } : void 0,
1064
+ section: $?.title ? { colors: { titleColor: $.title } } : void 0
1065
+ }, Ft = B(() => ({
1066
+ required: Q.folderNameRequiredError ?? "Enter a folder name",
1067
+ invalid: Q.folderNameInvalidError ?? "Folder name can't contain / or \\, or be . or ..",
1068
+ duplicate: Q.folderNameDuplicateError ?? "An item with this name already exists here"
1069
+ }), [
1070
+ Q.folderNameRequiredError,
1071
+ Q.folderNameInvalidError,
1072
+ Q.folderNameDuplicateError
1073
+ ]), It = z((e) => {
1074
+ _t.has(e) || vt(new Set([..._t, e]));
1075
+ }, [_t, vt]), Lt = Je({
1076
+ files: i,
1077
+ fileActions: R,
1078
+ defaultName: Q.newFolderDefaultName ?? "New folder",
1079
+ messages: Ft,
1080
+ onRevealFolder: It,
1081
+ onCreated: it
1082
+ }), { draftNode: Rt, draftPath: zt, draftPane: Bt } = Lt, Vt = B(() => Ve([{
1083
+ path: K,
1084
+ name: K,
1085
+ kind: q.File
1086
+ }, ...i]), [i]), Ht = B(() => Rt ? Ve([
1087
+ {
1088
+ path: K,
1089
+ name: K,
1090
+ kind: q.File
1091
+ },
1092
+ ...i,
1093
+ Rt
1094
+ ]) : Vt, [
1095
+ i,
1096
+ Rt,
1097
+ Vt
1098
+ ]), Ut = B(() => i.find((e) => e.path === X), [i, X]), Wt = z((e) => {
1099
+ e.path !== zt && it(e.path);
1100
+ }, [it, zt]), Gt = z((e) => {
1101
+ R.onRemoveNode(e), X === e && it(K);
364
1102
  }, [
365
1103
  R,
366
- q,
367
- J
368
- ]), Je = w((e) => e.path === "SKILL.md" ? [] : [{
369
- key: "remove",
370
- label: X.removeLabel ?? "Remove",
371
- icon: /* @__PURE__ */ v(se, {
372
- size: c.SM,
373
- className: He,
374
- "aria-hidden": !0,
375
- stroke: l
376
- }),
377
- onClick: () => qe(e.path)
378
- }], [
379
- X.removeLabel,
380
- He,
381
- qe
382
- ]), Ye = /* @__PURE__ */ y("div", {
1104
+ X,
1105
+ it
1106
+ ]), { startDraft: Kt } = Lt, { onCreateFolder: qt, extractArchive: Jt, pickFromFileSystem: Yt } = R, Xt = z(async (e) => {
1107
+ if (!Yt) return;
1108
+ let t = await Yt();
1109
+ t?.length && Z({
1110
+ mode: Ze.Files,
1111
+ targetFolderPath: e,
1112
+ initialEntries: t
1113
+ });
1114
+ }, [Yt, Z]), Zt = z((e, t) => {
1115
+ let n = (e) => Qe(e, jt), r = [];
1116
+ return qt && r.push({
1117
+ key: "create-folder",
1118
+ label: Q.createFolderLabel ?? "Create folder",
1119
+ icon: n(oe),
1120
+ onClick: () => Kt(e, t)
1121
+ }), r.push({
1122
+ key: "upload-files",
1123
+ label: Q.uploadFilesLabel ?? "Upload files from device",
1124
+ icon: n(ue),
1125
+ onClick: () => Z({
1126
+ mode: Ze.Files,
1127
+ targetFolderPath: e
1128
+ })
1129
+ }), Jt && r.push({
1130
+ key: "upload-archive",
1131
+ label: Q.uploadArchiveLabel ?? "Upload archive from device",
1132
+ icon: n(ae),
1133
+ onClick: () => Z({
1134
+ mode: Ze.Archive,
1135
+ targetFolderPath: e
1136
+ })
1137
+ }), Yt && r.push({
1138
+ key: "open-file-system",
1139
+ label: Q.openFileSystemLabel ?? "Open DIAL file system",
1140
+ icon: n(re),
1141
+ onClick: () => void Xt(e)
1142
+ }), r;
1143
+ }, [
1144
+ jt,
1145
+ qt,
1146
+ Jt,
1147
+ Yt,
1148
+ Q.createFolderLabel,
1149
+ Q.uploadFilesLabel,
1150
+ Q.uploadArchiveLabel,
1151
+ Q.openFileSystemLabel,
1152
+ Kt,
1153
+ Z,
1154
+ Xt
1155
+ ]), Qt = B(() => {
1156
+ let e = We(ze.Header, i.find((e) => e.path === X));
1157
+ return {
1158
+ [Y.Mobile]: Zt(e, Y.Mobile),
1159
+ [Y.Desktop]: Zt(e, Y.Desktop)
1160
+ };
1161
+ }, [
1162
+ Zt,
1163
+ i,
1164
+ X
1165
+ ]), $t = z((e, t) => {
1166
+ if (e.path === "SKILL.md" || e.path === zt) return [];
1167
+ let n = {
1168
+ path: e.path,
1169
+ name: e.name,
1170
+ kind: e.nodeType === he.FOLDER ? q.Folder : q.File
1171
+ }, r = [];
1172
+ return n.kind === q.Folder && r.push({
1173
+ key: "add-child",
1174
+ icon: Qe(ce),
1175
+ label: Q.addChildLabel ?? "Add child",
1176
+ children: Zt(We(ze.Child, n), t)
1177
+ }), r.push({
1178
+ key: "add-sibling",
1179
+ icon: Qe(ce),
1180
+ label: Q.addSiblingLabel ?? "Add sibling",
1181
+ children: Zt(We(ze.Sibling, n), t)
1182
+ }, {
1183
+ key: "delete",
1184
+ label: Q.deleteLabel ?? "Delete",
1185
+ danger: !0,
1186
+ icon: Qe(le, At),
1187
+ onClick: () => Gt(e.path)
1188
+ }), r;
1189
+ }, [
1190
+ zt,
1191
+ Q.addChildLabel,
1192
+ Q.addSiblingLabel,
1193
+ Q.deleteLabel,
1194
+ At,
1195
+ Zt,
1196
+ Gt
1197
+ ]), en = B(() => ({
1198
+ [Y.Mobile]: (e) => $t(e, Y.Mobile),
1199
+ [Y.Desktop]: (e) => $t(e, Y.Desktop)
1200
+ }), [$t]), tn = (e) => /* @__PURE__ */ I("div", {
383
1201
  className: "flex flex-col gap-2 desktop:gap-5",
384
- children: [/* @__PURE__ */ y("div", {
1202
+ children: [/* @__PURE__ */ I("div", {
385
1203
  className: "flex items-center justify-between",
386
- children: [/* @__PURE__ */ v("span", {
387
- className: i(U.title, Be),
388
- children: X.filesHeading ?? "Files"
389
- }), /* @__PURE__ */ v(m, {
390
- label: X.addUploadLabel ?? "Upload from device",
391
- iconBefore: /* @__PURE__ */ v(oe, {
392
- size: 16,
1204
+ children: [/* @__PURE__ */ F("span", {
1205
+ className: c(st.title, Ot),
1206
+ children: Q.filesHeading ?? "Files"
1207
+ }), /* @__PURE__ */ F(p, {
1208
+ label: Q.addLabel ?? "Add",
1209
+ variant: m.Neutral,
1210
+ appearance: f.Solid,
1211
+ size: b.Small,
1212
+ iconBefore: /* @__PURE__ */ F(ce, {
1213
+ size: g.SM,
393
1214
  "aria-hidden": !0,
394
- stroke: l
1215
+ stroke: _
395
1216
  }),
396
- onClick: () => {
397
- Fe(void 0), Ne(!0);
398
- }
1217
+ items: Qt[e]
399
1218
  })]
400
- }), /* @__PURE__ */ v("div", {
1219
+ }), /* @__PURE__ */ F("div", {
401
1220
  role: "tree",
402
- "aria-label": X.filesTreeAriaLabel ?? "Skill files",
403
- children: /* @__PURE__ */ v(ce, {
404
- items: Ge,
1221
+ "aria-label": Q.filesTreeAriaLabel ?? "Skill files",
1222
+ children: /* @__PURE__ */ F(ge, {
1223
+ items: Bt === e ? Ht : Vt,
405
1224
  showFiles: !0,
406
- selectedPath: q,
407
- expandedPaths: je,
408
- onExpandedPathsChange: Me,
409
- onItemClick: Ke,
410
- getContextMenuItems: Je,
1225
+ selectedPath: X,
1226
+ expandedPaths: _t,
1227
+ onExpandedPathsChange: vt,
1228
+ onItemClick: Wt,
1229
+ getContextMenuItems: en[e],
1230
+ renamedPath: Bt === e ? zt : void 0,
1231
+ onRenameSave: Lt.handleSave,
1232
+ onRenameCancel: Lt.handleCancel,
1233
+ onRenameValidate: Lt.handleValidate,
411
1234
  rootItemPath: ""
412
1235
  })
413
1236
  })]
414
- }), Xe = /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(m, {
415
- label: X.cancelLabel ?? "Cancel",
416
- onClick: B,
417
- disabled: C
418
- }), /* @__PURE__ */ v(ie, {
419
- label: X.createLabel ?? "Create",
420
- iconBefore: C ? /* @__PURE__ */ v(h, {
421
- size: 16,
422
- ariaLabel: ""
423
- }) : void 0,
424
- onClick: () => z(G),
425
- disabled: C
426
- })] });
427
- return ae ? /* @__PURE__ */ v("div", {
428
- dir: ve,
1237
+ }), nn = B(() => ({
1238
+ name: W.name,
1239
+ description: W.description,
1240
+ iconUrl: "",
1241
+ version: "",
1242
+ topics: [],
1243
+ otherLocales: []
1244
+ }), [W.name, W.description]), rn = B(() => ({
1245
+ name: k?.name,
1246
+ description: k?.description
1247
+ }), [k?.name, k?.description]), an = B(() => ({ form: {
1248
+ ...Pe,
1249
+ name: {
1250
+ label: Q.nameLabel ?? "Name",
1251
+ placeholder: Q.namePlaceholder ?? "good-morning-breakfast"
1252
+ },
1253
+ description: {
1254
+ label: Q.descriptionLabel ?? "Description",
1255
+ placeholder: Q.descriptionPlaceholder ?? "What this skill does and when to use it"
1256
+ },
1257
+ ariaLabel: void 0
1258
+ } }), [
1259
+ Q.nameLabel,
1260
+ Q.namePlaceholder,
1261
+ Q.descriptionLabel,
1262
+ Q.descriptionPlaceholder
1263
+ ]), on = (e) => {
1264
+ e.name !== void 0 && je({ name: e.name }), e.description !== void 0 && (Fe.reset(), je({ description: e.description }));
1265
+ }, sn = ie ? (e, t) => /* @__PURE__ */ F(a, {
1266
+ isEnabled: !0,
1267
+ fieldId: t,
1268
+ required: !0,
1269
+ label: Q.descriptionLabel ?? "Description",
1270
+ labels: Q,
1271
+ refinement: Fe,
1272
+ disabled: J || O,
1273
+ ...Nt,
1274
+ children: e
1275
+ }) : void 0, cn = {
1276
+ title: xe,
1277
+ onBack: Ue,
1278
+ onCancel: He,
1279
+ onSubmit: Ge,
1280
+ submitLabel: Q.createLabel ?? "Create",
1281
+ isSubmitDisabled: J || T || D,
1282
+ labels: {
1283
+ cancelLabel: Q.cancelLabel ?? "Cancel",
1284
+ backAriaLabel: be ?? "Back",
1285
+ savingStatusLabel: Q.savingStatusLabel ?? "Saving"
1286
+ },
1287
+ styles: Pt,
1288
+ metadataTitle: null
1289
+ };
1290
+ if (T) return /* @__PURE__ */ F("div", {
1291
+ dir: U,
429
1292
  className: "relative flex min-h-0 flex-1 flex-col",
430
- children: /* @__PURE__ */ v(N, {
431
- title: W,
432
- onBack: V,
433
- backAriaLabel: H,
434
- actions: Xe,
435
- isSaving: !1,
436
- labels: { savingStatusLabel: X.savingStatusLabel },
437
- styles: We,
438
- leftContent: /* @__PURE__ */ v("div", {
1293
+ children: /* @__PURE__ */ F(Ne, {
1294
+ ...cn,
1295
+ metadata: /* @__PURE__ */ F("div", {
439
1296
  role: "status",
440
- "aria-label": X.loadingAriaLabel ?? "Loading skill",
1297
+ "aria-label": Q.loadingAriaLabel ?? "Loading skill",
441
1298
  className: "flex flex-1 items-center justify-center p-8",
442
- children: /* @__PURE__ */ v(h, {})
1299
+ children: /* @__PURE__ */ F(ne, {})
443
1300
  })
444
1301
  })
445
- }) : x ? /* @__PURE__ */ v("div", {
446
- dir: ve,
1302
+ });
1303
+ if (D) return /* @__PURE__ */ F("div", {
1304
+ dir: U,
447
1305
  className: "relative flex min-h-0 flex-1 flex-col",
448
- children: /* @__PURE__ */ v(N, {
449
- title: W,
450
- onBack: V,
451
- backAriaLabel: H,
452
- actions: Xe,
453
- isSaving: !1,
454
- labels: { savingStatusLabel: X.savingStatusLabel },
455
- styles: We,
456
- leftContent: /* @__PURE__ */ y("div", {
1306
+ children: /* @__PURE__ */ F(Ne, {
1307
+ ...cn,
1308
+ metadata: /* @__PURE__ */ I("div", {
457
1309
  role: "alert",
458
1310
  className: "flex flex-col items-center gap-4 p-8",
459
- children: [/* @__PURE__ */ v(d, { text: X.loadErrorMessage ?? "Couldn't load this skill. Please try again." }), /* @__PURE__ */ v(ie, {
460
- label: X.retryLabel ?? "Retry",
461
- onClick: he
1311
+ children: [/* @__PURE__ */ F(x, { text: Q.loadErrorMessage ?? "Couldn't load this skill. Please try again." }), /* @__PURE__ */ F(A, {
1312
+ label: Q.retryLabel ?? "Retry",
1313
+ onClick: Se
462
1314
  })]
463
1315
  })
464
1316
  })
465
- }) : /* @__PURE__ */ y("div", {
466
- dir: ve,
467
- className: "relative flex min-h-0 flex-1 flex-col",
468
- style: Ue,
469
- ...ze,
1317
+ });
1318
+ let ln = X === K, un = ln ? K : Q.selectedFileHeading?.(Ut?.name ?? X) ?? Ut?.name ?? X, dn = ee != null || te != null ? /* @__PURE__ */ I("div", {
1319
+ className: "flex flex-col gap-2",
1320
+ children: [ee != null && /* @__PURE__ */ I("div", {
1321
+ className: "flex items-center gap-2",
1322
+ children: [/* @__PURE__ */ F(x, { text: ee }), Ce != null && /* @__PURE__ */ F(C, {
1323
+ label: Q.retryLabel ?? "Retry",
1324
+ onClick: Ce
1325
+ })]
1326
+ }), te != null && /* @__PURE__ */ I("div", {
1327
+ className: "flex items-center gap-2",
1328
+ children: [/* @__PURE__ */ F(x, { text: te.message }), /* @__PURE__ */ F(C, {
1329
+ label: Q.reloadLatestLabel ?? "Reload latest",
1330
+ onClick: j
1331
+ })]
1332
+ })]
1333
+ }) : void 0, fn = /* @__PURE__ */ F(a, {
1334
+ isEnabled: !!se,
1335
+ fieldId: Oe,
1336
+ required: !0,
1337
+ labelClassName: c(st.helperText, kt),
1338
+ label: Q.instructionsLabel ?? "Instructions",
1339
+ labels: Q,
1340
+ refinement: Le,
1341
+ disabled: J || O,
1342
+ ...Nt,
1343
+ children: /* @__PURE__ */ I("div", {
1344
+ className: "flex flex-1 flex-col gap-2",
1345
+ children: [
1346
+ !se && /* @__PURE__ */ F(E, {
1347
+ htmlFor: Oe,
1348
+ className: c(st.helperText, kt),
1349
+ label: Q.instructionsLabel ?? "Instructions",
1350
+ required: !0
1351
+ }),
1352
+ /* @__PURE__ */ F("div", {
1353
+ ref: ke,
1354
+ className: c(t, e, n),
1355
+ children: /* @__PURE__ */ F(de, {
1356
+ fallback: /* @__PURE__ */ F(ne, { ariaLabel: Q.instructionsLoadingAriaLabel ?? "Loading" }),
1357
+ children: /* @__PURE__ */ F(mt, {
1358
+ id: Oe,
1359
+ ariaLabel: Q.instructionsLabel ?? "Instructions",
1360
+ value: W.instructions,
1361
+ onChange: (e) => {
1362
+ Le.reset(), je({ instructions: e });
1363
+ },
1364
+ theme: Ee,
1365
+ placeholder: Q.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
1366
+ })
1367
+ })
1368
+ }),
1369
+ k?.instructions != null && /* @__PURE__ */ F(x, { text: k.instructions })
1370
+ ]
1371
+ })
1372
+ });
1373
+ return /* @__PURE__ */ I("div", {
1374
+ dir: U,
1375
+ className: c("relative flex min-h-0 flex-1 flex-col", Re.root),
1376
+ style: Mt,
1377
+ ...Et,
470
1378
  children: [
471
- /* @__PURE__ */ v(de, {
472
- isVisible: Re && !Y,
473
- labels: ge
1379
+ /* @__PURE__ */ F($e, {
1380
+ isVisible: Tt && !yt,
1381
+ labels: we
474
1382
  }),
475
- /* @__PURE__ */ v(N, {
476
- title: W,
477
- onBack: V,
478
- backAriaLabel: H,
479
- actions: Xe,
480
- isSaving: C,
481
- labels: { savingStatusLabel: X.savingStatusLabel },
482
- styles: We,
483
- leftContent: /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("div", {
484
- className: "px-4 py-4 desktop:hidden",
485
- children: /* @__PURE__ */ v(o, {
486
- title: X.editingFileLabel ?? "Editing file",
487
- description: $?.name ?? "SKILL.md",
488
- expanded: Ie,
489
- onToggle: Le,
490
- ariaLabel: X.editingFileLabel ?? "Editing file",
491
- children: Ye
1383
+ /* @__PURE__ */ F(Ne, {
1384
+ ...cn,
1385
+ isSubmitting: O,
1386
+ metadataSectionClassName: ft,
1387
+ metadata: /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", {
1388
+ className: "desktop:hidden",
1389
+ children: /* @__PURE__ */ F(d, {
1390
+ title: Q.editingFileLabel ?? "Editing file",
1391
+ description: Ut?.name ?? "SKILL.md",
1392
+ expanded: Ct,
1393
+ onToggle: wt,
1394
+ ariaLabel: Q.editingFileLabel ?? "Editing file",
1395
+ children: tn(Y.Mobile)
492
1396
  })
493
- }), /* @__PURE__ */ v("div", {
494
- className: "hidden px-8 py-6 desktop:block",
495
- children: Ye
1397
+ }), /* @__PURE__ */ F("div", {
1398
+ className: "hidden desktop:block",
1399
+ children: tn(Y.Desktop)
496
1400
  })] }),
497
- rightContent: /* @__PURE__ */ y("div", {
498
- className: "flex flex-1 flex-col gap-4 px-4 py-6 desktop:gap-5 desktop:px-8",
499
- children: [
500
- A != null && /* @__PURE__ */ v("div", {
501
- role: "alert",
502
- children: /* @__PURE__ */ v(d, { text: A })
503
- }),
504
- j != null && /* @__PURE__ */ y("div", {
505
- role: "alert",
506
- className: "flex items-center gap-2",
507
- children: [/* @__PURE__ */ v(d, { text: j.message }), /* @__PURE__ */ v(ee, {
508
- label: X.reloadLatestLabel ?? "Reload latest",
509
- onClick: M
510
- })]
511
- }),
512
- /* @__PURE__ */ v("h2", {
513
- className: i(U.title, Be),
514
- children: q === "SKILL.md" ? F : X.selectedFileHeading?.($?.name ?? q) ?? $?.name ?? q
515
- }),
516
- q === "SKILL.md" ? /* @__PURE__ */ y(_, { children: [
517
- /* @__PURE__ */ v(p, {
518
- labelProps: {
519
- label: X.nameLabel ?? "Name",
520
- required: !0
521
- },
522
- value: G.name,
523
- onChange: (e) => K((t) => ({
524
- ...t,
525
- name: e ?? ""
526
- })),
527
- placeholder: X.namePlaceholder ?? "good-morning-breakfast",
528
- caption: E?.name ? void 0 : X.nameCaption ?? "Lowercase letters and hyphens only, no spaces. We'll reformat automatically if needed.",
529
- error: E?.name,
530
- invalid: !!E?.name,
531
- disabled: P
532
- }),
533
- /* @__PURE__ */ v(g, {
534
- labelProps: {
535
- label: X.descriptionLabel ?? "Description",
536
- required: !0
537
- },
538
- value: G.description,
539
- placeholder: X.descriptionPlaceholder ?? "What this skill does and when to use it",
540
- onChange: (e) => K((t) => ({
541
- ...t,
542
- description: e
543
- })),
544
- error: E?.description,
545
- invalid: !!E?.description
546
- }),
547
- /* @__PURE__ */ y("div", {
548
- className: "flex flex-1 flex-col gap-2",
549
- children: [
550
- /* @__PURE__ */ y("span", {
551
- className: "flex items-center gap-0.5",
552
- children: [/* @__PURE__ */ v("span", {
553
- className: i(U.helperText, Ve),
554
- children: X.instructionsLabel ?? "Instructions"
555
- }), /* @__PURE__ */ v("span", {
556
- className: "dial-tiny-text text-error",
557
- children: "*"
558
- })]
559
- }),
560
- /* @__PURE__ */ v("div", {
561
- ref: be,
562
- className: i(e, t),
563
- children: /* @__PURE__ */ v(S, {
564
- fallback: /* @__PURE__ */ v(h, { ariaLabel: X.instructionsLoadingAriaLabel ?? "Loading" }),
565
- children: /* @__PURE__ */ v(me, {
566
- value: G.instructions,
567
- onChange: (e) => K((t) => ({
568
- ...t,
569
- instructions: e
570
- })),
571
- theme: ye,
572
- placeholder: X.instructionsPlaceholder ?? "Write the skill instructions in Markdown"
573
- })
574
- })
575
- }),
576
- E?.instructions != null && /* @__PURE__ */ v(d, { text: E.instructions })
577
- ]
578
- })
579
- ] }) : $?.kind === I.File && (fe ?? /* @__PURE__ */ v(s, { text: X.supportingFileNote ?? "This supporting file is included in the skill package as-is. Remove it from the Files panel to replace its content." }))
580
- ]
581
- })
1401
+ alert: dn,
1402
+ setupTitle: un,
1403
+ setupSectionClassName: pt,
1404
+ setup: ln ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(Ie, {
1405
+ values: nn,
1406
+ errors: rn,
1407
+ onChange: on,
1408
+ fields: lt,
1409
+ isDescriptionRequired: !0,
1410
+ isNameReadOnly: M,
1411
+ nameCaption: k?.name ? void 0 : Q.nameCaption ?? "Lowercase letters and hyphens only, no spaces. We'll reformat automatically if needed.",
1412
+ renderDescription: sn,
1413
+ labels: an
1414
+ }), fn] }) : /* @__PURE__ */ F(P, { children: Ut?.kind === q.File && /* @__PURE__ */ F("div", {
1415
+ className: "flex min-h-0 flex-1 flex-col",
1416
+ children: fe ?? /* @__PURE__ */ F(h, { text: Q.supportingFileNote ?? "This supporting file is included in the skill package as-is. Remove it from the Files panel to replace its content." })
1417
+ }) })
582
1418
  }),
583
- /* @__PURE__ */ v(pe, {
584
- isOpen: Y,
585
- onClose: () => {
586
- Ne(!1), Fe(void 0);
587
- },
1419
+ /* @__PURE__ */ F(ot, {
1420
+ isOpen: yt,
1421
+ onClose: () => bt(!1),
588
1422
  fileActions: R,
589
- initialFiles: Pe,
590
- labels: ge
1423
+ mode: xt.mode,
1424
+ targetFolderPath: xt.targetFolderPath,
1425
+ initialFiles: xt.initialFiles,
1426
+ initialEntries: xt.initialEntries,
1427
+ labels: we
591
1428
  })
592
1429
  ]
593
1430
  });
594
1431
  };
595
1432
  //#endregion
596
- export { W as SkillEditor, fe as SkillFileCandidateKind, I as SkillFileNodeKind, z as SkillFileValidationStatus };
1433
+ export { Re as SKILL_EDITOR_CLASS, ht as SkillEditor, et as SkillFileCandidateKind, q as SkillFileNodeKind, Ze as SkillFileUploadMode, tt as SkillFileValidationStatus };