@epam/ai-dial-attachment-canvas 1.4.0-dev.12 → 1.4.0-dev.124

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