@epam/ai-dial-attachment-canvas 1.2.0-dev.12 → 1.2.0-dev.15

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
@@ -17,11 +17,11 @@ var de = {
17
17
  }, fe = {
18
18
  [l.Dark]: _,
19
19
  [l.Light]: _
20
- }, pe = () => A(async () => {
20
+ }, U = () => A(async () => {
21
21
  let { Prism: e } = await import("react-syntax-highlighter");
22
22
  return { default: e };
23
- }), me = j(({ content: e, codeBlockTheme: t = l.Light, labels: n }) => {
24
- let { text: r, language: i } = e, a = i == null || i === "plaintext", o = fe[t], c = t === l.Light, [u, d] = L(0), f = F(pe, [u]), p = M(() => {
23
+ }), pe = j(({ content: e, codeBlockTheme: t = l.Light, labels: n }) => {
24
+ let { text: r, language: i } = e, a = i == null || i === "plaintext", o = fe[t], c = t === l.Light, [u, d] = L(0), f = F(U, [u]), p = M(() => {
25
25
  d((e) => e + 1);
26
26
  }, []), m = /* @__PURE__ */ R("pre", {
27
27
  className: "whitespace-pre-wrap break-words p-4",
@@ -53,7 +53,7 @@ var de = {
53
53
  })
54
54
  })
55
55
  });
56
- }), he = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ge = j(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
56
+ }), me = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, he = j(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
57
57
  let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = L(!0), [d, f] = L(!1), p = I(null);
58
58
  P(() => {
59
59
  u(!0), f(!1);
@@ -67,7 +67,7 @@ var de = {
67
67
  }, [e.srcdoc]), h = M(() => {
68
68
  u(!1), f(!0);
69
69
  }, []);
70
- if (n && e.srcdoc != null) return /* @__PURE__ */ R(me, {
70
+ if (n && e.srcdoc != null) return /* @__PURE__ */ R(pe, {
71
71
  content: {
72
72
  type: i.Code,
73
73
  text: e.srcdoc,
@@ -84,7 +84,7 @@ var de = {
84
84
  href: e.url,
85
85
  target: "_blank",
86
86
  label: c,
87
- className: he.openInNewTabButton,
87
+ className: me.openInNewTabButton,
88
88
  textClassName: o
89
89
  })]
90
90
  });
@@ -105,10 +105,10 @@ var de = {
105
105
  onError: h
106
106
  })]
107
107
  });
