@epam/ai-dial-attachment-canvas 1.3.0-dev.98 → 1.4.0-dev.5

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