@epam/ai-dial-attachment-canvas 1.1.0-dev.393 → 1.1.0-dev.398
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/LazyContentBoundary-CqvIcNMp.js +167 -0
- package/PdfContent-CU1Q5IV6.js +226 -0
- package/PdfContent.css +1 -0
- package/components/AttachmentCanvas/AttachmentCanvas.d.ts.map +1 -1
- package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts.map +1 -1
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts +7 -3
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts.map +1 -1
- package/components/CodeContent/CodeContent.d.ts +11 -0
- package/components/CodeContent/CodeContent.d.ts.map +1 -1
- package/components/LazyContentBoundary/LazyContentBoundary.d.ts +73 -0
- package/components/LazyContentBoundary/LazyContentBoundary.d.ts.map +1 -0
- package/components/PdfContent/PdfContent.d.ts +13 -3
- package/components/PdfContent/PdfContent.d.ts.map +1 -1
- package/index.css +1 -2
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +578 -15535
- package/models/attachment-canvas.d.ts +27 -7
- package/models/attachment-canvas.d.ts.map +1 -1
- package/package.json +7 -6
- package/utils/vite-external-matcher.d.ts +16 -0
- package/utils/vite-external-matcher.d.ts.map +1 -0
- package/PdfContent-CES32aGU.js +0 -17154
- package/download-BBbVchnm.js +0 -119
- package/esm-bFpgu8Tl.js +0 -17407
package/download-BBbVchnm.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { MIMEType as e, ensureDownloadFilename as t, triggerAnchorDownload as n, triggerBlobDownload as r } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
//#region src/types/attachment-canvas.ts
|
|
3
|
-
var i = /* @__PURE__ */ function(e) {
|
|
4
|
-
return e.PlainText = "plain_text", e.Image = "image", e.Audio = "audio", e.Markdown = "markdown", e.Json = "json", e.Pdf = "pdf", e.Ooxml = "ooxml", e.Code = "code", e.Html = "html", e.Visualizer = "visualizer", e.McpApp = "mcp_app", e.Unsupported = "unsupported", e.Error = "error", e;
|
|
5
|
-
}({}), a = /* @__PURE__ */ function(e) {
|
|
6
|
-
return e.Docx = "docx", e.Xlsx = "xlsx", e.Pptx = "pptx", e;
|
|
7
|
-
}({}), o = /* @__PURE__ */ function(e) {
|
|
8
|
-
return e.LoadFailed = "load_failed", e.Forbidden = "forbidden", e;
|
|
9
|
-
}({}), s = {
|
|
10
|
-
[a.Docx]: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
11
|
-
[a.Xlsx]: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
12
|
-
[a.Pptx]: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
13
|
-
}, c = (e) => {
|
|
14
|
-
switch (e.type) {
|
|
15
|
-
case i.PlainText:
|
|
16
|
-
case i.Markdown:
|
|
17
|
-
case i.Json:
|
|
18
|
-
case i.Image:
|
|
19
|
-
case i.Audio:
|
|
20
|
-
case i.Pdf:
|
|
21
|
-
case i.Ooxml:
|
|
22
|
-
case i.Code: return !0;
|
|
23
|
-
case i.Html: return e.url != null;
|
|
24
|
-
case i.Visualizer:
|
|
25
|
-
case i.McpApp: return !1;
|
|
26
|
-
case i.Unsupported: return e.url != null;
|
|
27
|
-
case i.Error: return e.errorType !== o.Forbidden && e.url != null;
|
|
28
|
-
}
|
|
29
|
-
}, l = async (e) => {
|
|
30
|
-
let t = await fetch(e);
|
|
31
|
-
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
32
|
-
return t.blob();
|
|
33
|
-
}, u = (t) => {
|
|
34
|
-
switch (t.type) {
|
|
35
|
-
case i.Image: return {
|
|
36
|
-
url: t.url,
|
|
37
|
-
mimeType: void 0
|
|
38
|
-
};
|
|
39
|
-
case i.Audio: return {
|
|
40
|
-
url: t.url,
|
|
41
|
-
mimeType: t.mimeType
|
|
42
|
-
};
|
|
43
|
-
case i.Pdf: return {
|
|
44
|
-
url: t.url,
|
|
45
|
-
mimeType: e.PDF
|
|
46
|
-
};
|
|
47
|
-
case i.Ooxml: return {
|
|
48
|
-
url: t.url,
|
|
49
|
-
mimeType: s[t.format]
|
|
50
|
-
};
|
|
51
|
-
case i.Html: return {
|
|
52
|
-
url: t.url,
|
|
53
|
-
mimeType: e.HTML
|
|
54
|
-
};
|
|
55
|
-
case i.Unsupported:
|
|
56
|
-
case i.Error: return {
|
|
57
|
-
url: t.url,
|
|
58
|
-
mimeType: void 0
|
|
59
|
-
};
|
|
60
|
-
case i.PlainText:
|
|
61
|
-
case i.Code: return {
|
|
62
|
-
url: void 0,
|
|
63
|
-
mimeType: e.Plain
|
|
64
|
-
};
|
|
65
|
-
case i.Markdown: return {
|
|
66
|
-
url: void 0,
|
|
67
|
-
mimeType: e.Markdown
|
|
68
|
-
};
|
|
69
|
-
case i.Json: return {
|
|
70
|
-
url: void 0,
|
|
71
|
-
mimeType: e.JSON
|
|
72
|
-
};
|
|
73
|
-
default: return {
|
|
74
|
-
url: void 0,
|
|
75
|
-
mimeType: void 0
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
}, d = (a, o) => {
|
|
79
|
-
let { url: s, mimeType: l } = u(a), d = t(o ?? "attachment", s, l);
|
|
80
|
-
switch (a.type) {
|
|
81
|
-
case i.PlainText:
|
|
82
|
-
if (a.text === "") return;
|
|
83
|
-
r(new Blob([a.text], { type: e.Plain }), d);
|
|
84
|
-
return;
|
|
85
|
-
case i.Markdown:
|
|
86
|
-
if (a.text === "") return;
|
|
87
|
-
r(new Blob([a.text], { type: e.Markdown }), d);
|
|
88
|
-
return;
|
|
89
|
-
case i.Json:
|
|
90
|
-
r(new Blob([JSON.stringify(a.value, null, 2)], { type: e.JSON }), d);
|
|
91
|
-
return;
|
|
92
|
-
case i.Image:
|
|
93
|
-
case i.Audio:
|
|
94
|
-
case i.Pdf:
|
|
95
|
-
case i.Ooxml:
|
|
96
|
-
n(a.url, d);
|
|
97
|
-
return;
|
|
98
|
-
case i.Code:
|
|
99
|
-
if (a.text === "") return;
|
|
100
|
-
r(new Blob([a.text], { type: e.Plain }), d);
|
|
101
|
-
return;
|
|
102
|
-
case i.Html:
|
|
103
|
-
if (a.url == null) return;
|
|
104
|
-
n(a.url, d);
|
|
105
|
-
return;
|
|
106
|
-
case i.Visualizer:
|
|
107
|
-
case i.McpApp: return;
|
|
108
|
-
case i.Unsupported:
|
|
109
|
-
if (a.url == null) return;
|
|
110
|
-
n(a.url, d);
|
|
111
|
-
return;
|
|
112
|
-
case i.Error:
|
|
113
|
-
if (!c(a) || a.url == null) return;
|
|
114
|
-
n(a.url, d);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
//#endregion
|
|
119
|
-
export { o as a, i, l as n, a as o, c as r, d as t };
|