108
- }), _e = {
108
+ }), ge = {
109
109
  name: "MCP-UI Host",
110
110
  version: "1.0.0"
111
- }, ve = { openLinks: {} }, U = (e) => {
111
+ }, _e = { openLinks: {} }, W = (e) => {
112
112
  let t;
113
113
  try {
114
114
  t = new URL(e);
@@ -122,14 +122,14 @@ var de = {
122
122
  return !1;
123
123
  }
124
124
  return !0;
125
- }, ye = (e, t, n) => {
125
+ }, ve = (e, t, n) => {
126
126
  if (n) {
127
127
  e.style.maxWidth = "", e.style.maxHeight = "";
128
128
  return;
129
129
  }
130
130
  let r = t;
131
131
  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
- }, be = (e, t, n) => {
132
+ }, ye = (e, t, n) => {
133
133
  let r = I(e);
134
134
  P(() => {
135
135
  r.current = e;
@@ -138,15 +138,15 @@ var de = {
138
138
  return P(() => {
139
139
  let e = null;
140
140
  try {
141
- e = new B(null, _e, ve, { hostContext: r.current.hostContext }), e.onopenlink = async ({ url: e }) => {
141
+ e = new B(null, ge, _e, { hostContext: r.current.hostContext }), e.onopenlink = async ({ url: e }) => {
142
142
  let t = r.current.onOpenLink;
143
- return (t == null ? U(e) : t(e)) === !1 ? { isError: !0 } : {};
143
+ return (t == null ? W(e) : t(e)) === !1 ? { isError: !0 } : {};
144
144
  }, e.onrequestdisplaymode = async ({ mode: e }) => {
145
145
  let t = r.current.onRequestDisplayMode, n = r.current.hostContext?.displayMode ?? "inline";
146
146
  return { mode: t?.(e) ?? n };
147
147
  }, e.oncalltool = (e) => r.current.onToolCall(e.name, e.arguments), e.setNotificationHandler(ue, ({ params: e }) => {
148
148
  let n = t.current?.querySelector("iframe");
149
- n != null && ye(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
149
+ n != null && ve(n, e.containerDimensions, r.current.hostContext?.displayMode === "fullscreen");
150
150
  }), a(e);
151
151
  } catch (e) {
152
152
  console.error("[useMcpAppBridge] Error creating AppBridge:", e), s(!0);
@@ -160,12 +160,12 @@ var de = {
160
160
  appBridge: i,
161
161
  hasFailed: o
162
162
  };
163
- }, W = {
163
+ }, G = {
164
164
  loadingOverlay: "_loadingOverlay_1aric_1",
165
165
  fullscreenFrame: "_fullscreenFrame_1aric_20",
166
166
  statusLabel: "_statusLabel_1aric_27",
167
167
  errorIcon: "_errorIcon_1aric_31"
168
- }, xe = ({ content: e, errorLabel: t = "Failed to load app" }) => {
168
+ }, be = ({ content: e, errorLabel: t = "Failed to load app" }) => {
169
169
  let [n, r] = L("loading"), { html: i, sandboxUrl: a, toolInput: o, toolResult: s, hostContext: c } = e, l = F(() => ({ url: new URL(a) }), [a]), u = c?.displayMode === "fullscreen", d = I(null), [f, p] = L();
170
170
  P(() => {
171
171
  let e = d.current;
@@ -180,13 +180,13 @@ var de = {
180
180
  });
181
181
  return t.observe(e), () => t.disconnect();
182
182
  }, []);
183
- let { appBridge: m, hasFailed: h } = be(e, d, F(() => c == null || f == null ? c : {
183
+ let { appBridge: m, hasFailed: h } = ye(e, d, F(() => c == null || f == null ? c : {
184
184
  ...c,
185
185
  containerDimensions: f
186
186
  }, [c, f])), _ = h || n === "error";
187
187
  return /* @__PURE__ */ z("div", {
188
188
  ref: d,
189
- className: g("relative h-full w-full", u && W.fullscreenFrame),
189
+ className: g("relative h-full w-full", u && G.fullscreenFrame),
190
190
  children: [
191
191
  m != null && /* @__PURE__ */ R(le, {
192
192
  html: i,
@@ -199,7 +199,7 @@ var de = {
199
199
  onError: () => r("error")
200
200
  }),
201
201
  !_ && n === "loading" && /* @__PURE__ */ R("div", {
202
- className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", W.loadingOverlay),
202
+ className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", G.loadingOverlay),
203
203
  children: /* @__PURE__ */ R(T, {})
204
204
  }),
205
205
  _ && /* @__PURE__ */ z("div", {
@@ -208,16 +208,16 @@ var de = {
208
208
  size: 60,
209
209
  stroke: S,
210
210
  "aria-hidden": !0,
211
- className: W.errorIcon
211
+ className: G.errorIcon
212
212
  }), /* @__PURE__ */ R("p", {
213
213
  role: "alert",
214
- className: g("text-center", W.statusLabel),
214
+ className: g("text-center", G.statusLabel),
215
215
  children: t
216
216
  })]
217
217
  })
218
218
  ]
219
219
  });
220
- }, G = {
220
+ }, K = {
221
221
  viewer: "_viewer_1w97n_2",
222
222
  spreadsheetCanvas: "_spreadsheetCanvas_1w97n_6",
223
223
  formulaPanel: "_formulaPanel_1w97n_12",
@@ -225,13 +225,13 @@ var de = {
225
225
  statusOverlay: "_statusOverlay_1w97n_24",
226
226
  errorIcon: "_errorIcon_1w97n_29",
227
227
  highlight: "_highlight_1w97n_37"
228
- }, Se = (e) => {
228
+ }, xe = (e) => {
229
229
  if (e?.kind !== "range") return "";
230
230
  let { activeCell: t } = e.selection, n = e.cells.find(({ address: e }) => e.row === t.row && e.col === t.col);
231
231
  if (n == null) return "";
232
232
  let r = n.formula;
233
233
  return r == null || r.trim().length === 0 ? n.displayText : r.startsWith("=") ? r : `=${r}`;
234
- }, Ce = async (e, t, { onError: n, onXlsxSelectionContextChange: i }) => {
234
+ }, Se = async (e, t, { onError: n, onXlsxSelectionContextChange: i }) => {
235
235
  switch (t) {
236
236
  case r.Docx: {
237
237
  let [{ DocxScrollViewer: t }, { chartEx: r }] = await Promise.all([import("./docx-B-VcIRoc.js"), import("./chart-ex-DsESBs97.js")]);
@@ -253,7 +253,7 @@ var de = {
253
253
  }
254
254
  case r.Csv: {
255
255
  let { XlsxSheetViewer: t } = await import("./xlsx-Dn0XSlTO.js"), r = document.createElement("canvas");
256
- r.className = G.spreadsheetCanvas, e.replaceChildren(r);
256
+ r.className = K.spreadsheetCanvas, e.replaceChildren(r);
257
257
  let i = new t(r, {
258
258
  showScrollbars: !0,
259
259
  onError: n
@@ -273,7 +273,7 @@ var de = {
273
273
  });
274
274
  }
275
275
  }
276
- }, we = async (e, t, n, i) => {
276
+ }, Ce = async (e, t, n, i) => {
277
277
  let { onError: a, onXlsxSelectionContextChange: o, onGeometryInvalidated: s } = n;
278
278
  switch (t.format) {
279
279
  case r.Docx: {
@@ -282,7 +282,7 @@ var de = {
282
282
  import("./chart-ex-DsESBs97.js"),
283
283
  import("./ooxml-highlight-surfaces-CaMjx8u-.js")
284
284
  ]), l = await n.load(t.url, { chartEx: o });
285
- if (i()) throw l.destroy(), new Te();
285
+ if (i()) throw l.destroy(), new we();
286
286
  let u = r.fromDocument(e, l, {
287
287
  enableTextSelection: !0,
288
288
  refitOnResize: !0,
@@ -302,7 +302,7 @@ var de = {
302
302
  import("./chart-ex-DsESBs97.js"),
303
303
  import("./ooxml-highlight-surfaces-CaMjx8u-.js")
304
304
  ]), l = await n.load(t.url, { chartEx: o });
305
- if (i()) throw l.destroy(), new Te();
305
+ if (i()) throw l.destroy(), new we();
306
306
  let u = r.fromPresentation(e, l, {
307
307
  enableTextSelection: !0,
308
308
  refitOnResize: !0,
@@ -336,11 +336,11 @@ var de = {
336
336
  };
337
337
  }
338
338
  case r.Csv: {
339
- let r = await Ce(e, t.format, n);
339
+ let r = await Se(e, t.format, n);
340
340
  return await r.load(t.url), { viewer: r };
341
341
  }
342
342
  }
343
- }, Te = class extends Error {}, Ee = ({ content: t, fileName: n, loadErrorLabel: i, formulaLabel: a, formulaLabelClassName: o, highlightsLabel: s = "Cited locations", highlightNavigatedLabel: c = "Scrolled to the cited location" }) => {
343
+ }, 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" }) => {
344
344
  let l = I(null), [u, d] = L(!0), [f, p] = L(!1), [m, h] = L(""), [_, v] = L([]), [y, b] = L(!1), { highlights: x, selectedHighlightId: C } = t, w = x != null && x.length > 0, D = I(void 0), O = I(x);
345
345
  O.current = x;
346
346
  let k = I(void 0);
@@ -366,7 +366,7 @@ var de = {
366
366
  i || (d(!1), p(!0));
367
367
  },
368
368
  onXlsxSelectionContextChange: (e) => {
369
- i || h(Se(e));
369
+ i || h(xe(e));
370
370
  },
371
371
  onGeometryInvalidated: s
372
372
  }, f = () => {
@@ -375,14 +375,14 @@ var de = {
375
375
  return e.addEventListener("scroll", s, !0), k.current = s, (async () => {
376
376
  try {
377
377
  if (w) {
378
- let r = await we(e, t, u, o);
378
+ let r = await Ce(e, t, u, o);
379
379
  if (i) {
380
380
  r.viewer.destroy(), r.engine?.destroy();
381
381
  return;
382
382
  }
383
383
  n = r, D.current = r.highlights, f();
384
384
  } else {
385
- let r = await Ce(e, t.format, u);
385
+ let r = await Se(e, t.format, u);
386
386
  if (i) {
387
387
  r.destroy();
388
388
  return;
@@ -392,7 +392,7 @@ var de = {
392
392
  if (i) return;
393
393
  d(!1), await c();
394
394
  } catch (t) {
395
- if (t instanceof Te || i) return;
395
+ if (t instanceof we || i) return;
396
396
  n?.viewer.destroy(), n?.engine?.destroy(), n = void 0, D.current = void 0, e.replaceChildren(), d(!1), p(!0);
397
397
  }
398
398
  })(), () => {
@@ -428,7 +428,7 @@ var de = {
428
428
  t.format === r.Xlsx && /* @__PURE__ */ z("div", {
429
429
  role: "region",
430
430
  "aria-label": a,
431
- className: g("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", G.formulaPanel),
431
+ className: g("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", K.formulaPanel),
432
432
  children: [/* @__PURE__ */ R("span", {
433
433
  "aria-hidden": "true",
434
434
  className: g("shrink-0", o),
@@ -437,7 +437,7 @@ var de = {
437
437
  dir: "ltr",
438
438
  tabIndex: 0,
439
439
  "aria-live": "polite",
440
- 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),
440
+ 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", K.formulaValue),
441
441
  children: m
442
442
  })]
443
443
  }),
@@ -448,7 +448,7 @@ var de = {
448
448
  role: "document",
449
449
  "aria-label": n,
450
450
  "aria-busy": u,
451
- className: g("h-full w-full overflow-hidden", G.viewer)
451
+ className: g("h-full w-full overflow-hidden", K.viewer)
452
452
  }), _.length > 0 && /* @__PURE__ */ R("div", {
453
453
  role: "region",
454
454
  "aria-label": s,
@@ -463,7 +463,7 @@ var de = {
463
463
  },
464
464
  "data-selected": e.highlightId === C,
465
465
  "data-clipped": e.isClippedAtEnd === !0,
466
- className: g("absolute", G.highlight)
466
+ className: g("absolute", K.highlight)
467
467
  }, `${e.highlightId}-${t}`))
468
468
  })]
469
469
  }),
@@ -476,14 +476,14 @@ var de = {
476
476
  (u || f) && /* @__PURE__ */ R("div", {
477
477
  role: f ? "alert" : void 0,
478
478
  "aria-live": "polite",
479
- className: g("absolute inset-0 flex items-center justify-center", G.statusOverlay),
479
+ className: g("absolute inset-0 flex items-center justify-center", K.statusOverlay),
480
480
  children: u ? /* @__PURE__ */ R(T, { size: 48 }) : /* @__PURE__ */ z("div", {
481
481
  className: "flex flex-col items-center gap-2",
482
482
  children: [/* @__PURE__ */ R(E, {
483
483
  "aria-hidden": "true",
484
484
  size: 60,
485
485
  stroke: S,
486
- className: G.errorIcon
486
+ className: K.errorIcon
487
487
  }), /* @__PURE__ */ R("p", {
488
488
  className: "text-center",
489
489
  children: i
@@ -492,11 +492,11 @@ var de = {
492
492
  })
493
493
  ]
494
494
  });
495
- }, De = {
495
+ }, Ee = {
496
496
  loadingOverlay: "_loadingOverlay_12637_1",
497
497
  statusLabel: "_statusLabel_12637_5",
498
498
  errorIcon: "_errorIcon_12637_9"
499
- }, Oe = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", colors: r }) => {
499
+ }, De = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", colors: r }) => {
500
500
  let i = I(null), [a, o] = L("loading"), { url: s, visualizerName: c, requestTimeout: l } = e, u = I(e);
501
501
  return u.current = e, P(() => {
502
502
  let e = i.current;
@@ -540,9 +540,9 @@ var de = {
540
540
  className: "h-full w-full"
541
541
  }),
542
542
  a === "loading" && /* @__PURE__ */ z("div", {
543
- className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", De.loadingOverlay),
543
+ className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", Ee.loadingOverlay),
544
544
  children: [/* @__PURE__ */ R(T, {}), t && /* @__PURE__ */ R("p", {
545
- className: g("text-center", De.statusLabel),
545
+ className: g("text-center", Ee.statusLabel),
546
546
  children: t
547
547
  })]
548
548
  }),
@@ -552,16 +552,16 @@ var de = {
552
552
  size: 60,
553
553
  stroke: S,
554
554
  "aria-hidden": !0,
555
- className: De.errorIcon
555
+ className: Ee.errorIcon
556
556
  }), /* @__PURE__ */ R("p", {
557
557
  role: "alert",
558
- className: g("text-center", De.statusLabel),
558
+ className: g("text-center", Ee.statusLabel),
559
559
  children: n
560
560
  })]
561
561
  })
562
562
  ]
563
563
  });
564
- }, K = {
564
+ }, q = {
565
565
  body: "_body_13ogb_4",
566
566
  statusLabel: "_statusLabel_13ogb_13",
567
567
  errorIcon: "_errorIcon_13ogb_17",
@@ -576,7 +576,7 @@ var de = {
576
576
  jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
577
577
  jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
578
578
  jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
579
- }, ke = () => A(async () => ({ default: (await import("./PdfContent-D71LPAe3.js")).PdfContent })), Ae = ({ url: e, fileName: t, loadErrorLabel: n }) => {
579
+ }, Oe = () => A(async () => ({ default: (await import("./PdfContent-D71LPAe3.js")).PdfContent })), ke = ({ url: e, fileName: t, loadErrorLabel: n }) => {
580
580
  let [r, i] = L(!1);
581
581
  return P(() => {
582
582
  i(!1);
@@ -585,9 +585,9 @@ var de = {
585
585
  children: [/* @__PURE__ */ R(E, {
586
586
  size: 60,
587
587
  stroke: S,
588
- className: K.errorIcon
588
+ className: q.errorIcon
589
589
  }), /* @__PURE__ */ R("p", {
590
- className: g("text-center", K.statusLabel),
590
+ className: g("text-center", q.statusLabel),
591
591
  children: n
592
592
  })]
593
593
  }) : /* @__PURE__ */ R("img", {
@@ -596,14 +596,14 @@ var de = {
596
596
  className: "max-h-full max-w-full object-contain",
597
597
  onError: () => i(!0)
598
598
  });
599
- }, je = new Set([
599
+ }, Ae = new Set([
600
600
  i.PlainText,
601
601
  i.Code,
602
602
  i.Ooxml
603
- ]), Me = j(({ 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: D = "Formula", codeContentLoadingLabel: O, codeContentErrorLabel: k, codeContentRetryLabel: ee, tableCopyCsvLabel: te, tableCopyTxtLabel: re, tableCopyMarkdownLabel: ie, tableCopiedLabel: ae, tableDownloadCsvLabel: A, ooxmlHighlightsLabel: j, ooxmlHighlightNavigatedLabel: N } = {}, styles: P, codeBlockTheme: I, tableDownloadFilename: ce, loadPdf: B, hidePdfToolbar: le = !1, configurePdfWorker: ue }) => {
604
- let { colors: V, typography: H, bodyClassName: de, cssVars: fe } = P ?? {}, [pe, he] = L(0), _e = F(ke, [pe]), ve = M(() => {
605
- he((e) => e + 1);
606
- }, []), U = H?.fontClassName != null, ye = F(() => ({
603
+ ]), je = j(({ 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: D = "Formula", codeContentLoadingLabel: O, codeContentErrorLabel: k, codeContentRetryLabel: ee, tableCopyCsvLabel: te, tableCopyTxtLabel: re, tableCopyMarkdownLabel: ie, tableCopiedLabel: ae, tableDownloadCsvLabel: A, ooxmlHighlightsLabel: j, ooxmlHighlightNavigatedLabel: N } = {}, styles: P, codeBlockTheme: I, tableDownloadFilename: ce, loadPdf: B, hidePdfToolbar: le = !1, configurePdfWorker: ue }) => {
604
+ let { colors: V, typography: H, bodyClassName: de, cssVars: fe } = P ?? {}, [U, me] = L(0), ge = F(Oe, [U]), _e = M(() => {
605
+ me((e) => e + 1);
606
+ }, []), W = H?.fontClassName != null, ve = F(() => ({
607
607
  ...m({
608
608
  "--ac-text": V?.text,
609
609
  "--ac-status-text": V?.statusText,
@@ -628,14 +628,14 @@ var de = {
628
628
  "--ac-ooxml-highlight-bg": V?.ooxmlHighlightBackground,
629
629
  "--ac-json-collapsed-text": V?.jsonCollapsedText,
630
630
  "--ac-json-collapsed-bg": V?.jsonCollapsedBackground,
631
- "--ac-font-family": U ? void 0 : H?.fontFamily,
632
- "--ac-font-size": U ? void 0 : H?.fontSize,
633
- "--ac-font-weight": U ? void 0 : H?.fontWeight,
634
- "--ac-line-height": U ? void 0 : H?.lineHeight,
635
- "--ac-letter-spacing": U ? void 0 : H?.letterSpacing
631
+ "--ac-font-family": W ? void 0 : H?.fontFamily,
632
+ "--ac-font-size": W ? void 0 : H?.fontSize,
633
+ "--ac-font-weight": W ? void 0 : H?.fontWeight,
634
+ "--ac-line-height": W ? void 0 : H?.lineHeight,
635
+ "--ac-letter-spacing": W ? void 0 : H?.letterSpacing
636
636
  }),
637
637
  ...fe
638
- }), [P]), be = F(() => {
638
+ }), [P]), ye = F(() => {
639
639
  switch (e.type) {
640
640
  case i.Image:
641
641
  case i.Audio:
@@ -652,13 +652,13 @@ var de = {
652
652
  case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
653
653
  default: return "h-full overflow-auto p-4";
654
654
  }
655
- }, [e.type]), W = F(() => {
655
+ }, [e.type]), G = F(() => {
656
656
  switch (e.type) {
657
657
  case i.PlainText: return /* @__PURE__ */ R("pre", {
658
- className: g("whitespace-pre-wrap break-words", K.body, H?.fontClassName),
658
+ className: g("whitespace-pre-wrap break-words", q.body, H?.fontClassName),
659
659
  children: e.text
660
660
  });
661
- case i.Image: return /* @__PURE__ */ R(Ae, {
661
+ case i.Image: return /* @__PURE__ */ R(ke, {
662
662
  url: e.url,
663
663
  fileName: r,
664
664
  loadErrorLabel: c
@@ -703,30 +703,30 @@ var de = {
703
703
  dir: "ltr",
704
704
  className: "h-full overflow-auto",
705
705
  children: /* @__PURE__ */ R("div", {
706
- className: g("m-3 overflow-auto rounded-md border", K.jsonWrapper),
706
+ className: g("m-3 overflow-auto rounded-md border", q.jsonWrapper),
707
707
  children: /* @__PURE__ */ R(oe, {
708
708
  data: e.value,
709
709
  style: {
710
710
  container: g("whitespace-pre-wrap break-words p-2", H?.jsonClassName ?? "dial-code-text"),
711
711
  basicChildStyle: se.basicChildStyle,
712
712
  childFieldsContainer: "m-0 ps-3",
713
- label: g("me-1 font-semibold", K.jsonLabel),
714
- clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline", K.jsonClickableLabel),
715
- nullValue: g("italic", K.jsonNullValue),
716
- undefinedValue: g("italic", K.jsonNullValue),
717
- stringValue: K.jsonStringValue,
718
- booleanValue: K.jsonBooleanValue,
719
- numberValue: K.jsonNumberValue,
720
- otherValue: g("italic", K.jsonNullValue),
721
- punctuation: g("me-1", K.jsonPunctuation),
722
- collapseIcon: g("me-1 cursor-pointer select-none transition-colors", K.jsonCollapseIcon),
723
- expandIcon: g("me-1 cursor-pointer select-none transition-colors", K.jsonExpandIcon),
724
- collapsedContent: g("me-1 cursor-pointer rounded px-1", K.jsonCollapsedContent)
713
+ label: g("me-1 font-semibold", q.jsonLabel),
714
+ clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline", q.jsonClickableLabel),
715
+ nullValue: g("italic", q.jsonNullValue),
716
+ undefinedValue: g("italic", q.jsonNullValue),
717
+ stringValue: q.jsonStringValue,
718
+ booleanValue: q.jsonBooleanValue,
719
+ numberValue: q.jsonNumberValue,
720
+ otherValue: g("italic", q.jsonNullValue),
721
+ punctuation: g("me-1", q.jsonPunctuation),
722
+ collapseIcon: g("me-1 cursor-pointer select-none transition-colors", q.jsonCollapseIcon),
723
+ expandIcon: g("me-1 cursor-pointer select-none transition-colors", q.jsonExpandIcon),
724
+ collapsedContent: g("me-1 cursor-pointer rounded px-1", q.jsonCollapsedContent)
725
725
  }
726
726
  })
727
727
  })
728
728
  });
729
- case i.Code: return /* @__PURE__ */ R(me, {
729
+ case i.Code: return /* @__PURE__ */ R(pe, {
730
730
  content: e,
731
731
  codeBlockTheme: I,
732
732
  labels: {
@@ -735,7 +735,7 @@ var de = {
735
735
  retryLabel: ee
736
736
  }
737
737
  });
738
- case i.Html: return /* @__PURE__ */ R(ge, {
738
+ case i.Html: return /* @__PURE__ */ R(he, {
739
739
  content: e,
740
740
  labels: {
741
741
  htmlFrameBlockedLabel: f,
@@ -746,14 +746,14 @@ var de = {
746
746
  codeBlockTheme: I
747
747
  });
748
748
  case i.Pdf: return /* @__PURE__ */ R(s, {
749
- retryKey: pe,
750
- onRetry: ve,
749
+ retryKey: U,
750
+ onRetry: _e,
751
751
  labels: {
752
752
  loadingLabel: x,
753
753
  errorLabel: C,
754
754
  retryLabel: w
755
755
  },
756
- children: /* @__PURE__ */ R(_e, {
756
+ children: /* @__PURE__ */ R(ge, {
757
757
  fileName: r,
758
758
  url: e.url,
759
759
  highlights: e.highlights ?? [],
@@ -773,7 +773,7 @@ var de = {
773
773
  }
774
774
  })
775
775
  }, e.url);
776
- case i.Ooxml: return /* @__PURE__ */ R(Ee, {
776
+ case i.Ooxml: return /* @__PURE__ */ R(Te, {
777
777
  content: e,
778
778
  fileName: r,
779
779
  loadErrorLabel: c,
@@ -782,13 +782,13 @@ var de = {
782
782
  highlightsLabel: j,
783
783
  highlightNavigatedLabel: N
784
784
  });
785
- case i.Visualizer: return /* @__PURE__ */ R(Oe, {
785
+ case i.Visualizer: return /* @__PURE__ */ R(De, {
786
786
  content: e,
787
787
  errorLabel: d
788
788
  });
789
- case i.McpApp: return /* @__PURE__ */ R(xe, { content: e });
789
+ case i.McpApp: return /* @__PURE__ */ R(be, { content: e });
790
790
  case i.Unsupported: return /* @__PURE__ */ R("p", {
791
- className: g("text-center", K.statusLabel),
791
+ className: g("text-center", q.statusLabel),
792
792
  children: o
793
793
  });
794
794
  case i.Error: {
@@ -798,9 +798,9 @@ var de = {
798
798
  children: [R(t ? ne : E, {
799
799
  size: 60,
800
800
  stroke: S,
801
- className: K.errorIcon
801
+ className: q.errorIcon
802
802
  }), /* @__PURE__ */ R("p", {
803
- className: g("text-center", K.statusLabel),
803
+ className: g("text-center", q.statusLabel),
804
804
  children: t ? l : c
805
805
  })]
806
806
  });
@@ -835,9 +835,9 @@ var de = {
835
835
  O,
836
836
  k,
837
837
  ee,
838
+ ge,
839
+ U,
838
840
  _e,
839
- pe,
840
- ve,
841
841
  te,
842
842
  re,
843
843
  ie,
@@ -847,28 +847,28 @@ var de = {
847
847
  N
848
848
  ]);
849
849
  return /* @__PURE__ */ R("div", {
850
- style: !t && je.has(e.type) ? ye : void 0,
851
- className: g(t ? "flex h-full items-center justify-center" : be, de),
852
- children: t ? /* @__PURE__ */ R(T, {}) : W
850
+ style: !t && Ae.has(e.type) ? ve : void 0,
851
+ className: g(t ? "flex h-full items-center justify-center" : ye, de),
852
+ children: t ? /* @__PURE__ */ R(T, {}) : G
853
853
  });
854
- }), Ne = 2e3, Pe = j(({ 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: w = "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: ne = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: ae = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: j = "View rendered", mcpAppReloadLabel: N = "Reload", pdfThumbnailsLabel: F, pdfShowThumbnailsLabel: oe, pdfHideThumbnailsLabel: se, pdfPageNumberLabel: B, pdfContentLoadingLabel: le, pdfContentErrorLabel: ue, pdfContentRetryLabel: V, xlsxFormulaLabel: H, codeContentLoadingLabel: de, codeContentErrorLabel: fe, codeContentRetryLabel: pe, tableCopyCsvLabel: me, tableCopyTxtLabel: he, tableCopyMarkdownLabel: ge, tableCopiedLabel: _e, tableDownloadCsvLabel: ve, ooxmlHighlightsLabel: U, ooxmlHighlightNavigatedLabel: ye }, onDownload: be, onCopyText: W, onCopyMarkdown: xe, onCopyJson: G, tableDownloadFilename: Se, isMobile: Ce = !1, defaultWidth: we, minWidth: Te = 600, maxWidth: Ee = 1500, onResizeStop: De, styles: Oe, codeBlockTheme: K, loadPdf: ke, configurePdfWorker: Ae }) => {
855
- let [je, Pe] = L(!1), [Fe, Ie] = L(!1), [q, Le] = L(!1), [J, Re] = L(!1), Y = I(null), X = I(null), Z = I(null), ze = M(() => {
856
- W?.(), Y.current != null && clearTimeout(Y.current), Pe(!0), Y.current = setTimeout(() => Pe(!1), Ne);
857
- }, [W]), Be = M(() => {
858
- xe?.(), X.current != null && clearTimeout(X.current), Ie(!0), X.current = setTimeout(() => Ie(!1), Ne);
859
- }, [xe]), Ve = M(() => {
860
- G?.(), Z.current != null && clearTimeout(Z.current), Le(!0), Z.current = setTimeout(() => Le(!1), Ne);
861
- }, [G]);
854
+ }), Me = 2e3, Ne = j(({ 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: w = "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: ne = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: ae = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: j = "View rendered", mcpAppReloadLabel: N = "Reload", pdfThumbnailsLabel: F, pdfShowThumbnailsLabel: oe, pdfHideThumbnailsLabel: se, pdfPageNumberLabel: B, pdfContentLoadingLabel: le, pdfContentErrorLabel: ue, pdfContentRetryLabel: V, xlsxFormulaLabel: H, codeContentLoadingLabel: de, codeContentErrorLabel: fe, codeContentRetryLabel: U, tableCopyCsvLabel: pe, tableCopyTxtLabel: me, tableCopyMarkdownLabel: he, tableCopiedLabel: ge, tableDownloadCsvLabel: _e, ooxmlHighlightsLabel: W, ooxmlHighlightNavigatedLabel: ve }, onDownload: ye, onCopyText: G, onCopyMarkdown: be, onCopyJson: K, tableDownloadFilename: xe, isMobile: Se = !1, defaultWidth: Ce, minWidth: we = 600, maxWidth: Te = 1500, onResizeStop: Ee, styles: De, codeBlockTheme: q, loadPdf: Oe, configurePdfWorker: ke }) => {
855
+ let [Ae, Ne] = L(!1), [Pe, J] = L(!1), [Fe, Ie] = L(!1), [Y, Le] = L(!1), X = I(null), Z = I(null), Q = I(null), Re = M(() => {
856
+ G?.(), X.current != null && clearTimeout(X.current), Ne(!0), X.current = setTimeout(() => Ne(!1), Me);
857
+ }, [G]), ze = M(() => {
858
+ be?.(), Z.current != null && clearTimeout(Z.current), J(!0), Z.current = setTimeout(() => J(!1), Me);
859
+ }, [be]), Be = M(() => {
860
+ K?.(), Q.current != null && clearTimeout(Q.current), Ie(!0), Q.current = setTimeout(() => Ie(!1), Me);
861
+ }, [K]);
862
862
  P(() => () => {
863
- Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current), Z.current != null && clearTimeout(Z.current);
863
+ X.current != null && clearTimeout(X.current), Z.current != null && clearTimeout(Z.current), Q.current != null && clearTimeout(Q.current);
864
864
  }, []);
865
- let Q = M(() => {
866
- Re((e) => !e);
865
+ let Ve = M(() => {
866
+ Le((e) => !e);
867
867
  }, []);
868
868
  P(() => {
869
- Re(!1);
869
+ Le(!1);
870
870
  }, [r]);
871
- let { className: He, panelStyles: Ue, ...We } = Oe ?? {}, Ge = !t && r.type === i.Html && r.srcdoc != null, Ke = !t && W != null && (r.type === i.PlainText || r.type === i.Code), qe = !t && xe != null && r.type === i.Markdown, $ = !t && G != null && r.type === i.Json, Je = !t && be != null && o(r), Ye = !t && r.type === i.McpApp && r.onReload != null;
871
+ let { className: $, panelStyles: He, ...Ue } = De ?? {}, We = !t && r.type === i.Html && r.srcdoc != null, Ge = !t && G != null && (r.type === i.PlainText || r.type === i.Code), Ke = !t && be != null && r.type === i.Markdown, qe = !t && K != null && r.type === i.Json, Je = !t && ye != null && o(r), Ye = !t && r.type === i.McpApp && r.onReload != null;
872
872
  return /* @__PURE__ */ R(b, {
873
873
  isOpen: e,
874
874
  orientation: y.Right,
@@ -879,18 +879,18 @@ var de = {
879
879
  resizeLabel: l
880
880
  },
881
881
  onClose: n,
882
- resizable: !Ce,
883
- defaultWidth: we,
884
- minWidth: Te,
885
- maxWidth: Ee,
886
- onResizeStop: De,
882
+ resizable: !Se,
883
+ defaultWidth: Ce,
884
+ minWidth: we,
885
+ maxWidth: Te,
886
+ onResizeStop: Ee,
887
887
  styles: {
888
- ...Ue,
889
- titleClassName: Ue?.titleClassName ?? "dial-h3-text",
890
- headerClassName: g("border-b border-tertiary", Ue?.headerClassName),
891
- className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0", He, Ue?.className)
888
+ ...He,
889
+ titleClassName: He?.titleClassName ?? "dial-h3-text",
890
+ headerClassName: g("border-b border-tertiary", He?.headerClassName),
891
+ className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0", $, He?.className)
892
892
  },
893
- rightActions: Ge || Ke || qe || $ || Je || Ye ? /* @__PURE__ */ z(ce, { children: [
893
+ rightActions: We || Ge || Ke || qe || Je || Ye ? /* @__PURE__ */ z(ce, { children: [
894
894
  Ye && /* @__PURE__ */ R(C, {
895
895
  icon: /* @__PURE__ */ R(ie, {
896
896
  size: x.LG,
@@ -901,46 +901,46 @@ var de = {
901
901
  tooltipProps: { tooltip: N },
902
902
  onClick: r.type === i.McpApp ? r.onReload : void 0
903
903
  }),
904
- Ge && /* @__PURE__ */ R(C, {
905
- icon: R(J ? te : O, {
904
+ We && /* @__PURE__ */ R(C, {
905
+ icon: R(Y ? te : O, {
906
906
  size: x.LG,
907
907
  stroke: S,
908
908
  "aria-hidden": !0
909
909
  }),
910
- "aria-label": J ? j : A,
911
- "aria-pressed": J,
912
- tooltipProps: { tooltip: J ? j : A },
913
- onClick: Q
910
+ "aria-label": Y ? j : A,
911
+ "aria-pressed": Y,
912
+ tooltipProps: { tooltip: Y ? j : A },
913
+ onClick: Ve
914
914
  }),
915
- Ke && /* @__PURE__ */ R(C, {
916
- icon: R(je ? D : k, {
915
+ Ge && /* @__PURE__ */ R(C, {
916
+ icon: R(Ae ? D : k, {
917
917
  size: x.LG,
918
918
  stroke: S,
919
919
  "aria-hidden": !0
920
920
  }),
921
- "aria-label": je ? f : d,
922
- tooltipProps: { tooltip: je ? f : d },
923
- onClick: ze
921
+ "aria-label": Ae ? f : d,
922
+ tooltipProps: { tooltip: Ae ? f : d },
923
+ onClick: Re
924
924
  }),
925
- qe && /* @__PURE__ */ R(C, {
926
- icon: R(Fe ? D : re, {
925
+ Ke && /* @__PURE__ */ R(C, {
926
+ icon: R(Pe ? D : re, {
927
927
  size: x.LG,
928
928
  stroke: S,
929
929
  "aria-hidden": !0
930
930
  }),
931
- "aria-label": Fe ? m : p,
932
- tooltipProps: { tooltip: Fe ? m : p },
933
- onClick: Be
931
+ "aria-label": Pe ? m : p,
932
+ tooltipProps: { tooltip: Pe ? m : p },
933
+ onClick: ze
934
934
  }),
935
- $ && /* @__PURE__ */ R(C, {
936
- icon: R(q ? D : k, {
935
+ qe && /* @__PURE__ */ R(C, {
936
+ icon: R(Fe ? D : k, {
937
937
  size: x.LG,
938
938
  stroke: S,
939
939
  "aria-hidden": !0
940
940
  }),
941
- "aria-label": q ? _ : h,
942
- tooltipProps: { tooltip: q ? _ : h },
943
- onClick: Ve
941
+ "aria-label": Fe ? _ : h,
942
+ tooltipProps: { tooltip: Fe ? _ : h },
943
+ onClick: Be
944
944
  }),
945
945
  Je && /* @__PURE__ */ R(C, {
946
946
  icon: /* @__PURE__ */ R(ee, {
@@ -949,14 +949,14 @@ var de = {
949
949
  }),
950
950
  "aria-label": u,
951
951
  tooltipProps: { tooltip: u },
952
- onClick: be
952
+ onClick: ye
953
953
  })
954
954
  ] }) : null,
955
- children: /* @__PURE__ */ R(Me, {
955
+ children: /* @__PURE__ */ R(je, {
956
956
  content: r,
957
957
  isLoading: t,
958
958
  fileName: a,
959
- isHtmlSourceView: J,
959
+ isHtmlSourceView: Y,
960
960
  labels: {
961
961
  unsupportedLabel: w,
962
962
  loadErrorLabel: T,
@@ -974,41 +974,139 @@ var de = {
974
974
  xlsxFormulaLabel: H,
975
975
  codeContentLoadingLabel: de,
976
976
  codeContentErrorLabel: fe,
977
- codeContentRetryLabel: pe,
978
- tableCopyCsvLabel: me,
979
- tableCopyTxtLabel: he,
980
- tableCopyMarkdownLabel: ge,
981
- tableCopiedLabel: _e,
982
- tableDownloadCsvLabel: ve,
983
- ooxmlHighlightsLabel: U,
984
- ooxmlHighlightNavigatedLabel: ye
977
+ codeContentRetryLabel: U,
978
+ tableCopyCsvLabel: pe,
979
+ tableCopyTxtLabel: me,
980
+ tableCopyMarkdownLabel: he,
981
+ tableCopiedLabel: ge,
982
+ tableDownloadCsvLabel: _e,
983
+ ooxmlHighlightsLabel: W,
984
+ ooxmlHighlightNavigatedLabel: ve
985
985
  },
986
- styles: We,
987
- codeBlockTheme: K,
988
- tableDownloadFilename: Se,
989
- loadPdf: ke,
990
- configurePdfWorker: Ae
986
+ styles: Ue,
987
+ codeBlockTheme: q,
988
+ tableDownloadFilename: xe,
989
+ loadPdf: Oe,
990
+ configurePdfWorker: ke
991
991
  })
992
992
  });
993
- }), Fe = {
993
+ }), Pe = new Set(["html", "htm"]), J = {
994
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
995
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
996
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
997
+ }, Fe = 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(".")), Ie = {
998
+ docx: r.Docx,
999
+ xlsx: r.Xlsx,
1000
+ pptx: r.Pptx,
1001
+ csv: r.Csv
1002
+ }, Y = {
1003
+ [J.docx]: r.Docx,
1004
+ [J.xlsx]: r.Xlsx,
1005
+ [J.pptx]: r.Pptx,
1006
+ [f.CSV]: r.Csv
1007
+ }, Le = {
1008
+ [r.Docx]: J.docx,
1009
+ [r.Xlsx]: J.xlsx,
1010
+ [r.Pptx]: J.pptx,
1011
+ [r.Csv]: f.CSV
1012
+ }, X = (e, t) => {
1013
+ let n = t?.split(";", 1)[0].trim().toLowerCase();
1014
+ if (n != null) {
1015
+ let e = Y[n];
1016
+ if (e != null) return e;
1017
+ }
1018
+ let r = e.lastIndexOf(".");
1019
+ if (r !== -1) return Ie[e.slice(r + 1).toLowerCase()];
1020
+ }, Z = (e, t) => X(e, t) != null, Q = (e, t) => {
1021
+ let n = X(e, t);
1022
+ return n == null ? void 0 : Le[n];
1023
+ }, Re = (e) => {
1024
+ let t = e.lastIndexOf(".");
1025
+ return t === -1 ? !1 : Fe.has(e.slice(t + 1).toLowerCase());
1026
+ }, ze = (e) => {
1027
+ let t = e.lastIndexOf(".");
1028
+ return t === -1 ? !1 : Pe.has(e.slice(t + 1).toLowerCase());
1029
+ }, Be = {
1030
+ xml: "xml",
1031
+ csv: "plaintext",
1032
+ tsv: "plaintext",
1033
+ yaml: "yaml",
1034
+ yml: "yaml",
1035
+ toml: "toml",
1036
+ ini: "ini",
1037
+ conf: "ini",
1038
+ cfg: "ini",
1039
+ css: "css",
1040
+ scss: "css",
1041
+ sass: "css",
1042
+ less: "css",
1043
+ js: "javascript",
1044
+ mjs: "javascript",
1045
+ cjs: "javascript",
1046
+ jsx: "jsx",
1047
+ ts: "typescript",
1048
+ mts: "typescript",
1049
+ cts: "typescript",
1050
+ tsx: "tsx",
1051
+ py: "python",
1052
+ rb: "ruby",
1053
+ go: "go",
1054
+ rs: "rust",
1055
+ java: "java",
1056
+ kt: "kotlin",
1057
+ swift: "swift",
1058
+ c: "c",
1059
+ h: "c",
1060
+ cpp: "cpp",
1061
+ cs: "csharp",
1062
+ sh: "bash",
1063
+ bash: "bash",
1064
+ zsh: "bash",
1065
+ fish: "bash",
1066
+ ps1: "bash",
1067
+ sql: "sql",
1068
+ json: "json",
1069
+ jsonl: "json",
1070
+ ndjson: "json",
1071
+ txt: "plaintext",
1072
+ log: "plaintext",
1073
+ env: "plaintext",
1074
+ gitignore: "plaintext",
1075
+ dockerfile: "plaintext",
1076
+ makefile: "plaintext"
1077
+ }, Ve = (e) => Be[e], $ = (e) => ({
1078
+ type: i.Unsupported,
1079
+ ...e != null && { url: e }
1080
+ }), He = (e) => ({
1081
+ type: i.Error,
1082
+ errorType: n.LoadFailed,
1083
+ ...e != null && { url: e }
1084
+ }), Ue = (e) => ({
1085
+ type: i.Error,
1086
+ errorType: n.Forbidden,
1087
+ ...e != null && { url: e }
1088
+ }), We = (e) => {
1089
+ 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;
1090
+ }, Ge = (e) => {
1091
+ let t = We(e);
1092
+ t != null && URL.revokeObjectURL(t);
1093
+ }, Ke = {
994
1094
  type: i.PlainText,
995
1095
  text: ""
996
- }, Ie = (e) => {
997
- 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;
998
- }, q = ae(void 0);
999
- q.displayName = "AttachmentCanvasContext";
1000
- var Le = ({ children: e }) => {
1001
- let [t, n] = L(!1), [r, i] = L(!1), [a, o] = L(Fe), [s, c] = L(void 0), [l, u] = L(void 0), d = M((e, t) => {
1096
+ }, qe = ae(void 0);
1097
+ qe.displayName = "AttachmentCanvasContext";
1098
+ var Je = ({ children: e }) => {
1099
+ let [t, n] = L(!1), [r, i] = L(!1), [a, o] = L(Ke), [s, c] = L(void 0), [l, u] = L(void 0), d = M((e, t) => {
1002
1100
  c(e), u(t), i(!0), n(!0);
1003
1101
  }, []), f = M((e, t, r) => {
1004
1102
  o(e), c(t), u(r), i(!1), n(!0);
1005
1103
  }, []), p = M(() => {
1006
- o(Fe), n(!1), i(!1), u(void 0);
1104
+ o(Ke), n(!1), i(!1), u(void 0);
1007
1105
  }, []);
1008
1106
  return P(() => () => {
1009
- let e = Ie(a);
1107
+ let e = We(a);
1010
1108
  e != null && URL.revokeObjectURL(e);
1011
- }, [a]), /* @__PURE__ */ R(q.Provider, {
1109
+ }, [a]), /* @__PURE__ */ R(qe.Provider, {
1012
1110
  value: F(() => ({
1013
1111
  isOpen: t,
1014
1112
  isLoading: r,
@@ -1030,12 +1128,12 @@ var Le = ({ children: e }) => {
1030
1128
  ]),
1031
1129
  children: e
1032
1130
  });
1033
- }, J = () => {
1034
- let e = N(q);
1131
+ }, Ye = () => {
1132
+ let e = N(qe);
1035
1133
  if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
1036
1134
  return e;
1037
- }, Re = j(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
1038
- let { ariaLabel: l = "Attachment preview", closeLabel: u = "Close", downloadLabel: d = "Download", unsupportedLabel: f = "Preview is not supported for this file", loadErrorLabel: p = "Failed to load file", forbiddenErrorLabel: 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: A, tableCopyCsvLabel: j, tableCopyTxtLabel: N, tableCopyMarkdownLabel: P, tableCopiedLabel: F, tableDownloadCsvLabel: I, ooxmlHighlightsLabel: L, ooxmlHighlightNavigatedLabel: oe } = e ?? {}, { isOpen: se, isLoading: ce, content: z, fileName: B, closeCanvas: le } = J(), ue = M(() => {
1135
+ }, Xe = j(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s, configurePdfWorker: c }) => {
1136
+ 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: A, tableCopyCsvLabel: j, tableCopyTxtLabel: N, tableCopyMarkdownLabel: P, tableCopiedLabel: F, tableDownloadCsvLabel: I, ooxmlHighlightsLabel: L, ooxmlHighlightNavigatedLabel: oe } = e ?? {}, { isOpen: se, isLoading: ce, content: z, fileName: B, closeCanvas: le } = Ye(), ue = M(() => {
1039
1137
  a(z, B);
1040
1138
  }, [z, B]), V = M(() => {
1041
1139
  (z.type === i.PlainText || z.type === i.Code) && h(z.text);
@@ -1044,7 +1142,7 @@ var Le = ({ children: e }) => {
1044
1142
  }, [z]), de = M(() => {
1045
1143
  z.type === i.Json && h(JSON.stringify(z.value, null, 2));
1046
1144
  }, [z]);
1047
- return /* @__PURE__ */ R(Pe, {
1145
+ return /* @__PURE__ */ R(Ne, {
1048
1146
  isOpen: se,
1049
1147
  isLoading: ce,
1050
1148
  onClose: le,
@@ -1097,105 +1195,10 @@ var Le = ({ children: e }) => {
1097
1195
  codeBlockTheme: o,
1098
1196
  configurePdfWorker: c
1099
1197
  });
1100
- }), Y = new Set(["html", "htm"]), X = {
1101
- docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1102
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1103
- pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
1104
- }, 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(".")), ze = {
1105
- docx: r.Docx,
1106
- xlsx: r.Xlsx,
1107
- pptx: r.Pptx,
1108
- csv: r.Csv
1109
- }, Be = {
1110
- [X.docx]: r.Docx,
1111
- [X.xlsx]: r.Xlsx,
1112
- [X.pptx]: r.Pptx,
1113
- [f.CSV]: r.Csv
1114
- }, Ve = {
1115
- [r.Docx]: X.docx,
1116
- [r.Xlsx]: X.xlsx,
1117
- [r.Pptx]: X.pptx,
1118
- [r.Csv]: f.CSV
1119
- }, Q = (e, t) => {
1120
- let n = t?.split(";", 1)[0].trim().toLowerCase();
1121
- if (n != null) {
1122
- let e = Be[n];
1123
- if (e != null) return e;
1124
- }
1125
- let r = e.lastIndexOf(".");
1126
- if (r !== -1) return ze[e.slice(r + 1).toLowerCase()];
1127
- }, He = (e, t) => Q(e, t) != null, Ue = (e, t) => {
1128
- let n = Q(e, t);
1129
- return n == null ? void 0 : Ve[n];
1130
- }, We = (e) => {
1131
- let t = e.lastIndexOf(".");
1132
- return t === -1 ? !1 : Z.has(e.slice(t + 1).toLowerCase());
1133
- }, Ge = (e) => {
1134
- let t = e.lastIndexOf(".");
1135
- return t === -1 ? !1 : Y.has(e.slice(t + 1).toLowerCase());
1136
- }, Ke = {
1137
- xml: "xml",
1138
- csv: "plaintext",
1139
- tsv: "plaintext",
1140
- yaml: "yaml",
1141
- yml: "yaml",
1142
- toml: "toml",
1143
- ini: "ini",
1144
- conf: "ini",
1145
- cfg: "ini",
1146
- css: "css",
1147
- scss: "css",
1148
- sass: "css",
1149
- less: "css",
1150
- js: "javascript",
1151
- mjs: "javascript",
1152
- cjs: "javascript",
1153
- jsx: "jsx",
1154
- ts: "typescript",
1155
- mts: "typescript",
1156
- cts: "typescript",
1157
- tsx: "tsx",
1158
- py: "python",
1159
- rb: "ruby",
1160
- go: "go",
1161
- rs: "rust",
1162
- java: "java",
1163
- kt: "kotlin",
1164
- swift: "swift",
1165
- c: "c",
1166
- h: "c",
1167
- cpp: "cpp",
1168
- cs: "csharp",
1169
- sh: "bash",
1170
- bash: "bash",
1171
- zsh: "bash",
1172
- fish: "bash",
1173
- ps1: "bash",
1174
- sql: "sql",
1175
- json: "json",
1176
- jsonl: "json",
1177
- ndjson: "json",
1178
- txt: "plaintext",
1179
- log: "plaintext",
1180
- env: "plaintext",
1181
- gitignore: "plaintext",
1182
- dockerfile: "plaintext",
1183
- makefile: "plaintext"
1184
- }, qe = (e) => Ke[e], $ = (e) => ({
1185
- type: i.Unsupported,
1186
- ...e != null && { url: e }
1187
- }), Je = (e) => ({
1188
- type: i.Error,
1189
- errorType: n.LoadFailed,
1190
- ...e != null && { url: e }
1191
- }), Ye = (e) => ({
1192
- type: i.Error,
1193
- errorType: n.Forbidden,
1194
- ...e != null && { url: e }
1195
- }), Xe = (e, t) => {
1198
+ }), Ze = (e, t) => {
1196
1199
  let n = e.toLowerCase();
1197
1200
  return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
1198
- }, Ze = (e) => {
1201
+ }, Qe = (e) => {
1199
1202
  let t;
1200
1203
  try {
1201
1204
  t = new URL(e).pathname;
@@ -1208,63 +1211,63 @@ var Le = ({ children: e }) => {
1208
1211
  } catch {
1209
1212
  return n;
1210
1213
  }
1211
- }, Qe = (e, t) => {
1212
- let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = J(), { customVisualizers: o, themeId: s, onBeforeOpen: l } = t, u = M(async (t, r) => {
1214
+ }, $e = (e, t) => {
1215
+ let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = Ye(), { customVisualizers: o, themeId: s, onBeforeOpen: l } = t, u = M(async (t, n, r) => {
1213
1216
  if (t.url == null && t.referenceUrl != null) {
1214
1217
  let i = e.resolveReferencePdfContent(t);
1215
- if (i != null) return n(i, t.name, r), !0;
1218
+ if (i != null) return r(i, t.name, n);
1216
1219
  }
1217
- let a = t.contentType.toLowerCase(), c = Xe(a, o);
1220
+ let a = t.contentType.toLowerCase(), c = Ze(a, o);
1218
1221
  if (c != null) {
1219
1222
  let i = await e.resolveVisualizerContent(t, c, s);
1220
- if (i != null) return n(i, t.name, r), !0;
1223
+ if (i != null) return r(i, t.name, n);
1221
1224
  }
1222
1225
  if (!a && t.data != null) {
1223
1226
  let i = await e.resolveTextContent(t);
1224
- if (i != null) return n(i, t.name, r), !0;
1227
+ if (i != null) return r(i, t.name, n);
1225
1228
  }
1226
- let l = Q("", a);
1227
- if (l != null) return n(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
1229
+ let l = X("", a);
1230
+ if (l != null) return r(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, n);
1228
1231
  switch (a) {
1229
- case f.PDF: return n(await e.resolvePdfContent(t) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
1230
- case f.Markdown: return n(await e.resolveMarkdownContent(t) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
1231
- case f.JSON: return n(await e.resolveJsonContent(t) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
1232
+ case f.PDF: return r(await e.resolvePdfContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
1233
+ case f.Markdown: return r(await e.resolveMarkdownContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
1234
+ case f.JSON: return r(await e.resolveJsonContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
1232
1235
  }
1233
- let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h = Q(u);
1234
- if (h != null) return n(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name, r), !0;
1236
+ let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h = X(u);
1237
+ if (h != null) return r(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name, n);
1235
1238
  switch (m) {
1236
1239
  case d.Markdown:
1237
1240
  case d.MarkdownAlt: {
1238
1241
  let i = await e.resolveMarkdownContent(t);
1239
- return i == null ? !1 : (n(i, t.name, r), !0);
1242
+ return i == null ? !1 : r(i, t.name, n);
1240
1243
  }
1241
1244
  case d.JSON: {
1242
1245
  let i = await e.resolveJsonContent(t);
1243
- return i == null ? !1 : (n(i, t.name, r), !0);
1246
+ return i == null ? !1 : r(i, t.name, n);
1244
1247
  }
1245
1248
  case d.PDF: {
1246
1249
  let i = await e.resolvePdfContent(t);
1247
- return i == null ? !1 : (n(i, t.name, r), !0);
1250
+ return i == null ? !1 : r(i, t.name, n);
1248
1251
  }
1249
1252
  }
1250
- let g = t.name != null && Ge(t.name) || t.url != null && Ge(Ze(t.url));
1251
- if (t.name != null && !We(t.name) && !g) return n($(e.resolveContentUrl(t)), t.name, r), !0;
1253
+ let g = t.name != null && ze(t.name) || t.url != null && ze(Qe(t.url));
1254
+ if (t.name != null && !Re(t.name) && !g) return r($(e.resolveContentUrl(t)), t.name, n);
1252
1255
  if (g) {
1253
1256
  let a = await e.resolveHtmlContent(t);
1254
- return a == null ? e.hasTextSource(t) ? (n($(e.resolveContentUrl(t)), t.name, r), !0) : t.url == null ? !1 : (n({
1257
+ return a == null ? e.hasTextSource(t) ? r($(e.resolveContentUrl(t)), t.name, n) : t.url == null ? !1 : r({
1255
1258
  type: i.Html,
1256
1259
  url: t.url
1257
- }, t.name, r), !0) : (n(a, t.name, r), !0);
1260
+ }, t.name, n) : r(a, t.name, n);
1258
1261
  }
1259
- let _ = await e.resolveCodeContent(t, qe(m));
1260
- return _ == null ? !1 : (n(_, t.name, r), !0);
1262
+ let _ = await e.resolveCodeContent(t, Ve(m));
1263
+ return _ == null ? !1 : r(_, t.name, n);
1261
1264
  }, [
1262
- n,
1263
1265
  o,
1264
1266
  s,
1265
1267
  e
1266
1268
  ]);
1267
- return { openAttachmentCanvas: M(async (t, o = t.id) => {
1269
+ return { openAttachmentCanvas: M(async (t, o = t.id, s) => {
1270
+ let d = () => s == null || s(), f = (e, t, r) => d() ? (n(e, t, r), !0) : (Ge(e), !1);
1268
1271
  switch (t.type) {
1269
1272
  case c.Image: {
1270
1273
  let r = e.resolveImageContent(t);
@@ -1280,14 +1283,14 @@ var Le = ({ children: e }) => {
1280
1283
  }
1281
1284
  case c.File: {
1282
1285
  l?.(), r(t.name, o);
1283
- let e = await u(t, o);
1284
- return e || a(), e;
1286
+ let e = await u(t, o, f);
1287
+ return !e && d() && a(), e;
1285
1288
  }
1286
1289
  case c.Pasted:
1287
1290
  case c.Prompt: {
1288
1291
  l?.(), r(t.name, o);
1289
- let i = await e.resolveTextContent(t);
1290
- return i == null ? (a(), !1) : (n(i, t.name, o), !0);
1292
+ let n = await e.resolveTextContent(t);
1293
+ return n == null ? (d() && a(), !1) : f(n, t.name, o);
1291
1294
  }
1292
1295
  default: return !1;
1293
1296
  }
@@ -1301,4 +1304,4 @@ var Le = ({ children: e }) => {
1301
1304
  ]) };
1302
1305
  };
1303
1306
  //#endregion
1304
- export { Pe as AttachmentCanvas, Me as AttachmentCanvasBody, Re as AttachmentCanvasContainer, Le as AttachmentCanvasProvider, i as AttachmentContentType, n as AttachmentErrorType, me as CodeContent, xe as McpAppCanvasRenderer, r as OoxmlFileType, t as OoxmlHighlightKind, Ye as createForbiddenCanvasContent, Je as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, a as downloadAttachmentContent, qe as extensionToLanguage, Xe as findVisualizerForMime, Q as getOoxmlFileType, Ue as getOoxmlMimeType, o as isDownloadable, Ge as isHtmlPreviewable, He as isOoxmlPreviewable, We as isTextPreviewable, J as useAttachmentCanvas, Qe as useOpenAttachmentCanvas };
1307
+ export { Ne as AttachmentCanvas, je as AttachmentCanvasBody, Xe as AttachmentCanvasContainer, Je as AttachmentCanvasProvider, i as AttachmentContentType, n as AttachmentErrorType, pe as CodeContent, be as McpAppCanvasRenderer, r as OoxmlFileType, t as OoxmlHighlightKind, Ue as createForbiddenCanvasContent, He as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, a as downloadAttachmentContent, Ve as extensionToLanguage, Ze as findVisualizerForMime, X as getOoxmlFileType, Q as getOoxmlMimeType, o as isDownloadable, ze as isHtmlPreviewable, Z as isOoxmlPreviewable, Re as isTextPreviewable, Ye as useAttachmentCanvas, $e as useOpenAttachmentCanvas };