@epam/ai-dial-attachment-input 1.0.0-dev.514 → 1.0.0-dev.515

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.
Files changed (30) hide show
  1. package/components/AttachmentCard/AttachmentCard.d.ts.map +1 -1
  2. package/components/AttachmentCard/Attachments/Actions.d.ts +29 -0
  3. package/components/AttachmentCard/Attachments/Actions.d.ts.map +1 -0
  4. package/components/AttachmentCard/Attachments/Audio.d.ts +16 -0
  5. package/components/AttachmentCard/Attachments/Audio.d.ts.map +1 -0
  6. package/components/{AttachmentFileRow/AttachmentFileRow.d.ts → AttachmentCard/Attachments/File.d.ts} +3 -3
  7. package/components/AttachmentCard/Attachments/File.d.ts.map +1 -0
  8. package/components/AttachmentCard/Attachments/Image.d.ts +17 -0
  9. package/components/AttachmentCard/Attachments/Image.d.ts.map +1 -0
  10. package/components/AttachmentGroup/AttachmentGroup.d.ts.map +1 -1
  11. package/components/AttachmentMoreTile/AttachmentMoreTile.d.ts.map +1 -1
  12. package/components/AttachmentTray/AttachmentTray.d.ts.map +1 -1
  13. package/constants/attachment-group.d.ts +2 -0
  14. package/constants/attachment-group.d.ts.map +1 -1
  15. package/index.css +1 -1
  16. package/index.d.ts +0 -2
  17. package/index.d.ts.map +1 -1
  18. package/index.js +391 -462
  19. package/models/attachment-card.d.ts +30 -47
  20. package/models/attachment-card.d.ts.map +1 -1
  21. package/models/attachment-file-row.d.ts +28 -51
  22. package/models/attachment-file-row.d.ts.map +1 -1
  23. package/models/attachment-group.d.ts +4 -12
  24. package/models/attachment-group.d.ts.map +1 -1
  25. package/models/attachment-tray.d.ts +1 -1
  26. package/models/attachment-tray.d.ts.map +1 -1
  27. package/package.json +2 -2
  28. package/utils/attachment.d.ts +2 -2
  29. package/utils/attachment.d.ts.map +1 -1
  30. package/components/AttachmentFileRow/AttachmentFileRow.d.ts.map +0 -1
