pptx-react-viewer 3.2.0 → 3.3.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.
Files changed (155) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/{AiChatPanel-C3E7NLX3.mjs → AiChatPanel-BNFDBP4S.mjs} +9 -8
  3. package/dist/AiChatPanel-BNFDBP4S.mjs.br +0 -0
  4. package/dist/AiChatPanel-BNFDBP4S.mjs.gz +0 -0
  5. package/dist/{AiChatPanel-TKBVSYD2.js → AiChatPanel-WNQCTQB5.js} +29 -28
  6. package/dist/AiChatPanel-WNQCTQB5.js.br +0 -0
  7. package/dist/AiChatPanel-WNQCTQB5.js.gz +0 -0
  8. package/dist/{Area3DChartScene-3A3CXKN3.js → Area3DChartScene-FXBSLIGX.js} +2 -2
  9. package/dist/Area3DChartScene-FXBSLIGX.js.br +0 -0
  10. package/dist/Area3DChartScene-FXBSLIGX.js.gz +0 -0
  11. package/dist/{Area3DChartScene-7YCFWEGX.mjs → Area3DChartScene-SAQVRYOH.mjs} +1 -1
  12. package/dist/Area3DChartScene-SAQVRYOH.mjs.br +0 -0
  13. package/dist/Area3DChartScene-SAQVRYOH.mjs.gz +0 -0
  14. package/dist/{Bar3DChartScene-BDUENAWJ.js → Bar3DChartScene-7HVUTP2E.js} +2 -2
  15. package/dist/Bar3DChartScene-7HVUTP2E.js.br +0 -0
  16. package/dist/Bar3DChartScene-7HVUTP2E.js.gz +0 -0
  17. package/dist/{Bar3DChartScene-7CNSJ35X.mjs → Bar3DChartScene-LUA6E2K6.mjs} +1 -1
  18. package/dist/Bar3DChartScene-LUA6E2K6.mjs.br +3 -0
  19. package/dist/Bar3DChartScene-LUA6E2K6.mjs.gz +0 -0
  20. package/dist/{Line3DChartScene-SMTHK6MD.mjs → Line3DChartScene-IW4JGH57.mjs} +1 -1
  21. package/dist/Line3DChartScene-IW4JGH57.mjs.br +0 -0
  22. package/dist/Line3DChartScene-IW4JGH57.mjs.gz +0 -0
  23. package/dist/{Line3DChartScene-R352CZ5U.js → Line3DChartScene-OVPULUTF.js} +2 -2
  24. package/dist/Line3DChartScene-OVPULUTF.js.br +0 -0
  25. package/dist/Line3DChartScene-OVPULUTF.js.gz +0 -0
  26. package/dist/{Model3DScene-Y4SGFQYW.js → Model3DScene-5KP6BVCV.js} +2 -2
  27. package/dist/Model3DScene-5KP6BVCV.js.br +0 -0
  28. package/dist/Model3DScene-5KP6BVCV.js.gz +0 -0
  29. package/dist/{Model3DScene-AUVJXXPV.mjs → Model3DScene-BERTZYCJ.mjs} +1 -1
  30. package/dist/Model3DScene-BERTZYCJ.mjs.br +0 -0
  31. package/dist/Model3DScene-BERTZYCJ.mjs.gz +0 -0
  32. package/dist/{PieChart3DScene-TK2VT4RS.js → PieChart3DScene-3R2ETTGA.js} +2 -2
  33. package/dist/PieChart3DScene-3R2ETTGA.js.br +0 -0
  34. package/dist/PieChart3DScene-3R2ETTGA.js.gz +0 -0
  35. package/dist/{PieChart3DScene-UD7GRH55.mjs → PieChart3DScene-O6FFK5L7.mjs} +1 -1
  36. package/dist/PieChart3DScene-O6FFK5L7.mjs.br +0 -0
  37. package/dist/PieChart3DScene-O6FFK5L7.mjs.gz +0 -0
  38. package/dist/{SurfaceChart3DScene-TXY6UZSW.mjs → SurfaceChart3DScene-OCR26R5D.mjs} +1 -1
  39. package/dist/SurfaceChart3DScene-OCR26R5D.mjs.br +0 -0
  40. package/dist/SurfaceChart3DScene-OCR26R5D.mjs.gz +0 -0
  41. package/dist/{SurfaceChart3DScene-ERFXZW2O.js → SurfaceChart3DScene-TGFAOLHL.js} +2 -2
  42. package/dist/SurfaceChart3DScene-TGFAOLHL.js.br +0 -0
  43. package/dist/SurfaceChart3DScene-TGFAOLHL.js.gz +0 -0
  44. package/dist/{chunk-RX6FE24O.mjs → chunk-2FTJAMFA.mjs} +294 -61
  45. package/dist/chunk-2FTJAMFA.mjs.br +0 -0
  46. package/dist/chunk-2FTJAMFA.mjs.gz +0 -0
  47. package/dist/{chunk-PPNXPEEZ.mjs → chunk-3B5FRKYU.mjs} +130 -437
  48. package/dist/chunk-3B5FRKYU.mjs.br +0 -0
  49. package/dist/chunk-3B5FRKYU.mjs.gz +0 -0
  50. package/dist/{chunk-ALO4ZOHQ.js → chunk-3P7FYHJH.js} +1 -0
  51. package/dist/chunk-3P7FYHJH.js.br +0 -0
  52. package/dist/chunk-3P7FYHJH.js.gz +0 -0
  53. package/dist/{chunk-B6UIVRFA.js → chunk-44CQ67GQ.js} +173 -262
  54. package/dist/chunk-44CQ67GQ.js.br +0 -0
  55. package/dist/chunk-44CQ67GQ.js.gz +0 -0
  56. package/dist/{chunk-RHSA5BW5.mjs → chunk-AMRT3AE4.mjs} +1 -0
  57. package/dist/chunk-AMRT3AE4.mjs.br +0 -0
  58. package/dist/chunk-AMRT3AE4.mjs.gz +0 -0
  59. package/dist/{chunk-G7UBIKAG.mjs → chunk-DM2IZCSD.mjs} +2429 -39
  60. package/dist/chunk-DM2IZCSD.mjs.br +0 -0
  61. package/dist/{chunk-G7UBIKAG.mjs.gz → chunk-DM2IZCSD.mjs.gz} +0 -0
  62. package/dist/{chunk-Q52HT4EZ.js → chunk-FSQCEAMG.js} +299 -63
  63. package/dist/chunk-FSQCEAMG.js.br +0 -0
  64. package/dist/chunk-FSQCEAMG.js.gz +0 -0
  65. package/dist/{chunk-ARQGUUYU.js → chunk-GR6SJJIT.js} +449 -723
  66. package/dist/chunk-GR6SJJIT.js.br +0 -0
  67. package/dist/chunk-GR6SJJIT.js.gz +0 -0
  68. package/dist/{chunk-FMEEIS6L.mjs → chunk-ITN5NYYM.mjs} +10 -98
  69. package/dist/chunk-ITN5NYYM.mjs.br +0 -0
  70. package/dist/chunk-ITN5NYYM.mjs.gz +0 -0
  71. package/dist/{chunk-FJDZ7AEE.js → chunk-K6R2JNCK.js} +2459 -45
  72. package/dist/chunk-K6R2JNCK.js.br +0 -0
  73. package/dist/{chunk-FJDZ7AEE.js.gz → chunk-K6R2JNCK.js.gz} +0 -0
  74. package/dist/{chunk-UHR7EYFM.mjs → chunk-QEEU4S4Z.mjs} +50 -324
  75. package/dist/chunk-QEEU4S4Z.mjs.br +0 -0
  76. package/dist/chunk-QEEU4S4Z.mjs.gz +0 -0
  77. package/dist/{chunk-RRAL4Y7V.js → chunk-QKSYKQEL.js} +1236 -1543
  78. package/dist/chunk-QKSYKQEL.js.br +0 -0
  79. package/dist/chunk-QKSYKQEL.js.gz +0 -0
  80. package/dist/i18n.js +4 -4
  81. package/dist/i18n.js.br +0 -0
  82. package/dist/i18n.js.gz +0 -0
  83. package/dist/i18n.mjs +1 -1
  84. package/dist/i18n.mjs.br +0 -0
  85. package/dist/i18n.mjs.gz +0 -0
  86. package/dist/index.js +47 -47
  87. package/dist/index.js.br +0 -0
  88. package/dist/index.js.gz +0 -0
  89. package/dist/index.mjs +6 -6
  90. package/dist/index.mjs.br +0 -0
  91. package/dist/index.mjs.gz +0 -0
  92. package/dist/internals.d.ts.map +1 -1
  93. package/dist/internals.js +79 -79
  94. package/dist/internals.js.br +4 -6
  95. package/dist/internals.js.gz +0 -0
  96. package/dist/internals.mjs +4 -4
  97. package/dist/internals.mjs.br +0 -0
  98. package/dist/internals.mjs.gz +0 -0
  99. package/dist/viewer/index.js +27 -27
  100. package/dist/viewer/index.js.br +0 -0
  101. package/dist/viewer/index.js.gz +0 -0
  102. package/dist/viewer/index.mjs +6 -6
  103. package/dist/viewer/index.mjs.br +0 -0
  104. package/dist/viewer/index.mjs.gz +0 -0
  105. package/package.json +1 -1
  106. package/dist/AiChatPanel-C3E7NLX3.mjs.br +0 -0
  107. package/dist/AiChatPanel-C3E7NLX3.mjs.gz +0 -0
  108. package/dist/AiChatPanel-TKBVSYD2.js.br +0 -0
  109. package/dist/AiChatPanel-TKBVSYD2.js.gz +0 -0
  110. package/dist/Area3DChartScene-3A3CXKN3.js.br +0 -0
  111. package/dist/Area3DChartScene-3A3CXKN3.js.gz +0 -0
  112. package/dist/Area3DChartScene-7YCFWEGX.mjs.br +0 -3
  113. package/dist/Area3DChartScene-7YCFWEGX.mjs.gz +0 -0
  114. package/dist/Bar3DChartScene-7CNSJ35X.mjs.br +0 -0
  115. package/dist/Bar3DChartScene-7CNSJ35X.mjs.gz +0 -0
  116. package/dist/Bar3DChartScene-BDUENAWJ.js.br +0 -0
  117. package/dist/Bar3DChartScene-BDUENAWJ.js.gz +0 -0
  118. package/dist/Line3DChartScene-R352CZ5U.js.br +0 -0
  119. package/dist/Line3DChartScene-R352CZ5U.js.gz +0 -0
  120. package/dist/Line3DChartScene-SMTHK6MD.mjs.br +0 -3
  121. package/dist/Line3DChartScene-SMTHK6MD.mjs.gz +0 -0
  122. package/dist/Model3DScene-AUVJXXPV.mjs.br +0 -0
  123. package/dist/Model3DScene-AUVJXXPV.mjs.gz +0 -0
  124. package/dist/Model3DScene-Y4SGFQYW.js.br +0 -0
  125. package/dist/Model3DScene-Y4SGFQYW.js.gz +0 -0
  126. package/dist/PieChart3DScene-TK2VT4RS.js.br +0 -0
  127. package/dist/PieChart3DScene-TK2VT4RS.js.gz +0 -0
  128. package/dist/PieChart3DScene-UD7GRH55.mjs.br +0 -0
  129. package/dist/PieChart3DScene-UD7GRH55.mjs.gz +0 -0
  130. package/dist/SurfaceChart3DScene-ERFXZW2O.js.br +0 -0
  131. package/dist/SurfaceChart3DScene-ERFXZW2O.js.gz +0 -0
  132. package/dist/SurfaceChart3DScene-TXY6UZSW.mjs.br +0 -0
  133. package/dist/SurfaceChart3DScene-TXY6UZSW.mjs.gz +0 -0
  134. package/dist/chunk-ALO4ZOHQ.js.br +0 -0
  135. package/dist/chunk-ALO4ZOHQ.js.gz +0 -0
  136. package/dist/chunk-ARQGUUYU.js.br +0 -0
  137. package/dist/chunk-ARQGUUYU.js.gz +0 -0
  138. package/dist/chunk-B6UIVRFA.js.br +0 -0
  139. package/dist/chunk-B6UIVRFA.js.gz +0 -0
  140. package/dist/chunk-FJDZ7AEE.js.br +0 -0
  141. package/dist/chunk-FMEEIS6L.mjs.br +0 -0
  142. package/dist/chunk-FMEEIS6L.mjs.gz +0 -0
  143. package/dist/chunk-G7UBIKAG.mjs.br +0 -0
  144. package/dist/chunk-PPNXPEEZ.mjs.br +0 -0
  145. package/dist/chunk-PPNXPEEZ.mjs.gz +0 -0
  146. package/dist/chunk-Q52HT4EZ.js.br +0 -0
  147. package/dist/chunk-Q52HT4EZ.js.gz +0 -0
  148. package/dist/chunk-RHSA5BW5.mjs.br +0 -0
  149. package/dist/chunk-RHSA5BW5.mjs.gz +0 -0
  150. package/dist/chunk-RRAL4Y7V.js.br +0 -0
  151. package/dist/chunk-RRAL4Y7V.js.gz +0 -0
  152. package/dist/chunk-RX6FE24O.mjs.br +0 -0
  153. package/dist/chunk-RX6FE24O.mjs.gz +0 -0
  154. package/dist/chunk-UHR7EYFM.mjs.br +0 -0
  155. package/dist/chunk-UHR7EYFM.mjs.gz +0 -0
