@epam/ai-dial-attachment-canvas 1.3.0-dev.294 → 1.3.0-dev.304

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