@epam/ai-dial-attachment-canvas 1.1.11 → 1.1.13
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/components/AttachmentCanvas/AttachmentCanvas.d.ts.map +1 -1
- package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts.map +1 -1
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts +2 -0
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts.map +1 -1
- package/components/InlineGroupedVisualizer/InlineGroupedVisualizer.d.ts +6 -0
- package/components/InlineGroupedVisualizer/InlineGroupedVisualizer.d.ts.map +1 -1
- package/components/VisualizerCanvasRenderer/VisualizerCanvasRenderer.d.ts +2 -0
- package/components/VisualizerCanvasRenderer/VisualizerCanvasRenderer.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.js +319 -305
- package/models/attachment-canvas.d.ts +4 -0
- package/models/attachment-canvas.d.ts.map +1 -1
- package/package.json +3 -3
- package/utils/visualizer.d.ts +6 -0
- package/utils/visualizer.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -9,9 +9,9 @@ import { JsonView as se, defaultStyles as ce } from "react-json-view-lite";
|
|
|
9
9
|
import { Fragment as le, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
10
10
|
import { AppBridge as V, AppFrame as H } from "@mcp-ui/client";
|
|
11
11
|
import { McpUiHostContextChangedNotificationSchema as U } from "@modelcontextprotocol/ext-apps/app-bridge";
|
|
12
|
-
import { VisualizerConnectorRequests as ue } from "@epam/ai-dial-shared";
|
|
12
|
+
import { VisualizerConnectorEvents as W, VisualizerConnectorRequests as ue } from "@epam/ai-dial-shared";
|
|
13
13
|
import { VisualizerConnector as de } from "@epam/ai-dial-visualizer-connector";
|
|
14
|
-
var
|
|
14
|
+
var G = {
|
|
15
15
|
container: "_container_1nhig_1",
|
|
16
16
|
containerLight: "_containerLight_1nhig_5"
|
|
17
17
|
}, fe = {
|
|
@@ -29,7 +29,7 @@ var W = {
|
|
|
29
29
|
});
|
|
30
30
|
return /* @__PURE__ */ z("div", {
|
|
31
31
|
dir: "ltr",
|
|
32
|
-
className: g("h-full overflow-auto",
|
|
32
|
+
className: g("h-full overflow-auto", G.container, c && G.containerLight),
|
|
33
33
|
children: a ? m : /* @__PURE__ */ z(s, {
|
|
34
34
|
retryKey: u,
|
|
35
35
|
onRetry: p,
|
|
@@ -105,7 +105,7 @@ var W = {
|
|
|
105
105
|
onError: h
|
|
106
106
|
})]
|
|
107
107
|
});
|
|
108
|
-
}),
|
|
108
|
+
}), K = {
|
|
109
109
|
name: "MCP-UI Host",
|
|
110
110
|
version: "1.0.0"
|
|
111
111
|
}, _e = { openLinks: {} }, ve = (e) => {
|
|
@@ -138,7 +138,7 @@ var W = {
|
|
|
138
138
|
return F(() => {
|
|
139
139
|
let e = null;
|
|
140
140
|
try {
|
|
141
|
-
e = new V(null,
|
|
141
|
+
e = new V(null, K, _e, { hostContext: r.current.hostContext }), e.onopenlink = async ({ url: e }) => {
|
|
142
142
|
let t = r.current.onOpenLink;
|
|
143
143
|
return (t == null ? ve(e) : t(e)) === !1 ? { isError: !0 } : {};
|
|
144
144
|
}, e.onrequestdisplaymode = async ({ mode: e }) => {
|
|
@@ -160,7 +160,7 @@ var W = {
|
|
|
160
160
|
appBridge: i,
|
|
161
161
|
hasFailed: o
|
|
162
162
|
};
|
|
163
|
-
},
|
|
163
|
+
}, q = {
|
|
164
164
|
loadingOverlay: "_loadingOverlay_1aric_1",
|
|
165
165
|
fullscreenFrame: "_fullscreenFrame_1aric_20",
|
|
166
166
|
statusLabel: "_statusLabel_1aric_27",
|
|
@@ -186,7 +186,7 @@ var W = {
|
|
|
186
186
|
}, [c, f])), _ = h || n === "error";
|
|
187
187
|
return /* @__PURE__ */ B("div", {
|
|
188
188
|
ref: d,
|
|
189
|
-
className: g("relative h-full w-full", u &&
|
|
189
|
+
className: g("relative h-full w-full", u && q.fullscreenFrame),
|
|
190
190
|
children: [
|
|
191
191
|
m != null && /* @__PURE__ */ z(H, {
|
|
192
192
|
html: i,
|
|
@@ -199,7 +199,7 @@ var W = {
|
|
|
199
199
|
onError: () => r("error")
|
|
200
200
|
}),
|
|
201
201
|
!_ && n === "loading" && /* @__PURE__ */ z("div", {
|
|
202
|
-
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
202
|
+
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", q.loadingOverlay),
|
|
203
203
|
children: /* @__PURE__ */ z(E, {})
|
|
204
204
|
}),
|
|
205
205
|
_ && /* @__PURE__ */ B("div", {
|
|
@@ -208,16 +208,16 @@ var W = {
|
|
|
208
208
|
size: 60,
|
|
209
209
|
stroke: S,
|
|
210
210
|
"aria-hidden": !0,
|
|
211
|
-
className:
|
|
211
|
+
className: q.errorIcon
|
|
212
212
|
}), /* @__PURE__ */ z("p", {
|
|
213
213
|
role: "alert",
|
|
214
|
-
className: g("text-center",
|
|
214
|
+
className: g("text-center", q.statusLabel),
|
|
215
215
|
children: t
|
|
216
216
|
})]
|
|
217
217
|
})
|
|
218
218
|
]
|
|
219
219
|
});
|
|
220
|
-
},
|
|
220
|
+
}, J = {
|
|
221
221
|
viewer: "_viewer_1w97n_2",
|
|
222
222
|
spreadsheetCanvas: "_spreadsheetCanvas_1w97n_6",
|
|
223
223
|
formulaPanel: "_formulaPanel_1w97n_12",
|
|
@@ -253,7 +253,7 @@ var W = {
|
|
|
253
253
|
}
|
|
254
254
|
case r.Csv: {
|
|
255
255
|
let { XlsxSheetViewer: t } = await import("@silurus/ooxml/xlsx"), r = document.createElement("canvas");
|
|
256
|
-
r.className =
|
|
256
|
+
r.className = J.spreadsheetCanvas, e.replaceChildren(r);
|
|
257
257
|
let i = new t(r, {
|
|
258
258
|
showScrollbars: !0,
|
|
259
259
|
onError: n
|
|
@@ -435,7 +435,7 @@ var W = {
|
|
|
435
435
|
t.format === r.Xlsx && /* @__PURE__ */ B("div", {
|
|
436
436
|
role: "region",
|
|
437
437
|
"aria-label": a,
|
|
438
|
-
className: g("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2",
|
|
438
|
+
className: g("flex min-w-0 shrink-0 items-center gap-2 border-b px-3 py-2", J.formulaPanel),
|
|
439
439
|
children: [/* @__PURE__ */ z("span", {
|
|
440
440
|
"aria-hidden": "true",
|
|
441
441
|
className: g("shrink-0", o),
|
|
@@ -444,7 +444,7 @@ var W = {
|
|
|
444
444
|
dir: "ltr",
|
|
445
445
|
tabIndex: 0,
|
|
446
446
|
"aria-live": "polite",
|
|
447
|
-
className: g("h-8 min-w-0 flex-1 overflow-x-auto whitespace-nowrap rounded border px-2 py-1 text-sm focus-visible:outline focus-visible:outline-focus",
|
|
447
|
+
className: g("h-8 min-w-0 flex-1 overflow-x-auto whitespace-nowrap rounded border px-2 py-1 text-sm focus-visible:outline focus-visible:outline-focus", J.formulaValue),
|
|
448
448
|
children: m
|
|
449
449
|
})]
|
|
450
450
|
}),
|
|
@@ -455,7 +455,7 @@ var W = {
|
|
|
455
455
|
role: "document",
|
|
456
456
|
"aria-label": n,
|
|
457
457
|
"aria-busy": u,
|
|
458
|
-
className: g("h-full w-full overflow-hidden",
|
|
458
|
+
className: g("h-full w-full overflow-hidden", J.viewer)
|
|
459
459
|
}), _.length > 0 && /* @__PURE__ */ z("div", {
|
|
460
460
|
role: "region",
|
|
461
461
|
"aria-label": s,
|
|
@@ -470,7 +470,7 @@ var W = {
|
|
|
470
470
|
},
|
|
471
471
|
"data-selected": e.highlightId === C,
|
|
472
472
|
"data-clipped": e.isClippedAtEnd === !0,
|
|
473
|
-
className: g("absolute",
|
|
473
|
+
className: g("absolute", J.highlight)
|
|
474
474
|
}, `${e.highlightId}-${t}`))
|
|
475
475
|
})]
|
|
476
476
|
}),
|
|
@@ -483,14 +483,14 @@ var W = {
|
|
|
483
483
|
(u || f) && /* @__PURE__ */ z("div", {
|
|
484
484
|
role: f ? "alert" : void 0,
|
|
485
485
|
"aria-live": "polite",
|
|
486
|
-
className: g("absolute inset-0 flex items-center justify-center",
|
|
486
|
+
className: g("absolute inset-0 flex items-center justify-center", J.statusOverlay),
|
|
487
487
|
children: u ? /* @__PURE__ */ z(E, { size: 48 }) : /* @__PURE__ */ B("div", {
|
|
488
488
|
className: "flex flex-col items-center gap-2",
|
|
489
489
|
children: [/* @__PURE__ */ z(D, {
|
|
490
490
|
"aria-hidden": "true",
|
|
491
491
|
size: 60,
|
|
492
492
|
stroke: S,
|
|
493
|
-
className:
|
|
493
|
+
className: J.errorIcon
|
|
494
494
|
}), /* @__PURE__ */ z("p", {
|
|
495
495
|
className: "text-center",
|
|
496
496
|
children: i
|
|
@@ -499,25 +499,51 @@ var W = {
|
|
|
499
499
|
})
|
|
500
500
|
]
|
|
501
501
|
});
|
|
502
|
-
}, De = {
|
|
502
|
+
}, De = (e, t) => {
|
|
503
|
+
let n = e.toLowerCase();
|
|
504
|
+
return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
|
|
505
|
+
}, Oe = (e, t) => {
|
|
506
|
+
if (!(e == null || e === "")) return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
|
|
507
|
+
}, ke = (e) => `${e}:grouped-visualizer`, Ae = (e, t) => {
|
|
508
|
+
let n = (t.contentType ?? "").split(",").map((e) => e.trim().toLowerCase()).filter((e) => e !== ""), r = [], i = [];
|
|
509
|
+
return e.forEach((e) => {
|
|
510
|
+
if (e.url != null && e.url !== "" && (n.length === 0 || n.includes(e.contentType.toLowerCase()))) {
|
|
511
|
+
r.push(e);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
i.push(e);
|
|
515
|
+
}), {
|
|
516
|
+
claimed: r,
|
|
517
|
+
unclaimed: i
|
|
518
|
+
};
|
|
519
|
+
}, je = (e) => {
|
|
520
|
+
if (typeof e != "object" || !e || !Object.prototype.hasOwnProperty.call(e, "message")) return;
|
|
521
|
+
let { message: t } = e;
|
|
522
|
+
return typeof t == "string" && t.trim() !== "" ? t : void 0;
|
|
523
|
+
}, Y = {
|
|
503
524
|
loadingOverlay: "_loadingOverlay_12637_1",
|
|
504
525
|
statusLabel: "_statusLabel_12637_5",
|
|
505
526
|
errorIcon: "_errorIcon_12637_9"
|
|
506
|
-
},
|
|
507
|
-
let
|
|
508
|
-
|
|
509
|
-
|
|
527
|
+
}, Me = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", frameTitle: r, colors: a, onSendMessage: o }) => {
|
|
528
|
+
let s = L(null), [c, l] = R("loading"), { url: u, visualizerName: d, requestTimeout: f } = e, p = L(e);
|
|
529
|
+
p.current = e;
|
|
530
|
+
let h = L(o);
|
|
531
|
+
return h.current = o, F(() => {
|
|
532
|
+
let e = s.current;
|
|
510
533
|
if (!e) return;
|
|
511
|
-
|
|
534
|
+
l("loading");
|
|
512
535
|
let t = new de(e, {
|
|
513
|
-
domain:
|
|
536
|
+
domain: u,
|
|
514
537
|
hostDomain: window.location.origin,
|
|
515
|
-
visualizerName:
|
|
516
|
-
requestTimeout:
|
|
517
|
-
}), n = !0
|
|
538
|
+
visualizerName: d,
|
|
539
|
+
requestTimeout: f
|
|
540
|
+
}), n = !0, r = t.subscribe(`${d}/${W.sendMessage}`, (e) => {
|
|
541
|
+
let t = je(e);
|
|
542
|
+
t != null && h.current?.(t);
|
|
543
|
+
});
|
|
518
544
|
return (async () => {
|
|
519
545
|
if (await t.ready(), !n) return;
|
|
520
|
-
let e =
|
|
546
|
+
let e = p.current;
|
|
521
547
|
if (e.type === i.GroupedVisualizer) await t.send(ue.sendGroupedVisualizeData, {
|
|
522
548
|
attachments: e.attachments,
|
|
523
549
|
layout: e.layout
|
|
@@ -532,24 +558,24 @@ var W = {
|
|
|
532
558
|
visualizerData: a
|
|
533
559
|
});
|
|
534
560
|
}
|
|
535
|
-
n &&
|
|
561
|
+
n && l("ready");
|
|
536
562
|
})().catch(() => {
|
|
537
|
-
n &&
|
|
563
|
+
n && l("error");
|
|
538
564
|
}), () => {
|
|
539
|
-
n = !1, t.destroy();
|
|
565
|
+
n = !1, r(), t.destroy();
|
|
540
566
|
};
|
|
541
567
|
}, [
|
|
542
|
-
l,
|
|
543
568
|
u,
|
|
544
|
-
d
|
|
569
|
+
d,
|
|
570
|
+
f
|
|
545
571
|
]), F(() => {
|
|
546
|
-
let e = r ??
|
|
547
|
-
e !== "" &&
|
|
572
|
+
let e = r ?? d.trim();
|
|
573
|
+
e !== "" && s.current?.querySelector("iframe")?.setAttribute("title", e);
|
|
548
574
|
}, [
|
|
549
575
|
r,
|
|
576
|
+
d,
|
|
550
577
|
u,
|
|
551
|
-
|
|
552
|
-
d
|
|
578
|
+
f
|
|
553
579
|
]), /* @__PURE__ */ B("div", {
|
|
554
580
|
className: "relative h-full w-full",
|
|
555
581
|
style: m({
|
|
@@ -559,32 +585,32 @@ var W = {
|
|
|
559
585
|
}),
|
|
560
586
|
children: [
|
|
561
587
|
/* @__PURE__ */ z("div", {
|
|
562
|
-
ref:
|
|
588
|
+
ref: s,
|
|
563
589
|
className: "h-full w-full"
|
|
564
590
|
}),
|
|
565
|
-
|
|
566
|
-
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
591
|
+
c === "loading" && /* @__PURE__ */ B("div", {
|
|
592
|
+
className: g("absolute inset-0 flex flex-col items-center justify-center gap-2", Y.loadingOverlay),
|
|
567
593
|
children: [/* @__PURE__ */ z(E, {}), t && /* @__PURE__ */ z("p", {
|
|
568
|
-
className: g("text-center",
|
|
594
|
+
className: g("text-center", Y.statusLabel),
|
|
569
595
|
children: t
|
|
570
596
|
})]
|
|
571
597
|
}),
|
|
572
|
-
|
|
598
|
+
c === "error" && /* @__PURE__ */ B("div", {
|
|
573
599
|
className: "absolute inset-0 flex flex-col items-center justify-center gap-2",
|
|
574
600
|
children: [/* @__PURE__ */ z(D, {
|
|
575
601
|
size: 60,
|
|
576
602
|
stroke: S,
|
|
577
603
|
"aria-hidden": !0,
|
|
578
|
-
className:
|
|
604
|
+
className: Y.errorIcon
|
|
579
605
|
}), /* @__PURE__ */ z("p", {
|
|
580
606
|
role: "alert",
|
|
581
|
-
className: g("text-center",
|
|
607
|
+
className: g("text-center", Y.statusLabel),
|
|
582
608
|
children: n
|
|
583
609
|
})]
|
|
584
610
|
})
|
|
585
611
|
]
|
|
586
612
|
});
|
|
587
|
-
},
|
|
613
|
+
}, X = {
|
|
588
614
|
body: "_body_13ogb_4",
|
|
589
615
|
statusLabel: "_statusLabel_13ogb_13",
|
|
590
616
|
errorIcon: "_errorIcon_13ogb_17",
|
|
@@ -599,7 +625,7 @@ var W = {
|
|
|
599
625
|
jsonExpandIcon: "_jsonExpandIcon_13ogb_54",
|
|
600
626
|
jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
|
|
601
627
|
jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
|
|
602
|
-
},
|
|
628
|
+
}, Ne = () => j(async () => ({ default: (await import("./PdfContent-BoAtghsO.js")).PdfContent })), Pe = ({ url: e, fileName: t, loadErrorLabel: n }) => {
|
|
603
629
|
let [r, i] = R(!1);
|
|
604
630
|
return F(() => {
|
|
605
631
|
i(!1);
|
|
@@ -608,9 +634,9 @@ var W = {
|
|
|
608
634
|
children: [/* @__PURE__ */ z(D, {
|
|
609
635
|
size: 60,
|
|
610
636
|
stroke: S,
|
|
611
|
-
className:
|
|
637
|
+
className: X.errorIcon
|
|
612
638
|
}), /* @__PURE__ */ z("p", {
|
|
613
|
-
className: g("text-center",
|
|
639
|
+
className: g("text-center", X.statusLabel),
|
|
614
640
|
children: n
|
|
615
641
|
})]
|
|
616
642
|
}) : /* @__PURE__ */ z("img", {
|
|
@@ -619,43 +645,43 @@ var W = {
|
|
|
619
645
|
className: "max-h-full max-w-full object-contain",
|
|
620
646
|
onError: () => i(!0)
|
|
621
647
|
});
|
|
622
|
-
},
|
|
648
|
+
}, Z = new Set([
|
|
623
649
|
i.PlainText,
|
|
624
650
|
i.Code,
|
|
625
651
|
i.Ooxml
|
|
626
|
-
]),
|
|
627
|
-
let { colors:
|
|
652
|
+
]), Fe = M(({ content: e, isLoading: t = !1, fileName: r, isHtmlSourceView: a = !1, labels: { unsupportedLabel: o = "Preview is not supported for this file", loadErrorLabel: c = "Failed to load file", forbiddenErrorLabel: l = "You don't have permission to access this file", visualizerErrorLabel: d, htmlFrameBlockedLabel: f = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: h = "Open in new tab", pdfThumbnailsLabel: _, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: b, pdfContentLoadingLabel: x, pdfContentErrorLabel: C, pdfContentRetryLabel: w, xlsxFormulaLabel: T = "Formula", codeContentLoadingLabel: O, codeContentErrorLabel: k, codeContentRetryLabel: ee, tableCopyCsvLabel: te, tableCopyTxtLabel: ne, tableCopyMarkdownLabel: re, tableCopiedLabel: ae, tableDownloadCsvLabel: oe, ooxmlHighlightsLabel: A, ooxmlHighlightNavigatedLabel: j } = {}, styles: M, codeBlockTheme: P, tableDownloadFilename: F, loadPdf: L, hidePdfToolbar: le = !1, configurePdfWorker: V, onVisualizerSendMessage: H }) => {
|
|
653
|
+
let { colors: U, typography: W, bodyClassName: ue, cssVars: de } = M ?? {}, [G, fe] = R(0), pe = I(Ne, [G]), he = N(() => {
|
|
628
654
|
fe((e) => e + 1);
|
|
629
|
-
}, []),
|
|
655
|
+
}, []), K = W?.fontClassName != null, _e = I(() => ({
|
|
630
656
|
...m({
|
|
631
|
-
"--ac-text":
|
|
632
|
-
"--ac-status-text":
|
|
633
|
-
"--ac-error-icon":
|
|
634
|
-
"--ac-open-in-new-tab-text":
|
|
635
|
-
"--ac-json-border":
|
|
636
|
-
"--ac-json-bg":
|
|
637
|
-
"--ac-json-label":
|
|
638
|
-
"--ac-json-clickable-label":
|
|
639
|
-
"--ac-json-punctuation":
|
|
640
|
-
"--ac-json-string":
|
|
641
|
-
"--ac-json-number":
|
|
642
|
-
"--ac-json-boolean":
|
|
643
|
-
"--ac-json-null":
|
|
644
|
-
"--ac-json-toggle-icon":
|
|
645
|
-
"--ac-json-toggle-icon-hover":
|
|
646
|
-
"--ac-ooxml-bg":
|
|
647
|
-
"--ac-ooxml-formula-border":
|
|
648
|
-
"--ac-ooxml-formula-bg":
|
|
649
|
-
"--ac-ooxml-formula-text":
|
|
650
|
-
"--ac-ooxml-highlight-border":
|
|
651
|
-
"--ac-ooxml-highlight-bg":
|
|
652
|
-
"--ac-json-collapsed-text":
|
|
653
|
-
"--ac-json-collapsed-bg":
|
|
654
|
-
"--ac-font-family":
|
|
655
|
-
"--ac-font-size":
|
|
656
|
-
"--ac-font-weight":
|
|
657
|
-
"--ac-line-height":
|
|
658
|
-
"--ac-letter-spacing":
|
|
657
|
+
"--ac-text": U?.text,
|
|
658
|
+
"--ac-status-text": U?.statusText,
|
|
659
|
+
"--ac-error-icon": U?.errorIcon,
|
|
660
|
+
"--ac-open-in-new-tab-text": U?.openInNewTabText,
|
|
661
|
+
"--ac-json-border": U?.jsonBorder,
|
|
662
|
+
"--ac-json-bg": U?.jsonBackground,
|
|
663
|
+
"--ac-json-label": U?.jsonLabel,
|
|
664
|
+
"--ac-json-clickable-label": U?.jsonClickableLabel,
|
|
665
|
+
"--ac-json-punctuation": U?.jsonPunctuation,
|
|
666
|
+
"--ac-json-string": U?.jsonString,
|
|
667
|
+
"--ac-json-number": U?.jsonNumber,
|
|
668
|
+
"--ac-json-boolean": U?.jsonBoolean,
|
|
669
|
+
"--ac-json-null": U?.jsonNull,
|
|
670
|
+
"--ac-json-toggle-icon": U?.jsonToggleIcon,
|
|
671
|
+
"--ac-json-toggle-icon-hover": U?.jsonToggleIconHover,
|
|
672
|
+
"--ac-ooxml-bg": U?.ooxmlBackground,
|
|
673
|
+
"--ac-ooxml-formula-border": U?.ooxmlFormulaBorder,
|
|
674
|
+
"--ac-ooxml-formula-bg": U?.ooxmlFormulaBackground,
|
|
675
|
+
"--ac-ooxml-formula-text": U?.ooxmlFormulaText,
|
|
676
|
+
"--ac-ooxml-highlight-border": U?.ooxmlHighlightBorder,
|
|
677
|
+
"--ac-ooxml-highlight-bg": U?.ooxmlHighlightBackground,
|
|
678
|
+
"--ac-json-collapsed-text": U?.jsonCollapsedText,
|
|
679
|
+
"--ac-json-collapsed-bg": U?.jsonCollapsedBackground,
|
|
680
|
+
"--ac-font-family": K ? void 0 : W?.fontFamily,
|
|
681
|
+
"--ac-font-size": K ? void 0 : W?.fontSize,
|
|
682
|
+
"--ac-font-weight": K ? void 0 : W?.fontWeight,
|
|
683
|
+
"--ac-line-height": K ? void 0 : W?.lineHeight,
|
|
684
|
+
"--ac-letter-spacing": K ? void 0 : W?.letterSpacing
|
|
659
685
|
}),
|
|
660
686
|
...de
|
|
661
687
|
}), [M]), ve = I(() => {
|
|
@@ -679,10 +705,10 @@ var W = {
|
|
|
679
705
|
}, [e.type]), ye = I(() => {
|
|
680
706
|
switch (e.type) {
|
|
681
707
|
case i.PlainText: return /* @__PURE__ */ z("pre", {
|
|
682
|
-
className: g("whitespace-pre-wrap break-words",
|
|
708
|
+
className: g("whitespace-pre-wrap break-words", X.body, W?.fontClassName),
|
|
683
709
|
children: e.text
|
|
684
710
|
});
|
|
685
|
-
case i.Image: return /* @__PURE__ */ z(
|
|
711
|
+
case i.Image: return /* @__PURE__ */ z(Pe, {
|
|
686
712
|
url: e.url,
|
|
687
713
|
fileName: r,
|
|
688
714
|
loadErrorLabel: c
|
|
@@ -727,25 +753,25 @@ var W = {
|
|
|
727
753
|
dir: "ltr",
|
|
728
754
|
className: "h-full overflow-auto",
|
|
729
755
|
children: /* @__PURE__ */ z("div", {
|
|
730
|
-
className: g("m-3 overflow-auto rounded-md border",
|
|
756
|
+
className: g("m-3 overflow-auto rounded-md border", X.jsonWrapper),
|
|
731
757
|
children: /* @__PURE__ */ z(se, {
|
|
732
758
|
data: e.value,
|
|
733
759
|
style: {
|
|
734
|
-
container: g("whitespace-pre-wrap break-words p-2",
|
|
760
|
+
container: g("whitespace-pre-wrap break-words p-2", W?.jsonClassName ?? "dial-code-text"),
|
|
735
761
|
basicChildStyle: ce.basicChildStyle,
|
|
736
762
|
childFieldsContainer: "m-0 ps-3",
|
|
737
|
-
label: g("me-1 font-semibold",
|
|
738
|
-
clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline",
|
|
739
|
-
nullValue: g("italic",
|
|
740
|
-
undefinedValue: g("italic",
|
|
741
|
-
stringValue:
|
|
742
|
-
booleanValue:
|
|
743
|
-
numberValue:
|
|
744
|
-
otherValue: g("italic",
|
|
745
|
-
punctuation: g("me-1",
|
|
746
|
-
collapseIcon: g("me-1 cursor-pointer select-none transition-colors",
|
|
747
|
-
expandIcon: g("me-1 cursor-pointer select-none transition-colors",
|
|
748
|
-
collapsedContent: g("me-1 cursor-pointer rounded px-1",
|
|
763
|
+
label: g("me-1 font-semibold", X.jsonLabel),
|
|
764
|
+
clickableLabel: g("me-1 cursor-pointer font-semibold hover:underline", X.jsonClickableLabel),
|
|
765
|
+
nullValue: g("italic", X.jsonNullValue),
|
|
766
|
+
undefinedValue: g("italic", X.jsonNullValue),
|
|
767
|
+
stringValue: X.jsonStringValue,
|
|
768
|
+
booleanValue: X.jsonBooleanValue,
|
|
769
|
+
numberValue: X.jsonNumberValue,
|
|
770
|
+
otherValue: g("italic", X.jsonNullValue),
|
|
771
|
+
punctuation: g("me-1", X.jsonPunctuation),
|
|
772
|
+
collapseIcon: g("me-1 cursor-pointer select-none transition-colors", X.jsonCollapseIcon),
|
|
773
|
+
expandIcon: g("me-1 cursor-pointer select-none transition-colors", X.jsonExpandIcon),
|
|
774
|
+
collapsedContent: g("me-1 cursor-pointer rounded px-1", X.jsonCollapsedContent)
|
|
749
775
|
}
|
|
750
776
|
})
|
|
751
777
|
})
|
|
@@ -770,7 +796,7 @@ var W = {
|
|
|
770
796
|
codeBlockTheme: P
|
|
771
797
|
});
|
|
772
798
|
case i.Pdf: return /* @__PURE__ */ z(s, {
|
|
773
|
-
retryKey:
|
|
799
|
+
retryKey: G,
|
|
774
800
|
onRetry: he,
|
|
775
801
|
labels: {
|
|
776
802
|
loadingLabel: x,
|
|
@@ -802,18 +828,19 @@ var W = {
|
|
|
802
828
|
fileName: r,
|
|
803
829
|
loadErrorLabel: c,
|
|
804
830
|
formulaLabel: T,
|
|
805
|
-
formulaLabelClassName:
|
|
831
|
+
formulaLabelClassName: W?.xlsxFormulaLabelClassName ?? "dial-italic-text",
|
|
806
832
|
highlightsLabel: A,
|
|
807
833
|
highlightNavigatedLabel: j
|
|
808
834
|
});
|
|
809
835
|
case i.Visualizer:
|
|
810
|
-
case i.GroupedVisualizer: return /* @__PURE__ */ z(
|
|
836
|
+
case i.GroupedVisualizer: return /* @__PURE__ */ z(Me, {
|
|
811
837
|
content: e,
|
|
812
|
-
errorLabel: d
|
|
838
|
+
errorLabel: d,
|
|
839
|
+
onSendMessage: H
|
|
813
840
|
});
|
|
814
841
|
case i.McpApp: return /* @__PURE__ */ z(xe, { content: e });
|
|
815
842
|
case i.Unsupported: return /* @__PURE__ */ z("p", {
|
|
816
|
-
className: g("text-center",
|
|
843
|
+
className: g("text-center", X.statusLabel),
|
|
817
844
|
children: o
|
|
818
845
|
});
|
|
819
846
|
case i.Error: {
|
|
@@ -823,9 +850,9 @@ var W = {
|
|
|
823
850
|
children: [z(t ? ie : D, {
|
|
824
851
|
size: 60,
|
|
825
852
|
stroke: S,
|
|
826
|
-
className:
|
|
853
|
+
className: X.errorIcon
|
|
827
854
|
}), /* @__PURE__ */ z("p", {
|
|
828
|
-
className: g("text-center",
|
|
855
|
+
className: g("text-center", X.statusLabel),
|
|
829
856
|
children: t ? l : c
|
|
830
857
|
})]
|
|
831
858
|
});
|
|
@@ -833,15 +860,16 @@ var W = {
|
|
|
833
860
|
}
|
|
834
861
|
}, [
|
|
835
862
|
e,
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
863
|
+
W?.fontClassName,
|
|
864
|
+
W?.jsonClassName,
|
|
865
|
+
W?.xlsxFormulaLabelClassName,
|
|
839
866
|
r,
|
|
840
867
|
P,
|
|
841
868
|
o,
|
|
842
869
|
c,
|
|
843
870
|
l,
|
|
844
871
|
d,
|
|
872
|
+
H,
|
|
845
873
|
f,
|
|
846
874
|
h,
|
|
847
875
|
a,
|
|
@@ -861,7 +889,7 @@ var W = {
|
|
|
861
889
|
k,
|
|
862
890
|
ee,
|
|
863
891
|
pe,
|
|
864
|
-
|
|
892
|
+
G,
|
|
865
893
|
he,
|
|
866
894
|
te,
|
|
867
895
|
ne,
|
|
@@ -872,28 +900,28 @@ var W = {
|
|
|
872
900
|
j
|
|
873
901
|
]);
|
|
874
902
|
return /* @__PURE__ */ z("div", {
|
|
875
|
-
style: !t &&
|
|
903
|
+
style: !t && Z.has(e.type) ? _e : void 0,
|
|
876
904
|
className: g(t ? "flex h-full items-center justify-center" : ve, ue),
|
|
877
905
|
children: t ? /* @__PURE__ */ z(E, {}) : ye
|
|
878
906
|
});
|
|
879
|
-
}),
|
|
880
|
-
let [
|
|
881
|
-
|
|
882
|
-
}, [
|
|
883
|
-
|
|
884
|
-
}, [
|
|
885
|
-
|
|
886
|
-
}, [
|
|
907
|
+
}), Ie = 2e3, Le = M(({ 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: m = "Copy as Markdown", copiedMarkdownLabel: h = "Copied!", copyJsonLabel: _ = "Copy as JSON", copiedJsonLabel: v = "Copied!", visualizerErrorLabel: C, unsupportedLabel: T = "Preview is not supported for this file", loadErrorLabel: E = "Failed to load file", forbiddenErrorLabel: D = "You don't have permission to access this file", htmlFrameBlockedLabel: O = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: ie = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: j = "View rendered", mcpAppReloadLabel: M = "Reload", pdfThumbnailsLabel: P, pdfShowThumbnailsLabel: I, pdfHideThumbnailsLabel: se, pdfPageNumberLabel: ce, pdfContentLoadingLabel: V, pdfContentErrorLabel: H, pdfContentRetryLabel: U, xlsxFormulaLabel: W, codeContentLoadingLabel: ue, codeContentErrorLabel: de, codeContentRetryLabel: G, tableCopyCsvLabel: fe, tableCopyTxtLabel: pe, tableCopyMarkdownLabel: me, tableCopiedLabel: he, tableDownloadCsvLabel: ge, ooxmlHighlightsLabel: K, ooxmlHighlightNavigatedLabel: _e }, onDownload: ve, onCopyText: ye, onCopyMarkdown: be, onCopyJson: q, tableDownloadFilename: xe, isMobile: J = !1, defaultWidth: Se, minWidth: Ce = 600, maxWidth: we = 1500, onResizeStop: Te, styles: Ee, codeBlockTheme: De, loadPdf: Oe, configurePdfWorker: ke, onVisualizerSendMessage: Ae }) => {
|
|
908
|
+
let [je, Y] = R(!1), [Me, X] = R(!1), [Ne, Pe] = R(!1), [Z, Le] = R(!1), Re = L(null), Q = L(null), ze = L(null), Be = N(() => {
|
|
909
|
+
ye?.(), Re.current != null && clearTimeout(Re.current), Y(!0), Re.current = setTimeout(() => Y(!1), Ie);
|
|
910
|
+
}, [ye]), Ve = N(() => {
|
|
911
|
+
be?.(), Q.current != null && clearTimeout(Q.current), X(!0), Q.current = setTimeout(() => X(!1), Ie);
|
|
912
|
+
}, [be]), He = N(() => {
|
|
913
|
+
q?.(), ze.current != null && clearTimeout(ze.current), Pe(!0), ze.current = setTimeout(() => Pe(!1), Ie);
|
|
914
|
+
}, [q]);
|
|
887
915
|
F(() => () => {
|
|
888
|
-
|
|
916
|
+
Re.current != null && clearTimeout(Re.current), Q.current != null && clearTimeout(Q.current), ze.current != null && clearTimeout(ze.current);
|
|
889
917
|
}, []);
|
|
890
|
-
let
|
|
918
|
+
let Ue = N(() => {
|
|
891
919
|
Le((e) => !e);
|
|
892
920
|
}, []);
|
|
893
921
|
F(() => {
|
|
894
922
|
Le(!1);
|
|
895
923
|
}, [r]);
|
|
896
|
-
let { className:
|
|
924
|
+
let { className: We, panelStyles: Ge, ...Ke } = Ee ?? {}, qe = !t && r.type === i.Html && r.srcdoc != null, Je = !t && ye != null && (r.type === i.PlainText || r.type === i.Code), Ye = !t && be != null && r.type === i.Markdown, $ = !t && q != null && r.type === i.Json, Xe = !t && ve != null && o(r), Ze = !t && r.type === i.McpApp && r.onReload != null;
|
|
897
925
|
return /* @__PURE__ */ z(b, {
|
|
898
926
|
isOpen: e,
|
|
899
927
|
orientation: y.Right,
|
|
@@ -904,20 +932,20 @@ var W = {
|
|
|
904
932
|
resizeLabel: u
|
|
905
933
|
},
|
|
906
934
|
onClose: n,
|
|
907
|
-
resizable: !
|
|
908
|
-
defaultWidth:
|
|
909
|
-
minWidth:
|
|
910
|
-
maxWidth:
|
|
911
|
-
onResizeStop:
|
|
935
|
+
resizable: !J,
|
|
936
|
+
defaultWidth: Se,
|
|
937
|
+
minWidth: Ce,
|
|
938
|
+
maxWidth: we,
|
|
939
|
+
onResizeStop: Te,
|
|
912
940
|
styles: {
|
|
913
|
-
|
|
914
|
-
titleClassName:
|
|
915
|
-
headerClassName: g("border-b border-tertiary",
|
|
916
|
-
className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0",
|
|
941
|
+
...Ge,
|
|
942
|
+
titleClassName: Ge?.titleClassName ?? "dial-h3-text",
|
|
943
|
+
headerClassName: g("border-b border-tertiary", Ge?.headerClassName),
|
|
944
|
+
className: g(e ? "mobile:w-full mobile:max-w-full" : "w-0", We, Ge?.className)
|
|
917
945
|
},
|
|
918
946
|
leftActions: s,
|
|
919
|
-
rightActions:
|
|
920
|
-
|
|
947
|
+
rightActions: qe || Je || Ye || $ || Xe || Ze ? /* @__PURE__ */ B(le, { children: [
|
|
948
|
+
Ze && /* @__PURE__ */ z(w, {
|
|
921
949
|
icon: /* @__PURE__ */ z(oe, {
|
|
922
950
|
size: x.LG,
|
|
923
951
|
stroke: S,
|
|
@@ -927,62 +955,62 @@ var W = {
|
|
|
927
955
|
tooltipProps: { tooltip: M },
|
|
928
956
|
onClick: r.type === i.McpApp ? r.onReload : void 0
|
|
929
957
|
}),
|
|
930
|
-
|
|
931
|
-
icon: z(
|
|
958
|
+
qe && /* @__PURE__ */ z(w, {
|
|
959
|
+
icon: z(Z ? re : ee, {
|
|
932
960
|
size: x.LG,
|
|
933
961
|
stroke: S,
|
|
934
962
|
"aria-hidden": !0
|
|
935
963
|
}),
|
|
936
|
-
"aria-label":
|
|
937
|
-
"aria-pressed":
|
|
938
|
-
tooltipProps: { tooltip:
|
|
939
|
-
onClick:
|
|
964
|
+
"aria-label": Z ? j : A,
|
|
965
|
+
"aria-pressed": Z,
|
|
966
|
+
tooltipProps: { tooltip: Z ? j : A },
|
|
967
|
+
onClick: Ue
|
|
940
968
|
}),
|
|
941
|
-
|
|
942
|
-
icon: z(
|
|
969
|
+
Je && /* @__PURE__ */ z(w, {
|
|
970
|
+
icon: z(je ? k : te, {
|
|
943
971
|
size: x.LG,
|
|
944
972
|
stroke: S,
|
|
945
973
|
"aria-hidden": !0
|
|
946
974
|
}),
|
|
947
|
-
"aria-label":
|
|
948
|
-
tooltipProps: { tooltip:
|
|
949
|
-
onClick:
|
|
975
|
+
"aria-label": je ? p : f,
|
|
976
|
+
tooltipProps: { tooltip: je ? p : f },
|
|
977
|
+
onClick: Be
|
|
950
978
|
}),
|
|
951
|
-
|
|
952
|
-
icon: z(
|
|
979
|
+
Ye && /* @__PURE__ */ z(w, {
|
|
980
|
+
icon: z(Me ? k : ae, {
|
|
953
981
|
size: x.LG,
|
|
954
982
|
stroke: S,
|
|
955
983
|
"aria-hidden": !0
|
|
956
984
|
}),
|
|
957
|
-
"aria-label":
|
|
958
|
-
tooltipProps: { tooltip:
|
|
959
|
-
onClick:
|
|
985
|
+
"aria-label": Me ? h : m,
|
|
986
|
+
tooltipProps: { tooltip: Me ? h : m },
|
|
987
|
+
onClick: Ve
|
|
960
988
|
}),
|
|
961
|
-
|
|
962
|
-
icon: z(
|
|
989
|
+
$ && /* @__PURE__ */ z(w, {
|
|
990
|
+
icon: z(Ne ? k : te, {
|
|
963
991
|
size: x.LG,
|
|
964
992
|
stroke: S,
|
|
965
993
|
"aria-hidden": !0
|
|
966
994
|
}),
|
|
967
|
-
"aria-label":
|
|
968
|
-
tooltipProps: { tooltip:
|
|
969
|
-
onClick:
|
|
995
|
+
"aria-label": Ne ? v : _,
|
|
996
|
+
tooltipProps: { tooltip: Ne ? v : _ },
|
|
997
|
+
onClick: He
|
|
970
998
|
}),
|
|
971
|
-
|
|
999
|
+
Xe && /* @__PURE__ */ z(w, {
|
|
972
1000
|
icon: /* @__PURE__ */ z(ne, {
|
|
973
1001
|
size: x.LG,
|
|
974
1002
|
stroke: S
|
|
975
1003
|
}),
|
|
976
1004
|
"aria-label": d,
|
|
977
1005
|
tooltipProps: { tooltip: d },
|
|
978
|
-
onClick:
|
|
1006
|
+
onClick: ve
|
|
979
1007
|
})
|
|
980
1008
|
] }) : null,
|
|
981
|
-
children: /* @__PURE__ */ z(
|
|
1009
|
+
children: /* @__PURE__ */ z(Fe, {
|
|
982
1010
|
content: r,
|
|
983
1011
|
isLoading: t,
|
|
984
1012
|
fileName: a,
|
|
985
|
-
isHtmlSourceView:
|
|
1013
|
+
isHtmlSourceView: Z,
|
|
986
1014
|
labels: {
|
|
987
1015
|
unsupportedLabel: T,
|
|
988
1016
|
loadErrorLabel: E,
|
|
@@ -997,62 +1025,63 @@ var W = {
|
|
|
997
1025
|
pdfContentLoadingLabel: V,
|
|
998
1026
|
pdfContentErrorLabel: H,
|
|
999
1027
|
pdfContentRetryLabel: U,
|
|
1000
|
-
xlsxFormulaLabel:
|
|
1001
|
-
codeContentLoadingLabel:
|
|
1002
|
-
codeContentErrorLabel:
|
|
1003
|
-
codeContentRetryLabel:
|
|
1004
|
-
tableCopyCsvLabel:
|
|
1005
|
-
tableCopyTxtLabel:
|
|
1006
|
-
tableCopyMarkdownLabel:
|
|
1007
|
-
tableCopiedLabel:
|
|
1008
|
-
tableDownloadCsvLabel:
|
|
1009
|
-
ooxmlHighlightsLabel:
|
|
1010
|
-
ooxmlHighlightNavigatedLabel:
|
|
1028
|
+
xlsxFormulaLabel: W,
|
|
1029
|
+
codeContentLoadingLabel: ue,
|
|
1030
|
+
codeContentErrorLabel: de,
|
|
1031
|
+
codeContentRetryLabel: G,
|
|
1032
|
+
tableCopyCsvLabel: fe,
|
|
1033
|
+
tableCopyTxtLabel: pe,
|
|
1034
|
+
tableCopyMarkdownLabel: me,
|
|
1035
|
+
tableCopiedLabel: he,
|
|
1036
|
+
tableDownloadCsvLabel: ge,
|
|
1037
|
+
ooxmlHighlightsLabel: K,
|
|
1038
|
+
ooxmlHighlightNavigatedLabel: _e
|
|
1011
1039
|
},
|
|
1012
|
-
styles:
|
|
1013
|
-
codeBlockTheme:
|
|
1014
|
-
tableDownloadFilename:
|
|
1015
|
-
loadPdf:
|
|
1016
|
-
configurePdfWorker: ke
|
|
1040
|
+
styles: Ke,
|
|
1041
|
+
codeBlockTheme: De,
|
|
1042
|
+
tableDownloadFilename: xe,
|
|
1043
|
+
loadPdf: Oe,
|
|
1044
|
+
configurePdfWorker: ke,
|
|
1045
|
+
onVisualizerSendMessage: Ae
|
|
1017
1046
|
})
|
|
1018
1047
|
});
|
|
1019
|
-
}),
|
|
1048
|
+
}), Re = new Set(["html", "htm"]), Q = {
|
|
1020
1049
|
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1021
1050
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1022
1051
|
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
1023
|
-
},
|
|
1052
|
+
}, ze = new Set(/* @__PURE__ */ "txt.md.markdown.json.jsonl.ndjson.xml.csv.tsv.yaml.yml.toml.ini.conf.cfg.css.scss.sass.less.js.jsx.ts.tsx.mjs.cjs.mts.cts.py.rb.go.rs.java.kt.swift.c.h.cpp.cs.sh.bash.zsh.fish.ps1.log.env.gitignore.dockerfile.makefile.sql".split(".")), Be = {
|
|
1024
1053
|
docx: r.Docx,
|
|
1025
1054
|
xlsx: r.Xlsx,
|
|
1026
1055
|
pptx: r.Pptx,
|
|
1027
1056
|
csv: r.Csv
|
|
1028
|
-
},
|
|
1029
|
-
[
|
|
1030
|
-
[
|
|
1031
|
-
[
|
|
1057
|
+
}, Ve = {
|
|
1058
|
+
[Q.docx]: r.Docx,
|
|
1059
|
+
[Q.xlsx]: r.Xlsx,
|
|
1060
|
+
[Q.pptx]: r.Pptx,
|
|
1032
1061
|
[f.CSV]: r.Csv
|
|
1033
|
-
},
|
|
1034
|
-
[r.Docx]:
|
|
1035
|
-
[r.Xlsx]:
|
|
1036
|
-
[r.Pptx]:
|
|
1062
|
+
}, He = {
|
|
1063
|
+
[r.Docx]: Q.docx,
|
|
1064
|
+
[r.Xlsx]: Q.xlsx,
|
|
1065
|
+
[r.Pptx]: Q.pptx,
|
|
1037
1066
|
[r.Csv]: f.CSV
|
|
1038
|
-
},
|
|
1067
|
+
}, Ue = (e, t) => {
|
|
1039
1068
|
let n = t?.split(";", 1)[0].trim().toLowerCase();
|
|
1040
1069
|
if (n != null) {
|
|
1041
|
-
let e =
|
|
1070
|
+
let e = Ve[n];
|
|
1042
1071
|
if (e != null) return e;
|
|
1043
1072
|
}
|
|
1044
1073
|
let r = e.lastIndexOf(".");
|
|
1045
|
-
if (r !== -1) return
|
|
1046
|
-
},
|
|
1047
|
-
let n =
|
|
1048
|
-
return n == null ? void 0 :
|
|
1049
|
-
},
|
|
1074
|
+
if (r !== -1) return Be[e.slice(r + 1).toLowerCase()];
|
|
1075
|
+
}, We = (e, t) => Ue(e, t) != null, Ge = (e, t) => {
|
|
1076
|
+
let n = Ue(e, t);
|
|
1077
|
+
return n == null ? void 0 : He[n];
|
|
1078
|
+
}, Ke = (e) => {
|
|
1050
1079
|
let t = e.lastIndexOf(".");
|
|
1051
|
-
return t === -1 ? !1 :
|
|
1052
|
-
},
|
|
1080
|
+
return t === -1 ? !1 : ze.has(e.slice(t + 1).toLowerCase());
|
|
1081
|
+
}, qe = (e) => {
|
|
1053
1082
|
let t = e.lastIndexOf(".");
|
|
1054
|
-
return t === -1 ? !1 :
|
|
1055
|
-
},
|
|
1083
|
+
return t === -1 ? !1 : Re.has(e.slice(t + 1).toLowerCase());
|
|
1084
|
+
}, Je = {
|
|
1056
1085
|
xml: "xml",
|
|
1057
1086
|
csv: "plaintext",
|
|
1058
1087
|
tsv: "plaintext",
|
|
@@ -1100,39 +1129,39 @@ var W = {
|
|
|
1100
1129
|
gitignore: "plaintext",
|
|
1101
1130
|
dockerfile: "plaintext",
|
|
1102
1131
|
makefile: "plaintext"
|
|
1103
|
-
},
|
|
1132
|
+
}, Ye = (e) => Je[e], $ = (e) => ({
|
|
1104
1133
|
type: i.Unsupported,
|
|
1105
1134
|
...e != null && { url: e }
|
|
1106
|
-
}),
|
|
1135
|
+
}), Xe = (e) => ({
|
|
1107
1136
|
type: i.Error,
|
|
1108
1137
|
errorType: n.LoadFailed,
|
|
1109
1138
|
...e != null && { url: e }
|
|
1110
|
-
}),
|
|
1139
|
+
}), Ze = (e) => ({
|
|
1111
1140
|
type: i.Error,
|
|
1112
1141
|
errorType: n.Forbidden,
|
|
1113
1142
|
...e != null && { url: e }
|
|
1114
|
-
}),
|
|
1143
|
+
}), Qe = (e) => {
|
|
1115
1144
|
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;
|
|
1116
|
-
},
|
|
1117
|
-
let t =
|
|
1145
|
+
}, $e = (e) => {
|
|
1146
|
+
let t = Qe(e);
|
|
1118
1147
|
t != null && URL.revokeObjectURL(t);
|
|
1119
|
-
},
|
|
1148
|
+
}, et = {
|
|
1120
1149
|
type: i.PlainText,
|
|
1121
1150
|
text: ""
|
|
1122
|
-
},
|
|
1123
|
-
|
|
1124
|
-
var
|
|
1125
|
-
let [t, n] = R(!1), [r, i] = R(!1), [a, o] = R(
|
|
1151
|
+
}, tt = A(void 0);
|
|
1152
|
+
tt.displayName = "AttachmentCanvasContext";
|
|
1153
|
+
var nt = ({ children: e }) => {
|
|
1154
|
+
let [t, n] = R(!1), [r, i] = R(!1), [a, o] = R(et), [s, c] = R(void 0), [l, u] = R(void 0), d = N((e, t) => {
|
|
1126
1155
|
c(e), u(t), i(!0), n(!0);
|
|
1127
1156
|
}, []), f = N((e, t, r) => {
|
|
1128
1157
|
o(e), c(t), u(r), i(!1), n(!0);
|
|
1129
1158
|
}, []), p = N(() => {
|
|
1130
|
-
o(
|
|
1159
|
+
o(et), n(!1), i(!1), u(void 0);
|
|
1131
1160
|
}, []);
|
|
1132
1161
|
return F(() => () => {
|
|
1133
|
-
let e =
|
|
1162
|
+
let e = Qe(a);
|
|
1134
1163
|
e != null && URL.revokeObjectURL(e);
|
|
1135
|
-
}, [a]), /* @__PURE__ */ z(
|
|
1164
|
+
}, [a]), /* @__PURE__ */ z(tt.Provider, {
|
|
1136
1165
|
value: I(() => ({
|
|
1137
1166
|
isOpen: t,
|
|
1138
1167
|
isLoading: r,
|
|
@@ -1154,93 +1183,94 @@ var Xe = ({ children: e }) => {
|
|
|
1154
1183
|
]),
|
|
1155
1184
|
children: e
|
|
1156
1185
|
});
|
|
1157
|
-
},
|
|
1158
|
-
let e = P(
|
|
1186
|
+
}, rt = () => {
|
|
1187
|
+
let e = P(tt);
|
|
1159
1188
|
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
1160
1189
|
return e;
|
|
1161
|
-
},
|
|
1162
|
-
let { ariaLabel:
|
|
1163
|
-
a(
|
|
1164
|
-
}, [
|
|
1165
|
-
(
|
|
1166
|
-
}, [
|
|
1167
|
-
|
|
1168
|
-
}, [
|
|
1169
|
-
|
|
1170
|
-
}, [
|
|
1171
|
-
return /* @__PURE__ */ z(
|
|
1172
|
-
isOpen:
|
|
1173
|
-
isLoading:
|
|
1174
|
-
onClose:
|
|
1175
|
-
content:
|
|
1176
|
-
fileName:
|
|
1190
|
+
}, it = M(({ labels: e, leftActions: t, isMobile: n = !1, defaultWidth: r, maxWidth: o, codeBlockTheme: s, tableDownloadFilename: c, loadPdf: l, configurePdfWorker: u, onVisualizerSendMessage: d }) => {
|
|
1191
|
+
let { ariaLabel: f = "Attachment preview", closeLabel: p = "Close", downloadLabel: m = "Download", unsupportedLabel: g = "Preview is not supported for this file", loadErrorLabel: _ = "Failed to load file", forbiddenErrorLabel: v = "You don't have permission to access this file", copyTextLabel: y, copiedTextLabel: b, copyMarkdownLabel: x, copiedMarkdownLabel: S, copyJsonLabel: C, copiedJsonLabel: w, htmlFrameBlockedLabel: T, htmlOpenInNewTabLabel: E, htmlViewSourceLabel: D, htmlViewRenderedLabel: O, pdfThumbnailsLabel: k, pdfShowThumbnailsLabel: ee, pdfHideThumbnailsLabel: te, pdfPageNumberLabel: ne, pdfContentLoadingLabel: re, pdfContentErrorLabel: ie, pdfContentRetryLabel: ae, xlsxFormulaLabel: oe, codeContentLoadingLabel: A, codeContentErrorLabel: j, codeContentRetryLabel: M, tableCopyCsvLabel: P, tableCopyTxtLabel: F, tableCopyMarkdownLabel: I, tableCopiedLabel: L, tableDownloadCsvLabel: R, ooxmlHighlightsLabel: se, ooxmlHighlightNavigatedLabel: ce } = e ?? {}, { isOpen: le, isLoading: B, content: V, fileName: H, closeCanvas: U } = rt(), W = N(() => {
|
|
1192
|
+
a(V, H);
|
|
1193
|
+
}, [V, H]), ue = N(() => {
|
|
1194
|
+
(V.type === i.PlainText || V.type === i.Code) && h(V.text);
|
|
1195
|
+
}, [V]), de = N(() => {
|
|
1196
|
+
V.type === i.Markdown && h(V.text);
|
|
1197
|
+
}, [V]), G = N(() => {
|
|
1198
|
+
V.type === i.Json && h(JSON.stringify(V.value, null, 2));
|
|
1199
|
+
}, [V]);
|
|
1200
|
+
return /* @__PURE__ */ z(Le, {
|
|
1201
|
+
isOpen: le,
|
|
1202
|
+
isLoading: B,
|
|
1203
|
+
onClose: U,
|
|
1204
|
+
content: V,
|
|
1205
|
+
fileName: H,
|
|
1177
1206
|
leftActions: t,
|
|
1178
1207
|
labels: {
|
|
1179
|
-
ariaLabel:
|
|
1180
|
-
closeLabel:
|
|
1181
|
-
downloadLabel:
|
|
1182
|
-
copyTextLabel:
|
|
1183
|
-
copiedTextLabel:
|
|
1184
|
-
copyMarkdownLabel:
|
|
1185
|
-
copiedMarkdownLabel:
|
|
1186
|
-
copyJsonLabel:
|
|
1187
|
-
copiedJsonLabel:
|
|
1188
|
-
unsupportedLabel:
|
|
1189
|
-
loadErrorLabel:
|
|
1190
|
-
forbiddenErrorLabel:
|
|
1191
|
-
htmlFrameBlockedLabel:
|
|
1192
|
-
htmlOpenInNewTabLabel:
|
|
1193
|
-
htmlViewSourceLabel:
|
|
1194
|
-
htmlViewRenderedLabel:
|
|
1195
|
-
pdfThumbnailsLabel:
|
|
1196
|
-
pdfShowThumbnailsLabel:
|
|
1197
|
-
pdfHideThumbnailsLabel:
|
|
1198
|
-
pdfPageNumberLabel:
|
|
1199
|
-
pdfContentLoadingLabel:
|
|
1200
|
-
pdfContentErrorLabel:
|
|
1201
|
-
pdfContentRetryLabel:
|
|
1202
|
-
xlsxFormulaLabel:
|
|
1203
|
-
codeContentLoadingLabel:
|
|
1204
|
-
codeContentErrorLabel:
|
|
1205
|
-
codeContentRetryLabel:
|
|
1206
|
-
tableCopyCsvLabel:
|
|
1207
|
-
tableCopyTxtLabel:
|
|
1208
|
-
tableCopyMarkdownLabel:
|
|
1209
|
-
tableCopiedLabel:
|
|
1210
|
-
tableDownloadCsvLabel:
|
|
1211
|
-
ooxmlHighlightsLabel:
|
|
1212
|
-
ooxmlHighlightNavigatedLabel:
|
|
1208
|
+
ariaLabel: f,
|
|
1209
|
+
closeLabel: p,
|
|
1210
|
+
downloadLabel: m,
|
|
1211
|
+
copyTextLabel: y,
|
|
1212
|
+
copiedTextLabel: b,
|
|
1213
|
+
copyMarkdownLabel: x,
|
|
1214
|
+
copiedMarkdownLabel: S,
|
|
1215
|
+
copyJsonLabel: C,
|
|
1216
|
+
copiedJsonLabel: w,
|
|
1217
|
+
unsupportedLabel: g,
|
|
1218
|
+
loadErrorLabel: _,
|
|
1219
|
+
forbiddenErrorLabel: v,
|
|
1220
|
+
htmlFrameBlockedLabel: T,
|
|
1221
|
+
htmlOpenInNewTabLabel: E,
|
|
1222
|
+
htmlViewSourceLabel: D,
|
|
1223
|
+
htmlViewRenderedLabel: O,
|
|
1224
|
+
pdfThumbnailsLabel: k,
|
|
1225
|
+
pdfShowThumbnailsLabel: ee,
|
|
1226
|
+
pdfHideThumbnailsLabel: te,
|
|
1227
|
+
pdfPageNumberLabel: ne,
|
|
1228
|
+
pdfContentLoadingLabel: re,
|
|
1229
|
+
pdfContentErrorLabel: ie,
|
|
1230
|
+
pdfContentRetryLabel: ae,
|
|
1231
|
+
xlsxFormulaLabel: oe,
|
|
1232
|
+
codeContentLoadingLabel: A,
|
|
1233
|
+
codeContentErrorLabel: j,
|
|
1234
|
+
codeContentRetryLabel: M,
|
|
1235
|
+
tableCopyCsvLabel: P,
|
|
1236
|
+
tableCopyTxtLabel: F,
|
|
1237
|
+
tableCopyMarkdownLabel: I,
|
|
1238
|
+
tableCopiedLabel: L,
|
|
1239
|
+
tableDownloadCsvLabel: R,
|
|
1240
|
+
ooxmlHighlightsLabel: se,
|
|
1241
|
+
ooxmlHighlightNavigatedLabel: ce
|
|
1213
1242
|
},
|
|
1214
|
-
onDownload:
|
|
1215
|
-
onCopyText:
|
|
1216
|
-
onCopyMarkdown:
|
|
1217
|
-
onCopyJson:
|
|
1243
|
+
onDownload: W,
|
|
1244
|
+
onCopyText: V.type === i.PlainText || V.type === i.Code ? ue : void 0,
|
|
1245
|
+
onCopyMarkdown: V.type === i.Markdown ? de : void 0,
|
|
1246
|
+
onCopyJson: V.type === i.Json ? G : void 0,
|
|
1218
1247
|
tableDownloadFilename: c,
|
|
1219
1248
|
isMobile: n,
|
|
1220
1249
|
defaultWidth: r,
|
|
1221
1250
|
maxWidth: o,
|
|
1222
1251
|
codeBlockTheme: s,
|
|
1223
1252
|
configurePdfWorker: u,
|
|
1224
|
-
loadPdf: l
|
|
1253
|
+
loadPdf: l,
|
|
1254
|
+
onVisualizerSendMessage: d
|
|
1225
1255
|
});
|
|
1226
|
-
}),
|
|
1256
|
+
}), at = {
|
|
1227
1257
|
frame: "_frame_g47g7_1",
|
|
1228
1258
|
header: "_header_g47g7_6",
|
|
1229
1259
|
title: "_title_g47g7_10"
|
|
1230
|
-
},
|
|
1231
|
-
let
|
|
1260
|
+
}, ot = M(({ content: e, height: t, onExpand: n, expandAriaLabel: r, actionsGroupAriaLabel: i = "Visualizer actions", frameTitle: a, loadingLabel: o, errorLabel: s, titleClassName: c = "dial-small-semi-text", isBorderless: l = !1, isTitleHidden: u = !1, colors: d, onVisualizerSendMessage: f }) => {
|
|
1261
|
+
let p = e.visualizerName.trim(), h = !u && p !== "";
|
|
1232
1262
|
return /* @__PURE__ */ B("div", {
|
|
1233
|
-
className: g("flex w-full min-w-0 flex-col overflow-hidden rounded-xl border",
|
|
1263
|
+
className: g("flex w-full min-w-0 flex-col overflow-hidden", !l && ["rounded-xl border", at.frame]),
|
|
1234
1264
|
style: m({
|
|
1235
|
-
"--igv-bg":
|
|
1236
|
-
"--igv-border":
|
|
1237
|
-
"--igv-title-text":
|
|
1265
|
+
"--igv-bg": d?.background,
|
|
1266
|
+
"--igv-border": d?.border,
|
|
1267
|
+
"--igv-title-text": d?.titleText
|
|
1238
1268
|
}),
|
|
1239
1269
|
children: [/* @__PURE__ */ B("div", {
|
|
1240
|
-
className: g("flex min-h-10 items-center justify-between
|
|
1241
|
-
children: [/* @__PURE__ */ z("span", {
|
|
1242
|
-
className: g("min-w-0 truncate", c,
|
|
1243
|
-
children:
|
|
1270
|
+
className: g("flex min-h-10 items-center gap-2 py-2", h ? "justify-between" : "justify-end", !l && ["border-b px-4", at.header]),
|
|
1271
|
+
children: [h && /* @__PURE__ */ z("span", {
|
|
1272
|
+
className: g("min-w-0 truncate", c, at.title),
|
|
1273
|
+
children: p
|
|
1244
1274
|
}), /* @__PURE__ */ z("div", {
|
|
1245
1275
|
role: "toolbar",
|
|
1246
1276
|
"aria-label": i,
|
|
@@ -1259,32 +1289,16 @@ var Xe = ({ children: e }) => {
|
|
|
1259
1289
|
}), /* @__PURE__ */ z("div", {
|
|
1260
1290
|
className: "w-full",
|
|
1261
1291
|
style: { height: `${t}px` },
|
|
1262
|
-
children: /* @__PURE__ */ z(
|
|
1292
|
+
children: /* @__PURE__ */ z(Me, {
|
|
1263
1293
|
content: e,
|
|
1264
1294
|
loadingLabel: o,
|
|
1265
1295
|
errorLabel: s,
|
|
1266
|
-
frameTitle: a
|
|
1296
|
+
frameTitle: a,
|
|
1297
|
+
onSendMessage: f
|
|
1267
1298
|
})
|
|
1268
1299
|
})]
|
|
1269
1300
|
});
|
|
1270
|
-
}),
|
|
1271
|
-
let n = e.toLowerCase();
|
|
1272
|
-
return t.find((e) => e.contentType.split(",").some((e) => e.trim().toLowerCase() === n && e.trim() !== ""));
|
|
1273
|
-
}, nt = (e, t) => {
|
|
1274
|
-
if (!(e == null || e === "")) return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
|
|
1275
|
-
}, rt = (e) => `${e}:grouped-visualizer`, it = (e, t) => {
|
|
1276
|
-
let n = (t.contentType ?? "").split(",").map((e) => e.trim().toLowerCase()).filter((e) => e !== ""), r = [], i = [];
|
|
1277
|
-
return e.forEach((e) => {
|
|
1278
|
-
if (e.url != null && e.url !== "" && (n.length === 0 || n.includes(e.contentType.toLowerCase()))) {
|
|
1279
|
-
r.push(e);
|
|
1280
|
-
return;
|
|
1281
|
-
}
|
|
1282
|
-
i.push(e);
|
|
1283
|
-
}), {
|
|
1284
|
-
claimed: r,
|
|
1285
|
-
unclaimed: i
|
|
1286
|
-
};
|
|
1287
|
-
}, at = (e) => {
|
|
1301
|
+
}), st = (e) => {
|
|
1288
1302
|
let t;
|
|
1289
1303
|
try {
|
|
1290
1304
|
t = new URL(e).pathname;
|
|
@@ -1297,13 +1311,13 @@ var Xe = ({ children: e }) => {
|
|
|
1297
1311
|
} catch {
|
|
1298
1312
|
return n;
|
|
1299
1313
|
}
|
|
1300
|
-
},
|
|
1301
|
-
let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } =
|
|
1314
|
+
}, ct = (e, t) => {
|
|
1315
|
+
let { openCanvas: n, openCanvasLoading: r, closeCanvas: a } = rt(), { customVisualizers: o, themeId: s, onBeforeOpen: l } = t, u = N(async (t, n, r) => {
|
|
1302
1316
|
if (t.url == null && t.referenceUrl != null) {
|
|
1303
1317
|
let i = e.resolveReferencePdfContent(t);
|
|
1304
1318
|
if (i != null) return r(i, t.name, n);
|
|
1305
1319
|
}
|
|
1306
|
-
let a = t.contentType.toLowerCase(), c =
|
|
1320
|
+
let a = t.contentType.toLowerCase(), c = De(a, o);
|
|
1307
1321
|
if (c != null) {
|
|
1308
1322
|
let i = await e.resolveVisualizerContent(t, c, s);
|
|
1309
1323
|
if (i != null) return r(i, t.name, n);
|
|
@@ -1312,14 +1326,14 @@ var Xe = ({ children: e }) => {
|
|
|
1312
1326
|
let i = await e.resolveTextContent(t);
|
|
1313
1327
|
if (i != null) return r(i, t.name, n);
|
|
1314
1328
|
}
|
|
1315
|
-
let l =
|
|
1329
|
+
let l = Ue("", a);
|
|
1316
1330
|
if (l != null) return r(await e.resolveOoxmlContent(t, l) ?? $(e.resolveContentUrl(t)), t.name, n);
|
|
1317
1331
|
switch (a) {
|
|
1318
1332
|
case f.PDF: return r(await e.resolvePdfContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
|
|
1319
1333
|
case f.Markdown: return r(await e.resolveMarkdownContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
|
|
1320
1334
|
case f.JSON: return r(await e.resolveJsonContent(t) ?? $(e.resolveContentUrl(t)), t.name, n);
|
|
1321
1335
|
}
|
|
1322
|
-
let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h =
|
|
1336
|
+
let u = t.name ?? "", p = u.lastIndexOf("."), m = p === -1 ? "" : u.slice(p + 1).toLowerCase(), h = Ue(u);
|
|
1323
1337
|
if (h != null) return r(await e.resolveOoxmlContent(t, h) ?? $(e.resolveContentUrl(t)), t.name, n);
|
|
1324
1338
|
switch (m) {
|
|
1325
1339
|
case d.Markdown:
|
|
@@ -1336,8 +1350,8 @@ var Xe = ({ children: e }) => {
|
|
|
1336
1350
|
return i == null ? !1 : r(i, t.name, n);
|
|
1337
1351
|
}
|
|
1338
1352
|
}
|
|
1339
|
-
let g = t.name != null &&
|
|
1340
|
-
if (t.name != null && !
|
|
1353
|
+
let g = t.name != null && qe(t.name) || t.url != null && qe(st(t.url));
|
|
1354
|
+
if (t.name != null && !Ke(t.name) && !g) return r($(e.resolveContentUrl(t)), t.name, n);
|
|
1341
1355
|
if (g) {
|
|
1342
1356
|
let a = await e.resolveHtmlContent(t);
|
|
1343
1357
|
return a == null ? e.hasTextSource(t) ? r($(e.resolveContentUrl(t)), t.name, n) : t.url == null ? !1 : r({
|
|
@@ -1345,7 +1359,7 @@ var Xe = ({ children: e }) => {
|
|
|
1345
1359
|
url: t.url
|
|
1346
1360
|
}, t.name, n) : r(a, t.name, n);
|
|
1347
1361
|
}
|
|
1348
|
-
let _ = await e.resolveCodeContent(t,
|
|
1362
|
+
let _ = await e.resolveCodeContent(t, Ye(m));
|
|
1349
1363
|
return _ == null ? !1 : r(_, t.name, n);
|
|
1350
1364
|
}, [
|
|
1351
1365
|
o,
|
|
@@ -1353,7 +1367,7 @@ var Xe = ({ children: e }) => {
|
|
|
1353
1367
|
e
|
|
1354
1368
|
]);
|
|
1355
1369
|
return { openAttachmentCanvas: N(async (t, o = t.id, s) => {
|
|
1356
|
-
let d = () => s == null || s(), f = (e, t, r) => d() ? (n(e, t, r), !0) : (
|
|
1370
|
+
let d = () => s == null || s(), f = (e, t, r) => d() ? (n(e, t, r), !0) : ($e(e), !1);
|
|
1357
1371
|
switch (t.type) {
|
|
1358
1372
|
case c.Image: {
|
|
1359
1373
|
let r = e.resolveImageContent(t);
|
|
@@ -1390,4 +1404,4 @@ var Xe = ({ children: e }) => {
|
|
|
1390
1404
|
]) };
|
|
1391
1405
|
};
|
|
1392
1406
|
//#endregion
|
|
1393
|
-
export {
|
|
1407
|
+
export { Le as AttachmentCanvas, Fe as AttachmentCanvasBody, it as AttachmentCanvasContainer, nt as AttachmentCanvasProvider, i as AttachmentContentType, n as AttachmentErrorType, me as CodeContent, ot as InlineGroupedVisualizer, xe as McpAppCanvasRenderer, r as OoxmlFileType, t as OoxmlHighlightKind, Ze as createForbiddenCanvasContent, Xe as createLoadErrorCanvasContent, $ as createUnsupportedCanvasContent, a as downloadAttachmentContent, Ye as extensionToLanguage, Oe as findVisualizerForApplication, De as findVisualizerForMime, Ue as getOoxmlFileType, Ge as getOoxmlMimeType, ke as groupedVisualizerCanvasKey, o as isDownloadable, qe as isHtmlPreviewable, We as isOoxmlPreviewable, Ke as isTextPreviewable, Ae as partitionAttachmentsForApplicationVisualizer, rt as useAttachmentCanvas, ct as useOpenAttachmentCanvas };
|