@epam/ai-dial-attachment-canvas 1.3.0-dev.29 → 1.3.0-dev.294
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LazyContentBoundary-tNE1ExbI.js → LazyContentBoundary-rT6s5wBc.js} +18 -14
- package/LazyContentBoundary.css +1 -0
- package/PdfContent-CyCIPzRp.js +268 -0
- package/PdfContent.css +1 -1
- package/components/AttachmentCanvas/AttachmentCanvas.d.ts.map +1 -1
- package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts.map +1 -1
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts +2 -0
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts.map +1 -1
- package/components/CodeContent/CodeContent.d.ts +4 -0
- package/components/CodeContent/CodeContent.d.ts.map +1 -1
- package/components/HtmlContent/HtmlContent.d.ts +2 -0
- package/components/HtmlContent/HtmlContent.d.ts.map +1 -1
- package/components/LazyContentBoundary/LazyContentBoundary.d.ts +5 -2
- package/components/LazyContentBoundary/LazyContentBoundary.d.ts.map +1 -1
- package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts.map +1 -1
- package/components/OoxmlContent/OoxmlContent.d.ts +2 -0
- package/components/OoxmlContent/OoxmlContent.d.ts.map +1 -1
- package/components/PdfContent/PdfContent.d.ts +2 -0
- package/components/PdfContent/PdfContent.d.ts.map +1 -1
- package/components/VisualizerCanvasRenderer/VisualizerCanvasRenderer.d.ts.map +1 -1
- package/context/AttachmentCanvasContext.d.ts +3 -1
- package/context/AttachmentCanvasContext.d.ts.map +1 -1
- package/index.css +3 -2
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +615 -581
- package/models/attachment-canvas.d.ts +24 -4
- package/models/attachment-canvas.d.ts.map +1 -1
- package/{ooxml-highlight-surfaces-BzgOKpBV.js → ooxml-highlight-surfaces-C18JJb0P.js} +6 -14
- package/package.json +12 -12
- package/utils/vite-external-matcher.d.ts +1 -1
- package/utils/vite-external-matcher.d.ts.map +1 -1
- package/PdfContent-ELaDSyFF.js +0 -266
package/index.js
CHANGED
|
@@ -1,85 +1,84 @@
|
|
|
1
1
|
import { a as e, i as t, n, r, t as i } from "./attachment-canvas-BgwyzrRC.js";
|
|
2
|
-
import { i as a, o, t as s } from "./LazyContentBoundary-
|
|
2
|
+
import { i as a, o, t as s } from "./LazyContentBoundary-rT6s5wBc.js";
|
|
3
3
|
import { AttachmentType as c, CodeBlockTheme as l, DEFAULT_MARKDOWN_CLASS_NAMES as u, FileExtension as d, MIMEType as f, MarkdownRenderer as p, buildCssVars as m, copyToClipboard as h, isSyntaxHighlightingAllowed as g, mergeClasses as _, restrainedSyntaxTheme as v, stripUrlQueryAndFragment as y } from "@epam/ai-dial-chat-shared";
|
|
4
4
|
import { SidebarOrientation as b, SidebarPanel as x } from "@epam/ai-dial-sidebar";
|
|
5
|
-
import { DIAL_ICON_SIZE as S, DIAL_KIT_ICON_STROKE as C, ElementSize as w, GhostIconButton as T, LinkButton as E,
|
|
6
|
-
import { IconAlertTriangle as
|
|
7
|
-
import { createContext as
|
|
8
|
-
import { JsonView as
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import { AppBridge as
|
|
11
|
-
import { McpUiHostContextChangedNotificationSchema as
|
|
12
|
-
import { VisualizerConnectorEvents as
|
|
13
|
-
import { VisualizerConnector as fe } from "@epam/ai-dial-visualizer-connector";
|
|
5
|
+
import { DIAL_ICON_SIZE as S, DIAL_KIT_ICON_STROKE as C, ElementSize as w, GhostIconButton as T, LinkButton as E, LiveRegion as D, Spinner as O } from "@epam/ai-dial-ui-kit";
|
|
6
|
+
import { IconAlertTriangle as k, IconArrowsMaximize as A, IconCheck as j, IconCode as M, IconCopy as ee, IconDownload as te, IconEye as N, IconLock as ne, IconMarkdown as re, IconRefresh as ie } from "@tabler/icons-react";
|
|
7
|
+
import { createContext as P, lazy as F, memo as I, useCallback as L, useContext as ae, useEffect as R, useMemo as z, useRef as B, useState as V } from "react";
|
|
8
|
+
import { JsonView as oe, defaultStyles as se } from "react-json-view-lite";
|
|
9
|
+
import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
10
|
+
import { AppBridge as ce, AppFrame as le } from "@mcp-ui/client";
|
|
11
|
+
import { McpUiHostContextChangedNotificationSchema as G } from "@modelcontextprotocol/ext-apps/app-bridge";
|
|
12
|
+
import { VisualizerConnector as ue, VisualizerConnectorEvents as de, VisualizerConnectorRequests as fe } from "@epam/ai-dial-visualizer-connector";
|
|
14
13
|
//#region src/constants/public-class-names.ts
|
|
15
|
-
var
|
|
16
|
-
container: "
|
|
17
|
-
containerLight: "
|
|
18
|
-
},
|
|
14
|
+
var K = { panel: "dial-attachment-canvas-panel" }, q = {
|
|
15
|
+
container: "_container_k7ib4_1",
|
|
16
|
+
containerLight: "_containerLight_k7ib4_5"
|
|
17
|
+
}, pe = {
|
|
19
18
|
[l.Dark]: v,
|
|
20
19
|
[l.Light]: v
|
|
21
|
-
}, me = () =>
|
|
20
|
+
}, me = () => F(async () => {
|
|
22
21
|
let { Prism: e } = await import("react-syntax-highlighter");
|
|
23
22
|
return { default: e };
|
|
24
|
-
}), he =
|
|
25
|
-
let { text:
|
|
26
|
-
|
|
27
|
-
}, []),
|
|
28
|
-
className: "
|
|
29
|
-
children:
|
|
23
|
+
}), he = I(({ content: e, codeBlockTheme: t = l.Light, labels: n, codeClassName: r = "dial-code-text", errorLabelClassName: i }) => {
|
|
24
|
+
let { text: a, language: o } = e, c = z(() => g(a), [a]), u = o == null || o === "plaintext" || !c, d = pe[t], f = t === l.Light, [p, m] = V(0), h = z(me, [p]), v = L(() => {
|
|
25
|
+
m((e) => e + 1);
|
|
26
|
+
}, []), y = /* @__PURE__ */ U("pre", {
|
|
27
|
+
className: _(r, "p-4 wrap-break-word whitespace-pre-wrap"),
|
|
28
|
+
children: a
|
|
30
29
|
});
|
|
31
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ U("div", {
|
|
32
31
|
dir: "ltr",
|
|
33
|
-
className: _("h-full overflow-auto",
|
|
34
|
-
children:
|
|
35
|
-
retryKey:
|
|
36
|
-
onRetry:
|
|
37
|
-
pendingContent:
|
|
38
|
-
errorContent:
|
|
32
|
+
className: _("h-full overflow-auto", q.container, f && q.containerLight),
|
|
33
|
+
children: u ? y : /* @__PURE__ */ U(s, {
|
|
34
|
+
retryKey: p,
|
|
35
|
+
onRetry: v,
|
|
36
|
+
pendingContent: y,
|
|
37
|
+
errorContent: y,
|
|
39
38
|
labels: n,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
errorLabelClassName: i,
|
|
40
|
+
children: /* @__PURE__ */ U(h, {
|
|
41
|
+
language: o,
|
|
42
|
+
style: d,
|
|
43
43
|
customStyle: {
|
|
44
44
|
margin: 0,
|
|
45
45
|
borderRadius: 0,
|
|
46
46
|
background: "transparent",
|
|
47
|
-
|
|
48
|
-
lineHeight: 1.5,
|
|
49
|
-
padding: "16px",
|
|
50
|
-
letterSpacing: 0
|
|
47
|
+
padding: "16px"
|
|
51
48
|
},
|
|
49
|
+
className: r,
|
|
50
|
+
codeTagProps: { className: r },
|
|
52
51
|
wrapLongLines: !0,
|
|
53
|
-
children:
|
|
52
|
+
children: a
|
|
54
53
|
})
|
|
55
54
|
})
|
|
56
55
|
});
|
|
57
|
-
}), ge = "dial-html-preview:render", _e = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ve =
|
|
58
|
-
let { htmlFrameBlockedLabel:
|
|
56
|
+
}), ge = "dial-html-preview:render", _e = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ve = I(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text", codeClassName: s }) => {
|
|
57
|
+
let { htmlFrameBlockedLabel: c = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: l = "Open in new tab" } = t, [u, d] = V(!0), [f, p] = V(!1), [m, h] = V(void 0), [g, v] = V(!1), [y, b] = V(!1), x = B(null), S = B(null), C = B(!1), w = B({
|
|
59
58
|
content: e,
|
|
60
59
|
generation: 0
|
|
61
60
|
});
|
|
62
|
-
|
|
61
|
+
w.current.content !== e && (w.current = {
|
|
63
62
|
content: e,
|
|
64
|
-
generation:
|
|
63
|
+
generation: w.current.generation + 1
|
|
65
64
|
});
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
let T = w.current.generation;
|
|
66
|
+
R(() => {
|
|
67
|
+
d(!0), p(!1), h(void 0), v(!1), b(!1);
|
|
69
68
|
}, [e]);
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
if (!n || e.srcdoc != null || e.resolveSourceText == null ||
|
|
69
|
+
let D = B(n);
|
|
70
|
+
D.current !== n && (D.current = n, n && y && b(!1), !n && C.current && (C.current = !1, d(!0))), R(() => {
|
|
71
|
+
if (!n || e.srcdoc != null || e.resolveSourceText == null || m != null) return;
|
|
73
72
|
let t = !1, r = e.resolveSourceText;
|
|
74
73
|
return (async () => {
|
|
75
|
-
|
|
74
|
+
v(!0);
|
|
76
75
|
try {
|
|
77
76
|
let e = await r();
|
|
78
|
-
t ||
|
|
77
|
+
t || h(e);
|
|
79
78
|
} catch {
|
|
80
|
-
t ||
|
|
79
|
+
t || b(!0);
|
|
81
80
|
} finally {
|
|
82
|
-
t ||
|
|
81
|
+
t || v(!1);
|
|
83
82
|
}
|
|
84
83
|
})(), () => {
|
|
85
84
|
t = !0;
|
|
@@ -87,70 +86,69 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
87
86
|
}, [
|
|
88
87
|
n,
|
|
89
88
|
e,
|
|
90
|
-
|
|
89
|
+
m
|
|
91
90
|
]);
|
|
92
|
-
let
|
|
93
|
-
if (
|
|
94
|
-
let e =
|
|
95
|
-
e != null && e !==
|
|
91
|
+
let k = e.isSameOriginUrl === !0 && e.url != null, A = !k && e.srcdoc != null, j = A ? e.srcdocHostUrl : void 0, M = e.srcdoc, ee = L((e) => {
|
|
92
|
+
if (d(!1), j != null) {
|
|
93
|
+
let e = x.current?.contentWindow;
|
|
94
|
+
e != null && e !== S.current && M != null && (S.current = e, e.postMessage({
|
|
96
95
|
type: ge,
|
|
97
|
-
html:
|
|
96
|
+
html: M
|
|
98
97
|
}, "*"));
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (!(k || O)) try {
|
|
102
|
-
b.current?.contentDocument ?? f(!0);
|
|
98
|
+
} else if (!(A || k)) try {
|
|
99
|
+
x.current?.contentDocument ?? p(!0);
|
|
103
100
|
} catch {
|
|
104
|
-
|
|
101
|
+
p(!0);
|
|
105
102
|
}
|
|
106
103
|
}, [
|
|
107
|
-
k,
|
|
108
|
-
O,
|
|
109
104
|
A,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
105
|
+
k,
|
|
106
|
+
j,
|
|
107
|
+
M
|
|
108
|
+
]), te = L(() => {
|
|
109
|
+
d(!1), p(!0);
|
|
110
|
+
}, []), N = e.srcdoc ?? m, ne = e.srcdoc != null || e.resolveSourceText != null, re = e.srcdoc == null && e.resolveSourceText != null && m == null && !y;
|
|
111
|
+
if (n && ne && (N != null || g || re)) return C.current = !0, N == null ? /* @__PURE__ */ U("div", {
|
|
115
112
|
className: "flex h-full items-center justify-center",
|
|
116
|
-
children: /* @__PURE__ */
|
|
117
|
-
}) : /* @__PURE__ */
|
|
113
|
+
children: /* @__PURE__ */ U(O, {})
|
|
114
|
+
}) : /* @__PURE__ */ U(he, {
|
|
118
115
|
content: {
|
|
119
116
|
type: i.Code,
|
|
120
|
-
text:
|
|
117
|
+
text: N,
|
|
121
118
|
language: "html"
|
|
122
119
|
},
|
|
123
|
-
codeBlockTheme: a
|
|
120
|
+
codeBlockTheme: a,
|
|
121
|
+
codeClassName: s
|
|
124
122
|
});
|
|
125
|
-
if (
|
|
123
|
+
if (f) return /* @__PURE__ */ W("div", {
|
|
126
124
|
className: "flex h-full flex-col items-center justify-center gap-3 p-4",
|
|
127
|
-
children: [/* @__PURE__ */
|
|
125
|
+
children: [/* @__PURE__ */ U("p", {
|
|
128
126
|
className: "text-center",
|
|
129
|
-
children:
|
|
130
|
-
}), e.url != null && /* @__PURE__ */
|
|
127
|
+
children: c
|
|
128
|
+
}), e.url != null && /* @__PURE__ */ U(E, {
|
|
131
129
|
href: e.url,
|
|
132
130
|
target: "_blank",
|
|
133
|
-
label:
|
|
131
|
+
label: l,
|
|
134
132
|
className: _e.openInNewTabButton,
|
|
135
133
|
textClassName: o
|
|
136
134
|
})]
|
|
137
135
|
});
|
|
138
|
-
let
|
|
139
|
-
return /* @__PURE__ */
|
|
136
|
+
let ie = A ? j : e.url, P = A && j == null ? e.srcdoc : void 0;
|
|
137
|
+
return /* @__PURE__ */ W("div", {
|
|
140
138
|
className: "relative h-full",
|
|
141
|
-
children: [
|
|
139
|
+
children: [u && /* @__PURE__ */ U("div", {
|
|
142
140
|
className: "absolute inset-0 flex items-center justify-center",
|
|
143
|
-
children: /* @__PURE__ */
|
|
144
|
-
}), /* @__PURE__ */
|
|
145
|
-
ref:
|
|
141
|
+
children: /* @__PURE__ */ U(O, {})
|
|
142
|
+
}), /* @__PURE__ */ U("iframe", {
|
|
143
|
+
ref: x,
|
|
146
144
|
title: r,
|
|
147
|
-
src:
|
|
148
|
-
srcDoc:
|
|
149
|
-
sandbox:
|
|
150
|
-
className: _("h-full w-full border-none",
|
|
151
|
-
onLoad:
|
|
152
|
-
onError:
|
|
153
|
-
},
|
|
145
|
+
src: ie,
|
|
146
|
+
srcDoc: P,
|
|
147
|
+
sandbox: A || k ? "allow-scripts" : "allow-scripts allow-same-origin",
|
|
148
|
+
className: _("h-full w-full border-none", u ? "invisible" : ""),
|
|
149
|
+
onLoad: ee,
|
|
150
|
+
onError: te
|
|
151
|
+
}, T)]
|
|
154
152
|
});
|
|
155
153
|
}), ye = {
|
|
156
154
|
name: "MCP-UI Host",
|
|
@@ -177,12 +175,12 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
177
175
|
let r = t;
|
|
178
176
|
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`));
|
|
179
177
|
}, Ce = (e, t, n) => {
|
|
180
|
-
let r =
|
|
181
|
-
|
|
178
|
+
let r = B(e);
|
|
179
|
+
R(() => {
|
|
182
180
|
r.current = e;
|
|
183
181
|
});
|
|
184
|
-
let [i, a] =
|
|
185
|
-
return
|
|
182
|
+
let [i, a] = V(null), [o, s] = V(!1);
|
|
183
|
+
return R(() => {
|
|
186
184
|
let e = null;
|
|
187
185
|
try {
|
|
188
186
|
let n = t.current?.getBoundingClientRect(), i = n != null && n.width > 0 && n.height > 0 ? {
|
|
@@ -192,13 +190,13 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
192
190
|
height: Math.round(n.height)
|
|
193
191
|
}
|
|
194
192
|
} : r.current.hostContext;
|
|
195
|
-
e = new
|
|
193
|
+
e = new ce(null, r.current.hostInfo ?? ye, be, { hostContext: i }), e.onopenlink = async ({ url: e }) => {
|
|
196
194
|
let t = r.current.onOpenLink;
|
|
197
195
|
return (t == null ? xe(e) : t(e)) === !1 ? { isError: !0 } : {};
|
|
198
196
|
}, e.onrequestdisplaymode = async ({ mode: e }) => {
|
|
199
197
|
let t = r.current.onRequestDisplayMode, n = r.current.hostContext?.displayMode ?? "inline";
|
|
200
198
|
return { mode: t?.(e) ?? n };
|
|
201
|
-
}, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(
|
|
199
|
+
}, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(G, ({ params: e }) => {
|
|
202
200
|
let n = t.current?.querySelector("iframe");
|
|
203
201
|
n != null && Se(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
|
|
204
202
|
}), a(e);
|
|
@@ -208,22 +206,22 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
208
206
|
return () => {
|
|
209
207
|
e?.close().catch((e) => console.error("[useMcpAppBridge] Error closing AppBridge:", e));
|
|
210
208
|
};
|
|
211
|
-
}, [t]),
|
|
209
|
+
}, [t]), R(() => {
|
|
212
210
|
i != null && i.transport != null && n != null && i.setHostContext(n);
|
|
213
211
|
}, [i, n]), {
|
|
214
212
|
appBridge: i,
|
|
215
213
|
hasFailed: o
|
|
216
214
|
};
|
|
217
|
-
},
|
|
218
|
-
loadingOverlay: "
|
|
219
|
-
fullscreenFrame: "
|
|
220
|
-
loadingFrame: "
|
|
221
|
-
statusLabel: "
|
|
222
|
-
statusDetail: "
|
|
223
|
-
errorIcon: "
|
|
215
|
+
}, J = {
|
|
216
|
+
loadingOverlay: "_loadingOverlay_1kink_2",
|
|
217
|
+
fullscreenFrame: "_fullscreenFrame_1kink_21",
|
|
218
|
+
loadingFrame: "_loadingFrame_1kink_29",
|
|
219
|
+
statusLabel: "_statusLabel_1kink_33",
|
|
220
|
+
statusDetail: "_statusDetail_1kink_38",
|
|
221
|
+
errorIcon: "_errorIcon_1kink_42"
|
|
224
222
|
}, we = ({ content: e, errorLabel: t = "Failed to load app", onAppInfo: n }) => {
|
|
225
|
-
let [r, i] =
|
|
226
|
-
|
|
223
|
+
let [r, i] = V("loading"), [a, o] = V(), { html: s, sandboxUrl: c, toolInput: l, toolResult: u, hostContext: d } = e, f = z(() => ({ url: new URL(c) }), [c]), p = d?.displayMode === "fullscreen", m = B(null), [h, g] = V();
|
|
224
|
+
R(() => {
|
|
227
225
|
let e = m.current;
|
|
228
226
|
if (!e) return;
|
|
229
227
|
let t = new ResizeObserver(([e]) => {
|
|
@@ -236,15 +234,15 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
236
234
|
});
|
|
237
235
|
return t.observe(e), () => t.disconnect();
|
|
238
236
|
}, []);
|
|
239
|
-
let { appBridge: v, hasFailed: y } = Ce(e, m,
|
|
237
|
+
let { appBridge: v, hasFailed: y } = Ce(e, m, z(() => d == null || h == null ? d : {
|
|
240
238
|
...d,
|
|
241
239
|
containerDimensions: h
|
|
242
240
|
}, [d, h])), b = y || r === "error";
|
|
243
|
-
return /* @__PURE__ */
|
|
241
|
+
return /* @__PURE__ */ W("div", {
|
|
244
242
|
ref: m,
|
|
245
|
-
className: _("relative h-full min-h-[
|
|
243
|
+
className: _("relative h-full w-full", b ? "min-h-[160px]" : "min-h-[100px]", p && J.fullscreenFrame, !p && r === "loading" && J.loadingFrame),
|
|
246
244
|
children: [
|
|
247
|
-
v != null && !b && /* @__PURE__ */
|
|
245
|
+
v != null && !b && /* @__PURE__ */ U(le, {
|
|
248
246
|
html: s,
|
|
249
247
|
sandbox: f,
|
|
250
248
|
appBridge: v,
|
|
@@ -258,43 +256,43 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
258
256
|
o(e.message), i("error");
|
|
259
257
|
}
|
|
260
258
|
}),
|
|
261
|
-
!b && r === "loading" && /* @__PURE__ */
|
|
262
|
-
className: _("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
263
|
-
children: /* @__PURE__ */
|
|
259
|
+
!b && r === "loading" && /* @__PURE__ */ U("div", {
|
|
260
|
+
className: _("absolute inset-0 flex flex-col items-center justify-center gap-2", J.loadingOverlay),
|
|
261
|
+
children: /* @__PURE__ */ U(O, {})
|
|
264
262
|
}),
|
|
265
|
-
b && /* @__PURE__ */
|
|
263
|
+
b && /* @__PURE__ */ W("div", {
|
|
266
264
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2 p-4",
|
|
267
|
-
children: [/* @__PURE__ */
|
|
265
|
+
children: [/* @__PURE__ */ U(k, {
|
|
268
266
|
size: 60,
|
|
269
267
|
stroke: C,
|
|
270
268
|
"aria-hidden": !0,
|
|
271
|
-
className:
|
|
272
|
-
}), /* @__PURE__ */
|
|
273
|
-
role: "
|
|
274
|
-
className: _("text-center",
|
|
275
|
-
children: [t, a && /* @__PURE__ */
|
|
276
|
-
className:
|
|
269
|
+
className: J.errorIcon
|
|
270
|
+
}), /* @__PURE__ */ W("p", {
|
|
271
|
+
role: "status",
|
|
272
|
+
className: _("text-center", J.statusLabel),
|
|
273
|
+
children: [t, a && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("br", {}), /* @__PURE__ */ U("span", {
|
|
274
|
+
className: J.statusDetail,
|
|
277
275
|
children: a
|
|
278
276
|
})] })]
|
|
279
277
|
})]
|
|
280
278
|
})
|
|
281
279
|
]
|
|
282
280
|
});
|
|
283
|
-
},
|
|
284
|
-
viewer: "
|
|
285
|
-
spreadsheetCanvas: "
|
|
286
|
-
formulaPanel: "
|
|
287
|
-
formulaValue: "
|
|
288
|
-
statusOverlay: "
|
|
289
|
-
errorIcon: "
|
|
290
|
-
highlight: "
|
|
291
|
-
},
|
|
281
|
+
}, Y = {
|
|
282
|
+
viewer: "_viewer_gdafg_2",
|
|
283
|
+
spreadsheetCanvas: "_spreadsheetCanvas_gdafg_6",
|
|
284
|
+
formulaPanel: "_formulaPanel_gdafg_12",
|
|
285
|
+
formulaValue: "_formulaValue_gdafg_18",
|
|
286
|
+
statusOverlay: "_statusOverlay_gdafg_27",
|
|
287
|
+
errorIcon: "_errorIcon_gdafg_32",
|
|
288
|
+
highlight: "_highlight_gdafg_40"
|
|
289
|
+
}, Te = (e) => {
|
|
292
290
|
if (e?.kind !== "range") return "";
|
|
293
291
|
let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
|
|
294
292
|
if (n == null) return "";
|
|
295
293
|
let r = n.formula;
|
|
296
294
|
return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
|
|
297
|
-
},
|
|
295
|
+
}, Ee = async (e, t, { onError: n, onXlsxSelectionContextChange: i }) => {
|
|
298
296
|
switch (t) {
|
|
299
297
|
case r.Docx: {
|
|
300
298
|
let [{ DocxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("@silurus/ooxml/docx"), import("@silurus/ooxml/chart-ex")]);
|
|
@@ -316,7 +314,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
316
314
|
}
|
|
317
315
|
case r.Csv: {
|
|
318
316
|
let { XlsxSheetViewer: t } = await import("@silurus/ooxml/xlsx"), r = document.createElement("canvas");
|
|
319
|
-
r.className =
|
|
317
|
+
r.className = Y.spreadsheetCanvas, e.replaceChildren(r);
|
|
320
318
|
let i = new t(r, {
|
|
321
319
|
showScrollbars: !0,
|
|
322
320
|
onError: n
|
|
@@ -340,16 +338,16 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
340
338
|
});
|
|
341
339
|
}
|
|
342
340
|
}
|
|
343
|
-
},
|
|
341
|
+
}, De = async (e, t, n, i) => {
|
|
344
342
|
let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = n;
|
|
345
343
|
switch (t.format) {
|
|
346
344
|
case r.Docx: {
|
|
347
345
|
let [{ DocxDocument: n, DocxScrollViewer: r }, { chartEx: o }, { createDocxHighlightSurface: c }] = await Promise.all([
|
|
348
346
|
import("@silurus/ooxml/docx"),
|
|
349
347
|
import("@silurus/ooxml/chart-ex"),
|
|
350
|
-
import("./ooxml-highlight-surfaces-
|
|
348
|
+
import("./ooxml-highlight-surfaces-C18JJb0P.js")
|
|
351
349
|
]), l = await n.load(t.url, { chartEx: o });
|
|
352
|
-
if (i()) throw l.destroy(), new
|
|
350
|
+
if (i()) throw l.destroy(), new Oe();
|
|
353
351
|
let u = r.fromDocument(e, l, {
|
|
354
352
|
enableTextSelection: !0,
|
|
355
353
|
refitOnResize: !0,
|
|
@@ -367,9 +365,9 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
367
365
|
let [{ PptxPresentation: n, PptxScrollViewer: r }, { chartEx: o }, { createPptxHighlightSurface: c }] = await Promise.all([
|
|
368
366
|
import("@silurus/ooxml/pptx"),
|
|
369
367
|
import("@silurus/ooxml/chart-ex"),
|
|
370
|
-
import("./ooxml-highlight-surfaces-
|
|
368
|
+
import("./ooxml-highlight-surfaces-C18JJb0P.js")
|
|
371
369
|
]), l = await n.load(t.url, { chartEx: o });
|
|
372
|
-
if (i()) throw l.destroy(), new
|
|
370
|
+
if (i()) throw l.destroy(), new Oe();
|
|
373
371
|
let u = r.fromPresentation(e, l, {
|
|
374
372
|
enableTextSelection: !0,
|
|
375
373
|
refitOnResize: !0,
|
|
@@ -387,7 +385,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
387
385
|
let [{ XlsxViewer: n }, { chartEx: r }, { createXlsxHighlightSurface: c }] = await Promise.all([
|
|
388
386
|
import("@silurus/ooxml/xlsx"),
|
|
389
387
|
import("@silurus/ooxml/chart-ex"),
|
|
390
|
-
import("./ooxml-highlight-surfaces-
|
|
388
|
+
import("./ooxml-highlight-surfaces-C18JJb0P.js")
|
|
391
389
|
]), l = new n(e, {
|
|
392
390
|
showZoomSlider: !0,
|
|
393
391
|
chartEx: r,
|
|
@@ -403,82 +401,82 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
403
401
|
};
|
|
404
402
|
}
|
|
405
403
|
case r.Csv: {
|
|
406
|
-
let r = await
|
|
404
|
+
let r = await Ee(e, t.format, n);
|
|
407
405
|
return await r.load(t.url), { viewer: r };
|
|
408
406
|
}
|
|
409
407
|
}
|
|
410
|
-
},
|
|
411
|
-
let
|
|
412
|
-
|
|
413
|
-
let
|
|
414
|
-
return
|
|
415
|
-
let e =
|
|
408
|
+
}, Oe = class extends Error {}, ke = ({ content: t, fileName: n, loadErrorLabel: i, formulaLabel: a, formulaLabelClassName: o, formulaValueClassName: s, highlightsLabel: c = "Cited locations", highlightNavigatedLabel: l = "Scrolled to the cited location" }) => {
|
|
409
|
+
let u = B(null), [d, f] = V(!0), [p, m] = V(!1), [h, g] = V(""), [v, y] = V([]), [b, x] = V(!1), { highlights: S, selectedHighlightId: w } = t, T = S != null && S.length > 0, E = B(void 0), A = B(S);
|
|
410
|
+
A.current = S;
|
|
411
|
+
let j = B(void 0);
|
|
412
|
+
return R(() => {
|
|
413
|
+
let e = u.current;
|
|
416
414
|
if (e == null) return;
|
|
417
415
|
let n, r, i = !1, a, o = () => i;
|
|
418
|
-
|
|
416
|
+
f(!0), m(!1), g(""), y([]), x(!1);
|
|
419
417
|
let s = () => {
|
|
420
418
|
i || a != null || (a = requestAnimationFrame(() => {
|
|
421
419
|
a = void 0, c();
|
|
422
420
|
}));
|
|
423
421
|
}, c = async () => {
|
|
424
|
-
let e = n?.highlights, t =
|
|
422
|
+
let e = n?.highlights, t = A.current;
|
|
425
423
|
if (!(i || e == null || t == null)) try {
|
|
426
424
|
let n = await e.measure(t);
|
|
427
|
-
i ||
|
|
425
|
+
i || y(n);
|
|
428
426
|
} catch {
|
|
429
|
-
i ||
|
|
427
|
+
i || y([]);
|
|
430
428
|
}
|
|
431
|
-
},
|
|
429
|
+
}, l = {
|
|
432
430
|
onError: () => {
|
|
433
|
-
i || (
|
|
431
|
+
i || (f(!1), m(!0));
|
|
434
432
|
},
|
|
435
433
|
onXlsxSelectionContextChange: (e) => {
|
|
436
|
-
i ||
|
|
434
|
+
i || g(Te(e));
|
|
437
435
|
},
|
|
438
436
|
onGeometryInvalidated: s
|
|
439
|
-
},
|
|
437
|
+
}, d = () => {
|
|
440
438
|
i || (r = new ResizeObserver(() => {
|
|
441
439
|
n?.viewer.resize?.(), s();
|
|
442
440
|
}), r.observe(e));
|
|
443
441
|
};
|
|
444
|
-
return e.addEventListener("scroll", s, !0),
|
|
442
|
+
return e.addEventListener("scroll", s, !0), j.current = s, (async () => {
|
|
445
443
|
try {
|
|
446
|
-
if (
|
|
447
|
-
let r = await
|
|
444
|
+
if (T) {
|
|
445
|
+
let r = await De(e, t, l, o);
|
|
448
446
|
if (i) {
|
|
449
447
|
r.viewer.destroy(), r.engine?.destroy();
|
|
450
448
|
return;
|
|
451
449
|
}
|
|
452
|
-
n = r,
|
|
450
|
+
n = r, E.current = r.highlights, d();
|
|
453
451
|
} else {
|
|
454
|
-
let r = await
|
|
452
|
+
let r = await Ee(e, t.format, l);
|
|
455
453
|
if (i) {
|
|
456
454
|
r.destroy();
|
|
457
455
|
return;
|
|
458
456
|
}
|
|
459
|
-
if (n = { viewer: r },
|
|
460
|
-
|
|
457
|
+
if (n = { viewer: r }, E.current = void 0, await r.load(t.url), i) return;
|
|
458
|
+
d();
|
|
461
459
|
}
|
|
462
460
|
if (i) return;
|
|
463
|
-
|
|
461
|
+
f(!1), await c();
|
|
464
462
|
} catch (t) {
|
|
465
|
-
if (t instanceof
|
|
466
|
-
n?.viewer.destroy(), n?.engine?.destroy(), n = void 0,
|
|
463
|
+
if (t instanceof Oe || i) return;
|
|
464
|
+
n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, E.current = void 0, e.replaceChildren(), f(!1), m(!0);
|
|
467
465
|
}
|
|
468
466
|
})(), () => {
|
|
469
|
-
i = !0, e.removeEventListener("scroll", s, !0), a != null && cancelAnimationFrame(a),
|
|
467
|
+
i = !0, e.removeEventListener("scroll", s, !0), a != null && cancelAnimationFrame(a), j.current = void 0, r?.disconnect(), n?.viewer.destroy(), n?.engine?.destroy(), E.current = void 0, e.replaceChildren();
|
|
470
468
|
};
|
|
471
469
|
}, [
|
|
472
470
|
t.format,
|
|
473
471
|
t.url,
|
|
474
|
-
|
|
475
|
-
]),
|
|
476
|
-
|
|
477
|
-
}, [
|
|
478
|
-
|
|
479
|
-
let t =
|
|
480
|
-
if (t == null ||
|
|
481
|
-
let n = (
|
|
472
|
+
T
|
|
473
|
+
]), R(() => {
|
|
474
|
+
j.current?.();
|
|
475
|
+
}, [S]), R(() => {
|
|
476
|
+
x(!1);
|
|
477
|
+
let t = E.current;
|
|
478
|
+
if (t == null || d) return;
|
|
479
|
+
let n = (A.current?.find(({ id: e }) => e === w))?.locations.at(0);
|
|
482
480
|
if (n == null) return;
|
|
483
481
|
let r = !1;
|
|
484
482
|
return (async () => {
|
|
@@ -488,42 +486,42 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
488
486
|
} catch {
|
|
489
487
|
return;
|
|
490
488
|
}
|
|
491
|
-
r || i !== e.Navigated ||
|
|
489
|
+
r || i !== e.Navigated || x(!0);
|
|
492
490
|
})(), () => {
|
|
493
491
|
r = !0;
|
|
494
492
|
};
|
|
495
|
-
}, [
|
|
493
|
+
}, [w, d]), /* @__PURE__ */ W("div", {
|
|
496
494
|
className: "relative flex h-full w-full min-w-0 flex-col overflow-hidden",
|
|
497
495
|
children: [
|
|
498
|
-
t.format === r.Xlsx && /* @__PURE__ */
|
|
496
|
+
t.format === r.Xlsx && /* @__PURE__ */ W("div", {
|
|
499
497
|
role: "region",
|
|
500
498
|
"aria-label": a,
|
|
501
|
-
className: _("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2",
|
|
502
|
-
children: [/* @__PURE__ */
|
|
499
|
+
className: _("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", Y.formulaPanel),
|
|
500
|
+
children: [/* @__PURE__ */ U("span", {
|
|
503
501
|
"aria-hidden": "true",
|
|
504
502
|
className: _("shrink-0", o),
|
|
505
503
|
children: "fx"
|
|
506
|
-
}), /* @__PURE__ */
|
|
504
|
+
}), /* @__PURE__ */ U("code", {
|
|
507
505
|
dir: "ltr",
|
|
508
506
|
tabIndex: 0,
|
|
509
507
|
"aria-live": "polite",
|
|
510
|
-
className: _("h-8 min-w-0 flex-1 overflow-x-auto
|
|
511
|
-
children:
|
|
508
|
+
className: _("h-8 min-w-0 flex-1 overflow-x-auto rounded border px-2 py-1 whitespace-nowrap focus-visible:outline", Y.formulaValue, s),
|
|
509
|
+
children: h
|
|
512
510
|
})]
|
|
513
511
|
}),
|
|
514
|
-
/* @__PURE__ */
|
|
512
|
+
/* @__PURE__ */ W("div", {
|
|
515
513
|
className: "relative min-h-0 w-full flex-1",
|
|
516
|
-
children: [/* @__PURE__ */
|
|
517
|
-
ref:
|
|
514
|
+
children: [/* @__PURE__ */ U("div", {
|
|
515
|
+
ref: u,
|
|
518
516
|
role: "document",
|
|
519
517
|
"aria-label": n,
|
|
520
|
-
"aria-busy":
|
|
521
|
-
className: _("h-full w-full overflow-hidden",
|
|
522
|
-
}),
|
|
518
|
+
"aria-busy": d,
|
|
519
|
+
className: _("h-full w-full overflow-hidden", Y.viewer)
|
|
520
|
+
}), v.length > 0 && /* @__PURE__ */ U("div", {
|
|
523
521
|
role: "region",
|
|
524
|
-
"aria-label":
|
|
522
|
+
"aria-label": c,
|
|
525
523
|
className: "pointer-events-none absolute inset-0 overflow-hidden",
|
|
526
|
-
children:
|
|
524
|
+
children: v.map((e, t) => /* @__PURE__ */ U("div", {
|
|
527
525
|
"aria-hidden": "true",
|
|
528
526
|
style: {
|
|
529
527
|
left: `${e.left}px`,
|
|
@@ -531,30 +529,28 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
531
529
|
width: `${e.width}px`,
|
|
532
530
|
height: `${e.height}px`
|
|
533
531
|
},
|
|
534
|
-
"data-selected": e.highlightId ===
|
|
532
|
+
"data-selected": e.highlightId === w,
|
|
535
533
|
"data-clipped": e.isClippedAtEnd === !0,
|
|
536
|
-
className: _("absolute",
|
|
534
|
+
className: _("absolute", Y.highlight)
|
|
537
535
|
}, `${e.highlightId}-${t}`))
|
|
538
536
|
})]
|
|
539
537
|
}),
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
className: "sr-only",
|
|
544
|
-
children: y ? c : ""
|
|
538
|
+
/* @__PURE__ */ U(D, {
|
|
539
|
+
visuallyHidden: !0,
|
|
540
|
+
children: b ? l : ""
|
|
545
541
|
}),
|
|
546
|
-
(
|
|
547
|
-
role:
|
|
542
|
+
(d || p) && /* @__PURE__ */ U("div", {
|
|
543
|
+
role: p ? "alert" : void 0,
|
|
548
544
|
"aria-live": "polite",
|
|
549
|
-
className: _("absolute inset-0 flex items-center justify-center",
|
|
550
|
-
children:
|
|
545
|
+
className: _("absolute inset-0 flex items-center justify-center", Y.statusOverlay),
|
|
546
|
+
children: d ? /* @__PURE__ */ U(O, { size: 48 }) : /* @__PURE__ */ W("div", {
|
|
551
547
|
className: "flex flex-col items-center gap-2",
|
|
552
|
-
children: [/* @__PURE__ */
|
|
548
|
+
children: [/* @__PURE__ */ U(k, {
|
|
553
549
|
"aria-hidden": "true",
|
|
554
550
|
size: 60,
|
|
555
551
|
stroke: C,
|
|
556
|
-
className:
|
|
557
|
-
}), /* @__PURE__ */
|
|
552
|
+
className: Y.errorIcon
|
|
553
|
+
}), /* @__PURE__ */ U("p", {
|
|
558
554
|
className: "text-center",
|
|
559
555
|
children: i
|
|
560
556
|
})]
|
|
@@ -562,52 +558,47 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
562
558
|
})
|
|
563
559
|
]
|
|
564
560
|
});
|
|
565
|
-
},
|
|
561
|
+
}, Ae = (e, t) => {
|
|
566
562
|
let n = e.toLowerCase();
|
|
567
563
|
return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
|
|
568
|
-
},
|
|
569
|
-
if (
|
|
570
|
-
},
|
|
564
|
+
}, je = (e, t) => {
|
|
565
|
+
if (e != null && e !== "") return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
|
|
566
|
+
}, Me = (e) => `${e}:grouped-visualizer`, Ne = (e, t) => {
|
|
571
567
|
let n = (t.contentType ?? "").split(",").map((e) => e.trim().toLowerCase()).filter((e) => e !== ""), r = [], i = [];
|
|
572
568
|
return e.forEach((e) => {
|
|
573
|
-
|
|
574
|
-
r.push(e);
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
i.push(e);
|
|
569
|
+
e.url != null && e.url !== "" && (n.length === 0 || n.includes(e.contentType.toLowerCase())) ? r.push(e) : i.push(e);
|
|
578
570
|
}), {
|
|
579
571
|
claimed: r,
|
|
580
572
|
unclaimed: i
|
|
581
573
|
};
|
|
582
|
-
},
|
|
574
|
+
}, Pe = (e) => {
|
|
583
575
|
if (typeof e != "object" || !e || !Object.prototype.hasOwnProperty.call(e, "message")) return;
|
|
584
576
|
let { message: t } = e;
|
|
585
577
|
return typeof t == "string" && t.trim() !== "" ? t : void 0;
|
|
586
|
-
},
|
|
578
|
+
}, Fe = {
|
|
587
579
|
loadingOverlay: "_loadingOverlay_12637_1",
|
|
588
580
|
statusLabel: "_statusLabel_12637_5",
|
|
589
581
|
errorIcon: "_errorIcon_12637_9"
|
|
590
|
-
},
|
|
591
|
-
let s =
|
|
582
|
+
}, Ie = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", frameTitle: r, colors: a, onSendMessage: o }) => {
|
|
583
|
+
let s = B(null), [c, l] = V("loading"), { url: u, visualizerName: d, requestTimeout: f } = e, p = B(e);
|
|
592
584
|
p.current = e;
|
|
593
|
-
let h =
|
|
594
|
-
return h.current = o,
|
|
585
|
+
let h = B(o);
|
|
586
|
+
return h.current = o, R(() => {
|
|
595
587
|
let e = s.current;
|
|
596
588
|
if (!e) return;
|
|
597
589
|
l("loading");
|
|
598
|
-
let t = new
|
|
590
|
+
let t = new ue(e, {
|
|
599
591
|
domain: u,
|
|
600
|
-
hostDomain: window.location.origin,
|
|
601
592
|
visualizerName: d,
|
|
602
593
|
requestTimeout: f
|
|
603
|
-
}), n = !0, r = t.subscribe(`${d}/${
|
|
604
|
-
let t =
|
|
594
|
+
}), n = !0, r = t.subscribe(`${d}/${de.SendMessage}`, (e) => {
|
|
595
|
+
let t = Pe(e);
|
|
605
596
|
t != null && h.current?.(t);
|
|
606
597
|
});
|
|
607
598
|
return (async () => {
|
|
608
599
|
if (await t.ready(), !n) return;
|
|
609
600
|
let e = p.current;
|
|
610
|
-
if (e.type === i.GroupedVisualizer) await t.send(
|
|
601
|
+
if (e.type === i.GroupedVisualizer) await t.send(fe.SendGroupedVisualizeData, {
|
|
611
602
|
attachments: e.attachments,
|
|
612
603
|
layout: e.layout
|
|
613
604
|
});
|
|
@@ -616,7 +607,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
616
607
|
layout: r,
|
|
617
608
|
...typeof i == "object" && i ? i : {}
|
|
618
609
|
};
|
|
619
|
-
await t.send(
|
|
610
|
+
await t.send(fe.SendVisualizeData, {
|
|
620
611
|
mimeType: n,
|
|
621
612
|
visualizerData: a
|
|
622
613
|
});
|
|
@@ -631,7 +622,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
631
622
|
u,
|
|
632
623
|
d,
|
|
633
624
|
f
|
|
634
|
-
]),
|
|
625
|
+
]), R(() => {
|
|
635
626
|
let e = r ?? d.trim();
|
|
636
627
|
e !== "" && s.current?.querySelector("iframe")?.setAttribute("title", e);
|
|
637
628
|
}, [
|
|
@@ -639,7 +630,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
639
630
|
d,
|
|
640
631
|
u,
|
|
641
632
|
f
|
|
642
|
-
]), /* @__PURE__ */
|
|
633
|
+
]), /* @__PURE__ */ W("div", {
|
|
643
634
|
className: "relative h-full w-full",
|
|
644
635
|
style: m({
|
|
645
636
|
"--vs-loading-bg": a?.loadingBackground,
|
|
@@ -647,114 +638,114 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
647
638
|
"--vs-error-icon": a?.errorIcon
|
|
648
639
|
}),
|
|
649
640
|
children: [
|
|
650
|
-
/* @__PURE__ */
|
|
641
|
+
/* @__PURE__ */ U("div", {
|
|
651
642
|
ref: s,
|
|
652
643
|
className: "h-full w-full"
|
|
653
644
|
}),
|
|
654
|
-
c === "loading" && /* @__PURE__ */
|
|
655
|
-
className: _("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
656
|
-
children: [/* @__PURE__ */
|
|
657
|
-
className: _("text-center",
|
|
645
|
+
c === "loading" && /* @__PURE__ */ W("div", {
|
|
646
|
+
className: _("absolute inset-0 flex flex-col items-center justify-center gap-2", Fe.loadingOverlay),
|
|
647
|
+
children: [/* @__PURE__ */ U(O, {}), t && /* @__PURE__ */ U("p", {
|
|
648
|
+
className: _("text-center", Fe.statusLabel),
|
|
658
649
|
children: t
|
|
659
650
|
})]
|
|
660
651
|
}),
|
|
661
|
-
c === "error" && /* @__PURE__ */
|
|
652
|
+
c === "error" && /* @__PURE__ */ W("div", {
|
|
662
653
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
663
|
-
children: [/* @__PURE__ */
|
|
654
|
+
children: [/* @__PURE__ */ U(k, {
|
|
664
655
|
size: 60,
|
|
665
656
|
stroke: C,
|
|
666
657
|
"aria-hidden": !0,
|
|
667
|
-
className:
|
|
668
|
-
}), /* @__PURE__ */
|
|
669
|
-
role: "
|
|
670
|
-
className: _("text-center",
|
|
658
|
+
className: Fe.errorIcon
|
|
659
|
+
}), /* @__PURE__ */ U("p", {
|
|
660
|
+
role: "status",
|
|
661
|
+
className: _("text-center", Fe.statusLabel),
|
|
671
662
|
children: n
|
|
672
663
|
})]
|
|
673
664
|
})
|
|
674
665
|
]
|
|
675
666
|
});
|
|
676
667
|
}, X = {
|
|
677
|
-
body: "
|
|
678
|
-
statusLabel: "
|
|
679
|
-
errorIcon: "
|
|
680
|
-
jsonWrapper: "
|
|
681
|
-
jsonLabel: "
|
|
682
|
-
jsonClickableLabel: "
|
|
683
|
-
jsonPunctuation: "
|
|
684
|
-
jsonStringValue: "
|
|
685
|
-
jsonNumberValue: "
|
|
686
|
-
jsonBooleanValue: "
|
|
687
|
-
jsonNullValue: "
|
|
688
|
-
jsonExpandIcon: "
|
|
689
|
-
jsonCollapseIcon: "
|
|
690
|
-
jsonCollapsedContent: "
|
|
691
|
-
},
|
|
692
|
-
let [r, i] =
|
|
693
|
-
return
|
|
668
|
+
body: "_body_fvnln_4",
|
|
669
|
+
statusLabel: "_statusLabel_fvnln_13",
|
|
670
|
+
errorIcon: "_errorIcon_fvnln_17",
|
|
671
|
+
jsonWrapper: "_jsonWrapper_fvnln_21",
|
|
672
|
+
jsonLabel: "_jsonLabel_fvnln_26",
|
|
673
|
+
jsonClickableLabel: "_jsonClickableLabel_fvnln_30",
|
|
674
|
+
jsonPunctuation: "_jsonPunctuation_fvnln_34",
|
|
675
|
+
jsonStringValue: "_jsonStringValue_fvnln_38",
|
|
676
|
+
jsonNumberValue: "_jsonNumberValue_fvnln_42",
|
|
677
|
+
jsonBooleanValue: "_jsonBooleanValue_fvnln_46",
|
|
678
|
+
jsonNullValue: "_jsonNullValue_fvnln_50",
|
|
679
|
+
jsonExpandIcon: "_jsonExpandIcon_fvnln_54",
|
|
680
|
+
jsonCollapseIcon: "_jsonCollapseIcon_fvnln_67",
|
|
681
|
+
jsonCollapsedContent: "_jsonCollapsedContent_fvnln_84"
|
|
682
|
+
}, Le = () => F(async () => ({ default: (await import("./PdfContent-CyCIPzRp.js")).PdfContent })), Re = ({ url: e, fileName: t, loadErrorLabel: n }) => {
|
|
683
|
+
let [r, i] = V(!1);
|
|
684
|
+
return R(() => {
|
|
694
685
|
i(!1);
|
|
695
|
-
}, [e]), r ? /* @__PURE__ */
|
|
686
|
+
}, [e]), r ? /* @__PURE__ */ W("div", {
|
|
696
687
|
className: "flex flex-col items-center gap-2",
|
|
697
|
-
children: [/* @__PURE__ */
|
|
688
|
+
children: [/* @__PURE__ */ U(k, {
|
|
698
689
|
size: 60,
|
|
699
690
|
stroke: C,
|
|
700
691
|
className: X.errorIcon
|
|
701
|
-
}), /* @__PURE__ */
|
|
692
|
+
}), /* @__PURE__ */ U("p", {
|
|
702
693
|
className: _("text-center", X.statusLabel),
|
|
703
694
|
children: n
|
|
704
695
|
})]
|
|
705
|
-
}) : /* @__PURE__ */
|
|
696
|
+
}) : /* @__PURE__ */ U("img", {
|
|
706
697
|
src: e,
|
|
707
698
|
alt: t ?? "",
|
|
708
699
|
className: "max-h-full max-w-full object-contain",
|
|
709
700
|
onError: () => i(!0)
|
|
710
701
|
});
|
|
711
|
-
},
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
let { colors: G, typography: K, bodyClassName: me, cssVars: ge } = le ?? {}, [_e, ye] = z(0), be = L(Ie, [_e]), xe = F(() => {
|
|
717
|
-
ye((e) => e + 1);
|
|
718
|
-
}, []), Se = R(void 0), [Ce, q] = z(0), J = F((e) => {
|
|
719
|
-
Se.current = e;
|
|
702
|
+
}, ze = I(({ 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: g, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: b, pdfContentLoadingLabel: x, pdfContentErrorLabel: S, pdfContentRetryLabel: w, xlsxFormulaLabel: T = "Formula", codeContentLoadingLabel: E, codeContentErrorLabel: D, codeContentRetryLabel: A, tableCopyLabel: j, tableCopiedLabel: M, tableDownloadCsvLabel: ee, codeBlockCopyLabel: te, codeBlockCopiedLabel: N, codeBlockDownloadLabel: re, tableScrollRegionAriaLabel: ie, mathScrollRegionAriaLabel: P, ooxmlHighlightsLabel: F, ooxmlHighlightNavigatedLabel: I } = {}, styles: ae, codeBlockTheme: H, tableDownloadFilename: ce, loadPdf: le, hidePdfToolbar: G = !1, configurePdfWorker: ue, onAppInfo: de, onVisualizerSendMessage: fe }) => {
|
|
703
|
+
let { colors: K, typography: q, bodyClassName: pe, cssVars: me } = ae ?? {}, [ge, _e] = V(0), ye = z(Le, [ge]), be = L(() => {
|
|
704
|
+
_e((e) => e + 1);
|
|
705
|
+
}, []), xe = B(void 0), [Se, Ce] = V(0), J = L((e) => {
|
|
706
|
+
xe.current = e;
|
|
720
707
|
}, []);
|
|
721
|
-
|
|
722
|
-
let t =
|
|
723
|
-
t != null && (
|
|
708
|
+
R(() => {
|
|
709
|
+
let t = xe.current;
|
|
710
|
+
t != null && (xe.current = void 0, e.type === i.Pdf && e.url === t && Ce((e) => e + 1));
|
|
724
711
|
}, [e]);
|
|
725
|
-
let Y =
|
|
712
|
+
let Y = q?.fontClassName != null, Te = z(() => ({
|
|
726
713
|
...m({
|
|
727
|
-
"--ac-text":
|
|
728
|
-
"--ac-status-text":
|
|
729
|
-
"--ac-error-icon":
|
|
730
|
-
"--ac-open-in-new-tab-text":
|
|
731
|
-
"--ac-json-border":
|
|
732
|
-
"--ac-json-bg":
|
|
733
|
-
"--ac-json-label":
|
|
734
|
-
"--ac-json-clickable-label":
|
|
735
|
-
"--ac-json-punctuation":
|
|
736
|
-
"--ac-json-string":
|
|
737
|
-
"--ac-json-number":
|
|
738
|
-
"--ac-json-boolean":
|
|
739
|
-
"--ac-json-null":
|
|
740
|
-
"--ac-json-toggle-icon":
|
|
741
|
-
"--ac-json-toggle-icon-hover":
|
|
742
|
-
"--ac-ooxml-bg":
|
|
743
|
-
"--ac-ooxml-formula-border":
|
|
744
|
-
"--ac-ooxml-formula-bg":
|
|
745
|
-
"--ac-ooxml-formula-text":
|
|
746
|
-
"--ac-ooxml-highlight-border":
|
|
747
|
-
"--ac-ooxml-highlight-bg":
|
|
748
|
-
"--ac-json-collapsed-text":
|
|
749
|
-
"--ac-json-collapsed-bg":
|
|
750
|
-
"--ac-
|
|
751
|
-
"--ac-
|
|
752
|
-
"--ac-
|
|
753
|
-
"--ac-
|
|
754
|
-
"--ac-
|
|
714
|
+
"--ac-text": K?.text,
|
|
715
|
+
"--ac-status-text": K?.statusText,
|
|
716
|
+
"--ac-error-icon": K?.errorIcon,
|
|
717
|
+
"--ac-open-in-new-tab-text": K?.openInNewTabText,
|
|
718
|
+
"--ac-json-border": K?.jsonBorder,
|
|
719
|
+
"--ac-json-bg": K?.jsonBackground,
|
|
720
|
+
"--ac-json-label": K?.jsonLabel,
|
|
721
|
+
"--ac-json-clickable-label": K?.jsonClickableLabel,
|
|
722
|
+
"--ac-json-punctuation": K?.jsonPunctuation,
|
|
723
|
+
"--ac-json-string": K?.jsonString,
|
|
724
|
+
"--ac-json-number": K?.jsonNumber,
|
|
725
|
+
"--ac-json-boolean": K?.jsonBoolean,
|
|
726
|
+
"--ac-json-null": K?.jsonNull,
|
|
727
|
+
"--ac-json-toggle-icon": K?.jsonToggleIcon,
|
|
728
|
+
"--ac-json-toggle-icon-hover": K?.jsonToggleIconHover,
|
|
729
|
+
"--ac-ooxml-bg": K?.ooxmlBackground,
|
|
730
|
+
"--ac-ooxml-formula-border": K?.ooxmlFormulaBorder,
|
|
731
|
+
"--ac-ooxml-formula-bg": K?.ooxmlFormulaBackground,
|
|
732
|
+
"--ac-ooxml-formula-text": K?.ooxmlFormulaText,
|
|
733
|
+
"--ac-ooxml-highlight-border": K?.ooxmlHighlightBorder,
|
|
734
|
+
"--ac-ooxml-highlight-bg": K?.ooxmlHighlightBackground,
|
|
735
|
+
"--ac-json-collapsed-text": K?.jsonCollapsedText,
|
|
736
|
+
"--ac-json-collapsed-bg": K?.jsonCollapsedBackground,
|
|
737
|
+
"--ac-focus-outline": K?.focusOutline,
|
|
738
|
+
"--ac-code-bg": K?.codeBackground,
|
|
739
|
+
"--ac-mcp-app-loading-bg": K?.mcpAppLoadingBackground,
|
|
740
|
+
"--ac-mcp-app-status-text": K?.mcpAppStatusText,
|
|
741
|
+
"--ac-font-family": Y ? void 0 : q?.fontFamily,
|
|
742
|
+
"--ac-font-size": Y ? void 0 : q?.fontSize,
|
|
743
|
+
"--ac-font-weight": Y ? void 0 : q?.fontWeight,
|
|
744
|
+
"--ac-line-height": Y ? void 0 : q?.lineHeight,
|
|
745
|
+
"--ac-letter-spacing": Y ? void 0 : q?.letterSpacing
|
|
755
746
|
}),
|
|
756
|
-
...
|
|
757
|
-
}), [
|
|
747
|
+
...me
|
|
748
|
+
}), [ae]), Ee = z(() => {
|
|
758
749
|
switch (e.type) {
|
|
759
750
|
case i.Image:
|
|
760
751
|
case i.Audio:
|
|
@@ -768,53 +759,56 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
768
759
|
case i.McpApp:
|
|
769
760
|
case i.Code:
|
|
770
761
|
case i.Html: return "h-full overflow-hidden";
|
|
771
|
-
case i.Markdown: return "h-full overflow-auto
|
|
762
|
+
case i.Markdown: return "h-full overflow-auto";
|
|
772
763
|
case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
|
|
773
764
|
default: return "h-full overflow-auto p-4";
|
|
774
765
|
}
|
|
775
|
-
}, [e.type]), De =
|
|
766
|
+
}, [e.type]), De = z(() => {
|
|
776
767
|
switch (e.type) {
|
|
777
|
-
case i.PlainText: return /* @__PURE__ */
|
|
778
|
-
className: _("whitespace-pre-wrap
|
|
768
|
+
case i.PlainText: return /* @__PURE__ */ U("pre", {
|
|
769
|
+
className: _("wrap-break-word whitespace-pre-wrap", X.body, q?.fontClassName),
|
|
779
770
|
children: e.text
|
|
780
771
|
});
|
|
781
|
-
case i.Image: return /* @__PURE__ */
|
|
772
|
+
case i.Image: return /* @__PURE__ */ U(Re, {
|
|
782
773
|
url: e.url,
|
|
783
774
|
fileName: r,
|
|
784
775
|
loadErrorLabel: c
|
|
785
776
|
});
|
|
786
|
-
case i.Audio: return /* @__PURE__ */
|
|
777
|
+
case i.Audio: return /* @__PURE__ */ U("audio", {
|
|
787
778
|
controls: !0,
|
|
788
779
|
controlsList: "nodownload",
|
|
789
780
|
src: e.url,
|
|
790
781
|
"aria-label": r ?? "Audio attachment",
|
|
791
782
|
className: "w-full max-w-sm",
|
|
792
783
|
preload: "metadata",
|
|
793
|
-
children: e.mimeType && /* @__PURE__ */
|
|
784
|
+
children: e.mimeType && /* @__PURE__ */ U("source", {
|
|
794
785
|
src: e.url,
|
|
795
786
|
type: e.mimeType
|
|
796
787
|
})
|
|
797
788
|
});
|
|
798
|
-
case i.Markdown: return /* @__PURE__ */
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
789
|
+
case i.Markdown: return /* @__PURE__ */ U("div", {
|
|
790
|
+
className: "p-4",
|
|
791
|
+
children: /* @__PURE__ */ U(p, {
|
|
792
|
+
content: e.text,
|
|
793
|
+
isStreaming: !1,
|
|
794
|
+
codeBlockTheme: H,
|
|
795
|
+
codeBlockCopyLabel: te,
|
|
796
|
+
codeBlockCopiedLabel: N,
|
|
797
|
+
codeBlockDownloadLabel: re,
|
|
798
|
+
tableScrollRegionAriaLabel: ie,
|
|
799
|
+
mathScrollRegionAriaLabel: P,
|
|
800
|
+
classNames: u
|
|
801
|
+
})
|
|
808
802
|
});
|
|
809
|
-
case i.MarkdownTable: return /* @__PURE__ */
|
|
803
|
+
case i.MarkdownTable: return /* @__PURE__ */ U(p, {
|
|
810
804
|
content: e.text,
|
|
811
805
|
isStreaming: !1,
|
|
812
806
|
codeBlockTheme: H,
|
|
813
|
-
codeBlockCopyLabel:
|
|
814
|
-
codeBlockCopiedLabel:
|
|
815
|
-
codeBlockDownloadLabel:
|
|
816
|
-
tableScrollRegionAriaLabel:
|
|
817
|
-
mathScrollRegionAriaLabel:
|
|
807
|
+
codeBlockCopyLabel: te,
|
|
808
|
+
codeBlockCopiedLabel: N,
|
|
809
|
+
codeBlockDownloadLabel: re,
|
|
810
|
+
tableScrollRegionAriaLabel: ie,
|
|
811
|
+
mathScrollRegionAriaLabel: P,
|
|
818
812
|
containerClassName: "flex h-full min-h-0 flex-col",
|
|
819
813
|
classNames: {
|
|
820
814
|
...u,
|
|
@@ -822,49 +816,54 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
822
816
|
tableScrollContainer: "max-h-full"
|
|
823
817
|
},
|
|
824
818
|
tableActionLabels: {
|
|
825
|
-
copyLabel:
|
|
826
|
-
copiedLabel:
|
|
827
|
-
downloadCsvLabel:
|
|
819
|
+
copyLabel: j,
|
|
820
|
+
copiedLabel: M,
|
|
821
|
+
downloadCsvLabel: ee
|
|
828
822
|
},
|
|
829
|
-
tableDownloadFilename:
|
|
823
|
+
tableDownloadFilename: ce
|
|
830
824
|
});
|
|
831
|
-
case i.Json:
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
className:
|
|
836
|
-
children: /* @__PURE__ */
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
825
|
+
case i.Json: {
|
|
826
|
+
let t = q?.jsonLabelClassName ?? (q?.jsonClassName ? void 0 : "dial-code-semi-text");
|
|
827
|
+
return /* @__PURE__ */ U("div", {
|
|
828
|
+
dir: "ltr",
|
|
829
|
+
className: "h-full overflow-auto",
|
|
830
|
+
children: /* @__PURE__ */ U("div", {
|
|
831
|
+
className: _("m-3 overflow-auto rounded-md border", X.jsonWrapper),
|
|
832
|
+
children: /* @__PURE__ */ U(oe, {
|
|
833
|
+
data: e.value,
|
|
834
|
+
style: {
|
|
835
|
+
container: _("whitespace-pre-wrap wrap-break-word p-2", q?.jsonClassName ?? "dial-code-text"),
|
|
836
|
+
basicChildStyle: se.basicChildStyle,
|
|
837
|
+
childFieldsContainer: "m-0 ps-3",
|
|
838
|
+
label: _("me-1", t, X.jsonLabel),
|
|
839
|
+
clickableLabel: _("me-1 cursor-pointer hover:underline", t, X.jsonClickableLabel),
|
|
840
|
+
nullValue: _("italic", X.jsonNullValue),
|
|
841
|
+
undefinedValue: _("italic", X.jsonNullValue),
|
|
842
|
+
stringValue: X.jsonStringValue,
|
|
843
|
+
booleanValue: X.jsonBooleanValue,
|
|
844
|
+
numberValue: X.jsonNumberValue,
|
|
845
|
+
otherValue: _("italic", X.jsonNullValue),
|
|
846
|
+
punctuation: _("me-1", X.jsonPunctuation),
|
|
847
|
+
collapseIcon: _("me-1 cursor-pointer select-none transition-colors", X.jsonCollapseIcon),
|
|
848
|
+
expandIcon: _("me-1 cursor-pointer select-none transition-colors", X.jsonExpandIcon),
|
|
849
|
+
collapsedContent: _(q?.jsonCollapsedClassName ?? "dial-caption-text", "me-1 cursor-pointer rounded px-1", X.jsonCollapsedContent)
|
|
850
|
+
}
|
|
851
|
+
})
|
|
855
852
|
})
|
|
856
|
-
})
|
|
857
|
-
}
|
|
858
|
-
case i.Code: return /* @__PURE__ */
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
case i.Code: return /* @__PURE__ */ U(he, {
|
|
859
856
|
content: e,
|
|
860
857
|
codeBlockTheme: H,
|
|
858
|
+
codeClassName: q?.codeClassName,
|
|
859
|
+
errorLabelClassName: q?.errorMessageClassName,
|
|
861
860
|
labels: {
|
|
862
861
|
loadingLabel: E,
|
|
863
|
-
errorLabel:
|
|
862
|
+
errorLabel: D,
|
|
864
863
|
retryLabel: A
|
|
865
864
|
}
|
|
866
865
|
});
|
|
867
|
-
case i.Html: return /* @__PURE__ */
|
|
866
|
+
case i.Html: return /* @__PURE__ */ U(ve, {
|
|
868
867
|
content: e,
|
|
869
868
|
labels: {
|
|
870
869
|
htmlFrameBlockedLabel: f,
|
|
@@ -872,26 +871,29 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
872
871
|
},
|
|
873
872
|
isSourceView: a,
|
|
874
873
|
title: r,
|
|
875
|
-
codeBlockTheme: H
|
|
874
|
+
codeBlockTheme: H,
|
|
875
|
+
codeClassName: q?.codeClassName
|
|
876
876
|
});
|
|
877
|
-
case i.Pdf: return /* @__PURE__ */
|
|
878
|
-
retryKey:
|
|
879
|
-
onRetry:
|
|
877
|
+
case i.Pdf: return /* @__PURE__ */ U(s, {
|
|
878
|
+
retryKey: ge,
|
|
879
|
+
onRetry: be,
|
|
880
|
+
errorLabelClassName: q?.errorMessageClassName,
|
|
880
881
|
labels: {
|
|
881
882
|
loadingLabel: x,
|
|
882
883
|
errorLabel: S,
|
|
883
884
|
retryLabel: w
|
|
884
885
|
},
|
|
885
|
-
children: /* @__PURE__ */
|
|
886
|
+
children: /* @__PURE__ */ U(ye, {
|
|
886
887
|
fileName: r,
|
|
887
888
|
url: e.url,
|
|
888
889
|
highlights: e.highlights ?? [],
|
|
889
890
|
selectedHighlightId: e.selectedHighlightId,
|
|
890
891
|
selectedPageNumber: e.page,
|
|
891
|
-
loadPdf:
|
|
892
|
+
loadPdf: le,
|
|
892
893
|
onLoadError: J,
|
|
893
|
-
hideHeader:
|
|
894
|
-
configurePdfWorker:
|
|
894
|
+
hideHeader: G,
|
|
895
|
+
configurePdfWorker: ue,
|
|
896
|
+
errorLabelClassName: q?.errorMessageClassName,
|
|
895
897
|
labels: {
|
|
896
898
|
thumbnailsLabel: g,
|
|
897
899
|
showThumbnailsLabel: v,
|
|
@@ -902,39 +904,40 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
902
904
|
retryLabel: w
|
|
903
905
|
}
|
|
904
906
|
})
|
|
905
|
-
}, `${e.url}#${
|
|
906
|
-
case i.Ooxml: return /* @__PURE__ */
|
|
907
|
+
}, `${e.url}#${Se}`);
|
|
908
|
+
case i.Ooxml: return /* @__PURE__ */ U(ke, {
|
|
907
909
|
content: e,
|
|
908
910
|
fileName: r,
|
|
909
911
|
loadErrorLabel: c,
|
|
910
912
|
formulaLabel: T,
|
|
911
|
-
formulaLabelClassName:
|
|
912
|
-
|
|
913
|
-
|
|
913
|
+
formulaLabelClassName: q?.xlsxFormulaLabelClassName ?? "dial-italic-text",
|
|
914
|
+
formulaValueClassName: q?.xlsxFormulaValueClassName ?? "dial-code-text",
|
|
915
|
+
highlightsLabel: F,
|
|
916
|
+
highlightNavigatedLabel: I
|
|
914
917
|
});
|
|
915
918
|
case i.Visualizer:
|
|
916
|
-
case i.GroupedVisualizer: return /* @__PURE__ */
|
|
919
|
+
case i.GroupedVisualizer: return /* @__PURE__ */ U(Ie, {
|
|
917
920
|
content: e,
|
|
918
921
|
errorLabel: d,
|
|
919
|
-
onSendMessage:
|
|
922
|
+
onSendMessage: fe
|
|
920
923
|
});
|
|
921
|
-
case i.McpApp: return /* @__PURE__ */
|
|
924
|
+
case i.McpApp: return /* @__PURE__ */ U(we, {
|
|
922
925
|
content: e,
|
|
923
|
-
onAppInfo:
|
|
926
|
+
onAppInfo: de
|
|
924
927
|
});
|
|
925
|
-
case i.Unsupported: return /* @__PURE__ */
|
|
928
|
+
case i.Unsupported: return /* @__PURE__ */ U("p", {
|
|
926
929
|
className: _("text-center", X.statusLabel),
|
|
927
930
|
children: o
|
|
928
931
|
});
|
|
929
932
|
case i.Error: {
|
|
930
933
|
let t = e.errorType === n.Forbidden;
|
|
931
|
-
return /* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ W("div", {
|
|
932
935
|
className: "flex flex-col items-center gap-2",
|
|
933
|
-
children: [
|
|
936
|
+
children: [U(t ? ne : k, {
|
|
934
937
|
size: 60,
|
|
935
938
|
stroke: C,
|
|
936
939
|
className: X.errorIcon
|
|
937
|
-
}), /* @__PURE__ */
|
|
940
|
+
}), /* @__PURE__ */ U("p", {
|
|
938
941
|
className: _("text-center", X.statusLabel),
|
|
939
942
|
children: t ? l : c
|
|
940
943
|
})]
|
|
@@ -943,24 +946,29 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
943
946
|
}
|
|
944
947
|
}, [
|
|
945
948
|
e,
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
+
q?.fontClassName,
|
|
950
|
+
q?.jsonClassName,
|
|
951
|
+
q?.jsonLabelClassName,
|
|
952
|
+
q?.xlsxFormulaLabelClassName,
|
|
953
|
+
q?.xlsxFormulaValueClassName,
|
|
954
|
+
q?.codeClassName,
|
|
955
|
+
q?.jsonCollapsedClassName,
|
|
956
|
+
q?.errorMessageClassName,
|
|
949
957
|
r,
|
|
950
958
|
H,
|
|
951
959
|
o,
|
|
952
960
|
c,
|
|
953
961
|
l,
|
|
954
962
|
d,
|
|
955
|
-
|
|
963
|
+
fe,
|
|
956
964
|
f,
|
|
957
965
|
h,
|
|
958
966
|
a,
|
|
967
|
+
ce,
|
|
968
|
+
le,
|
|
969
|
+
G,
|
|
959
970
|
ue,
|
|
960
|
-
U,
|
|
961
|
-
W,
|
|
962
971
|
de,
|
|
963
|
-
fe,
|
|
964
972
|
g,
|
|
965
973
|
v,
|
|
966
974
|
y,
|
|
@@ -970,68 +978,69 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
970
978
|
w,
|
|
971
979
|
T,
|
|
972
980
|
E,
|
|
973
|
-
|
|
981
|
+
D,
|
|
974
982
|
A,
|
|
983
|
+
ye,
|
|
984
|
+
ge,
|
|
975
985
|
be,
|
|
976
|
-
|
|
977
|
-
xe,
|
|
978
|
-
Ce,
|
|
986
|
+
Se,
|
|
979
987
|
J,
|
|
980
|
-
ee,
|
|
981
|
-
te,
|
|
982
|
-
ne,
|
|
983
988
|
j,
|
|
984
|
-
ie,
|
|
985
|
-
ae,
|
|
986
989
|
M,
|
|
990
|
+
ee,
|
|
991
|
+
te,
|
|
987
992
|
N,
|
|
993
|
+
re,
|
|
994
|
+
ie,
|
|
988
995
|
P,
|
|
989
|
-
|
|
996
|
+
F,
|
|
997
|
+
I
|
|
990
998
|
]);
|
|
991
|
-
return /* @__PURE__ */
|
|
992
|
-
style:
|
|
993
|
-
className: _(t ? "flex h-full items-center justify-center" : Ee,
|
|
994
|
-
children: t ? /* @__PURE__ */
|
|
999
|
+
return /* @__PURE__ */ U("div", {
|
|
1000
|
+
style: t ? void 0 : Te,
|
|
1001
|
+
className: _(t ? "flex h-full items-center justify-center" : Ee, pe),
|
|
1002
|
+
children: t ? /* @__PURE__ */ U(O, {}) : De
|
|
995
1003
|
});
|
|
996
1004
|
}), Be = {
|
|
997
|
-
mcpAppDivider: "
|
|
998
|
-
mcpAppVersion: "
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
+
mcpAppDivider: "_mcpAppDivider_1gxed_1",
|
|
1006
|
+
mcpAppVersion: "_mcpAppVersion_1gxed_5",
|
|
1007
|
+
panelHeader: "_panelHeader_1gxed_9"
|
|
1008
|
+
}, Ve = 2e3, He = I(({ isOpen: e, isLoading: t = !1, onClose: n, content: r, fileName: a, leftActions: s, labels: { ariaLabel: c, closeLabel: l = "Close", resizeLabel: u = "Resize panel", downloadLabel: d = "Download", copyTextLabel: f = "Copy text", copiedTextLabel: p = "Copied!", copyMarkdownLabel: h = "Copy as Markdown", copiedMarkdownLabel: g = "Copied!", copyJsonLabel: v = "Copy as JSON", copiedJsonLabel: y = "Copied!", visualizerErrorLabel: w, unsupportedLabel: E = "Preview is not supported for this file", loadErrorLabel: D = "Failed to load file", forbiddenErrorLabel: O = "You don't have permission to access this file", htmlFrameBlockedLabel: k = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: A = "Open in new tab", htmlViewSourceLabel: ne = "View source", htmlViewRenderedLabel: P = "View rendered", mcpAppReloadLabel: F = "Reload", pdfThumbnailsLabel: I, pdfShowThumbnailsLabel: ae, pdfHideThumbnailsLabel: oe, pdfPageNumberLabel: se, pdfContentLoadingLabel: ce, pdfContentErrorLabel: le, pdfContentRetryLabel: G, xlsxFormulaLabel: ue, codeContentLoadingLabel: de, codeContentErrorLabel: fe, codeContentRetryLabel: q, tableCopyLabel: pe, tableCopiedLabel: me, tableDownloadCsvLabel: he, codeBlockCopyLabel: ge, codeBlockCopiedLabel: _e, codeBlockDownloadLabel: ve, tableScrollRegionAriaLabel: ye, mathScrollRegionAriaLabel: be, ooxmlHighlightsLabel: xe, ooxmlHighlightNavigatedLabel: Se }, onDownload: Ce, onCopyText: J, onCopyMarkdown: we, onCopyJson: Y, tableDownloadFilename: Te, isMobile: Ee = !1, defaultWidth: De, minWidth: Oe = 600, maxWidth: ke = 1500, onResizeStop: Ae, styles: je, codeBlockTheme: Me, loadPdf: Ne, configurePdfWorker: Pe, onVisualizerSendMessage: Fe }) => {
|
|
1009
|
+
let [Ie, X] = V(!1), [Le, Re] = V(!1), [He, Ue] = V(!1), [Z, We] = V(!1), [Ge, Ke] = V(void 0), qe = B(null), Q = B(null), Je = B(null), Ye = L(() => {
|
|
1010
|
+
J?.(), qe.current != null && clearTimeout(qe.current), X(!0), qe.current = setTimeout(() => X(!1), Ve);
|
|
1011
|
+
}, [J]), Xe = L(() => {
|
|
1012
|
+
we?.(), Q.current != null && clearTimeout(Q.current), Re(!0), Q.current = setTimeout(() => Re(!1), Ve);
|
|
1013
|
+
}, [we]), Ze = L(() => {
|
|
1005
1014
|
Y?.(), Je.current != null && clearTimeout(Je.current), Ue(!0), Je.current = setTimeout(() => Ue(!1), Ve);
|
|
1006
1015
|
}, [Y]);
|
|
1007
|
-
|
|
1016
|
+
R(() => () => {
|
|
1008
1017
|
qe.current != null && clearTimeout(qe.current), Q.current != null && clearTimeout(Q.current), Je.current != null && clearTimeout(Je.current);
|
|
1009
1018
|
}, []);
|
|
1010
|
-
let Qe =
|
|
1019
|
+
let Qe = L(() => {
|
|
1011
1020
|
We((e) => !e);
|
|
1012
1021
|
}, []);
|
|
1013
|
-
|
|
1022
|
+
R(() => {
|
|
1014
1023
|
We(!1), Ke(void 0);
|
|
1015
1024
|
}, [r]);
|
|
1016
|
-
let { className: $e, panelStyles: $, ...et } = je ?? {}, { colors: tt, typography: nt } = et, rt =
|
|
1025
|
+
let { className: $e, panelStyles: $, ...et } = je ?? {}, { colors: tt, typography: nt } = et, rt = z(() => m({
|
|
1017
1026
|
"--ac-mcp-app-divider": tt?.mcpAppDividerColor,
|
|
1018
1027
|
"--ac-mcp-app-version": tt?.mcpAppVersionColor
|
|
1019
|
-
}), [tt?.mcpAppDividerColor, tt?.mcpAppVersionColor]), it = r.type === i.McpApp && Ge != null ? /* @__PURE__ */
|
|
1028
|
+
}), [tt?.mcpAppDividerColor, tt?.mcpAppVersionColor]), it = r.type === i.McpApp && Ge != null ? /* @__PURE__ */ W("span", {
|
|
1020
1029
|
style: rt,
|
|
1021
1030
|
children: [
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
/* @__PURE__ */
|
|
1031
|
+
/* @__PURE__ */ U("span", { children: a }),
|
|
1032
|
+
/* @__PURE__ */ U("span", {
|
|
1024
1033
|
"aria-hidden": !0,
|
|
1025
1034
|
className: _("mx-1.5 inline-block h-3 w-0 border-s align-middle", Be.mcpAppDivider)
|
|
1026
1035
|
}),
|
|
1027
|
-
/* @__PURE__ */
|
|
1028
|
-
Ge.version && /* @__PURE__ */
|
|
1036
|
+
/* @__PURE__ */ U("span", { children: Ge.name }),
|
|
1037
|
+
Ge.version && /* @__PURE__ */ U("span", {
|
|
1029
1038
|
className: _("ms-2", nt?.mcpAppVersionClassName ?? "dial-caption-text", Be.mcpAppVersion),
|
|
1030
1039
|
children: Ge.version
|
|
1031
1040
|
})
|
|
1032
1041
|
]
|
|
1033
|
-
}) : a, at = !t && r.type === i.Html && (r.srcdoc != null || r.resolveSourceText != null), ot = !t &&
|
|
1034
|
-
return /* @__PURE__ */
|
|
1042
|
+
}) : a, at = !t && r.type === i.Html && (r.srcdoc != null || r.resolveSourceText != null), ot = !t && J != null && (r.type === i.PlainText || r.type === i.Code), st = !t && we != null && r.type === i.Markdown, ct = !t && Y != null && r.type === i.Json, lt = !t && Ce != null && o(r), ut = !t && r.type === i.McpApp && r.onReload != null;
|
|
1043
|
+
return /* @__PURE__ */ U(x, {
|
|
1035
1044
|
isOpen: e,
|
|
1036
1045
|
orientation: b.Right,
|
|
1037
1046
|
title: it,
|
|
@@ -1048,45 +1057,49 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
1048
1057
|
onResizeStop: Ae,
|
|
1049
1058
|
styles: {
|
|
1050
1059
|
...$,
|
|
1060
|
+
cssVars: {
|
|
1061
|
+
...m({ "--ac-header-border": tt?.headerBorder }),
|
|
1062
|
+
...$?.cssVars
|
|
1063
|
+
},
|
|
1051
1064
|
titleClassName: $?.titleClassName ?? "dial-h3-text",
|
|
1052
|
-
headerClassName: _("border-b
|
|
1053
|
-
className: _(e ? "mobile:w-full mobile:max-w-full" : "w-0", $e, $?.className,
|
|
1065
|
+
headerClassName: _("border-b", Be.panelHeader, $?.headerClassName),
|
|
1066
|
+
className: _(e ? "mobile:w-full mobile:max-w-full" : "w-0", $e, $?.className, K.panel)
|
|
1054
1067
|
},
|
|
1055
1068
|
leftActions: s,
|
|
1056
|
-
rightActions: at || ot || st || ct || lt || ut ? /* @__PURE__ */
|
|
1057
|
-
ut && /* @__PURE__ */
|
|
1058
|
-
icon: /* @__PURE__ */
|
|
1069
|
+
rightActions: at || ot || st || ct || lt || ut ? /* @__PURE__ */ W(H, { children: [
|
|
1070
|
+
ut && /* @__PURE__ */ U(T, {
|
|
1071
|
+
icon: /* @__PURE__ */ U(ie, {
|
|
1059
1072
|
size: S.LG,
|
|
1060
1073
|
stroke: C,
|
|
1061
1074
|
"aria-hidden": !0
|
|
1062
1075
|
}),
|
|
1063
|
-
"aria-label":
|
|
1064
|
-
tooltipProps: { tooltip:
|
|
1076
|
+
"aria-label": F,
|
|
1077
|
+
tooltipProps: { tooltip: F },
|
|
1065
1078
|
onClick: r.type === i.McpApp ? r.onReload : void 0
|
|
1066
1079
|
}),
|
|
1067
|
-
at && /* @__PURE__ */
|
|
1068
|
-
icon:
|
|
1080
|
+
at && /* @__PURE__ */ U(T, {
|
|
1081
|
+
icon: U(Z ? N : M, {
|
|
1069
1082
|
size: S.LG,
|
|
1070
1083
|
stroke: C,
|
|
1071
1084
|
"aria-hidden": !0
|
|
1072
1085
|
}),
|
|
1073
|
-
"aria-label": Z ?
|
|
1086
|
+
"aria-label": Z ? P : ne,
|
|
1074
1087
|
"aria-pressed": Z,
|
|
1075
|
-
tooltipProps: { tooltip: Z ?
|
|
1088
|
+
tooltipProps: { tooltip: Z ? P : ne },
|
|
1076
1089
|
onClick: Qe
|
|
1077
1090
|
}),
|
|
1078
|
-
ot && /* @__PURE__ */
|
|
1079
|
-
icon:
|
|
1091
|
+
ot && /* @__PURE__ */ U(T, {
|
|
1092
|
+
icon: U(Ie ? j : ee, {
|
|
1080
1093
|
size: S.LG,
|
|
1081
1094
|
stroke: C,
|
|
1082
1095
|
"aria-hidden": !0
|
|
1083
1096
|
}),
|
|
1084
|
-
"aria-label":
|
|
1085
|
-
tooltipProps: { tooltip:
|
|
1097
|
+
"aria-label": Ie ? p : f,
|
|
1098
|
+
tooltipProps: { tooltip: Ie ? p : f },
|
|
1086
1099
|
onClick: Ye
|
|
1087
1100
|
}),
|
|
1088
|
-
st && /* @__PURE__ */
|
|
1089
|
-
icon:
|
|
1101
|
+
st && /* @__PURE__ */ U(T, {
|
|
1102
|
+
icon: U(Le ? j : re, {
|
|
1090
1103
|
size: S.LG,
|
|
1091
1104
|
stroke: C,
|
|
1092
1105
|
"aria-hidden": !0
|
|
@@ -1095,8 +1108,8 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
1095
1108
|
tooltipProps: { tooltip: Le ? g : h },
|
|
1096
1109
|
onClick: Xe
|
|
1097
1110
|
}),
|
|
1098
|
-
ct && /* @__PURE__ */
|
|
1099
|
-
icon:
|
|
1111
|
+
ct && /* @__PURE__ */ U(T, {
|
|
1112
|
+
icon: U(He ? j : ee, {
|
|
1100
1113
|
size: S.LG,
|
|
1101
1114
|
stroke: C,
|
|
1102
1115
|
"aria-hidden": !0
|
|
@@ -1105,17 +1118,17 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
1105
1118
|
tooltipProps: { tooltip: He ? y : v },
|
|
1106
1119
|
onClick: Ze
|
|
1107
1120
|
}),
|
|
1108
|
-
lt && /* @__PURE__ */
|
|
1109
|
-
icon: /* @__PURE__ */
|
|
1121
|
+
lt && /* @__PURE__ */ U(T, {
|
|
1122
|
+
icon: /* @__PURE__ */ U(te, {
|
|
1110
1123
|
size: S.LG,
|
|
1111
1124
|
stroke: C
|
|
1112
1125
|
}),
|
|
1113
1126
|
"aria-label": d,
|
|
1114
1127
|
tooltipProps: { tooltip: d },
|
|
1115
|
-
onClick:
|
|
1128
|
+
onClick: Ce
|
|
1116
1129
|
})
|
|
1117
1130
|
] }) : null,
|
|
1118
|
-
children: /* @__PURE__ */
|
|
1131
|
+
children: /* @__PURE__ */ U(ze, {
|
|
1119
1132
|
content: r,
|
|
1120
1133
|
isLoading: t,
|
|
1121
1134
|
fileName: a,
|
|
@@ -1127,28 +1140,28 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
1127
1140
|
forbiddenErrorLabel: O,
|
|
1128
1141
|
visualizerErrorLabel: w,
|
|
1129
1142
|
htmlFrameBlockedLabel: k,
|
|
1130
|
-
htmlOpenInNewTabLabel:
|
|
1131
|
-
pdfThumbnailsLabel:
|
|
1132
|
-
pdfShowThumbnailsLabel:
|
|
1133
|
-
pdfHideThumbnailsLabel:
|
|
1134
|
-
pdfPageNumberLabel:
|
|
1135
|
-
pdfContentLoadingLabel:
|
|
1136
|
-
pdfContentErrorLabel:
|
|
1137
|
-
pdfContentRetryLabel:
|
|
1138
|
-
xlsxFormulaLabel:
|
|
1139
|
-
codeContentLoadingLabel:
|
|
1140
|
-
codeContentErrorLabel:
|
|
1141
|
-
codeContentRetryLabel:
|
|
1142
|
-
tableCopyLabel:
|
|
1143
|
-
tableCopiedLabel:
|
|
1144
|
-
tableDownloadCsvLabel:
|
|
1145
|
-
codeBlockCopyLabel:
|
|
1146
|
-
codeBlockCopiedLabel:
|
|
1147
|
-
codeBlockDownloadLabel:
|
|
1148
|
-
tableScrollRegionAriaLabel:
|
|
1149
|
-
mathScrollRegionAriaLabel:
|
|
1150
|
-
ooxmlHighlightsLabel:
|
|
1151
|
-
ooxmlHighlightNavigatedLabel:
|
|
1143
|
+
htmlOpenInNewTabLabel: A,
|
|
1144
|
+
pdfThumbnailsLabel: I,
|
|
1145
|
+
pdfShowThumbnailsLabel: ae,
|
|
1146
|
+
pdfHideThumbnailsLabel: oe,
|
|
1147
|
+
pdfPageNumberLabel: se,
|
|
1148
|
+
pdfContentLoadingLabel: ce,
|
|
1149
|
+
pdfContentErrorLabel: le,
|
|
1150
|
+
pdfContentRetryLabel: G,
|
|
1151
|
+
xlsxFormulaLabel: ue,
|
|
1152
|
+
codeContentLoadingLabel: de,
|
|
1153
|
+
codeContentErrorLabel: fe,
|
|
1154
|
+
codeContentRetryLabel: q,
|
|
1155
|
+
tableCopyLabel: pe,
|
|
1156
|
+
tableCopiedLabel: me,
|
|
1157
|
+
tableDownloadCsvLabel: he,
|
|
1158
|
+
codeBlockCopyLabel: ge,
|
|
1159
|
+
codeBlockCopiedLabel: _e,
|
|
1160
|
+
codeBlockDownloadLabel: ve,
|
|
1161
|
+
tableScrollRegionAriaLabel: ye,
|
|
1162
|
+
mathScrollRegionAriaLabel: be,
|
|
1163
|
+
ooxmlHighlightsLabel: xe,
|
|
1164
|
+
ooxmlHighlightNavigatedLabel: Se
|
|
1152
1165
|
},
|
|
1153
1166
|
styles: et,
|
|
1154
1167
|
codeBlockTheme: Me,
|
|
@@ -1158,11 +1171,11 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
1158
1171
|
onVisualizerSendMessage: Fe
|
|
1159
1172
|
})
|
|
1160
1173
|
});
|
|
1161
|
-
}), Ue = new Set(["html", "htm"]), Z = {
|
|
1174
|
+
}), Ue = /* @__PURE__ */ new Set(["html", "htm"]), Z = {
|
|
1162
1175
|
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1163
1176
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1164
1177
|
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
1165
|
-
}, We = 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(".")), Ge = {
|
|
1178
|
+
}, We = /* @__PURE__ */ 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(".")), Ge = {
|
|
1166
1179
|
docx: r.Docx,
|
|
1167
1180
|
xlsx: r.Xlsx,
|
|
1168
1181
|
pptx: r.Pptx,
|
|
@@ -1190,10 +1203,10 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
1190
1203
|
return n == null ? void 0 : qe[n];
|
|
1191
1204
|
}, Xe = (e) => {
|
|
1192
1205
|
let t = e.lastIndexOf(".");
|
|
1193
|
-
return t
|
|
1206
|
+
return t !== -1 && We.has(e.slice(t + 1).toLowerCase());
|
|
1194
1207
|
}, Ze = (e) => {
|
|
1195
1208
|
let t = e.lastIndexOf(".");
|
|
1196
|
-
return t
|
|
1209
|
+
return t !== -1 && Ue.has(e.slice(t + 1).toLowerCase());
|
|
1197
1210
|
}, Qe = {
|
|
1198
1211
|
xml: "xml",
|
|
1199
1212
|
csv: "plaintext",
|
|
@@ -1254,145 +1267,166 @@ var pe = { panel: "dial-attachment-canvas-panel" }, G = {
|
|
|
1254
1267
|
errorType: n.Forbidden,
|
|
1255
1268
|
...e != null && { url: e }
|
|
1256
1269
|
}), nt = (e) => {
|
|
1257
|
-
if (
|
|
1270
|
+
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;
|
|
1258
1271
|
}, rt = (e) => {
|
|
1259
1272
|
let t = nt(e);
|
|
1260
1273
|
t != null && URL.revokeObjectURL(t);
|
|
1261
1274
|
}, it = {
|
|
1262
1275
|
type: i.PlainText,
|
|
1263
1276
|
text: ""
|
|
1264
|
-
}, at =
|
|
1277
|
+
}, at = P(void 0);
|
|
1265
1278
|
at.displayName = "AttachmentCanvasContext";
|
|
1266
|
-
var ot = ({ children: e }) => {
|
|
1267
|
-
let
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
o(e), c(t), u(r), i(!1), n(!0);
|
|
1271
|
-
}, []), p = F(() => {
|
|
1272
|
-
o(it), n(!1), i(!1), u(void 0);
|
|
1279
|
+
var ot = P(void 0), st = ({ children: e }) => {
|
|
1280
|
+
let t = B(0), n = L(() => {
|
|
1281
|
+
let e = ++t.current;
|
|
1282
|
+
return () => e === t.current;
|
|
1273
1283
|
}, []);
|
|
1274
|
-
|
|
1275
|
-
|
|
1284
|
+
R(() => () => {
|
|
1285
|
+
t.current += 1;
|
|
1286
|
+
}, []);
|
|
1287
|
+
let [r, i] = V(!1), [a, o] = V(!1), [s, c] = V(it), [l, u] = V(void 0), [d, f] = V(void 0), p = L((e, t) => {
|
|
1288
|
+
u(e), f(t), o(!0), i(!0);
|
|
1289
|
+
}, []), m = L((e, t, n) => {
|
|
1290
|
+
c(e), u(t), f(n), o(!1), i(!0);
|
|
1291
|
+
}, []), h = L(() => {
|
|
1292
|
+
c(it), i(!1), o(!1), f(void 0);
|
|
1293
|
+
}, []);
|
|
1294
|
+
return R(() => () => {
|
|
1295
|
+
let e = nt(s);
|
|
1276
1296
|
e != null && URL.revokeObjectURL(e);
|
|
1277
|
-
}, [
|
|
1278
|
-
value:
|
|
1279
|
-
isOpen:
|
|
1280
|
-
isLoading:
|
|
1281
|
-
content:
|
|
1282
|
-
fileName:
|
|
1283
|
-
attachmentId:
|
|
1284
|
-
openCanvasLoading:
|
|
1285
|
-
openCanvas:
|
|
1286
|
-
closeCanvas:
|
|
1297
|
+
}, [s]), /* @__PURE__ */ U(at.Provider, {
|
|
1298
|
+
value: z(() => ({
|
|
1299
|
+
isOpen: r,
|
|
1300
|
+
isLoading: a,
|
|
1301
|
+
content: s,
|
|
1302
|
+
fileName: l,
|
|
1303
|
+
attachmentId: d,
|
|
1304
|
+
openCanvasLoading: p,
|
|
1305
|
+
openCanvas: m,
|
|
1306
|
+
closeCanvas: h
|
|
1287
1307
|
}), [
|
|
1288
|
-
t,
|
|
1289
1308
|
r,
|
|
1290
1309
|
a,
|
|
1291
1310
|
s,
|
|
1292
1311
|
l,
|
|
1293
1312
|
d,
|
|
1294
|
-
|
|
1295
|
-
|
|
1313
|
+
p,
|
|
1314
|
+
m,
|
|
1315
|
+
h
|
|
1296
1316
|
]),
|
|
1297
|
-
children:
|
|
1317
|
+
children: /* @__PURE__ */ U(ot.Provider, {
|
|
1318
|
+
value: n,
|
|
1319
|
+
children: e
|
|
1320
|
+
})
|
|
1298
1321
|
});
|
|
1299
|
-
},
|
|
1300
|
-
let e =
|
|
1322
|
+
}, ct = () => {
|
|
1323
|
+
let e = ae(at);
|
|
1301
1324
|
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
1302
1325
|
return e;
|
|
1303
|
-
},
|
|
1304
|
-
let
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
}, [
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1326
|
+
}, lt = () => {
|
|
1327
|
+
let e = ae(ot);
|
|
1328
|
+
if (!e) throw Error("useLatestCanvasRequest must be used within an AttachmentCanvasProvider");
|
|
1329
|
+
let t = B(void 0);
|
|
1330
|
+
return R(() => (t.current = {}, () => {
|
|
1331
|
+
t.current = void 0;
|
|
1332
|
+
}), []), L(() => {
|
|
1333
|
+
let n = t.current, r = e();
|
|
1334
|
+
return () => n !== void 0 && t.current === n && r();
|
|
1335
|
+
}, [e]);
|
|
1336
|
+
}, ut = I(({ labels: e, leftActions: t, isMobile: n = !1, defaultWidth: r, minWidth: o, maxWidth: s, codeBlockTheme: c, tableDownloadFilename: l, loadPdf: u, configurePdfWorker: d, onVisualizerSendMessage: f }) => {
|
|
1337
|
+
let { ariaLabel: p = "Attachment preview", closeLabel: m = "Close", downloadLabel: g = "Download", unsupportedLabel: _ = "Preview is not supported for this file", loadErrorLabel: v = "Failed to load file", forbiddenErrorLabel: y = "You don't have permission to access this file", copyTextLabel: b, copiedTextLabel: x, copyMarkdownLabel: S, copiedMarkdownLabel: C, copyJsonLabel: w, copiedJsonLabel: T, htmlFrameBlockedLabel: E, htmlOpenInNewTabLabel: D, htmlViewSourceLabel: O, htmlViewRenderedLabel: k, pdfThumbnailsLabel: A, pdfShowThumbnailsLabel: j, pdfHideThumbnailsLabel: M, pdfPageNumberLabel: ee, pdfContentLoadingLabel: te, pdfContentErrorLabel: N, pdfContentRetryLabel: ne, xlsxFormulaLabel: re, codeContentLoadingLabel: ie, codeContentErrorLabel: P, codeContentRetryLabel: F, tableCopyLabel: I, tableCopiedLabel: ae, tableDownloadCsvLabel: R, codeBlockCopyLabel: z, codeBlockCopiedLabel: B, codeBlockDownloadLabel: V, tableScrollRegionAriaLabel: oe, mathScrollRegionAriaLabel: se, ooxmlHighlightsLabel: H, ooxmlHighlightNavigatedLabel: W } = e ?? {}, { isOpen: ce, isLoading: le, content: G, fileName: ue, closeCanvas: de } = ct(), fe = L(() => {
|
|
1338
|
+
a(G, ue);
|
|
1339
|
+
}, [G, ue]), K = L(() => {
|
|
1340
|
+
(G.type === i.PlainText || G.type === i.Code) && h(G.text);
|
|
1341
|
+
}, [G]), q = L(() => {
|
|
1342
|
+
G.type === i.Markdown && h(G.text);
|
|
1343
|
+
}, [G]), pe = L(() => {
|
|
1344
|
+
G.type === i.Json && h(JSON.stringify(G.value, null, 2));
|
|
1345
|
+
}, [G]);
|
|
1346
|
+
return /* @__PURE__ */ U(He, {
|
|
1347
|
+
isOpen: ce,
|
|
1348
|
+
isLoading: le,
|
|
1316
1349
|
onClose: de,
|
|
1317
|
-
content:
|
|
1318
|
-
fileName:
|
|
1350
|
+
content: G,
|
|
1351
|
+
fileName: ue,
|
|
1319
1352
|
leftActions: t,
|
|
1320
1353
|
labels: {
|
|
1321
|
-
ariaLabel:
|
|
1322
|
-
closeLabel:
|
|
1323
|
-
downloadLabel:
|
|
1324
|
-
copyTextLabel:
|
|
1325
|
-
copiedTextLabel:
|
|
1326
|
-
copyMarkdownLabel:
|
|
1327
|
-
copiedMarkdownLabel:
|
|
1328
|
-
copyJsonLabel:
|
|
1329
|
-
copiedJsonLabel:
|
|
1330
|
-
unsupportedLabel:
|
|
1331
|
-
loadErrorLabel:
|
|
1332
|
-
forbiddenErrorLabel:
|
|
1333
|
-
htmlFrameBlockedLabel:
|
|
1334
|
-
htmlOpenInNewTabLabel:
|
|
1335
|
-
htmlViewSourceLabel:
|
|
1336
|
-
htmlViewRenderedLabel:
|
|
1337
|
-
pdfThumbnailsLabel:
|
|
1338
|
-
pdfShowThumbnailsLabel:
|
|
1339
|
-
pdfHideThumbnailsLabel:
|
|
1340
|
-
pdfPageNumberLabel:
|
|
1341
|
-
pdfContentLoadingLabel:
|
|
1342
|
-
pdfContentErrorLabel:
|
|
1343
|
-
pdfContentRetryLabel:
|
|
1344
|
-
xlsxFormulaLabel:
|
|
1345
|
-
codeContentLoadingLabel:
|
|
1346
|
-
codeContentErrorLabel:
|
|
1347
|
-
codeContentRetryLabel:
|
|
1348
|
-
tableCopyLabel:
|
|
1349
|
-
tableCopiedLabel:
|
|
1350
|
-
tableDownloadCsvLabel:
|
|
1351
|
-
codeBlockCopyLabel:
|
|
1352
|
-
codeBlockCopiedLabel:
|
|
1353
|
-
codeBlockDownloadLabel:
|
|
1354
|
-
tableScrollRegionAriaLabel:
|
|
1355
|
-
mathScrollRegionAriaLabel:
|
|
1356
|
-
ooxmlHighlightsLabel:
|
|
1357
|
-
ooxmlHighlightNavigatedLabel:
|
|
1354
|
+
ariaLabel: p,
|
|
1355
|
+
closeLabel: m,
|
|
1356
|
+
downloadLabel: g,
|
|
1357
|
+
copyTextLabel: b,
|
|
1358
|
+
copiedTextLabel: x,
|
|
1359
|
+
copyMarkdownLabel: S,
|
|
1360
|
+
copiedMarkdownLabel: C,
|
|
1361
|
+
copyJsonLabel: w,
|
|
1362
|
+
copiedJsonLabel: T,
|
|
1363
|
+
unsupportedLabel: _,
|
|
1364
|
+
loadErrorLabel: v,
|
|
1365
|
+
forbiddenErrorLabel: y,
|
|
1366
|
+
htmlFrameBlockedLabel: E,
|
|
1367
|
+
htmlOpenInNewTabLabel: D,
|
|
1368
|
+
htmlViewSourceLabel: O,
|
|
1369
|
+
htmlViewRenderedLabel: k,
|
|
1370
|
+
pdfThumbnailsLabel: A,
|
|
1371
|
+
pdfShowThumbnailsLabel: j,
|
|
1372
|
+
pdfHideThumbnailsLabel: M,
|
|
1373
|
+
pdfPageNumberLabel: ee,
|
|
1374
|
+
pdfContentLoadingLabel: te,
|
|
1375
|
+
pdfContentErrorLabel: N,
|
|
1376
|
+
pdfContentRetryLabel: ne,
|
|
1377
|
+
xlsxFormulaLabel: re,
|
|
1378
|
+
codeContentLoadingLabel: ie,
|
|
1379
|
+
codeContentErrorLabel: P,
|
|
1380
|
+
codeContentRetryLabel: F,
|
|
1381
|
+
tableCopyLabel: I,
|
|
1382
|
+
tableCopiedLabel: ae,
|
|
1383
|
+
tableDownloadCsvLabel: R,
|
|
1384
|
+
codeBlockCopyLabel: z,
|
|
1385
|
+
codeBlockCopiedLabel: B,
|
|
1386
|
+
codeBlockDownloadLabel: V,
|
|
1387
|
+
tableScrollRegionAriaLabel: oe,
|
|
1388
|
+
mathScrollRegionAriaLabel: se,
|
|
1389
|
+
ooxmlHighlightsLabel: H,
|
|
1390
|
+
ooxmlHighlightNavigatedLabel: W
|
|
1358
1391
|
},
|
|
1359
1392
|
onDownload: fe,
|
|
1360
|
-
onCopyText:
|
|
1361
|
-
onCopyMarkdown:
|
|
1362
|
-
onCopyJson:
|
|
1363
|
-
tableDownloadFilename:
|
|
1393
|
+
onCopyText: G.type === i.PlainText || G.type === i.Code ? K : void 0,
|
|
1394
|
+
onCopyMarkdown: G.type === i.Markdown ? q : void 0,
|
|
1395
|
+
onCopyJson: G.type === i.Json ? pe : void 0,
|
|
1396
|
+
tableDownloadFilename: l,
|
|
1364
1397
|
isMobile: n,
|
|
1365
1398
|
defaultWidth: r,
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1399
|
+
minWidth: o,
|
|
1400
|
+
maxWidth: s,
|
|
1401
|
+
codeBlockTheme: c,
|
|
1402
|
+
configurePdfWorker: d,
|
|
1403
|
+
loadPdf: u,
|
|
1404
|
+
onVisualizerSendMessage: f
|
|
1371
1405
|
});
|
|
1372
|
-
}),
|
|
1406
|
+
}), dt = {
|
|
1373
1407
|
frame: "_frame_1ys0b_1",
|
|
1374
1408
|
header: "_header_1ys0b_6",
|
|
1375
1409
|
title: "_title_1ys0b_10"
|
|
1376
|
-
},
|
|
1410
|
+
}, ft = I(({ content: e, height: t, onExpand: n, expandAriaLabel: r, actionsGroupAriaLabel: i = "Visualizer actions", frameTitle: a, loadingLabel: o, errorLabel: s, titleClassName: c = "dial-small-semi-text", isBorderless: l = !1, isTitleHidden: u = !1, colors: d, onVisualizerSendMessage: f }) => {
|
|
1377
1411
|
let p = e.visualizerName.trim(), h = !u && p !== "";
|
|
1378
|
-
return /* @__PURE__ */
|
|
1379
|
-
className: _("flex w-full min-w-0 flex-col overflow-hidden", !l && ["rounded-xl border",
|
|
1412
|
+
return /* @__PURE__ */ W("div", {
|
|
1413
|
+
className: _("flex w-full min-w-0 flex-col overflow-hidden", !l && ["rounded-xl border", dt.frame]),
|
|
1380
1414
|
style: m({
|
|
1381
1415
|
"--igv-bg": d?.background,
|
|
1382
1416
|
"--igv-border": d?.border,
|
|
1383
1417
|
"--igv-title-text": d?.titleText
|
|
1384
1418
|
}),
|
|
1385
|
-
children: [/* @__PURE__ */
|
|
1386
|
-
className: _("flex min-h-10 items-center gap-2 py-2", h ? "justify-between" : "justify-end", !l && ["border-b px-4",
|
|
1387
|
-
children: [h && /* @__PURE__ */
|
|
1388
|
-
className: _("min-w-0 truncate", c,
|
|
1419
|
+
children: [/* @__PURE__ */ W("div", {
|
|
1420
|
+
className: _("flex min-h-10 items-center gap-2 py-2", h ? "justify-between" : "justify-end", !l && ["border-b px-4", dt.header]),
|
|
1421
|
+
children: [h && /* @__PURE__ */ U("span", {
|
|
1422
|
+
className: _("min-w-0 truncate", c, dt.title),
|
|
1389
1423
|
children: p
|
|
1390
|
-
}), /* @__PURE__ */
|
|
1424
|
+
}), /* @__PURE__ */ U("div", {
|
|
1391
1425
|
role: "toolbar",
|
|
1392
1426
|
"aria-label": i,
|
|
1393
1427
|
className: "flex items-center gap-1",
|
|
1394
|
-
children: /* @__PURE__ */
|
|
1395
|
-
icon: /* @__PURE__ */
|
|
1428
|
+
children: /* @__PURE__ */ U(T, {
|
|
1429
|
+
icon: /* @__PURE__ */ U(A, {
|
|
1396
1430
|
size: S.SM,
|
|
1397
1431
|
stroke: C,
|
|
1398
1432
|
"aria-hidden": !0
|
|
@@ -1402,10 +1436,10 @@ var ot = ({ children: e }) => {
|
|
|
1402
1436
|
onClick: n
|
|
1403
1437
|
})
|
|
1404
1438
|
})]
|
|
1405
|
-
}), /* @__PURE__ */
|
|
1439
|
+
}), /* @__PURE__ */ U("div", {
|
|
1406
1440
|
className: "w-full",
|
|
1407
1441
|
style: { height: `${t}px` },
|
|
1408
|
-
children: /* @__PURE__ */
|
|
1442
|
+
children: /* @__PURE__ */ U(Ie, {
|
|
1409
1443
|
content: e,
|
|
1410
1444
|
loadingLabel: o,
|
|
1411
1445
|
errorLabel: s,
|
|
@@ -1414,7 +1448,7 @@ var ot = ({ children: e }) => {
|
|
|
1414
1448
|
})
|
|
1415
1449
|
})]
|
|
1416
1450
|
});
|
|
1417
|
-
}),
|
|
1451
|
+
}), pt = (e) => {
|
|
1418
1452
|
let t;
|
|
1419
1453
|
try {
|
|
1420
1454
|
t = new URL(e).pathname;
|
|
@@ -1427,13 +1461,13 @@ var ot = ({ children: e }) => {
|
|
|
1427
1461
|
} catch {
|
|
1428
1462
|
return n;
|
|
1429
1463
|
}
|
|
1430
|
-
},
|
|
1431
|
-
let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } =
|
|
1464
|
+
}, mt = (e, t) => {
|
|
1465
|
+
let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = ct(), { customVisualizers: o, themeId: s, onBeforeOpen: l } = t, u = L(async (t, n, r) => {
|
|
1432
1466
|
if (t.url == null && t.referenceUrl != null) {
|
|
1433
1467
|
let i = e.resolveReferencePdfContent(t);
|
|
1434
1468
|
if (i != null) return r(i, t.name, n);
|
|
1435
1469
|
}
|
|
1436
|
-
let a = t.contentType.toLowerCase(), c =
|
|
1470
|
+
let a = t.contentType.toLowerCase(), c = Ae(a, o);
|
|
1437
1471
|
if (c != null) {
|
|
1438
1472
|
let i = await e.resolveVisualizerContent(t, c, s);
|
|
1439
1473
|
if (i != null) return r(i, t.name, n);
|
|
@@ -1455,43 +1489,43 @@ var ot = ({ children: e }) => {
|
|
|
1455
1489
|
case d.Markdown:
|
|
1456
1490
|
case d.MarkdownAlt: {
|
|
1457
1491
|
let i = await e.resolveMarkdownContent(t);
|
|
1458
|
-
return i
|
|
1492
|
+
return i != null && r(i, t.name, n);
|
|
1459
1493
|
}
|
|
1460
1494
|
case d.JSON: {
|
|
1461
1495
|
let i = await e.resolveJsonContent(t);
|
|
1462
|
-
return i
|
|
1496
|
+
return i != null && r(i, t.name, n);
|
|
1463
1497
|
}
|
|
1464
1498
|
case d.PDF: {
|
|
1465
1499
|
let i = await e.resolvePdfContent(t);
|
|
1466
|
-
return i
|
|
1500
|
+
return i != null && r(i, t.name, n);
|
|
1467
1501
|
}
|
|
1468
1502
|
}
|
|
1469
|
-
let g = t.name != null && Ze(t.name) || t.url != null && Ze(
|
|
1503
|
+
let g = t.name != null && Ze(t.name) || t.url != null && Ze(pt(t.url));
|
|
1470
1504
|
if (t.name != null && !Xe(t.name) && !g) return r($(e.resolveContentUrl(t)), t.name, n);
|
|
1471
1505
|
if (g) {
|
|
1472
1506
|
let a = await e.resolveHtmlContent(t);
|
|
1473
|
-
return a == null ? e.hasTextSource(t) ? r($(e.resolveContentUrl(t)), t.name, n) : t.url
|
|
1507
|
+
return a == null ? e.hasTextSource(t) ? r($(e.resolveContentUrl(t)), t.name, n) : t.url != null && r({
|
|
1474
1508
|
type: i.Html,
|
|
1475
1509
|
url: t.url
|
|
1476
1510
|
}, t.name, n) : r(a, t.name, n);
|
|
1477
1511
|
}
|
|
1478
1512
|
let _ = await e.resolveCodeContent(t, $e(m));
|
|
1479
|
-
return _
|
|
1513
|
+
return _ != null && r(_, t.name, n);
|
|
1480
1514
|
}, [
|
|
1481
1515
|
o,
|
|
1482
1516
|
s,
|
|
1483
1517
|
e
|
|
1484
1518
|
]);
|
|
1485
|
-
return { openAttachmentCanvas:
|
|
1519
|
+
return { openAttachmentCanvas: L(async (t, o = t.id, s) => {
|
|
1486
1520
|
let d = () => s == null || s(), f = (e, t, r) => d() ? (n(e, t, r), !0) : (rt(e), !1);
|
|
1487
1521
|
switch (t.type) {
|
|
1488
1522
|
case c.Image: {
|
|
1489
1523
|
let r = e.resolveImageContent(t);
|
|
1490
|
-
return r
|
|
1524
|
+
return r != null && (l?.(), n(r, t.name, o), !0);
|
|
1491
1525
|
}
|
|
1492
1526
|
case c.Audio: {
|
|
1493
1527
|
let e = t.playUrl ?? t.url;
|
|
1494
|
-
return e
|
|
1528
|
+
return e != null && (n({
|
|
1495
1529
|
type: i.Audio,
|
|
1496
1530
|
url: e,
|
|
1497
1531
|
mimeType: t.contentType || void 0
|
|
@@ -1520,4 +1554,4 @@ var ot = ({ children: e }) => {
|
|
|
1520
1554
|
]) };
|
|
1521
1555
|
};
|
|
1522
1556
|
//#endregion
|
|
1523
|
-
export {
|
|
1557
|
+
export { K as ATTACHMENT_CANVAS_CLASS, He as AttachmentCanvas, ze as AttachmentCanvasBody, ut as AttachmentCanvasContainer, st as AttachmentCanvasProvider, i as AttachmentContentType, n as AttachmentErrorType, he as CodeContent, ge as HTML_PREVIEW_FRAME_RENDER_MESSAGE, ft as InlineGroupedVisualizer, we as McpAppCanvasRenderer, r as OoxmlFileType, t as OoxmlHighlightKind, tt as createForbiddenCanvasContent, et as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, a as downloadAttachmentContent, $e as extensionToLanguage, je as findVisualizerForApplication, Ae as findVisualizerForMime, Q as getOoxmlFileType, Ye as getOoxmlMimeType, Me as groupedVisualizerCanvasKey, o as isDownloadable, Ze as isHtmlPreviewable, Je as isOoxmlPreviewable, Xe as isTextPreviewable, Ne as partitionAttachmentsForApplicationVisualizer, ct as useAttachmentCanvas, lt as useLatestCanvasRequest, mt as useOpenAttachmentCanvas };
|