@shapesos/clay 0.17.0 → 0.18.0
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/dist/ai-elements.cjs +3 -1
- package/dist/ai-elements.cjs.map +1 -1
- package/dist/ai-elements.js +4 -4
- package/dist/artifacts.cjs +963 -34
- package/dist/artifacts.cjs.map +1 -1
- package/dist/artifacts.d.cts +20 -3
- package/dist/artifacts.d.ts +20 -3
- package/dist/artifacts.js +13 -5
- package/dist/blocks.cjs +677 -50
- package/dist/blocks.cjs.map +1 -1
- package/dist/blocks.css +1 -1
- package/dist/blocks.d.cts +3 -3
- package/dist/blocks.d.ts +3 -3
- package/dist/blocks.js +5 -5
- package/dist/button.cjs +3 -1
- package/dist/button.cjs.map +1 -1
- package/dist/button.js +2 -2
- package/dist/capture.cjs +3 -1
- package/dist/capture.cjs.map +1 -1
- package/dist/capture.js +2 -2
- package/dist/chart.cjs +3 -1
- package/dist/chart.cjs.map +1 -1
- package/dist/chart.js +2 -2
- package/dist/chat.cjs +701 -74
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.d.cts +2 -2
- package/dist/chat.d.ts +2 -2
- package/dist/chat.js +6 -6
- package/dist/{chunk-46ZYTBX5.js → chunk-7MY4X4YL.js} +3 -3
- package/dist/chunk-BHHJOG5X.js +1 -0
- package/dist/{chunk-B6GAPZ2R.js → chunk-CATIRDZP.js} +5 -5
- package/dist/{chunk-B4U37WIH.js → chunk-CFCLVJIO.js} +2 -2
- package/dist/{chunk-PYDVANWI.js → chunk-E36VI2HA.js} +2 -2
- package/dist/{chunk-PUVZ2S3F.js → chunk-G4NXVFXU.js} +2 -2
- package/dist/{chunk-JAGNXEWK.js → chunk-GK4XW4BC.js} +2 -2
- package/dist/{chunk-4VE6ZXXW.js → chunk-MQP57DOP.js} +3 -3
- package/dist/{chunk-6YZ65KPW.js → chunk-QR4VBGK4.js} +673 -42
- package/dist/chunk-QR4VBGK4.js.map +1 -0
- package/dist/{chunk-JF3P66JF.js → chunk-SN3ORQSJ.js} +4 -2
- package/dist/{chunk-JF3P66JF.js.map → chunk-SN3ORQSJ.js.map} +1 -1
- package/dist/{chunk-PGR2MDDU.js → chunk-W66OJM55.js} +2 -2
- package/dist/{chunk-7OYIDM42.js → chunk-XKURJ72I.js} +2 -2
- package/dist/{dom-to-image-NATF3446.js → dom-to-image-QB7KMTAE.js} +3 -3
- package/dist/icon.cjs +3 -1
- package/dist/icon.cjs.map +1 -1
- package/dist/icon.js +2 -2
- package/dist/index.cjs +767 -132
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +19 -11
- package/dist/keyboard-shortcut.cjs +3 -1
- package/dist/keyboard-shortcut.cjs.map +1 -1
- package/dist/keyboard-shortcut.js +2 -2
- package/dist/text-area.cjs +3 -1
- package/dist/text-area.cjs.map +1 -1
- package/dist/text-area.js +2 -2
- package/dist/tokens.cjs +3 -1
- package/dist/tokens.cjs.map +1 -1
- package/dist/tokens.d.cts +1 -0
- package/dist/tokens.d.ts +1 -0
- package/dist/tokens.js +1 -1
- package/dist/{types-CW45GBXl.d.cts → types-BDYPVP2N.d.cts} +1 -1
- package/dist/{types-D1b8v7EY.d.ts → types-BMwa4bPW.d.ts} +1 -1
- package/dist/{types-GCkXbyFm.d.ts → types-C8JtnwNY.d.ts} +200 -4
- package/dist/{types-BzXPBy6s.d.cts → types-DTdDFU3O.d.cts} +200 -4
- package/package.json +1 -1
- package/dist/chunk-6YZ65KPW.js.map +0 -1
- package/dist/chunk-RSRNSWJN.js +0 -1
- /package/dist/{chunk-46ZYTBX5.js.map → chunk-7MY4X4YL.js.map} +0 -0
- /package/dist/{chunk-RSRNSWJN.js.map → chunk-BHHJOG5X.js.map} +0 -0
- /package/dist/{chunk-B6GAPZ2R.js.map → chunk-CATIRDZP.js.map} +0 -0
- /package/dist/{chunk-B4U37WIH.js.map → chunk-CFCLVJIO.js.map} +0 -0
- /package/dist/{chunk-PYDVANWI.js.map → chunk-E36VI2HA.js.map} +0 -0
- /package/dist/{chunk-PUVZ2S3F.js.map → chunk-G4NXVFXU.js.map} +0 -0
- /package/dist/{chunk-JAGNXEWK.js.map → chunk-GK4XW4BC.js.map} +0 -0
- /package/dist/{chunk-4VE6ZXXW.js.map → chunk-MQP57DOP.js.map} +0 -0
- /package/dist/{chunk-PGR2MDDU.js.map → chunk-W66OJM55.js.map} +0 -0
- /package/dist/{chunk-7OYIDM42.js.map → chunk-XKURJ72I.js.map} +0 -0
- /package/dist/{dom-to-image-NATF3446.js.map → dom-to-image-QB7KMTAE.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -122,7 +122,9 @@ var init_colors = __esm({
|
|
|
122
122
|
"red-200": "#FECACA",
|
|
123
123
|
"red-400": "#F7776C",
|
|
124
124
|
"red-500": "#EF4444",
|
|
125
|
-
"red-600": "#DC2626"
|
|
125
|
+
"red-600": "#DC2626",
|
|
126
|
+
// Deck
|
|
127
|
+
"deck-canvas": "#faf8f5"
|
|
126
128
|
};
|
|
127
129
|
}
|
|
128
130
|
});
|
|
@@ -16596,7 +16598,9 @@ __export(src_exports, {
|
|
|
16596
16598
|
ChatContext: () => ChatContext,
|
|
16597
16599
|
ChatMessage: () => ChatMessage,
|
|
16598
16600
|
DEFAULT_CHART_ARTIFACT_LABELS: () => DEFAULT_CHART_ARTIFACT_LABELS,
|
|
16601
|
+
DEFAULT_DECK_ARTIFACT_LABELS: () => DEFAULT_DECK_ARTIFACT_LABELS,
|
|
16599
16602
|
DEFAULT_TABLE_ARTIFACT_LABELS: () => DEFAULT_TABLE_ARTIFACT_LABELS,
|
|
16603
|
+
DeckArtifact: () => DeckArtifact,
|
|
16600
16604
|
ICON_POSITION: () => ICON_POSITION,
|
|
16601
16605
|
Icon: () => Icon,
|
|
16602
16606
|
IconButton: () => IconButton,
|
|
@@ -16622,6 +16626,8 @@ __export(src_exports, {
|
|
|
16622
16626
|
colors: () => colors,
|
|
16623
16627
|
convertTableToCSV: () => convertTableToCSV,
|
|
16624
16628
|
copyMessageText: () => copyMessageText,
|
|
16629
|
+
deckBlockTypes: () => deckBlockTypes,
|
|
16630
|
+
deckSlideKinds: () => deckSlideKinds,
|
|
16625
16631
|
escapeCsvField: () => escapeCsvField,
|
|
16626
16632
|
fontFamilies: () => fontFamilies,
|
|
16627
16633
|
isSafeDownloadUrl: () => isSafeDownloadUrl,
|
|
@@ -16954,7 +16960,8 @@ var blockTypes = {
|
|
|
16954
16960
|
// src/components/artifacts/artifact-base.ts
|
|
16955
16961
|
var artifactTypes = {
|
|
16956
16962
|
TABLE: "TABLE",
|
|
16957
|
-
CHART: "CHART"
|
|
16963
|
+
CHART: "CHART",
|
|
16964
|
+
DECK: "DECK"
|
|
16958
16965
|
};
|
|
16959
16966
|
|
|
16960
16967
|
// src/components/artifacts/chart-artifact/types.ts
|
|
@@ -16979,6 +16986,34 @@ var DEFAULT_TABLE_ARTIFACT_LABELS = {
|
|
|
16979
16986
|
empty: "No rows to display."
|
|
16980
16987
|
};
|
|
16981
16988
|
|
|
16989
|
+
// src/components/artifacts/deck-artifact/types.ts
|
|
16990
|
+
var deckBlockTypes = {
|
|
16991
|
+
TEXT: "TEXT",
|
|
16992
|
+
CHART: "CHART",
|
|
16993
|
+
TABLE: "TABLE"
|
|
16994
|
+
};
|
|
16995
|
+
var deckSlideKinds = {
|
|
16996
|
+
TITLE: "TITLE",
|
|
16997
|
+
AGENDA: "AGENDA",
|
|
16998
|
+
SECTION: "SECTION",
|
|
16999
|
+
CONTENT: "CONTENT",
|
|
17000
|
+
CLOSING: "CLOSING"
|
|
17001
|
+
};
|
|
17002
|
+
var DEFAULT_DECK_ARTIFACT_LABELS = {
|
|
17003
|
+
previous: "Previous slide",
|
|
17004
|
+
next: "Next slide",
|
|
17005
|
+
position: "Slide {current} of {total}",
|
|
17006
|
+
download: "Download",
|
|
17007
|
+
unavailable: "Deck content is unavailable.",
|
|
17008
|
+
enterFullscreen: "Fullscreen",
|
|
17009
|
+
exitFullscreen: "Exit fullscreen",
|
|
17010
|
+
thankYou: "Thank you",
|
|
17011
|
+
questions: "Questions?",
|
|
17012
|
+
agenda: "Agenda",
|
|
17013
|
+
chart: DEFAULT_CHART_ARTIFACT_LABELS,
|
|
17014
|
+
table: DEFAULT_TABLE_ARTIFACT_LABELS
|
|
17015
|
+
};
|
|
17016
|
+
|
|
16982
17017
|
// src/components/artifacts/chart-artifact/chart-artifact.tsx
|
|
16983
17018
|
var import_react13 = require("react");
|
|
16984
17019
|
|
|
@@ -17071,37 +17106,53 @@ var createReactComponent = (type, iconName, iconNamePascal, iconNode) => {
|
|
|
17071
17106
|
var __iconNode = [["path", { "d": "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", "key": "svg-0" }], ["path", { "d": "M12 8v4", "key": "svg-1" }], ["path", { "d": "M12 16h.01", "key": "svg-2" }]];
|
|
17072
17107
|
var IconAlertCircle = createReactComponent("outline", "alert-circle", "AlertCircle", __iconNode);
|
|
17073
17108
|
|
|
17109
|
+
// node_modules/@tabler/icons-react/dist/esm/icons/IconArrowsMaximize.mjs
|
|
17110
|
+
var __iconNode2 = [["path", { "d": "M16 4l4 0l0 4", "key": "svg-0" }], ["path", { "d": "M14 10l6 -6", "key": "svg-1" }], ["path", { "d": "M8 20l-4 0l0 -4", "key": "svg-2" }], ["path", { "d": "M4 20l6 -6", "key": "svg-3" }], ["path", { "d": "M16 20l4 0l0 -4", "key": "svg-4" }], ["path", { "d": "M14 14l6 6", "key": "svg-5" }], ["path", { "d": "M8 4l-4 0l0 4", "key": "svg-6" }], ["path", { "d": "M4 4l6 6", "key": "svg-7" }]];
|
|
17111
|
+
var IconArrowsMaximize = createReactComponent("outline", "arrows-maximize", "ArrowsMaximize", __iconNode2);
|
|
17112
|
+
|
|
17113
|
+
// node_modules/@tabler/icons-react/dist/esm/icons/IconArrowsMinimize.mjs
|
|
17114
|
+
var __iconNode3 = [["path", { "d": "M5 9l4 0l0 -4", "key": "svg-0" }], ["path", { "d": "M3 3l6 6", "key": "svg-1" }], ["path", { "d": "M5 15l4 0l0 4", "key": "svg-2" }], ["path", { "d": "M3 21l6 -6", "key": "svg-3" }], ["path", { "d": "M19 9l-4 0l0 -4", "key": "svg-4" }], ["path", { "d": "M15 9l6 -6", "key": "svg-5" }], ["path", { "d": "M19 15l-4 0l0 4", "key": "svg-6" }], ["path", { "d": "M15 15l6 6", "key": "svg-7" }]];
|
|
17115
|
+
var IconArrowsMinimize = createReactComponent("outline", "arrows-minimize", "ArrowsMinimize", __iconNode3);
|
|
17116
|
+
|
|
17074
17117
|
// node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.mjs
|
|
17075
|
-
var
|
|
17076
|
-
var IconCheck = createReactComponent("outline", "check", "Check",
|
|
17118
|
+
var __iconNode4 = [["path", { "d": "M5 12l5 5l10 -10", "key": "svg-0" }]];
|
|
17119
|
+
var IconCheck = createReactComponent("outline", "check", "Check", __iconNode4);
|
|
17120
|
+
|
|
17121
|
+
// node_modules/@tabler/icons-react/dist/esm/icons/IconChevronLeft.mjs
|
|
17122
|
+
var __iconNode5 = [["path", { "d": "M15 6l-6 6l6 6", "key": "svg-0" }]];
|
|
17123
|
+
var IconChevronLeft = createReactComponent("outline", "chevron-left", "ChevronLeft", __iconNode5);
|
|
17124
|
+
|
|
17125
|
+
// node_modules/@tabler/icons-react/dist/esm/icons/IconChevronRight.mjs
|
|
17126
|
+
var __iconNode6 = [["path", { "d": "M9 6l6 6l-6 6", "key": "svg-0" }]];
|
|
17127
|
+
var IconChevronRight = createReactComponent("outline", "chevron-right", "ChevronRight", __iconNode6);
|
|
17077
17128
|
|
|
17078
17129
|
// node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.mjs
|
|
17079
|
-
var
|
|
17080
|
-
var IconCopy = createReactComponent("outline", "copy", "Copy",
|
|
17130
|
+
var __iconNode7 = [["path", { "d": "M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666", "key": "svg-0" }], ["path", { "d": "M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1", "key": "svg-1" }]];
|
|
17131
|
+
var IconCopy = createReactComponent("outline", "copy", "Copy", __iconNode7);
|
|
17081
17132
|
|
|
17082
17133
|
// node_modules/@tabler/icons-react/dist/esm/icons/IconDownload.mjs
|
|
17083
|
-
var
|
|
17084
|
-
var IconDownload = createReactComponent("outline", "download", "Download",
|
|
17134
|
+
var __iconNode8 = [["path", { "d": "M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2", "key": "svg-0" }], ["path", { "d": "M7 11l5 5l5 -5", "key": "svg-1" }], ["path", { "d": "M12 4l0 12", "key": "svg-2" }]];
|
|
17135
|
+
var IconDownload = createReactComponent("outline", "download", "Download", __iconNode8);
|
|
17085
17136
|
|
|
17086
17137
|
// node_modules/@tabler/icons-react/dist/esm/icons/IconFileSpreadsheet.mjs
|
|
17087
|
-
var
|
|
17088
|
-
var IconFileSpreadsheet = createReactComponent("outline", "file-spreadsheet", "FileSpreadsheet",
|
|
17138
|
+
var __iconNode9 = [["path", { "d": "M14 3v4a1 1 0 0 0 1 1h4", "key": "svg-0" }], ["path", { "d": "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2", "key": "svg-1" }], ["path", { "d": "M8 11h8v7h-8l0 -7", "key": "svg-2" }], ["path", { "d": "M8 15h8", "key": "svg-3" }], ["path", { "d": "M11 11v7", "key": "svg-4" }]];
|
|
17139
|
+
var IconFileSpreadsheet = createReactComponent("outline", "file-spreadsheet", "FileSpreadsheet", __iconNode9);
|
|
17089
17140
|
|
|
17090
17141
|
// node_modules/@tabler/icons-react/dist/esm/icons/IconLoader2.mjs
|
|
17091
|
-
var
|
|
17092
|
-
var IconLoader2 = createReactComponent("outline", "loader-2", "Loader2",
|
|
17142
|
+
var __iconNode10 = [["path", { "d": "M12 3a9 9 0 1 0 9 9", "key": "svg-0" }]];
|
|
17143
|
+
var IconLoader2 = createReactComponent("outline", "loader-2", "Loader2", __iconNode10);
|
|
17093
17144
|
|
|
17094
17145
|
// node_modules/@tabler/icons-react/dist/esm/icons/IconPhoto.mjs
|
|
17095
|
-
var
|
|
17096
|
-
var IconPhoto = createReactComponent("outline", "photo", "Photo",
|
|
17146
|
+
var __iconNode11 = [["path", { "d": "M15 8h.01", "key": "svg-0" }], ["path", { "d": "M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12", "key": "svg-1" }], ["path", { "d": "M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5", "key": "svg-2" }], ["path", { "d": "M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3", "key": "svg-3" }]];
|
|
17147
|
+
var IconPhoto = createReactComponent("outline", "photo", "Photo", __iconNode11);
|
|
17097
17148
|
|
|
17098
17149
|
// node_modules/@tabler/icons-react/dist/esm/icons/IconThumbDown.mjs
|
|
17099
|
-
var
|
|
17100
|
-
var IconThumbDown = createReactComponent("outline", "thumb-down", "ThumbDown",
|
|
17150
|
+
var __iconNode12 = [["path", { "d": "M7 13v-8a1 1 0 0 0 -1 -1h-2a1 1 0 0 0 -1 1v7a1 1 0 0 0 1 1h3a4 4 0 0 1 4 4v1a2 2 0 0 0 4 0v-5h3a2 2 0 0 0 2 -2l-1 -5a2 3 0 0 0 -2 -2h-7a3 3 0 0 0 -3 3", "key": "svg-0" }]];
|
|
17151
|
+
var IconThumbDown = createReactComponent("outline", "thumb-down", "ThumbDown", __iconNode12);
|
|
17101
17152
|
|
|
17102
17153
|
// node_modules/@tabler/icons-react/dist/esm/icons/IconThumbUp.mjs
|
|
17103
|
-
var
|
|
17104
|
-
var IconThumbUp = createReactComponent("outline", "thumb-up", "ThumbUp",
|
|
17154
|
+
var __iconNode13 = [["path", { "d": "M7 11v8a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1h3a4 4 0 0 0 4 -4v-1a2 2 0 0 1 4 0v5h3a2 2 0 0 1 2 2l-1 5a2 3 0 0 1 -2 2h-7a3 3 0 0 1 -3 -3", "key": "svg-0" }]];
|
|
17155
|
+
var IconThumbUp = createReactComponent("outline", "thumb-up", "ThumbUp", __iconNode13);
|
|
17105
17156
|
|
|
17106
17157
|
// src/components/artifacts/artifact-copy-as-image-button/artifact-copy-as-image-button.tsx
|
|
17107
17158
|
var import_react6 = require("react");
|
|
@@ -18366,8 +18417,13 @@ var ChartArtifactService = {
|
|
|
18366
18417
|
toClipboardText: chartArtifactToClipboardText
|
|
18367
18418
|
};
|
|
18368
18419
|
|
|
18369
|
-
// src/components/artifacts/
|
|
18370
|
-
var
|
|
18420
|
+
// src/components/artifacts/deck-artifact/deck-artifact.tsx
|
|
18421
|
+
var import_react17 = require("react");
|
|
18422
|
+
var import_react_dom = require("react-dom");
|
|
18423
|
+
init_capture_exclude_attribute();
|
|
18424
|
+
|
|
18425
|
+
// src/components/artifacts/deck-artifact/deck-artifact-content.tsx
|
|
18426
|
+
var import_react16 = require("react");
|
|
18371
18427
|
|
|
18372
18428
|
// src/components/ui/table.tsx
|
|
18373
18429
|
var React3 = __toESM(require("react"), 1);
|
|
@@ -18514,9 +18570,333 @@ function renderEmptyRow(colSpan, emptyMessage) {
|
|
|
18514
18570
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableCell, { colSpan, className: "py-6 text-center text-sm text-muted-foreground", children: emptyMessage }) });
|
|
18515
18571
|
}
|
|
18516
18572
|
|
|
18517
|
-
// src/components/artifacts/
|
|
18518
|
-
|
|
18519
|
-
|
|
18573
|
+
// src/components/artifacts/deck-artifact/deck-markdown.tsx
|
|
18574
|
+
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
18575
|
+
var import_remark_breaks = __toESM(require("remark-breaks"), 1);
|
|
18576
|
+
var import_remark_gfm = __toESM(require("remark-gfm"), 1);
|
|
18577
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
18578
|
+
function sanitize(text2) {
|
|
18579
|
+
return text2.split("\n").filter((line) => {
|
|
18580
|
+
const t = line.trim();
|
|
18581
|
+
return !(t.startsWith("<!-- table-title:") && t.endsWith("-->"));
|
|
18582
|
+
}).join("\n");
|
|
18583
|
+
}
|
|
18584
|
+
var MARKDOWN_COMPONENTS = {
|
|
18585
|
+
h1: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h1", { className: "text-[30px] font-semibold leading-tight text-foreground mb-3", ...props }),
|
|
18586
|
+
h2: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: "text-[26px] font-semibold leading-tight text-foreground mb-2", ...props }),
|
|
18587
|
+
h3: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { className: "text-[24px] font-semibold leading-tight text-foreground mb-2", ...props }),
|
|
18588
|
+
h4: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h4", { className: "text-[24px] font-semibold leading-tight text-foreground mb-2", ...props }),
|
|
18589
|
+
h5: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h5", { className: "text-[24px] font-semibold leading-tight text-foreground mb-2", ...props }),
|
|
18590
|
+
h6: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h6", { className: "text-[24px] font-semibold leading-tight text-foreground mb-2", ...props }),
|
|
18591
|
+
p: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[22px] leading-relaxed text-foreground my-2", ...props }),
|
|
18592
|
+
ul: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "list-disc pl-7 text-[22px] leading-relaxed text-foreground my-2", ...props }),
|
|
18593
|
+
ol: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ol", { className: "list-decimal pl-7 text-[22px] leading-relaxed text-foreground my-2", ...props }),
|
|
18594
|
+
// react-markdown injects list metadata (`ordered` / `index` / `checked`) that must not leak to the DOM.
|
|
18595
|
+
li: ({ node: _node, ordered: _ordered, index: _index, checked: _checked, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { className: "my-1", ...props }),
|
|
18596
|
+
strong: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("strong", { className: "font-semibold", ...props }),
|
|
18597
|
+
em: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("em", { className: "italic", ...props }),
|
|
18598
|
+
// Gate `<img src>` against an http(s) allowlist. react-markdown v8 percent-encodes the URL but
|
|
18599
|
+
// does NOT protocol-filter image src (unlike link href), so an LLM-authored
|
|
18600
|
+
// `` / `` or a tracking-pixel `` would otherwise render
|
|
18601
|
+
// with the raw URL. Unsafe src → render nothing.
|
|
18602
|
+
img: ({ node: _node, src, ...props }) => typeof src === "string" && isSafeDownloadUrl(src) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src, className: "max-w-full", ...props }) : null,
|
|
18603
|
+
a: ({ node: _node, ...props }) => (
|
|
18604
|
+
// `rel` is forced AFTER `{...props}` so it can't be overridden — if a consumer ever adds
|
|
18605
|
+
// `linkTarget="_blank"`, LLM-authored links still can't reach `window.opener`.
|
|
18606
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("a", { className: "underline underline-offset-2", ...props, rel: "noopener noreferrer" })
|
|
18607
|
+
),
|
|
18608
|
+
// react-markdown passes `inline` to distinguish inline code from fenced blocks — strip it from the DOM.
|
|
18609
|
+
code: ({ node: _node, inline: _inline, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { className: "rounded bg-muted px-1.5 py-0.5 font-mono text-[18px]", ...props }),
|
|
18610
|
+
blockquote: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("blockquote", { className: "border-l-2 border-brown-alpha-12 pl-4 text-[22px] text-muted-foreground", ...props }),
|
|
18611
|
+
hr: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("hr", { className: "my-4 border-brown-alpha-12", ...props }),
|
|
18612
|
+
table: ({ node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("table", { className: "w-full border-collapse text-[20px]", ...props }) }),
|
|
18613
|
+
// react-markdown passes `isHeader` to cell renderers — strip it so it never reaches the DOM.
|
|
18614
|
+
th: ({ node: _node, isHeader: _isHeader, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("th", { className: "border-b border-brown-alpha-12 px-3 py-1.5 text-left font-medium", ...props }),
|
|
18615
|
+
td: ({ node: _node, isHeader: _isHeader, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", { className: "border-b border-brown-alpha-12 px-3 py-1.5", ...props })
|
|
18616
|
+
};
|
|
18617
|
+
function DeckMarkdown({ markdown }) {
|
|
18618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_markdown.default, { remarkPlugins: [import_remark_gfm.default, import_remark_breaks.default], components: MARKDOWN_COMPONENTS, children: sanitize(markdown) });
|
|
18619
|
+
}
|
|
18620
|
+
|
|
18621
|
+
// src/components/artifacts/deck-artifact/slide-renderers.tsx
|
|
18622
|
+
var import_react15 = require("react");
|
|
18623
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
18624
|
+
function safeLogoUrl(meta) {
|
|
18625
|
+
return meta?.logoUrl && isSafeDownloadUrl(meta.logoUrl) ? meta.logoUrl : null;
|
|
18626
|
+
}
|
|
18627
|
+
var DESIGN_W = 1280;
|
|
18628
|
+
var DESIGN_H = 720;
|
|
18629
|
+
var EYEBROW_H = 84;
|
|
18630
|
+
var CANVAS_LOGO_MAX_H = 48;
|
|
18631
|
+
var ACCENT_FONT = { fontFamily: `"${fontFamilies.CRIMSON_PRO}", serif`, fontStyle: "italic" };
|
|
18632
|
+
function SlideFrame({ meta, children, accent = false, bare = false }) {
|
|
18633
|
+
const frameRef = (0, import_react15.useRef)(null);
|
|
18634
|
+
const [scale2, setScale] = (0, import_react15.useState)(null);
|
|
18635
|
+
(0, import_react15.useLayoutEffect)(() => {
|
|
18636
|
+
const el = frameRef.current;
|
|
18637
|
+
if (!el) return;
|
|
18638
|
+
const apply = (width2) => {
|
|
18639
|
+
if (width2 > 0) setScale(width2 / DESIGN_W);
|
|
18640
|
+
};
|
|
18641
|
+
apply(el.clientWidth);
|
|
18642
|
+
const ro = new ResizeObserver((entries) => apply(entries[0]?.contentRect.width ?? 0));
|
|
18643
|
+
ro.observe(el);
|
|
18644
|
+
return () => ro.disconnect();
|
|
18645
|
+
}, []);
|
|
18646
|
+
const bg = accent ? "bg-indigo-600" : "bg-deck-canvas";
|
|
18647
|
+
const eyebrowColor = accent ? "text-white/70" : "text-brown-60";
|
|
18648
|
+
const borderColor = accent ? "border-white/20" : "border-brown-alpha-12";
|
|
18649
|
+
const logoSrc = safeLogoUrl(meta);
|
|
18650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref: frameRef, className: `relative aspect-[16/9] w-full overflow-hidden rounded-lg ${bg}`, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
18651
|
+
"div",
|
|
18652
|
+
{
|
|
18653
|
+
className: "absolute left-0 top-0 origin-top-left",
|
|
18654
|
+
style: {
|
|
18655
|
+
width: DESIGN_W,
|
|
18656
|
+
height: DESIGN_H,
|
|
18657
|
+
transform: `scale(${scale2 ?? 0})`,
|
|
18658
|
+
visibility: scale2 === null ? "hidden" : "visible"
|
|
18659
|
+
},
|
|
18660
|
+
children: [
|
|
18661
|
+
!bare ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
18662
|
+
"div",
|
|
18663
|
+
{
|
|
18664
|
+
className: `absolute inset-x-0 top-0 flex items-center justify-between border-b px-16 ${borderColor}`,
|
|
18665
|
+
style: { height: EYEBROW_H },
|
|
18666
|
+
children: [
|
|
18667
|
+
meta?.eyebrow ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: eyebrowColor, style: { ...ACCENT_FONT, fontSize: 22 }, children: meta.eyebrow }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", {}),
|
|
18668
|
+
logoSrc ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: logoSrc, alt: "", className: "object-contain", style: { maxHeight: CANVAS_LOGO_MAX_H } }) : null
|
|
18669
|
+
]
|
|
18670
|
+
}
|
|
18671
|
+
) : null,
|
|
18672
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute inset-x-0 bottom-0 overflow-hidden", style: { top: bare ? 0 : EYEBROW_H }, children })
|
|
18673
|
+
]
|
|
18674
|
+
}
|
|
18675
|
+
) });
|
|
18676
|
+
}
|
|
18677
|
+
function TitleSlide({ slide, meta }) {
|
|
18678
|
+
const logoSrc = safeLogoUrl(meta);
|
|
18679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SlideFrame, { meta, bare: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex h-full flex-col justify-center px-24 py-16", children: [
|
|
18680
|
+
logoSrc ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
18681
|
+
"img",
|
|
18682
|
+
{
|
|
18683
|
+
src: logoSrc,
|
|
18684
|
+
alt: "",
|
|
18685
|
+
className: "mb-16 object-contain object-left",
|
|
18686
|
+
style: { maxHeight: 56, maxWidth: 380 }
|
|
18687
|
+
}
|
|
18688
|
+
) : null,
|
|
18689
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
18690
|
+
"h1",
|
|
18691
|
+
{
|
|
18692
|
+
className: "font-bold tracking-tight text-brown-100",
|
|
18693
|
+
style: { fontSize: 92, lineHeight: 1.04, maxWidth: 1060 },
|
|
18694
|
+
children: slide.title
|
|
18695
|
+
}
|
|
18696
|
+
),
|
|
18697
|
+
slide.subtitle ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "mt-7 text-brown-70", style: { ...ACCENT_FONT, fontSize: 34 }, children: slide.subtitle }) : null,
|
|
18698
|
+
slide.description ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "mt-4 leading-relaxed text-brown-70", style: { fontSize: 24, maxWidth: 880 }, children: slide.description }) : null,
|
|
18699
|
+
meta?.date ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "mt-10 text-brown-70", style: { ...ACCENT_FONT, fontSize: 30 }, children: meta.date }) : null
|
|
18700
|
+
] }) });
|
|
18701
|
+
}
|
|
18702
|
+
function AgendaSlide({ slide, meta, labels }) {
|
|
18703
|
+
const items = slide.items ?? [];
|
|
18704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SlideFrame, { meta, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "h-full px-24 py-14", children: [
|
|
18705
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h2", { className: "mb-10 font-bold text-brown-90", style: { fontSize: 40 }, children: slide.title || labels.agenda }),
|
|
18706
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-baseline gap-6 border-b border-brown-alpha-12 py-5", children: [
|
|
18707
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "shrink-0 text-indigo-600", style: { ...ACCENT_FONT, fontSize: 28, width: 64 }, children: String(i + 1).padStart(2, "0") }),
|
|
18708
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-brown-90", style: { fontSize: 28 }, children: item })
|
|
18709
|
+
] }, i)) })
|
|
18710
|
+
] }) });
|
|
18711
|
+
}
|
|
18712
|
+
function SectionSlide({ slide, meta }) {
|
|
18713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SlideFrame, { meta, accent: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex h-full flex-col justify-center gap-6 px-24", children: [
|
|
18714
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h2", { className: "font-bold text-white", style: { fontSize: 72, lineHeight: 1.05, maxWidth: 940 }, children: slide.title }),
|
|
18715
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-2 bg-white/50", style: { width: 96, height: 5 } })
|
|
18716
|
+
] }) });
|
|
18717
|
+
}
|
|
18718
|
+
function ClosingSlide({ meta, labels }) {
|
|
18719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SlideFrame, { meta, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex h-full flex-col items-center justify-center gap-6 px-24 text-center", children: [
|
|
18720
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h1", { className: "font-bold text-brown-100", style: { fontSize: 72 }, children: labels.thankYou }),
|
|
18721
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-indigo-600", style: { ...ACCENT_FONT, fontSize: 36 }, children: labels.questions })
|
|
18722
|
+
] }) });
|
|
18723
|
+
}
|
|
18724
|
+
|
|
18725
|
+
// src/components/artifacts/deck-artifact/deck-artifact-content.tsx
|
|
18726
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
18727
|
+
var TABLE_BLOCK_MAX_SHIMMER_ROWS = 10;
|
|
18728
|
+
var TABLE_CHROME_RESERVE = 56;
|
|
18729
|
+
var VISUAL_FALLBACK_HEIGHT = 360;
|
|
18730
|
+
function DeckArtifactContent({
|
|
18731
|
+
slides,
|
|
18732
|
+
labels,
|
|
18733
|
+
onNavigate,
|
|
18734
|
+
meta,
|
|
18735
|
+
onDark = false,
|
|
18736
|
+
currentSlide,
|
|
18737
|
+
onSlideChange
|
|
18738
|
+
}) {
|
|
18739
|
+
const navBtnClass = onDark ? "[&_svg]:!text-white hover:!bg-white/20 disabled:opacity-40" : void 0;
|
|
18740
|
+
const navBtnSize = onDark ? "medium" : "small";
|
|
18741
|
+
const isControlled = currentSlide !== void 0;
|
|
18742
|
+
const [internalIndex, setInternalIndex] = (0, import_react16.useState)(0);
|
|
18743
|
+
const index2 = isControlled ? currentSlide : internalIndex;
|
|
18744
|
+
const current = Math.min(index2, slides.length - 1);
|
|
18745
|
+
const slide = slides[current];
|
|
18746
|
+
const goTo = (0, import_react16.useCallback)(
|
|
18747
|
+
(next) => {
|
|
18748
|
+
const clamped = Math.max(0, Math.min(next, slides.length - 1));
|
|
18749
|
+
if (isControlled) onSlideChange?.(clamped);
|
|
18750
|
+
else setInternalIndex(clamped);
|
|
18751
|
+
onNavigate?.(clamped);
|
|
18752
|
+
},
|
|
18753
|
+
[slides.length, onNavigate, isControlled, onSlideChange]
|
|
18754
|
+
);
|
|
18755
|
+
const position2 = labels.position.replace("{current}", String(current + 1)).replace("{total}", String(slides.length));
|
|
18756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-3 p-4", children: [
|
|
18757
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlideDispatch, { slide, labels, meta }),
|
|
18758
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
18759
|
+
"div",
|
|
18760
|
+
{
|
|
18761
|
+
className: `flex items-center justify-between border-t pt-2 ${onDark ? "border-white/20" : "border-brown-alpha-12"}`,
|
|
18762
|
+
children: [
|
|
18763
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
18764
|
+
IconButton,
|
|
18765
|
+
{
|
|
18766
|
+
icon: IconChevronLeft,
|
|
18767
|
+
size: navBtnSize,
|
|
18768
|
+
className: navBtnClass,
|
|
18769
|
+
"aria-label": labels.previous,
|
|
18770
|
+
disabled: current === 0,
|
|
18771
|
+
onClick: () => goTo(current - 1)
|
|
18772
|
+
}
|
|
18773
|
+
),
|
|
18774
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: `text-xs font-medium ${onDark ? "text-white/70" : "text-brown-70"}`, children: position2 }),
|
|
18775
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
18776
|
+
IconButton,
|
|
18777
|
+
{
|
|
18778
|
+
icon: IconChevronRight,
|
|
18779
|
+
size: navBtnSize,
|
|
18780
|
+
className: navBtnClass,
|
|
18781
|
+
"aria-label": labels.next,
|
|
18782
|
+
disabled: current === slides.length - 1,
|
|
18783
|
+
onClick: () => goTo(current + 1)
|
|
18784
|
+
}
|
|
18785
|
+
)
|
|
18786
|
+
]
|
|
18787
|
+
}
|
|
18788
|
+
)
|
|
18789
|
+
] });
|
|
18790
|
+
}
|
|
18791
|
+
function SlideDispatch({ slide, labels, meta }) {
|
|
18792
|
+
const kind = slide.kind ?? deckSlideKinds.CONTENT;
|
|
18793
|
+
switch (kind) {
|
|
18794
|
+
case deckSlideKinds.TITLE:
|
|
18795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TitleSlide, { slide, meta });
|
|
18796
|
+
case deckSlideKinds.AGENDA:
|
|
18797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AgendaSlide, { slide, meta, labels });
|
|
18798
|
+
case deckSlideKinds.SECTION:
|
|
18799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SectionSlide, { slide, meta });
|
|
18800
|
+
case deckSlideKinds.CLOSING:
|
|
18801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ClosingSlide, { meta, labels });
|
|
18802
|
+
case deckSlideKinds.CONTENT:
|
|
18803
|
+
default:
|
|
18804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ContentSlide, { slide, meta, labels });
|
|
18805
|
+
}
|
|
18806
|
+
}
|
|
18807
|
+
function isVisualBlock(block) {
|
|
18808
|
+
return block.type === deckBlockTypes.CHART || block.type === deckBlockTypes.TABLE;
|
|
18809
|
+
}
|
|
18810
|
+
function ContentSlide({ slide, meta, labels }) {
|
|
18811
|
+
const content2 = slide.content ?? [];
|
|
18812
|
+
const visuals = content2.filter(isVisualBlock);
|
|
18813
|
+
const texts = content2.filter(
|
|
18814
|
+
(b) => b.type === deckBlockTypes.TEXT
|
|
18815
|
+
);
|
|
18816
|
+
if (visuals.length === 1 && texts.length > 0) {
|
|
18817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlideFrame, { meta, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex h-full items-stretch gap-12 px-16 py-12", children: [
|
|
18818
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex w-[42%] shrink-0 flex-col overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(AutoFit, { children: [
|
|
18819
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "mb-5 font-bold leading-tight text-foreground", style: { fontSize: 34 }, children: slide.title }),
|
|
18820
|
+
texts.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DeckMarkdown, { markdown: block.markdown }, i))
|
|
18821
|
+
] }) }),
|
|
18822
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "min-h-0 min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FillVisual, { block: visuals[0], labels }) })
|
|
18823
|
+
] }) });
|
|
18824
|
+
}
|
|
18825
|
+
if (visuals.length > 0) {
|
|
18826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlideFrame, { meta, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex h-full flex-col gap-5 px-16 py-10", children: [
|
|
18827
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "shrink-0 font-bold leading-tight text-foreground", style: { fontSize: 32 }, children: slide.title }),
|
|
18828
|
+
content2.map(
|
|
18829
|
+
(block, i) => isVisualBlock(block) ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "min-h-0 min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FillVisual, { block, labels }) }, i) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "shrink-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DeckMarkdown, { markdown: block.markdown }) }, i)
|
|
18830
|
+
)
|
|
18831
|
+
] }) });
|
|
18832
|
+
}
|
|
18833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SlideFrame, { meta, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "h-full px-24 py-12", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(AutoFit, { children: [
|
|
18834
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "mb-6 font-bold leading-tight text-foreground", style: { fontSize: 38 }, children: slide.title }),
|
|
18835
|
+
texts.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DeckMarkdown, { markdown: block.markdown }, i))
|
|
18836
|
+
] }) }) });
|
|
18837
|
+
}
|
|
18838
|
+
function AutoFit({ children }) {
|
|
18839
|
+
const boxRef = (0, import_react16.useRef)(null);
|
|
18840
|
+
const contentRef = (0, import_react16.useRef)(null);
|
|
18841
|
+
const [fit, setFit] = (0, import_react16.useState)({ scale: 1, height: 0 });
|
|
18842
|
+
(0, import_react16.useLayoutEffect)(() => {
|
|
18843
|
+
const boxEl = boxRef.current;
|
|
18844
|
+
const contentEl = contentRef.current;
|
|
18845
|
+
if (!boxEl || !contentEl) return;
|
|
18846
|
+
const measure = () => {
|
|
18847
|
+
const avail = boxEl.clientHeight;
|
|
18848
|
+
const natural = contentEl.offsetHeight;
|
|
18849
|
+
const scale2 = avail > 0 && natural > avail ? avail / natural : 1;
|
|
18850
|
+
setFit({ scale: scale2, height: natural * scale2 });
|
|
18851
|
+
};
|
|
18852
|
+
measure();
|
|
18853
|
+
const ro = new ResizeObserver(measure);
|
|
18854
|
+
ro.observe(boxEl);
|
|
18855
|
+
ro.observe(contentEl);
|
|
18856
|
+
return () => ro.disconnect();
|
|
18857
|
+
}, []);
|
|
18858
|
+
const scaled = fit.scale < 1;
|
|
18859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref: boxRef, className: "flex h-full min-h-0 w-full flex-col justify-center overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: scaled ? { height: fit.height } : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
18860
|
+
"div",
|
|
18861
|
+
{
|
|
18862
|
+
ref: contentRef,
|
|
18863
|
+
className: "w-full origin-top-left",
|
|
18864
|
+
style: scaled ? { transform: `scale(${fit.scale})` } : void 0,
|
|
18865
|
+
children
|
|
18866
|
+
}
|
|
18867
|
+
) }) });
|
|
18868
|
+
}
|
|
18869
|
+
function FillVisual({ block, labels }) {
|
|
18870
|
+
const ref = (0, import_react16.useRef)(null);
|
|
18871
|
+
const [height2, setHeight] = (0, import_react16.useState)(VISUAL_FALLBACK_HEIGHT);
|
|
18872
|
+
(0, import_react16.useLayoutEffect)(() => {
|
|
18873
|
+
const el = ref.current;
|
|
18874
|
+
if (!el) return;
|
|
18875
|
+
const apply = (h) => {
|
|
18876
|
+
if (h > 0) setHeight(h);
|
|
18877
|
+
};
|
|
18878
|
+
apply(el.clientHeight);
|
|
18879
|
+
const ro = new ResizeObserver((entries) => apply(entries[0]?.contentRect.height ?? 0));
|
|
18880
|
+
ro.observe(el);
|
|
18881
|
+
return () => ro.disconnect();
|
|
18882
|
+
}, []);
|
|
18883
|
+
const chartLabels = labels.chart ?? DEFAULT_CHART_ARTIFACT_LABELS;
|
|
18884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref, className: "h-full min-h-0 w-full overflow-hidden", children: block.type === deckBlockTypes.CHART ? (
|
|
18885
|
+
// ChartArtifactContent assumes a non-empty rowset (the standalone ChartArtifact guards
|
|
18886
|
+
// `rows.length > 0` upstream); mirror that guard here so an empty inline chart shows the
|
|
18887
|
+
// localized empty status instead of a blank chart area.
|
|
18888
|
+
block.rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StatusMessage, { $tone: "info", children: chartLabels.empty }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { height: height2 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChartArtifactContent, { config: block.config, rows: block.rows, labels: chartLabels }) })
|
|
18889
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
18890
|
+
TableArtifactContent,
|
|
18891
|
+
{
|
|
18892
|
+
columns: block.config.columns,
|
|
18893
|
+
data: { status: "ready", rows: block.rows, error: null },
|
|
18894
|
+
knownRowCount: block.config.stats?.rowCount ?? block.rows.length,
|
|
18895
|
+
maxShimmerRows: TABLE_BLOCK_MAX_SHIMMER_ROWS,
|
|
18896
|
+
maxBodyHeight: Math.max(0, height2 - TABLE_CHROME_RESERVE),
|
|
18897
|
+
labels: labels.table ?? DEFAULT_TABLE_ARTIFACT_LABELS
|
|
18898
|
+
}
|
|
18899
|
+
) });
|
|
18520
18900
|
}
|
|
18521
18901
|
|
|
18522
18902
|
// src/components/artifacts/table-artifact/validate.ts
|
|
@@ -18535,19 +18915,265 @@ function isValidTableColumn(column) {
|
|
|
18535
18915
|
return true;
|
|
18536
18916
|
}
|
|
18537
18917
|
|
|
18538
|
-
// src/components/artifacts/
|
|
18539
|
-
|
|
18918
|
+
// src/components/artifacts/deck-artifact/validate.ts
|
|
18919
|
+
function isValidDeckConfig(config) {
|
|
18920
|
+
if (!config || typeof config !== "object") return false;
|
|
18921
|
+
const candidate = config;
|
|
18922
|
+
if (!Array.isArray(candidate.slides)) return false;
|
|
18923
|
+
if (candidate.slides.length === 0) return false;
|
|
18924
|
+
return candidate.slides.every(isValidDeckSlide);
|
|
18925
|
+
}
|
|
18926
|
+
function isValidDeckSlide(slide) {
|
|
18927
|
+
if (!slide || typeof slide !== "object") return false;
|
|
18928
|
+
const candidate = slide;
|
|
18929
|
+
if (typeof candidate.title !== "string") return false;
|
|
18930
|
+
const kind = typeof candidate.kind === "string" ? candidate.kind : deckSlideKinds.CONTENT;
|
|
18931
|
+
if (kind === deckSlideKinds.CONTENT && !Array.isArray(candidate.content)) return false;
|
|
18932
|
+
const content2 = Array.isArray(candidate.content) ? candidate.content : [];
|
|
18933
|
+
if (candidate.items != null) {
|
|
18934
|
+
if (!Array.isArray(candidate.items)) return false;
|
|
18935
|
+
if (!candidate.items.every((item) => typeof item === "string")) return false;
|
|
18936
|
+
}
|
|
18937
|
+
return content2.every(isValidDeckBlock);
|
|
18938
|
+
}
|
|
18939
|
+
function isValidDeckBlock(block) {
|
|
18940
|
+
if (!block || typeof block !== "object") return false;
|
|
18941
|
+
const candidate = block;
|
|
18942
|
+
switch (candidate.type) {
|
|
18943
|
+
case deckBlockTypes.TEXT:
|
|
18944
|
+
return typeof candidate.markdown === "string";
|
|
18945
|
+
case deckBlockTypes.CHART:
|
|
18946
|
+
return isValidChartConfig(candidate.config) && Array.isArray(candidate.rows);
|
|
18947
|
+
case deckBlockTypes.TABLE:
|
|
18948
|
+
return isValidTableConfig(candidate.config) && Array.isArray(candidate.rows);
|
|
18949
|
+
default:
|
|
18950
|
+
return false;
|
|
18951
|
+
}
|
|
18952
|
+
}
|
|
18953
|
+
|
|
18954
|
+
// src/components/artifacts/deck-artifact/deck-artifact.tsx
|
|
18955
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
18540
18956
|
var TITLE_CLASSES2 = "text-sm font-semibold text-foreground";
|
|
18957
|
+
function DeckArtifact({ artifact, labels, callbacks }) {
|
|
18958
|
+
const validConfig = isValidDeckConfig(artifact.config);
|
|
18959
|
+
const [isFullscreen, setIsFullscreen] = (0, import_react17.useState)(false);
|
|
18960
|
+
const [currentSlide, setCurrentSlide] = (0, import_react17.useState)(0);
|
|
18961
|
+
(0, import_react17.useEffect)(() => {
|
|
18962
|
+
if (validConfig) return;
|
|
18963
|
+
console.warn("[clay] DeckArtifact: malformed `config` \u2014 skipping render.");
|
|
18964
|
+
}, [validConfig]);
|
|
18965
|
+
(0, import_react17.useEffect)(() => {
|
|
18966
|
+
if (!isFullscreen) return;
|
|
18967
|
+
const handleKey = (e) => {
|
|
18968
|
+
if (e.key === "Escape") setIsFullscreen(false);
|
|
18969
|
+
};
|
|
18970
|
+
document.addEventListener("keydown", handleKey);
|
|
18971
|
+
const previousOverflow = document.documentElement.style.overflow;
|
|
18972
|
+
document.documentElement.style.overflow = "hidden";
|
|
18973
|
+
return () => {
|
|
18974
|
+
document.removeEventListener("keydown", handleKey);
|
|
18975
|
+
document.documentElement.style.overflow = previousOverflow;
|
|
18976
|
+
};
|
|
18977
|
+
}, [isFullscreen]);
|
|
18978
|
+
const resolvedLabels = (0, import_react17.useMemo)(
|
|
18979
|
+
() => ({
|
|
18980
|
+
...DEFAULT_DECK_ARTIFACT_LABELS,
|
|
18981
|
+
...labels ?? {},
|
|
18982
|
+
chart: { ...DEFAULT_CHART_ARTIFACT_LABELS, ...labels?.chart ?? {} },
|
|
18983
|
+
table: { ...DEFAULT_TABLE_ARTIFACT_LABELS, ...labels?.table ?? {} }
|
|
18984
|
+
}),
|
|
18985
|
+
[labels]
|
|
18986
|
+
);
|
|
18987
|
+
const onNavigate = callbacks?.onNavigate;
|
|
18988
|
+
const handleNavigate = onNavigate ? (slideIndex) => onNavigate(artifact, slideIndex) : void 0;
|
|
18989
|
+
const onDownload = callbacks?.onDownload;
|
|
18990
|
+
const handleDownload = onDownload ? () => onDownload(artifact) : void 0;
|
|
18991
|
+
const presignedUrl = artifact.protectedAsset?.presignedUrl ?? null;
|
|
18992
|
+
const showDownload = presignedUrl !== null && isSafeDownloadUrl(presignedUrl);
|
|
18993
|
+
const meta = artifact.config?.meta;
|
|
18994
|
+
const handleOpenFullscreen = () => setIsFullscreen(true);
|
|
18995
|
+
const handleCloseFullscreen = () => setIsFullscreen(false);
|
|
18996
|
+
const actions = /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(ArtifactActions, { ...{ [CAPTURE_EXCLUDE_ATTRIBUTE]: "" }, children: [
|
|
18997
|
+
showDownload ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArtifactDownloadButton, { href: presignedUrl ?? "", label: resolvedLabels.download, onClick: handleDownload }) : null,
|
|
18998
|
+
validConfig ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
18999
|
+
IconButton,
|
|
19000
|
+
{
|
|
19001
|
+
icon: IconArrowsMaximize,
|
|
19002
|
+
size: "small",
|
|
19003
|
+
"aria-label": resolvedLabels.enterFullscreen,
|
|
19004
|
+
onClick: handleOpenFullscreen
|
|
19005
|
+
}
|
|
19006
|
+
) : null
|
|
19007
|
+
] });
|
|
19008
|
+
if (!validConfig) {
|
|
19009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Artifact, { className: "shadow-none w-full rounded-2xl bg-background/70", children: [
|
|
19010
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(ArtifactHeader, { className: "bg-background/70", children: [
|
|
19011
|
+
artifact.title ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArtifactTitle, { className: TITLE_CLASSES2, children: artifact.title }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", {}),
|
|
19012
|
+
actions
|
|
19013
|
+
] }),
|
|
19014
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArtifactContent, { className: "p-0", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StatusMessage, { $tone: "info", children: resolvedLabels.unavailable }) })
|
|
19015
|
+
] });
|
|
19016
|
+
}
|
|
19017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
19018
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Artifact, { className: "shadow-none w-full rounded-2xl bg-background/70", children: [
|
|
19019
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(ArtifactHeader, { className: "bg-background/70", children: [
|
|
19020
|
+
artifact.title ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArtifactTitle, { className: TITLE_CLASSES2, children: artifact.title }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", {}),
|
|
19021
|
+
actions
|
|
19022
|
+
] }),
|
|
19023
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArtifactContent, { className: "p-0", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
19024
|
+
DeckArtifactContent,
|
|
19025
|
+
{
|
|
19026
|
+
slides: artifact.config.slides,
|
|
19027
|
+
labels: resolvedLabels,
|
|
19028
|
+
onNavigate: handleNavigate,
|
|
19029
|
+
meta,
|
|
19030
|
+
currentSlide,
|
|
19031
|
+
onSlideChange: setCurrentSlide
|
|
19032
|
+
}
|
|
19033
|
+
) })
|
|
19034
|
+
] }),
|
|
19035
|
+
isFullscreen && (0, import_react_dom.createPortal)(
|
|
19036
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
19037
|
+
FullscreenOverlay,
|
|
19038
|
+
{
|
|
19039
|
+
artifact,
|
|
19040
|
+
resolvedLabels,
|
|
19041
|
+
onNavigate: handleNavigate,
|
|
19042
|
+
currentSlide,
|
|
19043
|
+
onSlideChange: setCurrentSlide,
|
|
19044
|
+
onClose: handleCloseFullscreen
|
|
19045
|
+
}
|
|
19046
|
+
),
|
|
19047
|
+
document.body
|
|
19048
|
+
)
|
|
19049
|
+
] });
|
|
19050
|
+
}
|
|
19051
|
+
function FullscreenOverlay({
|
|
19052
|
+
artifact,
|
|
19053
|
+
resolvedLabels,
|
|
19054
|
+
onNavigate,
|
|
19055
|
+
currentSlide,
|
|
19056
|
+
onSlideChange,
|
|
19057
|
+
onClose
|
|
19058
|
+
}) {
|
|
19059
|
+
const meta = artifact.config?.meta;
|
|
19060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
19061
|
+
"div",
|
|
19062
|
+
{
|
|
19063
|
+
className: "fixed inset-0 z-[2147483647] flex items-center justify-center bg-black/80",
|
|
19064
|
+
role: "dialog",
|
|
19065
|
+
"aria-modal": "true",
|
|
19066
|
+
"aria-label": resolvedLabels.exitFullscreen,
|
|
19067
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "relative", style: { width: "min(94vw, calc(82vh * 16 / 9))" }, children: [
|
|
19068
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
19069
|
+
DeckArtifactContent,
|
|
19070
|
+
{
|
|
19071
|
+
slides: artifact.config.slides,
|
|
19072
|
+
labels: resolvedLabels,
|
|
19073
|
+
onNavigate,
|
|
19074
|
+
meta,
|
|
19075
|
+
currentSlide,
|
|
19076
|
+
onSlideChange,
|
|
19077
|
+
onDark: true
|
|
19078
|
+
}
|
|
19079
|
+
),
|
|
19080
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
19081
|
+
"button",
|
|
19082
|
+
{
|
|
19083
|
+
className: "absolute -top-10 right-6 flex items-center gap-1.5 text-sm text-white/80 hover:text-white",
|
|
19084
|
+
"aria-label": resolvedLabels.exitFullscreen,
|
|
19085
|
+
onClick: onClose,
|
|
19086
|
+
children: [
|
|
19087
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(IconArrowsMinimize, { size: 16 }),
|
|
19088
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: resolvedLabels.exitFullscreen })
|
|
19089
|
+
]
|
|
19090
|
+
}
|
|
19091
|
+
)
|
|
19092
|
+
] })
|
|
19093
|
+
}
|
|
19094
|
+
);
|
|
19095
|
+
}
|
|
19096
|
+
|
|
19097
|
+
// src/components/artifacts/deck-artifact/to-clipboard-text.ts
|
|
19098
|
+
function deckArtifactToClipboardText(artifact) {
|
|
19099
|
+
const header = artifact.title?.trim() || "Deck";
|
|
19100
|
+
const slides = artifact.config?.slides ?? [];
|
|
19101
|
+
const body = slides.map((slide, i) => slideToText(slide, i)).join("\n\n");
|
|
19102
|
+
return body ? `${header}
|
|
19103
|
+
|
|
19104
|
+
${body}` : header;
|
|
19105
|
+
}
|
|
19106
|
+
function slideToText(slide, index2) {
|
|
19107
|
+
const kind = slide.kind ?? deckSlideKinds.CONTENT;
|
|
19108
|
+
const prefix = `Slide ${index2 + 1}: `;
|
|
19109
|
+
switch (kind) {
|
|
19110
|
+
case deckSlideKinds.TITLE: {
|
|
19111
|
+
const parts = [slide.title];
|
|
19112
|
+
if (slide.subtitle) parts.push(slide.subtitle);
|
|
19113
|
+
if (slide.description) parts.push(slide.description);
|
|
19114
|
+
return `${prefix}${parts.join(" \u2014 ")}`.trim();
|
|
19115
|
+
}
|
|
19116
|
+
case deckSlideKinds.AGENDA: {
|
|
19117
|
+
const items = (slide.items ?? []).map((item, i) => ` ${String(i + 1).padStart(2, "0")}. ${item}`).join("\n");
|
|
19118
|
+
return `${prefix}${slide.title || "Agenda"}${items ? `
|
|
19119
|
+
${items}` : ""}`.trim();
|
|
19120
|
+
}
|
|
19121
|
+
case deckSlideKinds.SECTION:
|
|
19122
|
+
return `${prefix}${slide.title}`.trim();
|
|
19123
|
+
case deckSlideKinds.CLOSING:
|
|
19124
|
+
return `${prefix}Thank you`.trim();
|
|
19125
|
+
case deckSlideKinds.CONTENT:
|
|
19126
|
+
default: {
|
|
19127
|
+
const blocks = (slide.content ?? []).map(blockToText).filter(Boolean).join("\n\n");
|
|
19128
|
+
return `${prefix}${slide.title}${blocks ? `
|
|
19129
|
+
${blocks}` : ""}`.trim();
|
|
19130
|
+
}
|
|
19131
|
+
}
|
|
19132
|
+
}
|
|
19133
|
+
function blockToText(block) {
|
|
19134
|
+
switch (block.type) {
|
|
19135
|
+
case deckBlockTypes.TEXT:
|
|
19136
|
+
return block.markdown.trim();
|
|
19137
|
+
case deckBlockTypes.CHART:
|
|
19138
|
+
return `[Chart: ${block.config.variant}]`;
|
|
19139
|
+
case deckBlockTypes.TABLE: {
|
|
19140
|
+
const columnCount = block.config.columns.length;
|
|
19141
|
+
const rowCount = block.rows.length;
|
|
19142
|
+
return `[Table: ${columnCount} column${columnCount === 1 ? "" : "s"} \xD7 ${rowCount} row${rowCount === 1 ? "" : "s"}]`;
|
|
19143
|
+
}
|
|
19144
|
+
default:
|
|
19145
|
+
return "";
|
|
19146
|
+
}
|
|
19147
|
+
}
|
|
19148
|
+
|
|
19149
|
+
// src/components/artifacts/artifact-services/deck-artifact-service.ts
|
|
19150
|
+
var DeckArtifactService = {
|
|
19151
|
+
type: artifactTypes.DECK,
|
|
19152
|
+
Component: DeckArtifact,
|
|
19153
|
+
toClipboardText: deckArtifactToClipboardText
|
|
19154
|
+
};
|
|
19155
|
+
|
|
19156
|
+
// src/components/artifacts/table-artifact/table-artifact.tsx
|
|
19157
|
+
var import_react18 = require("react");
|
|
19158
|
+
|
|
19159
|
+
// src/components/artifacts/table-artifact/use-table-artifact-data.ts
|
|
19160
|
+
function useTableArtifactData(presignedUrl, columns) {
|
|
19161
|
+
return useRowsArtifactData(presignedUrl, columns, parseCsv);
|
|
19162
|
+
}
|
|
19163
|
+
|
|
19164
|
+
// src/components/artifacts/table-artifact/table-artifact.tsx
|
|
19165
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
19166
|
+
var TITLE_CLASSES3 = "text-sm font-semibold text-foreground";
|
|
18541
19167
|
var TABLE_MAX_BODY_HEIGHT = 480;
|
|
18542
19168
|
var MAX_SHIMMER_ROWS = 10;
|
|
18543
19169
|
function TableArtifact({ artifact, labels, callbacks }) {
|
|
18544
19170
|
const validConfig = isValidTableConfig(artifact.config);
|
|
18545
19171
|
const validColumns = validConfig ? artifact.config.columns : null;
|
|
18546
|
-
(0,
|
|
19172
|
+
(0, import_react18.useEffect)(() => {
|
|
18547
19173
|
if (validConfig) return;
|
|
18548
19174
|
console.warn("[clay] TableArtifact: malformed `config` \u2014 skipping render.");
|
|
18549
19175
|
}, [validConfig]);
|
|
18550
|
-
const resolvedLabels = (0,
|
|
19176
|
+
const resolvedLabels = (0, import_react18.useMemo)(
|
|
18551
19177
|
() => ({ ...DEFAULT_TABLE_ARTIFACT_LABELS, ...labels ?? {} }),
|
|
18552
19178
|
[labels]
|
|
18553
19179
|
);
|
|
@@ -18559,10 +19185,10 @@ function TableArtifact({ artifact, labels, callbacks }) {
|
|
|
18559
19185
|
const onDownload = callbacks?.onDownload;
|
|
18560
19186
|
const handleDownloadClick = onDownload ? () => onDownload(artifact) : void 0;
|
|
18561
19187
|
if (!validConfig || !validColumns) {
|
|
18562
|
-
return /* @__PURE__ */ (0,
|
|
18563
|
-
/* @__PURE__ */ (0,
|
|
18564
|
-
artifact.title ? /* @__PURE__ */ (0,
|
|
18565
|
-
presignedUrl ? /* @__PURE__ */ (0,
|
|
19188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Artifact, { className: "shadow-none w-full rounded-2xl bg-background/70", children: [
|
|
19189
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ArtifactHeader, { className: "bg-background/70", children: [
|
|
19190
|
+
artifact.title ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArtifactTitle, { className: TITLE_CLASSES3, children: artifact.title }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", {}),
|
|
19191
|
+
presignedUrl ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArtifactActions, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
18566
19192
|
ArtifactDownloadButton,
|
|
18567
19193
|
{
|
|
18568
19194
|
href: presignedUrl,
|
|
@@ -18571,17 +19197,17 @@ function TableArtifact({ artifact, labels, callbacks }) {
|
|
|
18571
19197
|
}
|
|
18572
19198
|
) }) : null
|
|
18573
19199
|
] }),
|
|
18574
|
-
/* @__PURE__ */ (0,
|
|
19200
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArtifactContent, { className: "p-0 overflow-auto", style: { maxHeight: TABLE_MAX_BODY_HEIGHT }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StatusMessage, { $tone: "info", children: resolvedLabels.unavailable }) })
|
|
18575
19201
|
] });
|
|
18576
19202
|
}
|
|
18577
19203
|
return (
|
|
18578
19204
|
// The table body owns its own scroll container (`ArtifactTable` inside `TableArtifactContent`).
|
|
18579
19205
|
// Disable the outer overflow container so only one scroll context exists — this prevents
|
|
18580
19206
|
// double-scroll nesting and lets `useScrollShadow` find the correct scroll ancestor.
|
|
18581
|
-
/* @__PURE__ */ (0,
|
|
18582
|
-
/* @__PURE__ */ (0,
|
|
18583
|
-
artifact.title ? /* @__PURE__ */ (0,
|
|
18584
|
-
/* @__PURE__ */ (0,
|
|
19207
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Artifact, { className: "shadow-none w-full rounded-2xl bg-background/70", children: [
|
|
19208
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ArtifactHeader, { className: "bg-background/70", children: [
|
|
19209
|
+
artifact.title ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArtifactTitle, { className: TITLE_CLASSES3, children: artifact.title }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", {}),
|
|
19210
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArtifactActions, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
18585
19211
|
ArtifactDownloadButton,
|
|
18586
19212
|
{
|
|
18587
19213
|
href: presignedUrl ?? "",
|
|
@@ -18590,7 +19216,7 @@ function TableArtifact({ artifact, labels, callbacks }) {
|
|
|
18590
19216
|
}
|
|
18591
19217
|
) })
|
|
18592
19218
|
] }),
|
|
18593
|
-
/* @__PURE__ */ (0,
|
|
19219
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArtifactContent, { className: "p-0 overflow-visible", style: { maxHeight: "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
18594
19220
|
TableArtifactContent,
|
|
18595
19221
|
{
|
|
18596
19222
|
columns: validColumns,
|
|
@@ -18621,7 +19247,8 @@ var TableArtifactService = {
|
|
|
18621
19247
|
// src/components/artifacts/artifact-services/index.ts
|
|
18622
19248
|
var ArtifactServices = {
|
|
18623
19249
|
[artifactTypes.TABLE]: TableArtifactService,
|
|
18624
|
-
[artifactTypes.CHART]: ChartArtifactService
|
|
19250
|
+
[artifactTypes.CHART]: ChartArtifactService,
|
|
19251
|
+
[artifactTypes.DECK]: DeckArtifactService
|
|
18625
19252
|
};
|
|
18626
19253
|
function artifactToClipboardText(artifact) {
|
|
18627
19254
|
const entry = ArtifactServices[artifact.type];
|
|
@@ -18632,13 +19259,13 @@ function artifactToClipboardText(artifact) {
|
|
|
18632
19259
|
}
|
|
18633
19260
|
|
|
18634
19261
|
// src/components/blocks/artifact-ref-block/artifact-ref-block.tsx
|
|
18635
|
-
var
|
|
19262
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
18636
19263
|
function ArtifactRefBlock({ block }) {
|
|
18637
19264
|
const { artifact, labels, callbacks } = block.payload;
|
|
18638
19265
|
const entry = ArtifactServices[artifact.type];
|
|
18639
19266
|
if (!entry) return null;
|
|
18640
19267
|
const Component = entry.Component;
|
|
18641
|
-
return /* @__PURE__ */ (0,
|
|
19268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Component, { artifact, labels, callbacks });
|
|
18642
19269
|
}
|
|
18643
19270
|
|
|
18644
19271
|
// src/components/blocks/block-services/artifact-ref-block-service.ts
|
|
@@ -18673,9 +19300,9 @@ function markdownToPlainText(markdown) {
|
|
|
18673
19300
|
}
|
|
18674
19301
|
|
|
18675
19302
|
// src/components/blocks/text-block/text-block.tsx
|
|
18676
|
-
var
|
|
18677
|
-
var
|
|
18678
|
-
var
|
|
19303
|
+
var import_react_markdown2 = __toESM(require("react-markdown"), 1);
|
|
19304
|
+
var import_remark_breaks2 = __toESM(require("remark-breaks"), 1);
|
|
19305
|
+
var import_remark_gfm2 = __toESM(require("remark-gfm"), 1);
|
|
18679
19306
|
|
|
18680
19307
|
// src/components/blocks/scrollable-table/scrollable-table-styles.ts
|
|
18681
19308
|
var import_styled_components3 = __toESM(require("styled-components"), 1);
|
|
@@ -18690,13 +19317,13 @@ var TableScroll = import_styled_components3.default.div`
|
|
|
18690
19317
|
`;
|
|
18691
19318
|
|
|
18692
19319
|
// src/components/blocks/scrollable-table/scrollable-table.tsx
|
|
18693
|
-
var
|
|
19320
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
18694
19321
|
function ScrollableTable({ node: _node, ...props }) {
|
|
18695
|
-
return /* @__PURE__ */ (0,
|
|
19322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TableContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TableScroll, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("table", { ...props }) }) });
|
|
18696
19323
|
}
|
|
18697
19324
|
|
|
18698
19325
|
// src/components/blocks/text-block/sanitize.ts
|
|
18699
|
-
function
|
|
19326
|
+
function sanitize2(text2) {
|
|
18700
19327
|
return text2.split("\n").filter((line) => {
|
|
18701
19328
|
const t = line.trim();
|
|
18702
19329
|
return !(t.startsWith("<!-- table-title:") && t.endsWith("-->"));
|
|
@@ -18836,12 +19463,12 @@ var TextBlockWrapper = import_styled_components4.default.div`
|
|
|
18836
19463
|
`;
|
|
18837
19464
|
|
|
18838
19465
|
// src/components/blocks/text-block/text-block.tsx
|
|
18839
|
-
var
|
|
19466
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
18840
19467
|
var markdownComponents = {
|
|
18841
|
-
table: ((tableProps) => /* @__PURE__ */ (0,
|
|
19468
|
+
table: ((tableProps) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ScrollableTable, { ...tableProps }))
|
|
18842
19469
|
};
|
|
18843
19470
|
function TextBlock({ block }) {
|
|
18844
|
-
return /* @__PURE__ */ (0,
|
|
19471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TextBlockWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_markdown2.default, { remarkPlugins: [import_remark_gfm2.default, import_remark_breaks2.default], components: markdownComponents, children: sanitize2(block.payload.text) }) });
|
|
18845
19472
|
}
|
|
18846
19473
|
|
|
18847
19474
|
// src/components/blocks/block-services/text-block-service.ts
|
|
@@ -18863,26 +19490,26 @@ var BlockServices = {
|
|
|
18863
19490
|
};
|
|
18864
19491
|
|
|
18865
19492
|
// src/components/blocks/block/block.tsx
|
|
18866
|
-
var
|
|
19493
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
18867
19494
|
function Block({ block }) {
|
|
18868
19495
|
const service = BlockServices[block.type];
|
|
18869
19496
|
if (!service) return null;
|
|
18870
19497
|
const { Component } = service;
|
|
18871
|
-
return /* @__PURE__ */ (0,
|
|
19498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Component, { block });
|
|
18872
19499
|
}
|
|
18873
19500
|
|
|
18874
19501
|
// src/components/blocks/block-context/block-context.tsx
|
|
18875
|
-
var
|
|
18876
|
-
var BlockContext = (0,
|
|
19502
|
+
var import_react19 = require("react");
|
|
19503
|
+
var BlockContext = (0, import_react19.createContext)(null);
|
|
18877
19504
|
function useBlockContext() {
|
|
18878
|
-
return (0,
|
|
19505
|
+
return (0, import_react19.useContext)(BlockContext) ?? {};
|
|
18879
19506
|
}
|
|
18880
19507
|
|
|
18881
19508
|
// src/components/ai-elements/prompt-input/prompt-input.tsx
|
|
18882
|
-
var
|
|
19509
|
+
var import_react22 = require("react");
|
|
18883
19510
|
|
|
18884
19511
|
// src/components/button/button.tsx
|
|
18885
|
-
var
|
|
19512
|
+
var import_react20 = require("react");
|
|
18886
19513
|
|
|
18887
19514
|
// src/components/button/button-styles.ts
|
|
18888
19515
|
var import_styled_components5 = __toESM(require("styled-components"), 1);
|
|
@@ -19005,8 +19632,8 @@ var StyledButton = import_styled_components5.default.button`
|
|
|
19005
19632
|
`;
|
|
19006
19633
|
|
|
19007
19634
|
// src/components/button/button.tsx
|
|
19008
|
-
var
|
|
19009
|
-
var Button2 = (0,
|
|
19635
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
19636
|
+
var Button2 = (0, import_react20.forwardRef)(function Button3({
|
|
19010
19637
|
children,
|
|
19011
19638
|
variant = BUTTON_VARIANT.SOLID,
|
|
19012
19639
|
intent = BUTTON_INTENT.PRIMARY,
|
|
@@ -19018,8 +19645,8 @@ var Button2 = (0, import_react17.forwardRef)(function Button3({
|
|
|
19018
19645
|
className,
|
|
19019
19646
|
"aria-label": ariaLabel
|
|
19020
19647
|
}, ref) {
|
|
19021
|
-
const iconElement = icon ? /* @__PURE__ */ (0,
|
|
19022
|
-
return /* @__PURE__ */ (0,
|
|
19648
|
+
const iconElement = icon ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { icon, size: 16 }) : null;
|
|
19649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
19023
19650
|
StyledButton,
|
|
19024
19651
|
{
|
|
19025
19652
|
ref,
|
|
@@ -19033,7 +19660,7 @@ var Button2 = (0, import_react17.forwardRef)(function Button3({
|
|
|
19033
19660
|
"aria-label": ariaLabel,
|
|
19034
19661
|
children: [
|
|
19035
19662
|
iconPosition === ICON_POSITION.LEADING && iconElement,
|
|
19036
|
-
/* @__PURE__ */ (0,
|
|
19663
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children }),
|
|
19037
19664
|
iconPosition === ICON_POSITION.TRAILING && iconElement
|
|
19038
19665
|
]
|
|
19039
19666
|
}
|
|
@@ -19041,7 +19668,7 @@ var Button2 = (0, import_react17.forwardRef)(function Button3({
|
|
|
19041
19668
|
});
|
|
19042
19669
|
|
|
19043
19670
|
// src/components/text-area/text-area.tsx
|
|
19044
|
-
var
|
|
19671
|
+
var import_react21 = require("react");
|
|
19045
19672
|
|
|
19046
19673
|
// src/utils/merge-refs.ts
|
|
19047
19674
|
function mergeRefs(...refs) {
|
|
@@ -19082,23 +19709,23 @@ var StyledTextArea = import_styled_components6.default.textarea`
|
|
|
19082
19709
|
`;
|
|
19083
19710
|
|
|
19084
19711
|
// src/components/text-area/text-area.tsx
|
|
19085
|
-
var
|
|
19086
|
-
var TextArea = (0,
|
|
19087
|
-
const internalRef = (0,
|
|
19088
|
-
(0,
|
|
19712
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
19713
|
+
var TextArea = (0, import_react21.forwardRef)(function TextArea2({ value: value2, onChange, placeholder, maxHeight, rows = 1, autoFocus, onKeyDown, disabled, className }, externalRef) {
|
|
19714
|
+
const internalRef = (0, import_react21.useRef)(null);
|
|
19715
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
19089
19716
|
const el = internalRef.current;
|
|
19090
19717
|
if (el) {
|
|
19091
19718
|
el.style.height = "auto";
|
|
19092
19719
|
el.style.height = `${el.scrollHeight}px`;
|
|
19093
19720
|
}
|
|
19094
19721
|
}, [value2]);
|
|
19095
|
-
const handleChange = (0,
|
|
19722
|
+
const handleChange = (0, import_react21.useCallback)(
|
|
19096
19723
|
(e) => {
|
|
19097
19724
|
onChange(e.target.value);
|
|
19098
19725
|
},
|
|
19099
19726
|
[onChange]
|
|
19100
19727
|
);
|
|
19101
|
-
return /* @__PURE__ */ (0,
|
|
19728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19102
19729
|
StyledTextArea,
|
|
19103
19730
|
{
|
|
19104
19731
|
ref: mergeRefs(internalRef, externalRef),
|
|
@@ -19124,9 +19751,9 @@ var CHAT_STATUS = {
|
|
|
19124
19751
|
};
|
|
19125
19752
|
|
|
19126
19753
|
// src/components/ai-elements/prompt-input/prompt-input.tsx
|
|
19127
|
-
var
|
|
19754
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
19128
19755
|
var PromptInput = ({ className, onSubmit, disabled, children, ...props }) => {
|
|
19129
|
-
const handleSubmit = (0,
|
|
19756
|
+
const handleSubmit = (0, import_react22.useCallback)(
|
|
19130
19757
|
(event) => {
|
|
19131
19758
|
event.preventDefault();
|
|
19132
19759
|
if (disabled) {
|
|
@@ -19141,7 +19768,7 @@ var PromptInput = ({ className, onSubmit, disabled, children, ...props }) => {
|
|
|
19141
19768
|
},
|
|
19142
19769
|
[disabled, onSubmit]
|
|
19143
19770
|
);
|
|
19144
|
-
return /* @__PURE__ */ (0,
|
|
19771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19145
19772
|
"form",
|
|
19146
19773
|
{
|
|
19147
19774
|
className: cn(
|
|
@@ -19154,9 +19781,9 @@ var PromptInput = ({ className, onSubmit, disabled, children, ...props }) => {
|
|
|
19154
19781
|
}
|
|
19155
19782
|
);
|
|
19156
19783
|
};
|
|
19157
|
-
var PromptInputTextarea = (0,
|
|
19784
|
+
var PromptInputTextarea = (0, import_react22.forwardRef)(
|
|
19158
19785
|
function PromptInputTextarea2({ className, onKeyDown, placeholder = "What would you like to know?", ...props }, ref) {
|
|
19159
|
-
const handleKeyDown = (0,
|
|
19786
|
+
const handleKeyDown = (0, import_react22.useCallback)(
|
|
19160
19787
|
(event) => {
|
|
19161
19788
|
onKeyDown?.(event);
|
|
19162
19789
|
if (event.defaultPrevented) {
|
|
@@ -19169,21 +19796,21 @@ var PromptInputTextarea = (0, import_react19.forwardRef)(
|
|
|
19169
19796
|
},
|
|
19170
19797
|
[onKeyDown]
|
|
19171
19798
|
);
|
|
19172
|
-
return /* @__PURE__ */ (0,
|
|
19799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cn("py-3", className), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TextArea, { ref, className: "px-4", onKeyDown: handleKeyDown, placeholder, ...props }) });
|
|
19173
19800
|
}
|
|
19174
19801
|
);
|
|
19175
|
-
var PromptInputFooter = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
19176
|
-
var PromptInputTools = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
19802
|
+
var PromptInputFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cn("flex items-center justify-between gap-1 px-4 pb-3", className), ...props });
|
|
19803
|
+
var PromptInputTools = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cn("flex min-w-0 items-center gap-1", className), ...props });
|
|
19177
19804
|
var PromptInputSubmit = ({
|
|
19178
19805
|
label = "Submit",
|
|
19179
19806
|
status = CHAT_STATUS.READY,
|
|
19180
19807
|
disabled,
|
|
19181
19808
|
className
|
|
19182
19809
|
}) => {
|
|
19183
|
-
const handleClick = (0,
|
|
19810
|
+
const handleClick = (0, import_react22.useCallback)((event) => {
|
|
19184
19811
|
event.currentTarget.form?.requestSubmit();
|
|
19185
19812
|
}, []);
|
|
19186
|
-
return /* @__PURE__ */ (0,
|
|
19813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19187
19814
|
Button2,
|
|
19188
19815
|
{
|
|
19189
19816
|
intent: status === CHAT_STATUS.ERROR ? BUTTON_INTENT.ERROR : BUTTON_INTENT.PRIMARY,
|
|
@@ -19197,7 +19824,7 @@ var PromptInputSubmit = ({
|
|
|
19197
19824
|
};
|
|
19198
19825
|
|
|
19199
19826
|
// src/components/ai-elements/mouse-grid/mouse-grid.tsx
|
|
19200
|
-
var
|
|
19827
|
+
var import_react23 = require("react");
|
|
19201
19828
|
|
|
19202
19829
|
// src/utils/prefers-reduced-motion.ts
|
|
19203
19830
|
function prefersReducedMotion() {
|
|
@@ -19205,11 +19832,11 @@ function prefersReducedMotion() {
|
|
|
19205
19832
|
}
|
|
19206
19833
|
|
|
19207
19834
|
// src/components/ai-elements/mouse-grid/mouse-grid.tsx
|
|
19208
|
-
var
|
|
19835
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
19209
19836
|
function MouseGrid({ glowColor, colorCycleMs = 4e3, autoDrift = false } = {}) {
|
|
19210
|
-
const layerRef = (0,
|
|
19211
|
-
const glowRef = (0,
|
|
19212
|
-
(0,
|
|
19837
|
+
const layerRef = (0, import_react23.useRef)(null);
|
|
19838
|
+
const glowRef = (0, import_react23.useRef)(null);
|
|
19839
|
+
(0, import_react23.useEffect)(() => {
|
|
19213
19840
|
const driftEnabled = autoDrift && !prefersReducedMotion();
|
|
19214
19841
|
let raf = 0;
|
|
19215
19842
|
let driftRaf = 0;
|
|
@@ -19310,7 +19937,7 @@ function MouseGrid({ glowColor, colorCycleMs = 4e3, autoDrift = false } = {}) {
|
|
|
19310
19937
|
}, [autoDrift]);
|
|
19311
19938
|
const colorList = Array.isArray(glowColor) ? glowColor : glowColor != null ? [glowColor] : [];
|
|
19312
19939
|
const glowColorsKey = JSON.stringify(colorList);
|
|
19313
|
-
(0,
|
|
19940
|
+
(0, import_react23.useEffect)(() => {
|
|
19314
19941
|
const glow = glowRef.current;
|
|
19315
19942
|
if (!glow) {
|
|
19316
19943
|
return;
|
|
@@ -19337,19 +19964,19 @@ function MouseGrid({ glowColor, colorCycleMs = 4e3, autoDrift = false } = {}) {
|
|
|
19337
19964
|
clearColor();
|
|
19338
19965
|
};
|
|
19339
19966
|
}, [glowColorsKey, colorCycleMs]);
|
|
19340
|
-
return /* @__PURE__ */ (0,
|
|
19341
|
-
/* @__PURE__ */ (0,
|
|
19342
|
-
/* @__PURE__ */ (0,
|
|
19967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ref: layerRef, "aria-hidden": "true", className: "vibe-mouse-grid-layer", children: [
|
|
19968
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "vibe-mouse-grid" }),
|
|
19969
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref: glowRef, className: "vibe-mouse-glow" })
|
|
19343
19970
|
] });
|
|
19344
19971
|
}
|
|
19345
19972
|
|
|
19346
19973
|
// src/components/ai-elements/suggestion/suggestion.tsx
|
|
19347
|
-
var
|
|
19348
|
-
var
|
|
19349
|
-
var Suggestions = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
19974
|
+
var import_react24 = require("react");
|
|
19975
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
19976
|
+
var Suggestions = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: cn("flex flex-wrap items-center justify-center gap-3", className), ...props });
|
|
19350
19977
|
var Suggestion = ({ suggestion, onClick, className, children, ...props }) => {
|
|
19351
|
-
const handleClick = (0,
|
|
19352
|
-
return /* @__PURE__ */ (0,
|
|
19978
|
+
const handleClick = (0, import_react24.useCallback)(() => onClick?.(suggestion), [onClick, suggestion]);
|
|
19979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19353
19980
|
"button",
|
|
19354
19981
|
{
|
|
19355
19982
|
type: "button",
|
|
@@ -19365,7 +19992,7 @@ var Suggestion = ({ suggestion, onClick, className, children, ...props }) => {
|
|
|
19365
19992
|
};
|
|
19366
19993
|
|
|
19367
19994
|
// src/components/chat/chat-message/chat-message.tsx
|
|
19368
|
-
var
|
|
19995
|
+
var import_react28 = require("react");
|
|
19369
19996
|
|
|
19370
19997
|
// src/components/chat/hooks/copy-message-text.ts
|
|
19371
19998
|
function copyMessageText(message) {
|
|
@@ -19382,13 +20009,13 @@ function copyMessageText(message) {
|
|
|
19382
20009
|
}
|
|
19383
20010
|
|
|
19384
20011
|
// src/components/chat/chat-message-actions/chat-message-actions.tsx
|
|
19385
|
-
var
|
|
20012
|
+
var import_react27 = require("react");
|
|
19386
20013
|
|
|
19387
20014
|
// src/components/chat/chat-context/chat-context.ts
|
|
19388
|
-
var
|
|
19389
|
-
var ChatContext = (0,
|
|
20015
|
+
var import_react25 = require("react");
|
|
20016
|
+
var ChatContext = (0, import_react25.createContext)(null);
|
|
19390
20017
|
function useChatContext() {
|
|
19391
|
-
const context = (0,
|
|
20018
|
+
const context = (0, import_react25.useContext)(ChatContext);
|
|
19392
20019
|
if (!context) {
|
|
19393
20020
|
throw new Error("useChatContext must be used within a Chat.Root component");
|
|
19394
20021
|
}
|
|
@@ -19396,7 +20023,7 @@ function useChatContext() {
|
|
|
19396
20023
|
}
|
|
19397
20024
|
|
|
19398
20025
|
// src/components/chat/hooks/use-copy-to-clipboard.ts
|
|
19399
|
-
var
|
|
20026
|
+
var import_react26 = require("react");
|
|
19400
20027
|
|
|
19401
20028
|
// src/utils/clipboard.ts
|
|
19402
20029
|
function copyToClipboard(text2, options) {
|
|
@@ -19409,14 +20036,14 @@ function copyToClipboard(text2, options) {
|
|
|
19409
20036
|
// src/components/chat/hooks/use-copy-to-clipboard.ts
|
|
19410
20037
|
var RESET_DELAY_MS = 2e3;
|
|
19411
20038
|
function useCopyToClipboard() {
|
|
19412
|
-
const [isCopied, setIsCopied] = (0,
|
|
19413
|
-
const timeoutRef = (0,
|
|
19414
|
-
(0,
|
|
20039
|
+
const [isCopied, setIsCopied] = (0, import_react26.useState)(false);
|
|
20040
|
+
const timeoutRef = (0, import_react26.useRef)(null);
|
|
20041
|
+
(0, import_react26.useEffect)(() => {
|
|
19415
20042
|
return () => {
|
|
19416
20043
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
19417
20044
|
};
|
|
19418
20045
|
}, []);
|
|
19419
|
-
const copy = (0,
|
|
20046
|
+
const copy = (0, import_react26.useCallback)((text2) => {
|
|
19420
20047
|
copyToClipboard(text2, {
|
|
19421
20048
|
onSuccess: () => {
|
|
19422
20049
|
setIsCopied(true);
|
|
@@ -19456,24 +20083,24 @@ var AnimatedAction = import_styled_components7.default.div`
|
|
|
19456
20083
|
`;
|
|
19457
20084
|
|
|
19458
20085
|
// src/components/chat/chat-message-actions/chat-message-actions.tsx
|
|
19459
|
-
var
|
|
20086
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
19460
20087
|
function ChatMessageActions({ className, messageId, content: content2, role, isHelpful }) {
|
|
19461
20088
|
const { onCopyMessage, onThumbUpClick, onThumbDownClick } = useChatContext();
|
|
19462
20089
|
const { isCopied, copy } = useCopyToClipboard();
|
|
19463
|
-
const handleCopy = (0,
|
|
20090
|
+
const handleCopy = (0, import_react27.useCallback)(() => {
|
|
19464
20091
|
copy(content2);
|
|
19465
20092
|
onCopyMessage?.(messageId);
|
|
19466
20093
|
}, [content2, messageId, copy, onCopyMessage]);
|
|
19467
|
-
const handleThumbUp = (0,
|
|
20094
|
+
const handleThumbUp = (0, import_react27.useCallback)(() => {
|
|
19468
20095
|
onThumbUpClick?.(messageId, isHelpful === true ? null : true);
|
|
19469
20096
|
}, [messageId, isHelpful, onThumbUpClick]);
|
|
19470
|
-
const handleThumbDown = (0,
|
|
20097
|
+
const handleThumbDown = (0, import_react27.useCallback)(() => {
|
|
19471
20098
|
onThumbDownClick?.(messageId, isHelpful === false ? null : false);
|
|
19472
20099
|
}, [messageId, isHelpful, onThumbDownClick]);
|
|
19473
20100
|
const isAssistant = role === MESSAGE_ROLE.ASSISTANT;
|
|
19474
20101
|
const hasFeedback = isAssistant && (onThumbUpClick || onThumbDownClick);
|
|
19475
|
-
return /* @__PURE__ */ (0,
|
|
19476
|
-
/* @__PURE__ */ (0,
|
|
20102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(ActionsContainer, { $role: role, className, children: [
|
|
20103
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
19477
20104
|
IconButton,
|
|
19478
20105
|
{
|
|
19479
20106
|
icon: isCopied ? IconCheck : IconCopy,
|
|
@@ -19481,7 +20108,7 @@ function ChatMessageActions({ className, messageId, content: content2, role, isH
|
|
|
19481
20108
|
"aria-label": isCopied ? "Copied" : "Copy message"
|
|
19482
20109
|
}
|
|
19483
20110
|
),
|
|
19484
|
-
hasFeedback && /* @__PURE__ */ (0,
|
|
20111
|
+
hasFeedback && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AnimatedAction, { $visible: isHelpful !== false, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
19485
20112
|
IconButton,
|
|
19486
20113
|
{
|
|
19487
20114
|
icon: IconThumbUp,
|
|
@@ -19490,7 +20117,7 @@ function ChatMessageActions({ className, messageId, content: content2, role, isH
|
|
|
19490
20117
|
"aria-label": "Good response"
|
|
19491
20118
|
}
|
|
19492
20119
|
) }),
|
|
19493
|
-
hasFeedback && /* @__PURE__ */ (0,
|
|
20120
|
+
hasFeedback && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AnimatedAction, { $visible: isHelpful !== true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
19494
20121
|
IconButton,
|
|
19495
20122
|
{
|
|
19496
20123
|
icon: IconThumbDown,
|
|
@@ -19541,12 +20168,12 @@ var MessageBubble = import_styled_components8.default.div`
|
|
|
19541
20168
|
`;
|
|
19542
20169
|
|
|
19543
20170
|
// src/components/chat/chat-message/chat-message.tsx
|
|
19544
|
-
var
|
|
20171
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
19545
20172
|
function ChatMessage({ message }) {
|
|
19546
|
-
const clipboardText = (0,
|
|
19547
|
-
return /* @__PURE__ */ (0,
|
|
19548
|
-
/* @__PURE__ */ (0,
|
|
19549
|
-
/* @__PURE__ */ (0,
|
|
20173
|
+
const clipboardText = (0, import_react28.useMemo)(() => copyMessageText(message), [message]);
|
|
20174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(MessageRow, { $role: message.role, role: "article", "aria-label": `${message.role} message`, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(MessageContainer, { $role: message.role, children: [
|
|
20175
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(MessageBubble, { $role: message.role, "data-testid": "message-bubble", children: message.blocks.map((block, index2) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Block, { block }, index2)) }),
|
|
20176
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
19550
20177
|
ChatMessageActions,
|
|
19551
20178
|
{
|
|
19552
20179
|
messageId: message.id,
|
|
@@ -19606,21 +20233,21 @@ var Key = import_styled_components9.default.kbd`
|
|
|
19606
20233
|
`;
|
|
19607
20234
|
|
|
19608
20235
|
// src/components/keyboard-shortcut/keyboard-shortcut.tsx
|
|
19609
|
-
var
|
|
20236
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
19610
20237
|
function KeyboardShortcut({
|
|
19611
20238
|
keys,
|
|
19612
20239
|
variant = KEYBOARD_SHORTCUT_VARIANTS.OUTLINED,
|
|
19613
20240
|
adaptive = false,
|
|
19614
20241
|
className
|
|
19615
20242
|
}) {
|
|
19616
|
-
return /* @__PURE__ */ (0,
|
|
20243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Wrapper, { className, children: keys.map((KeyComponent, index2) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Key, { $variant: variant, $adaptive: adaptive, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { icon: KeyComponent, size: 12 }) }, index2)) });
|
|
19617
20244
|
}
|
|
19618
20245
|
|
|
19619
20246
|
// src/components/keyboard-shortcut/icons/icon-ctrl.tsx
|
|
19620
|
-
var
|
|
20247
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
19621
20248
|
function IconCtrl(props) {
|
|
19622
20249
|
const { width: width2 = 24, height: height2 = 24, ...rest } = props;
|
|
19623
|
-
return /* @__PURE__ */ (0,
|
|
20250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: width2, height: height2, fill: "none", ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
19624
20251
|
"text",
|
|
19625
20252
|
{
|
|
19626
20253
|
x: "50%",
|
|
@@ -19637,7 +20264,7 @@ function IconCtrl(props) {
|
|
|
19637
20264
|
}
|
|
19638
20265
|
|
|
19639
20266
|
// src/components/lottie/lottie.tsx
|
|
19640
|
-
var
|
|
20267
|
+
var import_react30 = require("react");
|
|
19641
20268
|
|
|
19642
20269
|
// src/components/lottie/lottie-styles.ts
|
|
19643
20270
|
var import_styled_components10 = __toESM(require("styled-components"), 1);
|
|
@@ -19653,7 +20280,7 @@ var LottieContainer = import_styled_components10.default.div`
|
|
|
19653
20280
|
`;
|
|
19654
20281
|
|
|
19655
20282
|
// src/components/lottie/use-lottie.ts
|
|
19656
|
-
var
|
|
20283
|
+
var import_react29 = require("react");
|
|
19657
20284
|
var import_lottie_web = __toESM(require_lottie(), 1);
|
|
19658
20285
|
function useLottie({
|
|
19659
20286
|
animationData: animationData2,
|
|
@@ -19668,17 +20295,17 @@ function useLottie({
|
|
|
19668
20295
|
onLoopComplete,
|
|
19669
20296
|
onEnterFrame
|
|
19670
20297
|
}) {
|
|
19671
|
-
const containerRef = (0,
|
|
19672
|
-
const animationRef = (0,
|
|
19673
|
-
const onAnimationLoadedRef = (0,
|
|
19674
|
-
const onCompleteRef = (0,
|
|
19675
|
-
const onLoopCompleteRef = (0,
|
|
19676
|
-
const onEnterFrameRef = (0,
|
|
20298
|
+
const containerRef = (0, import_react29.useRef)(null);
|
|
20299
|
+
const animationRef = (0, import_react29.useRef)(null);
|
|
20300
|
+
const onAnimationLoadedRef = (0, import_react29.useRef)(onAnimationLoaded);
|
|
20301
|
+
const onCompleteRef = (0, import_react29.useRef)(onComplete);
|
|
20302
|
+
const onLoopCompleteRef = (0, import_react29.useRef)(onLoopComplete);
|
|
20303
|
+
const onEnterFrameRef = (0, import_react29.useRef)(onEnterFrame);
|
|
19677
20304
|
onAnimationLoadedRef.current = onAnimationLoaded;
|
|
19678
20305
|
onCompleteRef.current = onComplete;
|
|
19679
20306
|
onLoopCompleteRef.current = onLoopComplete;
|
|
19680
20307
|
onEnterFrameRef.current = onEnterFrame;
|
|
19681
|
-
(0,
|
|
20308
|
+
(0, import_react29.useEffect)(() => {
|
|
19682
20309
|
if (!containerRef.current) return;
|
|
19683
20310
|
const anim = import_lottie_web.default.loadAnimation({
|
|
19684
20311
|
container: containerRef.current,
|
|
@@ -19770,8 +20397,8 @@ function createLottieRef(animationRef) {
|
|
|
19770
20397
|
}
|
|
19771
20398
|
|
|
19772
20399
|
// src/components/lottie/lottie.tsx
|
|
19773
|
-
var
|
|
19774
|
-
var Lottie = (0,
|
|
20400
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
20401
|
+
var Lottie = (0, import_react30.forwardRef)(function Lottie2({
|
|
19775
20402
|
animationData: animationData2,
|
|
19776
20403
|
autoplay,
|
|
19777
20404
|
loop,
|
|
@@ -19801,8 +20428,8 @@ var Lottie = (0, import_react27.forwardRef)(function Lottie2({
|
|
|
19801
20428
|
onLoopComplete,
|
|
19802
20429
|
onEnterFrame
|
|
19803
20430
|
});
|
|
19804
|
-
(0,
|
|
19805
|
-
return /* @__PURE__ */ (0,
|
|
20431
|
+
(0, import_react30.useImperativeHandle)(ref, () => createLottieRef(animationRef), [animationRef]);
|
|
20432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
19806
20433
|
LottieContainer,
|
|
19807
20434
|
{
|
|
19808
20435
|
ref: containerRef,
|
|
@@ -19905,7 +20532,9 @@ function convertTableToCSV(table) {
|
|
|
19905
20532
|
ChatContext,
|
|
19906
20533
|
ChatMessage,
|
|
19907
20534
|
DEFAULT_CHART_ARTIFACT_LABELS,
|
|
20535
|
+
DEFAULT_DECK_ARTIFACT_LABELS,
|
|
19908
20536
|
DEFAULT_TABLE_ARTIFACT_LABELS,
|
|
20537
|
+
DeckArtifact,
|
|
19909
20538
|
ICON_POSITION,
|
|
19910
20539
|
Icon,
|
|
19911
20540
|
IconButton,
|
|
@@ -19931,6 +20560,8 @@ function convertTableToCSV(table) {
|
|
|
19931
20560
|
colors,
|
|
19932
20561
|
convertTableToCSV,
|
|
19933
20562
|
copyMessageText,
|
|
20563
|
+
deckBlockTypes,
|
|
20564
|
+
deckSlideKinds,
|
|
19934
20565
|
escapeCsvField,
|
|
19935
20566
|
fontFamilies,
|
|
19936
20567
|
isSafeDownloadUrl,
|
|
@@ -19959,7 +20590,11 @@ lottie-web/build/player/lottie.js:
|
|
|
19959
20590
|
@tabler/icons-react/dist/esm/defaultAttributes.mjs:
|
|
19960
20591
|
@tabler/icons-react/dist/esm/createReactComponent.mjs:
|
|
19961
20592
|
@tabler/icons-react/dist/esm/icons/IconAlertCircle.mjs:
|
|
20593
|
+
@tabler/icons-react/dist/esm/icons/IconArrowsMaximize.mjs:
|
|
20594
|
+
@tabler/icons-react/dist/esm/icons/IconArrowsMinimize.mjs:
|
|
19962
20595
|
@tabler/icons-react/dist/esm/icons/IconCheck.mjs:
|
|
20596
|
+
@tabler/icons-react/dist/esm/icons/IconChevronLeft.mjs:
|
|
20597
|
+
@tabler/icons-react/dist/esm/icons/IconChevronRight.mjs:
|
|
19963
20598
|
@tabler/icons-react/dist/esm/icons/IconCopy.mjs:
|
|
19964
20599
|
@tabler/icons-react/dist/esm/icons/IconDownload.mjs:
|
|
19965
20600
|
@tabler/icons-react/dist/esm/icons/IconFileSpreadsheet.mjs:
|