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

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