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