ooxml-ui 1.29.0 → 1.29.1

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkIY7H76CZ_cjs = require('../chunk-IY7H76CZ.cjs');
3
+ var chunkBMMTD6PB_cjs = require('../chunk-BMMTD6PB.cjs');
4
4
  var chunkA5MANNJR_cjs = require('../chunk-A5MANNJR.cjs');
5
5
  require('../chunk-Y6DO6SVT.cjs');
6
6
  require('../chunk-PBZWDEXQ.cjs');
@@ -184,8 +184,8 @@ function bounds(el) {
184
184
  }
185
185
  function elementLine(el) {
186
186
  const text = "text" in el && typeof el.text === "string" ? el.text.trim().replace(/\s+/gu, " ") : "";
187
- const snippet2 = text ? `: "${text.slice(0, 60)}"` : "";
188
- return ` - ${el.type}#${el.id} ${bounds(el)}${snippet2}`;
187
+ const snippet = text ? `: "${text.slice(0, 60)}"` : "";
188
+ return ` - ${el.type}#${el.id} ${bounds(el)}${snippet}`;
189
189
  }
190
190
  function describeTable(el, maxCells) {
191
191
  if (el.type !== "table" || !el.tableData) {
@@ -279,71 +279,6 @@ async function buildDeckContext(bridge, options) {
279
279
  return parts.filter((part) => part.trim()).join("\n\n");
280
280
  }
281
281
 
282
- // src/pptx/ai/proposals-diff.ts
283
- function elementLabel(el) {
284
- const text = "text" in el && typeof el.text === "string" ? el.text.trim() : "";
285
- const snippet2 = text ? `: "${text.slice(0, 24)}${text.length > 24 ? "..." : ""}"` : "";
286
- return `${el.type} ${el.id}${snippet2}`;
287
- }
288
- function diffElements(index, before, after, out) {
289
- const beforeById = new Map(before.map((e) => [e.id, e]));
290
- const afterById = new Map(after.map((e) => [e.id, e]));
291
- for (const el of after) {
292
- if (!beforeById.has(el.id)) {
293
- out.push(`Slide ${index + 1}: add ${elementLabel(el)}`);
294
- }
295
- }
296
- for (const el of before) {
297
- if (!afterById.has(el.id)) {
298
- out.push(`Slide ${index + 1}: remove ${elementLabel(el)}`);
299
- }
300
- }
301
- for (const el of after) {
302
- const prev = beforeById.get(el.id);
303
- if (prev && JSON.stringify(prev) !== JSON.stringify(el)) {
304
- out.push(`Slide ${index + 1}: modify ${elementLabel(el)}`);
305
- }
306
- }
307
- }
308
- function diffSlides(before, after) {
309
- const out = [];
310
- if (after.length > before.length) {
311
- out.push(`Add ${after.length - before.length} slide(s) (total ${after.length}).`);
312
- } else if (after.length < before.length) {
313
- out.push(`Remove ${before.length - after.length} slide(s) (total ${after.length}).`);
314
- }
315
- const beforeById = new Map(before.map((s) => [s.id, s]));
316
- const pairCount = Math.min(before.length, after.length);
317
- for (let i = 0; i < pairCount; i++) {
318
- const nextSlide = after[i];
319
- const prevSlide = beforeById.get(nextSlide.id) ?? before[i];
320
- if (!prevSlide) {
321
- continue;
322
- }
323
- diffElements(i, prevSlide.elements, nextSlide.elements, out);
324
- if ((prevSlide.notes ?? "") !== (nextSlide.notes ?? "")) {
325
- out.push(`Slide ${i + 1}: update speaker notes`);
326
- }
327
- if (prevSlide.backgroundColor !== nextSlide.backgroundColor) {
328
- out.push(`Slide ${i + 1}: change background`);
329
- }
330
- }
331
- if (out.length === 0) {
332
- out.push("No detectable changes.");
333
- }
334
- return out;
335
- }
336
- function humanizeDiffLine(line) {
337
- return line.replace(
338
- /\b(add|remove|modify) (\w+) [^\s:]+(: )?/gu,
339
- (_match, verb, type, colon) => {
340
- const article = verb === "add" ? "a" : "the";
341
- const friendlyVerb = verb === "modify" ? "update" : verb;
342
- return `${friendlyVerb} ${article} ${type}${colon ? " " : ""}`;
343
- }
344
- );
345
- }
346
-
347
282
  // src/pptx/ai/proposals.ts
348
283
  var counter = 0;
349
284
  function nextId() {
@@ -380,7 +315,7 @@ var ProposalStore = class {
380
315
  const proposal = {
381
316
  id: nextId(),
382
317
  label,
383
- summary: diffSlides(before, after),
318
+ summary: chunkBMMTD6PB_cjs.diffSlides(before, after),
384
319
  createdAt: Date.now(),
385
320
  updater
386
321
  };
@@ -1282,7 +1217,7 @@ async function createAiChatSession(bridge, config) {
1282
1217
  'The optional "ai" SDK is not installed. Install `ai` (>=6 <8) to enable the assistant.'
1283
1218
  );
1284
1219
  }
1285
- const changeAnimator = chunkIY7H76CZ_cjs.createAiChangeAnimator(config.changeAnimation);
1220
+ const changeAnimator = chunkBMMTD6PB_cjs.createAiChangeAnimator(config.changeAnimation);
1286
1221
  const proposals = new ProposalStore(bridge, changeAnimator);
1287
1222
  const executors = buildToolExecutors(bridge, proposals, config, changeAnimator);
1288
1223
  const tools = buildToolSet(sdk, config, executors, { withExecute: false });
@@ -1318,120 +1253,6 @@ async function createAiChatSession(bridge, config) {
1318
1253
  };
1319
1254
  }
1320
1255
 
1321
- // src/pptx/ai/chat-history-controller.ts
1322
- var SAVE_DEBOUNCE_MS = 800;
1323
- var TITLE_MAX = 40;
1324
- function newChatId() {
1325
- return `chat-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
1326
- }
1327
- function deriveChatTitle(messages) {
1328
- for (const message of messages) {
1329
- if (message.role !== "user") {
1330
- continue;
1331
- }
1332
- const text = message.parts.filter((p) => p.type === "text").map((p) => p.text).join(" ").trim();
1333
- if (text) {
1334
- return text.length > TITLE_MAX ? `${text.slice(0, TITLE_MAX).trimEnd()}\u2026` : text;
1335
- }
1336
- }
1337
- return "";
1338
- }
1339
- function deckIdFromBridge(bridge) {
1340
- const meta = bridge.getDeckMeta();
1341
- const title = (meta.title ?? "deck").trim().toLowerCase().replace(/\s+/gu, "-").slice(0, 60);
1342
- return `${title || "deck"}::${meta.slideCount}`;
1343
- }
1344
- function createAiChatHistoryController(deps) {
1345
- const store = deps.store ?? chunkA5MANNJR_cjs.createChatHistoryStore();
1346
- let chats = [];
1347
- let activeChatId = newChatId();
1348
- let createdAt = Date.now();
1349
- let saveTimer = null;
1350
- let disposed = false;
1351
- const clearTimer = () => {
1352
- if (saveTimer) {
1353
- clearTimeout(saveTimer);
1354
- saveTimer = null;
1355
- }
1356
- };
1357
- const refresh = async () => {
1358
- const list = await store.listChats({ deckId: deps.deckId });
1359
- if (disposed) {
1360
- return;
1361
- }
1362
- chats = list;
1363
- deps.onChatsChanged?.(list);
1364
- };
1365
- void refresh();
1366
- const startNewChat = () => {
1367
- clearTimer();
1368
- activeChatId = newChatId();
1369
- createdAt = Date.now();
1370
- };
1371
- return {
1372
- chats: () => chats,
1373
- activeChatId: () => activeChatId,
1374
- refresh,
1375
- notifyMessagesChanged() {
1376
- clearTimer();
1377
- if (disposed || deps.getMessages().length === 0) {
1378
- return;
1379
- }
1380
- saveTimer = setTimeout(() => {
1381
- saveTimer = null;
1382
- const messages = deps.getMessages();
1383
- if (disposed || messages.length === 0) {
1384
- return;
1385
- }
1386
- void (async () => {
1387
- await store.saveChat({
1388
- id: activeChatId,
1389
- title: deriveChatTitle(messages) || (deps.untitledLabel ?? "Untitled chat"),
1390
- deckId: deps.deckId,
1391
- // JSON round-trip: the binding's transcript may be a framework
1392
- // reactive proxy (Vue deep ref / Svelte $state), which the store's
1393
- // structuredClone would reject with a DataCloneError.
1394
- messages: JSON.parse(JSON.stringify(messages)),
1395
- createdAt,
1396
- updatedAt: Date.now()
1397
- });
1398
- await refresh();
1399
- })();
1400
- }, SAVE_DEBOUNCE_MS);
1401
- },
1402
- newChat() {
1403
- startNewChat();
1404
- deps.setMessages([]);
1405
- },
1406
- async resumeChat(id) {
1407
- const chat = await store.loadChat(id);
1408
- if (!chat || disposed) {
1409
- return;
1410
- }
1411
- clearTimer();
1412
- activeChatId = chat.id;
1413
- createdAt = chat.createdAt;
1414
- deps.setMessages(chat.messages);
1415
- },
1416
- async deleteChat(id) {
1417
- await store.deleteChat(id);
1418
- if (id === activeChatId) {
1419
- startNewChat();
1420
- deps.setMessages([]);
1421
- }
1422
- await refresh();
1423
- },
1424
- clearCurrent() {
1425
- clearTimer();
1426
- deps.setMessages([]);
1427
- },
1428
- dispose() {
1429
- disposed = true;
1430
- clearTimer();
1431
- }
1432
- };
1433
- }
1434
-
1435
1256
  // src/pptx/ai/vanilla-chat.ts
1436
1257
  async function createVanillaChat(options) {
1437
1258
  const sdk = await loadAiSdk();
@@ -1542,525 +1363,161 @@ function buildPptxAiSystemPrompt(options = {}) {
1542
1363
  return buildSystemPrompt(options);
1543
1364
  }
1544
1365
 
1545
- // src/pptx/ai/tool-summary.ts
1546
- function toolLabel(toolName) {
1547
- if (!toolName) {
1548
- return "Tool";
1549
- }
1550
- const words = toolName.replace(/[_-]+/gu, " ").trim().split(/\s+/u);
1551
- return words.map((w, i) => i === 0 ? w.charAt(0).toUpperCase() + w.slice(1) : w).join(" ");
1552
- }
1553
- function formatValue(value) {
1554
- if (value === null || value === void 0) {
1555
- return "";
1556
- }
1557
- if (typeof value === "string") {
1558
- return value.length > 32 ? `"${value.slice(0, 32)}..."` : `"${value}"`;
1559
- }
1560
- if (typeof value === "number" || typeof value === "boolean") {
1561
- return String(value);
1562
- }
1563
- if (Array.isArray(value)) {
1564
- return `[${value.length}]`;
1565
- }
1566
- return "{...}";
1567
- }
1568
- function summarizeToolArgs(input) {
1569
- if (input === null || typeof input !== "object") {
1570
- return "";
1571
- }
1572
- const entries = Object.entries(input).filter(
1573
- ([, v]) => v !== void 0 && v !== null && v !== ""
1574
- );
1575
- if (entries.length === 0) {
1576
- return "";
1577
- }
1578
- const parts = [];
1579
- for (const [key, value] of entries.slice(0, 4)) {
1580
- if (key === "slideIndex" && typeof value === "number") {
1581
- parts.push(`slide ${value + 1}`);
1582
- continue;
1583
- }
1584
- parts.push(`${key}: ${formatValue(value)}`);
1585
- }
1586
- if (entries.length > 4) {
1587
- parts.push("...");
1588
- }
1589
- return parts.join(", ");
1590
- }
1591
- function asRecord(input) {
1592
- return input && typeof input === "object" ? input : {};
1593
- }
1594
- function slideNumber(input) {
1595
- const v = input.slideIndex;
1596
- return typeof v === "number" && Number.isFinite(v) ? v + 1 : void 0;
1597
- }
1598
- function onSlide(input) {
1599
- const n = slideNumber(input);
1600
- return n === void 0 ? "" : ` on slide ${n}`;
1601
- }
1602
- function snippet(value) {
1603
- if (typeof value !== "string" || value.trim().length === 0) {
1604
- return "";
1605
- }
1606
- const trimmed = value.trim();
1607
- return trimmed.length > 24 ? `"${trimmed.slice(0, 24)}..."` : `"${trimmed}"`;
1608
- }
1609
- var TOOL_PHRASES = {
1610
- // ── read ─────────────────────────────────────────────────────────────────
1611
- get_deck_overview: {
1612
- icon: "view",
1613
- present: () => "Reviewing the deck",
1614
- past: () => "Reviewed the deck"
1615
- },
1616
- get_slide: {
1617
- icon: "view",
1618
- present: (i) => `Looking at slide ${slideNumber(i) ?? ""}`.trim(),
1619
- past: (i) => `Looked at slide ${slideNumber(i) ?? ""}`.trim()
1620
- },
1621
- get_element: {
1622
- icon: "view",
1623
- present: (i) => `Inspecting an element${onSlide(i)}`,
1624
- past: (i) => `Inspected an element${onSlide(i)}`
1625
- },
1626
- get_speaker_notes: {
1627
- icon: "notes",
1628
- present: (i) => `Reading the notes${onSlide(i)}`,
1629
- past: (i) => `Read the notes${onSlide(i)}`
1630
- },
1631
- find_text: {
1632
- icon: "search",
1633
- present: (i) => `Searching for ${snippet(i.query) || "text"}`,
1634
- past: (i) => `Searched for ${snippet(i.query) || "text"}`
1635
- },
1636
- get_theme: {
1637
- icon: "theme",
1638
- present: () => "Checking the theme",
1639
- past: () => "Checked the theme"
1640
- },
1641
- // ── navigation ───────────────────────────────────────────────────────────
1642
- go_to_slide: {
1643
- icon: "nav",
1644
- present: (i) => `Going to slide ${slideNumber(i) ?? ""}`.trim(),
1645
- past: (i) => `Went to slide ${slideNumber(i) ?? ""}`.trim()
1646
- },
1647
- select_elements: {
1648
- icon: "view",
1649
- present: (i) => `Selecting elements${onSlide(i)}`,
1650
- past: (i) => `Selected elements${onSlide(i)}`
1651
- },
1652
- // ── MCP reads (no bespoke equivalent) ────────────────────────────────────────
1653
- get_metadata: {
1654
- icon: "view",
1655
- present: () => "Checking the file details",
1656
- past: () => "Checked the file details"
1657
- },
1658
- get_layouts: {
1659
- icon: "view",
1660
- present: () => "Looking at the layouts",
1661
- past: () => "Looked at the layouts"
1662
- },
1663
- find_placeholders: {
1664
- icon: "search",
1665
- present: () => "Finding placeholders",
1666
- past: () => "Found placeholders"
1667
- },
1668
- get_presentation_properties: {
1669
- icon: "view",
1670
- present: () => "Checking the slideshow settings",
1671
- past: () => "Checked the slideshow settings"
1672
- },
1673
- run_accessibility_check: {
1674
- icon: "view",
1675
- present: () => "Running an accessibility check",
1676
- past: () => "Ran an accessibility check"
1677
- },
1678
- convert_to_markdown: {
1679
- icon: "view",
1680
- present: () => "Exporting to Markdown",
1681
- past: () => "Exported to Markdown"
1682
- },
1683
- export_to_json: {
1684
- icon: "view",
1685
- present: () => "Exporting to JSON",
1686
- past: () => "Exported to JSON"
1687
- },
1688
- import_from_json: {
1689
- icon: "slide",
1690
- present: () => "Importing deck from JSON",
1691
- past: () => "Imported deck from JSON"
1692
- },
1693
- // ── element editing ────────────────────────────────────────────────────────
1694
- update_element: {
1695
- icon: "move",
1696
- present: (i) => `Updating an element${onSlide(i)}`,
1697
- past: (i) => `Updated an element${onSlide(i)}`
1698
- },
1699
- update_element_style: {
1700
- icon: "shape",
1701
- present: (i) => `Restyling an element${onSlide(i)}`,
1702
- past: (i) => `Restyled an element${onSlide(i)}`
1703
- },
1704
- add_element: {
1705
- icon: "shape",
1706
- present: (i) => `Adding a ${typeof i.type === "string" ? i.type : "element"}${onSlide(i)}`,
1707
- past: (i) => `Added a ${typeof i.type === "string" ? i.type : "element"}${onSlide(i)}`
1708
- },
1709
- delete_elements: {
1710
- icon: "delete",
1711
- present: (i) => `Deleting ${countLabel(i.elementIds, "element")}${onSlide(i)}`,
1712
- past: (i) => `Deleted ${countLabel(i.elementIds, "element")}${onSlide(i)}`
1713
- },
1714
- arrange_elements: {
1715
- icon: "move",
1716
- present: (i) => `Rearranging elements${onSlide(i)}`,
1717
- past: (i) => `Rearranged elements${onSlide(i)}`
1718
- },
1719
- clone_element: {
1720
- icon: "shape",
1721
- present: (i) => `Cloning an element${onSlide(i)}`,
1722
- past: (i) => `Cloned an element${onSlide(i)}`
1723
- },
1724
- group_elements: {
1725
- icon: "shape",
1726
- present: (i) => `Grouping elements${onSlide(i)}`,
1727
- past: (i) => `Grouped elements${onSlide(i)}`
1728
- },
1729
- ungroup_elements: {
1730
- icon: "shape",
1731
- present: (i) => `Ungrouping a group${onSlide(i)}`,
1732
- past: (i) => `Ungrouped a group${onSlide(i)}`
1733
- },
1734
- batch_update_elements: {
1735
- icon: "move",
1736
- present: (i) => `Updating several elements${onSlide(i)}`,
1737
- past: (i) => `Updated several elements${onSlide(i)}`
1738
- },
1739
- replace_geometry: {
1740
- icon: "shape",
1741
- present: (i) => `Reshaping an element${onSlide(i)}`,
1742
- past: (i) => `Reshaped an element${onSlide(i)}`
1743
- },
1744
- set_element_lock: {
1745
- icon: "shape",
1746
- present: (i) => `Locking an element${onSlide(i)}`,
1747
- past: (i) => `Locked an element${onSlide(i)}`
1748
- },
1749
- manage_hyperlinks: {
1750
- icon: "text",
1751
- present: (i) => `Updating a link${onSlide(i)}`,
1752
- past: (i) => `Updated a link${onSlide(i)}`
1753
- },
1754
- set_element_animation: {
1755
- icon: "animation",
1756
- present: (i) => `Adding an animation${onSlide(i)}`,
1757
- past: (i) => `Added an animation${onSlide(i)}`
1758
- },
1759
- // ── text / tables / charts / smartart ────────────────────────────────────────
1760
- replace_text: {
1761
- icon: "search",
1762
- present: () => "Replacing text across the deck",
1763
- past: () => "Replaced text across the deck"
1764
- },
1765
- manage_comments: {
1766
- icon: "notes",
1767
- present: (i) => `Updating comments${onSlide(i)}`,
1768
- past: (i) => `Updated comments${onSlide(i)}`
1769
- },
1770
- update_table_cells: {
1771
- icon: "table",
1772
- present: (i) => `Editing table cells${onSlide(i)}`,
1773
- past: (i) => `Edited table cells${onSlide(i)}`
1774
- },
1775
- manage_table_structure: {
1776
- icon: "table",
1777
- present: (i) => `Changing a table${onSlide(i)}`,
1778
- past: (i) => `Changed a table${onSlide(i)}`
1779
- },
1780
- merge_tables: {
1781
- icon: "table",
1782
- present: (i) => `Merging two tables${onSlide(i)}`,
1783
- past: (i) => `Merged two tables${onSlide(i)}`
1784
- },
1785
- create_chart: {
1786
- icon: "chart",
1787
- present: (i) => `Adding a ${chartKind(i.chartType)}chart${onSlide(i)}`,
1788
- past: (i) => `Added a ${chartKind(i.chartType)}chart${onSlide(i)}`
1789
- },
1790
- update_chart: {
1791
- icon: "chart",
1792
- present: (i) => `Updating a chart${onSlide(i)}`,
1793
- past: (i) => `Updated a chart${onSlide(i)}`
1794
- },
1795
- add_chart_series: {
1796
- icon: "chart",
1797
- present: (i) => `Adding a chart series${onSlide(i)}`,
1798
- past: (i) => `Added a chart series${onSlide(i)}`
1799
- },
1800
- remove_chart_series: {
1801
- icon: "chart",
1802
- present: (i) => `Removing a chart series${onSlide(i)}`,
1803
- past: (i) => `Removed a chart series${onSlide(i)}`
1804
- },
1805
- update_chart_series_data: {
1806
- icon: "chart",
1807
- present: (i) => `Updating chart data${onSlide(i)}`,
1808
- past: (i) => `Updated chart data${onSlide(i)}`
1809
- },
1810
- manage_smart_art: {
1811
- icon: "shape",
1812
- present: (i) => `Editing SmartArt${onSlide(i)}`,
1813
- past: (i) => `Edited SmartArt${onSlide(i)}`
1814
- },
1815
- apply_template: {
1816
- icon: "text",
1817
- present: () => "Filling in placeholders",
1818
- past: () => "Filled in placeholders"
1819
- },
1820
- // ── slide structure ──────────────────────────────────────────────────────────
1821
- add_slide: {
1822
- icon: "slide",
1823
- present: () => "Adding a slide",
1824
- past: () => "Added a slide"
1825
- },
1826
- duplicate_slide: {
1827
- icon: "slide",
1828
- present: (i) => `Duplicating slide ${slideNumber(i) ?? ""}`.trim(),
1829
- past: (i) => `Duplicated slide ${slideNumber(i) ?? ""}`.trim()
1830
- },
1831
- delete_slides: {
1832
- icon: "delete",
1833
- present: (i) => `Deleting ${countLabel(i.slideIndexes, "slide")}`,
1834
- past: (i) => `Deleted ${countLabel(i.slideIndexes, "slide")}`
1835
- },
1836
- reorder_slides: {
1837
- icon: "slide",
1838
- present: () => "Reordering the slides",
1839
- past: () => "Reordered the slides"
1840
- },
1841
- update_slide_properties: {
1842
- icon: "slide",
1843
- present: (i) => `Updating slide ${slideNumber(i) ?? ""}`.trim(),
1844
- past: (i) => `Updated slide ${slideNumber(i) ?? ""}`.trim()
1845
- },
1846
- set_slide_transition: {
1847
- icon: "animation",
1848
- present: (i) => `Setting a transition${onSlide(i)}`,
1849
- past: (i) => `Set a transition${onSlide(i)}`
1850
- },
1851
- // ── theme (applied immediately) ──────────────────────────────────────────────
1852
- apply_theme_preset: {
1853
- icon: "theme",
1854
- present: (i) => typeof i.presetName === "string" ? `Applying the ${i.presetName} theme` : "Applying a theme",
1855
- past: (i) => typeof i.presetName === "string" ? `Applied the ${i.presetName} theme` : "Applied a theme"
1856
- },
1857
- update_theme_colors: {
1858
- icon: "theme",
1859
- present: () => "Changing the theme colours",
1860
- past: () => "Changed the theme colours"
1861
- },
1862
- update_theme_fonts: {
1863
- icon: "theme",
1864
- present: () => "Changing the theme fonts",
1865
- past: () => "Changed the theme fonts"
1866
- },
1867
- // ── presentation-level ────────────────────────────────────────────────────────
1868
- set_canvas_size: {
1869
- icon: "slide",
1870
- present: () => "Resizing the slides",
1871
- past: () => "Resized the slides"
1872
- },
1873
- update_metadata: {
1874
- icon: "tool",
1875
- present: () => "Updating the file details",
1876
- past: () => "Updated the file details"
1877
- },
1878
- manage_sections: {
1879
- icon: "slide",
1880
- present: () => "Organising the sections",
1881
- past: () => "Organised the sections"
1882
- },
1883
- update_presentation_properties: {
1884
- icon: "tool",
1885
- present: () => "Updating the slideshow settings",
1886
- past: () => "Updated the slideshow settings"
1887
- },
1888
- apply_layout: {
1889
- icon: "slide",
1890
- present: (i) => `Applying a layout${onSlide(i)}`,
1891
- past: (i) => `Applied a layout${onSlide(i)}`
1892
- }
1893
- };
1894
- function chartKind(value) {
1895
- return typeof value === "string" && /^[a-z]+$/iu.test(value) ? `${value} ` : "";
1896
- }
1897
- function countLabel(value, noun) {
1898
- const n = Array.isArray(value) ? value.length : 0;
1899
- if (n <= 1) {
1900
- return `${n || 1} ${noun}`;
1901
- }
1902
- return `${n} ${noun}s`;
1903
- }
1904
- function describeToolActivity(toolName, input, tense = "past") {
1905
- const phrase = TOOL_PHRASES[toolName];
1906
- const record = asRecord(input);
1907
- if (!phrase) {
1908
- return { icon: "tool", label: toolLabel(toolName) };
1909
- }
1910
- return { icon: phrase.icon, label: phrase[tense](record) };
1911
- }
1912
-
1913
- // src/pptx/ai/tool-target.ts
1914
- function isFiniteNumber(value) {
1915
- return typeof value === "number" && Number.isFinite(value);
1916
- }
1917
- function pushId(ids, value) {
1918
- if (typeof value === "string" && value.length > 0) {
1919
- ids.push(value);
1920
- }
1921
- }
1922
- function toolCanvasTarget(toolName, input) {
1923
- const o = input && typeof input === "object" ? input : {};
1924
- const elementIds = [];
1925
- pushId(elementIds, o.elementId);
1926
- pushId(elementIds, o.elementIdA);
1927
- pushId(elementIds, o.elementIdB);
1928
- if (Array.isArray(o.elementIds)) {
1929
- for (const value of o.elementIds) {
1930
- pushId(elementIds, value);
1931
- }
1932
- }
1933
- let slideIndex2 = isFiniteNumber(o.slideIndex) ? o.slideIndex : void 0;
1934
- if (slideIndex2 === void 0 && Array.isArray(o.slideIndexes) && isFiniteNumber(o.slideIndexes[0])) {
1935
- slideIndex2 = o.slideIndexes[0];
1936
- }
1937
- if (slideIndex2 === void 0 && Array.isArray(o.newOrder) && isFiniteNumber(o.newOrder[0])) {
1938
- slideIndex2 = o.newOrder[0];
1939
- }
1940
- if (slideIndex2 === void 0 && toolName === "duplicate_slide" && isFiniteNumber(o.slideIndex)) {
1941
- slideIndex2 = o.slideIndex;
1942
- }
1943
- if (slideIndex2 === void 0 && elementIds.length === 0) {
1944
- return null;
1945
- }
1946
- return { slideIndex: slideIndex2, elementIds };
1947
- }
1948
-
1949
1366
  Object.defineProperty(exports, "AI_CHANGE_ATTR", {
1950
1367
  enumerable: true,
1951
- get: function () { return chunkIY7H76CZ_cjs.AI_CHANGE_ATTR; }
1368
+ get: function () { return chunkBMMTD6PB_cjs.AI_CHANGE_ATTR; }
1952
1369
  });
1953
1370
  Object.defineProperty(exports, "AI_TOOL_FLASH_MS", {
1954
1371
  enumerable: true,
1955
- get: function () { return chunkIY7H76CZ_cjs.AI_TOOL_FLASH_MS; }
1372
+ get: function () { return chunkBMMTD6PB_cjs.AI_TOOL_FLASH_MS; }
1956
1373
  });
1957
1374
  Object.defineProperty(exports, "aiChangeAnimationCss", {
1958
1375
  enumerable: true,
1959
- get: function () { return chunkIY7H76CZ_cjs.aiChangeAnimationCss; }
1376
+ get: function () { return chunkBMMTD6PB_cjs.aiChangeAnimationCss; }
1960
1377
  });
1961
1378
  Object.defineProperty(exports, "aiFixDirective", {
1962
1379
  enumerable: true,
1963
- get: function () { return chunkIY7H76CZ_cjs.aiFixDirective; }
1380
+ get: function () { return chunkBMMTD6PB_cjs.aiFixDirective; }
1964
1381
  });
1965
1382
  Object.defineProperty(exports, "applyElementUpdate", {
1966
1383
  enumerable: true,
1967
- get: function () { return chunkIY7H76CZ_cjs.applyElementUpdate; }
1384
+ get: function () { return chunkBMMTD6PB_cjs.applyElementUpdate; }
1968
1385
  });
1969
1386
  Object.defineProperty(exports, "applyShapeStyleUpdate", {
1970
1387
  enumerable: true,
1971
- get: function () { return chunkIY7H76CZ_cjs.applyShapeStyleUpdate; }
1388
+ get: function () { return chunkBMMTD6PB_cjs.applyShapeStyleUpdate; }
1972
1389
  });
1973
1390
  Object.defineProperty(exports, "applyTextUpdate", {
1974
1391
  enumerable: true,
1975
- get: function () { return chunkIY7H76CZ_cjs.applyTextUpdate; }
1392
+ get: function () { return chunkBMMTD6PB_cjs.applyTextUpdate; }
1976
1393
  });
1977
1394
  Object.defineProperty(exports, "buildChatLogExport", {
1978
1395
  enumerable: true,
1979
- get: function () { return chunkIY7H76CZ_cjs.buildChatLogExport; }
1396
+ get: function () { return chunkBMMTD6PB_cjs.buildChatLogExport; }
1980
1397
  });
1981
1398
  Object.defineProperty(exports, "buildChatLogMarkdown", {
1982
1399
  enumerable: true,
1983
- get: function () { return chunkIY7H76CZ_cjs.buildChatLogMarkdown; }
1400
+ get: function () { return chunkBMMTD6PB_cjs.buildChatLogMarkdown; }
1984
1401
  });
1985
1402
  Object.defineProperty(exports, "changeGhostStyle", {
1986
1403
  enumerable: true,
1987
- get: function () { return chunkIY7H76CZ_cjs.changeGhostStyle; }
1404
+ get: function () { return chunkBMMTD6PB_cjs.changeGhostStyle; }
1988
1405
  });
1989
1406
  Object.defineProperty(exports, "collectStoredChats", {
1990
1407
  enumerable: true,
1991
- get: function () { return chunkIY7H76CZ_cjs.collectStoredChats; }
1408
+ get: function () { return chunkBMMTD6PB_cjs.collectStoredChats; }
1992
1409
  });
1993
1410
  Object.defineProperty(exports, "computeFocusTargets", {
1994
1411
  enumerable: true,
1995
- get: function () { return chunkIY7H76CZ_cjs.computeFocusTargets; }
1412
+ get: function () { return chunkBMMTD6PB_cjs.computeFocusTargets; }
1996
1413
  });
1997
1414
  Object.defineProperty(exports, "createAiChangeAnimator", {
1998
1415
  enumerable: true,
1999
- get: function () { return chunkIY7H76CZ_cjs.createAiChangeAnimator; }
1416
+ get: function () { return chunkBMMTD6PB_cjs.createAiChangeAnimator; }
1417
+ });
1418
+ Object.defineProperty(exports, "createAiChatHistoryController", {
1419
+ enumerable: true,
1420
+ get: function () { return chunkBMMTD6PB_cjs.createAiChatHistoryController; }
2000
1421
  });
2001
1422
  Object.defineProperty(exports, "createPptxAiBridge", {
2002
1423
  enumerable: true,
2003
- get: function () { return chunkIY7H76CZ_cjs.createPptxAiBridge; }
1424
+ get: function () { return chunkBMMTD6PB_cjs.createPptxAiBridge; }
2004
1425
  });
2005
1426
  Object.defineProperty(exports, "createPptxAiPanelController", {
2006
1427
  enumerable: true,
2007
- get: function () { return chunkIY7H76CZ_cjs.createPptxAiPanelController; }
1428
+ get: function () { return chunkBMMTD6PB_cjs.createPptxAiPanelController; }
2008
1429
  });
2009
1430
  Object.defineProperty(exports, "deckDataFieldChanged", {
2010
1431
  enumerable: true,
2011
- get: function () { return chunkIY7H76CZ_cjs.deckDataFieldChanged; }
1432
+ get: function () { return chunkBMMTD6PB_cjs.deckDataFieldChanged; }
1433
+ });
1434
+ Object.defineProperty(exports, "deckIdFromBridge", {
1435
+ enumerable: true,
1436
+ get: function () { return chunkBMMTD6PB_cjs.deckIdFromBridge; }
1437
+ });
1438
+ Object.defineProperty(exports, "deriveChatTitle", {
1439
+ enumerable: true,
1440
+ get: function () { return chunkBMMTD6PB_cjs.deriveChatTitle; }
1441
+ });
1442
+ Object.defineProperty(exports, "describeToolActivity", {
1443
+ enumerable: true,
1444
+ get: function () { return chunkBMMTD6PB_cjs.describeToolActivity; }
2012
1445
  });
2013
1446
  Object.defineProperty(exports, "diffChangedElements", {
2014
1447
  enumerable: true,
2015
- get: function () { return chunkIY7H76CZ_cjs.diffChangedElements; }
1448
+ get: function () { return chunkBMMTD6PB_cjs.diffChangedElements; }
1449
+ });
1450
+ Object.defineProperty(exports, "diffSlides", {
1451
+ enumerable: true,
1452
+ get: function () { return chunkBMMTD6PB_cjs.diffSlides; }
2016
1453
  });
2017
1454
  Object.defineProperty(exports, "exportAiChatLogs", {
2018
1455
  enumerable: true,
2019
- get: function () { return chunkIY7H76CZ_cjs.exportAiChatLogs; }
1456
+ get: function () { return chunkBMMTD6PB_cjs.exportAiChatLogs; }
2020
1457
  });
2021
1458
  Object.defineProperty(exports, "extractReadyToolCalls", {
2022
1459
  enumerable: true,
2023
- get: function () { return chunkIY7H76CZ_cjs.extractReadyToolCalls; }
1460
+ get: function () { return chunkBMMTD6PB_cjs.extractReadyToolCalls; }
2024
1461
  });
2025
1462
  Object.defineProperty(exports, "focusTargetChips", {
2026
1463
  enumerable: true,
2027
- get: function () { return chunkIY7H76CZ_cjs.focusTargetChips; }
1464
+ get: function () { return chunkBMMTD6PB_cjs.focusTargetChips; }
1465
+ });
1466
+ Object.defineProperty(exports, "humanizeDiffLine", {
1467
+ enumerable: true,
1468
+ get: function () { return chunkBMMTD6PB_cjs.humanizeDiffLine; }
2028
1469
  });
2029
1470
  Object.defineProperty(exports, "isAiFocusPinned", {
2030
1471
  enumerable: true,
2031
- get: function () { return chunkIY7H76CZ_cjs.isAiFocusPinned; }
1472
+ get: function () { return chunkBMMTD6PB_cjs.isAiFocusPinned; }
2032
1473
  });
2033
1474
  Object.defineProperty(exports, "isTwoTableFocus", {
2034
1475
  enumerable: true,
2035
- get: function () { return chunkIY7H76CZ_cjs.isTwoTableFocus; }
1476
+ get: function () { return chunkBMMTD6PB_cjs.isTwoTableFocus; }
2036
1477
  });
2037
1478
  Object.defineProperty(exports, "mergeTablesDirective", {
2038
1479
  enumerable: true,
2039
- get: function () { return chunkIY7H76CZ_cjs.mergeTablesDirective; }
1480
+ get: function () { return chunkBMMTD6PB_cjs.mergeTablesDirective; }
1481
+ });
1482
+ Object.defineProperty(exports, "newChatId", {
1483
+ enumerable: true,
1484
+ get: function () { return chunkBMMTD6PB_cjs.newChatId; }
2040
1485
  });
2041
1486
  Object.defineProperty(exports, "pptxAiDeckTitle", {
2042
1487
  enumerable: true,
2043
- get: function () { return chunkIY7H76CZ_cjs.pptxAiDeckTitle; }
1488
+ get: function () { return chunkBMMTD6PB_cjs.pptxAiDeckTitle; }
2044
1489
  });
2045
1490
  Object.defineProperty(exports, "resolveAiEffectiveTargets", {
2046
1491
  enumerable: true,
2047
- get: function () { return chunkIY7H76CZ_cjs.resolveAiEffectiveTargets; }
1492
+ get: function () { return chunkBMMTD6PB_cjs.resolveAiEffectiveTargets; }
2048
1493
  });
2049
1494
  Object.defineProperty(exports, "resolveChangeAnimationConfig", {
2050
1495
  enumerable: true,
2051
- get: function () { return chunkIY7H76CZ_cjs.resolveChangeAnimationConfig; }
1496
+ get: function () { return chunkBMMTD6PB_cjs.resolveChangeAnimationConfig; }
1497
+ });
1498
+ Object.defineProperty(exports, "summarizeToolArgs", {
1499
+ enumerable: true,
1500
+ get: function () { return chunkBMMTD6PB_cjs.summarizeToolArgs; }
2052
1501
  });
2053
1502
  Object.defineProperty(exports, "toLogChat", {
2054
1503
  enumerable: true,
2055
- get: function () { return chunkIY7H76CZ_cjs.toLogChat; }
1504
+ get: function () { return chunkBMMTD6PB_cjs.toLogChat; }
2056
1505
  });
2057
1506
  Object.defineProperty(exports, "toRenderableParts", {
2058
1507
  enumerable: true,
2059
- get: function () { return chunkIY7H76CZ_cjs.toRenderableParts; }
1508
+ get: function () { return chunkBMMTD6PB_cjs.toRenderableParts; }
2060
1509
  });
2061
1510
  Object.defineProperty(exports, "toolCallLine", {
2062
1511
  enumerable: true,
2063
- get: function () { return chunkIY7H76CZ_cjs.toolCallLine; }
1512
+ get: function () { return chunkBMMTD6PB_cjs.toolCallLine; }
1513
+ });
1514
+ Object.defineProperty(exports, "toolCanvasTarget", {
1515
+ enumerable: true,
1516
+ get: function () { return chunkBMMTD6PB_cjs.toolCanvasTarget; }
1517
+ });
1518
+ Object.defineProperty(exports, "toolLabel", {
1519
+ enumerable: true,
1520
+ get: function () { return chunkBMMTD6PB_cjs.toolLabel; }
2064
1521
  });
2065
1522
  Object.defineProperty(exports, "createChatHistoryStore", {
2066
1523
  enumerable: true,
@@ -2085,19 +1542,12 @@ exports.buildSystemPrompt = buildSystemPrompt;
2085
1542
  exports.buildToolExecutors = buildToolExecutors;
2086
1543
  exports.buildToolSet = buildToolSet;
2087
1544
  exports.clampToTokenBudget = clampToTokenBudget;
2088
- exports.createAiChatHistoryController = createAiChatHistoryController;
2089
1545
  exports.createAiChatSession = createAiChatSession;
2090
1546
  exports.createVanillaChat = createVanillaChat;
2091
- exports.deckIdFromBridge = deckIdFromBridge;
2092
- exports.deriveChatTitle = deriveChatTitle;
2093
- exports.describeToolActivity = describeToolActivity;
2094
- exports.diffSlides = diffSlides;
2095
1547
  exports.enabledToolNames = enabledToolNames;
2096
1548
  exports.estimateTokens = estimateTokens;
2097
- exports.humanizeDiffLine = humanizeDiffLine;
2098
1549
  exports.isAiAvailable = isAiAvailable;
2099
1550
  exports.loadAiSdk = loadAiSdk;
2100
- exports.newChatId = newChatId;
2101
1551
  exports.requireElement = requireElement;
2102
1552
  exports.requireSlide = requireSlide;
2103
1553
  exports.resetAiSdkCache = resetAiSdkCache;
@@ -2105,6 +1555,3 @@ exports.resolveChatTransport = resolveChatTransport;
2105
1555
  exports.routeWrite = routeWrite;
2106
1556
  exports.runSharedTool = runSharedTool;
2107
1557
  exports.slideTitle = slideTitle;
2108
- exports.summarizeToolArgs = summarizeToolArgs;
2109
- exports.toolCanvasTarget = toolCanvasTarget;
2110
- exports.toolLabel = toolLabel;