@epam/ai-dial-projects 1.3.0-dev.224 → 1.3.0-dev.234

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,241 +1,277 @@
1
- import { MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as e, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as t, PROHIBITED_CONVERSATION_NAME_CHARS_RE as n, PanelEmptyState as r, RequestStatus as i, TextRefinementField as a, buildCssVars as o, getAttachmentTypeFromMime as s, inferMimeTypeFromPath as c, mergeClasses as l, useAvailableHeightCap as ee, useTextRefinement as u } from "@epam/ai-dial-chat-shared";
2
- import { Button as d, ButtonAppearance as te, ButtonDropdown as ne, ButtonVariant as f, CardShell as p, DIAL_ICON_SIZE as m, DIAL_KIT_ICON_STROKE as h, ElementSize as g, ErrorText as _, FileDropzone as v, FolderPath as y, GhostButton as b, Highlight as x, Input as S, Label as re, MenuItemMark as ie, Search as ae, Spinner as oe, Textarea as C } from "@epam/ai-dial-ui-kit";
3
- import { IconArrowNarrowLeft as se, IconArrowsSort as ce, IconPlus as le } from "@tabler/icons-react";
4
- import { Suspense as ue, lazy as w, useCallback as T, useEffect as de, useId as E, useMemo as D, useRef as O, useState as k } from "react";
5
- import { jsx as A, jsxs as j } from "react/jsx-runtime";
6
- import { AttachmentCard as fe, FileDndOverlay as pe } from "@epam/ai-dial-attachment-input";
7
- import { BuilderFormContainer as me } from "@epam/ai-dial-builder-form";
8
- import { LazyMarkdownEditor as M } from "@epam/ai-dial-ui-kit/editors";
1
+ import { MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME as e, MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME as t, MarkdownRenderer as n, PROHIBITED_CONVERSATION_NAME_CHARS_RE as r, PanelEmptyState as i, RequestStatus as a, TextRefinementField as o, buildCssVars as ee, getAttachmentTypeFromMime as s, inferMimeTypeFromPath as c, mergeClasses as l, useAvailableHeightCap as u, useTextRefinement as d } from "@epam/ai-dial-chat-shared";
2
+ import { Button as te, ButtonAppearance as ne, ButtonDropdown as f, ButtonVariant as re, CardShell as p, DIAL_ICON_SIZE as m, DIAL_KIT_ICON_STROKE as h, Dropdown as g, ElementSize as ie, EllipsisTooltip as _, ErrorText as v, FileDropzone as ae, FolderPath as y, GhostButton as b, GhostIconButton as x, Highlight as S, Input as C, Label as w, MenuItemMark as T, NeutralButton as oe, Search as se, Spinner as ce, Textarea as E } from "@epam/ai-dial-ui-kit";
3
+ import { IconArrowNarrowLeft as le, IconArrowsSort as D, IconDotsVertical as ue, IconPin as O, IconPinFilled as k, IconPlus as A } from "@tabler/icons-react";
4
+ import { Suspense as j, lazy as M, memo as N, useCallback as P, useEffect as de, useId as F, useMemo as I, useRef as L, useState as R } from "react";
5
+ import { Fragment as fe, jsx as z, jsxs as B } from "react/jsx-runtime";
6
+ import { AttachmentCard as pe, FileDndOverlay as me } from "@epam/ai-dial-attachment-input";
7
+ import { BuilderFormContainer as he } from "@epam/ai-dial-builder-form";
8
+ import { LazyMarkdownEditor as ge } from "@epam/ai-dial-ui-kit/editors";
9
9
  //#region src/types/projects-sort-key.ts