@@ -1,4 +1,4 @@
1
- import { ThemePresets, PptxMarkdownConverter } from './chunk-G7UBIKAG.mjs';
1
+ import { ThemePresets, PptxMarkdownConverter, hasTextProperties, hasShapeProperties } from './chunk-DM2IZCSD.mjs';
2
2
  import { __export } from './chunk-XGB3TDIC.mjs';
3
3
  import * as mcp from 'pptx-viewer-mcp';
4
4
  import * as mcpSchemas from 'pptx-viewer-mcp/schemas';
@@ -16235,12 +16235,304 @@ function toRenderableParts(message) {
16235
16235
  }
16236
16236
  return out;
16237
16237
  }
16238
+ function isoOf(ms) {
16239
+ const n = Number.isFinite(ms) ? ms : 0;
16240
+ return new Date(n).toISOString();
16241
+ }
16242
+ function toLogChat(chat, detailed) {
16243
+ const messages = chat.messages.map((message) => {
16244
+ const parts = toRenderableParts(message);
16245
+ const textRuns = [];
16246
+ const toolCalls = [];
16247
+ for (const part of parts) {
16248
+ if (part.kind === "text") {
16249
+ textRuns.push(part.text);
16250
+ continue;
16251
+ }
16252
+ toolCalls.push({
16253
+ toolName: part.toolName,
16254
+ toolCallId: part.toolCallId,
16255
+ state: part.state,
16256
+ input: detailed ? part.input : void 0,
16257
+ output: detailed ? part.output : void 0,
16258
+ errorText: part.errorText
16259
+ });
16260
+ }
16261
+ return {
16262
+ role: message.role,
16263
+ text: textRuns.join("\n\n"),
16264
+ toolCalls
16265
+ };
16266
+ });
16267
+ return {
16268
+ id: chat.id,
16269
+ title: chat.title,
16270
+ deckId: chat.deckId,
16271
+ createdAt: chat.createdAt,
16272
+ updatedAt: chat.updatedAt,
16273
+ createdAtIso: isoOf(chat.createdAt),
16274
+ updatedAtIso: isoOf(chat.updatedAt),
16275
+ messageCount: chat.messages.length,
16276
+ messages
16277
+ };
16278
+ }
16279
+ function buildChatLogExport(chats, options) {
16280
+ const detailed = options?.detailed ?? true;
16281
+ const now = options?.now ?? Date.now();
16282
+ return {
16283
+ format: "pptx-ai-chat-log",
16284
+ version: 1,
16285
+ exportedAt: isoOf(now),
16286
+ detailed,
16287
+ chatCount: chats.length,
16288
+ chats: chats.map((chat) => toLogChat(chat, detailed))
16289
+ };
16290
+ }
16291
+ function toolCallLine(call, detailed) {
16292
+ const lines = [`- Tool \`${call.toolName}\` (${call.state})`];
16293
+ if (call.errorText) {
16294
+ lines.push(` - error: ${call.errorText}`);
16295
+ }
16296
+ if (detailed) {
16297
+ lines.push(" - input:");
16298
+ lines.push(" ```json");
16299
+ lines.push(JSON.stringify(call.input ?? null, null, 2));
16300
+ lines.push(" ```");
16301
+ lines.push(" - output:");
16302
+ lines.push(" ```json");
16303
+ lines.push(JSON.stringify(call.output ?? null, null, 2));
16304
+ lines.push(" ```");
16305
+ }
16306
+ return lines.join("\n");
16307
+ }
16308
+ function buildChatLogMarkdown(doc) {
16309
+ const out = [
16310
+ `# AI chat logs`,
16311
+ "",
16312
+ `Exported: ${doc.exportedAt}`,
16313
+ `Chats: ${doc.chatCount}`,
16314
+ ""
16315
+ ];
16316
+ for (const chat of doc.chats) {
16317
+ out.push(`## ${chat.title || chat.id}`);
16318
+ out.push("");
16319
+ out.push(`- id: ${chat.id}`);
16320
+ if (chat.deckId) {
16321
+ out.push(`- deck: ${chat.deckId}`);
16322
+ }
16323
+ out.push(`- created: ${chat.createdAtIso}`);
16324
+ out.push(`- updated: ${chat.updatedAtIso}`);
16325
+ out.push(`- messages: ${chat.messageCount}`);
16326
+ out.push("");
16327
+ for (const message of chat.messages) {
16328
+ out.push(`### ${message.role}`);
16329
+ out.push("");
16330
+ if (message.text) {
16331
+ out.push(message.text);
16332
+ out.push("");
16333
+ }
16334
+ for (const call of message.toolCalls) {
16335
+ out.push(toolCallLine(call, doc.detailed));
16336
+ out.push("");
16337
+ }
16338
+ }
16339
+ }
16340
+ return out.join("\n");
16341
+ }
16342
+ async function collectStoredChats(store = createChatHistoryStore()) {
16343
+ const summaries = await store.listChats();
16344
+ const chats = [];
16345
+ for (const summary of summaries) {
16346
+ const chat = await store.loadChat(summary.id);
16347
+ if (chat) {
16348
+ chats.push(chat);
16349
+ }
16350
+ }
16351
+ return chats;
16352
+ }
16353
+ function timestampSlug(now) {
16354
+ const d = new Date(now);
16355
+ const p = (n) => String(n).padStart(2, "0");
16356
+ return `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`;
16357
+ }
16358
+ function exportAiChatLogs(chats, meta3, save) {
16359
+ if (chats.length === 0) {
16360
+ return 0;
16361
+ }
16362
+ const now = meta3?.now ?? Date.now();
16363
+ const doc = buildChatLogExport(chats, { detailed: meta3?.detailed ?? true, now });
16364
+ const slug = timestampSlug(now);
16365
+ const format = meta3?.format ?? "json";
16366
+ if (format === "markdown") {
16367
+ save(`pptx-ai-chats-${slug}.md`, buildChatLogMarkdown(doc), "text/markdown");
16368
+ } else {
16369
+ save(`pptx-ai-chats-${slug}.json`, JSON.stringify(doc, null, 2), "application/json");
16370
+ }
16371
+ return chats.length;
16372
+ }
16373
+ function computeFocusTargets(input) {
16374
+ const { activeSlideIndex, selectedElementIds, selectedElementId } = input;
16375
+ const ids = selectedElementIds.length > 0 ? [...selectedElementIds] : selectedElementId ? [selectedElementId] : [];
16376
+ if (ids.length === 0) {
16377
+ return [{ kind: "slide", slideIndex: activeSlideIndex }];
16378
+ }
16379
+ return ids.map((elementId2) => ({ kind: "element", slideIndex: activeSlideIndex, elementId: elementId2 }));
16380
+ }
16381
+ function elementTypeLabel(type) {
16382
+ if (type === "smartArt") {
16383
+ return "SmartArt";
16384
+ }
16385
+ if (type === "ole") {
16386
+ return "OLE";
16387
+ }
16388
+ return type.charAt(0).toUpperCase() + type.slice(1);
16389
+ }
16390
+ function shortElementId(id) {
16391
+ const trailingNumber = id.match(/(\d+)\s*$/u);
16392
+ if (trailingNumber) {
16393
+ return trailingNumber[1];
16394
+ }
16395
+ const tail = id.replace(/^.*[/.-]/u, "");
16396
+ return tail || id;
16397
+ }
16398
+ function focusTargetChips(targets, slides) {
16399
+ return targets.map((target, index) => {
16400
+ if (target.kind === "slide") {
16401
+ const label2 = `Slide ${target.slideIndex + 1}`;
16402
+ return { key: `slide-${target.slideIndex}-${index}`, label: label2, title: label2 };
16403
+ }
16404
+ const el = slides[target.slideIndex]?.elements.find((e) => e.id === target.elementId);
16405
+ const typeLabel = el ? elementTypeLabel(el.type) : "Element";
16406
+ const label = el ? `${typeLabel} ${shortElementId(target.elementId)}` : `${typeLabel} (missing)`;
16407
+ return {
16408
+ key: `el-${target.elementId}-${index}`,
16409
+ label,
16410
+ title: `${typeLabel}: ${target.elementId}`
16411
+ };
16412
+ });
16413
+ }
16414
+ function isTwoTableFocus(targets, slides) {
16415
+ if (targets.length !== 2 || targets.some((target) => target.kind !== "element")) {
16416
+ return false;
16417
+ }
16418
+ const [a, b] = targets;
16419
+ if (a.slideIndex !== b.slideIndex) {
16420
+ return false;
16421
+ }
16422
+ const slide = slides[a.slideIndex];
16423
+ const elA = slide?.elements.find((e) => e.id === a.elementId);
16424
+ const elB = slide?.elements.find((e) => e.id === b.elementId);
16425
+ if (elA?.type !== "table" || elB?.type !== "table") {
16426
+ return false;
16427
+ }
16428
+ return { slideIndex: a.slideIndex, elementIdA: a.elementId, elementIdB: b.elementId };
16429
+ }
16430
+ function mergeTablesDirective(slideIndex2, elementIdA, elementIdB) {
16431
+ return `Merge the two selected tables (elementIdA=${elementIdA}, elementIdB=${elementIdB}) on slide ${slideIndex2 + 1} using merge_tables; stage it now, do not ask me to confirm.`;
16432
+ }
16238
16433
  init_chat_history_store();
