@epam/ai-dial-attachment-canvas 1.2.0-dev.1 → 1.2.0-dev.101

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