@epam/ai-dial-attachment-canvas 1.1.2 → 1.1.4
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.
|
@@ -15,6 +15,8 @@ export interface AttachmentCanvasContainerProps {
|
|
|
15
15
|
codeBlockTheme?: CodeBlockTheme;
|
|
16
16
|
/** Filename used when downloading a `MarkdownTable`'s content as CSV. Defaults to `'table.csv'`. */
|
|
17
17
|
tableDownloadFilename?: string;
|
|
18
|
+
/** Host-owned PDF loader. When omitted, the viewer fetches the URL with browser defaults. */
|
|
19
|
+
loadPdf?: (url: string) => Promise<Blob>;
|
|
18
20
|
/**
|
|
19
21
|
* Configures `pdfjs-dist`'s worker (`GlobalWorkerOptions.workerSrc`) for the
|
|
20
22
|
* host app. Called once, the first time a PDF attachment is opened, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCanvasContainer.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasContainer/AttachmentCanvasContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EACV,sBAAsB,EAKvB,MAAM,gCAAgC,CAAC;AAKxC,yDAAyD;AACzD,MAAM,WAAW,8BAA8B;IAC7C,8DAA8D;IAC9D,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,mGAAmG;IACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,oGAAoG;IACpG,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,yFAAyF;AACzF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,
|
|
1
|
+
{"version":3,"file":"AttachmentCanvasContainer.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasContainer/AttachmentCanvasContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EACV,sBAAsB,EAKvB,MAAM,gCAAgC,CAAC;AAKxC,yDAAyD;AACzD,MAAM,WAAW,8BAA8B;IAC7C,8DAA8D;IAC9D,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,mGAAmG;IACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,oGAAoG;IACpG,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6FAA6F;IAC7F,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,yFAAyF;AACzF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,CAoJtE,CAAC"}
|
package/index.js
CHANGED
|
@@ -5,38 +5,38 @@ import { SidebarOrientation as y, SidebarPanel as b } from "@epam/ai-dial-sideba
|
|
|
5
5
|
import { DIAL_ICON_SIZE as x, DIAL_KIT_ICON_STROKE as S, ElementSize as C, GhostIconButton as w, LinkButton as T, Spinner as E } from "@epam/ai-dial-ui-kit";
|
|
6
6
|
import { IconAlertTriangle as D, IconArrowsMaximize as O, IconCheck as k, IconCode as ee, IconCopy as te, IconDownload as ne, IconEye as re, IconLock as ie, IconMarkdown as ae, IconRefresh as oe } from "@tabler/icons-react";
|
|
7
7
|
import { createContext as A, lazy as j, memo as M, useCallback as N, useContext as P, useEffect as F, useMemo as I, useRef as L, useState as R } from "react";
|
|
8
|
-
import { JsonView as se, defaultStyles as
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import { AppBridge as
|
|
11
|
-
import { McpUiHostContextChangedNotificationSchema as
|
|
12
|
-
import { VisualizerConnectorRequests as
|
|
13
|
-
import { VisualizerConnector as
|
|
14
|
-
var
|
|
8
|
+
import { JsonView as se, defaultStyles as ce } from "react-json-view-lite";
|
|
9
|
+
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
10
|
+
import { AppBridge as le, AppFrame as H } from "@mcp-ui/client";
|
|
11
|
+
import { McpUiHostContextChangedNotificationSchema as U } from "@modelcontextprotocol/ext-apps/app-bridge";
|
|
12
|
+
import { VisualizerConnectorRequests as ue } from "@epam/ai-dial-shared";
|
|
13
|
+
import { VisualizerConnector as de } from "@epam/ai-dial-visualizer-connector";
|
|
14
|
+
var W = {
|
|
15
15
|
container: "_container_1nhig_1",
|
|
16
16
|
containerLight: "_containerLight_1nhig_5"
|
|
17
|
-
},
|
|
17
|
+
}, fe = {
|
|
18
18
|
[l.Dark]: _,
|
|
19
19
|
[l.Light]: _
|
|
20
|
-
},
|
|
20
|
+
}, pe = () => j(async () => {
|
|
21
21
|
let { Prism: e } = await import("react-syntax-highlighter");
|
|
22
22
|
return { default: e };
|
|
23
|
-
}),
|
|
24
|
-
let { text: r, language: i } = e, a = i == null || i === "plaintext", o =
|
|
23
|
+
}), me = M(({ content: e, codeBlockTheme: t = l.Light, labels: n }) => {
|
|
24
|
+
let { text: r, language: i } = e, a = i == null || i === "plaintext", o = fe[t], c = t === l.Light, [u, d] = R(0), f = I(pe, [u]), p = N(() => {
|
|
25
25
|
d((e) => e + 1);
|
|
26
|
-
}, []), m = /* @__PURE__ */
|
|
26
|
+
}, []), m = /* @__PURE__ */ B("pre", {
|
|
27
27
|
className: "whitespace-pre-wrap break-words p-4",
|
|
28
28
|
children: r
|
|
29
29
|
});
|
|
30
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ B("div", {
|
|
31
31
|
dir: "ltr",
|
|
32
|
-
className: g("h-full overflow-auto",
|
|
33
|
-
children: a ? m : /* @__PURE__ */
|
|
32
|
+
className: g("h-full overflow-auto", W.container, c && W.containerLight),
|
|
33
|
+
children: a ? m : /* @__PURE__ */ B(s, {
|
|
34
34
|
retryKey: u,
|
|
35
35
|
onRetry: p,
|
|
36
36
|
pendingContent: m,
|
|
37
37
|
errorContent: m,
|
|
38
38
|
labels: n,
|
|
39
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ B(f, {
|
|
40
40
|
language: i,
|
|
41
41
|
style: o,
|
|
42
42
|
customStyle: {
|
|
@@ -53,7 +53,7 @@ var G = {
|
|
|
53
53
|
})
|
|
54
54
|
})
|
|
55
55
|
});
|
|
56
|
-
}),
|
|
56
|
+
}), he = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ge = M(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
|
|
57
57
|
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = R(!0), [d, f] = R(!1), p = L(null);
|
|
58
58
|
F(() => {
|
|
59
59
|
u(!0), f(!1);
|
|
@@ -67,7 +67,7 @@ var G = {
|
|
|
67
67
|
}, [e.srcdoc]), h = N(() => {
|
|
68
68
|
u(!1), f(!0);
|
|
69
69
|
}, []);
|
|
70
|
-
if (n && e.srcdoc != null) return /* @__PURE__ */
|
|
70
|
+
if (n && e.srcdoc != null) return /* @__PURE__ */ B(me, {
|
|
71
71
|
content: {
|
|
72
72
|
type: i.Code,
|
|
73
73
|
text: e.srcdoc,
|
|
@@ -75,26 +75,26 @@ var G = {
|
|
|
75
75
|
},
|
|
76
76
|
codeBlockTheme: a
|
|
77
77
|
});
|
|
78
|
-
if (d) return /* @__PURE__ */
|
|
78
|
+
if (d) return /* @__PURE__ */ V("div", {
|
|
79
79
|
className: "flex h-full flex-col items-center justify-center gap-3 p-4",
|
|
80
|
-
children: [/* @__PURE__ */
|
|
80
|
+
children: [/* @__PURE__ */ B("p", {
|
|
81
81
|
className: "text-center",
|
|
82
82
|
children: s
|
|
83
|
-
}), e.url != null && /* @__PURE__ */
|
|
83
|
+
}), e.url != null && /* @__PURE__ */ B(T, {
|
|
84
84
|
href: e.url,
|
|
85
85
|
target: "_blank",
|
|
86
86
|
label: c,
|
|
87
|
-
className:
|
|
87
|
+
className: he.openInNewTabButton,
|
|
88
88
|
textClassName: o
|
|
89
89
|
})]
|
|
90
90
|
});
|
|
91
91
|
let _ = e.srcdoc != null, v = _ ? void 0 : e.url, y = _ ? e.srcdoc : void 0;
|
|
92
|
-
return /* @__PURE__ */
|
|
92
|
+
return /* @__PURE__ */ V("div", {
|
|
93
93
|
className: "relative h-full",
|
|
94
|
-
children: [l && /* @__PURE__ */
|
|
94
|
+
children: [l && /* @__PURE__ */ B("div", {
|
|
95
95
|
className: "absolute inset-0 flex items-center justify-center",
|
|
96
|
-
children: /* @__PURE__ */
|
|
97
|
-
}), /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ B(E, {})
|
|
97
|
+
}), /* @__PURE__ */ B("iframe", {
|
|
98
98
|
ref: p,
|
|
99
99
|
title: r,
|
|
100
100
|
src: v,
|
|
@@ -105,10 +105,10 @@ var G = {
|
|
|
105
105
|
onError: h
|
|
106
106
|
})]
|
|
107
107
|
});
|
|
108
|
-
}),
|
|
108
|
+
}), G = {
|
|
109
109
|
name: "MCP-UI Host",
|
|
110
110
|
version: "1.0.0"
|
|
111
|
-
},
|
|
111
|
+
}, _e = { openLinks: {} }, ve = (e) => {
|
|
112
112
|
let t;
|
|
113
113
|
try {
|
|
114
114
|
t = new URL(e);
|
|
@@ -122,14 +122,14 @@ var G = {
|
|
|
122
122
|
return !1;
|
|
123
123
|
}
|
|
124
124
|
return !0;
|
|
125
|
-
},
|
|
125
|
+
}, ye = (e, t, n) => {
|
|
126
126
|
if (n) {
|
|
127
127
|
e.style.maxWidth = "", e.style.maxHeight = "";
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
let r = t;
|
|
131
131
|
r != null && (r.width != null && (e.style.width = `${r.width}px`), r.maxWidth != null && (e.style.maxWidth = `${r.maxWidth}px`), r.height != null && (e.style.height = `${r.height}px`), r.maxHeight != null && (e.style.maxHeight = `${r.maxHeight}px`));
|
|
132
|
-
},
|
|
132
|
+
}, be = (e, t, n) => {
|
|
133
133
|
let r = L(e);
|
|
134
134
|
F(() => {
|
|
135
135
|
r.current = e;
|
|
@@ -138,15 +138,15 @@ var G = {
|
|
|
138
138
|
return F(() => {
|
|
139
139
|
let e = null;
|
|
140
140
|
try {
|
|
141
|
-
e = new
|
|
141
|
+
e = new le(null, G, _e, { hostContext: r.current.hostContext }), e.onopenlink = async ({ url: e }) => {
|
|
142
142
|
let t = r.current.onOpenLink;
|
|
143
|
-
return (t == null ?
|
|
143
|
+
return (t == null ? ve(e) : t(e)) === !1 ? { isError: !0 } : {};
|
|
144
144
|
}, e.onrequestdisplaymode = async ({ mode: e }) => {
|
|
145
145
|
let t = r.current.onRequestDisplayMode, n = r.current.hostContext?.displayMode ?? "inline";
|
|
146
146
|
return { mode: t?.(e) ?? n };
|
|
147
|
-
}, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(
|
|
147
|
+
}, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(U, ({ params: e }) => {
|
|
148
148
|
let n = t.current?.querySelector("iframe");
|
|
149
|
-
n != null &&
|
|
149
|
+
n != null && ye(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
|
|
150
150
|
}), a(e);
|
|
151
151
|
} catch (e) {
|
|
152
152
|
console.error("[useMcpAppBridge] Error creating AppBridge:", e), s(!0);
|
|
@@ -160,12 +160,12 @@ var G = {
|
|
|
160
160
|
appBridge: i,
|
|
161
161
|
hasFailed: o
|
|
162
162
|
};
|
|
163
|
-
},
|
|
163
|
+
}, K = {
|
|
164
164
|
loadingOverlay: "_loadingOverlay_1aric_1",
|
|
165
165
|
fullscreenFrame: "_fullscreenFrame_1aric_20",
|
|
166
166
|
statusLabel: "_statusLabel_1aric_27",
|
|
167
167
|
errorIcon: "_errorIcon_1aric_31"
|
|
168
|
-
},
|
|
168
|
+
}, xe = ({ content: e, errorLabel: t = "Failed to load app" }) => {
|
|
169
169
|
let [n, r] = R("loading"), { html: i, sandboxUrl: a, toolInput: o, toolResult: s, hostContext: c } = e, l = I(() => ({ url: new URL(a) }), [a]), u = c?.displayMode === "fullscreen", d = L(null), [f, p] = R();
|
|
170
170
|
F(() => {
|
|
171
171
|
let e = d.current;
|
|
@@ -180,15 +180,15 @@ var G = {
|
|
|
180
180
|
});
|
|
181
181
|
return t.observe(e), () => t.disconnect();
|
|
182
182
|
}, []);
|
|
183
|
-
let { appBridge: m, hasFailed: h } =
|
|
183
|
+
let { appBridge: m, hasFailed: h } = be(e, d, I(() => c == null || f == null ? c : {
|
|
184
184
|
...c,
|
|
185
185
|
containerDimensions: f
|
|
186
186
|
}, [c, f])), _ = h || n === "error";
|
|
187
|
-
return /* @__PURE__ */
|
|
187
|
+
return /* @__PURE__ */ V("div", {
|
|
188
188
|
ref: d,
|
|
189
|
-
className: g("relative h-full w-full", u &&
|
|
189
|
+
className: g("relative h-full w-full", u && K.fullscreenFrame),
|
|
190
190
|
children: [
|
|
191
|
-
m != null && /* @__PURE__ */
|
|
191
|
+
m != null && /* @__PURE__ */ B(H, {
|
|
192
192
|
html: i,
|
|
193
193
|
sandbox: l,
|
|
194
194
|
appBridge: m,
|
|
@@ -198,26 +198,26 @@ var G = {
|
|
|
198
198
|
onInitialized: () => r("ready"),
|
|
199
199
|
onError: () => r("error")
|
|
200
200
|
}),
|
|
201
|
-
!_ && n === "loading" && /* @__PURE__ */
|
|
202
|
-
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
203
|
-
children: /* @__PURE__ */
|
|
201
|
+
!_ && n === "loading" && /* @__PURE__ */ B("div", {
|
|
202
|
+
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", K.loadingOverlay),
|
|
203
|
+
children: /* @__PURE__ */ B(E, {})
|
|
204
204
|
}),
|
|
205
|
-
_ && /* @__PURE__ */
|
|
205
|
+
_ && /* @__PURE__ */ V("div", {
|
|
206
206
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
207
|
-
children: [/* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ B(D, {
|
|
208
208
|
size: 60,
|
|
209
209
|
stroke: S,
|
|
210
210
|
"aria-hidden": !0,
|
|
211
|
-
className:
|
|
212
|
-
}), /* @__PURE__ */
|
|
211
|
+
className: K.errorIcon
|
|
212
|
+
}), /* @__PURE__ */ B("p", {
|
|
213
213
|
role: "alert",
|
|
214
|
-
className: g("text-center",
|
|
214
|
+
className: g("text-center", K.statusLabel),
|
|
215
215
|
children: t
|
|
216
216
|
})]
|
|
217
217
|
})
|
|
218
218
|
]
|
|
219
219
|
});
|
|
220
|
-
},
|
|
220
|
+
}, q = {
|
|
221
221
|
viewer: "_viewer_1w97n_2",
|
|
222
222
|
spreadsheetCanvas: "_spreadsheetCanvas_1w97n_6",
|
|
223
223
|
formulaPanel: "_formulaPanel_1w97n_12",
|
|
@@ -225,13 +225,13 @@ var G = {
|
|
|
225
225
|
statusOverlay: "_statusOverlay_1w97n_24",
|
|
226
226
|
errorIcon: "_errorIcon_1w97n_29",
|
|
227
227
|
highlight: "_highlight_1w97n_37"
|
|
228
|
-
},
|
|
228
|
+
}, Se = (e) => {
|
|
229
229
|
if (e?.kind !== "range") return "";
|
|
230
230
|
let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
|
|
231
231
|
if (n == null) return "";
|
|
232
232
|
let r = n.formula;
|
|
233
233
|
return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
|
|
234
|
-
},
|
|
234
|
+
}, Ce = async (e, t, { onError: n, onXlsxSelectionContextChange: i }) => {
|
|
235
235
|
switch (t) {
|
|
236
236
|
case r.Docx: {
|
|
237
237
|
let [{ DocxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/docx"), import("@silurus/ooxml/chart-ex")]);
|
|
@@ -253,7 +253,7 @@ var G = {
|
|
|
253
253
|
}
|
|
254
254
|
case r.Csv: {
|
|
255
255
|
let { XlsxSheetViewer: t } = await import("@silurus/ooxml/xlsx"), r = document.createElement("canvas");
|
|
256
|
-
r.className =
|
|
256
|
+
r.className = q.spreadsheetCanvas, e.replaceChildren(r);
|
|
257
257
|
let i = new t(r, {
|
|
258
258
|
showScrollbars: !0,
|
|
259
259
|
onError: n
|
|
@@ -277,7 +277,7 @@ var G = {
|
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
},
|
|
280
|
+
}, we = async (e, t, n, i) => {
|
|
281
281
|
let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = n;
|
|
282
282
|
switch (t.format) {
|
|
283
283
|
case r.Docx: {
|
|
@@ -286,7 +286,7 @@ var G = {
|
|
|
286
286
|
import("@silurus/ooxml/chart-ex"),
|
|
287
287
|
import("./ooxml-highlight-surfaces-BzgOKpBV.js")
|
|
288
288
|
]), l = await n.load(t.url, { chartEx: o });
|
|
289
|
-
if (i()) throw l.destroy(), new
|
|
289
|
+
if (i()) throw l.destroy(), new Te();
|
|
290
290
|
let u = r.fromDocument(e, l, {
|
|
291
291
|
enableTextSelection: !0,
|
|
292
292
|
refitOnResize: !0,
|
|
@@ -306,7 +306,7 @@ var G = {
|
|
|
306
306
|
import("@silurus/ooxml/chart-ex"),
|
|
307
307
|
import("./ooxml-highlight-surfaces-BzgOKpBV.js")
|
|
308
308
|
]), l = await n.load(t.url, { chartEx: o });
|
|
309
|
-
if (i()) throw l.destroy(), new
|
|
309
|
+
if (i()) throw l.destroy(), new Te();
|
|
310
310
|
let u = r.fromPresentation(e, l, {
|
|
311
311
|
enableTextSelection: !0,
|
|
312
312
|
refitOnResize: !0,
|
|
@@ -340,11 +340,11 @@ var G = {
|
|
|
340
340
|
};
|
|
341
341
|
}
|
|
342
342
|
case r.Csv: {
|
|
343
|
-
let r = await
|
|
343
|
+
let r = await Ce(e, t.format, n);
|
|
344
344
|
return await r.load(t.url), { viewer: r };
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
},
|
|
347
|
+
}, Te = class extends Error {}, Ee = ({ content: t, fileName: n, loadErrorLabel: i, formulaLabel: a, formulaLabelClassName: o, highlightsLabel: s = "Cited locations", highlightNavigatedLabel: c = "Scrolled to the cited location" }) => {
|
|
348
348
|
let l = L(null), [u, d] = R(!0), [f, p] = R(!1), [m, h] = R(""), [_, v] = R([]), [y, b] = R(!1), { highlights: x, selectedHighlightId: C } = t, w = x != null && x.length > 0, T = L(void 0), O = L(x);
|
|
349
349
|
O.current = x;
|
|
350
350
|
let k = L(void 0);
|
|
@@ -370,7 +370,7 @@ var G = {
|
|
|
370
370
|
i || (d(!1), p(!0));
|
|
371
371
|
},
|
|
372
372
|
onXlsxSelectionContextChange: (e) => {
|
|
373
|
-
i || h(
|
|
373
|
+
i || h(Se(e));
|
|
374
374
|
},
|
|
375
375
|
onGeometryInvalidated: s
|
|
376
376
|
}, f = () => {
|
|
@@ -381,14 +381,14 @@ var G = {
|
|
|
381
381
|
return e.addEventListener("scroll", s, !0), k.current = s, (async () => {
|
|
382
382
|
try {
|
|
383
383
|
if (w) {
|
|
384
|
-
let r = await
|
|
384
|
+
let r = await we(e, t, u, o);
|
|
385
385
|
if (i) {
|
|
386
386
|
r.viewer.destroy(), r.engine?.destroy();
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
389
|
n = r, T.current = r.highlights, f();
|
|
390
390
|
} else {
|
|
391
|
-
let r = await
|
|
391
|
+
let r = await Ce(e, t.format, u);
|
|
392
392
|
if (i) {
|
|
393
393
|
r.destroy();
|
|
394
394
|
return;
|
|
@@ -399,7 +399,7 @@ var G = {
|
|
|
399
399
|
if (i) return;
|
|
400
400
|
d(!1), await c();
|
|
401
401
|
} catch (t) {
|
|
402
|
-
if (t instanceof
|
|
402
|
+
if (t instanceof Te || i) return;
|
|
403
403
|
n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, T.current = void 0, e.replaceChildren(), d(!1), p(!0);
|
|
404
404
|
}
|
|
405
405
|
})(), () => {
|
|
@@ -429,38 +429,38 @@ var G = {
|
|
|
429
429
|
})(), () => {
|
|
430
430
|
r = !0;
|
|
431
431
|
};
|
|
432
|
-
}, [C, u]), /* @__PURE__ */
|
|
432
|
+
}, [C, u]), /* @__PURE__ */ V("div", {
|
|
433
433
|
className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
|
|
434
434
|
children: [
|
|
435
|
-
t.format === r.Xlsx && /* @__PURE__ */
|
|
435
|
+
t.format === r.Xlsx && /* @__PURE__ */ V("div", {
|
|
436
436
|
role: "region",
|
|
437
437
|
"aria-label": a,
|
|
438
|
-
className: g("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2",
|
|
439
|
-
children: [/* @__PURE__ */
|
|
438
|
+
className: g("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", q.formulaPanel),
|
|
439
|
+
children: [/* @__PURE__ */ B("span", {
|
|
440
440
|
"aria-hidden": "true",
|
|
441
441
|
className: g("shrink-0", o),
|
|
442
442
|
children: "fx"
|
|
443
|
-
}), /* @__PURE__ */
|
|
443
|
+
}), /* @__PURE__ */ B("code", {
|
|
444
444
|
dir: "ltr",
|
|
445
445
|
tabIndex: 0,
|
|
446
446
|
"aria-live": "polite",
|
|
447
|
-
className: g("h-8 min-w-0 flex-1 overflow-x-auto whitespace-nowrap rounded border px-2 py-1 text-sm focus-visible:outline focus-visible:outline-focus",
|
|
447
|
+
className: g("h-8 min-w-0 flex-1 overflow-x-auto whitespace-nowrap rounded border px-2 py-1 text-sm focus-visible:outline focus-visible:outline-focus", q.formulaValue),
|
|
448
448
|
children: m
|
|
449
449
|
})]
|
|
450
450
|
}),
|
|
451
|
-
/* @__PURE__ */
|
|
451
|
+
/* @__PURE__ */ V("div", {
|
|
452
452
|
className: "relative min-h-0 w-full flex-1",
|
|
453
|
-
children: [/* @__PURE__ */
|
|
453
|
+
children: [/* @__PURE__ */ B("div", {
|
|
454
454
|
ref: l,
|
|
455
455
|
role: "document",
|
|
456
456
|
"aria-label": n,
|
|
457
457
|
"aria-busy": u,
|
|
458
|
-
className: g("h-full w-full overflow-hidden",
|
|
459
|
-
}), _.length > 0 && /* @__PURE__ */
|
|
458
|
+
className: g("h-full w-full overflow-hidden", q.viewer)
|
|
459
|
+
}), _.length > 0 && /* @__PURE__ */ B("div", {
|
|
460
460
|
role: "region",
|
|
461
461
|
"aria-label": s,
|
|
462
462
|
className: "pointer-events-none absolute inset-0 overflow-hidden",
|
|
463
|
-
children: _.map((e, t) => /* @__PURE__ */
|
|
463
|
+
children: _.map((e, t) => /* @__PURE__ */ B("div", {
|
|
464
464
|
"aria-hidden": "true",
|
|
465
465
|
style: {
|
|
466
466
|
left: `${e.left}px`,
|
|
@@ -470,28 +470,28 @@ var G = {
|
|
|
470
470
|
},
|
|
471
471
|
"data-selected": e.highlightId === C,
|
|
472
472
|
"data-clipped": e.isClippedAtEnd === !0,
|
|
473
|
-
className: g("absolute",
|
|
473
|
+
className: g("absolute", q.highlight)
|
|
474
474
|
}, `${e.highlightId}-${t}`))
|
|
475
475
|
})]
|
|
476
476
|
}),
|
|
477
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ B("div", {
|
|
478
478
|
role: "status",
|
|
479
479
|
"aria-live": "polite",
|
|
480
480
|
className: "sr-only",
|
|
481
481
|
children: y ? c : ""
|
|
482
482
|
}),
|
|
483
|
-
(u || f) && /* @__PURE__ */
|
|
483
|
+
(u || f) && /* @__PURE__ */ B("div", {
|
|
484
484
|
role: f ? "alert" : void 0,
|
|
485
485
|
"aria-live": "polite",
|
|
486
|
-
className: g("absolute inset-0 flex items-center justify-center",
|
|
487
|
-
children: u ? /* @__PURE__ */
|
|
486
|
+
className: g("absolute inset-0 flex items-center justify-center", q.statusOverlay),
|
|
487
|
+
children: u ? /* @__PURE__ */ B(E, { size: 48 }) : /* @__PURE__ */ V("div", {
|
|
488
488
|
className: "flex flex-col items-center gap-2",
|
|
489
|
-
children: [/* @__PURE__ */
|
|
489
|
+
children: [/* @__PURE__ */ B(D, {
|
|
490
490
|
"aria-hidden": "true",
|
|
491
491
|
size: 60,
|
|
492
492
|
stroke: S,
|
|
493
|
-
className:
|
|
494
|
-
}), /* @__PURE__ */
|
|
493
|
+
className: q.errorIcon
|
|
494
|
+
}), /* @__PURE__ */ B("p", {
|
|
495
495
|
className: "text-center",
|
|
496
496
|
children: i
|
|
497
497
|
})]
|
|
@@ -499,17 +499,17 @@ var G = {
|
|
|
499
499
|
})
|
|
500
500
|
]
|
|
501
501
|
});
|
|
502
|
-
},
|
|
502
|
+
}, De = {
|
|
503
503
|
loadingOverlay: "_loadingOverlay_12637_1",
|
|
504
504
|
statusLabel: "_statusLabel_12637_5",
|
|
505
505
|
errorIcon: "_errorIcon_12637_9"
|
|
506
|
-
},
|
|
506
|
+
}, Oe = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", frameTitle: r, colors: a }) => {
|
|
507
507
|
let o = L(null), [s, c] = R("loading"), { url: l, visualizerName: u, requestTimeout: d } = e, f = L(e);
|
|
508
508
|
return f.current = e, F(() => {
|
|
509
509
|
let e = o.current;
|
|
510
510
|
if (!e) return;
|
|
511
511
|
c("loading");
|
|
512
|
-
let t = new
|
|
512
|
+
let t = new de(e, {
|
|
513
513
|
domain: l,
|
|
514
514
|
hostDomain: window.location.origin,
|
|
515
515
|
visualizerName: u,
|
|
@@ -518,7 +518,7 @@ var G = {
|
|
|
518
518
|
return (async () => {
|
|
519
519
|
if (await t.ready(), !n) return;
|
|
520
520
|
let e = f.current;
|
|
521
|
-
if (e.type === i.GroupedVisualizer) await t.send(
|
|
521
|
+
if (e.type === i.GroupedVisualizer) await t.send(ue.sendGroupedVisualizeData, {
|
|
522
522
|
attachments: e.attachments,
|
|
523
523
|
layout: e.layout
|
|
524
524
|
});
|
|
@@ -527,7 +527,7 @@ var G = {
|
|
|
527
527
|
layout: r,
|
|
528
528
|
...typeof i == "object" && i ? i : {}
|
|
529
529
|
};
|
|
530
|
-
await t.send(
|
|
530
|
+
await t.send(ue.sendVisualizeData, {
|
|
531
531
|
mimeType: n,
|
|
532
532
|
visualizerData: a
|
|
533
533
|
});
|
|
@@ -550,7 +550,7 @@ var G = {
|
|
|
550
550
|
u,
|
|
551
551
|
l,
|
|
552
552
|
d
|
|
553
|
-
]), /* @__PURE__ */
|
|
553
|
+
]), /* @__PURE__ */ V("div", {
|
|
554
554
|
className: "relative h-full w-full",
|
|
555
555
|
style: m({
|
|
556
556
|
"--vs-loading-bg": a?.loadingBackground,
|
|
@@ -558,33 +558,33 @@ var G = {
|
|
|
558
558
|
"--vs-error-icon": a?.errorIcon
|
|
559
559
|
}),
|
|
560
560
|
children: [
|
|
561
|
-
/* @__PURE__ */
|
|
561
|
+
/* @__PURE__ */ B("div", {
|
|
562
562
|
ref: o,
|
|
563
563
|
className: "h-full w-full"
|
|
564
564
|
}),
|
|
565
|
-
s === "loading" && /* @__PURE__ */
|
|
566
|
-
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
567
|
-
children: [/* @__PURE__ */
|
|
568
|
-
className: g("text-center",
|
|
565
|
+
s === "loading" && /* @__PURE__ */ V("div", {
|
|
566
|
+
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", De.loadingOverlay),
|
|
567
|
+
children: [/* @__PURE__ */ B(E, {}), t && /* @__PURE__ */ B("p", {
|
|
568
|
+
className: g("text-center", De.statusLabel),
|
|
569
569
|
children: t
|
|
570
570
|
})]
|
|
571
571
|
}),
|
|
572
|
-
s === "error" && /* @__PURE__ */
|
|
572
|
+
s === "error" && /* @__PURE__ */ V("div", {
|
|
573
573
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
574
|
-
children: [/* @__PURE__ */
|
|
574
|
+
children: [/* @__PURE__ */ B(D, {
|
|
575
575
|
size: 60,
|
|
576
576
|
stroke: S,
|
|
577
577
|
"aria-hidden": !0,
|
|
578
|
-
className:
|
|
579
|
-
}), /* @__PURE__ */
|
|
578
|
+
className: De.errorIcon
|
|
579
|
+
}), /* @__PURE__ */ B("p", {
|
|
580
580
|
role: "alert",
|
|
581
|
-
className: g("text-center",
|
|
581
|
+
className: g("text-center", De.statusLabel),
|
|
582
582
|
children: n
|
|
583
583
|
})]
|
|
584
584
|
})
|
|
585
585
|
]
|
|
586
586
|
});
|
|
587
|
-
},
|
|
587
|
+
}, J = {
|
|
588
588
|
body: "_body_13ogb_4",
|
|
589
589
|
statusLabel: "_statusLabel_13ogb_13",
|
|
590
590
|
errorIcon: "_errorIcon_13ogb_17",
|
|
@@ -599,66 +599,66 @@ var G = {
|
|
|
599
599
|
jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
|
|
600
600
|
jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
|
|
601
601
|
jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
|
|
602
|
-
},
|
|
602
|
+
}, ke = () => j(async () => ({ default: (await import("./PdfContent-BoAtghsO.js")).PdfContent })), Ae = ({ url: e, fileName: t, loadErrorLabel: n }) => {
|
|
603
603
|
let [r, i] = R(!1);
|
|
604
604
|
return F(() => {
|
|
605
605
|
i(!1);
|
|
606
|
-
}, [e]), r ? /* @__PURE__ */
|
|
606
|
+
}, [e]), r ? /* @__PURE__ */ V("div", {
|
|
607
607
|
className: "flex flex-col items-center gap-2",
|
|
608
|
-
children: [/* @__PURE__ */
|
|
608
|
+
children: [/* @__PURE__ */ B(D, {
|
|
609
609
|
size: 60,
|
|
610
610
|
stroke: S,
|
|
611
|
-
className:
|
|
612
|
-
}), /* @__PURE__ */
|
|
613
|
-
className: g("text-center",
|
|
611
|
+
className: J.errorIcon
|
|
612
|
+
}), /* @__PURE__ */ B("p", {
|
|
613
|
+
className: g("text-center", J.statusLabel),
|
|
614
614
|
children: n
|
|
615
615
|
})]
|
|
616
|
-
}) : /* @__PURE__ */
|
|
616
|
+
}) : /* @__PURE__ */ B("img", {
|
|
617
617
|
src: e,
|
|
618
618
|
alt: t ?? "",
|
|
619
619
|
className: "max-h-full max-w-full object-contain",
|
|
620
620
|
onError: () => i(!0)
|
|
621
621
|
});
|
|
622
|
-
},
|
|
622
|
+
}, je = new Set([
|
|
623
623
|
i.PlainText,
|
|
624
624
|
i.Code,
|
|
625
625
|
i.Ooxml
|
|
626
|
-
]),
|
|
627
|
-
let { colors:
|
|
628
|
-
|
|
629
|
-
}, []),
|
|
626
|
+
]), Me = M(({ content: e, isLoading: t = !1, fileName: r, isHtmlSourceView: a = !1, labels: { unsupportedLabel: o = "Preview is not supported for this file", loadErrorLabel: c = "Failed to load file", forbiddenErrorLabel: l = "You don't have permission to access this file", visualizerErrorLabel: d, htmlFrameBlockedLabel: f = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: h = "Open in new tab", pdfThumbnailsLabel: _, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: b, pdfContentLoadingLabel: x, pdfContentErrorLabel: C, pdfContentRetryLabel: w, xlsxFormulaLabel: T = "Formula", codeContentLoadingLabel: O, codeContentErrorLabel: k, codeContentRetryLabel: ee, tableCopyCsvLabel: te, tableCopyTxtLabel: ne, tableCopyMarkdownLabel: re, tableCopiedLabel: ae, tableDownloadCsvLabel: oe, ooxmlHighlightsLabel: A, ooxmlHighlightNavigatedLabel: j } = {}, styles: M, codeBlockTheme: P, tableDownloadFilename: F, loadPdf: L, hidePdfToolbar: z = !1, configurePdfWorker: le }) => {
|
|
627
|
+
let { colors: H, typography: U, bodyClassName: ue, cssVars: de } = M ?? {}, [W, fe] = R(0), pe = I(ke, [W]), he = N(() => {
|
|
628
|
+
fe((e) => e + 1);
|
|
629
|
+
}, []), G = U?.fontClassName != null, _e = I(() => ({
|
|
630
630
|
...m({
|
|
631
|
-
"--ac-text":
|
|
632
|
-
"--ac-status-text":
|
|
633
|
-
"--ac-error-icon":
|
|
634
|
-
"--ac-open-in-new-tab-text":
|
|
635
|
-
"--ac-json-border":
|
|
636
|
-
"--ac-json-bg":
|
|
637
|
-
"--ac-json-label":
|
|
638
|
-
"--ac-json-clickable-label":
|
|
639
|
-
"--ac-json-punctuation":
|
|
640
|
-
"--ac-json-string":
|
|
641
|
-
"--ac-json-number":
|
|
642
|
-
"--ac-json-boolean":
|
|
643
|
-
"--ac-json-null":
|
|
644
|
-
"--ac-json-toggle-icon":
|
|
645
|
-
"--ac-json-toggle-icon-hover":
|
|
646
|
-
"--ac-ooxml-bg":
|
|
647
|
-
"--ac-ooxml-formula-border":
|
|
648
|
-
"--ac-ooxml-formula-bg":
|
|
649
|
-
"--ac-ooxml-formula-text":
|
|
650
|
-
"--ac-ooxml-highlight-border":
|
|
651
|
-
"--ac-ooxml-highlight-bg":
|
|
652
|
-
"--ac-json-collapsed-text":
|
|
653
|
-
"--ac-json-collapsed-bg":
|
|
654
|
-
"--ac-font-family":
|
|
655
|
-
"--ac-font-size":
|
|
656
|
-
"--ac-font-weight":
|
|
657
|
-
"--ac-line-height":
|
|
658
|
-
"--ac-letter-spacing":
|
|
631
|
+
"--ac-text": H?.text,
|
|
632
|
+
"--ac-status-text": H?.statusText,
|
|
633
|
+
"--ac-error-icon": H?.errorIcon,
|
|
634
|
+
"--ac-open-in-new-tab-text": H?.openInNewTabText,
|
|
635
|
+
"--ac-json-border": H?.jsonBorder,
|
|
636
|
+
"--ac-json-bg": H?.jsonBackground,
|
|
637
|
+
"--ac-json-label": H?.jsonLabel,
|
|
638
|
+
"--ac-json-clickable-label": H?.jsonClickableLabel,
|
|
639
|
+
"--ac-json-punctuation": H?.jsonPunctuation,
|
|
640
|
+
"--ac-json-string": H?.jsonString,
|
|
641
|
+
"--ac-json-number": H?.jsonNumber,
|
|
642
|
+
"--ac-json-boolean": H?.jsonBoolean,
|
|
643
|
+
"--ac-json-null": H?.jsonNull,
|
|
644
|
+
"--ac-json-toggle-icon": H?.jsonToggleIcon,
|
|
645
|
+
"--ac-json-toggle-icon-hover": H?.jsonToggleIconHover,
|
|
646
|
+
"--ac-ooxml-bg": H?.ooxmlBackground,
|
|
647
|
+
"--ac-ooxml-formula-border": H?.ooxmlFormulaBorder,
|
|
648
|
+
"--ac-ooxml-formula-bg": H?.ooxmlFormulaBackground,
|
|
649
|
+
"--ac-ooxml-formula-text": H?.ooxmlFormulaText,
|
|
650
|
+
"--ac-ooxml-highlight-border": H?.ooxmlHighlightBorder,
|
|
651
|
+
"--ac-ooxml-highlight-bg": H?.ooxmlHighlightBackground,
|
|
652
|
+
"--ac-json-collapsed-text": H?.jsonCollapsedText,
|
|
653
|
+
"--ac-json-collapsed-bg": H?.jsonCollapsedBackground,
|
|
654
|
+
"--ac-font-family": G ? void 0 : U?.fontFamily,
|
|
655
|
+
"--ac-font-size": G ? void 0 : U?.fontSize,
|
|
656
|
+
"--ac-font-weight": G ? void 0 : U?.fontWeight,
|
|
657
|
+
"--ac-line-height": G ? void 0 : U?.lineHeight,
|
|
658
|
+
"--ac-letter-spacing": G ? void 0 : U?.letterSpacing
|
|
659
659
|
}),
|
|
660
|
-
...
|
|
661
|
-
}), [M]),
|
|
660
|
+
...de
|
|
661
|
+
}), [M]), ve = I(() => {
|
|
662
662
|
switch (e.type) {
|
|
663
663
|
case i.Image:
|
|
664
664
|
case i.Audio:
|
|
@@ -676,35 +676,35 @@ var G = {
|
|
|
676
676
|
case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
|
|
677
677
|
default: return "h-full overflow-auto p-4";
|
|
678
678
|
}
|
|
679
|
-
}, [e.type]),
|
|
679
|
+
}, [e.type]), ye = I(() => {
|
|
680
680
|
switch (e.type) {
|
|
681
|
-
case i.PlainText: return /* @__PURE__ */
|
|
682
|
-
className: g("whitespace-pre-wrap break-words",
|
|
681
|
+
case i.PlainText: return /* @__PURE__ */ B("pre", {
|
|
682
|
+
className: g("whitespace-pre-wrap break-words", J.body, U?.fontClassName),
|
|
683
683
|
children: e.text
|
|
684
684
|
});
|
|
685
|
-
case i.Image: return /* @__PURE__ */
|
|
685
|
+
case i.Image: return /* @__PURE__ */ B(Ae, {
|
|
686
686
|
url: e.url,
|
|
687
687
|
fileName: r,
|
|
688
688
|
loadErrorLabel: c
|
|
689
689
|
});
|
|
690
|
-
case i.Audio: return /* @__PURE__ */
|
|
690
|
+
case i.Audio: return /* @__PURE__ */ B("audio", {
|
|
691
691
|
controls: !0,
|
|
692
692
|
src: e.url,
|
|
693
693
|
"aria-label": r ?? "Audio attachment",
|
|
694
694
|
className: "w-full max-w-sm",
|
|
695
695
|
preload: "metadata",
|
|
696
|
-
children: e.mimeType && /* @__PURE__ */
|
|
696
|
+
children: e.mimeType && /* @__PURE__ */ B("source", {
|
|
697
697
|
src: e.url,
|
|
698
698
|
type: e.mimeType
|
|
699
699
|
})
|
|
700
700
|
});
|
|
701
|
-
case i.Markdown: return /* @__PURE__ */
|
|
701
|
+
case i.Markdown: return /* @__PURE__ */ B(p, {
|
|
702
702
|
content: e.text,
|
|
703
703
|
isStreaming: !1,
|
|
704
704
|
codeBlockTheme: P,
|
|
705
705
|
classNames: u
|
|
706
706
|
});
|
|
707
|
-
case i.MarkdownTable: return /* @__PURE__ */
|
|
707
|
+
case i.MarkdownTable: return /* @__PURE__ */ B(p, {
|
|
708
708
|
content: e.text,
|
|
709
709
|
isStreaming: !1,
|
|
710
710
|
codeBlockTheme: P,
|
|
@@ -723,34 +723,34 @@ var G = {
|
|
|
723
723
|
},
|
|
724
724
|
tableDownloadFilename: F
|
|
725
725
|
});
|
|
726
|
-
case i.Json: return /* @__PURE__ */
|
|
726
|
+
case i.Json: return /* @__PURE__ */ B("div", {
|
|
727
727
|
dir: "ltr",
|
|
728
728
|
className: "h-full overflow-auto",
|
|
729
|
-
children: /* @__PURE__ */
|
|
730
|
-
className: g("m-3 overflow-auto rounded-md border",
|
|
731
|
-
children: /* @__PURE__ */
|
|
729
|
+
children: /* @__PURE__ */ B("div", {
|
|
730
|
+
className: g("m-3 overflow-auto rounded-md border", J.jsonWrapper),
|
|
731
|
+
children: /* @__PURE__ */ B(se, {
|
|
732
732
|
data: e.value,
|
|
733
733
|
style: {
|
|
734
|
-
container: g("whitespace-pre-wrap break-words p-2",
|
|
735
|
-
basicChildStyle:
|
|
734
|
+
container: g("whitespace-pre-wrap break-words p-2", U?.jsonClassName ?? "dial-code-text"),
|
|
735
|
+
basicChildStyle: ce.basicChildStyle,
|
|
736
736
|
childFieldsContainer: "m-0 ps-3",
|
|
737
|
-
label: g("me-1 font-semibold",
|
|
738
|
-
clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline",
|
|
739
|
-
nullValue: g("italic",
|
|
740
|
-
undefinedValue: g("italic",
|
|
741
|
-
stringValue:
|
|
742
|
-
booleanValue:
|
|
743
|
-
numberValue:
|
|
744
|
-
otherValue: g("italic",
|
|
745
|
-
punctuation: g("me-1",
|
|
746
|
-
collapseIcon: g("me-1 cursor-pointer select-none transition-colors",
|
|
747
|
-
expandIcon: g("me-1 cursor-pointer select-none transition-colors",
|
|
748
|
-
collapsedContent: g("me-1 cursor-pointer rounded px-1",
|
|
737
|
+
label: g("me-1 font-semibold", J.jsonLabel),
|
|
738
|
+
clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline", J.jsonClickableLabel),
|
|
739
|
+
nullValue: g("italic", J.jsonNullValue),
|
|
740
|
+
undefinedValue: g("italic", J.jsonNullValue),
|
|
741
|
+
stringValue: J.jsonStringValue,
|
|
742
|
+
booleanValue: J.jsonBooleanValue,
|
|
743
|
+
numberValue: J.jsonNumberValue,
|
|
744
|
+
otherValue: g("italic", J.jsonNullValue),
|
|
745
|
+
punctuation: g("me-1", J.jsonPunctuation),
|
|
746
|
+
collapseIcon: g("me-1 cursor-pointer select-none transition-colors", J.jsonCollapseIcon),
|
|
747
|
+
expandIcon: g("me-1 cursor-pointer select-none transition-colors", J.jsonExpandIcon),
|
|
748
|
+
collapsedContent: g("me-1 cursor-pointer rounded px-1", J.jsonCollapsedContent)
|
|
749
749
|
}
|
|
750
750
|
})
|
|
751
751
|
})
|
|
752
752
|
});
|
|
753
|
-
case i.Code: return /* @__PURE__ */
|
|
753
|
+
case i.Code: return /* @__PURE__ */ B(me, {
|
|
754
754
|
content: e,
|
|
755
755
|
codeBlockTheme: P,
|
|
756
756
|
labels: {
|
|
@@ -759,7 +759,7 @@ var G = {
|
|
|
759
759
|
retryLabel: ee
|
|
760
760
|
}
|
|
761
761
|
});
|
|
762
|
-
case i.Html: return /* @__PURE__ */
|
|
762
|
+
case i.Html: return /* @__PURE__ */ B(ge, {
|
|
763
763
|
content: e,
|
|
764
764
|
labels: {
|
|
765
765
|
htmlFrameBlockedLabel: f,
|
|
@@ -769,23 +769,23 @@ var G = {
|
|
|
769
769
|
title: r,
|
|
770
770
|
codeBlockTheme: P
|
|
771
771
|
});
|
|
772
|
-
case i.Pdf: return /* @__PURE__ */
|
|
773
|
-
retryKey:
|
|
774
|
-
onRetry:
|
|
772
|
+
case i.Pdf: return /* @__PURE__ */ B(s, {
|
|
773
|
+
retryKey: W,
|
|
774
|
+
onRetry: he,
|
|
775
775
|
labels: {
|
|
776
776
|
loadingLabel: x,
|
|
777
777
|
errorLabel: C,
|
|
778
778
|
retryLabel: w
|
|
779
779
|
},
|
|
780
|
-
children: /* @__PURE__ */
|
|
780
|
+
children: /* @__PURE__ */ B(pe, {
|
|
781
781
|
fileName: r,
|
|
782
782
|
url: e.url,
|
|
783
783
|
highlights: e.highlights ?? [],
|
|
784
784
|
selectedHighlightId: e.selectedHighlightId,
|
|
785
785
|
selectedPageNumber: e.page,
|
|
786
786
|
loadPdf: L,
|
|
787
|
-
hideHeader:
|
|
788
|
-
configurePdfWorker:
|
|
787
|
+
hideHeader: z,
|
|
788
|
+
configurePdfWorker: le,
|
|
789
789
|
labels: {
|
|
790
790
|
thumbnailsLabel: _,
|
|
791
791
|
showThumbnailsLabel: v,
|
|
@@ -797,35 +797,35 @@ var G = {
|
|
|
797
797
|
}
|
|
798
798
|
})
|
|
799
799
|
}, e.url);
|
|
800
|
-
case i.Ooxml: return /* @__PURE__ */
|
|
800
|
+
case i.Ooxml: return /* @__PURE__ */ B(Ee, {
|
|
801
801
|
content: e,
|
|
802
802
|
fileName: r,
|
|
803
803
|
loadErrorLabel: c,
|
|
804
804
|
formulaLabel: T,
|
|
805
|
-
formulaLabelClassName:
|
|
805
|
+
formulaLabelClassName: U?.xlsxFormulaLabelClassName ?? "dial-italic-text",
|
|
806
806
|
highlightsLabel: A,
|
|
807
807
|
highlightNavigatedLabel: j
|
|
808
808
|
});
|
|
809
809
|
case i.Visualizer:
|
|
810
|
-
case i.GroupedVisualizer: return /* @__PURE__ */
|
|
810
|
+
case i.GroupedVisualizer: return /* @__PURE__ */ B(Oe, {
|
|
811
811
|
content: e,
|
|
812
812
|
errorLabel: d
|
|
813
813
|
});
|
|
814
|
-
case i.McpApp: return /* @__PURE__ */
|
|
815
|
-
case i.Unsupported: return /* @__PURE__ */
|
|
816
|
-
className: g("text-center",
|
|
814
|
+
case i.McpApp: return /* @__PURE__ */ B(xe, { content: e });
|
|
815
|
+
case i.Unsupported: return /* @__PURE__ */ B("p", {
|
|
816
|
+
className: g("text-center", J.statusLabel),
|
|
817
817
|
children: o
|
|
818
818
|
});
|
|
819
819
|
case i.Error: {
|
|
820
820
|
let t = e.errorType === n.Forbidden;
|
|
821
|
-
return /* @__PURE__ */
|
|
821
|
+
return /* @__PURE__ */ V("div", {
|
|
822
822
|
className: "flex flex-col items-center gap-2",
|
|
823
|
-
children: [
|
|
823
|
+
children: [B(t ? ie : D, {
|
|
824
824
|
size: 60,
|
|
825
825
|
stroke: S,
|
|
826
|
-
className:
|
|
827
|
-
}), /* @__PURE__ */
|
|
828
|
-
className: g("text-center",
|
|
826
|
+
className: J.errorIcon
|
|
827
|
+
}), /* @__PURE__ */ B("p", {
|
|
828
|
+
className: g("text-center", J.statusLabel),
|
|
829
829
|
children: t ? l : c
|
|
830
830
|
})]
|
|
831
831
|
});
|
|
@@ -833,9 +833,9 @@ var G = {
|
|
|
833
833
|
}
|
|
834
834
|
}, [
|
|
835
835
|
e,
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
836
|
+
U?.fontClassName,
|
|
837
|
+
U?.jsonClassName,
|
|
838
|
+
U?.xlsxFormulaLabelClassName,
|
|
839
839
|
r,
|
|
840
840
|
P,
|
|
841
841
|
o,
|
|
@@ -847,8 +847,8 @@ var G = {
|
|
|
847
847
|
a,
|
|
848
848
|
F,
|
|
849
849
|
L,
|
|
850
|
-
|
|
851
|
-
|
|
850
|
+
z,
|
|
851
|
+
le,
|
|
852
852
|
_,
|
|
853
853
|
v,
|
|
854
854
|
y,
|
|
@@ -860,9 +860,9 @@ var G = {
|
|
|
860
860
|
O,
|
|
861
861
|
k,
|
|
862
862
|
ee,
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
863
|
+
pe,
|
|
864
|
+
W,
|
|
865
|
+
he,
|
|
866
866
|
te,
|
|
867
867
|
ne,
|
|
868
868
|
re,
|
|
@@ -871,30 +871,30 @@ var G = {
|
|
|
871
871
|
A,
|
|
872
872
|
j
|
|
873
873
|
]);
|
|
874
|
-
return /* @__PURE__ */
|
|
875
|
-
style: !t &&
|
|
876
|
-
className: g(t ? "flex h-full items-center justify-center" :
|
|
877
|
-
children: t ? /* @__PURE__ */
|
|
874
|
+
return /* @__PURE__ */ B("div", {
|
|
875
|
+
style: !t && je.has(e.type) ? _e : void 0,
|
|
876
|
+
className: g(t ? "flex h-full items-center justify-center" : ve, ue),
|
|
877
|
+
children: t ? /* @__PURE__ */ B(E, {}) : ye
|
|
878
878
|
});
|
|
879
|
-
}),
|
|
880
|
-
let [
|
|
881
|
-
|
|
882
|
-
}, [
|
|
883
|
-
|
|
884
|
-
}, [
|
|
885
|
-
|
|
886
|
-
}, [
|
|
879
|
+
}), Ne = 2e3, Pe = M(({ isOpen: e, isLoading: t = !1, onClose: n, content: r, fileName: a, labels: { ariaLabel: s, closeLabel: c = "Close", resizeLabel: l = "Resize panel", downloadLabel: u = "Download", copyTextLabel: d = "Copy text", copiedTextLabel: f = "Copied!", copyMarkdownLabel: p = "Copy as Markdown", copiedMarkdownLabel: m = "Copied!", copyJsonLabel: h = "Copy as JSON", copiedJsonLabel: _ = "Copied!", visualizerErrorLabel: v, unsupportedLabel: C = "Preview is not supported for this file", loadErrorLabel: T = "Failed to load file", forbiddenErrorLabel: E = "You don't have permission to access this file", htmlFrameBlockedLabel: D = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: O = "Open in new tab", htmlViewSourceLabel: ie = "View source", htmlViewRenderedLabel: A = "View rendered", mcpAppReloadLabel: j = "Reload", pdfThumbnailsLabel: M, pdfShowThumbnailsLabel: P, pdfHideThumbnailsLabel: I, pdfPageNumberLabel: se, pdfContentLoadingLabel: ce, pdfContentErrorLabel: le, pdfContentRetryLabel: H, xlsxFormulaLabel: U, codeContentLoadingLabel: ue, codeContentErrorLabel: de, codeContentRetryLabel: W, tableCopyCsvLabel: fe, tableCopyTxtLabel: pe, tableCopyMarkdownLabel: me, tableCopiedLabel: he, tableDownloadCsvLabel: ge, ooxmlHighlightsLabel: G, ooxmlHighlightNavigatedLabel: _e }, onDownload: ve, onCopyText: ye, onCopyMarkdown: be, onCopyJson: K, tableDownloadFilename: xe, isMobile: q = !1, defaultWidth: Se, minWidth: Ce = 600, maxWidth: we = 1500, onResizeStop: Te, styles: Ee, codeBlockTheme: De, loadPdf: Oe, configurePdfWorker: J }) => {
|
|
880
|
+
let [ke, Ae] = R(!1), [je, Pe] = R(!1), [Fe, Y] = R(!1), [X, Ie] = R(!1), Z = L(null), Le = L(null), Q = L(null), Re = N(() => {
|
|
881
|
+
ye?.(), Z.current != null && clearTimeout(Z.current), Ae(!0), Z.current = setTimeout(() => Ae(!1), Ne);
|
|
882
|
+
}, [ye]), ze = N(() => {
|
|
883
|
+
be?.(), Le.current != null && clearTimeout(Le.current), Pe(!0), Le.current = setTimeout(() => Pe(!1), Ne);
|
|
884
|
+
}, [be]), Be = N(() => {
|
|
885
|
+
K?.(), Q.current != null && clearTimeout(Q.current), Y(!0), Q.current = setTimeout(() => Y(!1), Ne);
|
|
886
|
+
}, [K]);
|
|
887
887
|
F(() => () => {
|
|
888
|
-
|
|
888
|
+
Z.current != null && clearTimeout(Z.current), Le.current != null && clearTimeout(Le.current), Q.current != null && clearTimeout(Q.current);
|
|
889
889
|
}, []);
|
|
890
890
|
let Ve = N(() => {
|
|
891
|
-
|
|
891
|
+
Ie((e) => !e);
|
|
892
892
|
}, []);
|
|
893
893
|
F(() => {
|
|
894
|
-
|
|
894
|
+
Ie(!1);
|
|
895
895
|
}, [r]);
|
|
896
|
-
let { className: He, panelStyles: Ue, ...$ } =
|
|
897
|
-
return /* @__PURE__ */
|
|
896
|
+
let { className: He, panelStyles: Ue, ...$ } = Ee ?? {}, We = !t && r.type === i.Html && r.srcdoc != null, Ge = !t && ye != null && (r.type === i.PlainText || r.type === i.Code), Ke = !t && be != null && r.type === i.Markdown, qe = !t && K != null && r.type === i.Json, Je = !t && ve != null && o(r), Ye = !t && r.type === i.McpApp && r.onReload != null;
|
|
897
|
+
return /* @__PURE__ */ B(b, {
|
|
898
898
|
isOpen: e,
|
|
899
899
|
orientation: y.Right,
|
|
900
900
|
title: a,
|
|
@@ -904,20 +904,20 @@ var G = {
|
|
|
904
904
|
resizeLabel: l
|
|
905
905
|
},
|
|
906
906
|
onClose: n,
|
|
907
|
-
resizable: !
|
|
908
|
-
defaultWidth:
|
|
909
|
-
minWidth:
|
|
910
|
-
maxWidth:
|
|
911
|
-
onResizeStop:
|
|
907
|
+
resizable: !q,
|
|
908
|
+
defaultWidth: Se,
|
|
909
|
+
minWidth: Ce,
|
|
910
|
+
maxWidth: we,
|
|
911
|
+
onResizeStop: Te,
|
|
912
912
|
styles: {
|
|
913
913
|
...Ue,
|
|
914
914
|
titleClassName: Ue?.titleClassName ?? "dial-h3-text",
|
|
915
915
|
headerClassName: g("border-b border-tertiary", Ue?.headerClassName),
|
|
916
916
|
className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0", He, Ue?.className)
|
|
917
917
|
},
|
|
918
|
-
rightActions: We || Ge || Ke || qe || Je || Ye ? /* @__PURE__ */
|
|
919
|
-
Ye && /* @__PURE__ */
|
|
920
|
-
icon: /* @__PURE__ */
|
|
918
|
+
rightActions: We || Ge || Ke || qe || Je || Ye ? /* @__PURE__ */ V(z, { children: [
|
|
919
|
+
Ye && /* @__PURE__ */ B(w, {
|
|
920
|
+
icon: /* @__PURE__ */ B(oe, {
|
|
921
921
|
size: x.LG,
|
|
922
922
|
stroke: S,
|
|
923
923
|
"aria-hidden": !0
|
|
@@ -926,62 +926,62 @@ var G = {
|
|
|
926
926
|
tooltipProps: { tooltip: j },
|
|
927
927
|
onClick: r.type === i.McpApp ? r.onReload : void 0
|
|
928
928
|
}),
|
|
929
|
-
We && /* @__PURE__ */
|
|
930
|
-
icon:
|
|
929
|
+
We && /* @__PURE__ */ B(w, {
|
|
930
|
+
icon: B(X ? re : ee, {
|
|
931
931
|
size: x.LG,
|
|
932
932
|
stroke: S,
|
|
933
933
|
"aria-hidden": !0
|
|
934
934
|
}),
|
|
935
|
-
"aria-label":
|
|
936
|
-
"aria-pressed":
|
|
937
|
-
tooltipProps: { tooltip:
|
|
935
|
+
"aria-label": X ? A : ie,
|
|
936
|
+
"aria-pressed": X,
|
|
937
|
+
tooltipProps: { tooltip: X ? A : ie },
|
|
938
938
|
onClick: Ve
|
|
939
939
|
}),
|
|
940
|
-
Ge && /* @__PURE__ */
|
|
941
|
-
icon:
|
|
940
|
+
Ge && /* @__PURE__ */ B(w, {
|
|
941
|
+
icon: B(ke ? k : te, {
|
|
942
942
|
size: x.LG,
|
|
943
943
|
stroke: S,
|
|
944
944
|
"aria-hidden": !0
|
|
945
945
|
}),
|
|
946
|
-
"aria-label":
|
|
947
|
-
tooltipProps: { tooltip:
|
|
946
|
+
"aria-label": ke ? f : d,
|
|
947
|
+
tooltipProps: { tooltip: ke ? f : d },
|
|
948
948
|
onClick: Re
|
|
949
949
|
}),
|
|
950
|
-
Ke && /* @__PURE__ */
|
|
951
|
-
icon:
|
|
950
|
+
Ke && /* @__PURE__ */ B(w, {
|
|
951
|
+
icon: B(je ? k : ae, {
|
|
952
952
|
size: x.LG,
|
|
953
953
|
stroke: S,
|
|
954
954
|
"aria-hidden": !0
|
|
955
955
|
}),
|
|
956
|
-
"aria-label":
|
|
957
|
-
tooltipProps: { tooltip:
|
|
956
|
+
"aria-label": je ? m : p,
|
|
957
|
+
tooltipProps: { tooltip: je ? m : p },
|
|
958
958
|
onClick: ze
|
|
959
959
|
}),
|
|
960
|
-
qe && /* @__PURE__ */
|
|
961
|
-
icon:
|
|
960
|
+
qe && /* @__PURE__ */ B(w, {
|
|
961
|
+
icon: B(Fe ? k : te, {
|
|
962
962
|
size: x.LG,
|
|
963
963
|
stroke: S,
|
|
964
964
|
"aria-hidden": !0
|
|
965
965
|
}),
|
|
966
|
-
"aria-label":
|
|
967
|
-
tooltipProps: { tooltip:
|
|
966
|
+
"aria-label": Fe ? _ : h,
|
|
967
|
+
tooltipProps: { tooltip: Fe ? _ : h },
|
|
968
968
|
onClick: Be
|
|
969
969
|
}),
|
|
970
|
-
Je && /* @__PURE__ */
|
|
971
|
-
icon: /* @__PURE__ */
|
|
970
|
+
Je && /* @__PURE__ */ B(w, {
|
|
971
|
+
icon: /* @__PURE__ */ B(ne, {
|
|
972
972
|
size: x.LG,
|
|
973
973
|
stroke: S
|
|
974
974
|
}),
|
|
975
975
|
"aria-label": u,
|
|
976
976
|
tooltipProps: { tooltip: u },
|
|
977
|
-
onClick:
|
|
977
|
+
onClick: ve
|
|
978
978
|
})
|
|
979
979
|
] }) : null,
|
|
980
|
-
children: /* @__PURE__ */
|
|
980
|
+
children: /* @__PURE__ */ B(Me, {
|
|
981
981
|
content: r,
|
|
982
982
|
isLoading: t,
|
|
983
983
|
fileName: a,
|
|
984
|
-
isHtmlSourceView:
|
|
984
|
+
isHtmlSourceView: X,
|
|
985
985
|
labels: {
|
|
986
986
|
unsupportedLabel: C,
|
|
987
987
|
loadErrorLabel: T,
|
|
@@ -993,64 +993,64 @@ var G = {
|
|
|
993
993
|
pdfShowThumbnailsLabel: P,
|
|
994
994
|
pdfHideThumbnailsLabel: I,
|
|
995
995
|
pdfPageNumberLabel: se,
|
|
996
|
-
pdfContentLoadingLabel:
|
|
997
|
-
pdfContentErrorLabel:
|
|
998
|
-
pdfContentRetryLabel:
|
|
999
|
-
xlsxFormulaLabel:
|
|
1000
|
-
codeContentLoadingLabel:
|
|
1001
|
-
codeContentErrorLabel:
|
|
1002
|
-
codeContentRetryLabel:
|
|
1003
|
-
tableCopyCsvLabel:
|
|
1004
|
-
tableCopyTxtLabel:
|
|
1005
|
-
tableCopyMarkdownLabel:
|
|
1006
|
-
tableCopiedLabel:
|
|
1007
|
-
tableDownloadCsvLabel:
|
|
1008
|
-
ooxmlHighlightsLabel:
|
|
1009
|
-
ooxmlHighlightNavigatedLabel:
|
|
996
|
+
pdfContentLoadingLabel: ce,
|
|
997
|
+
pdfContentErrorLabel: le,
|
|
998
|
+
pdfContentRetryLabel: H,
|
|
999
|
+
xlsxFormulaLabel: U,
|
|
1000
|
+
codeContentLoadingLabel: ue,
|
|
1001
|
+
codeContentErrorLabel: de,
|
|
1002
|
+
codeContentRetryLabel: W,
|
|
1003
|
+
tableCopyCsvLabel: fe,
|
|
1004
|
+
tableCopyTxtLabel: pe,
|
|
1005
|
+
tableCopyMarkdownLabel: me,
|
|
1006
|
+
tableCopiedLabel: he,
|
|
1007
|
+
tableDownloadCsvLabel: ge,
|
|
1008
|
+
ooxmlHighlightsLabel: G,
|
|
1009
|
+
ooxmlHighlightNavigatedLabel: _e
|
|
1010
1010
|
},
|
|
1011
1011
|
styles: $,
|
|
1012
|
-
codeBlockTheme:
|
|
1013
|
-
tableDownloadFilename:
|
|
1014
|
-
loadPdf:
|
|
1015
|
-
configurePdfWorker:
|
|
1012
|
+
codeBlockTheme: De,
|
|
1013
|
+
tableDownloadFilename: xe,
|
|
1014
|
+
loadPdf: Oe,
|
|
1015
|
+
configurePdfWorker: J
|
|
1016
1016
|
})
|
|
1017
1017
|
});
|
|
1018
|
-
}),
|
|
1018
|
+
}), Fe = new Set(["html", "htm"]), Y = {
|
|
1019
1019
|
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1020
1020
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1021
1021
|
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
1022
|
-
},
|
|
1022
|
+
}, X = 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(".")), Ie = {
|
|
1023
1023
|
docx: r.Docx,
|
|
1024
1024
|
xlsx: r.Xlsx,
|
|
1025
1025
|
pptx: r.Pptx,
|
|
1026
1026
|
csv: r.Csv
|
|
1027
|
-
},
|
|
1028
|
-
[
|
|
1029
|
-
[
|
|
1030
|
-
[
|
|
1027
|
+
}, Z = {
|
|
1028
|
+
[Y.docx]: r.Docx,
|
|
1029
|
+
[Y.xlsx]: r.Xlsx,
|
|
1030
|
+
[Y.pptx]: r.Pptx,
|
|
1031
1031
|
[f.CSV]: r.Csv
|
|
1032
1032
|
}, Le = {
|
|
1033
|
-
[r.Docx]:
|
|
1034
|
-
[r.Xlsx]:
|
|
1035
|
-
[r.Pptx]:
|
|
1033
|
+
[r.Docx]: Y.docx,
|
|
1034
|
+
[r.Xlsx]: Y.xlsx,
|
|
1035
|
+
[r.Pptx]: Y.pptx,
|
|
1036
1036
|
[r.Csv]: f.CSV
|
|
1037
1037
|
}, Q = (e, t) => {
|
|
1038
1038
|
let n = t?.split(";", 1)[0].trim().toLowerCase();
|
|
1039
1039
|
if (n != null) {
|
|
1040
|
-
let e =
|
|
1040
|
+
let e = Z[n];
|
|
1041
1041
|
if (e != null) return e;
|
|
1042
1042
|
}
|
|
1043
1043
|
let r = e.lastIndexOf(".");
|
|
1044
|
-
if (r !== -1) return
|
|
1044
|
+
if (r !== -1) return Ie[e.slice(r + 1).toLowerCase()];
|
|
1045
1045
|
}, Re = (e, t) => Q(e, t) != null, ze = (e, t) => {
|
|
1046
1046
|
let n = Q(e, t);
|
|
1047
1047
|
return n == null ? void 0 : Le[n];
|
|
1048
1048
|
}, Be = (e) => {
|
|
1049
1049
|
let t = e.lastIndexOf(".");
|
|
1050
|
-
return t === -1 ? !1 :
|
|
1050
|
+
return t === -1 ? !1 : X.has(e.slice(t + 1).toLowerCase());
|
|
1051
1051
|
}, Ve = (e) => {
|
|
1052
1052
|
let t = e.lastIndexOf(".");
|
|
1053
|
-
return t === -1 ? !1 :
|
|
1053
|
+
return t === -1 ? !1 : Fe.has(e.slice(t + 1).toLowerCase());
|
|
1054
1054
|
}, He = {
|
|
1055
1055
|
xml: "xml",
|
|
1056
1056
|
csv: "plaintext",
|
|
@@ -1131,7 +1131,7 @@ var Xe = ({ children: e }) => {
|
|
|
1131
1131
|
return F(() => () => {
|
|
1132
1132
|
let e = Ke(a);
|
|
1133
1133
|
e != null && URL.revokeObjectURL(e);
|
|
1134
|
-
}, [a]), /* @__PURE__ */
|
|
1134
|
+
}, [a]), /* @__PURE__ */ B(Ye.Provider, {
|
|
1135
1135
|
value: I(() => ({
|
|
1136
1136
|
isOpen: t,
|
|
1137
1137
|
isLoading: r,
|
|
@@ -1157,68 +1157,69 @@ var Xe = ({ children: e }) => {
|
|
|
1157
1157
|
let e = P(Ye);
|
|
1158
1158
|
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
1159
1159
|
return e;
|
|
1160
|
-
}, Qe = M(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s,
|
|
1161
|
-
let { ariaLabel:
|
|
1162
|
-
a(z,
|
|
1163
|
-
}, [z,
|
|
1160
|
+
}, Qe = M(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s, loadPdf: c, configurePdfWorker: l }) => {
|
|
1161
|
+
let { ariaLabel: u = "Attachment preview", closeLabel: d = "Close", downloadLabel: f = "Download", unsupportedLabel: p = "Preview is not supported for this file", loadErrorLabel: m = "Failed to load file", forbiddenErrorLabel: g = "You don't have permission to access this file", copyTextLabel: _, copiedTextLabel: v, copyMarkdownLabel: y, copiedMarkdownLabel: b, copyJsonLabel: x, copiedJsonLabel: S, htmlFrameBlockedLabel: C, htmlOpenInNewTabLabel: w, htmlViewSourceLabel: T, htmlViewRenderedLabel: E, pdfThumbnailsLabel: D, pdfShowThumbnailsLabel: O, pdfHideThumbnailsLabel: k, pdfPageNumberLabel: ee, pdfContentLoadingLabel: te, pdfContentErrorLabel: ne, pdfContentRetryLabel: re, xlsxFormulaLabel: ie, codeContentLoadingLabel: ae, codeContentErrorLabel: oe, codeContentRetryLabel: A, tableCopyCsvLabel: j, tableCopyTxtLabel: M, tableCopyMarkdownLabel: P, tableCopiedLabel: F, tableDownloadCsvLabel: I, ooxmlHighlightsLabel: L, ooxmlHighlightNavigatedLabel: R } = e ?? {}, { isOpen: se, isLoading: ce, content: z, fileName: V, closeCanvas: le } = Ze(), H = N(() => {
|
|
1162
|
+
a(z, V);
|
|
1163
|
+
}, [z, V]), U = N(() => {
|
|
1164
1164
|
(z.type === i.PlainText || z.type === i.Code) && h(z.text);
|
|
1165
|
-
}, [z]),
|
|
1165
|
+
}, [z]), ue = N(() => {
|
|
1166
1166
|
z.type === i.Markdown && h(z.text);
|
|
1167
|
-
}, [z]),
|
|
1167
|
+
}, [z]), de = N(() => {
|
|
1168
1168
|
z.type === i.Json && h(JSON.stringify(z.value, null, 2));
|
|
1169
1169
|
}, [z]);
|
|
1170
|
-
return /* @__PURE__ */
|
|
1171
|
-
isOpen:
|
|
1172
|
-
isLoading:
|
|
1173
|
-
onClose:
|
|
1170
|
+
return /* @__PURE__ */ B(Pe, {
|
|
1171
|
+
isOpen: se,
|
|
1172
|
+
isLoading: ce,
|
|
1173
|
+
onClose: le,
|
|
1174
1174
|
content: z,
|
|
1175
|
-
fileName:
|
|
1175
|
+
fileName: V,
|
|
1176
1176
|
labels: {
|
|
1177
|
-
ariaLabel:
|
|
1178
|
-
closeLabel:
|
|
1179
|
-
downloadLabel:
|
|
1180
|
-
copyTextLabel:
|
|
1181
|
-
copiedTextLabel:
|
|
1182
|
-
copyMarkdownLabel:
|
|
1183
|
-
copiedMarkdownLabel:
|
|
1184
|
-
copyJsonLabel:
|
|
1185
|
-
copiedJsonLabel:
|
|
1186
|
-
unsupportedLabel:
|
|
1187
|
-
loadErrorLabel:
|
|
1188
|
-
forbiddenErrorLabel:
|
|
1189
|
-
htmlFrameBlockedLabel:
|
|
1190
|
-
htmlOpenInNewTabLabel:
|
|
1191
|
-
htmlViewSourceLabel:
|
|
1192
|
-
htmlViewRenderedLabel:
|
|
1193
|
-
pdfThumbnailsLabel:
|
|
1194
|
-
pdfShowThumbnailsLabel:
|
|
1195
|
-
pdfHideThumbnailsLabel:
|
|
1196
|
-
pdfPageNumberLabel:
|
|
1197
|
-
pdfContentLoadingLabel:
|
|
1198
|
-
pdfContentErrorLabel:
|
|
1199
|
-
pdfContentRetryLabel:
|
|
1200
|
-
xlsxFormulaLabel:
|
|
1201
|
-
codeContentLoadingLabel:
|
|
1202
|
-
codeContentErrorLabel:
|
|
1203
|
-
codeContentRetryLabel:
|
|
1204
|
-
tableCopyCsvLabel:
|
|
1205
|
-
tableCopyTxtLabel:
|
|
1206
|
-
tableCopyMarkdownLabel:
|
|
1207
|
-
tableCopiedLabel:
|
|
1208
|
-
tableDownloadCsvLabel:
|
|
1209
|
-
ooxmlHighlightsLabel:
|
|
1210
|
-
ooxmlHighlightNavigatedLabel:
|
|
1177
|
+
ariaLabel: u,
|
|
1178
|
+
closeLabel: d,
|
|
1179
|
+
downloadLabel: f,
|
|
1180
|
+
copyTextLabel: _,
|
|
1181
|
+
copiedTextLabel: v,
|
|
1182
|
+
copyMarkdownLabel: y,
|
|
1183
|
+
copiedMarkdownLabel: b,
|
|
1184
|
+
copyJsonLabel: x,
|
|
1185
|
+
copiedJsonLabel: S,
|
|
1186
|
+
unsupportedLabel: p,
|
|
1187
|
+
loadErrorLabel: m,
|
|
1188
|
+
forbiddenErrorLabel: g,
|
|
1189
|
+
htmlFrameBlockedLabel: C,
|
|
1190
|
+
htmlOpenInNewTabLabel: w,
|
|
1191
|
+
htmlViewSourceLabel: T,
|
|
1192
|
+
htmlViewRenderedLabel: E,
|
|
1193
|
+
pdfThumbnailsLabel: D,
|
|
1194
|
+
pdfShowThumbnailsLabel: O,
|
|
1195
|
+
pdfHideThumbnailsLabel: k,
|
|
1196
|
+
pdfPageNumberLabel: ee,
|
|
1197
|
+
pdfContentLoadingLabel: te,
|
|
1198
|
+
pdfContentErrorLabel: ne,
|
|
1199
|
+
pdfContentRetryLabel: re,
|
|
1200
|
+
xlsxFormulaLabel: ie,
|
|
1201
|
+
codeContentLoadingLabel: ae,
|
|
1202
|
+
codeContentErrorLabel: oe,
|
|
1203
|
+
codeContentRetryLabel: A,
|
|
1204
|
+
tableCopyCsvLabel: j,
|
|
1205
|
+
tableCopyTxtLabel: M,
|
|
1206
|
+
tableCopyMarkdownLabel: P,
|
|
1207
|
+
tableCopiedLabel: F,
|
|
1208
|
+
tableDownloadCsvLabel: I,
|
|
1209
|
+
ooxmlHighlightsLabel: L,
|
|
1210
|
+
ooxmlHighlightNavigatedLabel: R
|
|
1211
1211
|
},
|
|
1212
|
-
onDownload:
|
|
1212
|
+
onDownload: H,
|
|
1213
1213
|
onCopyText: z.type === i.PlainText || z.type === i.Code ? U : void 0,
|
|
1214
|
-
onCopyMarkdown: z.type === i.Markdown ?
|
|
1215
|
-
onCopyJson: z.type === i.Json ?
|
|
1214
|
+
onCopyMarkdown: z.type === i.Markdown ? ue : void 0,
|
|
1215
|
+
onCopyJson: z.type === i.Json ? de : void 0,
|
|
1216
1216
|
tableDownloadFilename: s,
|
|
1217
1217
|
isMobile: t,
|
|
1218
1218
|
defaultWidth: n,
|
|
1219
1219
|
maxWidth: r,
|
|
1220
1220
|
codeBlockTheme: o,
|
|
1221
|
-
configurePdfWorker:
|
|
1221
|
+
configurePdfWorker: l,
|
|
1222
|
+
loadPdf: c
|
|
1222
1223
|
});
|
|
1223
1224
|
}), $e = {
|
|
1224
1225
|
frame: "_frame_g47g7_1",
|
|
@@ -1226,24 +1227,24 @@ var Xe = ({ children: e }) => {
|
|
|
1226
1227
|
title: "_title_g47g7_10"
|
|
1227
1228
|
}, et = M(({ content: e, height: t, onExpand: n, expandAriaLabel: r, actionsGroupAriaLabel: i = "Visualizer actions", frameTitle: a, loadingLabel: o, errorLabel: s, titleClassName: c = "dial-small-semi-text", colors: l }) => {
|
|
1228
1229
|
let u = e.visualizerName.trim();
|
|
1229
|
-
return /* @__PURE__ */
|
|
1230
|
+
return /* @__PURE__ */ V("div", {
|
|
1230
1231
|
className: g("flex w-full min-w-0 flex-col overflow-hidden rounded-xl border", $e.frame),
|
|
1231
1232
|
style: m({
|
|
1232
1233
|
"--igv-bg": l?.background,
|
|
1233
1234
|
"--igv-border": l?.border,
|
|
1234
1235
|
"--igv-title-text": l?.titleText
|
|
1235
1236
|
}),
|
|
1236
|
-
children: [/* @__PURE__ */
|
|
1237
|
+
children: [/* @__PURE__ */ V("div", {
|
|
1237
1238
|
className: g("flex min-h-10 items-center justify-between gap-2 border-b px-4 py-2", $e.header),
|
|
1238
|
-
children: [/* @__PURE__ */
|
|
1239
|
+
children: [/* @__PURE__ */ B("span", {
|
|
1239
1240
|
className: g("min-w-0 truncate", c, $e.title),
|
|
1240
1241
|
children: u
|
|
1241
|
-
}), /* @__PURE__ */
|
|
1242
|
+
}), /* @__PURE__ */ B("div", {
|
|
1242
1243
|
role: "toolbar",
|
|
1243
1244
|
"aria-label": i,
|
|
1244
1245
|
className: "flex items-center gap-1",
|
|
1245
|
-
children: /* @__PURE__ */
|
|
1246
|
-
icon: /* @__PURE__ */
|
|
1246
|
+
children: /* @__PURE__ */ B(w, {
|
|
1247
|
+
icon: /* @__PURE__ */ B(O, {
|
|
1247
1248
|
size: x.SM,
|
|
1248
1249
|
stroke: S,
|
|
1249
1250
|
"aria-hidden": !0
|
|
@@ -1253,10 +1254,10 @@ var Xe = ({ children: e }) => {
|
|
|
1253
1254
|
onClick: n
|
|
1254
1255
|
})
|
|
1255
1256
|
})]
|
|
1256
|
-
}), /* @__PURE__ */
|
|
1257
|
+
}), /* @__PURE__ */ B("div", {
|
|
1257
1258
|
className: "w-full",
|
|
1258
1259
|
style: { height: `${t}px` },
|
|
1259
|
-
children: /* @__PURE__ */
|
|
1260
|
+
children: /* @__PURE__ */ B(Oe, {
|
|
1260
1261
|
content: e,
|
|
1261
1262
|
loadingLabel: o,
|
|
1262
1263
|
errorLabel: s,
|
|
@@ -1387,4 +1388,4 @@ var Xe = ({ children: e }) => {
|
|
|
1387
1388
|
]) };
|
|
1388
1389
|
};
|
|
1389
1390
|
//#endregion
|
|
1390
|
-
export {
|
|
1391
|
+
export { Pe as AttachmentCanvas, Me as AttachmentCanvasBody, Qe as AttachmentCanvasContainer, Xe as AttachmentCanvasProvider, i as AttachmentContentType, n as AttachmentErrorType, me as CodeContent, et as InlineGroupedVisualizer, xe as McpAppCanvasRenderer, r as OoxmlFileType, t as OoxmlHighlightKind, Ge as createForbiddenCanvasContent, We as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, a as downloadAttachmentContent, Ue as extensionToLanguage, nt as findVisualizerForApplication, tt as findVisualizerForMime, Q as getOoxmlFileType, ze as getOoxmlMimeType, rt as groupedVisualizerCanvasKey, o as isDownloadable, Ve as isHtmlPreviewable, Re as isOoxmlPreviewable, Be as isTextPreviewable, it as partitionAttachmentsForApplicationVisualizer, Ze as useAttachmentCanvas, ot as useOpenAttachmentCanvas };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-attachment-canvas",
|
|
3
3
|
"description": "Canvas viewer for rendering attachment content — images, PDFs, Office documents, CSV, JSON, markdown, and plain text",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.4",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
30
30
|
"@modelcontextprotocol/ext-apps": "1.7.5",
|
|
31
31
|
"pdfjs-dist": "^5.4.149",
|
|
32
|
-
"@epam/ai-dial-sidebar": "1.1.
|
|
32
|
+
"@epam/ai-dial-sidebar": "1.1.4"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@epam/ai-dial-chat-shared": "1.1.
|
|
35
|
+
"@epam/ai-dial-chat-shared": "1.1.4",
|
|
36
36
|
"@epam/ai-dial-ui-kit": "^0.14.2",
|
|
37
37
|
"react": "^19.2.8"
|
|
38
38
|
},
|