16239
16434
  function deckIdFromBridge(bridge) {
16240
16435
  const meta3 = bridge.getDeckMeta();
16241
16436
  const title = (meta3.title ?? "deck").trim().toLowerCase().replace(/\s+/gu, "-").slice(0, 60);
16242
16437
  return `${title || "deck"}::${meta3.slideCount}`;
16243
16438
  }
16439
+ function applyElementUpdate(el, u) {
16440
+ if (u.x !== void 0) {
16441
+ el.x = u.x;
16442
+ }
16443
+ if (u.y !== void 0) {
16444
+ el.y = u.y;
16445
+ }
16446
+ if (u.width !== void 0) {
16447
+ el.width = u.width;
16448
+ }
16449
+ if (u.height !== void 0) {
16450
+ el.height = u.height;
16451
+ }
16452
+ if (u.rotation !== void 0) {
16453
+ el.rotation = u.rotation;
16454
+ }
16455
+ if (u.opacity !== void 0) {
16456
+ el.opacity = u.opacity;
16457
+ }
16458
+ if (u.hidden !== void 0) {
16459
+ el.hidden = u.hidden;
16460
+ }
16461
+ if (u.flipHorizontal !== void 0) {
16462
+ el.flipHorizontal = u.flipHorizontal;
16463
+ }
16464
+ if (u.flipVertical !== void 0) {
16465
+ el.flipVertical = u.flipVertical;
16466
+ }
16467
+ applyTextUpdate(el, u);
16468
+ applyShapeStyleUpdate(el, u);
16469
+ }
16470
+ function applyTextUpdate(el, u) {
16471
+ if (!hasTextProperties(el)) {
16472
+ return;
16473
+ }
16474
+ const textEl = el;
16475
+ if (u.text !== void 0) {
16476
+ textEl.text = u.text;
16477
+ if (textEl.textSegments && textEl.textSegments.length > 0) {
16478
+ textEl.textSegments[0].text = u.text;
16479
+ } else {
16480
+ textEl.textSegments = [{ text: u.text, style: {} }];
16481
+ }
16482
+ }
16483
+ if (u.fontSize === void 0 && u.fontFamily === void 0 && u.fontColor === void 0 && u.bold === void 0 && u.italic === void 0 && u.underline === void 0 && u.align === void 0) {
16484
+ return;
16485
+ }
16486
+ const textStyle = {};
16487
+ if (u.fontSize !== void 0) {
16488
+ textStyle.fontSize = u.fontSize;
16489
+ }
16490
+ if (u.fontFamily !== void 0) {
16491
+ textStyle.fontFamily = u.fontFamily;
16492
+ }
16493
+ if (u.fontColor !== void 0) {
16494
+ textStyle.color = u.fontColor;
16495
+ }
16496
+ if (u.bold !== void 0) {
16497
+ textStyle.bold = u.bold;
16498
+ }
16499
+ if (u.italic !== void 0) {
16500
+ textStyle.italic = u.italic;
16501
+ }
16502
+ if (u.underline !== void 0) {
16503
+ textStyle.underline = u.underline;
16504
+ }
16505
+ if (u.align !== void 0) {
16506
+ textStyle.align = u.align;
16507
+ }
16508
+ textEl.textStyle = { ...textEl.textStyle, ...textStyle };
16509
+ if (textEl.textSegments) {
16510
+ textEl.textSegments = textEl.textSegments.map((seg) => ({
16511
+ ...seg,
16512
+ style: { ...seg.style, ...textStyle }
16513
+ }));
16514
+ }
16515
+ }
16516
+ function applyShapeStyleUpdate(el, u) {
16517
+ if (u.fillColor === void 0 && u.strokeColor === void 0 && u.strokeWidth === void 0) {
16518
+ return;
16519
+ }
16520
+ if (!hasShapeProperties(el)) {
16521
+ return;
16522
+ }
16523
+ const holder = el;
16524
+ holder.shapeStyle ??= {};
16525
+ const style = holder.shapeStyle;
16526
+ if (u.fillColor !== void 0) {
16527
+ style.fillColor = u.fillColor;
16528
+ }
16529
+ if (u.strokeColor !== void 0) {
16530
+ style.strokeColor = u.strokeColor;
16531
+ }
16532
+ if (u.strokeWidth !== void 0) {
16533
+ style.strokeWidth = u.strokeWidth;
16534
+ }
16535
+ }
16244
16536
  function toolLabel(toolName) {
16245
16537
  if (!toolName) {
16246
16538
  return "Tool";
@@ -16642,63 +16934,4 @@ function toolCanvasTarget(toolName, input) {
16642
16934
  return { slideIndex: slideIndex2, elementIds };
16643
16935
  }
16644
16936
 
16645
- // src/viewer/hooks/ai/focus-targets.ts
16646
- function computeFocusTargets(input) {
16647
- const { activeSlideIndex, selectedElementIds, selectedElementId } = input;
16648
- const ids = selectedElementIds.length > 0 ? selectedElementIds : selectedElementId ? [selectedElementId] : [];
16649
- if (ids.length === 0) {
16650
- return [{ kind: "slide", slideIndex: activeSlideIndex }];
16651
- }
16652
- return ids.map((elementId2) => ({ kind: "element", slideIndex: activeSlideIndex, elementId: elementId2 }));
16653
- }
16654
- function elementTypeLabel(type) {
16655
- if (type === "smartArt") {
16656
- return "SmartArt";
16657
- }
16658
- if (type === "ole") {
16659
- return "OLE";
16660
- }
16661
- return type.charAt(0).toUpperCase() + type.slice(1);
16662
- }
16663
- function shortElementId(id) {
16664
- const trailingNumber = id.match(/(\d+)\s*$/u);
16665
- if (trailingNumber) {
16666
- return trailingNumber[1];
16667
- }
16668
- const tail = id.replace(/^.*[/.-]/u, "");
16669
- return tail || id;
16670
- }
16671
- function focusTargetChips(targets, slides) {
16672
- return targets.map((target, index) => {
16673
- if (target.kind === "slide") {
16674
- const label2 = `Slide ${target.slideIndex + 1}`;
16675
- return { key: `slide-${target.slideIndex}-${index}`, label: label2, title: label2 };
16676
- }
16677
- const el = slides[target.slideIndex]?.elements.find((e) => e.id === target.elementId);
16678
- const typeLabel = el ? elementTypeLabel(el.type) : "Element";
16679
- const label = el ? `${typeLabel} ${shortElementId(target.elementId)}` : `${typeLabel} (missing)`;
16680
- return {
16681
- key: `el-${target.elementId}-${index}`,
16682
- label,
16683
- title: `${typeLabel}: ${target.elementId}`
16684
- };
16685
- });
16686
- }
16687
- function isTwoTableFocus(targets, slides) {
16688
- if (targets.length !== 2 || targets.some((t) => t.kind !== "element")) {
16689
- return false;
16690
- }
16691
- const [a, b] = targets;
16692
- if (a.slideIndex !== b.slideIndex) {
16693
- return false;
16694
- }
16695
- const slide = slides[a.slideIndex];
16696
- const elA = slide?.elements.find((e) => e.id === a.elementId);
16697
- const elB = slide?.elements.find((e) => e.id === b.elementId);
16698
- if (elA?.type !== "table" || elB?.type !== "table") {
16699
- return false;
16700
- }
16701
- return { slideIndex: a.slideIndex, elementIdA: a.elementId, elementIdB: b.elementId };
16702
- }
16703
-
16704
- export { aiChangeAnimationCss, buildDeckContext, changeGhostStyle, computeFocusTargets, createAiChatSession, createChatHistoryStore, deckIdFromBridge, describeToolActivity, focusTargetChips, humanizeDiffLine, isAiAvailable, isTwoTableFocus, summarizeToolArgs, toRenderableParts, toolCanvasTarget, toolLabel };
16937
+ export { aiChangeAnimationCss, applyElementUpdate, buildDeckContext, changeGhostStyle, collectStoredChats, computeFocusTargets, createAiChatSession, createChatHistoryStore, deckIdFromBridge, describeToolActivity, exportAiChatLogs, focusTargetChips, humanizeDiffLine, isAiAvailable, isTwoTableFocus, mergeTablesDirective, summarizeToolArgs, toolCanvasTarget, toolLabel };
Binary file
Binary file