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

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