10
- var N = /* @__PURE__ */ function(e) {
10
+ var V = /* @__PURE__ */ function(e) {
11
11
  return e.Newest = "newest", e.Oldest = "oldest", e.NameAsc = "name-asc", e;
12
- }({}), he = (e, t) => {
12
+ }({}), _e = (e, t) => {
13
13
  let n = t.trim().toLocaleLowerCase();
14
14
  return n ? e.filter((e) => e.name.toLocaleLowerCase().includes(n)) : e;
15
- }, ge = (e, t, n) => {
15
+ }, H = (e, t, n) => {
16
16
  let r = new Intl.Collator(n, {
17
17
  sensitivity: "base",
18
18
  numeric: !0
19
- }), i = (e, t) => r.compare(e.name, t.name);
20
- if (t === N.NameAsc) return [...e].sort(i);
21
- let a = t === N.Oldest ? 1 : -1;
22
- return [...e].sort((e, t) => e.updatedAt == null && t.updatedAt == null ? i(e, t) : e.updatedAt == null ? 1 : t.updatedAt == null ? -1 : (e.updatedAt - t.updatedAt) * a || i(e, t));
23
- }, P = {
24
- card: "_card_1b611_1",
25
- title: "_title_1b611_5",
26
- footer: "_footer_1b611_9",
27
- path: "_path_1b611_13"
28
- }, F = (e, t) => [e, ...(t ?? "").split("/").filter((e) => e.length > 0)], I = ({ project: e, searchQuery: t, sourceLabel: n, folderPathLabel: r, titleClassName: i, pathLabelClassName: a, pathLeafClassName: o }) => /* @__PURE__ */ A("li", {
29
- className: "flex min-w-0",
30
- children: /* @__PURE__ */ j(p, {
31
- "aria-label": e.name,
32
- className: l("flex w-full min-w-0 flex-col gap-3", P.card),
33
- children: [/* @__PURE__ */ A(x, {
34
- text: e.name,
35
- query: t,
36
- maxLines: 1,
37
- className: l("min-w-0", i, P.title)
38
- }), /* @__PURE__ */ A(y, {
39
- segments: F(n, e.parentPath),
40
- ariaLabel: r,
41
- labelClassName: l(a, P.path),
42
- leafClassName: l(o, P.path),
43
- className: l("mt-auto pt-3", P.footer)
44
- })]
45
- })
46
- }), L = {
19
+ }), i = (e, t) => r.compare(e.name, t.name), a = (e, t) => Number(t.isPinned ?? !1) - Number(e.isPinned ?? !1);
20
+ if (t === V.NameAsc) return [...e].sort((e, t) => a(e, t) || i(e, t));
21
+ let o = t === V.Oldest ? 1 : -1;
22
+ return [...e].sort((e, t) => {
23
+ let n = a(e, t);
24
+ return n === 0 ? e.updatedAt == null && t.updatedAt == null ? i(e, t) : e.updatedAt == null ? 1 : t.updatedAt == null ? -1 : (e.updatedAt - t.updatedAt) * o || i(e, t) : n;
25
+ });
26
+ }, U = {
27
+ card: "_card_175or_1",
28
+ title: "_title_175or_5",
29
+ footer: "_footer_175or_9",
30
+ path: "_path_175or_13",
31
+ pin: "_pin_175or_17",
32
+ link: "_link_175or_23",
33
+ aboveLink: "_aboveLink_175or_39",
34
+ interactive: "_interactive_175or_44"
35
+ }, ve = (e, t) => [e, ...(t ?? "").split("/").filter((e) => e.length > 0)], ye = (e) => e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, W = ({ project: e, searchQuery: t, sourceLabel: n, folderPathLabel: r, pinnedLabel: i, href: a, onOpen: o, titleClassName: ee, pathLabelClassName: s, pathLeafClassName: c }) => {
36
+ let u = /* @__PURE__ */ z(S, {
37
+ text: e.name,
38
+ query: t,
39
+ maxLines: 1,
40
+ className: l("min-w-0", ee, U.title, a != null && U.aboveLink)
41
+ });
42
+ return /* @__PURE__ */ z("li", {
43
+ className: "flex min-w-0",
44
+ children: /* @__PURE__ */ B(p, {
45
+ "aria-label": e.name,
46
+ className: l("relative flex w-full min-w-0 flex-col gap-3", U.card, a != null && U.interactive),
47
+ children: [/* @__PURE__ */ B("div", {
48
+ className: "flex min-w-0 items-center gap-2",
49
+ children: [a == null ? /* @__PURE__ */ z("div", {
50
+ className: "min-w-0 flex-1",
51
+ children: u
52
+ }) : /* @__PURE__ */ z("a", {
53
+ href: a,
54
+ onClick: (t) => {
55
+ o != null && ye(t) && (t.preventDefault(), o(e.id));
56
+ },
57
+ className: l("min-w-0 flex-1", U.link),
58
+ children: u
59
+ }), e.isPinned && /* @__PURE__ */ B("span", {
60
+ className: l("shrink-0", U.pin),
61
+ children: [/* @__PURE__ */ z(k, {
62
+ size: m.SM,
63
+ "aria-hidden": !0
64
+ }), /* @__PURE__ */ z("span", {
65
+ className: "sr-only",
66
+ children: i
67
+ })]
68
+ })]
69
+ }), /* @__PURE__ */ z(y, {
70
+ segments: ve(n, e.parentPath),
71
+ ariaLabel: r,
72
+ labelClassName: l(s, U.path),
73
+ leafClassName: l(c, U.path),
74
+ className: l("mt-auto pt-3", U.footer, a != null && U.aboveLink)
75
+ })]
76
+ })
77
+ });
78
+ }, G = {
47
79
  container: "_container_4rer8_1",
48
80
  subtitle: "_subtitle_4rer8_5",
49
81
  sortButton: "_sortButton_4rer8_9"
50
- }, R = ({ projects: e, isLoading: t = !1, hasError: n = !1, incompleteSources: i = [], onRetry: a, onCreateProject: s, searchQuery: c, onSearchQueryChange: ee, sortKey: u, onSortKeyChange: p, labels: _, locale: v, styles: y }) => {
51
- let { colors: x, typography: S } = y ?? {}, re = S?.titleClassName ?? "dial-h1-text", C = S?.subtitleClassName ?? "dial-body-text", se = S?.cardTitleClassName ?? "dial-body-semi-text", ue = S?.pathLabelClassName ?? "dial-tiny-text", w = S?.pathLeafClassName ?? "dial-tiny-semi-text", T = o({
52
- "--pr-bg": x?.background,
53
- "--pr-subtitle-text": x?.subtitleText,
54
- "--pr-sort-text": x?.sortButtonText,
55
- "--pr-card-bg": x?.cardBackground,
56
- "--pr-card-title-text": x?.cardTitleText,
57
- "--pr-card-divider": x?.cardDivider,
58
- "--pr-path-text": x?.pathText
59
- }), de = c.trim(), E = i.length > 0, O = E && e.length === 0, k = D(() => ge(he(e, c), u, v), [
82
+ }, be = ({ projects: e, isLoading: t = !1, hasError: n = !1, incompleteSources: r = [], onRetry: a, onCreateProject: o, onOpenProject: s, getProjectHref: c, searchQuery: u, onSearchQueryChange: d, sortKey: p, onSortKeyChange: g, labels: _, locale: v, styles: ae }) => {
83
+ let { colors: y, typography: x } = ae ?? {}, S = x?.titleClassName ?? "dial-h1-text", C = x?.subtitleClassName ?? "dial-body-text", w = x?.cardTitleClassName ?? "dial-body-semi-text", oe = x?.pathLabelClassName ?? "dial-tiny-text", E = x?.pathLeafClassName ?? "dial-tiny-semi-text", le = ee({
84
+ "--pr-bg": y?.background,
85
+ "--pr-subtitle-text": y?.subtitleText,
86
+ "--pr-sort-text": y?.sortButtonText,
87
+ "--pr-card-bg": y?.cardBackground,
88
+ "--pr-card-hover-bg": y?.cardHoverBackground,
89
+ "--pr-card-title-text": y?.cardTitleText,
90
+ "--pr-card-divider": y?.cardDivider,
91
+ "--pr-path-text": y?.pathText
92
+ }), ue = u.trim(), O = r.length > 0, k = O && e.length === 0, j = I(() => H(_e(e, u), p, v), [
60
93
  e,
61
- c,
62
94
  u,
95
+ p,
63
96
  v
64
- ]), fe = _.sortOptions.find((e) => e.value === u)?.label ?? _.sortLabel, pe = D(() => _.sortOptions.map((e) => ({
97
+ ]), M = _.sortOptions.find((e) => e.value === p)?.label ?? _.sortLabel, N = I(() => _.sortOptions.map((e) => ({
65
98
  key: e.value,
66
99
  label: e.label,
67
- mark: ie.Check,
68
- checked: e.value === u,
69
- onClick: () => p(e.value)
100
+ mark: T.Check,
101
+ checked: e.value === p,
102
+ onClick: () => g(e.value)
70
103
  })), [
71
104
  _.sortOptions,
72
- u,
73
- p
74
- ]), me = (e) => {
75
- ee(e ?? "");
76
- }, M = () => {
77
- if (!t) return n ? _.errorLabel : E ? _.incompleteLabel : e.length === 0 ? _.emptyStateLabel : k.length === 0 ? _.noResultsLabel : _.resultCountLabel(k.length);
78
- }, N = () => s ? /* @__PURE__ */ A(d, {
105
+ p,
106
+ g
107
+ ]), P = (e) => {
108
+ d(e ?? "");
109
+ }, de = () => {
110
+ if (!t) return n ? _.errorLabel : O ? _.incompleteLabel : e.length === 0 ? _.emptyStateLabel : j.length === 0 ? _.noResultsLabel : _.resultCountLabel(j.length);
111
+ }, F = () => o ? /* @__PURE__ */ z(te, {
79
112
  label: _.createProjectLabel,
80
- variant: f.Primary,
81
- iconBefore: /* @__PURE__ */ A(le, {
113
+ variant: re.Primary,
114
+ iconBefore: /* @__PURE__ */ z(A, {
82
115
  size: m.SM,
83
116
  stroke: h,
84
117
  "aria-hidden": !0
85
118
  }),
86
- onClick: s,
119
+ onClick: o,
87
120
  className: "shrink-0"
88
- }) : void 0, P = () => t ? /* @__PURE__ */ A(oe, {}) : n || O ? /* @__PURE__ */ j("div", {
121
+ }) : void 0, L = () => t ? /* @__PURE__ */ z(ce, {}) : n || k ? /* @__PURE__ */ B("div", {
89
122
  className: "flex flex-col items-center gap-3",
90
- children: [/* @__PURE__ */ A("p", {
91
- className: l(C, L.subtitle),
123
+ children: [/* @__PURE__ */ z("p", {
124
+ className: l(C, G.subtitle),
92
125
  children: n ? _.errorLabel : _.incompleteLabel
93
- }), /* @__PURE__ */ A(b, {
126
+ }), /* @__PURE__ */ z(b, {
94
127
  label: _.retryLabel,
95
128
  onClick: a
96
129
  })]
97
- }) : e.length === 0 ? /* @__PURE__ */ A(r, {
130
+ }) : e.length === 0 ? /* @__PURE__ */ z(i, {
98
131
  label: _.emptyStateLabel,
99
132
  description: _.emptyStateDescription,
100
- action: N()
101
- }) : k.length === 0 ? /* @__PURE__ */ A(r, { label: _.noResultsLabel }) : /* @__PURE__ */ A("ul", {
133
+ action: F()
134
+ }) : j.length === 0 ? /* @__PURE__ */ z(i, { label: _.noResultsLabel }) : /* @__PURE__ */ z("ul", {
102
135
  className: "m-0 grid w-full max-w-[1116px] min-w-0 list-none grid-cols-1 gap-5 p-0 desktop:grid-cols-3",
103
- children: k.map((e) => /* @__PURE__ */ A(I, {
136
+ children: j.map((e) => /* @__PURE__ */ z(W, {
104
137
  project: e,
105
- searchQuery: de,
138
+ searchQuery: ue,
106
139
  sourceLabel: _.sourceLabels[e.source],
107
140
  folderPathLabel: _.folderPathLabel,
108
- titleClassName: se,
109
- pathLabelClassName: ue,
110
- pathLeafClassName: w
141
+ pinnedLabel: _.pinnedLabel ?? "Pinned",
142
+ href: c?.(e.id),
143
+ onOpen: s,
144
+ titleClassName: w,
145
+ pathLabelClassName: oe,
146
+ pathLeafClassName: E
111
147
  }, e.id))
112
- }), F = t || n || k.length === 0;
113
- return /* @__PURE__ */ j("div", {
114
- style: T,
115
- className: l("flex h-full w-full min-w-0 flex-col gap-4 overflow-y-auto px-4 py-4 desktop:gap-6 desktop:px-8", L.container),
148
+ }), R = t || n || j.length === 0;
149
+ return /* @__PURE__ */ B("div", {
150
+ style: le,
151
+ className: l("flex h-full w-full min-w-0 flex-col gap-4 overflow-y-auto px-4 py-4 desktop:gap-6 desktop:px-8", G.container),
116
152
  children: [
117
- /* @__PURE__ */ j("div", {
153
+ /* @__PURE__ */ B("div", {
118
154
  className: "flex min-w-0 items-start justify-between gap-3",
119
- children: [/* @__PURE__ */ j("div", {
155
+ children: [/* @__PURE__ */ B("div", {
120
156
  className: "min-w-0",
121
- children: [/* @__PURE__ */ A("h1", {
122
- className: l("break-words", re),
157
+ children: [/* @__PURE__ */ z("h1", {
158
+ className: l("break-words", S),
123
159
  children: _.title
124
- }), /* @__PURE__ */ A("p", {
125
- className: l("mt-1", C, L.subtitle),
160
+ }), /* @__PURE__ */ z("p", {
161
+ className: l("mt-1", C, G.subtitle),
126
162
  children: _.subtitle
127
163
  })]
128
- }), N()]
164
+ }), F()]
129
165
  }),
130
- /* @__PURE__ */ j("div", {
166
+ /* @__PURE__ */ B("div", {
131
167
  className: "flex flex-col gap-3 desktop:flex-row desktop:items-center",
132
- children: [/* @__PURE__ */ A("div", {
168
+ children: [/* @__PURE__ */ z("div", {
133
169
  role: "search",
134
170
  className: "min-w-0 flex-1",
135
- children: /* @__PURE__ */ A(ae, {
136
- value: c,
137
- onChange: me,
171
+ children: /* @__PURE__ */ z(se, {
172
+ value: u,
173
+ onChange: P,
138
174
  placeholder: _.searchPlaceholder,
139
175
  clearLabel: _.clearSearchLabel,
140
176
  "aria-label": _.searchAriaLabel,
141
- size: g.Large
177
+ size: ie.Large
142
178
  })
143
- }), _.sortOptions.length > 0 && /* @__PURE__ */ A("div", {
179
+ }), _.sortOptions.length > 0 && /* @__PURE__ */ z("div", {
144
180
  role: "group",
145
181
  "aria-label": _.sortLabel,
146
182
  className: "shrink-0",
147
- children: /* @__PURE__ */ A(ne, {
148
- items: pe,
149
- label: fe,
150
- variant: f.Primary,
151
- appearance: te.Ghost,
152
- iconBefore: /* @__PURE__ */ A(ce, {
183
+ children: /* @__PURE__ */ z(f, {
184
+ items: N,
185
+ label: M,
186
+ variant: re.Primary,
187
+ appearance: ne.Ghost,
188
+ iconBefore: /* @__PURE__ */ z(D, {
153
189
  size: m.SM,
154
190
  "aria-hidden": !0,
155
191
  stroke: h
156
192
  }),
157
- className: L.sortButton
193
+ className: G.sortButton
158
194
  })
159
195
  })]
160
196
  }),
161
- /* @__PURE__ */ A("span", {
197
+ /* @__PURE__ */ z("span", {
162
198
  role: "status",
163
199
  "aria-live": "polite",
164
200
  className: "sr-only",
165
- children: M()
201
+ children: de()
166
202
  }),
167
- E && !t && !n && !O && /* @__PURE__ */ j("div", {
203
+ O && !t && !n && !k && /* @__PURE__ */ B("div", {
168
204
  className: "flex flex-wrap items-center gap-3",
169
- children: [/* @__PURE__ */ A("p", {
170
- className: l(C, L.subtitle),
205
+ children: [/* @__PURE__ */ z("p", {
206
+ className: l(C, G.subtitle),
171
207
  children: _.incompleteLabel
172
- }), /* @__PURE__ */ A(b, {
208
+ }), /* @__PURE__ */ z(b, {
173
209
  label: _.retryLabel,
174
210
  onClick: a
175
211
  })]
176
212
  }),
177
- /* @__PURE__ */ A("div", {
178
- className: l("flex w-full min-w-0 flex-1 flex-col", F && "items-center justify-center"),
179
- children: P()
213
+ /* @__PURE__ */ z("div", {
214
+ className: l("flex w-full min-w-0 flex-1 flex-col", R && "items-center justify-center"),
215
+ children: L()
180
216
  })
181
217
  ]
182
218
  });
183
- }, z = /* @__PURE__ */ function(e) {
219
+ }, xe = /* @__PURE__ */ function(e) {
184
220
  return e.Personal = "personal", e.Shared = "shared", e.Organization = "organization", e;
185
- }({}), B = (e) => !!e.dataTransfer?.types.includes("Files"), _e = (e) => {
186
- let [t, n] = k(!1), r = O(0);
221
+ }({}), K = (e) => !!e.dataTransfer?.types.includes("Files"), Se = (e) => {
222
+ let [t, n] = R(!1), r = L(0);
187
223
  return {
188
224
  isDragActive: t,
189
225
  handlers: {
190
- onDragEnter: T((e) => {
191
- B(e) && (e.preventDefault(), r.current += 1, n(!0));
226
+ onDragEnter: P((e) => {
227
+ K(e) && (e.preventDefault(), r.current += 1, n(!0));
192
228
  }, []),
193
- onDragLeave: T((e) => {
194
- B(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
229
+ onDragLeave: P((e) => {
230
+ K(e) && (--r.current, r.current <= 0 && (r.current = 0, n(!1)));
195
231
  }, []),
196
- onDragOver: T((e) => {
197
- B(e) && e.preventDefault();
232
+ onDragOver: P((e) => {
233
+ K(e) && e.preventDefault();
198
234
  }, []),
199
- onDrop: T((t) => {
200
- if (!B(t)) return;
235
+ onDrop: P((t) => {
236
+ if (!K(t)) return;
201
237
  t.preventDefault(), r.current = 0, n(!1);
202
238
  let i = Array.from(t.dataTransfer?.files ?? []);
203
239
  i.length > 0 && e(i);
204
240
  }, [e])
205
241
  }
206
242
  };
207
- }, V = /* @__PURE__ */ function(e) {
243
+ }, q = /* @__PURE__ */ function(e) {
208
244
  return e.UnsupportedType = "unsupported-type", e.TooLarge = "too-large", e.CapacityExceeded = "capacity-exceeded", e.Duplicate = "duplicate", e.InvalidName = "invalid-name", e;
209
- }({}), H = /* @__PURE__ */ function(e) {
245
+ }({}), J = /* @__PURE__ */ function(e) {
210
246
  return e.Required = "required", e.InvalidCharacters = "invalid-characters", e.Reserved = "reserved", e.TooLong = "too-long", e;
211
- }({}), ve = 255, U = new RegExp(n.source, "u"), ye = /[\p{Cc}‎‏‪-‮⁦-⁩]/u, be = /* @__PURE__ */ new Set([
247
+ }({}), Ce = 255, Y = new RegExp(r.source, "u"), we = /[\p{Cc}‎‏‪-‮⁦-⁩]/u, Te = /* @__PURE__ */ new Set([
212
248
  ".",
213
249
  "..",
214
250
  "v",
215
251
  "files",
216
252
  ".dial-resource",
217
253
  ".dial-folder"
218
- ]), xe = (e) => new TextEncoder().encode(e).length, Se = (e) => {
254
+ ]), Ee = (e) => new TextEncoder().encode(e).length, De = (e) => {
219
255
  let t = e.trim();
220
- return t.length === 0 ? H.Required : xe(t) > 255 ? H.TooLong : U.test(t) || ye.test(t) ? H.InvalidCharacters : be.has(t) ? H.Reserved : null;
221
- }, W = (e) => {
256
+ return t.length === 0 ? J.Required : Ee(t) > 255 ? J.TooLong : Y.test(t) || we.test(t) ? J.InvalidCharacters : Te.has(t) ? J.Reserved : null;
257
+ }, X = (e) => {
222
258
  let t = e.lastIndexOf(".");
223
259
  return t > 0 ? e.slice(t + 1).toLowerCase() : "";
224
- }, Ce = (e) => e.reduce((e, t) => e + t.file.size, 0), G = 0, we = () => (G += 1, `project-context-${Date.now()}-${G}`), Te = (e) => {
260
+ }, Oe = (e) => "isStored" in e && e.isStored, ke = (e) => Oe(e) ? e.size : e.file.size, Ae = (e) => e.reduce((e, t) => e + ke(t), 0), je = 0, Me = () => (je += 1, `project-context-${Date.now()}-${je}`), Ne = (e) => {
225
261
  let t = e.type || c(e.name) || "application/octet-stream";
226
262
  return {
227
- id: we(),
263
+ id: Me(),
228
264
  name: e.name,
229
265
  contentType: t,
230
266
  type: s(t),
231
- status: i.Idle,
267
+ status: a.Idle,
232
268
  file: e
233
269
  };
234
- }, K = (e, t, n, r) => Se(e.name) != null || e.name.trim() !== e.name ? V.InvalidName : r.allowedExtensions.includes(W(e.name)) ? t.has(e.name) ? V.Duplicate : e.size > r.maxFileBytes ? V.TooLarge : n + e.size > r.maxTotalBytes ? V.CapacityExceeded : null : V.UnsupportedType, Ee = (e, t, n) => {
235
- let r = new Set(t.map((e) => e.name)), i = Ce(t), a = [], o = [];
270
+ }, Pe = (e, t, n, r) => De(e.name) != null || e.name.trim() !== e.name ? q.InvalidName : r.allowedExtensions.includes(X(e.name)) ? t.has(e.name) ? q.Duplicate : e.size > r.maxFileBytes ? q.TooLarge : n + e.size > r.maxTotalBytes ? q.CapacityExceeded : null : q.UnsupportedType, Fe = (e, t, n) => {
271
+ let r = new Set(t.map((e) => e.name)), i = Ae(t), a = [], o = [];
236
272
  for (let t of e) {
237
- let e = K(t, r, i, n);
238
- e == null ? (r.add(t.name), i += t.size, a.push(Te(t))) : o.push({
273
+ let e = Pe(t, r, i, n);
274
+ e == null ? (r.add(t.name), i += t.size, a.push(Ne(t))) : o.push({
239
275
  name: t.name,
240
276
  reason: e
241
277
  });
@@ -244,38 +280,42 @@ var N = /* @__PURE__ */ function(e) {
244
280
  accepted: a,
245
281
  rejected: o
246
282
  };
247
- }, q = (e, t) => t <= 0 ? 100 : Math.min(100, Math.max(0, Math.round(e / t * 100))), J = {
283
+ }, Ie = (e, t) => e <= 0 ? 0 : t <= 0 ? 100 : Math.min(100, Math.max(1, Math.round(e / t * 100))), Z = (e, t) => {
284
+ let n = t.trim().toLowerCase();
285
+ return n === "" ? e : e.filter((e) => e.name.toLowerCase().includes(n));
286
+ }, Q = {
248
287
  track: "_track_15unh_1",
249
288
  fill: "_fill_15unh_5",
250
289
  text: "_text_15unh_9"
251
- }, De = ({ usedBytes: e, maxBytes: t, ariaLabel: n, formatLabel: r, textClassName: i = "dial-tiny-text" }) => {
290
+ }, Le = ({ usedBytes: e, maxBytes: t, ariaLabel: n, formatLabel: r, textClassName: i = "dial-tiny-text" }) => {
252
291
  if (e <= 0) return null;
253
- let a = q(e, t), o = r(a);
254
- return /* @__PURE__ */ j("div", {
255
- className: "flex flex-col gap-1",
256
- children: [/* @__PURE__ */ A("div", {
292
+ let a = Ie(e, t), o = r(a);
293
+ return /* @__PURE__ */ B("div", {
294
+ className: "flex min-w-0 items-center gap-2",
295
+ children: [/* @__PURE__ */ z("div", {
257
296
  role: "meter",
258
297
  "aria-label": n,
259
298
  "aria-valuemin": 0,
260
299
  "aria-valuemax": t,
261
300
  "aria-valuenow": Math.min(e, t),
262
301
  "aria-valuetext": o,
263
- className: l("h-1 w-full overflow-hidden rounded-full", J.track),
264
- children: /* @__PURE__ */ A("div", {
265
- className: l("h-full rounded-full", J.fill),
302
+ className: l("h-1 w-[60px] shrink-0 overflow-hidden rounded-full", Q.track),
303
+ children: /* @__PURE__ */ z("div", {
304
+ className: l("h-full rounded-full", Q.fill),
266
305
  style: { width: `${a}%` }
267
306
  })
268
- }), /* @__PURE__ */ A("span", {
307
+ }), /* @__PURE__ */ z("span", {
269
308
  "aria-hidden": !0,
270
- className: l(i, J.text),
309
+ className: l("whitespace-nowrap", i, Q.text),
271
310
  children: o
272
311
  })]
273
312
  });
274
- }, Oe = {
275
- formColumn: "_formColumn_16edi_1",
276
- helper: "_helper_16edi_10"
277
- }, ke = w(async () => ({ default: (await M()).MarkdownEditor })), Ae = "device", je = "file-manager", Y = ({ values: n, errors: r, onFieldChange: i, contextFiles: s, onContextFilesChange: c, allowedExtensions: d, maxFileBytes: p, maxTotalBytes: g, onPickFromFileManager: y, onRefineDescription: b, onRefineInstructions: x, onBack: ie, onCancel: ae, onSubmit: ce, isSubmitting: w = !1, labels: M, markdownEditorTheme: N, className: he, styles: ge }) => {
278
- let P = E(), F = E(), I = E(), L = E(), R = E(), z = O(null), B = O(null), V = ee(), [H, ve] = k(!1), [U, ye] = k([]), [be, xe] = k(""), W = O(void 0), G = T((e) => e ? async (t, n) => {
313
+ }, Re = {
314
+ formColumn: "_formColumn_1fxsc_1",
315
+ helper: "_helper_1fxsc_10",
316
+ label: "_label_1fxsc_14"
317
+ }, ze = M(async () => ({ default: (await ge()).MarkdownEditor })), Be = "device", Ve = "file-manager", He = ({ values: n, errors: r, onFieldChange: i, contextFiles: a, onContextFilesChange: s, allowedExtensions: c, maxFileBytes: te, maxTotalBytes: ne, onPickFromFileManager: p, onRefineDescription: g, onRefineInstructions: _, onBack: y, onCancel: b, onSubmit: x, isSubmitting: S = !1, labels: T, markdownEditorTheme: oe, className: se, styles: D }) => {
318
+ let ue = F(), O = F(), k = F(), A = F(), M = F(), N = L(null), fe = L(null), ge = u(), [V, _e] = R(!1), [H, U] = R([]), [ve, ye] = R(""), W = L(void 0), G = P((e) => e ? async (t, n) => {
279
319
  if (W.current && !W.current.aborted) throw new DOMException("Busy", "AbortError");
280
320
  W.current = n;
281
321
  try {
@@ -283,251 +323,473 @@ var N = /* @__PURE__ */ function(e) {
283
323
  } finally {
284
324
  W.current === n && (W.current = void 0);
285
325
  }
286
- } : void 0, []), we = D(() => G(b), [G, b]), Te = D(() => G(x), [G, x]), K = u({
326
+ } : void 0, []), be = I(() => G(g), [G, g]), xe = I(() => G(_), [G, _]), K = d({
287
327
  value: n.description,
288
328
  onChange: (e) => i("description", e),
289
- onRefine: we,
290
- disabled: w
291
- }), q = u({
329
+ onRefine: be,
330
+ disabled: S
331
+ }), q = d({
292
332
  value: n.instructions,
293
333
  onChange: (e) => i("instructions", e),
294
- onRefine: Te,
295
- disabled: w
296
- }), J = K.isPending || q.isPending, Y = Se(n.name), X = r.name ?? (H && Y != null ? M.nameErrors[Y] : void 0), Me = Y != null || w || J;
334
+ onRefine: xe,
335
+ disabled: S
336
+ }), J = K.isPending || q.isPending, Ce = De(n.name), Y = r.name ?? (V && Ce != null ? T.nameErrors[Ce] : void 0), we = Ce != null || S || J;
297
337
  de(() => {
298
- r.name && z.current?.focus();
338
+ r.name && N.current?.focus();
299
339
  }, [r.name]);
300
- let Ne = D(() => Ce(s), [s]), Pe = D(() => d.map((e) => `.${e}`).join(","), [d]), Z = (e) => {
340
+ let Te = I(() => Ae(a), [a]), Ee = I(() => c.map((e) => `.${e}`).join(","), [c]), X = (e) => {
301
341
  if (e.length === 0) return;
302
- let { accepted: t, rejected: n } = Ee(e, s, {
303
- allowedExtensions: d,
304
- maxFileBytes: p,
305
- maxTotalBytes: g
342
+ let { accepted: t, rejected: n } = Fe(e, a, {
343
+ allowedExtensions: c,
344
+ maxFileBytes: te,
345
+ maxTotalBytes: ne
306
346
  });
307
- ye(n), t.length > 0 && c([...s, ...t]), xe([t.length > 0 ? M.filesAddedStatus(t.length) : "", ...n.map(({ name: e, reason: t }) => M.fileRejections[t](e))].filter(Boolean).join(" "));
308
- }, { isDragActive: Fe, handlers: Ie } = _e(Z), Le = (e) => {
309
- let t = s.find((t) => t.id === e);
310
- c(s.filter((t) => t.id !== e)), ye([]), t && xe(M.fileRemovedStatus(t.name));
311
- }, Re = (e) => {
312
- Z(Array.from(e.target.files ?? [])), e.target.value = "";
313
- }, ze = async () => {
314
- if (y) try {
315
- let e = await y();
316
- e && Z(e);
347
+ U(n), t.length > 0 && s([...a, ...t]), ye([t.length > 0 ? T.filesAddedStatus(t.length) : "", ...n.map(({ name: e, reason: t }) => T.fileRejections[t](e))].filter(Boolean).join(" "));
348
+ }, { isDragActive: Oe, handlers: ke } = Se(X), je = (e) => {
349
+ let t = a.find((t) => t.id === e);
350
+ s(a.filter((t) => t.id !== e)), U([]), t && ye(T.fileRemovedStatus(t.name));
351
+ }, Me = (e) => {
352
+ X(Array.from(e.target.files ?? [])), e.target.value = "";
353
+ }, Ne = async () => {
354
+ if (p) try {
355
+ let e = await p();
356
+ e && X(e);
317
357
  } catch {}
318
- }, Be = [{
319
- key: Ae,
320
- label: M.addFromDeviceLabel,
321
- onClick: () => B.current?.click()
322
- }, ...y ? [{
323
- key: je,
324
- label: M.addFromFileManagerLabel,
325
- onClick: () => void ze()
326
- }] : []], Ve = () => {
327
- !Me && (!W.current || W.current.aborted) && ce();
328
- }, { colors: Q, typography: He } = ge ?? {}, Ue = He?.titleClassName ?? "dial-h1-text", $ = He?.labelClassName ?? "dial-body-semi-text", We = He?.helperClassName ?? "dial-tiny-text", Ge = o({
329
- "--pcf-helper-text": Q?.helperText,
330
- "--pcf-meter-track": Q?.meterTrack,
331
- "--pcf-meter-fill": Q?.meterFill
332
- }), Ke = M.refinement, qe = r.context, Je = !!qe;
333
- return /* @__PURE__ */ j("div", {
334
- className: l("relative flex h-full min-h-0 w-full", he),
335
- ...Ie,
358
+ }, Pe = [{
359
+ key: Be,
360
+ label: T.addFromDeviceLabel,
361
+ onClick: () => fe.current?.click()
362
+ }, ...p ? [{
363
+ key: Ve,
364
+ label: T.addFromFileManagerLabel,
365
+ onClick: () => void Ne()
366
+ }] : []], Ie = () => {
367
+ !we && (!W.current || W.current.aborted) && x();
368
+ }, { colors: Z, typography: Q } = D ?? {}, He = Q?.titleClassName ?? "dial-h1-text", $ = l(Q?.labelClassName ?? "dial-tiny-semi-text", Re.label), Ue = Q?.helperClassName ?? "dial-tiny-text", We = ee({
369
+ "--pcf-helper-text": Z?.helperText,
370
+ "--pcf-label-text": Z?.labelText,
371
+ "--pcf-meter-track": Z?.meterTrack,
372
+ "--pcf-meter-fill": Z?.meterFill
373
+ }), Ge = T.refinement, Ke = r.context, qe = !!Ke;
374
+ return /* @__PURE__ */ B("div", {
375
+ className: l("relative flex h-full min-h-0 w-full", se),
376
+ ...ke,
336
377
  children: [
337
- /* @__PURE__ */ A(pe, {
338
- isVisible: Fe,
378
+ /* @__PURE__ */ z(me, {
379
+ isVisible: Oe,
339
380
  labels: {
340
- title: M.dropOverlayTitle,
341
- subtitle: M.dropOverlaySubtitle
381
+ title: T.dropOverlayTitle,
382
+ subtitle: T.dropOverlaySubtitle
342
383
  }
343
384
  }),
344
- /* @__PURE__ */ A(me, {
385
+ /* @__PURE__ */ z(he, {
345
386
  labels: {
346
- title: M.title,
347
- backButtonLabel: M.backLabel,
348
- cancelButtonLabel: M.cancelLabel,
349
- submitButtonLabel: M.createLabel,
350
- submittingLabel: M.submittingLabel ?? M.createLabel
387
+ title: T.title,
388
+ backButtonLabel: T.backLabel,
389
+ cancelButtonLabel: T.cancelLabel,
390
+ submitButtonLabel: T.createLabel,
391
+ submittingLabel: T.submittingLabel ?? T.createLabel
351
392
  },
352
- onBack: ie,
353
- onCancel: ae,
354
- onSubmit: Ve,
355
- isCancelDisabled: w,
356
- isSubmitDisabled: Me,
357
- isSubmitting: w,
358
- backIcon: /* @__PURE__ */ A(se, {
393
+ onBack: y,
394
+ onCancel: b,
395
+ onSubmit: Ie,
396
+ isCancelDisabled: S,
397
+ isSubmitDisabled: we,
398
+ isSubmitting: S,
399
+ backIcon: /* @__PURE__ */ z(le, {
359
400
  size: m.LG,
360
401
  stroke: h,
361
402
  "aria-hidden": !0,
362
403
  className: "rtl:scale-x-[-1]"
363
404
  }),
364
405
  styles: {
365
- colors: { background: Q?.background },
406
+ colors: { background: Z?.background },
366
407
  header: {
367
- colors: { borderColor: Q?.headerBorder },
368
- typography: { fontClassName: Ue }
408
+ colors: { borderColor: Z?.headerBorder },
409
+ typography: { fontClassName: He }
369
410
  },
370
- cssVars: Ge
411
+ cssVars: We
371
412
  },
372
- children: /* @__PURE__ */ j("div", {
373
- className: l("mx-auto flex w-full max-w-[996px] min-w-0 flex-col gap-5 py-6", Oe.formColumn),
413
+ children: /* @__PURE__ */ B("div", {
414
+ className: l("mx-auto flex w-full max-w-[1040px] min-w-0 flex-col gap-5 py-6", Re.formColumn),
374
415
  children: [
375
- /* @__PURE__ */ j("div", {
416
+ /* @__PURE__ */ B("div", {
376
417
  className: "flex flex-col gap-1",
377
- children: [/* @__PURE__ */ A(S, {
378
- id: P,
379
- inputRef: z,
418
+ children: [/* @__PURE__ */ z(C, {
419
+ id: ue,
420
+ inputRef: N,
380
421
  value: n.name,
381
422
  onChange: (e) => i("name", e ?? ""),
382
- onBlur: () => ve(!0),
383
- placeholder: M.namePlaceholder,
423
+ onBlur: () => _e(!0),
424
+ placeholder: T.namePlaceholder,
384
425
  labelProps: {
385
- label: M.nameLabel,
426
+ label: T.nameLabel,
386
427
  required: !0
387
428
  },
388
429
  required: !0,
389
430
  "aria-required": !0,
390
- invalid: !!X,
391
- "aria-invalid": !!X,
392
- "aria-describedby": X ? F : void 0
393
- }), X && /* @__PURE__ */ A(_, {
394
- id: F,
431
+ invalid: !!Y,
432
+ "aria-invalid": !!Y,
433
+ "aria-describedby": Y ? O : void 0
434
+ }), Y && /* @__PURE__ */ z(v, {
435
+ id: O,
395
436
  role: r.name ? "alert" : void 0,
396
- className: We,
397
- text: X
437
+ className: Ue,
438
+ text: Y
398
439
  })]
399
440
  }),
400
- /* @__PURE__ */ A(a, {
401
- isEnabled: !!b,
402
- fieldId: I,
403
- label: M.descriptionLabel,
441
+ /* @__PURE__ */ z(o, {
442
+ isEnabled: !!g,
443
+ fieldId: k,
444
+ label: T.descriptionLabel,
404
445
  labelClassName: $,
405
- labels: Ke,
446
+ labels: Ge,
406
447
  refinement: K,
407
- disabled: w || J,
408
- children: /* @__PURE__ */ A(C, {
409
- id: I,
448
+ disabled: S || J,
449
+ children: /* @__PURE__ */ z(E, {
450
+ id: k,
410
451
  value: n.description,
411
452
  onChange: (e) => {
412
453
  K.reset(), i("description", e);
413
454
  },
414
- placeholder: M.descriptionPlaceholder,
415
- labelProps: b ? void 0 : { label: M.descriptionLabel }
455
+ placeholder: T.descriptionPlaceholder,
456
+ labelProps: g ? void 0 : { label: T.descriptionLabel }
416
457
  })
417
458
  }),
418
- /* @__PURE__ */ A(a, {
419
- isEnabled: !!x,
420
- fieldId: L,
421
- label: M.instructionsLabel,
459
+ /* @__PURE__ */ z(o, {
460
+ isEnabled: !!_,
461
+ fieldId: A,
462
+ label: T.instructionsLabel,
422
463
  labelClassName: $,
423
- labels: Ke,
464
+ labels: Ge,
424
465
  refinement: q,
425
- disabled: w || J,
426
- children: /* @__PURE__ */ j("div", {
427
- className: "flex flex-1 flex-col gap-1",
428
- children: [!x && /* @__PURE__ */ A(re, {
429
- htmlFor: L,
466
+ disabled: S || J,
467
+ children: /* @__PURE__ */ B("div", {
468
+ className: "flex flex-1 flex-col gap-2",
469
+ children: [!_ && /* @__PURE__ */ z(w, {
470
+ htmlFor: A,
430
471
  className: $,
431
- label: M.instructionsLabel
432
- }), /* @__PURE__ */ A("div", {
433
- ref: V,
472
+ label: T.instructionsLabel
473
+ }), /* @__PURE__ */ z("div", {
474
+ ref: ge,
434
475
  className: l("w-full", e, t),
435
- children: /* @__PURE__ */ A(ue, {
436
- fallback: /* @__PURE__ */ A(oe, {}),
437
- children: /* @__PURE__ */ A(ke, {
438
- id: L,
476
+ children: /* @__PURE__ */ z(j, {
477
+ fallback: /* @__PURE__ */ z(ce, {}),
478
+ children: /* @__PURE__ */ z(ze, {
479
+ id: A,
439
480
  value: n.instructions,
440
481
  onChange: (e) => {
441
482
  q.reset(), i("instructions", e);
442
483
  },
443
- height: 360,
444
- theme: N,
445
- placeholder: M.instructionsPlaceholder
484
+ height: 176,
485
+ theme: oe,
486
+ placeholder: T.instructionsPlaceholder
446
487
  })
447
488
  })
448
489
  })]
449
490
  })
450
491
  }),
451
- /* @__PURE__ */ j("section", {
452
- "aria-labelledby": R,
453
- className: "flex flex-col gap-3",
492
+ /* @__PURE__ */ B("section", {
493
+ "aria-labelledby": M,
494
+ className: "flex flex-col gap-2",
454
495
  children: [
455
- /* @__PURE__ */ j("div", {
456
- className: "flex min-w-0 items-center justify-between gap-2",
457
- children: [/* @__PURE__ */ A("h2", {
458
- id: R,
496
+ /* @__PURE__ */ B("div", {
497
+ className: "flex min-w-0 flex-wrap items-center justify-between gap-2",
498
+ children: [/* @__PURE__ */ z("h2", {
499
+ id: M,
459
500
  className: $,
460
- children: M.contextLabel
461
- }), /* @__PURE__ */ A(ne, {
462
- items: Be,
463
- label: M.addLabel,
464
- variant: f.Primary,
465
- appearance: te.Ghost,
466
- disabled: w,
467
- iconBefore: /* @__PURE__ */ A(le, {
468
- size: m.SM,
469
- stroke: h,
470
- "aria-hidden": !0
471
- })
501
+ children: T.contextLabel
502
+ }), /* @__PURE__ */ B("div", {
503
+ className: "flex min-w-0 items-center gap-4",
504
+ children: [/* @__PURE__ */ z(Le, {
505
+ usedBytes: Te,
506
+ maxBytes: ne,
507
+ ariaLabel: T.capacityMeterLabel,
508
+ formatLabel: T.capacityLabel,
509
+ textClassName: Ue
510
+ }), /* @__PURE__ */ z(f, {
511
+ items: Pe,
512
+ label: T.addLabel,
513
+ variant: re.Neutral,
514
+ size: ie.Small,
515
+ disabled: S
516
+ })]
472
517
  })]
473
518
  }),
474
- /* @__PURE__ */ A("input", {
475
- ref: B,
519
+ /* @__PURE__ */ z("input", {
520
+ ref: fe,
476
521
  type: "file",
477
522
  multiple: !0,
478
- accept: Pe,
523
+ accept: Ee,
479
524
  tabIndex: -1,
480
525
  "aria-hidden": !0,
481
526
  className: "sr-only",
482
- onChange: Re
527
+ onChange: Me
483
528
  }),
484
- /* @__PURE__ */ A(v, {
485
- label: M.dropZoneLabel,
486
- description: M.dropZoneHint,
487
- accept: Pe,
529
+ /* @__PURE__ */ z(ae, {
530
+ label: T.dropZoneLabel,
531
+ description: T.dropZoneHint,
532
+ accept: Ee,
488
533
  multiple: !0,
489
- disabled: w,
490
- onChange: Z,
491
- onReject: Z
534
+ disabled: S,
535
+ onChange: X,
536
+ onReject: X
492
537
  }),
493
- (U.length > 0 || Je) && /* @__PURE__ */ j("ul", {
494
- className: l("flex flex-col gap-1", We, Oe.helper),
495
- children: [U.map(({ name: e, reason: t }) => /* @__PURE__ */ A("li", { children: M.fileRejections[t](e) }, `${t}:${e}`)), Je && /* @__PURE__ */ A("li", {
538
+ (H.length > 0 || qe) && /* @__PURE__ */ B("ul", {
539
+ className: l("flex flex-col gap-1", Ue, Re.helper),
540
+ children: [H.map(({ name: e, reason: t }) => /* @__PURE__ */ z("li", { children: T.fileRejections[t](e) }, `${t}:${e}`)), qe && /* @__PURE__ */ z("li", {
496
541
  role: "alert",
497
- children: qe
542
+ children: Ke
498
543
  })]
499
544
  }),
500
- s.length > 0 && /* @__PURE__ */ A("ul", {
501
- className: "flex min-w-0 flex-wrap gap-2",
502
- children: s.map((e) => /* @__PURE__ */ A("li", {
545
+ a.length > 0 && /* @__PURE__ */ z("ul", {
546
+ className: "flex min-w-0 flex-wrap gap-2 pt-1",
547
+ children: a.map((e) => /* @__PURE__ */ z("li", {
503
548
  className: "min-w-0",
504
- children: /* @__PURE__ */ A(fe, {
549
+ children: /* @__PURE__ */ z(pe, {
505
550
  attachment: e,
506
- onRemove: Le,
507
- labels: { removeLabel: M.removeFileLabel(e.name) }
551
+ onRemove: je,
552
+ labels: { removeLabel: T.removeFileLabel(e.name) }
508
553
  })
509
554
  }, e.id))
510
- }),
511
- /* @__PURE__ */ A(De, {
512
- usedBytes: Ne,
513
- maxBytes: g,
514
- ariaLabel: M.capacityMeterLabel,
515
- formatLabel: M.capacityLabel,
516
- textClassName: We
517
555
  })
518
556
  ]
519
557
  })
520
558
  ]
521
559
  })
522
560
  }),
523
- /* @__PURE__ */ A("span", {
561
+ /* @__PURE__ */ z("span", {
524
562
  role: "status",
525
563
  "aria-live": "polite",
526
564
  className: "sr-only",
527
- children: w ? M.creatingStatus : be
565
+ children: S ? T.creatingStatus : ve
528
566
  })
529
567
  ]
530
568
  });
531
- };
569
+ }, $ = {
570
+ container: "_container_16lvl_1",
571
+ header: "_header_16lvl_5",
572
+ title: "_title_16lvl_9",
573
+ body: "_body_16lvl_13",
574
+ secondary: "_secondary_16lvl_17",
575
+ panel: "_panel_16lvl_21"
576
+ }, Ue = (e) => ({
577
+ id: e.name,
578
+ name: e.name,
579
+ contentType: e.contentType,
580
+ type: s(e.contentType),
581
+ status: a.Idle
582
+ }), We = N(({ project: e, isLoading: t = !1, hasError: r = !1, isNotFound: a = !1, isPinned: o, isPinPending: s = !1, contextSearchQuery: c, onContextSearchQueryChange: u, onBack: d, onTogglePin: ne, onPublish: f, onEdit: p, onShare: ie, onDelete: v, onDownload: ae, onOpenFile: y, onRetry: S, onBrowseProjects: C, labels: w, styles: T }) => {
583
+ let { colors: E, typography: D } = T ?? {}, A = D?.titleClassName ?? "dial-h2-text", j = D?.panelTitleClassName ?? "dial-body-semi-text", M = D?.sectionTitleClassName ?? "dial-tiny-text", N = D?.bodyClassName ?? "dial-small-text", P = D?.helperClassName ?? "dial-tiny-text", de = D?.instructionsHeadingClassName ?? "dial-small-semi-text", L = ee({
584
+ "--pv-bg": E?.background,
585
+ "--pv-border": E?.border,
586
+ "--pv-heading-text": E?.headingText,
587
+ "--pv-body-text": E?.bodyText,
588
+ "--pv-secondary-text": E?.secondaryText
589
+ }), R = I(() => e?.contextFiles ?? [], [e]), me = I(() => Z(R, c), [R, c]), he = c.trim(), ge = F(), V = I(() => {
590
+ let e = l("mb-1 mt-3 first:mt-0", de);
591
+ return {
592
+ h1: e,
593
+ h2: e,
594
+ h3: e,
595
+ h4: e,
596
+ h5: e,
597
+ h6: e,
598
+ p: N,
599
+ ul: N,
600
+ ol: N
601
+ };
602
+ }, [N, de]), _e = (e) => {
603
+ let t = [];
604
+ return e && f && t.push({
605
+ key: "publish",
606
+ label: w.publishLabel,
607
+ onClick: f
608
+ }), e && p && t.push({
609
+ key: "edit",
610
+ label: w.editLabel,
611
+ onClick: p
612
+ }), ie && t.push({
613
+ key: "share",
614
+ label: w.shareLabel,
615
+ onClick: ie
616
+ }), t.push({
617
+ key: "download",
618
+ label: w.downloadLabel,
619
+ onClick: ae
620
+ }), v && t.push({
621
+ key: "delete",
622
+ label: w.deleteLabel,
623
+ danger: !0,
624
+ onClick: v
625
+ }), t;
626
+ }, H = (e, t) => /* @__PURE__ */ z("div", {
627
+ className: t,
628
+ children: /* @__PURE__ */ z(g, {
629
+ items: _e(e),
630
+ matchReferenceWidth: !1,
631
+ listClassName: "w-[200px]",
632
+ children: /* @__PURE__ */ z(x, {
633
+ icon: /* @__PURE__ */ z(ue, {
634
+ size: m.MD,
635
+ "aria-hidden": !0,
636
+ stroke: h
637
+ }),
638
+ "aria-label": w.moreActionsLabel
639
+ })
640
+ })
641
+ });
642
+ return t || r || a || e == null ? /* @__PURE__ */ z("div", {
643
+ style: L,
644
+ className: l("flex h-full w-full min-w-0 items-center justify-center p-4", $.container),
645
+ children: t ? /* @__PURE__ */ z(ce, {}) : r ? /* @__PURE__ */ B("div", {
646
+ className: "flex flex-col items-center gap-3",
647
+ children: [/* @__PURE__ */ z("p", {
648
+ role: "alert",
649
+ className: l(N, $.body),
650
+ children: w.errorLabel
651
+ }), /* @__PURE__ */ z(b, {
652
+ label: w.retryLabel,
653
+ onClick: S
654
+ })]
655
+ }) : /* @__PURE__ */ B("div", {
656
+ className: "flex flex-col items-center gap-3",
657
+ children: [/* @__PURE__ */ z("p", {
658
+ role: "alert",
659
+ className: l(N, $.body),
660
+ children: w.notFoundLabel
661
+ }), /* @__PURE__ */ z(b, {
662
+ label: w.browseProjectsLabel,
663
+ onClick: C
664
+ })]
665
+ })
666
+ }) : /* @__PURE__ */ B("div", {
667
+ style: L,
668
+ className: l("flex h-full w-full min-w-0 flex-col overflow-y-auto", $.container),
669
+ children: [/* @__PURE__ */ B("header", {
670
+ className: l("flex min-w-0 items-center gap-2 px-4 py-3 desktop:px-8", $.header),
671
+ children: [
672
+ /* @__PURE__ */ z(x, {
673
+ icon: /* @__PURE__ */ z(le, {
674
+ size: m.LG,
675
+ className: "rtl:scale-x-[-1]",
676
+ "aria-hidden": !0,
677
+ stroke: h
678
+ }),
679
+ "aria-label": w.backLabel,
680
+ onClick: d
681
+ }),
682
+ /* @__PURE__ */ z("h1", {
683
+ className: l("min-w-0 flex-1", A, $.title),
684
+ children: /* @__PURE__ */ z(_, { text: e.name })
685
+ }),
686
+ /* @__PURE__ */ z(x, {
687
+ icon: o ? /* @__PURE__ */ z(k, {
688
+ size: m.MD,
689
+ "aria-hidden": !0
690
+ }) : /* @__PURE__ */ z(O, {
691
+ size: m.MD,
692
+ "aria-hidden": !0,
693
+ stroke: h
694
+ }),
695
+ "aria-label": w.pinLabel,
696
+ "aria-pressed": o,
697
+ "aria-disabled": s || void 0,
698
+ onClick: () => {
699
+ s || ne();
700
+ }
701
+ }),
702
+ f && /* @__PURE__ */ z(oe, {
703
+ label: w.publishLabel,
704
+ onClick: f,
705
+ className: "hidden shrink-0 desktop:inline-flex"
706
+ }),
707
+ p && /* @__PURE__ */ z(te, {
708
+ label: w.editLabel,
709
+ variant: re.Primary,
710
+ onClick: p,
711
+ className: "hidden shrink-0 desktop:inline-flex"
712
+ }),
713
+ H(!1, "hidden desktop:block"),
714
+ H(!0, "desktop:hidden")
715
+ ]
716
+ }), /* @__PURE__ */ z("div", {
717
+ className: "flex min-w-0 flex-1 flex-col desktop:flex-row desktop:justify-end",
718
+ children: /* @__PURE__ */ B("aside", {
719
+ "aria-labelledby": ge,
720
+ className: l("flex w-full min-w-0 flex-col gap-5 border-t px-4 py-6 desktop:w-[488px] desktop:shrink-0 desktop:border-s desktop:border-t-0 desktop:px-8", $.panel),
721
+ children: [
722
+ /* @__PURE__ */ z("h2", {
723
+ id: ge,
724
+ className: l(j, $.title),
725
+ children: w.detailsLabel
726
+ }),
727
+ e.description !== "" && /* @__PURE__ */ B("section", {
728
+ className: "flex min-w-0 flex-col gap-1",
729
+ children: [/* @__PURE__ */ z("h3", {
730
+ className: l(M, $.secondary),
731
+ children: w.descriptionLabel
732
+ }), /* @__PURE__ */ z("p", {
733
+ className: l("break-words whitespace-pre-line", N, $.body),
734
+ children: e.description
735
+ })]
736
+ }),
737
+ e.instructions !== "" && /* @__PURE__ */ B("section", {
738
+ className: "flex min-w-0 flex-col gap-1",
739
+ children: [/* @__PURE__ */ z("h3", {
740
+ className: l(M, $.secondary),
741
+ children: w.instructionsLabel
742
+ }), /* @__PURE__ */ z("div", {
743
+ className: l("min-w-0 break-words", N, $.body),
744
+ children: /* @__PURE__ */ z(n, {
745
+ content: e.instructions,
746
+ classNames: V
747
+ })
748
+ })]
749
+ }),
750
+ /* @__PURE__ */ B("section", {
751
+ className: "flex min-w-0 flex-col gap-2",
752
+ children: [/* @__PURE__ */ z("h3", {
753
+ className: l(M, $.secondary),
754
+ children: w.contextLabel
755
+ }), R.length === 0 ? /* @__PURE__ */ z(i, { label: w.emptyContextLabel }) : /* @__PURE__ */ B(fe, { children: [
756
+ /* @__PURE__ */ z("div", {
757
+ role: "search",
758
+ children: /* @__PURE__ */ z(se, {
759
+ value: c,
760
+ onChange: (e) => u(e ?? ""),
761
+ placeholder: w.contextSearchPlaceholder,
762
+ clearLabel: w.clearSearchLabel,
763
+ "aria-label": w.contextSearchAriaLabel
764
+ })
765
+ }),
766
+ me.length === 0 ? /* @__PURE__ */ z("p", {
767
+ className: l(P, $.secondary),
768
+ children: w.noContextMatchesLabel
769
+ }) : /* @__PURE__ */ z("ul", {
770
+ className: "m-0 flex min-w-0 list-none flex-wrap gap-2 p-0 pt-2",
771
+ children: me.map((e) => /* @__PURE__ */ z("li", {
772
+ className: "min-w-0",
773
+ children: /* @__PURE__ */ z(pe, {
774
+ attachment: Ue(e),
775
+ searchQuery: he,
776
+ onClick: y,
777
+ labels: { clickLabel: w.openFileLabel(e.name) }
778
+ })
779
+ }, e.name))
780
+ }),
781
+ /* @__PURE__ */ z("span", {
782
+ role: "status",
783
+ "aria-live": "polite",
784
+ className: "sr-only",
785
+ children: he === "" ? "" : w.contextResultCountLabel(me.length)
786
+ })
787
+ ] })]
788
+ })
789
+ ]
790
+ })
791
+ })]
792
+ });
793
+ });
532
794
  //#endregion
533
- export { V as ContextFileRejection, ve as PROJECT_NAME_MAX_BYTES, Y as ProjectCreateForm, H as ProjectNameError, z as ProjectSource, R as Projects, N as ProjectsSortKey, Ee as checkContextFiles, Ce as getContextFilesSize, Se as validateProjectName };
795
+ export { q as ContextFileRejection, Ce as PROJECT_NAME_MAX_BYTES, He as ProjectCreateForm, J as ProjectNameError, xe as ProjectSource, We as ProjectView, be as Projects, V as ProjectsSortKey, Fe as checkContextFiles, Z as filterContextFileItems, Ae as getContextFilesSize, Oe as isStoredContextFile, De as validateProjectName };