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