package/index.js CHANGED
@@ -1,41 +1,12 @@
1
- import { AttachmentErrorReason as e, AttachmentType as t, CodeBlockTheme as n, Highlight as r, MIME_TYPE_EXT_MAP as i, RequestStatus as a, buildCssVars as o, mergeClasses as s } from "@epam/ai-dial-chat-shared";
2
- import { DIAL_ICON_SIZE as c, DialGhostIconButton as l, DialSkeleton as u, DialSkeletonVariant as d, DialSpinner as f, ElementSize as p } from "@epam/ai-dial-ui-kit";
3
- import { IconChevronUp as m, IconClipboard as h, IconDownload as g, IconFile as _, IconFileDescription as v, IconFileTypeBmp as y, IconFileTypeCss as b, IconFileTypeCsv as x, IconFileTypeDoc as ee, IconFileTypeDocx as S, IconFileTypeHtml as C, IconFileTypeJpg as w, IconFileTypeJs as te, IconFileTypeJsx as T, IconFileTypePdf as E, IconFileTypePhp as D, IconFileTypePng as O, IconFileTypePpt as k, IconFileTypeRs as A, IconFileTypeSql as j, IconFileTypeSvg as M, IconFileTypeTs as N, IconFileTypeTsx as P, IconFileTypeTxt as F, IconFileTypeVue as I, IconFileTypeXls as L, IconFileTypeXml as R, IconFileTypeZip as z, IconFileX as B, IconMusic as ne, IconPaperclip as V, IconPhoto as re, IconReload as ie, IconTerminal2 as ae, IconVideo as H, IconX as oe } from "@tabler/icons-react";
4
- import { useCallback as se, useEffect as U, useId as W, useMemo as ce, useRef as le, useState as ue } from "react";
5
- import { Fragment as G, jsx as K, jsxs as q } from "react/jsx-runtime";
6
- //#region src/hooks/useLazyImageLoad.ts
7
- var J = /* @__PURE__ */ function(e) {
8
- return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
9
- }({}), de = ({ enabled: e, src: t }) => {
10
- let n = le(null), [r, i] = ue("idle");
11
- return U(() => {
12
- i(e && t ? "loading" : "idle");
13
- }, [e, t]), U(() => {
14
- let r = n.current;
15
- if (!r || !e || !t) return;
16
- let a = () => i("loaded"), o = () => i("error");
17
- return r.addEventListener("load", a), r.addEventListener("error", o), r.complete && i(r.naturalWidth > 0 ? "loaded" : "error"), () => {
18
- r.removeEventListener("load", a), r.removeEventListener("error", o);
19
- };
20
- }, [e, t]), {
21
- imageRef: n,
22
- imageLoadStatus: r
23
- };
24
- }, Y = {
25
- card: "_card_ywrb5_1",
26
- cardError: "_cardError_ywrb5_6",
27
- cardSelected: "_cardSelected_ywrb5_10",
28
- cardPrompt: "_cardPrompt_ywrb5_15",
29
- cardPasted: "_cardPasted_ywrb5_16",
30
- name: "_name_ywrb5_20",
31
- meta: "_meta_ywrb5_24",
32
- loadingOverlay: "_loadingOverlay_ywrb5_28",
33
- actionBtn: "_actionBtn_ywrb5_32",
34
- removeBtnImage: "_removeBtnImage_ywrb5_43",
35
- hoverDownloadIcon: "_hoverDownloadIcon_ywrb5_51"
36
- }, fe = 5, pe = 4, X = /* @__PURE__ */ function(e) {
1
+ import { AttachmentErrorReason as e, AttachmentType as t, Highlight as n, MIME_TYPE_EXT_MAP as r, RequestStatus as i, buildCssVars as a, mergeClasses as o } from "@epam/ai-dial-chat-shared";
2
+ import { useCallback as s, useEffect as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
3
+ import { IconChevronUp as p, IconClipboard as m, IconDownload as h, IconExternalLink as g, IconFile as _, IconFileDescription as v, IconFileTypeBmp as y, IconFileTypeCss as b, IconFileTypeCsv as x, IconFileTypeDoc as S, IconFileTypeDocx as C, IconFileTypeHtml as w, IconFileTypeJpg as T, IconFileTypeJs as E, IconFileTypeJsx as D, IconFileTypePdf as O, IconFileTypePhp as k, IconFileTypePng as A, IconFileTypePpt as j, IconFileTypeRs as M, IconFileTypeSql as N, IconFileTypeSvg as P, IconFileTypeTs as F, IconFileTypeTsx as I, IconFileTypeTxt as L, IconFileTypeVue as R, IconFileTypeXls as z, IconFileTypeXml as B, IconFileTypeZip as V, IconFileX as ee, IconMusic as te, IconPaperclip as ne, IconPhoto as H, IconReload as re, IconTerminal2 as ie, IconVideo as ae, IconX as oe } from "@tabler/icons-react";
4
+ import { DIAL_ICON_SIZE as U, DialGhostIconButton as se, DialSkeleton as ce, DialSkeletonVariant as le, ElementSize as ue } from "@epam/ai-dial-ui-kit";
5
+ import { Fragment as W, jsx as G, jsxs as K } from "react/jsx-runtime";
6
+ //#region src/constants/attachment-group.ts
7
+ var de = 5, fe = 4, q = "flex size-[84px] items-center justify-center rounded-xl border", J = /* @__PURE__ */ function(e) {
37
8
  return e.None = "none", e.AllVisible = "all-visible", e.Collapsed = "collapsed", e;
38
- }({}), Z = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, me = (e) => {
9
+ }({}), pe = () => `${Date.now()}-${Math.random().toString(36).slice(2)}`, me = (e) => {
39
10
  let t = e.lastIndexOf(".");
40
11
  return t > 0 ? e.slice(0, t) : e;
41
12
  }, he = {
@@ -61,59 +32,59 @@ var J = /* @__PURE__ */ function(e) {
61
32
  if (!e) return _;
62
33
  if (e.startsWith("image/")) switch (e) {
63
34
  case "image/jpeg":
64
- case "image/jpg": return w;
65
- case "image/png": return O;
66
- case "image/svg+xml": return M;
35
+ case "image/jpg": return T;
36
+ case "image/png": return A;
37
+ case "image/svg+xml": return P;
67
38
  case "image/bmp": return y;
68
- default: return re;
39
+ default: return H;
69
40
  }
70
- if (e.startsWith("video/")) return H;
71
- if (e.startsWith("audio/")) return ne;
41
+ if (e.startsWith("video/")) return ae;
42
+ if (e.startsWith("audio/")) return te;
72
43
  switch (e) {
73
- case "application/pdf": return E;
44
+ case "application/pdf": return O;
74
45
  case "application/msword":
75
- case "application/vnd.ms-word": return ee;
76
- case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return S;
77
- case "application/vnd.ms-powerpoint": return k;
78
- case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return k;
79
- case "application/vnd.ms-excel": return L;
80
- case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return L;
46
+ case "application/vnd.ms-word": return S;
47
+ case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return C;
48
+ case "application/vnd.ms-powerpoint": return j;
49
+ case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return j;
50
+ case "application/vnd.ms-excel": return z;
51
+ case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return z;
81
52
  case "application/zip":
82
53
  case "application/x-zip-compressed":
83
54
  case "application/x-rar-compressed":
84
55
  case "application/x-7z-compressed":
85
56
  case "application/gzip":
86
- case "application/x-tar": return z;
57
+ case "application/x-tar": return V;
87
58
  case "text/csv": return x;
88
- case "text/plain": return F;
59
+ case "text/plain": return L;
89
60
  case "text/html":
90
- case "application/xhtml+xml": return C;
61
+ case "application/xhtml+xml": return w;
91
62
  case "text/xml":
92
- case "application/xml": return R;
63
+ case "application/xml": return B;
93
64
  case "application/sql":
94
- case "text/x-sql": return j;
65
+ case "text/x-sql": return N;
95
66
  case "text/javascript":
96
- case "application/javascript": return te;
97
- case "text/jsx": return T;
67
+ case "application/javascript": return E;
68
+ case "text/jsx": return D;
98
69
  case "application/typescript":
99
- case "text/typescript": return N;
100
- case "text/tsx": return P;
70
+ case "text/typescript": return F;
71
+ case "text/tsx": return I;
101
72
  case "text/css": return b;
102
73
  case "text/x-php":
103
- case "application/x-php": return D;
74
+ case "application/x-php": return k;
104
75
  case "text/x-rustsrc":
105
- case "application/x-rust": return A;
106
- case "text/x-vue": return I;
76
+ case "application/x-rust": return M;
77
+ case "text/x-vue": return R;
107
78
  default: return _;
108
79
  }
109
80
  }, ye = (e) => {
110
81
  let { type: n, contentType: r } = e;
111
- return n === t.Prompt ? ae : n === t.Pasted ? h : n === t.Image ? re : ve(r ?? "");
82
+ return n === t.Prompt ? ie : n === t.Pasted ? m : n === t.Image ? H : ve(r ?? "");
112
83
  }, be = (e) => {
113
- let t = e.toLowerCase().split(";")[0].trim(), n = i[t];
84
+ let t = e.toLowerCase().split(";")[0].trim(), n = r[t];
114
85
  if (n) return n;
115
- let r = t.split("/")[1];
116
- if (r && !r.startsWith("vnd.") && !r.includes("+")) return r;
86
+ let i = t.split("/")[1];
87
+ if (i && !i.startsWith("vnd.") && !i.includes("+")) return i;
117
88
  }, xe = (e, n) => {
118
89
  let { type: r, name: i, contentType: a } = e;
119
90
  if (r === t.Prompt) return n.promptLabel ?? "Prompt";
@@ -125,234 +96,307 @@ var J = /* @__PURE__ */ function(e) {
125
96
  }
126
97
  let o = i.lastIndexOf(".");
127
98
  return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
128
- }, Se = (e, n, r, i = {}) => {
129
- let { type: o, status: c, previewUrl: l, url: u } = e, d = c === a.Loading, f = c === a.Error, p = o === t.Image && !!(l ?? u) && !f, m = o === t.Audio && !f, h = s(Y.card, f && Y.cardError, n && Y.cardSelected, !f && !n && o === t.Prompt && Y.cardPrompt, !f && !n && o === t.Pasted && Y.cardPasted);
99
+ }, Y = (e, n = {}) => {
100
+ let { type: r, status: a, previewUrl: o, url: s } = e, c = a === i.Loading, l = a === i.Error, u = r === t.Image && !!(o ?? s) && !l, d = r === t.Audio && !l, f = r === t.Link && !l;
130
101
  return {
131
- isLoading: d,
132
- isError: f,
133
- isImage: p,
134
- isAudio: m,
135
- areActionsVisible: f || r,
136
- BottomIcon: ye(e),
137
- typeLabel: xe(e, i),
138
- cardColorClass: h,
139
- removeBtnClass: p ? Y.removeBtnImage : Y.actionBtn
102
+ isLoading: c,
103
+ isError: l,
104
+ isImage: u,
105
+ isAudio: d,
106
+ isLink: f,
107
+ BottomIcon: f ? null : ye(e),
108
+ typeLabel: f ? null : xe(e, n)
140
109
  };
141
- }, Ce = (e, t) => e <= 0 ? {
142
- layout: X.None,
110
+ }, Se = (e, t) => e <= 0 ? {
111
+ layout: J.None,
143
112
  visibleCount: 0,
144
113
  hiddenCount: 0
145
114
  } : e < 5 || t ? {
146
- layout: X.AllVisible,
115
+ layout: J.AllVisible,
147
116
  visibleCount: e,
148
117
  hiddenCount: 0
149
118
  } : {
150
- layout: X.Collapsed,
119
+ layout: J.Collapsed,
151
120
  visibleCount: 4,
152
121
  hiddenCount: e - 4
153
- }, we = ({ attachment: n, searchQuery: i = "", onRemove: a, onRetry: m, onExpand: h, onClick: _, isSelected: v, shouldAlwaysShowActions: y, labels: b, styles: x, showHoverDownloadIcon: ee = !1 }) => {
154
- let { removeLabel: S = "Remove attachment", retryLabel: C = "Retry upload", clickLabel: w = "Open attachment", expandLabel: te = "Expand pasted text", loadingLabel: T = "Loading attachment", uploadFailedStatusLabel: E = "Upload failed" } = b ?? {}, { colors: D, typography: O, roundedClassName: k = "rounded-xl", className: A } = x ?? {}, { id: j, name: M } = n, N = n.previewUrl ?? n.url, P = n.type === t.Pasted, F = P && h !== void 0, I = ce(() => P ? M : me(M), [P, M]), L = o({
155
- "--ci-card-border": D?.border,
156
- "--ci-card-bg": D?.background,
157
- "--ci-card-name": D?.nameText,
158
- "--ci-card-meta": D?.metaText,
159
- "--ci-card-border-error": D?.borderError,
160
- "--ci-card-bg-selected": D?.backgroundSelected,
161
- "--ci-card-border-selected": D?.borderSelected,
162
- "--ci-card-bg-hover": D?.backgroundHover,
163
- "--ci-loading-overlay-bg": D?.loadingOverlayBackground,
164
- "--ci-card-action-color": D?.actionColor,
165
- "--ci-card-remove-bg-hover": D?.actionBackgroundHover,
166
- "--ci-card-focus-outline": D?.focusOutline,
167
- "--ci-card-remove-bg": D?.removeBackground,
168
- "--ci-card-remove-color": D?.removeColor,
169
- "--ci-card-hover-icon-bg": D?.hoverIconBackground,
170
- "--ci-card-hover-icon-color": D?.hoverIconColor
171
- }), { isLoading: R, isError: z, isImage: B, isAudio: ne, areActionsVisible: V, BottomIcon: ae, typeLabel: H, cardColorClass: se, removeBtnClass: U } = ce(() => Se(n, v ?? !1, y ?? !1, b), [
172
- n,
173
- v,
174
- y,
175
- b
176
- ]), W = _ !== void 0 && !F && !R && !z, le = F || W, { imageRef: ue, imageLoadStatus: fe } = de({
177
- enabled: B,
178
- src: N
179
- }), pe = () => {
180
- F && h ? h(j) : W && _ && _(j);
181
- }, X = (e) => {
182
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), pe());
183
- };
184
- if (ne) return /* @__PURE__ */ q("div", {
185
- style: L,
186
- className: s("group flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 border p-3", k, se, A),
187
- children: [/* @__PURE__ */ q("div", {
122
+ }, X = {
123
+ tile: "_tile_3x6ks_1",
124
+ tileLight: "_tileLight_3x6ks_12",
125
+ tileError: "_tileError_3x6ks_16",
126
+ nameText: "_nameText_3x6ks_23",
127
+ typeText: "_typeText_3x6ks_24",
128
+ retryIcon: "_retryIcon_3x6ks_36",
129
+ hoverIcon: "_hoverIcon_3x6ks_40",
130
+ track: "_track_3x6ks_48",
131
+ indeterminateFill: "_indeterminateFill_3x6ks_52",
132
+ "attachment-tile-indeterminate": "_attachment-tile-indeterminate_3x6ks_1"
133
+ }, Z = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: s }) => /* @__PURE__ */ G(se, {
134
+ icon: a,
135
+ size: ue.Small,
136
+ className: o("absolute end-1 top-1 h-6 w-6 rounded-lg", s ?? X.hoverIcon),
137
+ "aria-label": e,
138
+ "aria-describedby": t ? n : void 0,
139
+ onClick: (e) => {
140
+ e.stopPropagation(), r(i);
141
+ }
142
+ }), Ce = ({ ...e }) => /* @__PURE__ */ G(Z, {
143
+ icon: /* @__PURE__ */ G(re, {
144
+ size: U.SM,
145
+ "aria-hidden": !0
146
+ }),
147
+ className: X.retryIcon,
148
+ ...e
149
+ }), we = ({ ...e }) => /* @__PURE__ */ G(Z, {
150
+ icon: /* @__PURE__ */ G(h, {
151
+ size: U.SM,
152
+ "aria-hidden": !0
153
+ }),
154
+ ...e
155
+ }), Te = ({ ...e }) => /* @__PURE__ */ G(Z, {
156
+ icon: /* @__PURE__ */ G(g, {
157
+ size: U.SM,
158
+ "aria-hidden": !0
159
+ }),
160
+ ...e
161
+ }), Ee = ({ ...e }) => /* @__PURE__ */ G(Z, {
162
+ icon: /* @__PURE__ */ G(oe, {
163
+ size: U.SM,
164
+ "aria-hidden": !0
165
+ }),
166
+ className: X.hoverIcon,
167
+ ...e
168
+ }), De = ({ attachment: e, searchQuery: t = "", onClick: r, labels: i, styles: a, cssVars: s }) => {
169
+ let { clickLabel: c = "Open attachment" } = i ?? {}, { typography: l, className: u } = a ?? {};
170
+ return /* @__PURE__ */ K("div", {
171
+ style: s,
172
+ className: o("group flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 rounded-xl border p-3", u),
173
+ children: [/* @__PURE__ */ K("div", {
188
174
  className: "flex items-center justify-between gap-2",
189
- children: [/* @__PURE__ */ K("span", {
190
- title: n.name,
191
- className: s(O?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", Y.name),
192
- children: i ? /* @__PURE__ */ K(r, {
193
- text: n.name,
194
- query: i,
175
+ children: [/* @__PURE__ */ G("span", {
176
+ title: e.name,
177
+ className: o(l?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", X.nameText),
178
+ children: t ? /* @__PURE__ */ G(n, {
179
+ text: e.name,
180
+ query: t,
195
181
  maxLines: 1
196
- }) : n.name
197
- }), _ && /* @__PURE__ */ K(l, {
198
- icon: /* @__PURE__ */ K(g, {
199
- size: c.SM,
200
- "aria-hidden": !0
201
- }),
202
- size: p.Small,
203
- className: s("h-6 w-6 shrink-0 rounded", U),
204
- "aria-label": w,
205
- onClick: (e) => {
206
- e.stopPropagation(), _(j);
207
- }
182
+ }) : e.name
183
+ }), r && /* @__PURE__ */ G(we, {
184
+ ariaLabel: c,
185
+ onClick: r,
186
+ id: e.id
208
187
  })]
209
- }), n.playUrl && /* @__PURE__ */ K("audio", {
188
+ }), e.playUrl && /* @__PURE__ */ G("audio", {
210
189
  controls: !0,
211
- src: n.playUrl,
212
- "aria-label": n.name,
190
+ src: e.playUrl,
191
+ "aria-label": e.name,
213
192
  className: "w-full",
214
193
  preload: "metadata"
215
194
  })]
216
195
  });
217
- let Z = s("group relative flex h-[100px] w-[100px] flex-shrink-0 border focus-within:outline focus-within:outline-1 focus-within:outline-offset-1", k, se, !B && "flex-col gap-3 p-3", le && "cursor-pointer", A), he = /* @__PURE__ */ q(G, { children: [
218
- B ? /* @__PURE__ */ q("div", {
219
- className: "relative h-full w-full overflow-hidden",
220
- children: [fe !== J.Loaded && /* @__PURE__ */ K(u, {
221
- variant: d.Rectangular,
222
- width: "100%",
223
- height: "100%",
224
- active: fe === J.Loading,
225
- overlay: /* @__PURE__ */ K(re, {
226
- size: c.LG,
227
- className: O?.placeholderIconClassName ?? "text-secondary",
228
- "aria-hidden": !0
229
- }),
230
- className: s("absolute inset-0", k)
231
- }), /* @__PURE__ */ K("img", {
232
- ref: ue,
233
- src: N,
234
- alt: M,
235
- loading: "lazy",
236
- decoding: "async",
237
- className: s("h-full w-full object-cover transition-opacity duration-200", fe === J.Loaded ? "opacity-100" : "opacity-0", k)
238
- })]
239
- }) : z ? /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ q("div", {
240
- className: "flex flex-row items-center gap-1 overflow-hidden",
241
- children: [/* @__PURE__ */ K(ae, {
242
- size: c.SM,
243
- className: s("shrink-0", Y.meta),
244
- "aria-hidden": !0
245
- }), /* @__PURE__ */ K("span", {
246
- title: H,
247
- className: s(O?.metaClassName ?? "dial-tiny-text", "min-w-0 truncate", Y.meta),
248
- children: H
249
- })]
250
- }), /* @__PURE__ */ K("div", {
251
- className: "min-w-0 flex-1",
252
- children: /* @__PURE__ */ K("div", {
253
- title: I,
254
- className: s(O?.fontClassName ?? "dial-tiny-text", "line-clamp-3 break-words", Y.name),
255
- children: i ? /* @__PURE__ */ K(r, {
256
- text: I,
257
- query: i,
258
- maxLines: 3
259
- }) : I
260
- })
261
- })] }) : /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K("div", {
262
- className: "min-w-0 flex-1",
263
- children: /* @__PURE__ */ K("div", {
264
- title: I,
265
- className: s(O?.fontClassName ?? "dial-tiny-text", "line-clamp-3 break-words", Y.name),
266
- children: i ? /* @__PURE__ */ K(r, {
267
- text: I,
268
- query: i,
269
- maxLines: 3
270
- }) : I
271
- })
272
- }), /* @__PURE__ */ q("div", {
273
- className: "flex flex-row items-center gap-1 overflow-hidden",
274
- children: [/* @__PURE__ */ K(ae, {
275
- size: c.SM,
276
- className: s("shrink-0", Y.meta),
277
- "aria-hidden": !0
278
- }), /* @__PURE__ */ K("span", {
279
- title: H,
280
- className: s(O?.metaClassName ?? "dial-tiny-text", "min-w-0 truncate", Y.meta),
281
- children: H
282
- })]
283
- })] }),
284
- R && /* @__PURE__ */ K("span", {
285
- className: s("absolute inset-0 flex items-center justify-center", k, Y.loadingOverlay),
286
- children: /* @__PURE__ */ K(f, {
287
- size: 40,
288
- ariaLabel: T,
289
- className: "z-50"
290
- })
196
+ }, Oe = {
197
+ [e.Network]: "Upload failed · network error",
198
+ [e.UnsupportedType]: "Upload failed · unsupported file type"
199
+ }, ke = ({ attachment: t, onClick: n, onRetry: r, labels: a, styles: c, onDownload: d, isPasted: f, isLink: p, cssVars: m, onExpand: h, isExpandable: g, onRemove: _ }) => {
200
+ let { clickLabel: v = "Download attachment", retryLabel: y = "Retry upload", sizeLabel: b, uploadingLabel: x = "Uploading", errorReasonLabels: S, genericErrorLabel: C = "Upload failed" } = a ?? {}, { typography: { nameClassName: w = "dial-caption-text", metaClassName: T = "dial-caption-text" } = {}, className: E } = c ?? {}, { id: D, name: O, status: k, errorReason: A } = t, j = k === i.Loading, M = k === i.Error, N = l(), P = M ? A && (S?.[A] ?? Oe[A]) || C : "", { BottomIcon: F, typeLabel: I } = Y(t), L = !M && !j && d && !p, R = M && !!r && A !== e.UnsupportedType, z = L || R ? "pe-5" : void 0, B = (e) => {
201
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), n?.(t.id));
202
+ }, V = u(() => f ? O : me(O), [f, O]), ee = s(() => {
203
+ window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
204
+ }, [t]), te = o(q, "group relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", X.tile, !M && X.tileLight, M && X.tileError), ne = /* @__PURE__ */ G("div", {
205
+ title: V,
206
+ className: o(w, "line-clamp-2 min-w-0 break-all", X.nameText, !M && z),
207
+ children: V
208
+ }), H = F && /* @__PURE__ */ K("div", {
209
+ className: o("flex items-center gap-1 overflow-hidden", M && z),
210
+ children: [/* @__PURE__ */ G(F, {
211
+ size: 16,
212
+ className: X.typeText,
213
+ "aria-hidden": !0
214
+ }), /* @__PURE__ */ G("span", {
215
+ className: o(T, "truncate", X.typeText),
216
+ children: b ? `${I} · ${b}` : I
217
+ })]
218
+ }), re = () => {
219
+ g && h ? h(D) : n && n(D);
220
+ }, ie = /* @__PURE__ */ K(W, { children: [
221
+ M ? /* @__PURE__ */ K(W, { children: [H, ne] }) : /* @__PURE__ */ K(W, { children: [ne, H] }),
222
+ j && /* @__PURE__ */ G("div", {
223
+ role: "progressbar",
224
+ "aria-label": x,
225
+ className: o("absolute inset-x-2 bottom-2 h-[3px] overflow-hidden rounded-full", X.track),
226
+ children: /* @__PURE__ */ G("div", { className: o("h-full w-1/3 rounded-full", X.indeterminateFill) })
227
+ }),
228
+ L && /* @__PURE__ */ G(we, {
229
+ ariaLabel: v,
230
+ errorTitle: P,
231
+ errorDescId: N,
232
+ onClick: d,
233
+ id: D
234
+ }),
235
+ R && /* @__PURE__ */ G(Ce, {
236
+ ariaLabel: y,
237
+ errorTitle: P,
238
+ errorDescId: N,
239
+ onClick: r,
240
+ id: D
241
+ }),
242
+ p && /* @__PURE__ */ G(Te, {
243
+ ariaLabel: y,
244
+ errorTitle: P,
245
+ errorDescId: N,
246
+ onClick: ee
291
247
  }),
292
- /* @__PURE__ */ K("span", {
248
+ _ && /* @__PURE__ */ G(Ee, {
249
+ ariaLabel: y,
250
+ errorTitle: P,
251
+ errorDescId: N,
252
+ onClick: _,
253
+ id: D
254
+ }),
255
+ M && /* @__PURE__ */ G("span", {
256
+ id: N,
293
257
  role: "status",
294
258
  "aria-live": "polite",
295
259
  className: "sr-only",
296
- children: z ? E : ""
297
- }),
298
- !R && /* @__PURE__ */ q("div", {
299
- className: s("absolute end-1 top-1 flex gap-1 transition-opacity", V ? "opacity-100" : "opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 mobile:opacity-100"),
260
+ children: P
261
+ })
262
+ ] });
263
+ return /* @__PURE__ */ G("div", {
264
+ style: m,
265
+ className: o("inline-flex", E),
266
+ children: /* @__PURE__ */ G("div", {
267
+ role: "button",
268
+ tabIndex: 0,
269
+ "aria-label": v,
270
+ onClick: re,
271
+ onKeyDown: B,
272
+ style: m,
273
+ className: o(te, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
274
+ children: ie
275
+ })
276
+ });
277
+ }, Q = /* @__PURE__ */ function(e) {
278
+ return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
279
+ }({}), Ae = ({ enabled: e, src: t }) => {
280
+ let n = d(null), [r, i] = f("idle");
281
+ return c(() => {
282
+ i(e && t ? "loading" : "idle");
283
+ }, [e, t]), c(() => {
284
+ let r = n.current;
285
+ if (!r || !e || !t) return;
286
+ let a = () => i("loaded"), o = () => i("error");
287
+ return r.addEventListener("load", a), r.addEventListener("error", o), r.complete && i(r.naturalWidth > 0 ? "loaded" : "error"), () => {
288
+ r.removeEventListener("load", a), r.removeEventListener("error", o);
289
+ };
290
+ }, [e, t]), {
291
+ imageRef: n,
292
+ imageLoadStatus: r
293
+ };
294
+ }, je = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: s, onDownload: c, styles: l }) => {
295
+ let { clickLabel: d = "Open attachment", expandLabel: f = "Expand pasted text" } = i ?? {}, { typography: p, className: m } = l ?? {}, { id: h, name: g } = e, _ = e.previewUrl ?? e.url, v = e.type === t.Pasted && n !== void 0, { isLoading: y, isError: b, isImage: x } = u(() => Y(e), [e]), S = r !== void 0 && !v && !y && !b, { imageRef: C, imageLoadStatus: w } = Ae({
296
+ enabled: x,
297
+ src: _
298
+ }), T = () => {
299
+ v && n ? n(h) : S && r && r(h);
300
+ };
301
+ return /* @__PURE__ */ G("div", {
302
+ className: o(q, S && "cursor-pointer", X.tile, m),
303
+ onClick: T,
304
+ onKeyDown: (e) => {
305
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), T());
306
+ },
307
+ tabIndex: 0,
308
+ role: "button",
309
+ style: s,
310
+ "aria-label": S ? d : v ? f : void 0,
311
+ children: /* @__PURE__ */ K("div", {
312
+ className: "relative h-full w-full overflow-hidden",
300
313
  children: [
301
- z && m && n.errorReason !== e.UnsupportedType && /* @__PURE__ */ K(l, {
302
- icon: /* @__PURE__ */ K(ie, {
303
- size: c.SM,
304
- "aria-hidden": !0
305
- }),
306
- size: p.Small,
307
- className: s("h-6 w-6 rounded", U),
308
- "aria-label": C,
309
- onClick: (e) => {
310
- e.stopPropagation(), m(j);
311
- }
314
+ a && /* @__PURE__ */ G(Ee, {
315
+ onClick: a,
316
+ id: h
317
+ }),
318
+ c && /* @__PURE__ */ G(we, {
319
+ onClick: c,
320
+ id: h
312
321
  }),
313
- a && /* @__PURE__ */ K(l, {
314
- icon: /* @__PURE__ */ K(oe, {
315
- size: c.SM,
322
+ w !== Q.Loaded && /* @__PURE__ */ G(ce, {
323
+ variant: le.Rectangular,
324
+ width: "100%",
325
+ height: "100%",
326
+ active: w === Q.Loading,
327
+ overlay: /* @__PURE__ */ G(H, {
328
+ size: U.LG,
329
+ className: p?.placeholderIconClassName ?? "text-secondary",
316
330
  "aria-hidden": !0
317
331
  }),
318
- size: p.Small,
319
- className: s("h-6 w-6 rounded", U),
320
- "aria-label": S,
321
- onClick: (e) => {
322
- e.stopPropagation(), a?.(j);
323
- }
332
+ className: "absolute inset-0 rounded-xl"
324
333
  }),
325
- ee && !a && !z && /* @__PURE__ */ K(g, {
326
- size: c.SM,
327
- "aria-hidden": !0,
328
- className: s("h-6 w-6 rounded-lg p-1", Y.hoverDownloadIcon)
334
+ /* @__PURE__ */ G("img", {
335
+ ref: C,
336
+ src: _,
337
+ alt: g,
338
+ loading: "lazy",
339
+ decoding: "async",
340
+ className: o("h-full w-full rounded-xl object-cover transition-opacity duration-200", w === Q.Loaded ? "opacity-100" : "opacity-0")
329
341
  })
330
342
  ]
331
343
  })
332
- ] });
333
- return le ? /* @__PURE__ */ K("div", {
334
- style: L,
335
- className: Z,
336
- onClick: pe,
337
- onKeyDown: X,
338
- tabIndex: 0,
339
- role: "button",
340
- "aria-label": W ? w : F ? te : void 0,
341
- children: he
342
- }) : /* @__PURE__ */ K("div", {
343
- style: L,
344
- className: Z,
345
- children: he
346
344
  });
347
- }, Te = ({ attachments: e, onRemove: t, onRetry: n, onExpand: r, onAttachmentClick: i, labels: a, styles: o }) => {
348
- let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d } = a ?? {}, { className: f } = o ?? {};
349
- return e.length === 0 ? null : /* @__PURE__ */ K("div", {
345
+ }, Me = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: o, onClick: s, onDownload: c, labels: l, styles: d }) => {
346
+ let { colors: f } = d ?? {}, p = e.type === t.Pasted, m = p && o !== void 0, h = a({
347
+ "--ci-tile-bg": f?.background,
348
+ "--ci-tile-border": f?.border,
349
+ "--ci-tile-border-hover": f?.borderHover,
350
+ "--ci-tile-focus-outline": f?.focusOutline,
351
+ "--ci-tile-bg-error": f?.backgroundError,
352
+ "--ci-tile-border-error": f?.borderError,
353
+ "--ci-tile-error-text": f?.errorText,
354
+ "--ci-tile-name-text": f?.nameText,
355
+ "--ci-tile-type-text": f?.typeText,
356
+ "--ci-tile-hover-icon-bg": f?.hoverIconBackground,
357
+ "--ci-tile-hover-icon-color": f?.hoverIconColor,
358
+ "--ci-tile-track-bg": f?.trackBackground,
359
+ "--ci-tile-fill-bg": f?.fillBackground
360
+ }), { isImage: g, isAudio: _, isLink: v } = u(() => Y(e), [e]);
361
+ return _ ? /* @__PURE__ */ G(De, {
362
+ attachment: e,
363
+ labels: l,
364
+ onClick: s,
365
+ searchQuery: n,
366
+ styles: d,
367
+ cssVars: h
368
+ }) : g ? /* @__PURE__ */ G(je, {
369
+ attachment: e,
370
+ labels: l,
371
+ onClick: s,
372
+ onExpand: o,
373
+ styles: d,
374
+ onRemove: r,
375
+ cssVars: h,
376
+ onDownload: c
377
+ }) : /* @__PURE__ */ G(ke, {
378
+ attachment: e,
379
+ onClick: s,
380
+ onRetry: i,
381
+ onRemove: r,
382
+ onDownload: c,
383
+ isLink: v,
384
+ isPasted: p,
385
+ styles: d,
386
+ labels: l,
387
+ onExpand: o,
388
+ cssVars: h,
389
+ isExpandable: m
390
+ });
391
+ }, Ne = ({ attachments: e, onRemove: t, onRetry: n, onExpand: r, onAttachmentClick: i, labels: a, styles: s }) => {
392
+ let { ariaLabel: c = "Attached files", removeLabel: l, retryLabel: u, clickLabel: d } = a ?? {}, { className: f } = s ?? {};
393
+ return e.length === 0 ? null : /* @__PURE__ */ G("div", {
350
394
  role: "list",
351
395
  "aria-label": c,
352
- className: s("flex w-full min-w-0 gap-2 overflow-x-auto", f),
353
- children: e.map((e) => /* @__PURE__ */ K("div", {
396
+ className: o("flex w-full min-w-0 gap-2 overflow-x-auto", f),
397
+ children: e.map((e) => /* @__PURE__ */ G("div", {
354
398
  role: "listitem",
355
- children: /* @__PURE__ */ K(we, {
399
+ children: /* @__PURE__ */ G(Me, {
356
400
  attachment: e,
357
401
  onRemove: t,
358
402
  onRetry: n,
@@ -362,114 +406,12 @@ var J = /* @__PURE__ */ function(e) {
362
406
  retryLabel: u,
363
407
  clickLabel: d
364
408
  },
365
- onClick: i ? () => i(e) : void 0
409
+ onClick: i
366
410
  })
367
411
  }, e.id))
368
412
  });
369
- }, Q = {
370
- tile: "_tile_1l1lz_1",
371
- tileLight: "_tileLight_1l1lz_12",
372
- tileError: "_tileError_1l1lz_16",
373
- nameText: "_nameText_1l1lz_23",
374
- typeText: "_typeText_1l1lz_24",
375
- retryIcon: "_retryIcon_1l1lz_36",
376
- hoverIcon: "_hoverIcon_1l1lz_40",
377
- track: "_track_1l1lz_45",
378
- indeterminateFill: "_indeterminateFill_1l1lz_49",
379
- "attachment-tile-indeterminate": "_attachment-tile-indeterminate_1l1lz_1"
380
- }, Ee = {
381
- [e.Network]: "Upload failed · network error",
382
- [e.UnsupportedType]: "Upload failed · unsupported file type"
383
- }, De = ({ attachment: t, onClick: r, onRetry: i, labels: u, styles: d, theme: f = n.Dark }) => {
384
- let { clickLabel: m = "Download attachment", retryLabel: h = "Retry upload", sizeLabel: _, uploadingLabel: v = "Uploading", errorReasonLabels: y, genericErrorLabel: b = "Upload failed" } = u ?? {}, { typography: { nameClassName: x = "dial-caption-text", metaClassName: ee = "dial-caption-text" } = {}, colors: S, className: C } = d ?? {}, w = o({
385
- "--ci-tile-bg": S?.background,
386
- "--ci-tile-border": S?.border,
387
- "--ci-tile-border-hover": S?.borderHover,
388
- "--ci-tile-focus-outline": S?.focusOutline,
389
- "--ci-tile-bg-error": S?.backgroundError,
390
- "--ci-tile-border-error": S?.borderError,
391
- "--ci-tile-error-text": S?.errorText,
392
- "--ci-tile-name-text": S?.nameText,
393
- "--ci-tile-type-text": S?.typeText,
394
- "--ci-tile-hover-icon-bg": S?.hoverIconBackground,
395
- "--ci-tile-hover-icon-color": S?.hoverIconColor,
396
- "--ci-tile-track-bg": S?.trackBackground,
397
- "--ci-tile-fill-bg": S?.fillBackground
398
- }), { id: te, name: T, status: E, errorReason: D } = t, O = E === a.Loading, k = E === a.Error, A = W(), j = k && (D && (y?.[D] ?? Ee[D]) || b), { BottomIcon: M, typeLabel: N } = Se(t, !1, !1, u), P = !k && !O && r !== void 0, F = k && !!i && D !== e.UnsupportedType, I = P || F ? "pe-5" : void 0, L = () => {
399
- P && r?.(t);
400
- }, R = (e) => {
401
- (e.key === "Enter" || e.key === " ") && P && (e.preventDefault(), L());
402
- }, z = s("group relative flex size-[84px] flex-col justify-between gap-1 overflow-hidden rounded-xl border p-1.5", Q.tile, !k && f === n.Light && Q.tileLight, k && Q.tileError), B = /* @__PURE__ */ K("div", {
403
- title: T,
404
- className: s(x, "line-clamp-2 min-w-0 break-words", Q.nameText, !k && I),
405
- children: T
406
- }), ne = /* @__PURE__ */ q("div", {
407
- className: s("flex items-center gap-1 overflow-hidden", k && I),
408
- children: [/* @__PURE__ */ K(M, {
409
- size: 16,
410
- className: Q.typeText,
411
- "aria-hidden": !0
412
- }), /* @__PURE__ */ K("span", {
413
- className: s(ee, "truncate", Q.typeText),
414
- children: _ ? `${N} · ${_}` : N
415
- })]
416
- }), V = /* @__PURE__ */ q(G, { children: [
417
- k ? /* @__PURE__ */ q(G, { children: [ne, B] }) : /* @__PURE__ */ q(G, { children: [B, ne] }),
418
- O && /* @__PURE__ */ K("div", {
419
- role: "progressbar",
420
- "aria-label": v,
421
- className: s("absolute inset-x-2 bottom-2 h-[3px] overflow-hidden rounded-full", Q.track),
422
- children: /* @__PURE__ */ K("div", { className: s("h-full w-1/3 rounded-full", Q.indeterminateFill) })
423
- }),
424
- P && /* @__PURE__ */ K(g, {
425
- size: c.SM,
426
- "aria-hidden": !0,
427
- className: s("absolute end-1 top-1 h-6 w-6 rounded-lg p-1 opacity-0 transition-opacity group-hover:opacity-100 mobile:opacity-100", Q.hoverIcon)
428
- }),
429
- F && /* @__PURE__ */ K(l, {
430
- icon: /* @__PURE__ */ K(ie, {
431
- size: c.SM,
432
- "aria-hidden": !0
433
- }),
434
- size: p.Small,
435
- className: s("absolute end-1 top-1 h-6 w-6 rounded-lg", Q.retryIcon),
436
- "aria-label": h,
437
- "aria-describedby": j ? A : void 0,
438
- onClick: (e) => {
439
- e.stopPropagation(), i(te);
440
- }
441
- }),
442
- k && /* @__PURE__ */ K("span", {
443
- id: A,
444
- role: "status",
445
- "aria-live": "polite",
446
- className: "sr-only",
447
- children: j
448
- })
449
- ] });
450
- return /* @__PURE__ */ K("div", {
451
- className: s("inline-flex", C),
452
- children: P ? /* @__PURE__ */ K("div", {
453
- role: "button",
454
- tabIndex: 0,
455
- "aria-label": m,
456
- onClick: L,
457
- onKeyDown: R,
458
- style: w,
459
- className: s(z, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
460
- children: V
461
- }) : /* @__PURE__ */ K("div", {
462
- className: z,
463
- title: j || void 0,
464
- role: k ? "group" : void 0,
465
- "aria-describedby": k ? A : void 0,
466
- tabIndex: k ? 0 : void 0,
467
- style: w,
468
- children: V
469
- })
470
- });
471
- }, Oe = { tile: "_tile_1s4d7_1" }, ke = ({ count: e, onClick: t, labels: n, children: r, styles: i }) => {
472
- let { ariaLabel: a } = n ?? {}, { typography: { fontClassName: c = "dial-small-semi-text" } = {}, className: l, colors: u } = i ?? {}, d = o({
413
+ }, Pe = { tile: "_tile_1s4d7_1" }, Fe = ({ count: e, onClick: t, labels: n, children: r, styles: i }) => {
414
+ let { ariaLabel: s } = n ?? {}, { typography: { fontClassName: c = "dial-small-semi-text" } = {}, className: l, colors: u } = i ?? {}, d = a({
473
415
  "--ci-more-tile-bg": u?.background,
474
416
  "--ci-more-tile-border": u?.border,
475
417
  "--ci-more-tile-color": u?.color,
@@ -478,13 +420,13 @@ var J = /* @__PURE__ */ function(e) {
478
420
  "--ci-more-tile-border-hover": u?.borderHover,
479
421
  "--ci-more-tile-focus-outline": u?.focusOutline
480
422
  });
481
- return /* @__PURE__ */ K("button", {
423
+ return /* @__PURE__ */ G("button", {
482
424
  type: "button",
483
425
  onClick: t,
484
- "aria-label": a ?? `Show ${e} more attachments`,
426
+ "aria-label": s ?? `Show ${e} more attachments`,
485
427
  style: d,
486
- className: s("flex size-[84px] items-center justify-center rounded-xl border", c, Oe.tile, l),
487
- children: r ?? /* @__PURE__ */ K("bdi", {
428
+ className: o(q, c, Pe.tile, l),
429
+ children: r ?? /* @__PURE__ */ G("bdi", {
488
430
  dir: "ltr",
489
431
  children: `+${e}`
490
432
  })
@@ -495,97 +437,84 @@ var J = /* @__PURE__ */ function(e) {
495
437
  headerLabel: "_headerLabel_7fktb_7",
496
438
  downloadAllButton: "_downloadAllButton_7fktb_8",
497
439
  imageTile: "_imageTile_7fktb_12"
498
- }, Ae = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, je = ({ attachments: e, onAttachmentClick: n, onDownloadAll: r, onRetry: i, getSizeLabel: u, labels: d, styles: f, theme: p }) => {
499
- let { ariaLabel: h = "Attachments", clickLabel: v = "Download attachment", retryLabel: y = "Retry upload", showLessLabel: b = "Show less", downloadAllLabel: x = "Download all", getHeaderLabel: ee = (e) => Ae(e, "attachment"), promptLabel: S, pastedLabel: C, imageLabel: w } = d ?? {}, { typography: { headerLabelClassName: te = "dial-tiny-semi-text" } = {}, colors: T, className: E } = f ?? {}, D = o({
500
- "--ci-group-bg": T?.background,
501
- "--ci-group-border": T?.border,
502
- "--ci-group-text": T?.text
503
- }), [O, k] = ue(!1), A = ce(() => Ce(e.length, O), [e.length, O]);
440
+ }, Ie = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Le = ({ attachments: e, onAttachmentClick: n, onDownloadAll: r, onRetry: s, labels: c, styles: l }) => {
441
+ let { ariaLabel: d = "Attachments", clickLabel: m = "Download attachment", retryLabel: g = "Retry upload", showLessLabel: v = "Show less", downloadAllLabel: y = "Download all", openInNewTabLabel: b, getHeaderLabel: x = (e) => Ie(e, "attachment"), promptLabel: S, pastedLabel: C, imageLabel: w } = c ?? {}, { typography: { headerLabelClassName: T = "dial-tiny-semi-text" } = {}, colors: E, className: D } = l ?? {}, O = a({
442
+ "--ci-group-bg": E?.background,
443
+ "--ci-group-border": E?.border,
444
+ "--ci-group-text": E?.text
445
+ }), [k, A] = f(!1), j = u(() => Se(e.length, k), [e.length, k]);
504
446
  if (e.length === 0) return null;
505
- let j = e.some((e) => e.type === t.Image), M = e.some((e) => e.type !== t.Image), N = j && M, P = e.length >= 5, F = N ? V : j ? re : _, I = ee(e.length), L = e.slice(0, A.visibleCount);
506
- return /* @__PURE__ */ q("div", {
447
+ let M = e.some((e) => e.type === t.Image), N = e.some((e) => e.type !== t.Image), P = M && N, F = e.length >= 5, I = P ? ne : M ? H : _, L = x(e.length), R = e.slice(0, j.visibleCount), z = () => {
448
+ let t = e.filter((e) => e.status === i.Idle);
449
+ r ? r(t) : t.forEach((e) => n?.(e.id));
450
+ }, B = (t) => {
451
+ let n = e.find((e) => e.id === t);
452
+ n && r?.([n]);
453
+ };
454
+ return /* @__PURE__ */ K("div", {
507
455
  role: "group",
508
- "aria-label": h,
509
- style: D,
510
- className: s("rounded-2xl border p-3", P ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", $.container, E),
511
- children: [/* @__PURE__ */ q("div", {
456
+ "aria-label": d,
457
+ style: O,
458
+ className: o("rounded-2xl border p-3", F ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", $.container, D),
459
+ children: [/* @__PURE__ */ K("div", {
512
460
  className: "mb-3 flex min-h-6 items-center gap-2",
513
461
  children: [
514
- /* @__PURE__ */ K(F, {
515
- size: c.SM,
516
- className: s("shrink-0", $.headerIcon),
462
+ /* @__PURE__ */ G(I, {
463
+ size: U.SM,
464
+ className: o("shrink-0", $.headerIcon),
517
465
  "aria-hidden": !0
518
466
  }),
519
- /* @__PURE__ */ K("span", {
520
- className: s(te, $.headerLabel),
521
- children: I
467
+ /* @__PURE__ */ G("span", {
468
+ className: o(T, $.headerLabel),
469
+ children: L
522
470
  }),
523
- e.length >= 2 && (r || n) && /* @__PURE__ */ K(l, {
524
- icon: /* @__PURE__ */ K(g, {
525
- size: c.SM,
471
+ e.length >= 2 && (r || n) && /* @__PURE__ */ G(se, {
472
+ icon: /* @__PURE__ */ G(h, {
473
+ size: U.SM,
526
474
  "aria-hidden": !0
527
475
  }),
528
- className: s("ms-auto h-6 w-6 rounded-lg", $.downloadAllButton),
529
- "aria-label": x,
530
- onClick: () => {
531
- let t = e.filter((e) => e.status === a.Idle);
532
- r ? r(t) : t.forEach((e) => n?.(e));
533
- }
476
+ className: o("ms-auto h-6 w-6 rounded-lg", $.downloadAllButton),
477
+ "aria-label": y,
478
+ onClick: z
534
479
  })
535
480
  ]
536
- }), /* @__PURE__ */ q("div", {
481
+ }), /* @__PURE__ */ K("div", {
537
482
  role: "list",
538
- "aria-label": I,
539
- className: s("gap-3", P ? "grid grid-cols-[repeat(5,84px)] overflow-x-auto" : "flex flex-wrap"),
483
+ "aria-label": L,
484
+ className: o("gap-3", F ? "grid grid-cols-[repeat(5,83px)] overflow-x-auto" : "flex flex-wrap"),
540
485
  children: [
541
- L.map((e) => /* @__PURE__ */ K("div", {
486
+ R.map((e) => /* @__PURE__ */ G("div", {
542
487
  role: "listitem",
543
- children: e.type === t.Image ? /* @__PURE__ */ K(we, {
544
- attachment: e,
545
- onClick: n ? () => n(e) : void 0,
546
- onRetry: i,
547
- labels: {
548
- clickLabel: v,
549
- retryLabel: y,
550
- promptLabel: S,
551
- pastedLabel: C,
552
- imageLabel: w
553
- },
554
- styles: {
555
- roundedClassName: "rounded-xl",
556
- className: s("size-[84px]", $.imageTile)
557
- },
558
- showHoverDownloadIcon: !0
559
- }) : /* @__PURE__ */ K(De, {
488
+ children: /* @__PURE__ */ G(Me, {
560
489
  attachment: e,
561
490
  onClick: n,
562
- onRetry: i,
491
+ onDownload: B,
492
+ onRetry: s,
563
493
  labels: {
564
- clickLabel: v,
565
- retryLabel: y,
566
- sizeLabel: u?.(e),
494
+ clickLabel: m,
495
+ retryLabel: g,
567
496
  promptLabel: S,
568
497
  pastedLabel: C,
569
- imageLabel: w
570
- },
571
- theme: p
498
+ imageLabel: w,
499
+ openInNewTabLabel: b
500
+ }
572
501
  })
573
502
  }, e.id)),
574
- A.layout === X.Collapsed && /* @__PURE__ */ K("div", {
503
+ j.layout === J.Collapsed && /* @__PURE__ */ G("div", {
575
504
  role: "listitem",
576
- children: /* @__PURE__ */ K(ke, {
577
- count: A.hiddenCount,
578
- onClick: () => k(!0)
505
+ children: /* @__PURE__ */ G(Fe, {
506
+ count: j.hiddenCount,
507
+ onClick: () => A(!0)
579
508
  })
580
509
  }),
581
- P && O && /* @__PURE__ */ K("div", {
510
+ F && k && /* @__PURE__ */ G("div", {
582
511
  role: "listitem",
583
- children: /* @__PURE__ */ K(ke, {
512
+ children: /* @__PURE__ */ G(Fe, {
584
513
  count: 0,
585
- onClick: () => k(!1),
586
- labels: { ariaLabel: b },
587
- children: /* @__PURE__ */ K(m, {
588
- size: c.MD,
514
+ onClick: () => A(!1),
515
+ labels: { ariaLabel: v },
516
+ children: /* @__PURE__ */ G(p, {
517
+ size: U.MD,
589
518
  "aria-hidden": !0
590
519
  })
591
520
  })
@@ -593,49 +522,49 @@ var J = /* @__PURE__ */ function(e) {
593
522
  ]
594
523
  })]
595
524
  });
596
- }, Me = {
525
+ }, Re = {
597
526
  overlay: "_overlay_wr7ez_1",
598
527
  icon: "_icon_wr7ez_5",
599
528
  deniedIcon: "_deniedIcon_wr7ez_9"
600
- }, Ne = ({ isVisible: e, isAttachmentsAllowed: t = !0, labels: n, styles: r }) => {
601
- let { title: i, subtitle: a } = n ?? {}, { colors: c, typography: l } = r ?? {}, { titleClassName: u = "heading-3 font-semibold", subtitleClassName: d = "dial-small-text" } = l ?? {};
529
+ }, ze = ({ isVisible: e, isAttachmentsAllowed: t = !0, labels: n, styles: r }) => {
530
+ let { title: i, subtitle: s } = n ?? {}, { colors: c, typography: l } = r ?? {}, { titleClassName: u = "heading-3 font-semibold", subtitleClassName: d = "dial-small-text" } = l ?? {};
602
531
  if (!e) return null;
603
- let f = o({
532
+ let f = a({
604
533
  "--fd-bg": c?.background,
605
534
  "--fd-icon": c?.icon,
606
535
  "--fd-denied-icon": c?.deniedIcon
607
- }), p = i ?? (t ? "Attach files" : "No attachments allowed"), m = a ?? (t ? "Drop files here to attach them to message" : "Attachments can't be added to message"), h = t ? Me.icon : Me.deniedIcon, g = (e) => {
536
+ }), p = i ?? (t ? "Attach files" : "No attachments allowed"), m = s ?? (t ? "Drop files here to attach them to message" : "Attachments can't be added to message"), h = t ? Re.icon : Re.deniedIcon, g = (e) => {
608
537
  e.preventDefault();
609
- }, _ = t ? v : B;
610
- return /* @__PURE__ */ K("div", {
538
+ }, _ = t ? v : ee;
539
+ return /* @__PURE__ */ G("div", {
611
540
  role: "status",
612
541
  "aria-live": "polite",
613
- className: s("fixed inset-0 z-[9999] flex items-center justify-center backdrop-blur-sm", Me.overlay, t ? "pointer-events-none" : "pointer-events-auto cursor-not-allowed"),
542
+ className: o("fixed inset-0 z-[9999] flex items-center justify-center backdrop-blur-sm", Re.overlay, t ? "pointer-events-none" : "pointer-events-auto cursor-not-allowed"),
614
543
  onDragOver: t ? void 0 : g,
615
544
  onDrop: t ? void 0 : g,
616
545
  style: f,
617
- children: /* @__PURE__ */ q("div", {
546
+ children: /* @__PURE__ */ K("div", {
618
547
  className: "flex flex-col items-center text-center",
619
548
  children: [
620
- /* @__PURE__ */ K(_, {
549
+ /* @__PURE__ */ G(_, {
621
550
  size: 100,
622
551
  className: h,
623
552
  "aria-hidden": !0
624
553
  }),
625
- /* @__PURE__ */ K("span", {
626
- className: s("mt-5", u),
554
+ /* @__PURE__ */ G("span", {
555
+ className: o("mt-5", u),
627
556
  children: p
628
557
  }),
629
- /* @__PURE__ */ K("span", {
630
- className: s("mt-4", d),
558
+ /* @__PURE__ */ G("span", {
559
+ className: o("mt-4", d),
631
560
  children: m
632
561
  })
633
562
  ]
634
563
  })
635
564
  });
636
- }, Pe = (e, n, r = {}) => {
637
- let { screenshotName: i = "Screenshot.png", pastedTextName: o = "Pasted text" } = r;
638
- return { handlePaste: se((r) => {
565
+ }, Be = (e, n, r = {}) => {
566
+ let { screenshotName: a = "Screenshot.png", pastedTextName: o = "Pasted text" } = r;
567
+ return { handlePaste: s((r) => {
639
568
  if (!r.clipboardData) return;
640
569
  let s = Array.from(r.clipboardData.items).filter((e) => e.kind === "file" && e.type.startsWith("image/")), c = r.clipboardData.getData("text/plain").length > 0;
641
570
  if (s.length > 0 && !c) {
@@ -643,13 +572,13 @@ var J = /* @__PURE__ */ function(e) {
643
572
  for (let e of s) {
644
573
  let r = e.getAsFile();
645
574
  if (!r) continue;
646
- let o = new File([r], i, { type: r.type }), s = {
647
- id: Z(),
648
- name: i,
575
+ let o = new File([r], a, { type: r.type }), s = {
576
+ id: pe(),
577
+ name: a,
649
578
  contentType: r.type,
650
579
  file: o,
651
580
  type: t.Image,
652
- status: a.Idle,
581
+ status: i.Idle,
653
582
  previewUrl: URL.createObjectURL(o)
654
583
  };
655
584
  n.push(s);
@@ -659,22 +588,22 @@ var J = /* @__PURE__ */ function(e) {
659
588
  }
660
589
  let l = r.clipboardData.getData("text/plain");
661
590
  if (l.length > n) {
662
- let n = l.trim(), i = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) || o, s = new File([l], i, { type: "text/plain" }), c = {
663
- id: Z(),
664
- name: i,
591
+ let n = l.trim(), a = (n.length > 80 ? `${n.slice(0, 80).trimEnd()}…` : n) || o, s = new File([l], a, { type: "text/plain" }), c = {
592
+ id: pe(),
593
+ name: a,
665
594
  contentType: "text/plain",
666
595
  file: s,
667
596
  type: t.Pasted,
668
- status: a.Idle
597
+ status: i.Idle
669
598
  };
670
599
  r.preventDefault(), e([c]);
671
600
  }
672
601
  }, [
673
602
  e,
674
603
  n,
675
- i,
604
+ a,
676
605
  o
677
606
  ]) };
678
- }, Fe = 100;
607
+ }, Ve = 100;
679
608
  //#endregion
680
- export { pe as ATTACHMENT_COLLAPSED_VISIBLE_COUNT, fe as ATTACHMENT_COLLAPSE_THRESHOLD, we as AttachmentCard, De as AttachmentFileRow, je as AttachmentGroup, ke as AttachmentMoreTile, X as AttachmentTilesLayout, Te as AttachmentTray, Ne as FileDndOverlay, J as LazyImageLoadStatus, Fe as MAX_UPLOADS_PER_MINUTE, Z as generateAttachmentId, Se as getAttachmentCardState, ve as getAttachmentIcon, Ce as getAttachmentTilesPlan, be as getExtFromContentType, me as getNameWithoutExtension, _e as isMimeTypeAllowed, ge as mimeTypesToExtensionLabels, Pe as useClipboardPaste, de as useLazyImageLoad };
609
+ export { fe as ATTACHMENT_COLLAPSED_VISIBLE_COUNT, de as ATTACHMENT_COLLAPSE_THRESHOLD, Me as AttachmentCard, Le as AttachmentGroup, Fe as AttachmentMoreTile, J as AttachmentTilesLayout, Ne as AttachmentTray, ze as FileDndOverlay, Q as LazyImageLoadStatus, Ve as MAX_UPLOADS_PER_MINUTE, pe as generateAttachmentId, Y as getAttachmentCardState, ve as getAttachmentIcon, Se as getAttachmentTilesPlan, be as getExtFromContentType, me as getNameWithoutExtension, _e as isMimeTypeAllowed, ge as mimeTypesToExtensionLabels, Be as useClipboardPaste, Ae as useLazyImageLoad };