@epam/ai-dial-attachment-canvas 1.2.0-dev.3 → 1.2.0-dev.300

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