@epam/ai-dial-attachment-canvas 1.1.0-dev.402 → 1.1.0-dev.405
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/AttachmentCanvas/AttachmentCanvas.d.ts.map +1 -1
- package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.d.ts +9 -7
- package/index.d.ts.map +1 -1
- package/index.js +384 -355
- package/models/attachment-canvas.d.ts +4 -0
- package/models/attachment-canvas.d.ts.map +1 -1
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import { c as e, i as t, l as n, o as r, s as i, t as a } from "./LazyContentBoundary-DkAcpR4S.js";
|
|
2
2
|
import { AttachmentType as o, CodeBlockTheme as s, DEFAULT_MARKDOWN_CLASS_NAMES as c, FileExtension as l, MIMEType as u, MarkdownRenderer as d, buildCssVars as f, copyToClipboard as p, mergeClasses as m, restrainedSyntaxTheme as h, stripUrlQueryAndFragment as g } from "@epam/ai-dial-chat-shared";
|
|
3
|
-
import { SidebarOrientation as _, SidebarPanel as
|
|
4
|
-
import { DIAL_ICON_SIZE as
|
|
5
|
-
import { IconAlertTriangle as
|
|
6
|
-
import { createContext as
|
|
7
|
-
import { JsonView as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { AppRenderer as
|
|
10
|
-
import { VisualizerConnectorRequests as
|
|
11
|
-
import { VisualizerConnector as
|
|
12
|
-
var
|
|
3
|
+
import { SidebarOrientation as _, SidebarPanel as ee } from "@epam/ai-dial-sidebar";
|
|
4
|
+
import { DIAL_ICON_SIZE as v, DIAL_KIT_ICON_STROKE as y, GhostIconButton as b, LinkButton as x, Spinner as S } from "@epam/ai-dial-ui-kit";
|
|
5
|
+
import { IconAlertTriangle as C, IconCheck as w, IconCode as te, IconCopy as ne, IconDownload as re, IconEye as ie, IconLock as ae, IconMarkdown as oe, IconRefresh as se } from "@tabler/icons-react";
|
|
6
|
+
import { createContext as T, lazy as E, memo as D, useCallback as O, useContext as k, useEffect as A, useMemo as j, useRef as M, useState as N } from "react";
|
|
7
|
+
import { JsonView as ce, defaultStyles as le } from "react-json-view-lite";
|
|
8
|
+
import { Fragment as ue, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
9
|
+
import { AppRenderer as de } from "@mcp-ui/client";
|
|
10
|
+
import { VisualizerConnectorRequests as I } from "@epam/ai-dial-shared";
|
|
11
|
+
import { VisualizerConnector as fe } from "@epam/ai-dial-visualizer-connector";
|
|
12
|
+
var L = {
|
|
13
13
|
container: "_container_1nhig_1",
|
|
14
14
|
containerLight: "_containerLight_1nhig_5"
|
|
15
|
-
},
|
|
15
|
+
}, pe = {
|
|
16
16
|
[s.Dark]: h,
|
|
17
17
|
[s.Light]: h
|
|
18
|
-
},
|
|
18
|
+
}, R = () => E(async () => {
|
|
19
19
|
let { Prism: e } = await import("react-syntax-highlighter");
|
|
20
20
|
return { default: e };
|
|
21
|
-
}),
|
|
22
|
-
let { text: r, language: i } = e, o = i == null || i === "plaintext", c =
|
|
21
|
+
}), me = D(({ content: e, codeBlockTheme: t = s.Light, labels: n }) => {
|
|
22
|
+
let { text: r, language: i } = e, o = i == null || i === "plaintext", c = pe[t], l = t === s.Light, [u, d] = N(0), f = j(R, [u]), p = O(() => {
|
|
23
23
|
d((e) => e + 1);
|
|
24
|
-
}, []), h = /* @__PURE__ */
|
|
24
|
+
}, []), h = /* @__PURE__ */ P("pre", {
|
|
25
25
|
className: "whitespace-pre-wrap break-words p-4",
|
|
26
26
|
children: r
|
|
27
27
|
});
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ P("div", {
|
|
29
29
|
dir: "ltr",
|
|
30
|
-
className: m("h-full overflow-auto",
|
|
31
|
-
children: o ? h : /* @__PURE__ */
|
|
30
|
+
className: m("h-full overflow-auto", L.container, l && L.containerLight),
|
|
31
|
+
children: o ? h : /* @__PURE__ */ P(a, {
|
|
32
32
|
retryKey: u,
|
|
33
33
|
onRetry: p,
|
|
34
34
|
pendingContent: h,
|
|
35
35
|
errorContent: h,
|
|
36
36
|
labels: n,
|
|
37
|
-
children: /* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ P(f, {
|
|
38
38
|
language: i,
|
|
39
39
|
style: c,
|
|
40
40
|
customStyle: {
|
|
@@ -51,21 +51,21 @@ var ue = {
|
|
|
51
51
|
})
|
|
52
52
|
})
|
|
53
53
|
});
|
|
54
|
-
}),
|
|
55
|
-
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] =
|
|
56
|
-
|
|
54
|
+
}), he = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ge = D(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
|
|
55
|
+
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = N(!0), [d, f] = N(!1), p = M(null);
|
|
56
|
+
A(() => {
|
|
57
57
|
u(!0), f(!1);
|
|
58
58
|
}, [e]);
|
|
59
|
-
let h =
|
|
59
|
+
let h = O((t) => {
|
|
60
60
|
if (u(!1), e.srcdoc == null) try {
|
|
61
61
|
p.current?.contentDocument ?? f(!0);
|
|
62
62
|
} catch {
|
|
63
63
|
f(!0);
|
|
64
64
|
}
|
|
65
|
-
}, [e.srcdoc]), g =
|
|
65
|
+
}, [e.srcdoc]), g = O(() => {
|
|
66
66
|
u(!1), f(!0);
|
|
67
67
|
}, []);
|
|
68
|
-
if (n && e.srcdoc != null) return /* @__PURE__ */
|
|
68
|
+
if (n && e.srcdoc != null) return /* @__PURE__ */ P(me, {
|
|
69
69
|
content: {
|
|
70
70
|
type: i.Code,
|
|
71
71
|
text: e.srcdoc,
|
|
@@ -73,70 +73,89 @@ var ue = {
|
|
|
73
73
|
},
|
|
74
74
|
codeBlockTheme: a
|
|
75
75
|
});
|
|
76
|
-
if (d) return /* @__PURE__ */
|
|
76
|
+
if (d) return /* @__PURE__ */ F("div", {
|
|
77
77
|
className: "flex h-full flex-col items-center justify-center gap-3 p-4",
|
|
78
|
-
children: [/* @__PURE__ */
|
|
78
|
+
children: [/* @__PURE__ */ P("p", {
|
|
79
79
|
className: "text-center",
|
|
80
80
|
children: s
|
|
81
|
-
}), e.url != null && /* @__PURE__ */
|
|
81
|
+
}), e.url != null && /* @__PURE__ */ P(x, {
|
|
82
82
|
href: e.url,
|
|
83
83
|
target: "_blank",
|
|
84
84
|
label: c,
|
|
85
|
-
className:
|
|
85
|
+
className: he.openInNewTabButton,
|
|
86
86
|
textClassName: o
|
|
87
87
|
})]
|
|
88
88
|
});
|
|
89
|
-
let _ = e.srcdoc != null,
|
|
90
|
-
return /* @__PURE__ */
|
|
89
|
+
let _ = e.srcdoc != null, ee = _ ? void 0 : e.url, v = _ ? e.srcdoc : void 0;
|
|
90
|
+
return /* @__PURE__ */ F("div", {
|
|
91
91
|
className: "relative h-full",
|
|
92
|
-
children: [l && /* @__PURE__ */
|
|
92
|
+
children: [l && /* @__PURE__ */ P("div", {
|
|
93
93
|
className: "absolute inset-0 flex items-center justify-center",
|
|
94
|
-
children: /* @__PURE__ */
|
|
95
|
-
}), /* @__PURE__ */
|
|
94
|
+
children: /* @__PURE__ */ P(S, {})
|
|
95
|
+
}), /* @__PURE__ */ P("iframe", {
|
|
96
96
|
ref: p,
|
|
97
97
|
title: r,
|
|
98
|
-
src:
|
|
99
|
-
srcDoc:
|
|
98
|
+
src: ee,
|
|
99
|
+
srcDoc: v,
|
|
100
100
|
sandbox: _ ? "allow-scripts" : "allow-scripts allow-same-origin",
|
|
101
101
|
className: m("h-full w-full border-none", l ? "invisible" : ""),
|
|
102
102
|
onLoad: h,
|
|
103
103
|
onError: g
|
|
104
104
|
})]
|
|
105
105
|
});
|
|
106
|
-
}),
|
|
107
|
-
loadingOverlay: "
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
106
|
+
}), z = {
|
|
107
|
+
loadingOverlay: "_loadingOverlay_72o98_1",
|
|
108
|
+
fullscreenFrame: "_fullscreenFrame_72o98_14",
|
|
109
|
+
statusLabel: "_statusLabel_72o98_19",
|
|
110
|
+
errorIcon: "_errorIcon_72o98_23"
|
|
111
|
+
}, B = ({ content: e, errorLabel: t = "Failed to load app" }) => {
|
|
112
|
+
let [n, r] = N("loading"), { html: i, sandboxUrl: a, toolName: o, toolInput: s, toolResult: c, hostContext: l, onToolCall: u } = e, d = j(() => ({ url: new URL(a) }), [a]), f = l?.displayMode === "fullscreen", p = M(null), [h, g] = N();
|
|
113
|
+
A(() => {
|
|
114
|
+
let e = p.current;
|
|
115
|
+
if (!e) return;
|
|
116
|
+
let t = new ResizeObserver(([e]) => {
|
|
117
|
+
if (!e) return;
|
|
118
|
+
let { width: t, height: n } = e.contentRect;
|
|
119
|
+
g({
|
|
120
|
+
width: Math.round(t),
|
|
121
|
+
height: Math.round(n)
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
return t.observe(e), () => t.disconnect();
|
|
125
|
+
}, []);
|
|
126
|
+
let _ = j(() => l == null || h == null ? l : {
|
|
127
|
+
...l,
|
|
128
|
+
containerDimensions: h
|
|
129
|
+
}, [l, h]);
|
|
130
|
+
return /* @__PURE__ */ F("div", {
|
|
131
|
+
ref: p,
|
|
132
|
+
className: m("relative h-full w-full", f && z.fullscreenFrame),
|
|
114
133
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ P(de, {
|
|
116
135
|
html: i,
|
|
117
136
|
toolName: o,
|
|
118
137
|
toolInput: s,
|
|
119
138
|
toolResult: c,
|
|
120
|
-
hostContext:
|
|
121
|
-
sandbox:
|
|
139
|
+
hostContext: _,
|
|
140
|
+
sandbox: d,
|
|
122
141
|
onCallTool: (e) => u(e.name, e.arguments),
|
|
123
142
|
onSizeChanged: () => r("ready"),
|
|
124
143
|
onError: () => r("error")
|
|
125
144
|
}),
|
|
126
|
-
n === "loading" && /* @__PURE__ */
|
|
127
|
-
className: m("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
128
|
-
children: /* @__PURE__ */
|
|
145
|
+
n === "loading" && /* @__PURE__ */ P("div", {
|
|
146
|
+
className: m("absolute inset-0 flex flex-col items-center justify-center gap-2", z.loadingOverlay),
|
|
147
|
+
children: /* @__PURE__ */ P(S, {})
|
|
129
148
|
}),
|
|
130
|
-
n === "error" && /* @__PURE__ */
|
|
149
|
+
n === "error" && /* @__PURE__ */ F("div", {
|
|
131
150
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
132
|
-
children: [/* @__PURE__ */
|
|
151
|
+
children: [/* @__PURE__ */ P(C, {
|
|
133
152
|
size: 60,
|
|
134
|
-
stroke:
|
|
153
|
+
stroke: y,
|
|
135
154
|
"aria-hidden": !0,
|
|
136
|
-
className:
|
|
137
|
-
}), /* @__PURE__ */
|
|
155
|
+
className: z.errorIcon
|
|
156
|
+
}), /* @__PURE__ */ P("p", {
|
|
138
157
|
role: "alert",
|
|
139
|
-
className: m("text-center",
|
|
158
|
+
className: m("text-center", z.statusLabel),
|
|
140
159
|
children: t
|
|
141
160
|
})]
|
|
142
161
|
})
|
|
@@ -149,13 +168,13 @@ var ue = {
|
|
|
149
168
|
formulaValue: "_formulaValue_1npwu_17",
|
|
150
169
|
statusOverlay: "_statusOverlay_1npwu_23",
|
|
151
170
|
errorIcon: "_errorIcon_1npwu_28"
|
|
152
|
-
},
|
|
171
|
+
}, _e = (e) => {
|
|
153
172
|
if (e?.kind !== "range") return "";
|
|
154
173
|
let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
|
|
155
174
|
if (n == null) return "";
|
|
156
175
|
let r = n.formula;
|
|
157
176
|
return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
|
|
158
|
-
},
|
|
177
|
+
}, ve = async (e, t, r, i) => {
|
|
159
178
|
switch (t) {
|
|
160
179
|
case n.Docx: {
|
|
161
180
|
let [{ DocxScrollViewer: t }, { chartEx: n }] = await Promise.all([import("./docx-B9qBTEkj.js"), import("./chart-ex-B0DgG3Dt.js")]);
|
|
@@ -197,18 +216,18 @@ var ue = {
|
|
|
197
216
|
});
|
|
198
217
|
}
|
|
199
218
|
}
|
|
200
|
-
},
|
|
201
|
-
let o =
|
|
202
|
-
return
|
|
219
|
+
}, ye = ({ content: e, fileName: t, loadErrorLabel: r, formulaLabel: i, formulaLabelClassName: a }) => {
|
|
220
|
+
let o = M(null), [s, c] = N(!0), [l, u] = N(!1), [d, f] = N("");
|
|
221
|
+
return A(() => {
|
|
203
222
|
let t = o.current;
|
|
204
223
|
if (t == null) return;
|
|
205
224
|
let n, r = !1;
|
|
206
225
|
return c(!0), u(!1), f(""), (async () => {
|
|
207
226
|
try {
|
|
208
|
-
let i = await
|
|
227
|
+
let i = await ve(t, e.format, () => {
|
|
209
228
|
r || (c(!1), u(!0));
|
|
210
229
|
}, (e) => {
|
|
211
|
-
r || f(
|
|
230
|
+
r || f(_e(e));
|
|
212
231
|
});
|
|
213
232
|
if (r) {
|
|
214
233
|
i.destroy();
|
|
@@ -221,18 +240,18 @@ var ue = {
|
|
|
221
240
|
})(), () => {
|
|
222
241
|
r = !0, n?.destroy(), t.replaceChildren();
|
|
223
242
|
};
|
|
224
|
-
}, [e.format, e.url]), /* @__PURE__ */
|
|
243
|
+
}, [e.format, e.url]), /* @__PURE__ */ F("div", {
|
|
225
244
|
className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
|
|
226
245
|
children: [
|
|
227
|
-
e.format === n.Xlsx && /* @__PURE__ */
|
|
246
|
+
e.format === n.Xlsx && /* @__PURE__ */ F("div", {
|
|
228
247
|
role: "region",
|
|
229
248
|
"aria-label": i,
|
|
230
249
|
className: m("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", V.formulaPanel),
|
|
231
|
-
children: [/* @__PURE__ */
|
|
250
|
+
children: [/* @__PURE__ */ P("span", {
|
|
232
251
|
"aria-hidden": "true",
|
|
233
252
|
className: m("shrink-0", a),
|
|
234
253
|
children: "fx"
|
|
235
|
-
}), /* @__PURE__ */
|
|
254
|
+
}), /* @__PURE__ */ P("code", {
|
|
236
255
|
dir: "ltr",
|
|
237
256
|
tabIndex: 0,
|
|
238
257
|
"aria-live": "polite",
|
|
@@ -240,25 +259,25 @@ var ue = {
|
|
|
240
259
|
children: d
|
|
241
260
|
})]
|
|
242
261
|
}),
|
|
243
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ P("div", {
|
|
244
263
|
ref: o,
|
|
245
264
|
role: "document",
|
|
246
265
|
"aria-label": t,
|
|
247
266
|
"aria-busy": s,
|
|
248
267
|
className: m("min-h-0 w-full flex-1 overflow-hidden", V.viewer)
|
|
249
268
|
}),
|
|
250
|
-
(s || l) && /* @__PURE__ */
|
|
269
|
+
(s || l) && /* @__PURE__ */ P("div", {
|
|
251
270
|
role: l ? "alert" : void 0,
|
|
252
271
|
"aria-live": "polite",
|
|
253
272
|
className: m("absolute inset-0 flex items-center justify-center", V.statusOverlay),
|
|
254
|
-
children: s ? /* @__PURE__ */
|
|
273
|
+
children: s ? /* @__PURE__ */ P(S, { size: 48 }) : /* @__PURE__ */ F("div", {
|
|
255
274
|
className: "flex flex-col items-center gap-2",
|
|
256
|
-
children: [/* @__PURE__ */
|
|
275
|
+
children: [/* @__PURE__ */ P(C, {
|
|
257
276
|
"aria-hidden": "true",
|
|
258
277
|
size: 60,
|
|
259
|
-
stroke:
|
|
278
|
+
stroke: y,
|
|
260
279
|
className: V.errorIcon
|
|
261
|
-
}), /* @__PURE__ */
|
|
280
|
+
}), /* @__PURE__ */ P("p", {
|
|
262
281
|
className: "text-center",
|
|
263
282
|
children: r
|
|
264
283
|
})]
|
|
@@ -270,13 +289,13 @@ var ue = {
|
|
|
270
289
|
loadingOverlay: "_loadingOverlay_12637_1",
|
|
271
290
|
statusLabel: "_statusLabel_12637_5",
|
|
272
291
|
errorIcon: "_errorIcon_12637_9"
|
|
273
|
-
},
|
|
274
|
-
let i =
|
|
275
|
-
return u.current = e,
|
|
292
|
+
}, be = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", colors: r }) => {
|
|
293
|
+
let i = M(null), [a, o] = N("loading"), { url: s, visualizerName: c, requestTimeout: l } = e, u = M(e);
|
|
294
|
+
return u.current = e, A(() => {
|
|
276
295
|
let e = i.current;
|
|
277
296
|
if (!e) return;
|
|
278
297
|
o("loading");
|
|
279
|
-
let t = new
|
|
298
|
+
let t = new fe(e, {
|
|
280
299
|
domain: s,
|
|
281
300
|
hostDomain: window.location.origin,
|
|
282
301
|
visualizerName: c,
|
|
@@ -288,7 +307,7 @@ var ue = {
|
|
|
288
307
|
layout: r,
|
|
289
308
|
...typeof i == "object" && i ? i : {}
|
|
290
309
|
};
|
|
291
|
-
await t.send(
|
|
310
|
+
await t.send(I.sendVisualizeData, {
|
|
292
311
|
mimeType: e,
|
|
293
312
|
visualizerData: a
|
|
294
313
|
}), n && o("ready");
|
|
@@ -301,7 +320,7 @@ var ue = {
|
|
|
301
320
|
s,
|
|
302
321
|
c,
|
|
303
322
|
l
|
|
304
|
-
]), /* @__PURE__ */
|
|
323
|
+
]), /* @__PURE__ */ F("div", {
|
|
305
324
|
className: "relative h-full w-full",
|
|
306
325
|
style: f({
|
|
307
326
|
"--vs-loading-bg": r?.loadingBackground,
|
|
@@ -309,25 +328,25 @@ var ue = {
|
|
|
309
328
|
"--vs-error-icon": r?.errorIcon
|
|
310
329
|
}),
|
|
311
330
|
children: [
|
|
312
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ P("div", {
|
|
313
332
|
ref: i,
|
|
314
333
|
className: "h-full w-full"
|
|
315
334
|
}),
|
|
316
|
-
a === "loading" && /* @__PURE__ */
|
|
335
|
+
a === "loading" && /* @__PURE__ */ F("div", {
|
|
317
336
|
className: m("absolute inset-0 flex flex-col items-center justify-center gap-2", H.loadingOverlay),
|
|
318
|
-
children: [/* @__PURE__ */
|
|
337
|
+
children: [/* @__PURE__ */ P(S, {}), t && /* @__PURE__ */ P("p", {
|
|
319
338
|
className: m("text-center", H.statusLabel),
|
|
320
339
|
children: t
|
|
321
340
|
})]
|
|
322
341
|
}),
|
|
323
|
-
a === "error" && /* @__PURE__ */
|
|
342
|
+
a === "error" && /* @__PURE__ */ F("div", {
|
|
324
343
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
325
|
-
children: [/* @__PURE__ */
|
|
344
|
+
children: [/* @__PURE__ */ P(C, {
|
|
326
345
|
size: 60,
|
|
327
|
-
stroke:
|
|
346
|
+
stroke: y,
|
|
328
347
|
"aria-hidden": !0,
|
|
329
348
|
className: H.errorIcon
|
|
330
|
-
}), /* @__PURE__ */
|
|
349
|
+
}), /* @__PURE__ */ P("p", {
|
|
331
350
|
role: "alert",
|
|
332
351
|
className: m("text-center", H.statusLabel),
|
|
333
352
|
children: n
|
|
@@ -350,64 +369,64 @@ var ue = {
|
|
|
350
369
|
jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
|
|
351
370
|
jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
|
|
352
371
|
jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
|
|
353
|
-
},
|
|
354
|
-
let [r, i] =
|
|
355
|
-
return
|
|
372
|
+
}, xe = () => E(async () => ({ default: (await import("./PdfContent-BBUc0_SC.js")).PdfContent })), Se = ({ url: e, fileName: t, loadErrorLabel: n }) => {
|
|
373
|
+
let [r, i] = N(!1);
|
|
374
|
+
return A(() => {
|
|
356
375
|
i(!1);
|
|
357
|
-
}, [e]), r ? /* @__PURE__ */
|
|
376
|
+
}, [e]), r ? /* @__PURE__ */ F("div", {
|
|
358
377
|
className: "flex flex-col items-center gap-2",
|
|
359
|
-
children: [/* @__PURE__ */
|
|
378
|
+
children: [/* @__PURE__ */ P(C, {
|
|
360
379
|
size: 60,
|
|
361
|
-
stroke:
|
|
380
|
+
stroke: y,
|
|
362
381
|
className: U.errorIcon
|
|
363
|
-
}), /* @__PURE__ */
|
|
382
|
+
}), /* @__PURE__ */ P("p", {
|
|
364
383
|
className: m("text-center", U.statusLabel),
|
|
365
384
|
children: n
|
|
366
385
|
})]
|
|
367
|
-
}) : /* @__PURE__ */
|
|
386
|
+
}) : /* @__PURE__ */ P("img", {
|
|
368
387
|
src: e,
|
|
369
388
|
alt: t ?? "",
|
|
370
389
|
className: "max-h-full max-w-full object-contain",
|
|
371
390
|
onError: () => i(!0)
|
|
372
391
|
});
|
|
373
|
-
},
|
|
392
|
+
}, Ce = new Set([
|
|
374
393
|
i.PlainText,
|
|
375
394
|
i.Code,
|
|
376
395
|
i.Ooxml
|
|
377
|
-
]),
|
|
378
|
-
let { colors:
|
|
379
|
-
|
|
380
|
-
}, []),
|
|
396
|
+
]), we = D(({ content: t, isLoading: n = !1, fileName: r, isHtmlSourceView: o = !1, labels: { unsupportedLabel: s = "Preview is not supported for this file", loadErrorLabel: l = "Failed to load file", forbiddenErrorLabel: u = "You don't have permission to access this file", visualizerErrorLabel: p, htmlFrameBlockedLabel: h = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: g = "Open in new tab", pdfThumbnailsLabel: _, pdfShowThumbnailsLabel: ee, pdfHideThumbnailsLabel: v, pdfPageNumberLabel: b, pdfContentLoadingLabel: x, pdfContentErrorLabel: w, pdfContentRetryLabel: te, xlsxFormulaLabel: ne = "Formula", codeContentLoadingLabel: re, codeContentErrorLabel: ie, codeContentRetryLabel: oe } = {}, styles: se, codeBlockTheme: T, loadPdf: E, hidePdfToolbar: D = !1, configurePdfWorker: k }) => {
|
|
397
|
+
let { colors: A, typography: M, bodyClassName: ue, cssVars: de } = se ?? {}, [I, fe] = N(0), L = j(xe, [I]), pe = O(() => {
|
|
398
|
+
fe((e) => e + 1);
|
|
399
|
+
}, []), R = M?.fontClassName != null, he = j(() => ({
|
|
381
400
|
...f({
|
|
382
|
-
"--ac-text":
|
|
383
|
-
"--ac-status-text":
|
|
384
|
-
"--ac-error-icon":
|
|
385
|
-
"--ac-open-in-new-tab-text":
|
|
386
|
-
"--ac-json-border":
|
|
387
|
-
"--ac-json-bg":
|
|
388
|
-
"--ac-json-label":
|
|
389
|
-
"--ac-json-clickable-label":
|
|
390
|
-
"--ac-json-punctuation":
|
|
391
|
-
"--ac-json-string":
|
|
392
|
-
"--ac-json-number":
|
|
393
|
-
"--ac-json-boolean":
|
|
394
|
-
"--ac-json-null":
|
|
395
|
-
"--ac-json-toggle-icon":
|
|
396
|
-
"--ac-json-toggle-icon-hover":
|
|
397
|
-
"--ac-ooxml-bg":
|
|
398
|
-
"--ac-ooxml-formula-border":
|
|
399
|
-
"--ac-ooxml-formula-bg":
|
|
400
|
-
"--ac-ooxml-formula-text":
|
|
401
|
-
"--ac-json-collapsed-text":
|
|
402
|
-
"--ac-json-collapsed-bg":
|
|
403
|
-
"--ac-font-family":
|
|
404
|
-
"--ac-font-size":
|
|
405
|
-
"--ac-font-weight":
|
|
406
|
-
"--ac-line-height":
|
|
407
|
-
"--ac-letter-spacing":
|
|
401
|
+
"--ac-text": A?.text,
|
|
402
|
+
"--ac-status-text": A?.statusText,
|
|
403
|
+
"--ac-error-icon": A?.errorIcon,
|
|
404
|
+
"--ac-open-in-new-tab-text": A?.openInNewTabText,
|
|
405
|
+
"--ac-json-border": A?.jsonBorder,
|
|
406
|
+
"--ac-json-bg": A?.jsonBackground,
|
|
407
|
+
"--ac-json-label": A?.jsonLabel,
|
|
408
|
+
"--ac-json-clickable-label": A?.jsonClickableLabel,
|
|
409
|
+
"--ac-json-punctuation": A?.jsonPunctuation,
|
|
410
|
+
"--ac-json-string": A?.jsonString,
|
|
411
|
+
"--ac-json-number": A?.jsonNumber,
|
|
412
|
+
"--ac-json-boolean": A?.jsonBoolean,
|
|
413
|
+
"--ac-json-null": A?.jsonNull,
|
|
414
|
+
"--ac-json-toggle-icon": A?.jsonToggleIcon,
|
|
415
|
+
"--ac-json-toggle-icon-hover": A?.jsonToggleIconHover,
|
|
416
|
+
"--ac-ooxml-bg": A?.ooxmlBackground,
|
|
417
|
+
"--ac-ooxml-formula-border": A?.ooxmlFormulaBorder,
|
|
418
|
+
"--ac-ooxml-formula-bg": A?.ooxmlFormulaBackground,
|
|
419
|
+
"--ac-ooxml-formula-text": A?.ooxmlFormulaText,
|
|
420
|
+
"--ac-json-collapsed-text": A?.jsonCollapsedText,
|
|
421
|
+
"--ac-json-collapsed-bg": A?.jsonCollapsedBackground,
|
|
422
|
+
"--ac-font-family": R ? void 0 : M?.fontFamily,
|
|
423
|
+
"--ac-font-size": R ? void 0 : M?.fontSize,
|
|
424
|
+
"--ac-font-weight": R ? void 0 : M?.fontWeight,
|
|
425
|
+
"--ac-line-height": R ? void 0 : M?.lineHeight,
|
|
426
|
+
"--ac-letter-spacing": R ? void 0 : M?.letterSpacing
|
|
408
427
|
}),
|
|
409
|
-
...
|
|
410
|
-
}), [
|
|
428
|
+
...de
|
|
429
|
+
}), [se]), z = j(() => {
|
|
411
430
|
switch (t.type) {
|
|
412
431
|
case i.Image:
|
|
413
432
|
case i.Audio:
|
|
@@ -422,44 +441,44 @@ var ue = {
|
|
|
422
441
|
case i.Html: return "h-full overflow-hidden";
|
|
423
442
|
default: return "h-full overflow-auto p-4";
|
|
424
443
|
}
|
|
425
|
-
}, [t.type]),
|
|
444
|
+
}, [t.type]), V = j(() => {
|
|
426
445
|
switch (t.type) {
|
|
427
|
-
case i.PlainText: return /* @__PURE__ */
|
|
428
|
-
className: m("whitespace-pre-wrap break-words", U.body,
|
|
446
|
+
case i.PlainText: return /* @__PURE__ */ P("pre", {
|
|
447
|
+
className: m("whitespace-pre-wrap break-words", U.body, M?.fontClassName),
|
|
429
448
|
children: t.text
|
|
430
449
|
});
|
|
431
|
-
case i.Image: return /* @__PURE__ */
|
|
450
|
+
case i.Image: return /* @__PURE__ */ P(Se, {
|
|
432
451
|
url: t.url,
|
|
433
452
|
fileName: r,
|
|
434
453
|
loadErrorLabel: l
|
|
435
454
|
});
|
|
436
|
-
case i.Audio: return /* @__PURE__ */
|
|
455
|
+
case i.Audio: return /* @__PURE__ */ P("audio", {
|
|
437
456
|
controls: !0,
|
|
438
457
|
src: t.url,
|
|
439
458
|
"aria-label": r ?? "Audio attachment",
|
|
440
459
|
className: "w-full max-w-sm",
|
|
441
460
|
preload: "metadata",
|
|
442
|
-
children: t.mimeType && /* @__PURE__ */
|
|
461
|
+
children: t.mimeType && /* @__PURE__ */ P("source", {
|
|
443
462
|
src: t.url,
|
|
444
463
|
type: t.mimeType
|
|
445
464
|
})
|
|
446
465
|
});
|
|
447
|
-
case i.Markdown: return /* @__PURE__ */
|
|
466
|
+
case i.Markdown: return /* @__PURE__ */ P(d, {
|
|
448
467
|
content: t.text,
|
|
449
468
|
isStreaming: !1,
|
|
450
|
-
codeBlockTheme:
|
|
469
|
+
codeBlockTheme: T,
|
|
451
470
|
classNames: c
|
|
452
471
|
});
|
|
453
|
-
case i.Json: return /* @__PURE__ */
|
|
472
|
+
case i.Json: return /* @__PURE__ */ P("div", {
|
|
454
473
|
dir: "ltr",
|
|
455
474
|
className: "h-full overflow-auto",
|
|
456
|
-
children: /* @__PURE__ */
|
|
475
|
+
children: /* @__PURE__ */ P("div", {
|
|
457
476
|
className: m("m-3 overflow-auto rounded-md border", U.jsonWrapper),
|
|
458
|
-
children: /* @__PURE__ */
|
|
477
|
+
children: /* @__PURE__ */ P(ce, {
|
|
459
478
|
data: t.value,
|
|
460
479
|
style: {
|
|
461
|
-
container: m("whitespace-pre-wrap break-words p-2",
|
|
462
|
-
basicChildStyle:
|
|
480
|
+
container: m("whitespace-pre-wrap break-words p-2", M?.jsonClassName ?? "dial-code-text"),
|
|
481
|
+
basicChildStyle: le.basicChildStyle,
|
|
463
482
|
childFieldsContainer: "m-0 ps-3",
|
|
464
483
|
label: m("me-1 font-semibold", U.jsonLabel),
|
|
465
484
|
clickableLabel: m("me-1 cursor-pointer font-semibold hover:underline", U.jsonClickableLabel),
|
|
@@ -477,16 +496,16 @@ var ue = {
|
|
|
477
496
|
})
|
|
478
497
|
})
|
|
479
498
|
});
|
|
480
|
-
case i.Code: return /* @__PURE__ */
|
|
499
|
+
case i.Code: return /* @__PURE__ */ P(me, {
|
|
481
500
|
content: t,
|
|
482
|
-
codeBlockTheme:
|
|
501
|
+
codeBlockTheme: T,
|
|
483
502
|
labels: {
|
|
484
|
-
loadingLabel:
|
|
485
|
-
errorLabel:
|
|
486
|
-
retryLabel:
|
|
503
|
+
loadingLabel: re,
|
|
504
|
+
errorLabel: ie,
|
|
505
|
+
retryLabel: oe
|
|
487
506
|
}
|
|
488
507
|
});
|
|
489
|
-
case i.Html: return /* @__PURE__ */
|
|
508
|
+
case i.Html: return /* @__PURE__ */ P(ge, {
|
|
490
509
|
content: t,
|
|
491
510
|
labels: {
|
|
492
511
|
htmlFrameBlockedLabel: h,
|
|
@@ -494,60 +513,60 @@ var ue = {
|
|
|
494
513
|
},
|
|
495
514
|
isSourceView: o,
|
|
496
515
|
title: r,
|
|
497
|
-
codeBlockTheme:
|
|
516
|
+
codeBlockTheme: T
|
|
498
517
|
});
|
|
499
|
-
case i.Pdf: return /* @__PURE__ */
|
|
500
|
-
retryKey:
|
|
501
|
-
onRetry:
|
|
518
|
+
case i.Pdf: return /* @__PURE__ */ P(a, {
|
|
519
|
+
retryKey: I,
|
|
520
|
+
onRetry: pe,
|
|
502
521
|
labels: {
|
|
503
|
-
loadingLabel:
|
|
504
|
-
errorLabel:
|
|
505
|
-
retryLabel:
|
|
522
|
+
loadingLabel: x,
|
|
523
|
+
errorLabel: w,
|
|
524
|
+
retryLabel: te
|
|
506
525
|
},
|
|
507
|
-
children: /* @__PURE__ */
|
|
526
|
+
children: /* @__PURE__ */ P(L, {
|
|
508
527
|
fileName: r,
|
|
509
528
|
url: t.url,
|
|
510
529
|
highlights: t.highlights ?? [],
|
|
511
530
|
selectedHighlightId: t.selectedHighlightId,
|
|
512
|
-
loadPdf:
|
|
513
|
-
hideHeader:
|
|
514
|
-
configurePdfWorker:
|
|
531
|
+
loadPdf: E,
|
|
532
|
+
hideHeader: D,
|
|
533
|
+
configurePdfWorker: k,
|
|
515
534
|
labels: {
|
|
516
535
|
thumbnailsLabel: _,
|
|
517
|
-
showThumbnailsLabel:
|
|
518
|
-
hideThumbnailsLabel:
|
|
519
|
-
pageNumberLabel:
|
|
520
|
-
loadingLabel:
|
|
521
|
-
errorLabel:
|
|
522
|
-
retryLabel:
|
|
536
|
+
showThumbnailsLabel: ee,
|
|
537
|
+
hideThumbnailsLabel: v,
|
|
538
|
+
pageNumberLabel: b,
|
|
539
|
+
loadingLabel: x,
|
|
540
|
+
errorLabel: w,
|
|
541
|
+
retryLabel: te
|
|
523
542
|
}
|
|
524
543
|
})
|
|
525
544
|
}, t.url);
|
|
526
|
-
case i.Ooxml: return /* @__PURE__ */
|
|
545
|
+
case i.Ooxml: return /* @__PURE__ */ P(ye, {
|
|
527
546
|
content: t,
|
|
528
547
|
fileName: r,
|
|
529
548
|
loadErrorLabel: l,
|
|
530
|
-
formulaLabel:
|
|
531
|
-
formulaLabelClassName:
|
|
549
|
+
formulaLabel: ne,
|
|
550
|
+
formulaLabelClassName: M?.xlsxFormulaLabelClassName ?? "dial-italic-text"
|
|
532
551
|
});
|
|
533
|
-
case i.Visualizer: return /* @__PURE__ */
|
|
552
|
+
case i.Visualizer: return /* @__PURE__ */ P(be, {
|
|
534
553
|
content: t,
|
|
535
554
|
errorLabel: p
|
|
536
555
|
});
|
|
537
|
-
case i.McpApp: return /* @__PURE__ */
|
|
538
|
-
case i.Unsupported: return /* @__PURE__ */
|
|
556
|
+
case i.McpApp: return /* @__PURE__ */ P(B, { content: t });
|
|
557
|
+
case i.Unsupported: return /* @__PURE__ */ P("p", {
|
|
539
558
|
className: m("text-center", U.statusLabel),
|
|
540
559
|
children: s
|
|
541
560
|
});
|
|
542
561
|
case i.Error: {
|
|
543
562
|
let n = t.errorType === e.Forbidden;
|
|
544
|
-
return /* @__PURE__ */
|
|
563
|
+
return /* @__PURE__ */ F("div", {
|
|
545
564
|
className: "flex flex-col items-center gap-2",
|
|
546
|
-
children: [
|
|
565
|
+
children: [P(n ? ae : C, {
|
|
547
566
|
size: 60,
|
|
548
|
-
stroke:
|
|
567
|
+
stroke: y,
|
|
549
568
|
className: U.errorIcon
|
|
550
|
-
}), /* @__PURE__ */
|
|
569
|
+
}), /* @__PURE__ */ P("p", {
|
|
551
570
|
className: m("text-center", U.statusLabel),
|
|
552
571
|
children: n ? u : l
|
|
553
572
|
})]
|
|
@@ -556,11 +575,11 @@ var ue = {
|
|
|
556
575
|
}
|
|
557
576
|
}, [
|
|
558
577
|
t,
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
578
|
+
M?.fontClassName,
|
|
579
|
+
M?.jsonClassName,
|
|
580
|
+
M?.xlsxFormulaLabelClassName,
|
|
562
581
|
r,
|
|
563
|
-
|
|
582
|
+
T,
|
|
564
583
|
s,
|
|
565
584
|
l,
|
|
566
585
|
u,
|
|
@@ -568,48 +587,48 @@ var ue = {
|
|
|
568
587
|
h,
|
|
569
588
|
g,
|
|
570
589
|
o,
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
590
|
+
E,
|
|
591
|
+
D,
|
|
592
|
+
k,
|
|
574
593
|
_,
|
|
594
|
+
ee,
|
|
575
595
|
v,
|
|
576
|
-
|
|
596
|
+
b,
|
|
577
597
|
x,
|
|
578
|
-
|
|
579
|
-
T,
|
|
580
|
-
ee,
|
|
598
|
+
w,
|
|
581
599
|
te,
|
|
582
600
|
ne,
|
|
583
601
|
re,
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
602
|
+
ie,
|
|
603
|
+
oe,
|
|
604
|
+
L,
|
|
605
|
+
I,
|
|
606
|
+
pe
|
|
588
607
|
]);
|
|
589
|
-
return /* @__PURE__ */
|
|
590
|
-
style: !n &&
|
|
591
|
-
className: m(n ? "flex h-full items-center justify-center" :
|
|
592
|
-
children: n ? /* @__PURE__ */
|
|
608
|
+
return /* @__PURE__ */ P("div", {
|
|
609
|
+
style: !n && Ce.has(t.type) ? he : void 0,
|
|
610
|
+
className: m(n ? "flex h-full items-center justify-center" : z, ue),
|
|
611
|
+
children: n ? /* @__PURE__ */ P(S, {}) : V
|
|
593
612
|
});
|
|
594
|
-
}),
|
|
595
|
-
let [
|
|
596
|
-
B?.(), J.current != null && clearTimeout(J.current),
|
|
597
|
-
}, [B]),
|
|
598
|
-
|
|
599
|
-
}, [
|
|
600
|
-
|
|
601
|
-
}, [
|
|
602
|
-
|
|
613
|
+
}), Te = 2e3, Ee = D(({ isOpen: e, isLoading: t = !1, onClose: n, content: a, fileName: o, labels: { ariaLabel: s, closeLabel: c = "Close", downloadLabel: l = "Download", copyTextLabel: u = "Copy text", copiedTextLabel: d = "Copied!", copyMarkdownLabel: f = "Copy as Markdown", copiedMarkdownLabel: p = "Copied!", copyJsonLabel: h = "Copy as JSON", copiedJsonLabel: g = "Copied!", visualizerErrorLabel: x, unsupportedLabel: S = "Preview is not supported for this file", loadErrorLabel: C = "Failed to load file", forbiddenErrorLabel: ae = "You don't have permission to access this file", htmlFrameBlockedLabel: T = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: E = "Open in new tab", htmlViewSourceLabel: D = "View source", htmlViewRenderedLabel: k = "View rendered", mcpAppReloadLabel: j = "Reload", pdfThumbnailsLabel: ce, pdfShowThumbnailsLabel: le, pdfHideThumbnailsLabel: de, pdfPageNumberLabel: I, pdfContentLoadingLabel: fe, pdfContentErrorLabel: L, pdfContentRetryLabel: pe, xlsxFormulaLabel: R, codeContentLoadingLabel: me, codeContentErrorLabel: he, codeContentRetryLabel: ge }, onDownload: z, onCopyText: B, onCopyMarkdown: V, onCopyJson: _e, isMobile: ve = !1, defaultWidth: ye, minWidth: H = 600, maxWidth: be = 1500, onResizeStop: U, styles: xe, codeBlockTheme: Se, loadPdf: Ce, configurePdfWorker: Ee }) => {
|
|
614
|
+
let [De, Oe] = N(!1), [W, ke] = N(!1), [G, Ae] = N(!1), [K, q] = N(!1), J = M(null), Y = M(null), X = M(null), je = O(() => {
|
|
615
|
+
B?.(), J.current != null && clearTimeout(J.current), Oe(!0), J.current = setTimeout(() => Oe(!1), Te);
|
|
616
|
+
}, [B]), Z = O(() => {
|
|
617
|
+
V?.(), Y.current != null && clearTimeout(Y.current), ke(!0), Y.current = setTimeout(() => ke(!1), Te);
|
|
618
|
+
}, [V]), Me = O(() => {
|
|
619
|
+
_e?.(), X.current != null && clearTimeout(X.current), Ae(!0), X.current = setTimeout(() => Ae(!1), Te);
|
|
620
|
+
}, [_e]);
|
|
621
|
+
A(() => () => {
|
|
603
622
|
J.current != null && clearTimeout(J.current), Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current);
|
|
604
623
|
}, []);
|
|
605
|
-
let
|
|
606
|
-
|
|
624
|
+
let Ne = O(() => {
|
|
625
|
+
q((e) => !e);
|
|
607
626
|
}, []);
|
|
608
|
-
|
|
609
|
-
|
|
627
|
+
A(() => {
|
|
628
|
+
q(!1);
|
|
610
629
|
}, [a]);
|
|
611
|
-
let { className:
|
|
612
|
-
return /* @__PURE__ */
|
|
630
|
+
let { className: Pe, panelStyles: Q, ...Fe } = xe ?? {}, Ie = !t && a.type === i.Html && a.srcdoc != null, $ = !t && B != null && (a.type === i.PlainText || a.type === i.Code), Le = !t && V != null && a.type === i.Markdown, Re = !t && _e != null && a.type === i.Json, ze = !t && z != null && r(a), Be = !t && a.type === i.McpApp && a.onReload != null;
|
|
631
|
+
return /* @__PURE__ */ P(ee, {
|
|
613
632
|
isOpen: e,
|
|
614
633
|
orientation: _.Right,
|
|
615
634
|
title: o,
|
|
@@ -618,119 +637,129 @@ var ue = {
|
|
|
618
637
|
closeLabel: c
|
|
619
638
|
},
|
|
620
639
|
onClose: n,
|
|
621
|
-
resizable: !
|
|
622
|
-
defaultWidth:
|
|
623
|
-
minWidth:
|
|
624
|
-
maxWidth:
|
|
625
|
-
onResizeStop:
|
|
640
|
+
resizable: !ve,
|
|
641
|
+
defaultWidth: ye,
|
|
642
|
+
minWidth: H,
|
|
643
|
+
maxWidth: be,
|
|
644
|
+
onResizeStop: U,
|
|
626
645
|
styles: {
|
|
627
646
|
...Q,
|
|
628
647
|
titleClassName: Q?.titleClassName ?? "dial-h3-text",
|
|
629
648
|
headerClassName: m("border-b border-tertiary", Q?.headerClassName),
|
|
630
|
-
className: m(e ? "mobile:w-full mobile:max-w-full" : "w-0",
|
|
649
|
+
className: m(e ? "mobile:w-full mobile:max-w-full" : "w-0", Pe, Q?.className)
|
|
631
650
|
},
|
|
632
|
-
rightActions:
|
|
633
|
-
|
|
634
|
-
icon:
|
|
635
|
-
size:
|
|
636
|
-
stroke:
|
|
651
|
+
rightActions: Ie || $ || Le || Re || ze || Be ? /* @__PURE__ */ F(ue, { children: [
|
|
652
|
+
Be && /* @__PURE__ */ P(b, {
|
|
653
|
+
icon: /* @__PURE__ */ P(se, {
|
|
654
|
+
size: v.LG,
|
|
655
|
+
stroke: y,
|
|
637
656
|
"aria-hidden": !0
|
|
638
657
|
}),
|
|
639
|
-
"aria-label":
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
onClick: je
|
|
658
|
+
"aria-label": j,
|
|
659
|
+
tooltipProps: { tooltip: j },
|
|
660
|
+
onClick: a.type === i.McpApp ? a.onReload : void 0
|
|
643
661
|
}),
|
|
644
|
-
|
|
645
|
-
icon:
|
|
646
|
-
size:
|
|
647
|
-
stroke:
|
|
662
|
+
Ie && /* @__PURE__ */ P(b, {
|
|
663
|
+
icon: P(K ? ie : te, {
|
|
664
|
+
size: v.LG,
|
|
665
|
+
stroke: y,
|
|
648
666
|
"aria-hidden": !0
|
|
649
667
|
}),
|
|
650
|
-
"aria-label":
|
|
651
|
-
|
|
652
|
-
|
|
668
|
+
"aria-label": K ? k : D,
|
|
669
|
+
"aria-pressed": K,
|
|
670
|
+
tooltipProps: { tooltip: K ? k : D },
|
|
671
|
+
onClick: Ne
|
|
653
672
|
}),
|
|
654
|
-
$ && /* @__PURE__ */
|
|
655
|
-
icon:
|
|
656
|
-
size:
|
|
657
|
-
stroke:
|
|
673
|
+
$ && /* @__PURE__ */ P(b, {
|
|
674
|
+
icon: P(De ? w : ne, {
|
|
675
|
+
size: v.LG,
|
|
676
|
+
stroke: y,
|
|
658
677
|
"aria-hidden": !0
|
|
659
678
|
}),
|
|
660
|
-
"aria-label":
|
|
661
|
-
tooltipProps: { tooltip:
|
|
662
|
-
onClick:
|
|
679
|
+
"aria-label": De ? d : u,
|
|
680
|
+
tooltipProps: { tooltip: De ? d : u },
|
|
681
|
+
onClick: je
|
|
663
682
|
}),
|
|
664
|
-
|
|
665
|
-
icon:
|
|
666
|
-
size:
|
|
667
|
-
stroke:
|
|
683
|
+
Le && /* @__PURE__ */ P(b, {
|
|
684
|
+
icon: P(W ? w : oe, {
|
|
685
|
+
size: v.LG,
|
|
686
|
+
stroke: y,
|
|
668
687
|
"aria-hidden": !0
|
|
669
688
|
}),
|
|
670
|
-
"aria-label":
|
|
671
|
-
tooltipProps: { tooltip:
|
|
689
|
+
"aria-label": W ? p : f,
|
|
690
|
+
tooltipProps: { tooltip: W ? p : f },
|
|
672
691
|
onClick: Z
|
|
673
692
|
}),
|
|
674
|
-
|
|
675
|
-
icon:
|
|
676
|
-
size:
|
|
677
|
-
stroke:
|
|
693
|
+
Re && /* @__PURE__ */ P(b, {
|
|
694
|
+
icon: P(G ? w : ne, {
|
|
695
|
+
size: v.LG,
|
|
696
|
+
stroke: y,
|
|
697
|
+
"aria-hidden": !0
|
|
698
|
+
}),
|
|
699
|
+
"aria-label": G ? g : h,
|
|
700
|
+
tooltipProps: { tooltip: G ? g : h },
|
|
701
|
+
onClick: Me
|
|
702
|
+
}),
|
|
703
|
+
ze && /* @__PURE__ */ P(b, {
|
|
704
|
+
icon: /* @__PURE__ */ P(re, {
|
|
705
|
+
size: v.LG,
|
|
706
|
+
stroke: y
|
|
678
707
|
}),
|
|
679
708
|
"aria-label": l,
|
|
680
709
|
tooltipProps: { tooltip: l },
|
|
681
|
-
onClick:
|
|
710
|
+
onClick: z
|
|
682
711
|
})
|
|
683
712
|
] }) : null,
|
|
684
|
-
children: /* @__PURE__ */
|
|
713
|
+
children: /* @__PURE__ */ P(we, {
|
|
685
714
|
content: a,
|
|
686
715
|
isLoading: t,
|
|
687
716
|
fileName: o,
|
|
688
|
-
isHtmlSourceView:
|
|
717
|
+
isHtmlSourceView: K,
|
|
689
718
|
labels: {
|
|
690
|
-
unsupportedLabel:
|
|
691
|
-
loadErrorLabel:
|
|
692
|
-
forbiddenErrorLabel:
|
|
693
|
-
visualizerErrorLabel:
|
|
694
|
-
htmlFrameBlockedLabel:
|
|
695
|
-
htmlOpenInNewTabLabel:
|
|
696
|
-
pdfThumbnailsLabel:
|
|
697
|
-
pdfShowThumbnailsLabel:
|
|
698
|
-
pdfHideThumbnailsLabel:
|
|
699
|
-
pdfPageNumberLabel:
|
|
700
|
-
pdfContentLoadingLabel:
|
|
701
|
-
pdfContentErrorLabel:
|
|
702
|
-
pdfContentRetryLabel:
|
|
703
|
-
xlsxFormulaLabel:
|
|
704
|
-
codeContentLoadingLabel:
|
|
705
|
-
codeContentErrorLabel:
|
|
706
|
-
codeContentRetryLabel:
|
|
719
|
+
unsupportedLabel: S,
|
|
720
|
+
loadErrorLabel: C,
|
|
721
|
+
forbiddenErrorLabel: ae,
|
|
722
|
+
visualizerErrorLabel: x,
|
|
723
|
+
htmlFrameBlockedLabel: T,
|
|
724
|
+
htmlOpenInNewTabLabel: E,
|
|
725
|
+
pdfThumbnailsLabel: ce,
|
|
726
|
+
pdfShowThumbnailsLabel: le,
|
|
727
|
+
pdfHideThumbnailsLabel: de,
|
|
728
|
+
pdfPageNumberLabel: I,
|
|
729
|
+
pdfContentLoadingLabel: fe,
|
|
730
|
+
pdfContentErrorLabel: L,
|
|
731
|
+
pdfContentRetryLabel: pe,
|
|
732
|
+
xlsxFormulaLabel: R,
|
|
733
|
+
codeContentLoadingLabel: me,
|
|
734
|
+
codeContentErrorLabel: he,
|
|
735
|
+
codeContentRetryLabel: ge
|
|
707
736
|
},
|
|
708
|
-
styles:
|
|
709
|
-
codeBlockTheme:
|
|
710
|
-
loadPdf:
|
|
711
|
-
configurePdfWorker:
|
|
737
|
+
styles: Fe,
|
|
738
|
+
codeBlockTheme: Se,
|
|
739
|
+
loadPdf: Ce,
|
|
740
|
+
configurePdfWorker: Ee
|
|
712
741
|
})
|
|
713
742
|
});
|
|
714
|
-
}),
|
|
743
|
+
}), De = {
|
|
715
744
|
type: i.PlainText,
|
|
716
745
|
text: ""
|
|
717
|
-
},
|
|
746
|
+
}, Oe = (e) => {
|
|
718
747
|
if (!(e.type !== i.Image && e.type !== i.Audio && e.type !== i.Pdf && e.type !== i.Ooxml)) return e.url.startsWith("blob:") ? e.url : void 0;
|
|
719
|
-
},
|
|
720
|
-
|
|
721
|
-
var
|
|
722
|
-
let [t, n] =
|
|
748
|
+
}, W = T(void 0);
|
|
749
|
+
W.displayName = "AttachmentCanvasContext";
|
|
750
|
+
var ke = ({ children: e }) => {
|
|
751
|
+
let [t, n] = N(!1), [r, i] = N(!1), [a, o] = N(De), [s, c] = N(void 0), [l, u] = N(void 0), d = O((e, t) => {
|
|
723
752
|
c(e), u(t), i(!0), n(!0);
|
|
724
|
-
}, []), f =
|
|
753
|
+
}, []), f = O((e, t, r) => {
|
|
725
754
|
o(e), c(t), u(r), i(!1), n(!0);
|
|
726
|
-
}, []), p =
|
|
727
|
-
o(
|
|
755
|
+
}, []), p = O(() => {
|
|
756
|
+
o(De), n(!1), i(!1), u(void 0);
|
|
728
757
|
}, []);
|
|
729
|
-
return
|
|
730
|
-
let e =
|
|
758
|
+
return A(() => () => {
|
|
759
|
+
let e = Oe(a);
|
|
731
760
|
e != null && URL.revokeObjectURL(e);
|
|
732
|
-
}, [a]), /* @__PURE__ */
|
|
733
|
-
value:
|
|
761
|
+
}, [a]), /* @__PURE__ */ P(W.Provider, {
|
|
762
|
+
value: j(() => ({
|
|
734
763
|
isOpen: t,
|
|
735
764
|
isLoading: r,
|
|
736
765
|
content: a,
|
|
@@ -751,26 +780,26 @@ var De = ({ children: e }) => {
|
|
|
751
780
|
]),
|
|
752
781
|
children: e
|
|
753
782
|
});
|
|
754
|
-
},
|
|
755
|
-
let e =
|
|
783
|
+
}, G = () => {
|
|
784
|
+
let e = k(W);
|
|
756
785
|
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
757
786
|
return e;
|
|
758
|
-
},
|
|
759
|
-
let { ariaLabel: c = "Attachment preview", closeLabel: l = "Close", downloadLabel: u = "Download", unsupportedLabel: d = "Preview is not supported for this file", loadErrorLabel: f = "Failed to load file", forbiddenErrorLabel: m = "You don't have permission to access this file", copyTextLabel: h, copiedTextLabel: g, copyMarkdownLabel: _, copiedMarkdownLabel:
|
|
760
|
-
t(
|
|
761
|
-
}, [
|
|
762
|
-
(
|
|
763
|
-
}, [
|
|
764
|
-
|
|
765
|
-
}, [
|
|
766
|
-
|
|
767
|
-
}, [
|
|
768
|
-
return /* @__PURE__ */
|
|
769
|
-
isOpen:
|
|
770
|
-
isLoading:
|
|
771
|
-
onClose:
|
|
772
|
-
content:
|
|
773
|
-
fileName:
|
|
787
|
+
}, Ae = D(({ labels: e, isMobile: n = !1, defaultWidth: r, maxWidth: a, codeBlockTheme: o, configurePdfWorker: s }) => {
|
|
788
|
+
let { ariaLabel: c = "Attachment preview", closeLabel: l = "Close", downloadLabel: u = "Download", unsupportedLabel: d = "Preview is not supported for this file", loadErrorLabel: f = "Failed to load file", forbiddenErrorLabel: m = "You don't have permission to access this file", copyTextLabel: h, copiedTextLabel: g, copyMarkdownLabel: _, copiedMarkdownLabel: ee, copyJsonLabel: v, copiedJsonLabel: y, htmlFrameBlockedLabel: b, htmlOpenInNewTabLabel: x, htmlViewSourceLabel: S, htmlViewRenderedLabel: C, pdfThumbnailsLabel: w, pdfShowThumbnailsLabel: te, pdfHideThumbnailsLabel: ne, pdfPageNumberLabel: re, pdfContentLoadingLabel: ie, pdfContentErrorLabel: ae, pdfContentRetryLabel: oe, xlsxFormulaLabel: se, codeContentLoadingLabel: T, codeContentErrorLabel: E, codeContentRetryLabel: D } = e ?? {}, { isOpen: k, isLoading: A, content: j, fileName: M, closeCanvas: N } = G(), ce = O(() => {
|
|
789
|
+
t(j, M);
|
|
790
|
+
}, [j, M]), le = O(() => {
|
|
791
|
+
(j.type === i.PlainText || j.type === i.Code) && p(j.text);
|
|
792
|
+
}, [j]), ue = O(() => {
|
|
793
|
+
j.type === i.Markdown && p(j.text);
|
|
794
|
+
}, [j]), F = O(() => {
|
|
795
|
+
j.type === i.Json && p(JSON.stringify(j.value, null, 2));
|
|
796
|
+
}, [j]);
|
|
797
|
+
return /* @__PURE__ */ P(Ee, {
|
|
798
|
+
isOpen: k,
|
|
799
|
+
isLoading: A,
|
|
800
|
+
onClose: N,
|
|
801
|
+
content: j,
|
|
802
|
+
fileName: M,
|
|
774
803
|
labels: {
|
|
775
804
|
ariaLabel: c,
|
|
776
805
|
closeLabel: l,
|
|
@@ -778,75 +807,75 @@ var De = ({ children: e }) => {
|
|
|
778
807
|
copyTextLabel: h,
|
|
779
808
|
copiedTextLabel: g,
|
|
780
809
|
copyMarkdownLabel: _,
|
|
781
|
-
copiedMarkdownLabel:
|
|
782
|
-
copyJsonLabel:
|
|
783
|
-
copiedJsonLabel:
|
|
810
|
+
copiedMarkdownLabel: ee,
|
|
811
|
+
copyJsonLabel: v,
|
|
812
|
+
copiedJsonLabel: y,
|
|
784
813
|
unsupportedLabel: d,
|
|
785
814
|
loadErrorLabel: f,
|
|
786
815
|
forbiddenErrorLabel: m,
|
|
787
|
-
htmlFrameBlockedLabel:
|
|
788
|
-
htmlOpenInNewTabLabel:
|
|
789
|
-
htmlViewSourceLabel:
|
|
790
|
-
htmlViewRenderedLabel:
|
|
791
|
-
pdfThumbnailsLabel:
|
|
792
|
-
pdfShowThumbnailsLabel:
|
|
793
|
-
pdfHideThumbnailsLabel:
|
|
794
|
-
pdfPageNumberLabel:
|
|
795
|
-
pdfContentLoadingLabel:
|
|
796
|
-
pdfContentErrorLabel:
|
|
797
|
-
pdfContentRetryLabel:
|
|
798
|
-
xlsxFormulaLabel:
|
|
799
|
-
codeContentLoadingLabel:
|
|
800
|
-
codeContentErrorLabel:
|
|
801
|
-
codeContentRetryLabel:
|
|
816
|
+
htmlFrameBlockedLabel: b,
|
|
817
|
+
htmlOpenInNewTabLabel: x,
|
|
818
|
+
htmlViewSourceLabel: S,
|
|
819
|
+
htmlViewRenderedLabel: C,
|
|
820
|
+
pdfThumbnailsLabel: w,
|
|
821
|
+
pdfShowThumbnailsLabel: te,
|
|
822
|
+
pdfHideThumbnailsLabel: ne,
|
|
823
|
+
pdfPageNumberLabel: re,
|
|
824
|
+
pdfContentLoadingLabel: ie,
|
|
825
|
+
pdfContentErrorLabel: ae,
|
|
826
|
+
pdfContentRetryLabel: oe,
|
|
827
|
+
xlsxFormulaLabel: se,
|
|
828
|
+
codeContentLoadingLabel: T,
|
|
829
|
+
codeContentErrorLabel: E,
|
|
830
|
+
codeContentRetryLabel: D
|
|
802
831
|
},
|
|
803
|
-
onDownload:
|
|
804
|
-
onCopyText:
|
|
805
|
-
onCopyMarkdown:
|
|
806
|
-
onCopyJson:
|
|
832
|
+
onDownload: ce,
|
|
833
|
+
onCopyText: j.type === i.PlainText || j.type === i.Code ? le : void 0,
|
|
834
|
+
onCopyMarkdown: j.type === i.Markdown ? ue : void 0,
|
|
835
|
+
onCopyJson: j.type === i.Json ? F : void 0,
|
|
807
836
|
isMobile: n,
|
|
808
837
|
defaultWidth: r,
|
|
809
838
|
maxWidth: a,
|
|
810
839
|
codeBlockTheme: o,
|
|
811
840
|
configurePdfWorker: s
|
|
812
841
|
});
|
|
813
|
-
}),
|
|
842
|
+
}), K = new Set(["html", "htm"]), q = {
|
|
814
843
|
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
815
844
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
816
845
|
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
817
|
-
},
|
|
846
|
+
}, J = new Set(/* @__PURE__ */ "txt.md.markdown.json.jsonl.ndjson.xml.csv.tsv.yaml.yml.toml.ini.conf.cfg.css.scss.sass.less.js.jsx.ts.tsx.mjs.cjs.mts.cts.py.rb.go.rs.java.kt.swift.c.h.cpp.cs.sh.bash.zsh.fish.ps1.log.env.gitignore.dockerfile.makefile.sql".split(".")), Y = {
|
|
818
847
|
docx: n.Docx,
|
|
819
848
|
xlsx: n.Xlsx,
|
|
820
849
|
pptx: n.Pptx,
|
|
821
850
|
csv: n.Csv
|
|
822
|
-
},
|
|
823
|
-
[
|
|
824
|
-
[
|
|
825
|
-
[
|
|
851
|
+
}, X = {
|
|
852
|
+
[q.docx]: n.Docx,
|
|
853
|
+
[q.xlsx]: n.Xlsx,
|
|
854
|
+
[q.pptx]: n.Pptx,
|
|
826
855
|
[u.CSV]: n.Csv
|
|
827
|
-
},
|
|
828
|
-
[n.Docx]:
|
|
829
|
-
[n.Xlsx]:
|
|
830
|
-
[n.Pptx]:
|
|
856
|
+
}, je = {
|
|
857
|
+
[n.Docx]: q.docx,
|
|
858
|
+
[n.Xlsx]: q.xlsx,
|
|
859
|
+
[n.Pptx]: q.pptx,
|
|
831
860
|
[n.Csv]: u.CSV
|
|
832
861
|
}, Z = (e, t) => {
|
|
833
862
|
let n = t?.split(";", 1)[0].trim().toLowerCase();
|
|
834
863
|
if (n != null) {
|
|
835
|
-
let e =
|
|
864
|
+
let e = X[n];
|
|
836
865
|
if (e != null) return e;
|
|
837
866
|
}
|
|
838
867
|
let r = e.lastIndexOf(".");
|
|
839
|
-
if (r !== -1) return
|
|
840
|
-
},
|
|
868
|
+
if (r !== -1) return Y[e.slice(r + 1).toLowerCase()];
|
|
869
|
+
}, Me = (e, t) => Z(e, t) != null, Ne = (e, t) => {
|
|
841
870
|
let n = Z(e, t);
|
|
842
|
-
return n == null ? void 0 :
|
|
843
|
-
},
|
|
871
|
+
return n == null ? void 0 : je[n];
|
|
872
|
+
}, Pe = (e) => {
|
|
844
873
|
let t = e.lastIndexOf(".");
|
|
845
|
-
return t === -1 ? !1 :
|
|
846
|
-
},
|
|
874
|
+
return t === -1 ? !1 : J.has(e.slice(t + 1).toLowerCase());
|
|
875
|
+
}, Q = (e) => {
|
|
847
876
|
let t = e.lastIndexOf(".");
|
|
848
|
-
return t === -1 ? !1 :
|
|
849
|
-
},
|
|
877
|
+
return t === -1 ? !1 : K.has(e.slice(t + 1).toLowerCase());
|
|
878
|
+
}, Fe = {
|
|
850
879
|
xml: "xml",
|
|
851
880
|
csv: "plaintext",
|
|
852
881
|
tsv: "plaintext",
|
|
@@ -894,21 +923,21 @@ var De = ({ children: e }) => {
|
|
|
894
923
|
gitignore: "plaintext",
|
|
895
924
|
dockerfile: "plaintext",
|
|
896
925
|
makefile: "plaintext"
|
|
897
|
-
},
|
|
926
|
+
}, Ie = (e) => Fe[e], $ = (e) => ({
|
|
898
927
|
type: i.Unsupported,
|
|
899
928
|
...e != null && { url: e }
|
|
900
|
-
}),
|
|
929
|
+
}), Le = (t) => ({
|
|
901
930
|
type: i.Error,
|
|
902
931
|
errorType: e.LoadFailed,
|
|
903
932
|
...t != null && { url: t }
|
|
904
|
-
}),
|
|
933
|
+
}), Re = (t) => ({
|
|
905
934
|
type: i.Error,
|
|
906
935
|
errorType: e.Forbidden,
|
|
907
936
|
...t != null && { url: t }
|
|
908
|
-
}),
|
|
937
|
+
}), ze = (e, t) => {
|
|
909
938
|
let n = e.toLowerCase();
|
|
910
939
|
return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
|
|
911
|
-
},
|
|
940
|
+
}, Be = (e) => {
|
|
912
941
|
let t;
|
|
913
942
|
try {
|
|
914
943
|
t = new URL(e).pathname;
|
|
@@ -921,13 +950,13 @@ var De = ({ children: e }) => {
|
|
|
921
950
|
} catch {
|
|
922
951
|
return n;
|
|
923
952
|
}
|
|
924
|
-
},
|
|
925
|
-
let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } =
|
|
953
|
+
}, Ve = (e, t) => {
|
|
954
|
+
let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = G(), { customVisualizers: s, themeId: c, onBeforeOpen: d } = t, f = O(async (t, r) => {
|
|
926
955
|
if (t.url == null && t.referenceUrl != null) {
|
|
927
956
|
let i = e.resolveReferencePdfContent(t);
|
|
928
957
|
if (i != null) return n(i, t.name, r), !0;
|
|
929
958
|
}
|
|
930
|
-
let a = t.contentType.toLowerCase(), o =
|
|
959
|
+
let a = t.contentType.toLowerCase(), o = ze(a, s);
|
|
931
960
|
if (o != null) {
|
|
932
961
|
let i = await e.resolveVisualizerContent(t, o, c);
|
|
933
962
|
if (i != null) return n(i, t.name, r), !0;
|
|
@@ -960,8 +989,8 @@ var De = ({ children: e }) => {
|
|
|
960
989
|
return i == null ? !1 : (n(i, t.name, r), !0);
|
|
961
990
|
}
|
|
962
991
|
}
|
|
963
|
-
let g = t.name != null &&
|
|
964
|
-
if (t.name != null && !
|
|
992
|
+
let g = t.name != null && Q(t.name) || t.url != null && Q(Be(t.url));
|
|
993
|
+
if (t.name != null && !Pe(t.name) && !g) return n($(e.resolveContentUrl(t)), t.name, r), !0;
|
|
965
994
|
if (g) {
|
|
966
995
|
let a = await e.resolveHtmlContent(t);
|
|
967
996
|
return a == null ? e.hasTextSource(t) ? (n($(e.resolveContentUrl(t)), t.name, r), !0) : t.url == null ? !1 : (n({
|
|
@@ -969,7 +998,7 @@ var De = ({ children: e }) => {
|
|
|
969
998
|
url: t.url
|
|
970
999
|
}, t.name, r), !0) : (n(a, t.name, r), !0);
|
|
971
1000
|
}
|
|
972
|
-
let _ = await e.resolveCodeContent(t,
|
|
1001
|
+
let _ = await e.resolveCodeContent(t, Ie(m));
|
|
973
1002
|
return _ == null ? !1 : (n(_, t.name, r), !0);
|
|
974
1003
|
}, [
|
|
975
1004
|
n,
|
|
@@ -977,7 +1006,7 @@ var De = ({ children: e }) => {
|
|
|
977
1006
|
c,
|
|
978
1007
|
e
|
|
979
1008
|
]);
|
|
980
|
-
return { openAttachmentCanvas:
|
|
1009
|
+
return { openAttachmentCanvas: O(async (t, s = t.id) => {
|
|
981
1010
|
switch (t.type) {
|
|
982
1011
|
case o.Image: {
|
|
983
1012
|
let r = e.resolveImageContent(t);
|
|
@@ -1014,4 +1043,4 @@ var De = ({ children: e }) => {
|
|
|
1014
1043
|
]) };
|
|
1015
1044
|
};
|
|
1016
1045
|
//#endregion
|
|
1017
|
-
export {
|
|
1046
|
+
export { Ee as AttachmentCanvas, we as AttachmentCanvasBody, Ae as AttachmentCanvasContainer, ke as AttachmentCanvasProvider, i as AttachmentContentType, e as AttachmentErrorType, me as CodeContent, B as McpAppCanvasRenderer, n as OoxmlFileType, Re as createForbiddenCanvasContent, Le as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, t as downloadAttachmentContent, Ie as extensionToLanguage, ze as findVisualizerForMime, Z as getOoxmlFileType, Ne as getOoxmlMimeType, r as isDownloadable, Q as isHtmlPreviewable, Me as isOoxmlPreviewable, Pe as isTextPreviewable, G as useAttachmentCanvas, Ve as useOpenAttachmentCanvas };
|