pptx-react-viewer 4.14.0 → 4.15.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 (111) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{AiChatPanel-WQUOEVQB.mjs → AiChatPanel-7OVUGUKW.mjs} +4 -4
  3. package/dist/AiChatPanel-7OVUGUKW.mjs.br +0 -0
  4. package/dist/AiChatPanel-7OVUGUKW.mjs.gz +0 -0
  5. package/dist/{AiChatPanel-PULXQTFJ.js → AiChatPanel-CDQWJTWL.js} +28 -28
  6. package/dist/AiChatPanel-CDQWJTWL.js.br +0 -0
  7. package/dist/AiChatPanel-CDQWJTWL.js.gz +0 -0
  8. package/dist/{Model3DScene-HZG33BWN.mjs → Model3DScene-A3CPMFAO.mjs} +1 -1
  9. package/dist/Model3DScene-A3CPMFAO.mjs.br +0 -0
  10. package/dist/Model3DScene-A3CPMFAO.mjs.gz +0 -0
  11. package/dist/{Model3DScene-6MYHPE5N.js → Model3DScene-OLGB7Z7Q.js} +2 -2
  12. package/dist/Model3DScene-OLGB7Z7Q.js.br +0 -0
  13. package/dist/Model3DScene-OLGB7Z7Q.js.gz +0 -0
  14. package/dist/{chunk-6ZR27XTL.js → chunk-2CSRCH4H.js} +2321 -1211
  15. package/dist/chunk-2CSRCH4H.js.br +0 -0
  16. package/dist/chunk-2CSRCH4H.js.gz +0 -0
  17. package/dist/{chunk-RK5UV5HL.js → chunk-6ZPXMS64.js} +1517 -1526
  18. package/dist/chunk-6ZPXMS64.js.br +0 -0
  19. package/dist/chunk-6ZPXMS64.js.gz +0 -0
  20. package/dist/{chunk-ECKXYCP3.mjs → chunk-AHJ4ND7Q.mjs} +1 -1
  21. package/dist/chunk-AHJ4ND7Q.mjs.br +0 -0
  22. package/dist/chunk-AHJ4ND7Q.mjs.gz +0 -0
  23. package/dist/{chunk-UWVRB4Z5.mjs → chunk-AIWEM7VE.mjs} +2312 -1210
  24. package/dist/chunk-AIWEM7VE.mjs.br +0 -0
  25. package/dist/chunk-AIWEM7VE.mjs.gz +0 -0
  26. package/dist/{chunk-55OLQ7HS.mjs → chunk-CJSIEITL.mjs} +3 -0
  27. package/dist/chunk-CJSIEITL.mjs.br +0 -0
  28. package/dist/chunk-CJSIEITL.mjs.gz +0 -0
  29. package/dist/{chunk-DI4YTG3J.js → chunk-CNXVOFUW.js} +197 -197
  30. package/dist/chunk-CNXVOFUW.js.br +0 -0
  31. package/dist/{chunk-DI4YTG3J.js.gz → chunk-CNXVOFUW.js.gz} +0 -0
  32. package/dist/{chunk-EPMT65EN.mjs → chunk-DNWIW75I.mjs} +6 -5
  33. package/dist/chunk-DNWIW75I.mjs.br +0 -0
  34. package/dist/chunk-DNWIW75I.mjs.gz +0 -0
  35. package/dist/{chunk-E6VYR3GM.js → chunk-HGO243GV.js} +818 -816
  36. package/dist/chunk-HGO243GV.js.br +0 -0
  37. package/dist/chunk-HGO243GV.js.gz +0 -0
  38. package/dist/{chunk-AJTFPTSN.mjs → chunk-Q5VQ53R3.mjs} +2 -2
  39. package/dist/chunk-Q5VQ53R3.mjs.br +0 -0
  40. package/dist/chunk-Q5VQ53R3.mjs.gz +0 -0
  41. package/dist/{chunk-WSYKEPW6.mjs → chunk-RQCAXUVQ.mjs} +342 -351
  42. package/dist/chunk-RQCAXUVQ.mjs.br +0 -0
  43. package/dist/chunk-RQCAXUVQ.mjs.gz +0 -0
  44. package/dist/{chunk-XWO367ZG.js → chunk-UP6PJEHM.js} +5 -5
  45. package/dist/chunk-UP6PJEHM.js.br +0 -0
  46. package/dist/chunk-UP6PJEHM.js.gz +0 -0
  47. package/dist/{chunk-HIYK7HPX.js → chunk-XEYB25ZT.js} +3 -0
  48. package/dist/chunk-XEYB25ZT.js.br +0 -0
  49. package/dist/chunk-XEYB25ZT.js.gz +0 -0
  50. package/dist/i18n.js +4 -4
  51. package/dist/i18n.js.br +0 -0
  52. package/dist/i18n.js.gz +0 -0
  53. package/dist/i18n.mjs +1 -1
  54. package/dist/i18n.mjs.br +0 -0
  55. package/dist/i18n.mjs.gz +0 -0
  56. package/dist/index.d.ts +293 -268
  57. package/dist/index.js +63 -63
  58. package/dist/index.js.br +0 -0
  59. package/dist/index.js.gz +0 -0
  60. package/dist/index.mjs +6 -6
  61. package/dist/index.mjs.br +0 -0
  62. package/dist/index.mjs.gz +0 -0
  63. package/dist/internals.d.ts +600 -575
  64. package/dist/internals.js +105 -105
  65. package/dist/internals.js.br +0 -0
  66. package/dist/internals.js.gz +0 -0
  67. package/dist/internals.mjs +4 -4
  68. package/dist/internals.mjs.br +0 -0
  69. package/dist/internals.mjs.gz +0 -0
  70. package/dist/pptx-viewer.css +1 -1
  71. package/dist/pptx-viewer.css.br +0 -0
  72. package/dist/pptx-viewer.css.gz +0 -0
  73. package/dist/viewer/index.d.ts +161 -136
  74. package/dist/viewer/index.js +27 -27
  75. package/dist/viewer/index.js.br +0 -0
  76. package/dist/viewer/index.js.gz +0 -0
  77. package/dist/viewer/index.mjs +6 -6
  78. package/dist/viewer/index.mjs.br +0 -0
  79. package/dist/viewer/index.mjs.gz +0 -0
  80. package/package.json +1 -1
  81. package/dist/AiChatPanel-PULXQTFJ.js.br +0 -0
  82. package/dist/AiChatPanel-PULXQTFJ.js.gz +0 -0
  83. package/dist/AiChatPanel-WQUOEVQB.mjs.br +0 -0
  84. package/dist/AiChatPanel-WQUOEVQB.mjs.gz +0 -0
  85. package/dist/Model3DScene-6MYHPE5N.js.br +0 -0
  86. package/dist/Model3DScene-6MYHPE5N.js.gz +0 -0
  87. package/dist/Model3DScene-HZG33BWN.mjs.br +0 -0
  88. package/dist/Model3DScene-HZG33BWN.mjs.gz +0 -0
  89. package/dist/chunk-55OLQ7HS.mjs.br +0 -0
  90. package/dist/chunk-55OLQ7HS.mjs.gz +0 -0
  91. package/dist/chunk-6ZR27XTL.js.br +0 -0
  92. package/dist/chunk-6ZR27XTL.js.gz +0 -0
  93. package/dist/chunk-AJTFPTSN.mjs.br +0 -0
  94. package/dist/chunk-AJTFPTSN.mjs.gz +0 -0
  95. package/dist/chunk-DI4YTG3J.js.br +0 -0
  96. package/dist/chunk-E6VYR3GM.js.br +0 -0
  97. package/dist/chunk-E6VYR3GM.js.gz +0 -0
  98. package/dist/chunk-ECKXYCP3.mjs.br +0 -0
  99. package/dist/chunk-ECKXYCP3.mjs.gz +0 -0
  100. package/dist/chunk-EPMT65EN.mjs.br +0 -0
  101. package/dist/chunk-EPMT65EN.mjs.gz +0 -0
  102. package/dist/chunk-HIYK7HPX.js.br +0 -0
  103. package/dist/chunk-HIYK7HPX.js.gz +0 -0
  104. package/dist/chunk-RK5UV5HL.js.br +0 -0
  105. package/dist/chunk-RK5UV5HL.js.gz +0 -0
  106. package/dist/chunk-UWVRB4Z5.mjs.br +0 -0
  107. package/dist/chunk-UWVRB4Z5.mjs.gz +0 -0
  108. package/dist/chunk-WSYKEPW6.mjs.br +0 -0
  109. package/dist/chunk-WSYKEPW6.mjs.gz +0 -0
  110. package/dist/chunk-XWO367ZG.js.br +0 -0
  111. package/dist/chunk-XWO367ZG.js.gz +0 -0
@@ -59243,9 +59243,9 @@ function ensureArray4(val2) {
59243
59243
  }
59244
59244
  return Array.isArray(val2) ? val2 : [val2];
59245
59245
  }
59246
- function collectControlNodes(controls) {
59247
- const nodes = [...ensureArray4(controls["p:control"])];
59248
- const altContents = ensureArray4(controls["mc:AlternateContent"]);
59246
+ function collectControlNodes(controls2) {
59247
+ const nodes = [...ensureArray4(controls2["p:control"])];
59248
+ const altContents = ensureArray4(controls2["mc:AlternateContent"]);
59249
59249
  for (const alt of altContents) {
59250
59250
  const fallback = alt["mc:Fallback"];
59251
59251
  const fallbackControls = fallback ? ensureArray4(fallback["p:control"]) : [];
@@ -59302,11 +59302,11 @@ function parseActiveXControlsFromSlide(slideXml3) {
59302
59302
  if (!cSld) {
59303
59303
  return [];
59304
59304
  }
59305
- const controls = cSld["p:controls"];
59306
- if (!controls) {
59305
+ const controls2 = cSld["p:controls"];
59306
+ if (!controls2) {
59307
59307
  return [];
59308
59308
  }
59309
- const controlEntries = collectControlNodes(controls);
59309
+ const controlEntries = collectControlNodes(controls2);
59310
59310
  if (controlEntries.length === 0) {
59311
59311
  return [];
59312
59312
  }
@@ -59397,17 +59397,17 @@ function buildActiveXControlNode(control) {
59397
59397
  }
59398
59398
  return node;
59399
59399
  }
59400
- function applyActiveXControlsToSlide(slideXml3, controls) {
59400
+ function applyActiveXControlsToSlide(slideXml3, controls2) {
59401
59401
  const sld = slideXml3["p:sld"];
59402
59402
  const cSld = sld?.["p:cSld"];
59403
59403
  if (!cSld) {
59404
59404
  return;
59405
59405
  }
59406
- if (!controls || controls.length === 0) {
59406
+ if (!controls2 || controls2.length === 0) {
59407
59407
  delete cSld["p:controls"];
59408
59408
  return;
59409
59409
  }
59410
- const nodes = controls.map(buildActiveXControlNode);
59410
+ const nodes = controls2.map(buildActiveXControlNode);
59411
59411
  const container = cSld["p:controls"] ?? {};
59412
59412
  const isNewContainer = cSld["p:controls"] === void 0;
59413
59413
  container["p:control"] = nodes.length === 1 ? nodes[0] : nodes;
@@ -135079,6 +135079,28 @@ var init_slide_fingerprint = __esm({
135079
135079
  UNHASHABLE_COUNTER = 0;
135080
135080
  }
135081
135081
  });
135082
+ function updateSlideLayoutRelationship(relationships2, layoutPath, relationshipType) {
135083
+ if (!layoutPath) {
135084
+ return;
135085
+ }
135086
+ const target = `../${layoutPath.replace(/^\/?ppt\//, "")}`;
135087
+ const existing = relationships2.find((rel) => String(rel["@_Type"]).endsWith("/slideLayout"));
135088
+ if (existing) {
135089
+ existing["@_Target"] = target;
135090
+ delete existing["@_TargetMode"];
135091
+ return;
135092
+ }
135093
+ const ids = new Set(relationships2.map((rel) => String(rel["@_Id"])));
135094
+ let id = 1;
135095
+ while (ids.has(`rId${id}`)) {
135096
+ id++;
135097
+ }
135098
+ relationships2.push({ "@_Id": `rId${id}`, "@_Type": relationshipType, "@_Target": target });
135099
+ }
135100
+ var init_slide_layout_relationship = __esm({
135101
+ "src/core/core/runtime/slide-layout-relationship.ts"() {
135102
+ }
135103
+ });
135082
135104
  function isXmlObject7(value) {
135083
135105
  return typeof value === "object" && value !== null && !Array.isArray(value);
135084
135106
  }
@@ -135731,6 +135753,7 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
135731
135753
  init_PptxHandlerRuntimeSaveElementWriter();
135732
135754
  init_save_structural_id_gate();
135733
135755
  init_slide_fingerprint();
135756
+ init_slide_layout_relationship();
135734
135757
  init_slide_save_xml_order();
135735
135758
  init_slide_timing_reconcile();
135736
135759
  init_slide_transition_reconcile();
@@ -135898,9 +135921,15 @@ var init_PptxHandlerRuntimeSaveSlideWriter = __esm({
135898
135921
  slideRelsRoot["@_xmlns"] = constants.relationshipsNamespace;
135899
135922
  }
135900
135923
  const slideRelationships = this.ensureArray(slideRelsRoot["Relationship"]);
135924
+ updateSlideLayoutRelationship(
135925
+ slideRelationships,
135926
+ slide.layoutPath,
135927
+ constants.slideLayoutRelationshipType
135928
+ );
135901
135929
  const slideRelationshipRegistry = new PptxSlideRelationshipRegistry({
135902
135930
  relationships: slideRelationships
135903
135931
  });
135932
+ this.slideRelsMap.set(slide.id, slideRelationshipRegistry.toRelationshipMap());
135904
135933
  const existingCommentRelationship = slideRelationshipRegistry.removeCommentRelationships(
135905
135934
  constants.slideCommentRelationshipType
135906
135935
  );
@@ -136919,12 +136948,12 @@ function orderedTemplatePartXml(options) {
136919
136948
  const rebuilt = positionsByRuntime.get(runtime)?.get(partPath);
136920
136949
  const ordered4 = rebuilt ? orderShapeTreeChildren(rewrapped, (node) => rebuilt.get(node), getLocalName2) : orderContainer(rewrapped, sourceXml ? scanSpTreeDocumentOrder(sourceXml) : [], getLocalName2);
136921
136950
  if (ordered4 === spTree) {
136922
- return withOrderedTableParagraphs(xmlObj);
136951
+ return withOrderedTableParagraphs(xmlObj, true);
136923
136952
  }
136924
136953
  const nextRoot = { ...root, "p:cSld": { ...commonSlideData, "p:spTree": ordered4 } };
136925
136954
  const nextPart = { ...xmlObj };
136926
136955
  setOwnXmlProperty(nextPart, rootTag2, nextRoot);
136927
- return withOrderedTableParagraphs(nextPart);
136956
+ return withOrderedTableParagraphs(nextPart, true);
136928
136957
  }
136929
136958
  var ALTERNATE_CONTENT_TAG3;
136930
136959
  var positionsByRuntime;
@@ -185595,6 +185624,250 @@ pptx-ui-checkbox[checked] { border-color: var(--pptx-primary, #6366f1); }
185595
185624
  }
185596
185625
  }
185597
185626
  `;
185627
+ var CONTRACT_REVISION = 1;
185628
+ var CONTRACT_KEY = /* @__PURE__ */ Symbol.for("pptx-viewer.web-control-contract");
185629
+ function assertWebControlContract(registry, names) {
185630
+ for (const name of names) {
185631
+ const ctor = registry.get(name);
185632
+ const revision = ctor?.[CONTRACT_KEY];
185633
+ if (revision !== void 0 && revision !== CONTRACT_REVISION) {
185634
+ throw new Error(
185635
+ `Incompatible ${name} contract (${revision}; expected ${CONTRACT_REVISION}). Use matching viewer bindings in this window.`
185636
+ );
185637
+ }
185638
+ }
185639
+ }
185640
+ function markWebControlContract(ctor) {
185641
+ Object.defineProperty(ctor, CONTRACT_KEY, { value: CONTRACT_REVISION });
185642
+ }
185643
+ var RIBBON_COMMAND_STYLES = `
185644
+ :host { display: inline-flex; flex: none; }
185645
+ button {
185646
+ box-sizing: border-box; display: inline-flex; flex-direction: column; align-items: center;
185647
+ justify-content: flex-start; gap: 2px; min-width: 54px; max-width: 78px; height: 58px;
185648
+ padding: 4px; border: 0; border-radius: 4px; background: transparent;
185649
+ color: var(--pptx-foreground, #f9fafb); cursor: pointer; font: inherit;
185650
+ font-size: 9px; line-height: 11px; text-align: center;
185651
+ }
185652
+ svg { width: 24px; height: 24px; flex: none; color: var(--pptx-primary, #6366f1);
185653
+ fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
185654
+ :host([compact]) button { flex-direction: row; align-items: center; justify-content: flex-start;
185655
+ gap: 6px; min-width: 88px; max-width: none; height: 26px; padding: 0 4px; font-size: 10px; text-align: left; }
185656
+ :host([compact]) svg { width: 16px; height: 16px; }
185657
+ button:hover:not(:disabled) { background: var(--pptx-accent, #33334d); }
185658
+ :host([active]) button { background: color-mix(in srgb, var(--pptx-primary, #6366f1) 15%, transparent); color: var(--pptx-primary, #6366f1); }
185659
+ button:disabled { opacity: .35; cursor: not-allowed; }
185660
+ button:focus-visible { outline: 2px solid var(--pptx-ring, #6366f1); outline-offset: 2px; }
185661
+ @media (pointer: coarse), (max-width: 767px) { :host([compact]) button { min-height: 44px; } }
185662
+ @media (forced-colors: active) {
185663
+ button { color: ButtonText; } svg { color: ButtonText; }
185664
+ button:disabled { color: GrayText; opacity: 1; }
185665
+ button:focus-visible { outline-color: Highlight; }
185666
+ :host([active]) button { border: 1px solid Highlight; }
185667
+ }
185668
+ `;
185669
+ var RIBBON_ICON_PATHS = {
185670
+ camera: "M2 6h4l2-3h4l2 3h4v11H2ZM7 11a3 3 0 1 0 6 0 3 3 0 1 0-6 0",
185671
+ eraser: "M3 12l8-8 6 6-7 7H7ZM3 17h14M7 8l6 6",
185672
+ reset: "M4 10a6 6 0 1 1 1.8 4.2M4 6v4h4",
185673
+ help: "M3 10a7 7 0 1 0 14 0 7 7 0 1 0-14 0M8 7a2 2 0 1 1 3 1.8c-.7.3-1 .8-1 1.7M10 14v.1",
185674
+ "play-start": "M4 3 15 10 4 17ZM17 3v14",
185675
+ play: "M5 3 16 10 5 17Z",
185676
+ presentation: "M2 3h16v11H2ZM7 18h6M10 14v4",
185677
+ list: "M4 4h12v12H4ZM7 8h6M7 11h6",
185678
+ broadcast: "M7 7a4.2 4.2 0 0 0 0 6M13 7a4.2 4.2 0 0 1 0 6M4.5 4.5a7.8 7.8 0 0 0 0 11M15.5 4.5a7.8 7.8 0 0 1 0 11M8.5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0",
185679
+ video: "M2 5h11v10H2ZM13 10l5-3v6Z",
185680
+ settings: "M3 5h14M6 10h8M8 15h4M6 3v4M12 8v4M10 13v4",
185681
+ "eye-off": "M2.5 10S5.5 5 10 5s7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5ZM4 4l12 12",
185682
+ clock: "M3 10a7 7 0 1 0 14 0 7 7 0 1 0-14 0M10 6v4l3 2",
185683
+ record: "M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0",
185684
+ captions: "M2 4h16v12H2ZM5 9h4M11 9h4M5 12h3M10 12h5",
185685
+ keyboard: "M2 5h16v10H2ZM5 8h1M9 8h1M13 8h1M5 11h1M9 11h5",
185686
+ accessibility: "M8 3a2 2 0 1 0 4 0 2 2 0 1 0-4 0M3 7l7 2 7-2M10 9v4M10 13l-4 5M10 13l4 5"
185687
+ };
185688
+ function definePptxRibbonCommand(registry) {
185689
+ if (registry.get("pptx-ui-ribbon-command")) {
185690
+ return;
185691
+ }
185692
+ class RibbonCommand extends HTMLElement {
185693
+ static observedAttributes = [
185694
+ "label",
185695
+ "icon",
185696
+ "disabled",
185697
+ "active",
185698
+ "compact",
185699
+ "pressed",
185700
+ "expanded",
185701
+ "title",
185702
+ "data-ribbon-control"
185703
+ ];
185704
+ button;
185705
+ text;
185706
+ path;
185707
+ constructor() {
185708
+ super();
185709
+ const root = this.attachShadow({ mode: "open" });
185710
+ attachControlStyles(root, RIBBON_COMMAND_STYLES);
185711
+ this.button = document.createElement("button");
185712
+ this.button.type = "button";
185713
+ this.button.setAttribute("part", "button");
185714
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
185715
+ svg.setAttribute("viewBox", "0 0 20 20");
185716
+ svg.setAttribute("aria-hidden", "true");
185717
+ this.path = document.createElementNS("http://www.w3.org/2000/svg", "path");
185718
+ svg.append(this.path);
185719
+ this.text = document.createElement("span");
185720
+ this.button.append(svg, this.text);
185721
+ root.append(this.button);
185722
+ this.button.addEventListener("keydown", (event) => {
185723
+ if ((event.key === " " || event.key === "Enter") && !event.ctrlKey && !event.metaKey && !event.altKey) {
185724
+ event.stopPropagation();
185725
+ }
185726
+ });
185727
+ this.button.addEventListener("click", () => {
185728
+ const id = this.getAttribute("data-ribbon-control");
185729
+ if (!this.button.disabled && id) {
185730
+ this.dispatchEvent(
185731
+ new CustomEvent("command-request", { detail: { id }, bubbles: true, composed: true })
185732
+ );
185733
+ }
185734
+ });
185735
+ }
185736
+ connectedCallback() {
185737
+ this.sync();
185738
+ }
185739
+ attributeChangedCallback() {
185740
+ this.sync();
185741
+ }
185742
+ sync() {
185743
+ this.text.textContent = this.getAttribute("label") ?? "";
185744
+ this.button.title = this.getAttribute("title") ?? this.text.textContent;
185745
+ this.button.disabled = this.hasAttribute("disabled");
185746
+ this.path.setAttribute("d", RIBBON_ICON_PATHS[this.getAttribute("icon") ?? ""] ?? "");
185747
+ for (const attr22 of ["pressed", "expanded"]) {
185748
+ const value = this.getAttribute(attr22);
185749
+ if (value === null) {
185750
+ this.button.removeAttribute(`aria-${attr22}`);
185751
+ } else {
185752
+ this.button.setAttribute(`aria-${attr22}`, value);
185753
+ }
185754
+ }
185755
+ }
185756
+ }
185757
+ registry.define("pptx-ui-ribbon-command", RibbonCommand);
185758
+ }
185759
+ var STYLES = `
185760
+ :host { display: inline-flex; flex: none; align-self: stretch; }
185761
+ .group { box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between;
185762
+ min-height: 78px; padding: 4px 8px 2px; border-right: 1px solid color-mix(in srgb, var(--pptx-border, #33334d) 60%, transparent); }
185763
+ :host(:last-child) .group { border-right: 0; }
185764
+ .row { display: flex; align-items: flex-start; gap: 4px; }
185765
+ ::slotted(*) { flex-shrink: 0; }
185766
+ .caption { padding-top: 2px; color: var(--pptx-muted-foreground, #94a3b8); font: inherit;
185767
+ font-size: 9px; line-height: 12px; text-align: center; white-space: nowrap; }
185768
+ `;
185769
+ function definePptxRibbonGroup(registry) {
185770
+ if (registry.get("pptx-ui-ribbon-group")) {
185771
+ return;
185772
+ }
185773
+ class RibbonGroup extends HTMLElement {
185774
+ static observedAttributes = ["label"];
185775
+ caption;
185776
+ constructor() {
185777
+ super();
185778
+ const root = this.attachShadow({ mode: "open" });
185779
+ attachControlStyles(root, STYLES);
185780
+ const group2 = document.createElement("div");
185781
+ group2.className = "group";
185782
+ const row = document.createElement("div");
185783
+ row.className = "row";
185784
+ row.append(document.createElement("slot"));
185785
+ this.caption = document.createElement("span");
185786
+ this.caption.className = "caption";
185787
+ group2.append(row, this.caption);
185788
+ root.append(group2);
185789
+ }
185790
+ connectedCallback() {
185791
+ this.setAttribute("role", "group");
185792
+ this.sync();
185793
+ }
185794
+ attributeChangedCallback() {
185795
+ this.sync();
185796
+ }
185797
+ sync() {
185798
+ const label = this.getAttribute("label") ?? "";
185799
+ this.caption.textContent = label;
185800
+ this.setAttribute("aria-label", label);
185801
+ }
185802
+ }
185803
+ registry.define("pptx-ui-ribbon-group", RibbonGroup);
185804
+ }
185805
+ function definePptxRibbonToggle(registry) {
185806
+ if (registry.get("pptx-ui-ribbon-toggle")) {
185807
+ return;
185808
+ }
185809
+ class RibbonToggle extends HTMLElement {
185810
+ static observedAttributes = ["label", "checked", "disabled", "title"];
185811
+ checkbox;
185812
+ text;
185813
+ constructor() {
185814
+ super();
185815
+ const root = this.attachShadow({ mode: "open" });
185816
+ attachControlStyles(
185817
+ root,
185818
+ `
185819
+ :host { display: block; }
185820
+ label { display: flex; align-items: center; gap: 4px; min-height: 22px; padding: 0 4px;
185821
+ color: var(--pptx-foreground, #f9fafb); font: inherit; font-size: 10px; white-space: nowrap; cursor: pointer; }
185822
+ :host([disabled]) label { color: var(--pptx-muted-foreground, #9ca3af); cursor: not-allowed; }
185823
+ @media (pointer: coarse), (max-width: 767px) { label { min-height: 44px; font-size: 12px; } }
185824
+ `
185825
+ );
185826
+ const label = document.createElement("label");
185827
+ this.checkbox = document.createElement("pptx-ui-checkbox");
185828
+ this.text = document.createTextNode("");
185829
+ label.append(this.checkbox, this.text);
185830
+ label.addEventListener("click", (event) => {
185831
+ event.preventDefault();
185832
+ if (event.target !== this.checkbox) {
185833
+ this.checkbox.click();
185834
+ }
185835
+ });
185836
+ this.checkbox.addEventListener("input", (event) => event.stopPropagation());
185837
+ this.checkbox.addEventListener("change", (event) => {
185838
+ event.stopPropagation();
185839
+ const checked = this.checkbox.checked;
185840
+ this.sync();
185841
+ const id = this.getAttribute("data-ribbon-control");
185842
+ if (!this.hasAttribute("disabled") && id) {
185843
+ this.dispatchEvent(
185844
+ new CustomEvent("toggle-request", {
185845
+ detail: { id, checked },
185846
+ bubbles: true,
185847
+ composed: true
185848
+ })
185849
+ );
185850
+ }
185851
+ });
185852
+ root.append(label);
185853
+ }
185854
+ connectedCallback() {
185855
+ this.sync();
185856
+ }
185857
+ attributeChangedCallback() {
185858
+ this.sync();
185859
+ }
185860
+ sync() {
185861
+ const label = this.getAttribute("label") ?? "";
185862
+ this.text.textContent = label;
185863
+ this.checkbox.setAttribute("aria-label", label);
185864
+ this.checkbox.title = this.getAttribute("title") ?? label;
185865
+ this.checkbox.checked = this.hasAttribute("checked");
185866
+ this.checkbox.disabled = this.hasAttribute("disabled");
185867
+ }
185868
+ }
185869
+ registry.define("pptx-ui-ribbon-toggle", RibbonToggle);
185870
+ }
185598
185871
  var SEARCH_STYLES = `
185599
185872
  :host {
185600
185873
  display: flex;
@@ -186034,6 +186307,9 @@ function definePptxSelect(registry) {
186034
186307
  }
186035
186308
  disconnectedCallback() {
186036
186309
  this.close();
186310
+ window.clearTimeout(this.searchTimer);
186311
+ this.searchTimer = 0;
186312
+ this.search = "";
186037
186313
  this.observer.disconnect();
186038
186314
  cancelAnimationFrame(this.refreshFrame);
186039
186315
  this.refreshFrame = 0;
@@ -186205,796 +186481,6 @@ function definePptxSelect(registry) {
186205
186481
  }
186206
186482
  registry.define("pptx-ui-select", PptxSelect);
186207
186483
  }
186208
- function registerPptxWebControls() {
186209
- if (typeof window === "undefined" || !window.customElements) {
186210
- return;
186211
- }
186212
- if (!document.getElementById("pptx-ui-control-hosts")) {
186213
- const style = document.createElement("style");
186214
- style.id = "pptx-ui-control-hosts";
186215
- style.textContent = HOST_STYLES;
186216
- document.head.append(style);
186217
- }
186218
- definePptxSearchField(window.customElements);
186219
- definePptxCheckbox(window.customElements);
186220
- definePptxSelect(window.customElements);
186221
- }
186222
- var defaultThemeColors = {
186223
- background: "#030712",
186224
- // gray-950
186225
- foreground: "#f3f4f6",
186226
- // gray-100
186227
- card: "#111827",
186228
- // gray-900
186229
- cardForeground: "#f3f4f6",
186230
- // gray-100
186231
- popover: "#111827",
186232
- // gray-900
186233
- popoverForeground: "#f3f4f6",
186234
- // gray-100
186235
- primary: "#6366f1",
186236
- // indigo-500
186237
- primaryForeground: "#ffffff",
186238
- // white
186239
- secondary: "#1f2937",
186240
- // gray-800
186241
- secondaryForeground: "#f3f4f6",
186242
- // gray-100
186243
- muted: "#1f2937",
186244
- // gray-800
186245
- mutedForeground: "#9ca3af",
186246
- // gray-400
186247
- accent: "#1f2937",
186248
- // gray-800
186249
- accentForeground: "#f3f4f6",
186250
- // gray-100
186251
- destructive: "#ef4444",
186252
- // red-500
186253
- destructiveForeground: "#ffffff",
186254
- // white
186255
- border: "#374151",
186256
- // gray-700
186257
- input: "#374151",
186258
- // gray-700
186259
- ring: "#6366f1"
186260
- // indigo-500
186261
- };
186262
- var defaultRadius = "0.5rem";
186263
- var lightThemeColors = {
186264
- background: "#f8fafc",
186265
- // slate-50
186266
- foreground: "#0f172a",
186267
- // slate-900
186268
- card: "#ffffff",
186269
- cardForeground: "#0f172a",
186270
- // slate-900
186271
- popover: "#ffffff",
186272
- popoverForeground: "#0f172a",
186273
- // slate-900
186274
- primary: "#4f46e5",
186275
- // indigo-600
186276
- primaryForeground: "#ffffff",
186277
- secondary: "#f1f5f9",
186278
- // slate-100
186279
- secondaryForeground: "#0f172a",
186280
- // slate-900
186281
- muted: "#f1f5f9",
186282
- // slate-100
186283
- mutedForeground: "#64748b",
186284
- // slate-500
186285
- accent: "#f1f5f9",
186286
- // slate-100
186287
- accentForeground: "#0f172a",
186288
- // slate-900
186289
- destructive: "#dc2626",
186290
- // red-600
186291
- destructiveForeground: "#ffffff",
186292
- border: "#e2e8f0",
186293
- // slate-200
186294
- input: "#e2e8f0",
186295
- // slate-200
186296
- ring: "#4f46e5"
186297
- // indigo-600
186298
- };
186299
- var lightTheme = {
186300
- colors: lightThemeColors
186301
- };
186302
- var COLOR_KEY_TO_CSS = {
186303
- background: "background",
186304
- foreground: "foreground",
186305
- card: "card",
186306
- cardForeground: "card-foreground",
186307
- popover: "popover",
186308
- popoverForeground: "popover-foreground",
186309
- primary: "primary",
186310
- primaryForeground: "primary-foreground",
186311
- secondary: "secondary",
186312
- secondaryForeground: "secondary-foreground",
186313
- muted: "muted",
186314
- mutedForeground: "muted-foreground",
186315
- accent: "accent",
186316
- accentForeground: "accent-foreground",
186317
- destructive: "destructive",
186318
- destructiveForeground: "destructive-foreground",
186319
- border: "border",
186320
- input: "input",
186321
- ring: "ring"
186322
- };
186323
- var DERIVED_COLOR_TOKENS = [
186324
- { source: "primary", cssSuffix: "inspector-active" },
186325
- { source: "border", cssSuffix: "inspector-border" }
186326
- ];
186327
- function themeToCssVars(theme, omitDefaults = false) {
186328
- const vars = {};
186329
- if (!theme) {
186330
- return vars;
186331
- }
186332
- const colors = theme.colors;
186333
- if (colors) {
186334
- for (const [key2, cssSuffix] of Object.entries(COLOR_KEY_TO_CSS)) {
186335
- const value = colors[key2];
186336
- if (value === void 0) {
186337
- continue;
186338
- }
186339
- if (omitDefaults && value === defaultThemeColors[key2]) {
186340
- continue;
186341
- }
186342
- vars[`--pptx-${cssSuffix}`] = value;
186343
- vars[`--color-${cssSuffix}`] = value;
186344
- }
186345
- for (const { source, cssSuffix } of DERIVED_COLOR_TOKENS) {
186346
- const value = colors[source];
186347
- if (value === void 0) {
186348
- continue;
186349
- }
186350
- if (omitDefaults && value === defaultThemeColors[source]) {
186351
- continue;
186352
- }
186353
- vars[`--pptx-${cssSuffix}`] = value;
186354
- }
186355
- }
186356
- if (theme.radius !== void 0) {
186357
- if (!omitDefaults || theme.radius !== defaultRadius) {
186358
- vars["--pptx-radius"] = theme.radius;
186359
- const r = theme.radius;
186360
- vars["--radius-sm"] = `calc(${r} - 4px)`;
186361
- vars["--radius-md"] = `calc(${r} - 2px)`;
186362
- vars["--radius-lg"] = r;
186363
- vars["--radius-xl"] = `calc(${r} + 4px)`;
186364
- }
186365
- }
186366
- if (theme.cssVars) {
186367
- for (const [key2, value] of Object.entries(theme.cssVars)) {
186368
- vars[key2] = value;
186369
- }
186370
- }
186371
- return vars;
186372
- }
186373
- function defaultCssVars() {
186374
- const vars = {};
186375
- for (const [key2, cssSuffix] of Object.entries(COLOR_KEY_TO_CSS)) {
186376
- vars[`--pptx-${cssSuffix}`] = defaultThemeColors[key2];
186377
- }
186378
- for (const { source, cssSuffix } of DERIVED_COLOR_TOKENS) {
186379
- vars[`--pptx-${cssSuffix}`] = defaultThemeColors[source];
186380
- }
186381
- vars["--pptx-radius"] = defaultRadius;
186382
- return vars;
186383
- }
186384
- var vermilionLightColors = {
186385
- background: "#fbfaf7",
186386
- foreground: "#1a1d21",
186387
- card: "#ffffff",
186388
- cardForeground: "#1a1d21",
186389
- popover: "#ffffff",
186390
- popoverForeground: "#1a1d21",
186391
- primary: "#c2431f",
186392
- primaryForeground: "#ffffff",
186393
- secondary: "#f2efe8",
186394
- secondaryForeground: "#1a1d21",
186395
- muted: "#f2efe8",
186396
- mutedForeground: "#5a626e",
186397
- accent: "rgba(194, 67, 31, 0.08)",
186398
- accentForeground: "#1a1d21",
186399
- destructive: "#dc2626",
186400
- destructiveForeground: "#ffffff",
186401
- border: "#e6e2d9",
186402
- input: "#e6e2d9",
186403
- ring: "#c2431f"
186404
- };
186405
- var vermilionDarkColors = {
186406
- background: "#0f1113",
186407
- foreground: "#f0efec",
186408
- card: "#171a1e",
186409
- cardForeground: "#f0efec",
186410
- popover: "#171a1e",
186411
- popoverForeground: "#f0efec",
186412
- primary: "#e86a40",
186413
- primaryForeground: "#ffffff",
186414
- secondary: "#1f242b",
186415
- secondaryForeground: "#f0efec",
186416
- muted: "#1f242b",
186417
- mutedForeground: "#9aa1ab",
186418
- accent: "rgba(232, 106, 64, 0.1)",
186419
- accentForeground: "#f0efec",
186420
- destructive: "#ef4444",
186421
- destructiveForeground: "#ffffff",
186422
- border: "#272c33",
186423
- input: "#272c33",
186424
- ring: "#e86a40"
186425
- };
186426
- var vermilionRadius = "0.375rem";
186427
- var vermilionLightTheme = {
186428
- colors: vermilionLightColors,
186429
- radius: vermilionRadius
186430
- };
186431
- var vermilionDarkTheme = {
186432
- colors: vermilionDarkColors,
186433
- radius: vermilionRadius
186434
- };
186435
- var THEME_CATALOG = [
186436
- { key: "default", labelKey: "pptx.settings.theme.default", theme: void 0 },
186437
- { key: "light", labelKey: "pptx.settings.theme.light", theme: lightTheme },
186438
- {
186439
- key: "vermilionLight",
186440
- labelKey: "pptx.settings.theme.vermilionLight",
186441
- theme: vermilionLightTheme
186442
- },
186443
- {
186444
- key: "vermilionDark",
186445
- labelKey: "pptx.settings.theme.vermilionDark",
186446
- theme: vermilionDarkTheme
186447
- }
186448
- ];
186449
- function resolveThemeCatalogEntry(key2, catalog = THEME_CATALOG) {
186450
- return catalog.find((entry5) => entry5.key === key2)?.theme;
186451
- }
186452
- function corePreset(id) {
186453
- const preset22 = exports.THEME_PRESETS.find((p) => p.id === id);
186454
- if (!preset22) {
186455
- throw new Error(`theme-gallery-presets: core THEME_PRESETS is missing "${id}"`);
186456
- }
186457
- return preset22;
186458
- }
186459
- var WISP_PRESET = {
186460
- id: "wisp",
186461
- name: "Wisp",
186462
- colorScheme: {
186463
- dk1: "#000000",
186464
- lt1: "#FFFFFF",
186465
- dk2: "#46393B",
186466
- lt2: "#E8DCD8",
186467
- accent1: "#A53010",
186468
- accent2: "#DE7E18",
186469
- accent3: "#9F8351",
186470
- accent4: "#728653",
186471
- accent5: "#92AA4C",
186472
- accent6: "#6AAC91",
186473
- hlink: "#FB4F14",
186474
- folHlink: "#E25839"
186475
- },
186476
- fontScheme: {
186477
- majorFont: { latin: "Century Gothic" },
186478
- minorFont: { latin: "Century Gothic" }
186479
- }
186480
- };
186481
- var BERLIN_PRESET = {
186482
- id: "berlin",
186483
- name: "Berlin",
186484
- colorScheme: {
186485
- dk1: "#000000",
186486
- lt1: "#FFFFFF",
186487
- dk2: "#3E5C61",
186488
- lt2: "#D5E0D0",
186489
- accent1: "#F09415",
186490
- accent2: "#C1B56B",
186491
- accent3: "#89C2A3",
186492
- accent4: "#729BBE",
186493
- accent5: "#9A90C2",
186494
- accent6: "#BE8DBE",
186495
- hlink: "#25A0DA",
186496
- folHlink: "#FF7F00"
186497
- },
186498
- fontScheme: {
186499
- majorFont: { latin: "Trebuchet MS" },
186500
- minorFont: { latin: "Trebuchet MS" }
186501
- }
186502
- };
186503
- var SLICE_PRESET = {
186504
- id: "slice",
186505
- name: "Slice",
186506
- colorScheme: {
186507
- dk1: "#000000",
186508
- lt1: "#FFFFFF",
186509
- dk2: "#2E3B4C",
186510
- lt2: "#C7CDD3",
186511
- accent1: "#E2751D",
186512
- accent2: "#C53B23",
186513
- accent3: "#A13D69",
186514
- accent4: "#58599E",
186515
- accent5: "#36749D",
186516
- accent6: "#4EA39A",
186517
- hlink: "#FD6B32",
186518
- folHlink: "#D14D0F"
186519
- },
186520
- fontScheme: {
186521
- majorFont: { latin: "Century Gothic" },
186522
- minorFont: { latin: "Century Gothic" }
186523
- }
186524
- };
186525
- var DIVIDEND_PRESET = {
186526
- id: "dividend",
186527
- name: "Dividend",
186528
- colorScheme: {
186529
- dk1: "#000000",
186530
- lt1: "#FFFFFF",
186531
- dk2: "#3D3D3D",
186532
- lt2: "#E1E1E1",
186533
- accent1: "#4D1434",
186534
- accent2: "#903163",
186535
- accent3: "#B2324B",
186536
- accent4: "#D34817",
186537
- accent5: "#E8971C",
186538
- accent6: "#FDCB00",
186539
- hlink: "#A03068",
186540
- folHlink: "#C34882"
186541
- },
186542
- fontScheme: {
186543
- majorFont: { latin: "Gill Sans MT" },
186544
- minorFont: { latin: "Gill Sans MT" }
186545
- }
186546
- };
186547
- [
186548
- corePreset("office"),
186549
- corePreset("facet"),
186550
- corePreset("integral"),
186551
- corePreset("ion"),
186552
- corePreset("retrospect"),
186553
- corePreset("organic"),
186554
- WISP_PRESET,
186555
- BERLIN_PRESET,
186556
- SLICE_PRESET,
186557
- DIVIDEND_PRESET
186558
- ];
186559
- function createPresentationLoadResources(handler) {
186560
- const blobUrls = [];
186561
- let committed = false;
186562
- let released = false;
186563
- return {
186564
- blobUrls,
186565
- /** The live viewer now owns the handler and media URLs. */
186566
- commit() {
186567
- committed = true;
186568
- },
186569
- /** Call in finally, after pending asset reads have settled. */
186570
- releaseIfUncommitted() {
186571
- if (committed || released) {
186572
- return;
186573
- }
186574
- released = true;
186575
- handler.dispose();
186576
- for (const url of blobUrls) {
186577
- if (url.startsWith("blob:")) {
186578
- URL.revokeObjectURL(url);
186579
- }
186580
- }
186581
- }
186582
- };
186583
- }
186584
- function walkAndPatchElements(elements, patch) {
186585
- let mutated = false;
186586
- const next = elements.map((el) => {
186587
- let updated = patch(el);
186588
- if (updated.type === "group" && updated.children?.length) {
186589
- const newChildren = walkAndPatchElements(updated.children, patch);
186590
- if (newChildren !== updated.children) {
186591
- updated = { ...updated, children: newChildren };
186592
- }
186593
- }
186594
- if (updated !== el) {
186595
- mutated = true;
186596
- }
186597
- return updated;
186598
- });
186599
- return mutated ? next : elements;
186600
- }
186601
- function applyImagePathPatches(elements, resolvedMap, refs) {
186602
- const elementPatches = /* @__PURE__ */ new Map();
186603
- for (const ref of refs) {
186604
- const url = resolvedMap.get(ref.path);
186605
- if (!url) {
186606
- continue;
186607
- }
186608
- const existing = elementPatches.get(ref.element.id) ?? {};
186609
- existing[ref.field] = url;
186610
- elementPatches.set(ref.element.id, existing);
186611
- }
186612
- if (elementPatches.size === 0) {
186613
- return elements;
186614
- }
186615
- return walkAndPatchElements(elements, (el) => {
186616
- const patch = elementPatches.get(el.id);
186617
- return patch ? { ...el, ...patch } : el;
186618
- });
186619
- }
186620
- function isExternalUrl(path) {
186621
- return path.startsWith("http://") || path.startsWith("https://") || path.startsWith("data:") || path.startsWith("blob:");
186622
- }
186623
- function collectMediaElements(elements, collector) {
186624
- for (const element of elements) {
186625
- if (element.type === "media") {
186626
- collector.push(element);
186627
- continue;
186628
- }
186629
- if (element.type === "group" && element.children?.length) {
186630
- collectMediaElements(element.children, collector);
186631
- }
186632
- }
186633
- }
186634
- function collectImagePaths(slides) {
186635
- const paths = /* @__PURE__ */ new Set();
186636
- const refs = [];
186637
- const walkElements = (elements) => {
186638
- for (const el of elements) {
186639
- if (el.type === "picture" || el.type === "image") {
186640
- const pic = el;
186641
- if (pic.imagePath && !pic.imageData && !isExternalUrl(pic.imagePath)) {
186642
- paths.add(pic.imagePath);
186643
- refs.push({ element: el, field: "imageData", path: pic.imagePath });
186644
- }
186645
- if (pic.svgPath && !pic.svgData && !isExternalUrl(pic.svgPath)) {
186646
- paths.add(pic.svgPath);
186647
- refs.push({ element: el, field: "svgData", path: pic.svgPath });
186648
- }
186649
- }
186650
- if (el.type === "media") {
186651
- const media = el;
186652
- if (media.posterFramePath && !media.posterFrameData && !isExternalUrl(media.posterFramePath)) {
186653
- paths.add(media.posterFramePath);
186654
- refs.push({
186655
- element: el,
186656
- field: "posterFrameData",
186657
- path: media.posterFramePath
186658
- });
186659
- }
186660
- }
186661
- if (el.type === "model3d") {
186662
- const model = el;
186663
- if (model.modelPath && !model.modelData && !isExternalUrl(model.modelPath)) {
186664
- paths.add(model.modelPath);
186665
- refs.push({ element: el, field: "modelData", path: model.modelPath });
186666
- }
186667
- const posterNeedsResolution = model.posterImage ? !isExternalUrl(model.posterImage) : !model.imageData;
186668
- if (model.imagePath && posterNeedsResolution && !isExternalUrl(model.imagePath)) {
186669
- paths.add(model.imagePath);
186670
- refs.push({ element: el, field: "posterImage", path: model.imagePath });
186671
- }
186672
- }
186673
- if (el.type === "group" && el.children?.length) {
186674
- walkElements(el.children);
186675
- }
186676
- }
186677
- };
186678
- for (const slide of slides) {
186679
- walkElements(slide.elements);
186680
- }
186681
- return { paths, refs };
186682
- }
186683
- function collectTableCellImagePaths(slides) {
186684
- const paths = /* @__PURE__ */ new Set();
186685
- const refs = [];
186686
- const walkElements = (elements) => {
186687
- for (const el of elements) {
186688
- if (el.type === "table") {
186689
- const rows = el.tableData?.rows ?? [];
186690
- rows.forEach((row, rowIndex) => {
186691
- row.cells.forEach((cell, cellIndex) => {
186692
- const path = cell.style?.backgroundImageFillPath;
186693
- if (path && !cell.style?.backgroundImageFillData && !isExternalUrl(path)) {
186694
- paths.add(path);
186695
- refs.push({ element: el, rowIndex, cellIndex, path });
186696
- }
186697
- });
186698
- });
186699
- }
186700
- if (el.type === "group" && el.children?.length) {
186701
- walkElements(el.children);
186702
- }
186703
- }
186704
- };
186705
- for (const slide of slides) {
186706
- walkElements(slide.elements);
186707
- }
186708
- return { paths, refs };
186709
- }
186710
- function applyTableCellImagePatches(elements, resolvedMap, refs) {
186711
- const patchesByElementId = /* @__PURE__ */ new Map();
186712
- for (const ref of refs) {
186713
- const url = resolvedMap.get(ref.path);
186714
- if (!url) {
186715
- continue;
186716
- }
186717
- const list2 = patchesByElementId.get(ref.element.id) ?? [];
186718
- list2.push({ rowIndex: ref.rowIndex, cellIndex: ref.cellIndex, url });
186719
- patchesByElementId.set(ref.element.id, list2);
186720
- }
186721
- if (patchesByElementId.size === 0) {
186722
- return elements;
186723
- }
186724
- return walkAndPatchElements(elements, (el) => {
186725
- const cellPatches = patchesByElementId.get(el.id);
186726
- if (!cellPatches || el.type !== "table") {
186727
- return el;
186728
- }
186729
- const table2 = el;
186730
- const tableData = table2.tableData;
186731
- if (!tableData) {
186732
- return el;
186733
- }
186734
- const newRows = tableData.rows.map((row, rowIndex) => {
186735
- const rowPatches = cellPatches.filter((p) => p.rowIndex === rowIndex);
186736
- if (rowPatches.length === 0) {
186737
- return row;
186738
- }
186739
- const newCells = row.cells.map((cell, cellIndex) => {
186740
- const patch = rowPatches.find((p) => p.cellIndex === cellIndex);
186741
- if (!patch || !cell.style) {
186742
- return cell;
186743
- }
186744
- return {
186745
- ...cell,
186746
- style: { ...cell.style, backgroundImageFillData: patch.url }
186747
- };
186748
- });
186749
- return { ...row, cells: newCells };
186750
- });
186751
- return { ...table2, tableData: { ...tableData, rows: newRows } };
186752
- });
186753
- }
186754
- function buildInitialGuides(presentationGuides, firstSlideGuides) {
186755
- const guides = [];
186756
- if (presentationGuides) {
186757
- for (const g2 of presentationGuides) {
186758
- guides.push({
186759
- id: g2.id,
186760
- axis: g2.orientation === "horz" ? "h" : "v",
186761
- position: guideEmuToPx(g2.positionEmu)
186762
- });
186763
- }
186764
- }
186765
- if (firstSlideGuides) {
186766
- for (const g2 of firstSlideGuides) {
186767
- guides.push({
186768
- id: g2.id,
186769
- axis: g2.orientation === "horz" ? "h" : "v",
186770
- position: guideEmuToPx(g2.positionEmu)
186771
- });
186772
- }
186773
- }
186774
- return guides;
186775
- }
186776
- async function resolveMediaElementSource(mediaElement, handler) {
186777
- const mediaPath = mediaElement.mediaPath;
186778
- if (!mediaPath) {
186779
- return { mediaPath: void 0, url: void 0, isBlobUrl: false, missing: true };
186780
- }
186781
- if (isExternalUrl(mediaPath)) {
186782
- return { mediaPath, url: mediaPath, isBlobUrl: false, missing: false };
186783
- }
186784
- try {
186785
- const isAudioVideo = mediaElement.mediaType === "audio" || mediaElement.mediaType === "video";
186786
- if (isAudioVideo) {
186787
- const arrayBuffer = await handler.getMediaArrayBuffer(mediaPath);
186788
- if (!arrayBuffer) {
186789
- return { mediaPath, url: void 0, isBlobUrl: false, missing: true };
186790
- }
186791
- const mimeType = mediaElement.mediaMimeType || "application/octet-stream";
186792
- const blobUrl = URL.createObjectURL(new Blob([arrayBuffer], { type: mimeType }));
186793
- return { mediaPath, url: blobUrl, isBlobUrl: true, missing: false };
186794
- }
186795
- const dataUrl = await handler.getImageData(mediaPath);
186796
- if (!dataUrl) {
186797
- return { mediaPath, url: void 0, isBlobUrl: false, missing: true };
186798
- }
186799
- return { mediaPath, url: dataUrl, isBlobUrl: false, missing: false };
186800
- } catch {
186801
- return { mediaPath, url: void 0, isBlobUrl: false, missing: true };
186802
- }
186803
- }
186804
- var TABLE_STYLE_FILL_KEYS = [
186805
- "wholeTblFill",
186806
- "band1HFill",
186807
- "band2HFill",
186808
- "band1VFill",
186809
- "band2VFill",
186810
- "lastColFill",
186811
- "firstColFill",
186812
- "lastRowFill",
186813
- "seCellFill",
186814
- "swCellFill",
186815
- "firstRowFill",
186816
- "neCellFill",
186817
- "nwCellFill"
186818
- ];
186819
- function isExternalUrl2(path) {
186820
- return path.startsWith("http://") || path.startsWith("https://") || path.startsWith("data:") || path.startsWith("blob:");
186821
- }
186822
- function collectTableStyleImagePaths(tableStyleMap) {
186823
- const paths = /* @__PURE__ */ new Set();
186824
- const refs = [];
186825
- if (!tableStyleMap) {
186826
- return { paths, refs };
186827
- }
186828
- for (const [styleId, entry5] of Object.entries(tableStyleMap)) {
186829
- for (const fillKey of TABLE_STYLE_FILL_KEYS) {
186830
- const fill = entry5[fillKey];
186831
- const path = fill?.image?.path;
186832
- if (path && !fill?.image?.data && !isExternalUrl2(path)) {
186833
- paths.add(path);
186834
- refs.push({ styleId, fillKey, path });
186835
- }
186836
- }
186837
- }
186838
- return { paths, refs };
186839
- }
186840
- function applyTableStyleImagePatches(tableStyleMap, resolvedMap, refs) {
186841
- const patchesByStyleId = /* @__PURE__ */ new Map();
186842
- for (const ref of refs) {
186843
- const url = resolvedMap.get(ref.path);
186844
- if (!url) {
186845
- continue;
186846
- }
186847
- const list2 = patchesByStyleId.get(ref.styleId) ?? [];
186848
- list2.push({ fillKey: ref.fillKey, url });
186849
- patchesByStyleId.set(ref.styleId, list2);
186850
- }
186851
- if (patchesByStyleId.size === 0) {
186852
- return tableStyleMap;
186853
- }
186854
- const next = { ...tableStyleMap };
186855
- for (const [styleId, patches] of patchesByStyleId) {
186856
- const entry5 = next[styleId];
186857
- if (!entry5) {
186858
- continue;
186859
- }
186860
- const patchedEntry = { ...entry5 };
186861
- for (const { fillKey, url } of patches) {
186862
- const fill = patchedEntry[fillKey];
186863
- if (!fill?.image) {
186864
- continue;
186865
- }
186866
- patchedEntry[fillKey] = { ...fill, image: { ...fill.image, data: url } };
186867
- }
186868
- next[styleId] = patchedEntry;
186869
- }
186870
- return next;
186871
- }
186872
- function collectTextFillBlipPaths(slides) {
186873
- const paths = /* @__PURE__ */ new Set();
186874
- const refs = [];
186875
- const walkElements = (elements) => {
186876
- for (const el of elements) {
186877
- if (hasTextProperties(el) && el.textSegments) {
186878
- el.textSegments.forEach((segment, segmentIndex) => {
186879
- const path = segment.style?.textFillBlipUrl;
186880
- if (path && !isExternalUrl(path)) {
186881
- paths.add(path);
186882
- refs.push({ element: el, segmentIndex, path });
186883
- }
186884
- });
186885
- }
186886
- if (el.type === "group" && el.children?.length) {
186887
- walkElements(el.children);
186888
- }
186889
- }
186890
- };
186891
- for (const slide of slides) {
186892
- walkElements(slide.elements);
186893
- }
186894
- return { paths, refs };
186895
- }
186896
- function applyTextFillBlipPatches(elements, resolvedMap, refs) {
186897
- const patchesByElementId = /* @__PURE__ */ new Map();
186898
- for (const ref of refs) {
186899
- const url = resolvedMap.get(ref.path);
186900
- if (!url) {
186901
- continue;
186902
- }
186903
- const list2 = patchesByElementId.get(ref.element.id) ?? [];
186904
- list2.push({ segmentIndex: ref.segmentIndex, url });
186905
- patchesByElementId.set(ref.element.id, list2);
186906
- }
186907
- if (patchesByElementId.size === 0) {
186908
- return elements;
186909
- }
186910
- return walkAndPatchElements(elements, (el) => {
186911
- const segmentPatches = patchesByElementId.get(el.id);
186912
- if (!segmentPatches || !hasTextProperties(el) || !el.textSegments) {
186913
- return el;
186914
- }
186915
- const newSegments = el.textSegments.map((segment, segmentIndex) => {
186916
- const patch = segmentPatches.find((p) => p.segmentIndex === segmentIndex);
186917
- if (!patch || !segment.style) {
186918
- return segment;
186919
- }
186920
- return { ...segment, style: { ...segment.style, textFillBlipUrl: patch.url } };
186921
- });
186922
- return { ...el, textSegments: newSegments };
186923
- });
186924
- }
186925
- async function resolveTableCellImageUrls(slides, getImageData) {
186926
- const { paths, refs } = collectTableCellImagePaths(slides);
186927
- if (paths.size === 0) {
186928
- return slides;
186929
- }
186930
- const resolvedMap = /* @__PURE__ */ new Map();
186931
- await Promise.all(
186932
- Array.from(paths).map(async (path) => {
186933
- try {
186934
- const url = await getImageData(path);
186935
- if (url) {
186936
- resolvedMap.set(path, url);
186937
- }
186938
- } catch {
186939
- }
186940
- })
186941
- );
186942
- if (resolvedMap.size === 0) {
186943
- return slides;
186944
- }
186945
- return slides.map((slide) => {
186946
- const newElements = applyTableCellImagePatches(slide.elements, resolvedMap, refs);
186947
- return newElements === slide.elements ? slide : { ...slide, elements: newElements };
186948
- });
186949
- }
186950
- async function resolveTableStyleImageUrls(tableStyleMap, getImageData) {
186951
- const { paths, refs } = collectTableStyleImagePaths(tableStyleMap);
186952
- if (paths.size === 0 || !tableStyleMap) {
186953
- return tableStyleMap;
186954
- }
186955
- const resolvedMap = /* @__PURE__ */ new Map();
186956
- await Promise.all(
186957
- Array.from(paths).map(async (path) => {
186958
- try {
186959
- const url = await getImageData(path);
186960
- if (url) {
186961
- resolvedMap.set(path, url);
186962
- }
186963
- } catch {
186964
- }
186965
- })
186966
- );
186967
- if (resolvedMap.size === 0) {
186968
- return tableStyleMap;
186969
- }
186970
- return applyTableStyleImagePatches(tableStyleMap, resolvedMap, refs);
186971
- }
186972
- async function resolveTextFillBlipUrls(slides, getImageData) {
186973
- const { paths, refs } = collectTextFillBlipPaths(slides);
186974
- if (paths.size === 0) {
186975
- return slides;
186976
- }
186977
- const resolvedMap = /* @__PURE__ */ new Map();
186978
- await Promise.all(
186979
- Array.from(paths).map(async (path) => {
186980
- try {
186981
- const url = await getImageData(path);
186982
- if (url) {
186983
- resolvedMap.set(path, url);
186984
- }
186985
- } catch {
186986
- }
186987
- })
186988
- );
186989
- if (resolvedMap.size === 0) {
186990
- return slides;
186991
- }
186992
- return slides.map((slide) => {
186993
- const newElements = applyTextFillBlipPatches(slide.elements, resolvedMap, refs);
186994
- return newElements === slide.elements ? slide : { ...slide, elements: newElements };
186995
- });
186996
- }
186997
- init_constants2();
186998
186484
  function resolveLiveCustomGeometryPath(element) {
186999
186485
  const el = element;
187000
186486
  if (!el.pathData || !el.pathWidth || !el.pathHeight) {
@@ -196897,7 +196383,7 @@ function resolveAutoAdvanceDelayMs(slide, options) {
196897
196383
  }
196898
196384
  return advanceAfterMs;
196899
196385
  }
196900
- var PRESENTATION_INERT_CLICK_SELECTOR = 'a, button, input, select, textarea, video, audio, [data-pptx-action], [role="dialog"]';
196386
+ var PRESENTATION_INERT_CLICK_SELECTOR = 'a, button, input, select, textarea, video, audio, [data-pptx-action], [data-pptx-anim-trigger], [role="dialog"]';
196901
196387
  function isInertMedia(node) {
196902
196388
  return (node.tagName === "VIDEO" || node.tagName === "AUDIO") && !node.controls;
196903
196389
  }
@@ -200061,6 +199547,269 @@ function collectDiagramBuildInfo(timeline) {
200061
199547
  }
200062
199548
  return info;
200063
199549
  }
199550
+ var CLICK_EVENTS = /* @__PURE__ */ new Set(["onClick", "onNext"]);
199551
+ var TIMENODE_EVENTS = /* @__PURE__ */ new Set([
199552
+ "onBegin",
199553
+ "onEnd",
199554
+ "begin",
199555
+ "end",
199556
+ "onStopAudio"
199557
+ ]);
199558
+ function normalizeDelay(delay) {
199559
+ if (delay === void 0) {
199560
+ return { ms: 0, indefinite: false };
199561
+ }
199562
+ if (delay < 0) {
199563
+ return { ms: 0, indefinite: true };
199564
+ }
199565
+ return { ms: delay, indefinite: false };
199566
+ }
199567
+ function resolveEffectiveEndCondition(conditions) {
199568
+ if (!conditions || conditions.length === 0) {
199569
+ return void 0;
199570
+ }
199571
+ const result = {
199572
+ endsOnMouseOut: false,
199573
+ endsOnClick: false,
199574
+ indefinite: false
199575
+ };
199576
+ for (const cond of conditions) {
199577
+ const evt = cond.event;
199578
+ if (evt === "onMouseOut") {
199579
+ result.endsOnMouseOut = true;
199580
+ } else if (evt && CLICK_EVENTS.has(evt)) {
199581
+ result.endsOnClick = true;
199582
+ if (cond.targetShapeId) {
199583
+ result.clickTargetShapeId = cond.targetShapeId;
199584
+ }
199585
+ } else if (evt && TIMENODE_EVENTS.has(evt) && cond.targetTimeNodeId !== void 0) {
199586
+ result.endsWithTimeNodeId = cond.targetTimeNodeId;
199587
+ }
199588
+ const { ms, indefinite } = normalizeDelay(cond.delay);
199589
+ if (indefinite) {
199590
+ result.indefinite = true;
199591
+ } else if (ms > 0 && result.delayMs === void 0) {
199592
+ result.delayMs = ms;
199593
+ }
199594
+ }
199595
+ return result;
199596
+ }
199597
+ function resolveAnimationEnd(anim) {
199598
+ return resolveEffectiveEndCondition(anim.endConditions);
199599
+ }
199600
+ var HOVER_EVENTS = /* @__PURE__ */ new Set(["onMouseOver"]);
199601
+ function isInteractiveTrigger(trigger) {
199602
+ return trigger === "onClick" || trigger === "onShapeClick" || trigger === "onHover";
199603
+ }
199604
+ function classifyCondition(cond) {
199605
+ const evt = cond.event;
199606
+ if (evt && CLICK_EVENTS.has(evt)) {
199607
+ return "click";
199608
+ }
199609
+ if (evt && HOVER_EVENTS.has(evt)) {
199610
+ return "hover";
199611
+ }
199612
+ if (evt === "onMediaBookmark" && cond.bookmarkTarget) {
199613
+ return "bookmark";
199614
+ }
199615
+ if (evt && TIMENODE_EVENTS.has(evt)) {
199616
+ if (cond.targetTimeNodeId !== void 0) {
199617
+ return "timenode";
199618
+ }
199619
+ if (evt === "onStopAudio" && cond.targetShapeId !== void 0) {
199620
+ return "timenode";
199621
+ }
199622
+ }
199623
+ return "delay";
199624
+ }
199625
+ function resolveEffectiveStartCondition(conditions, fallbackTrigger) {
199626
+ const base = {
199627
+ trigger: fallbackTrigger,
199628
+ delayMs: 0,
199629
+ hasClickAlternative: false,
199630
+ hasHoverAlternative: false,
199631
+ indefinite: false,
199632
+ requiresInteraction: isInteractiveTrigger(fallbackTrigger)
199633
+ };
199634
+ if (!conditions || conditions.length === 0) {
199635
+ return base;
199636
+ }
199637
+ let timenode;
199638
+ let bookmarkCond;
199639
+ let delayCond;
199640
+ let clickCond;
199641
+ let hoverCond;
199642
+ for (const cond of conditions) {
199643
+ switch (classifyCondition(cond)) {
199644
+ case "timenode":
199645
+ if (!timenode) {
199646
+ timenode = cond;
199647
+ } else if (cond.targetTimeNodeId !== void 0) {
199648
+ if (timenode.targetTimeNodeId === void 0 || cond.targetTimeNodeId < timenode.targetTimeNodeId) {
199649
+ timenode = cond;
199650
+ }
199651
+ }
199652
+ break;
199653
+ case "bookmark":
199654
+ if (!bookmarkCond) {
199655
+ bookmarkCond = cond;
199656
+ }
199657
+ break;
199658
+ case "delay":
199659
+ if (!delayCond || (cond.delay ?? 0) < (delayCond.delay ?? 0)) {
199660
+ delayCond = cond;
199661
+ }
199662
+ break;
199663
+ case "click":
199664
+ if (!clickCond) {
199665
+ clickCond = cond;
199666
+ }
199667
+ break;
199668
+ case "hover":
199669
+ if (!hoverCond) {
199670
+ hoverCond = cond;
199671
+ }
199672
+ break;
199673
+ }
199674
+ }
199675
+ base.hasClickAlternative = clickCond !== void 0;
199676
+ base.hasHoverAlternative = hoverCond !== void 0;
199677
+ if (clickCond?.targetShapeId) {
199678
+ base.clickTargetShapeId = clickCond.targetShapeId;
199679
+ }
199680
+ if (timenode) {
199681
+ const { ms, indefinite } = normalizeDelay(timenode.delay);
199682
+ base.trigger = timenode.event === "onBegin" || timenode.event === "begin" ? "withPrevious" : "afterPrevious";
199683
+ base.delayMs = ms;
199684
+ base.indefinite = indefinite;
199685
+ base.dependsOnTimeNodeId = timenode.targetTimeNodeId;
199686
+ base.dependsOnShapeId = timenode.targetTimeNodeId === void 0 ? timenode.targetShapeId : void 0;
199687
+ base.dependsOnEvent = timenode.event;
199688
+ base.requiresInteraction = false;
199689
+ return base;
199690
+ }
199691
+ if (bookmarkCond?.bookmarkTarget) {
199692
+ base.trigger = "afterPrevious";
199693
+ base.delayMs = 0;
199694
+ base.dependsOnShapeId = bookmarkCond.bookmarkTarget.shapeId;
199695
+ base.dependsOnEvent = "onMediaBookmark";
199696
+ base.dependsOnBookmarkName = bookmarkCond.bookmarkTarget.bookmarkName;
199697
+ base.requiresInteraction = false;
199698
+ return base;
199699
+ }
199700
+ if (delayCond && (delayCond.delay ?? 0) !== 0) {
199701
+ const { ms, indefinite } = normalizeDelay(delayCond.delay);
199702
+ base.trigger = clickCond ? "onClick" : "afterDelay";
199703
+ base.delayMs = ms;
199704
+ base.indefinite = indefinite;
199705
+ base.requiresInteraction = indefinite;
199706
+ return base;
199707
+ }
199708
+ if (clickCond) {
199709
+ base.trigger = clickCond.targetShapeId ? "onShapeClick" : "onClick";
199710
+ base.requiresInteraction = true;
199711
+ return base;
199712
+ }
199713
+ if (hoverCond) {
199714
+ base.trigger = "onHover";
199715
+ base.requiresInteraction = true;
199716
+ return base;
199717
+ }
199718
+ if (delayCond) {
199719
+ base.trigger = fallbackTrigger;
199720
+ base.delayMs = 0;
199721
+ base.requiresInteraction = false;
199722
+ }
199723
+ return base;
199724
+ }
199725
+ function resolveAnimationStart(anim) {
199726
+ return resolveEffectiveStartCondition(anim.startConditions, anim.trigger ?? "onClick");
199727
+ }
199728
+ var BEZIER_SAMPLES = 8;
199729
+ function cubicAt(p0, c1, c2, p3, t) {
199730
+ const mt = 1 - t;
199731
+ return mt * mt * mt * p0 + 3 * mt * mt * t * c1 + 3 * mt * t * t * c2 + t * t * t * p3;
199732
+ }
199733
+ function allFinite(values) {
199734
+ return values.every((v) => Number.isFinite(v));
199735
+ }
199736
+ function parseMotionPathPoints(motionPath) {
199737
+ const tokens = motionPath.match(/[MLCZmlcz]|-?\d*\.?\d+(?:[eE][-+]?\d+)?/gu);
199738
+ if (!tokens) {
199739
+ return [];
199740
+ }
199741
+ const points4 = [];
199742
+ let curX = 0;
199743
+ let curY = 0;
199744
+ let startX = 0;
199745
+ let startY = 0;
199746
+ let i2 = 0;
199747
+ let cmd = "";
199748
+ const nextNum = () => Number(tokens[i2++]);
199749
+ const push2 = (x, y) => {
199750
+ points4.push({ x: x * 100, y: y * 100 });
199751
+ };
199752
+ while (i2 < tokens.length) {
199753
+ const tok = tokens[i2];
199754
+ if (/^[MLCZmlcz]$/u.test(tok)) {
199755
+ cmd = tok;
199756
+ i2++;
199757
+ if (cmd === "Z" || cmd === "z") {
199758
+ curX = startX;
199759
+ curY = startY;
199760
+ }
199761
+ continue;
199762
+ }
199763
+ const rel = cmd === cmd.toLowerCase();
199764
+ const upper = cmd.toUpperCase();
199765
+ if (upper === "M" || upper === "L") {
199766
+ let x = nextNum();
199767
+ let y = nextNum();
199768
+ if (!allFinite([x, y])) {
199769
+ break;
199770
+ }
199771
+ if (rel) {
199772
+ x += curX;
199773
+ y += curY;
199774
+ }
199775
+ curX = x;
199776
+ curY = y;
199777
+ if (upper === "M") {
199778
+ startX = x;
199779
+ startY = y;
199780
+ cmd = rel ? "l" : "L";
199781
+ }
199782
+ push2(x, y);
199783
+ } else if (upper === "C") {
199784
+ let c1x = nextNum();
199785
+ let c1y = nextNum();
199786
+ let c2x = nextNum();
199787
+ let c2y = nextNum();
199788
+ let ex = nextNum();
199789
+ let ey = nextNum();
199790
+ if (!allFinite([c1x, c1y, c2x, c2y, ex, ey])) {
199791
+ break;
199792
+ }
199793
+ if (rel) {
199794
+ c1x += curX;
199795
+ c1y += curY;
199796
+ c2x += curX;
199797
+ c2y += curY;
199798
+ ex += curX;
199799
+ ey += curY;
199800
+ }
199801
+ for (let s = 1; s <= BEZIER_SAMPLES; s++) {
199802
+ const t = s / BEZIER_SAMPLES;
199803
+ push2(cubicAt(curX, c1x, c2x, ex, t), cubicAt(curY, c1y, c2y, ey, t));
199804
+ }
199805
+ curX = ex;
199806
+ curY = ey;
199807
+ } else {
199808
+ i2++;
199809
+ }
199810
+ }
199811
+ return points4;
199812
+ }
200064
199813
  var BACKGROUND_ANIMATION_ID_SUFFIX = "::pptx-bg";
200065
199814
  function resolveAnimationTargetId(animation) {
200066
199815
  const targetId = (animation.target?.type === "shape" ? animation.target.subShapeId : void 0) ?? animation.targetId ?? "";
@@ -200069,6 +199818,42 @@ function resolveAnimationTargetId(animation) {
200069
199818
  }
200070
199819
  return targetId;
200071
199820
  }
199821
+ var DEFAULT_SLIDE_ASPECT = 16 / 9;
199822
+ function pacedFractions(points4, aspect = DEFAULT_SLIDE_ASPECT) {
199823
+ const lengths = [0];
199824
+ let total = 0;
199825
+ for (let i2 = 1; i2 < points4.length; i2++) {
199826
+ const dx = (points4[i2].x - points4[i2 - 1].x) * aspect;
199827
+ const dy = points4[i2].y - points4[i2 - 1].y;
199828
+ total += Math.hypot(dx, dy);
199829
+ lengths.push(total);
199830
+ }
199831
+ if (total <= 0) {
199832
+ return points4.map((_, i2) => points4.length > 1 ? i2 / (points4.length - 1) : 0);
199833
+ }
199834
+ return lengths.map((length) => length / total);
199835
+ }
199836
+ function pacedPointAt(points4, fractions, progress) {
199837
+ if (points4.length === 0) {
199838
+ return { x: 0, y: 0 };
199839
+ }
199840
+ if (points4.length === 1 || progress <= 0) {
199841
+ return points4[0];
199842
+ }
199843
+ if (progress >= 1) {
199844
+ return points4[points4.length - 1];
199845
+ }
199846
+ let i2 = 1;
199847
+ while (i2 < points4.length - 1 && fractions[i2] < progress) {
199848
+ i2++;
199849
+ }
199850
+ const span = fractions[i2] - fractions[i2 - 1];
199851
+ const ratio2 = span > 0 ? (progress - fractions[i2 - 1]) / span : 1;
199852
+ return {
199853
+ x: points4[i2 - 1].x + (points4[i2].x - points4[i2 - 1].x) * ratio2,
199854
+ y: points4[i2 - 1].y + (points4[i2].y - points4[i2 - 1].y) * ratio2
199855
+ };
199856
+ }
200072
199857
  var IDENT_RE = /^[#a-zA-Z_$][a-zA-Z0-9_]*/u;
200073
199858
  var NUMBER_RE = /^\d+(\.\d+)?|^\.\d+/u;
200074
199859
  function tokenize2(formula) {
@@ -200603,127 +200388,6 @@ function createAttributeTransformModel(anim, box) {
200603
200388
  }
200604
200389
  };
200605
200390
  }
200606
- var BEZIER_SAMPLES = 8;
200607
- function cubicAt(p0, c1, c2, p3, t) {
200608
- const mt = 1 - t;
200609
- return mt * mt * mt * p0 + 3 * mt * mt * t * c1 + 3 * mt * t * t * c2 + t * t * t * p3;
200610
- }
200611
- function allFinite(values) {
200612
- return values.every((v) => Number.isFinite(v));
200613
- }
200614
- function parseMotionPathPoints(motionPath) {
200615
- const tokens = motionPath.match(/[MLCZmlcz]|-?\d*\.?\d+(?:[eE][-+]?\d+)?/gu);
200616
- if (!tokens) {
200617
- return [];
200618
- }
200619
- const points4 = [];
200620
- let curX = 0;
200621
- let curY = 0;
200622
- let startX = 0;
200623
- let startY = 0;
200624
- let i2 = 0;
200625
- let cmd = "";
200626
- const nextNum = () => Number(tokens[i2++]);
200627
- const push2 = (x, y) => {
200628
- points4.push({ x: x * 100, y: y * 100 });
200629
- };
200630
- while (i2 < tokens.length) {
200631
- const tok = tokens[i2];
200632
- if (/^[MLCZmlcz]$/u.test(tok)) {
200633
- cmd = tok;
200634
- i2++;
200635
- if (cmd === "Z" || cmd === "z") {
200636
- curX = startX;
200637
- curY = startY;
200638
- }
200639
- continue;
200640
- }
200641
- const rel = cmd === cmd.toLowerCase();
200642
- const upper = cmd.toUpperCase();
200643
- if (upper === "M" || upper === "L") {
200644
- let x = nextNum();
200645
- let y = nextNum();
200646
- if (!allFinite([x, y])) {
200647
- break;
200648
- }
200649
- if (rel) {
200650
- x += curX;
200651
- y += curY;
200652
- }
200653
- curX = x;
200654
- curY = y;
200655
- if (upper === "M") {
200656
- startX = x;
200657
- startY = y;
200658
- cmd = rel ? "l" : "L";
200659
- }
200660
- push2(x, y);
200661
- } else if (upper === "C") {
200662
- let c1x = nextNum();
200663
- let c1y = nextNum();
200664
- let c2x = nextNum();
200665
- let c2y = nextNum();
200666
- let ex = nextNum();
200667
- let ey = nextNum();
200668
- if (!allFinite([c1x, c1y, c2x, c2y, ex, ey])) {
200669
- break;
200670
- }
200671
- if (rel) {
200672
- c1x += curX;
200673
- c1y += curY;
200674
- c2x += curX;
200675
- c2y += curY;
200676
- ex += curX;
200677
- ey += curY;
200678
- }
200679
- for (let s = 1; s <= BEZIER_SAMPLES; s++) {
200680
- const t = s / BEZIER_SAMPLES;
200681
- push2(cubicAt(curX, c1x, c2x, ex, t), cubicAt(curY, c1y, c2y, ey, t));
200682
- }
200683
- curX = ex;
200684
- curY = ey;
200685
- } else {
200686
- i2++;
200687
- }
200688
- }
200689
- return points4;
200690
- }
200691
- var DEFAULT_SLIDE_ASPECT = 16 / 9;
200692
- function pacedFractions(points4, aspect = DEFAULT_SLIDE_ASPECT) {
200693
- const lengths = [0];
200694
- let total = 0;
200695
- for (let i2 = 1; i2 < points4.length; i2++) {
200696
- const dx = (points4[i2].x - points4[i2 - 1].x) * aspect;
200697
- const dy = points4[i2].y - points4[i2 - 1].y;
200698
- total += Math.hypot(dx, dy);
200699
- lengths.push(total);
200700
- }
200701
- if (total <= 0) {
200702
- return points4.map((_, i2) => points4.length > 1 ? i2 / (points4.length - 1) : 0);
200703
- }
200704
- return lengths.map((length) => length / total);
200705
- }
200706
- function pacedPointAt(points4, fractions, progress) {
200707
- if (points4.length === 0) {
200708
- return { x: 0, y: 0 };
200709
- }
200710
- if (points4.length === 1 || progress <= 0) {
200711
- return points4[0];
200712
- }
200713
- if (progress >= 1) {
200714
- return points4[points4.length - 1];
200715
- }
200716
- let i2 = 1;
200717
- while (i2 < points4.length - 1 && fractions[i2] < progress) {
200718
- i2++;
200719
- }
200720
- const span = fractions[i2] - fractions[i2 - 1];
200721
- const ratio2 = span > 0 ? (progress - fractions[i2 - 1]) / span : 1;
200722
- return {
200723
- x: points4[i2 - 1].x + (points4[i2].x - points4[i2 - 1].x) * ratio2,
200724
- y: points4[i2 - 1].y + (points4[i2].y - points4[i2 - 1].y) * ratio2
200725
- };
200726
- }
200727
200391
  function slideOffset(percent4, axis, origin) {
200728
200392
  const fallback = axis === "w" ? "1280px" : "720px";
200729
200393
  const varName = origin === "parent" ? `--pptx-parent-${axis}` : `--pptx-slide-${axis}`;
@@ -200870,6 +200534,217 @@ function buildTransformKeyframes(anim, uid, prefixes, box) {
200870
200534
  ${lines.join("\n")}
200871
200535
  }` };
200872
200536
  }
200537
+ function buildChainedMotionKeyframes(anim, uid, prefixes, box) {
200538
+ const chain2 = anim.motionChain;
200539
+ if (!chain2 || chain2.length < 2) {
200540
+ return void 0;
200541
+ }
200542
+ const totalMs = anim.durationMs ?? chain2.reduce((sum, segment) => sum + segment.durationMs, 0);
200543
+ if (totalMs <= 0) {
200544
+ return void 0;
200545
+ }
200546
+ const keyframes = [];
200547
+ for (const segment of chain2) {
200548
+ const fractions = pacedFractions(segment.points, box?.slideAspect);
200549
+ const segStartPct = segment.startMs / totalMs * 100;
200550
+ const segSpanPct = segment.durationMs / totalMs * 100;
200551
+ for (let j = 0; j < segment.points.length; j++) {
200552
+ const fraction = fractions[j];
200553
+ const point2 = pacedPointAt(segment.points, fractions, fraction);
200554
+ const progress = Number((segStartPct + fraction * segSpanPct).toFixed(4));
200555
+ const transform6 = `transform: translate(${slideOffset(point2.x, "w", anim.motionOrigin)}, ${slideOffset(point2.y, "h", anim.motionOrigin)})`;
200556
+ const easing = j === 0 ? segment.easing : void 0;
200557
+ const previous = keyframes[keyframes.length - 1];
200558
+ if (previous && previous.progress === progress) {
200559
+ previous.transform = transform6;
200560
+ previous.easing = easing ?? previous.easing;
200561
+ continue;
200562
+ }
200563
+ keyframes.push({ progress, transform: transform6, easing });
200564
+ }
200565
+ }
200566
+ const hideUntilStart = anim.motionChainHideUntilStart === true;
200567
+ if (hideUntilStart && keyframes.length > 0) {
200568
+ keyframes.splice(1, 0, { ...keyframes[0], progress: 0.01 });
200569
+ }
200570
+ const lines = keyframes.map((keyframe, index) => {
200571
+ const easing = keyframe.easing ? `animation-timing-function: ${keyframe.easing}; ` : "";
200572
+ const opacity2 = hideUntilStart && index === 0 ? "opacity: 0; " : hideUntilStart && index === 1 ? "opacity: 1; " : "";
200573
+ return ` ${formatNumber(keyframe.progress, 2)}% { ${easing}${opacity2}${keyframe.transform}; }`;
200574
+ });
200575
+ const name = `${prefixes.transform}-${uid}${hideUntilStart ? "-visibility" : ""}`;
200576
+ return {
200577
+ keyframeName: name,
200578
+ css: `@keyframes ${name} {
200579
+ ${lines.join("\n")}
200580
+ }`
200581
+ };
200582
+ }
200583
+ function isChainedMotionAnimation(anim) {
200584
+ return anim.motionChain !== void 0;
200585
+ }
200586
+ function isChainedMotionSwallowed(anim) {
200587
+ return anim.motionChainSwallowed === true;
200588
+ }
200589
+ function hasChainBlockingExtras(anim) {
200590
+ return Boolean(
200591
+ anim.rotationBy !== void 0 || anim.rotationFrom !== void 0 || anim.rotationTo !== void 0 || anim.scaleByX !== void 0 || anim.scaleByY !== void 0 || anim.scaleFromX !== void 0 || anim.scaleFromY !== void 0 || anim.scaleToX !== void 0 || anim.scaleToY !== void 0 || anim.colorAnimation || anim.attributeAnimations?.length || anim.setAnimations?.length || anim.repeatCount !== void 0 || anim.repeatDurMs !== void 0 || anim.autoReverse || anim.graphicBuildProperties || anim.iterate || anim.speedPct !== void 0 || anim.afterAnimationAction || anim.startConditions?.some(
200592
+ (condition) => condition.targetTimeNodeId !== void 0 || condition.event !== void 0 && condition.event !== "onClick" && condition.event !== "onMouseOver"
200593
+ )
200594
+ );
200595
+ }
200596
+ function authoredStartMs(anim) {
200597
+ return (anim.parGroupDelayMs ?? 0) + Math.max(anim.delayMs ?? 0, anim.triggerDelayMs ?? 0);
200598
+ }
200599
+ function mergeChainedMotionPathAnims(anims) {
200600
+ const candidates = /* @__PURE__ */ new Map();
200601
+ let clickGroup = 0;
200602
+ const clickGroups = [];
200603
+ for (let index = 0; index < anims.length; index++) {
200604
+ const anim = anims[index];
200605
+ if (resolveAnimationStart(anim).trigger === "onClick") {
200606
+ clickGroup++;
200607
+ }
200608
+ clickGroups[index] = clickGroup;
200609
+ if (anim.presetClass !== "path" || !anim.motionPath || anim.parGroupIndex === void 0 || !Number.isFinite(anim.parGroupDelayMs) || !Number.isFinite(anim.durationMs) || (anim.durationMs ?? 0) <= 0) {
200610
+ continue;
200611
+ }
200612
+ if (hasChainBlockingExtras(anim)) {
200613
+ continue;
200614
+ }
200615
+ const targetId = resolveAnimationTargetId(anim);
200616
+ if (!targetId) {
200617
+ continue;
200618
+ }
200619
+ const startMs = authoredStartMs(anim);
200620
+ const candidateKey = JSON.stringify([
200621
+ clickGroup,
200622
+ anim.triggerShapeId,
200623
+ targetId,
200624
+ anim.motionOrigin
200625
+ ]);
200626
+ const run = candidates.get(candidateKey) ?? [];
200627
+ run.push({ index, anim, startMs, endMs: startMs + (anim.durationMs ?? 0) });
200628
+ candidates.set(candidateKey, run);
200629
+ }
200630
+ const swallowedIndices = /* @__PURE__ */ new Set();
200631
+ const replacements = /* @__PURE__ */ new Map();
200632
+ for (const [, run] of candidates) {
200633
+ if (run.length < 2) {
200634
+ continue;
200635
+ }
200636
+ const ordered4 = [...run].sort((left, right) => left.startMs - right.startMs);
200637
+ if (ordered4.slice(1).some((member) => member.anim.trigger === "onClick")) {
200638
+ continue;
200639
+ }
200640
+ if (ordered4.some((member, i2) => i2 > 0 && member.startMs < ordered4[i2 - 1].endMs)) {
200641
+ continue;
200642
+ }
200643
+ const segments = [];
200644
+ const points4 = [];
200645
+ const windowStartMs = ordered4[0].startMs;
200646
+ let windowEndMs = ordered4[0].endMs;
200647
+ let viable = true;
200648
+ for (const member of ordered4) {
200649
+ const segmentPoints = parseMotionPathPoints(member.anim.motionPath ?? "");
200650
+ if (segmentPoints.length < 2) {
200651
+ viable = false;
200652
+ break;
200653
+ }
200654
+ points4.push(...segmentPoints);
200655
+ segments.push({
200656
+ points: segmentPoints,
200657
+ startMs: member.startMs - windowStartMs,
200658
+ durationMs: member.anim.durationMs ?? 0,
200659
+ easing: cssEasingForAccelDecel(member.anim.accel, member.anim.decel)
200660
+ });
200661
+ windowEndMs = Math.max(windowEndMs, member.endMs);
200662
+ }
200663
+ if (!viable) {
200664
+ continue;
200665
+ }
200666
+ const head = ordered4[0];
200667
+ const windowStartMsAbs = windowStartMs;
200668
+ const hasPreChainExit = anims.some(
200669
+ (other, index) => index < head.index && clickGroups[index] === clickGroups[head.index] && other !== head.anim && other.presetClass === "exit" && resolveAnimationTargetId(other) === resolveAnimationTargetId(head.anim) && authoredStartMs(other) + (other.durationMs ?? 0) <= windowStartMsAbs
200670
+ );
200671
+ const synthetic = {
200672
+ ...head.anim,
200673
+ motionPath: pointsToPathString(points4),
200674
+ // The window includes any authored gaps between segments.
200675
+ durationMs: Math.max(1, windowEndMs - windowStartMs),
200676
+ motionChain: segments,
200677
+ motionChainHideUntilStart: hasPreChainExit
200678
+ };
200679
+ replacements.set(head.index, synthetic);
200680
+ for (const member of ordered4.slice(1)) {
200681
+ swallowedIndices.add(member.index);
200682
+ }
200683
+ }
200684
+ if (replacements.size === 0) {
200685
+ return [...anims];
200686
+ }
200687
+ return anims.map((anim, index) => {
200688
+ if (swallowedIndices.has(index)) {
200689
+ return { ...anim, motionChainSwallowed: true };
200690
+ }
200691
+ return replacements.get(index) ?? anim;
200692
+ });
200693
+ }
200694
+ function pointsToPathString(points4) {
200695
+ return points4.map((point2, index) => `${index === 0 ? "M" : "L"} ${point2.x / 100} ${point2.y / 100} `).join("");
200696
+ }
200697
+ function cssKeyframeName(effect) {
200698
+ return `pptx-${effect}`;
200699
+ }
200700
+ function defaultDuration(presetClass) {
200701
+ switch (presetClass) {
200702
+ case "entr":
200703
+ return 500;
200704
+ case "exit":
200705
+ return 500;
200706
+ case "emph":
200707
+ return 800;
200708
+ case "path":
200709
+ return 1e3;
200710
+ default:
200711
+ return 500;
200712
+ }
200713
+ }
200714
+ function fillModeForClass(presetClass) {
200715
+ switch (presetClass) {
200716
+ case "entr":
200717
+ return "both";
200718
+ case "exit":
200719
+ return "forwards";
200720
+ case "emph":
200721
+ return "both";
200722
+ default:
200723
+ return "both";
200724
+ }
200725
+ }
200726
+ function finalizeClickGroup(steps, options) {
200727
+ let maxEnd = 0;
200728
+ for (const step of steps) {
200729
+ const end = step.delayMs + step.durationMs;
200730
+ if (end > maxEnd) {
200731
+ maxEnd = end;
200732
+ }
200733
+ }
200734
+ const group2 = { steps, totalDurationMs: maxEnd };
200735
+ for (const step of steps) {
200736
+ if (group2.seqConcurrent === void 0 && step.seqConcurrent !== void 0) {
200737
+ group2.seqConcurrent = step.seqConcurrent;
200738
+ }
200739
+ if (group2.seqNextAction === void 0 && step.seqNextAction !== void 0) {
200740
+ group2.seqNextAction = step.seqNextAction;
200741
+ }
200742
+ if (group2.seqPrevAction === void 0 && step.seqPrevAction !== void 0) {
200743
+ group2.seqPrevAction = step.seqPrevAction;
200744
+ }
200745
+ }
200746
+ return group2;
200747
+ }
200873
200748
  function resolveEffect(anim, pixelateMosaic) {
200874
200749
  const cls = anim.presetClass;
200875
200750
  const id = anim.presetId;
@@ -200939,6 +200814,15 @@ function boxForAnimation(anim, renderContext) {
200939
200814
  return targetId ? renderContext.getElementBox(targetId) : void 0;
200940
200815
  }
200941
200816
  function buildDynamicKeyframe(anim, uid, renderContext) {
200817
+ const chained = isChainedMotionAnimation(anim) ? buildChainedMotionKeyframes(
200818
+ anim,
200819
+ uid,
200820
+ TIMELINE_TRANSFORM_PREFIXES,
200821
+ boxForAnimation(anim, renderContext)
200822
+ ) : void 0;
200823
+ if (chained) {
200824
+ return chained;
200825
+ }
200942
200826
  const transform6 = buildTransformKeyframes(
200943
200827
  anim,
200944
200828
  uid,
@@ -200969,57 +200853,6 @@ function buildDynamicKeyframe(anim, uid, renderContext) {
200969
200853
  }
200970
200854
  return void 0;
200971
200855
  }
200972
- function cssKeyframeName(effect) {
200973
- return `pptx-${effect}`;
200974
- }
200975
- function defaultDuration(presetClass) {
200976
- switch (presetClass) {
200977
- case "entr":
200978
- return 500;
200979
- case "exit":
200980
- return 500;
200981
- case "emph":
200982
- return 800;
200983
- case "path":
200984
- return 1e3;
200985
- default:
200986
- return 500;
200987
- }
200988
- }
200989
- function fillModeForClass(presetClass) {
200990
- switch (presetClass) {
200991
- case "entr":
200992
- return "both";
200993
- case "exit":
200994
- return "forwards";
200995
- case "emph":
200996
- return "both";
200997
- default:
200998
- return "both";
200999
- }
201000
- }
201001
- function finalizeClickGroup(steps, options) {
201002
- let maxEnd = 0;
201003
- for (const step of steps) {
201004
- const end = step.delayMs + step.durationMs;
201005
- if (end > maxEnd) {
201006
- maxEnd = end;
201007
- }
201008
- }
201009
- const group2 = { steps, totalDurationMs: maxEnd };
201010
- for (const step of steps) {
201011
- if (group2.seqConcurrent === void 0 && step.seqConcurrent !== void 0) {
201012
- group2.seqConcurrent = step.seqConcurrent;
201013
- }
201014
- if (group2.seqNextAction === void 0 && step.seqNextAction !== void 0) {
201015
- group2.seqNextAction = step.seqNextAction;
201016
- }
201017
- if (group2.seqPrevAction === void 0 && step.seqPrevAction !== void 0) {
201018
- group2.seqPrevAction = step.seqPrevAction;
201019
- }
201020
- }
201021
- return group2;
201022
- }
201023
200856
  function clamp015(value) {
201024
200857
  return Math.max(0, Math.min(1, value));
201025
200858
  }
@@ -201156,184 +200989,6 @@ function resolveEffectTiming(anim, baseDurationMs) {
201156
200989
  holdEndState: shouldHoldEndState(anim)
201157
200990
  };
201158
200991
  }
201159
- var CLICK_EVENTS = /* @__PURE__ */ new Set(["onClick", "onNext"]);
201160
- var TIMENODE_EVENTS = /* @__PURE__ */ new Set([
201161
- "onBegin",
201162
- "onEnd",
201163
- "begin",
201164
- "end",
201165
- "onStopAudio"
201166
- ]);
201167
- function normalizeDelay(delay) {
201168
- if (delay === void 0) {
201169
- return { ms: 0, indefinite: false };
201170
- }
201171
- if (delay < 0) {
201172
- return { ms: 0, indefinite: true };
201173
- }
201174
- return { ms: delay, indefinite: false };
201175
- }
201176
- function resolveEffectiveEndCondition(conditions) {
201177
- if (!conditions || conditions.length === 0) {
201178
- return void 0;
201179
- }
201180
- const result = {
201181
- endsOnMouseOut: false,
201182
- endsOnClick: false,
201183
- indefinite: false
201184
- };
201185
- for (const cond of conditions) {
201186
- const evt = cond.event;
201187
- if (evt === "onMouseOut") {
201188
- result.endsOnMouseOut = true;
201189
- } else if (evt && CLICK_EVENTS.has(evt)) {
201190
- result.endsOnClick = true;
201191
- if (cond.targetShapeId) {
201192
- result.clickTargetShapeId = cond.targetShapeId;
201193
- }
201194
- } else if (evt && TIMENODE_EVENTS.has(evt) && cond.targetTimeNodeId !== void 0) {
201195
- result.endsWithTimeNodeId = cond.targetTimeNodeId;
201196
- }
201197
- const { ms, indefinite } = normalizeDelay(cond.delay);
201198
- if (indefinite) {
201199
- result.indefinite = true;
201200
- } else if (ms > 0 && result.delayMs === void 0) {
201201
- result.delayMs = ms;
201202
- }
201203
- }
201204
- return result;
201205
- }
201206
- function resolveAnimationEnd(anim) {
201207
- return resolveEffectiveEndCondition(anim.endConditions);
201208
- }
201209
- var HOVER_EVENTS = /* @__PURE__ */ new Set(["onMouseOver"]);
201210
- function isInteractiveTrigger(trigger) {
201211
- return trigger === "onClick" || trigger === "onShapeClick" || trigger === "onHover";
201212
- }
201213
- function classifyCondition(cond) {
201214
- const evt = cond.event;
201215
- if (evt && CLICK_EVENTS.has(evt)) {
201216
- return "click";
201217
- }
201218
- if (evt && HOVER_EVENTS.has(evt)) {
201219
- return "hover";
201220
- }
201221
- if (evt === "onMediaBookmark" && cond.bookmarkTarget) {
201222
- return "bookmark";
201223
- }
201224
- if (evt && TIMENODE_EVENTS.has(evt)) {
201225
- if (cond.targetTimeNodeId !== void 0) {
201226
- return "timenode";
201227
- }
201228
- if (evt === "onStopAudio" && cond.targetShapeId !== void 0) {
201229
- return "timenode";
201230
- }
201231
- }
201232
- return "delay";
201233
- }
201234
- function resolveEffectiveStartCondition(conditions, fallbackTrigger) {
201235
- const base = {
201236
- trigger: fallbackTrigger,
201237
- delayMs: 0,
201238
- hasClickAlternative: false,
201239
- hasHoverAlternative: false,
201240
- indefinite: false,
201241
- requiresInteraction: isInteractiveTrigger(fallbackTrigger)
201242
- };
201243
- if (!conditions || conditions.length === 0) {
201244
- return base;
201245
- }
201246
- let timenode;
201247
- let bookmarkCond;
201248
- let delayCond;
201249
- let clickCond;
201250
- let hoverCond;
201251
- for (const cond of conditions) {
201252
- switch (classifyCondition(cond)) {
201253
- case "timenode":
201254
- if (!timenode) {
201255
- timenode = cond;
201256
- } else if (cond.targetTimeNodeId !== void 0) {
201257
- if (timenode.targetTimeNodeId === void 0 || cond.targetTimeNodeId < timenode.targetTimeNodeId) {
201258
- timenode = cond;
201259
- }
201260
- }
201261
- break;
201262
- case "bookmark":
201263
- if (!bookmarkCond) {
201264
- bookmarkCond = cond;
201265
- }
201266
- break;
201267
- case "delay":
201268
- if (!delayCond || (cond.delay ?? 0) < (delayCond.delay ?? 0)) {
201269
- delayCond = cond;
201270
- }
201271
- break;
201272
- case "click":
201273
- if (!clickCond) {
201274
- clickCond = cond;
201275
- }
201276
- break;
201277
- case "hover":
201278
- if (!hoverCond) {
201279
- hoverCond = cond;
201280
- }
201281
- break;
201282
- }
201283
- }
201284
- base.hasClickAlternative = clickCond !== void 0;
201285
- base.hasHoverAlternative = hoverCond !== void 0;
201286
- if (clickCond?.targetShapeId) {
201287
- base.clickTargetShapeId = clickCond.targetShapeId;
201288
- }
201289
- if (timenode) {
201290
- const { ms, indefinite } = normalizeDelay(timenode.delay);
201291
- base.trigger = timenode.event === "onBegin" || timenode.event === "begin" ? "withPrevious" : "afterPrevious";
201292
- base.delayMs = ms;
201293
- base.indefinite = indefinite;
201294
- base.dependsOnTimeNodeId = timenode.targetTimeNodeId;
201295
- base.dependsOnShapeId = timenode.targetTimeNodeId === void 0 ? timenode.targetShapeId : void 0;
201296
- base.dependsOnEvent = timenode.event;
201297
- base.requiresInteraction = false;
201298
- return base;
201299
- }
201300
- if (bookmarkCond?.bookmarkTarget) {
201301
- base.trigger = "afterPrevious";
201302
- base.delayMs = 0;
201303
- base.dependsOnShapeId = bookmarkCond.bookmarkTarget.shapeId;
201304
- base.dependsOnEvent = "onMediaBookmark";
201305
- base.dependsOnBookmarkName = bookmarkCond.bookmarkTarget.bookmarkName;
201306
- base.requiresInteraction = false;
201307
- return base;
201308
- }
201309
- if (delayCond && (delayCond.delay ?? 0) !== 0) {
201310
- const { ms, indefinite } = normalizeDelay(delayCond.delay);
201311
- base.trigger = clickCond ? "onClick" : "afterDelay";
201312
- base.delayMs = ms;
201313
- base.indefinite = indefinite;
201314
- base.requiresInteraction = indefinite;
201315
- return base;
201316
- }
201317
- if (clickCond) {
201318
- base.trigger = clickCond.targetShapeId ? "onShapeClick" : "onClick";
201319
- base.requiresInteraction = true;
201320
- return base;
201321
- }
201322
- if (hoverCond) {
201323
- base.trigger = "onHover";
201324
- base.requiresInteraction = true;
201325
- return base;
201326
- }
201327
- if (delayCond) {
201328
- base.trigger = fallbackTrigger;
201329
- base.delayMs = 0;
201330
- base.requiresInteraction = false;
201331
- }
201332
- return base;
201333
- }
201334
- function resolveAnimationStart(anim) {
201335
- return resolveEffectiveStartCondition(anim.startConditions, anim.trigger ?? "onClick");
201336
- }
201337
200992
  function isMediaCommandAnimation(anim) {
201338
200993
  return typeof anim.commandString === "string" && anim.commandString.trim().length > 0;
201339
200994
  }
@@ -202327,6 +201982,49 @@ function composeParallelSteps(left, right) {
202327
201982
  colorTargets: colorTargets.length > 0 ? colorTargets : void 0
202328
201983
  };
202329
201984
  }
201985
+ var TRANSFORM_KEYFRAME_NAME = /^pptx-(?:tl-)?(?:motion|rotate(?:Abs)?|scale(?:Abs)?|transform)-/u;
201986
+ var COLOR_KEYFRAME_NAME = /^pptx-(?:tl-)?(?:color|tavclr)-/u;
201987
+ var FILTER_KEYFRAME_NAME = /^pptx-(?:tl-)?emph-/u;
201988
+ var animatedPropertyCache = /* @__PURE__ */ new Map();
201989
+ function keyframeAnimatedProperties(keyframeName2) {
201990
+ let props = animatedPropertyCache.get(keyframeName2);
201991
+ if (props) {
201992
+ return props;
201993
+ }
201994
+ props = /* @__PURE__ */ new Set();
201995
+ if (TRANSFORM_KEYFRAME_NAME.test(keyframeName2)) {
201996
+ props.add("transform");
201997
+ if (keyframeName2.endsWith("-visibility")) {
201998
+ props.add("opacity");
201999
+ }
202000
+ } else if (COLOR_KEYFRAME_NAME.test(keyframeName2)) {
202001
+ props.add("color");
202002
+ } else if (FILTER_KEYFRAME_NAME.test(keyframeName2)) {
202003
+ props.add("filter");
202004
+ } else {
202005
+ const css = getEffectKeyframes(keyframeName2.replace(/^pptx-/u, ""));
202006
+ if (css) {
202007
+ if (/(?:^|[^-])\btransform\s*:/u.test(css)) {
202008
+ props.add("transform");
202009
+ }
202010
+ if (/(?:^|[^-])\bopacity\s*:/u.test(css)) {
202011
+ props.add("opacity");
202012
+ }
202013
+ if (/(?:^|[^-])\bfilter\s*:/u.test(css)) {
202014
+ props.add("filter");
202015
+ }
202016
+ if (/(?:^|[^-])\b(?:color|fill|stroke)\s*:/u.test(css)) {
202017
+ props.add("color");
202018
+ }
202019
+ } else {
202020
+ props.add("unknown");
202021
+ }
202022
+ }
202023
+ if (!/^pptx-(?:tl-)?(?:motion|rotate|scale|transform|color|tavclr|emph)-/u.test(keyframeName2)) {
202024
+ animatedPropertyCache.set(keyframeName2, props);
202025
+ }
202026
+ return props;
202027
+ }
202330
202028
  function parseTmFilter(raw) {
202331
202029
  if (!raw) {
202332
202030
  return void 0;
@@ -203028,6 +202726,23 @@ function expandIterateAnimation(anim) {
203028
202726
  function processRegularAnimation(state, anim, renderContext, pixelateMosaic) {
203029
202727
  const expandedSteps = expandIterateAnimation(anim);
203030
202728
  for (const singleAnim of expandedSteps) {
202729
+ if (isChainedMotionSwallowed(singleAnim)) {
202730
+ if (singleAnim.soundPath || singleAnim.stopSound) {
202731
+ state.currentGroup.push({
202732
+ elementId: "",
202733
+ cssAnimation: "",
202734
+ keyframeName: "",
202735
+ trigger: singleAnim.trigger ?? "onClick",
202736
+ delayMs: (singleAnim.parGroupDelayMs ?? 0) + Math.max(singleAnim.delayMs ?? 0, singleAnim.triggerDelayMs ?? 0),
202737
+ durationMs: singleAnim.durationMs ?? 0,
202738
+ fillMode: "forwards",
202739
+ presetClass: "emph",
202740
+ soundPath: singleAnim.soundPath,
202741
+ stopSound: singleAnim.stopSound
202742
+ });
202743
+ }
202744
+ continue;
202745
+ }
203031
202746
  const resolved = resolveStepEffect(
203032
202747
  singleAnim,
203033
202748
  renderContext,
@@ -203138,6 +202853,9 @@ function countDynamicUids(interactiveAnims) {
203138
202853
  let count = 0;
203139
202854
  for (const [, anims] of interactiveAnims) {
203140
202855
  for (const anim of anims) {
202856
+ if (isChainedMotionSwallowed(anim)) {
202857
+ continue;
202858
+ }
203141
202859
  const effect = resolveEffect(anim);
203142
202860
  if (!effect) {
203143
202861
  count++;
@@ -203156,6 +202874,23 @@ function buildSequenceGroups(animsByKey, entranceIds, neededKeyframes, dynamicBl
203156
202874
  let subGroupIndex;
203157
202875
  let subGroupStartMs = 0;
203158
202876
  for (const anim of anims) {
202877
+ if (isChainedMotionSwallowed(anim)) {
202878
+ if (anim.soundPath || anim.stopSound) {
202879
+ seqGroup.push({
202880
+ elementId: "",
202881
+ cssAnimation: "",
202882
+ keyframeName: "",
202883
+ trigger: anim.trigger ?? "onShapeClick",
202884
+ delayMs: (anim.parGroupDelayMs ?? 0) + Math.max(anim.delayMs ?? 0, anim.triggerDelayMs ?? 0),
202885
+ durationMs: anim.durationMs ?? 0,
202886
+ fillMode: "forwards",
202887
+ presetClass: "emph",
202888
+ soundPath: anim.soundPath,
202889
+ stopSound: anim.stopSound
202890
+ });
202891
+ }
202892
+ continue;
202893
+ }
203159
202894
  const resolved = resolveStepEffect(anim, renderContext, dynamicUid, false, pixelateMosaic);
203160
202895
  dynamicUid = resolved.nextDynamicUid;
203161
202896
  if (resolved.skip) {
@@ -203346,7 +203081,12 @@ function buildTimeline(nativeAnimations, renderContext, pixelateMosaic) {
203346
203081
  regularAnims.push(anim);
203347
203082
  }
203348
203083
  }
203349
- const { clickGroups, entranceIds, neededKeyframes, dynamicBlocks, dynamicUid } = buildRegularClickGroups(regularAnims, renderContext, pixelateMosaic);
203084
+ const mergedRegularAnims = mergeChainedMotionPathAnims(regularAnims);
203085
+ for (const [shapeId, anims] of interactiveAnims) {
203086
+ interactiveAnims.set(shapeId, mergeChainedMotionPathAnims(anims));
203087
+ }
203088
+ const mergedHoverAnims = mergeChainedMotionPathAnims(hoverAnims);
203089
+ const { clickGroups, entranceIds, neededKeyframes, dynamicBlocks, dynamicUid } = buildRegularClickGroups(mergedRegularAnims, renderContext, pixelateMosaic);
203350
203090
  const interactiveSequences = buildSequenceGroups(
203351
203091
  interactiveAnims,
203352
203092
  entranceIds,
@@ -203357,7 +203097,7 @@ function buildTimeline(nativeAnimations, renderContext, pixelateMosaic) {
203357
203097
  pixelateMosaic
203358
203098
  );
203359
203099
  const { hoverSequences } = buildHoverSequences(
203360
- hoverAnims,
203100
+ mergedHoverAnims,
203361
203101
  entranceIds,
203362
203102
  neededKeyframes,
203363
203103
  dynamicBlocks,
@@ -208777,17 +208517,17 @@ function attachRotateHandlePlacement(button, options = {}) {
208777
208517
  for (const node of ancestors) {
208778
208518
  mutations.observe(node, { attributes: true, attributeFilter: ["style", "class", "hidden"] });
208779
208519
  }
208780
- const controls = options.getObstacleRoot ? options.getObstacleRoot() : button.parentElement;
208781
- if (controls) {
208782
- mutations.observe(controls, {
208520
+ const controls2 = options.getObstacleRoot ? options.getObstacleRoot() : button.parentElement;
208521
+ if (controls2) {
208522
+ mutations.observe(controls2, {
208783
208523
  attributes: true,
208784
208524
  attributeFilter: ["style", "class", "hidden"],
208785
208525
  childList: true
208786
208526
  });
208787
- observed.add(controls);
208527
+ observed.add(controls2);
208788
208528
  for (const control of [
208789
208529
  button,
208790
- ...controls.querySelectorAll("[data-pptx-handle-kind]")
208530
+ ...controls2.querySelectorAll("[data-pptx-handle-kind]")
208791
208531
  ]) {
208792
208532
  observeControl(control);
208793
208533
  }
@@ -211492,6 +211232,9 @@ var translationsEn = {
211492
211232
  // Live captions
211493
211233
  "pptx.subtitles.listening": "Listening\u2026",
211494
211234
  "pptx.subtitles.notSupported": "Subtitles are not supported in this browser.",
211235
+ "pptx.subtitles.spokenLanguage": "Spoken language",
211236
+ "pptx.subtitles.browserLanguage": "Browser language",
211237
+ "pptx.subtitles.settingsDescription": "Choose the language you will speak. Captions use browser speech recognition; translation is not available.",
211495
211238
  // Table (additions)
211496
211239
  "pptx.table.background": "Background",
211497
211240
  "pptx.table.bandColCycle": "Column band size",
@@ -229209,6 +228952,89 @@ function slideShowOptionChange(id, checked) {
229209
228952
  return null;
229210
228953
  }
229211
228954
  }
228955
+ var SLIDE_SHOW_COMMAND_GROUPS = [
228956
+ {
228957
+ id: "slideShow.startSlideShow",
228958
+ labelKey: "pptx.slideShow.start",
228959
+ commands: [
228960
+ {
228961
+ id: "slideShow.startSlideShow.fromBeginning",
228962
+ labelKey: "pptx.slideShow.fromBeginning",
228963
+ icon: "play-start",
228964
+ tooltipKey: "pptx.slideShow.fromBeginningTooltip"
228965
+ },
228966
+ {
228967
+ id: "slideShow.startSlideShow.fromCurrent",
228968
+ labelKey: "pptx.slideShow.fromCurrent",
228969
+ icon: "play",
228970
+ tooltipKey: "pptx.slideShow.fromCurrentTooltip"
228971
+ }
228972
+ ]
228973
+ },
228974
+ {
228975
+ id: "slideShow.present",
228976
+ labelKey: "pptx.slideShow.present",
228977
+ commands: [
228978
+ {
228979
+ id: "slideShow.present.presenterView",
228980
+ labelKey: "pptx.slideShow.presenterView",
228981
+ icon: "presentation",
228982
+ tooltipKey: "pptx.slideShow.presenterViewTooltip"
228983
+ },
228984
+ {
228985
+ id: "slideShow.startSlideShow.customShow",
228986
+ labelKey: "pptx.slideShow.customShow",
228987
+ icon: "list",
228988
+ tooltipKey: "pptx.customShows.customShowTooltip"
228989
+ },
228990
+ {
228991
+ id: "slideShow.present.broadcast",
228992
+ labelKey: "pptx.slideShow.broadcast",
228993
+ icon: "broadcast",
228994
+ tooltipKey: "pptx.slideShow.broadcastTooltip"
228995
+ }
228996
+ ]
228997
+ },
228998
+ {
228999
+ id: "slideShow.setUp",
229000
+ labelKey: "pptx.slideShow.setUpGroup",
229001
+ commands: [
229002
+ {
229003
+ id: "slideShow.setUp.rehearseWithCoach",
229004
+ labelKey: "pptx.slideShow.rehearseCoach",
229005
+ icon: "video",
229006
+ unsupported: true
229007
+ },
229008
+ {
229009
+ id: "slideShow.setUp.setUpSlideShow",
229010
+ labelKey: "pptx.slideShow.setUp",
229011
+ icon: "settings",
229012
+ tooltipKey: "pptx.slideShow.setUpTooltip"
229013
+ },
229014
+ { id: "slideShow.setUp.hideSlide", labelKey: "pptx.slideShow.hideSlide", icon: "eye-off" },
229015
+ {
229016
+ id: "slideShow.setUp.rehearseTimings",
229017
+ labelKey: "pptx.slideShow.rehearseTimings",
229018
+ icon: "clock",
229019
+ tooltipKey: "pptx.slideShow.rehearseTimingsTooltip"
229020
+ },
229021
+ { id: "slideShow.setUp.record", labelKey: "pptx.titleBar.record", icon: "record" }
229022
+ ]
229023
+ }
229024
+ ];
229025
+ var HELP_RIBBON_COMMANDS = [
229026
+ { id: "help.help.options", labelKey: "pptx.settings.title", icon: "settings" },
229027
+ {
229028
+ id: "help.help.keyboardShortcuts",
229029
+ labelKey: "pptx.settings.keyboardShortcuts",
229030
+ icon: "keyboard"
229031
+ },
229032
+ {
229033
+ id: "help.help.accessibility",
229034
+ labelKey: "pptx.ribbon.accessibilityCheck",
229035
+ icon: "accessibility"
229036
+ }
229037
+ ];
229212
229038
  function resetSlideLayoutPath(slide) {
229213
229039
  const path = slide?.layoutPath;
229214
229040
  return typeof path === "string" && path !== "" ? path : void 0;
@@ -232440,20 +232266,20 @@ async function mountModel3D(container, modelUrl, options) {
232440
232266
  scene.add(light);
232441
232267
  }
232442
232268
  scene.add(rig.placeModel(model));
232443
- let controls = null;
232269
+ let controls2 = null;
232444
232270
  const OrbitCtrlCtor = await loadOrbitControlsCtor();
232445
232271
  const enableControls = (on) => {
232446
- if (on && !controls && OrbitCtrlCtor) {
232447
- controls = new OrbitCtrlCtor(camera, canvas);
232448
- controls.enablePan = false;
232449
- controls.enableZoom = true;
232450
- controls.enableRotate = true;
232451
- controls.minDistance = descriptor.authored ? rig.distance * 0.2 : 2;
232452
- controls.maxDistance = descriptor.authored ? rig.distance * 4 : 20;
232453
- controls.update();
232454
- } else if (!on && controls) {
232455
- controls.dispose();
232456
- controls = null;
232272
+ if (on && !controls2 && OrbitCtrlCtor) {
232273
+ controls2 = new OrbitCtrlCtor(camera, canvas);
232274
+ controls2.enablePan = false;
232275
+ controls2.enableZoom = true;
232276
+ controls2.enableRotate = true;
232277
+ controls2.minDistance = descriptor.authored ? rig.distance * 0.2 : 2;
232278
+ controls2.maxDistance = descriptor.authored ? rig.distance * 4 : 20;
232279
+ controls2.update();
232280
+ } else if (!on && controls2) {
232281
+ controls2.dispose();
232282
+ controls2 = null;
232457
232283
  }
232458
232284
  };
232459
232285
  enableControls(options.interactive ?? true);
@@ -232464,7 +232290,7 @@ async function mountModel3D(container, modelUrl, options) {
232464
232290
  return;
232465
232291
  }
232466
232292
  frame2 = requestAnimationFrame(renderLoop);
232467
- controls?.update();
232293
+ controls2?.update();
232468
232294
  renderer.render(scene, camera);
232469
232295
  };
232470
232296
  frame2 = requestAnimationFrame(renderLoop);
@@ -232501,7 +232327,7 @@ async function mountModel3D(container, modelUrl, options) {
232501
232327
  }
232502
232328
  disposed = true;
232503
232329
  cancelAnimationFrame(frame2);
232504
- controls?.dispose();
232330
+ controls2?.dispose();
232505
232331
  disposeModel();
232506
232332
  scene.clear();
232507
232333
  renderer.dispose();
@@ -237411,11 +237237,13 @@ function resolveElementAriaAttributes(element, options) {
237411
237237
  };
237412
237238
  }
237413
237239
  var PRESENTATION_STAGE_ATTRIBUTE = "data-pptx-presenting";
237240
+ var PRESENTATION_ANIM_TRIGGER_ATTRIBUTE = "data-pptx-anim-trigger";
237414
237241
  var PRESENTATION_HIT_TEST_CSS = `
237415
237242
  [${PRESENTATION_STAGE_ATTRIBUTE}] [data-element-id] {
237416
237243
  pointer-events: none;
237417
237244
  }
237418
237245
  [${PRESENTATION_STAGE_ATTRIBUTE}] [data-pptx-action],
237246
+ [${PRESENTATION_STAGE_ATTRIBUTE}] [${PRESENTATION_ANIM_TRIGGER_ATTRIBUTE}],
237419
237247
  [${PRESENTATION_STAGE_ATTRIBUTE}] [data-element-id] a[href],
237420
237248
  [${PRESENTATION_STAGE_ATTRIBUTE}] [data-element-id] video[controls],
237421
237249
  [${PRESENTATION_STAGE_ATTRIBUTE}] [data-element-id] audio[controls] {
@@ -237500,7 +237328,11 @@ function focusableElements(panel2) {
237500
237328
  }
237501
237329
  function activateModalFocus(panel2, options = {}) {
237502
237330
  const doc = panel2.ownerDocument;
237503
- const opener = doc.activeElement instanceof HTMLElement ? doc.activeElement : null;
237331
+ let activeElement = doc.activeElement;
237332
+ while (activeElement?.shadowRoot?.activeElement) {
237333
+ activeElement = activeElement.shadowRoot.activeElement;
237334
+ }
237335
+ const opener = activeElement instanceof HTMLElement ? activeElement : null;
237504
237336
  const restoreFocus = options.restoreFocus ?? true;
237505
237337
  function focusInitial() {
237506
237338
  const candidate = options.initialFocus ?? focusableElements(panel2)[0] ?? panel2;
@@ -241846,6 +241678,73 @@ function hiddenSlideCue(hidden, surface, slideIndex) {
241846
241678
  }
241847
241679
  return { hidden: true, labelId: hiddenSlideLabelId(surface, slideIndex), marker: "true" };
241848
241680
  }
241681
+ function mergeCaptionResults(resultIndex, results) {
241682
+ let finalText = "";
241683
+ let interimText = "";
241684
+ for (let index = resultIndex; index < results.length; index++) {
241685
+ const result = results[index];
241686
+ const fragment = result?.[0]?.transcript ?? "";
241687
+ if (result?.isFinal) {
241688
+ finalText += fragment;
241689
+ } else {
241690
+ interimText += fragment;
241691
+ }
241692
+ }
241693
+ return `${finalText} ${interimText}`.trim();
241694
+ }
241695
+ function getSpeechRecognitionCtor() {
241696
+ const source = globalThis;
241697
+ return source["SpeechRecognition"] ?? source["webkitSpeechRecognition"] ?? null;
241698
+ }
241699
+ var SUBTITLE_LANGUAGES = [
241700
+ "auto",
241701
+ "en-US",
241702
+ "en-GB",
241703
+ "fr-FR",
241704
+ "de-DE",
241705
+ "es-ES",
241706
+ "pt-BR",
241707
+ "it-IT",
241708
+ "ja-JP",
241709
+ "ko-KR",
241710
+ "zh-CN"
241711
+ ];
241712
+ function subtitleLanguageLabel(language) {
241713
+ try {
241714
+ return new Intl.DisplayNames(void 0, { type: "language" }).of(language) ?? language;
241715
+ } catch {
241716
+ return language;
241717
+ }
241718
+ }
241719
+ function normalizeSubtitleSettings(settings) {
241720
+ const spokenLanguage = settings?.spokenLanguage ?? "auto";
241721
+ return {
241722
+ spokenLanguage: SUBTITLE_LANGUAGES.includes(spokenLanguage) ? spokenLanguage : "auto"
241723
+ };
241724
+ }
241725
+ function subtitleSettingsFromOptions(options) {
241726
+ return normalizeSubtitleSettings({ spokenLanguage: options?.accessibility.subtitleLanguage });
241727
+ }
241728
+ function updateSubtitleSettings(store, settings) {
241729
+ store.setValue(
241730
+ "accessibility",
241731
+ "subtitleLanguage",
241732
+ normalizeSubtitleSettings(settings).spokenLanguage
241733
+ );
241734
+ }
241735
+ function subtitleRecognitionLanguage(settings, browserLanguage = "en-US") {
241736
+ return settings.spokenLanguage === "auto" ? browserLanguage || "en-US" : settings.spokenLanguage;
241737
+ }
241738
+ function subtitleSettingsLabels(t) {
241739
+ return {
241740
+ title: t("pptx.slideShow.subtitleSettings"),
241741
+ language: t("pptx.subtitles.spokenLanguage"),
241742
+ browserLanguage: t("pptx.subtitles.browserLanguage"),
241743
+ description: t("pptx.subtitles.settingsDescription"),
241744
+ apply: t("pptx.common.apply"),
241745
+ cancel: t("pptx.common.cancel")
241746
+ };
241747
+ }
241849
241748
  var VIEWER_PREFS_STORAGE_KEY = "pptx-viewer-prefs";
241850
241749
  function hasLocalStorage() {
241851
241750
  return typeof localStorage !== "undefined";
@@ -242210,6 +242109,7 @@ var DEFAULT_VIEWER_OPTIONS = {
242210
242109
  clearCacheOnClose: false
242211
242110
  },
242212
242111
  accessibility: {
242112
+ subtitleLanguage: "auto",
242213
242113
  showAccessibilityStatus: true,
242214
242114
  feedbackWithSound: false,
242215
242115
  soundScheme: "modern",
@@ -243849,7 +243749,7 @@ function resolveRibbonCustomization(ribbon3) {
243849
243749
  const actions = /* @__PURE__ */ new Set();
243850
243750
  const contextualTabs = /* @__PURE__ */ new Set();
243851
243751
  const groups = /* @__PURE__ */ new Set();
243852
- const controls = /* @__PURE__ */ new Set();
243752
+ const controls2 = /* @__PURE__ */ new Set();
243853
243753
  for (const tab of ribbon3?.hiddenTabs ?? []) {
243854
243754
  if (CONTEXTUAL_TAB_IDS.has(tab)) {
243855
243755
  contextualTabs.add(tab);
@@ -243864,19 +243764,19 @@ function resolveRibbonCustomization(ribbon3) {
243864
243764
  }
243865
243765
  for (const button of ribbon3?.hiddenButtons ?? []) {
243866
243766
  if (isRibbonControlId(button)) {
243867
- controls.add(button);
243767
+ controls2.add(button);
243868
243768
  } else {
243869
243769
  actions.add(button);
243870
243770
  }
243871
243771
  }
243872
243772
  for (const [action, control] of BUTTON_CONTROL_ALIASES) {
243873
243773
  if (actions.has(action)) {
243874
- controls.add(control);
243875
- } else if (controls.has(control)) {
243774
+ controls2.add(control);
243775
+ } else if (controls2.has(control)) {
243876
243776
  actions.add(action);
243877
243777
  }
243878
243778
  }
243879
- return { actions, contextualTabs, groups, controls };
243779
+ return { actions, contextualTabs, groups, controls: controls2 };
243880
243780
  }
243881
243781
  var DIALOG_ENTRY_POINTS = {
243882
243782
  options: { actions: [], pages: ["options"], cards: [] },
@@ -244079,13 +243979,13 @@ function customizeSection(tabId, section, resolved) {
244079
243979
  if (resolved.hiddenOptionsSections.has(`${tabId}.${section.id}`)) {
244080
243980
  return null;
244081
243981
  }
244082
- const controls = section.controls.filter((control) => isSettingVisible(resolved, optionsSettingIdOf(control))).map(
243982
+ const controls2 = section.controls.filter((control) => isSettingVisible(resolved, optionsSettingIdOf(control))).map(
244083
243983
  (control) => isSettingLocked(resolved, optionsSettingIdOf(control)) ? { ...control, readOnly: true } : control
244084
243984
  );
244085
- if (controls.length === 0 && section.controls.length > 0 && !section.special) {
243985
+ if (controls2.length === 0 && section.controls.length > 0 && !section.special) {
244086
243986
  return null;
244087
243987
  }
244088
- return { ...section, controls };
243988
+ return { ...section, controls: controls2 };
244089
243989
  }
244090
243990
  function customizeOptionsTabs(tabs, resolved) {
244091
243991
  if (resolved.hiddenOptionsPages.size === 0 && resolved.hiddenOptionsSections.size === 0 && resolved.hiddenSettings.size === 0 && Object.keys(resolved.lockedSettings).length === 0) {
@@ -248990,28 +248890,19 @@ function cursorForTool(tool) {
248990
248890
  return "default";
248991
248891
  }
248992
248892
  }
248993
- function carryBuildState(state) {
248994
- if (!state) {
248995
- return {};
248996
- }
248997
- const carried = {};
248998
- if (state.build) {
248999
- carried.build = state.build;
249000
- }
249001
- if (state.chartReveal) {
249002
- carried.chartReveal = state.chartReveal;
249003
- }
249004
- if (state.diagramReveal) {
249005
- carried.diagramReveal = state.diagramReveal;
249006
- }
249007
- if (state.textStyle) {
249008
- carried.textStyle = state.textStyle;
249009
- }
249010
- return carried;
249011
- }
248893
+ var playbackOwners = /* @__PURE__ */ new WeakMap();
249012
248894
  function applyAnimationGroupSteps(group2, ctx) {
249013
248895
  wireMediaEndedSteps(group2, ctx);
249014
248896
  wireMediaBookmarkSteps(group2, ctx);
248897
+ const ownedAnimations = /* @__PURE__ */ new Map();
248898
+ const owner = /* @__PURE__ */ Symbol("animation group");
248899
+ const owners = playbackOwners.get(ctx.setStates) ?? /* @__PURE__ */ new Map();
248900
+ playbackOwners.set(ctx.setStates, owners);
248901
+ for (const step of group2.steps) {
248902
+ if (step.elementId && !step.command) {
248903
+ owners.set(step.elementId, owner);
248904
+ }
248905
+ }
249015
248906
  for (const step of group2.steps) {
249016
248907
  if (step.command) {
249017
248908
  const command = step.command;
@@ -249025,46 +248916,101 @@ function applyAnimationGroupSteps(group2, ctx) {
249025
248916
  continue;
249026
248917
  }
249027
248918
  if (step.stopSound) {
249028
- ctx.stopSound();
248919
+ if (step.delayMs > 0) {
248920
+ const stopTimer = window.setTimeout(() => {
248921
+ ctx.stopSound();
248922
+ }, step.delayMs);
248923
+ ctx.timers.push(stopTimer);
248924
+ } else {
248925
+ ctx.stopSound();
248926
+ }
249029
248927
  } else if (step.soundPath) {
249030
- (ctx.onPlayActionSound ?? ctx.playSound)(step.soundPath);
248928
+ const soundPath = step.soundPath;
248929
+ if (step.delayMs > 0) {
248930
+ const soundTimer = window.setTimeout(() => {
248931
+ (ctx.onPlayActionSound ?? ctx.playSound)(soundPath);
248932
+ }, step.delayMs);
248933
+ ctx.timers.push(soundTimer);
248934
+ } else {
248935
+ (ctx.onPlayActionSound ?? ctx.playSound)(soundPath);
248936
+ }
249031
248937
  }
249032
248938
  }
249033
248939
  ctx.setStates((previous) => {
249034
248940
  const next = new Map(previous);
248941
+ const componentsByElement = /* @__PURE__ */ new Map();
249035
248942
  for (const step of group2.steps) {
249036
- if (step.command) {
248943
+ if (step.command || !step.elementId) {
249037
248944
  continue;
249038
248945
  }
249039
248946
  const current = next.get(step.elementId);
249040
248947
  const shouldBeVisible = step.presetClass === "exit" ? current?.visible ?? true : true;
249041
248948
  const carried = carryBuildState(current);
248949
+ let components = componentsByElement.get(step.elementId);
248950
+ if (!components) {
248951
+ components = [];
248952
+ componentsByElement.set(step.elementId, components);
248953
+ }
248954
+ if (step.cssAnimation) {
248955
+ const names = [...step.cssAnimation.matchAll(/(?:^|,\s*)([\w-]+)\s+[\d.]+m?s\b/gu)].map(
248956
+ (match) => match[1]
248957
+ );
248958
+ const stepProperties = new Set(
248959
+ (names.length ? names : [step.keyframeName]).flatMap((name) => [
248960
+ ...keyframeAnimatedProperties(name)
248961
+ ])
248962
+ );
248963
+ const takesOverEverything = stepProperties.has("unknown");
248964
+ for (let index = components.length - 1; index >= 0; index--) {
248965
+ const component2 = components[index];
248966
+ const collides = takesOverEverything || component2.properties.has("unknown") || [...stepProperties].some((property) => component2.properties.has(property));
248967
+ if (collides) {
248968
+ components.splice(index, 1);
248969
+ }
248970
+ }
248971
+ components.push({
248972
+ animation: step.cssAnimation,
248973
+ properties: stepProperties,
248974
+ colorTargets: step.colorTargets
248975
+ });
248976
+ ownedAnimations.set(
248977
+ step.elementId,
248978
+ components.map((component2) => component2.animation)
248979
+ );
248980
+ }
249042
248981
  next.set(step.elementId, {
249043
248982
  ...carried,
249044
248983
  visible: shouldBeVisible,
249045
- cssAnimation: step.cssAnimation,
249046
- animatesFill: step.colorTargets?.includes("fill") ? true : void 0,
249047
- animatesStroke: step.colorTargets?.includes("stroke") ? true : void 0,
248984
+ cssAnimation: components.map((component2) => component2.animation).join(", ") || void 0,
248985
+ animatesFill: components.some((component2) => component2.colorTargets?.includes("fill")) || void 0,
248986
+ animatesStroke: components.some((component2) => component2.colorTargets?.includes("stroke")) || void 0,
249048
248987
  textStyle: mergeTextStyleOnStart(carried.textStyle, step.textStyle)
249049
248988
  });
249050
248989
  }
249051
248990
  return next;
249052
248991
  });
249053
248992
  for (const step of group2.steps) {
249054
- if (step.command) {
248993
+ if (step.command || !step.elementId) {
249055
248994
  continue;
249056
248995
  }
249057
248996
  const timer = window.setTimeout(
249058
248997
  () => {
248998
+ const components = ownedAnimations.get(step.elementId) ?? [];
248999
+ const remaining = step.holdEndState ? components : components.filter((animation) => animation !== step.cssAnimation);
249059
249000
  ctx.setStates((previous) => {
249060
249001
  const next = new Map(previous);
249061
249002
  const current = next.get(step.elementId);
249003
+ if (owners.get(step.elementId) !== owner || current?.cssAnimation !== (components.join(", ") || void 0) || step.cssAnimation && !components.includes(step.cssAnimation)) {
249004
+ return next;
249005
+ }
249062
249006
  const visibleAfter = step.presetClass === "exit" || step.hideAfterEffect ? false : current?.visible ?? true;
249063
249007
  const carried = carryBuildState(current);
249064
249008
  next.set(step.elementId, {
249065
249009
  ...carried,
249066
249010
  visible: visibleAfter,
249067
- cssAnimation: step.holdEndState ? step.cssAnimation : void 0,
249011
+ cssAnimation: remaining.join(", ") || void 0,
249012
+ animatesFill: step.colorTargets ? void 0 : current?.animatesFill,
249013
+ animatesStroke: step.colorTargets ? void 0 : current?.animatesStroke,
249068
249014
  textStyle: resolveTextStyleOnCleanup(
249069
249015
  carried.textStyle,
249070
249016
  step.textStyle,
@@ -249073,12 +249019,32 @@ function applyAnimationGroupSteps(group2, ctx) {
249073
249019
  });
249074
249020
  return next;
249075
249021
  });
249022
+ ownedAnimations.set(step.elementId, remaining);
249076
249023
  },
249077
249024
  Math.max(0, step.delayMs + step.durationMs + 8)
249078
249025
  );
249079
249026
  ctx.timers.push(timer);
249080
249027
  }
249081
249028
  }
249029
+ function carryBuildState(state) {
249030
+ if (!state) {
249031
+ return {};
249032
+ }
249033
+ const carried = {};
249034
+ if (state.build) {
249035
+ carried.build = state.build;
249036
+ }
249037
+ if (state.chartReveal) {
249038
+ carried.chartReveal = state.chartReveal;
249039
+ }
249040
+ if (state.diagramReveal) {
249041
+ carried.diagramReveal = state.diagramReveal;
249042
+ }
249043
+ if (state.textStyle) {
249044
+ carried.textStyle = state.textStyle;
249045
+ }
249046
+ return carried;
249047
+ }
249082
249048
  function cancelBuildReveal(handle) {
249083
249049
  if (handle.current !== null && typeof cancelAnimationFrame === "function") {
249084
249050
  cancelAnimationFrame(handle.current);
@@ -253364,6 +253330,1142 @@ function prepareElementUpdateBatch(slides, updates) {
253364
253330
  });
253365
253331
  return changed ? next : null;
253366
253332
  }
253333
+ var RECORD_COMMAND_GROUPS = [
253334
+ {
253335
+ id: "record.camera",
253336
+ labelKey: "pptx.record.camera",
253337
+ commands: [
253338
+ {
253339
+ id: "record.camera.cameo",
253340
+ labelKey: "pptx.record.cameo",
253341
+ icon: "camera",
253342
+ unsupported: true
253343
+ }
253344
+ ]
253345
+ },
253346
+ {
253347
+ id: "record.record",
253348
+ labelKey: "pptx.ribbon.tab.record",
253349
+ commands: [
253350
+ {
253351
+ id: "record.record.fromBeginning",
253352
+ labelKey: "pptx.slideShow.fromBeginning",
253353
+ icon: "video"
253354
+ },
253355
+ { id: "record.record.fromCurrent", labelKey: "pptx.slideShow.fromCurrent", icon: "play" }
253356
+ ]
253357
+ },
253358
+ {
253359
+ id: "record.manage",
253360
+ labelKey: "pptx.record.manage",
253361
+ commands: [
253362
+ {
253363
+ id: "record.manage.clear",
253364
+ labelKey: "pptx.record.clear",
253365
+ icon: "eraser",
253366
+ unsupported: true
253367
+ },
253368
+ {
253369
+ id: "record.manage.reset",
253370
+ labelKey: "pptx.record.resetToCameo",
253371
+ icon: "reset",
253372
+ unsupported: true
253373
+ }
253374
+ ]
253375
+ },
253376
+ {
253377
+ id: "record.help",
253378
+ labelKey: "pptx.ribbon.tab.help",
253379
+ commands: [
253380
+ {
253381
+ id: "record.help.learnMore",
253382
+ labelKey: "pptx.record.learnMore",
253383
+ icon: "help",
253384
+ unsupported: true
253385
+ }
253386
+ ]
253387
+ }
253388
+ ];
253389
+ var SLIDE_SHOW_OPTIONS_STYLES = `
253390
+ :host {
253391
+ display: inline-flex;
253392
+ flex: none;
253393
+ align-items: flex-start;
253394
+ gap: 8px;
253395
+ color: var(--pptx-foreground, #f9fafb);
253396
+ font: inherit;
253397
+ }
253398
+ .column { display: flex; flex-direction: column; gap: 2px; }
253399
+ label {
253400
+ display: flex;
253401
+ align-items: center;
253402
+ gap: 4px;
253403
+ min-height: 22px;
253404
+ padding: 0 4px;
253405
+ font-size: 10px;
253406
+ white-space: nowrap;
253407
+ cursor: pointer;
253408
+ }
253409
+ label:has([disabled]) { color: var(--pptx-muted-foreground, #9ca3af); cursor: not-allowed; }
253410
+ @media (pointer: coarse), (max-width: 767px) {
253411
+ label { min-height: 44px; font-size: 12px; }
253412
+ }
253413
+ `;
253414
+ function definePptxSlideShowOptions(registry) {
253415
+ if (registry.get("pptx-ui-slide-show-options")) {
253416
+ return;
253417
+ }
253418
+ class SlideShowOptions extends HTMLElement {
253419
+ static observedAttributes = ["disabled"];
253420
+ properties;
253421
+ optionLabels = {};
253422
+ rows = /* @__PURE__ */ new Map();
253423
+ constructor() {
253424
+ super();
253425
+ const root = this.attachShadow({ mode: "open" });
253426
+ attachControlStyles(root, SLIDE_SHOW_OPTIONS_STYLES);
253427
+ const columns = [document.createElement("div"), document.createElement("div")];
253428
+ for (const column of columns) {
253429
+ column.className = "column";
253430
+ }
253431
+ SLIDE_SHOW_OPTIONS.forEach((option, index) => {
253432
+ const label = document.createElement("label");
253433
+ const checkbox = document.createElement("pptx-ui-checkbox");
253434
+ const text22 = document.createTextNode("");
253435
+ label.append(checkbox, text22);
253436
+ label.addEventListener("click", (event) => {
253437
+ event.preventDefault();
253438
+ if (event.target !== checkbox) {
253439
+ checkbox.click();
253440
+ }
253441
+ });
253442
+ columns[index < 3 ? 0 : 1].append(label);
253443
+ this.rows.set(option.id, { checkbox, text: text22 });
253444
+ checkbox.addEventListener("change", (event) => {
253445
+ event.stopPropagation();
253446
+ const change = slideShowOptionChange(option.id, checkbox.checked);
253447
+ this.sync();
253448
+ if (!this.disabled && !option.unsupported && change) {
253449
+ this.dispatchEvent(
253450
+ new CustomEvent("show-options-change", {
253451
+ detail: change,
253452
+ bubbles: true,
253453
+ composed: true
253454
+ })
253455
+ );
253456
+ }
253457
+ });
253458
+ checkbox.addEventListener("input", (event) => event.stopPropagation());
253459
+ });
253460
+ columns[1].append(document.createElement("slot"));
253461
+ root.append(...columns);
253462
+ }
253463
+ connectedCallback() {
253464
+ this.sync();
253465
+ }
253466
+ attributeChangedCallback() {
253467
+ this.sync();
253468
+ }
253469
+ get presentationProperties() {
253470
+ return this.properties;
253471
+ }
253472
+ set presentationProperties(value) {
253473
+ this.properties = value;
253474
+ this.sync();
253475
+ }
253476
+ get labels() {
253477
+ return this.optionLabels;
253478
+ }
253479
+ set labels(value) {
253480
+ this.optionLabels = value ?? {};
253481
+ this.sync();
253482
+ }
253483
+ get disabled() {
253484
+ return this.hasAttribute("disabled");
253485
+ }
253486
+ set disabled(value) {
253487
+ this.toggleAttribute("disabled", Boolean(value));
253488
+ }
253489
+ sync() {
253490
+ for (const option of SLIDE_SHOW_OPTIONS) {
253491
+ const row = this.rows.get(option.id);
253492
+ const label = this.optionLabels[option.id] ?? option.labelKey;
253493
+ row.text.textContent = label;
253494
+ row.checkbox.setAttribute("aria-label", label);
253495
+ row.checkbox.checked = readSlideShowOption(this.properties, option.id);
253496
+ row.checkbox.disabled = this.disabled || option.unsupported;
253497
+ }
253498
+ }
253499
+ }
253500
+ registry.define("pptx-ui-slide-show-options", SlideShowOptions);
253501
+ }
253502
+ var SUBTITLE_SETTINGS_STYLES = `
253503
+ :host { display: inline-flex; }
253504
+ dialog { box-sizing: border-box; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
253505
+ margin: auto; padding: 24px; border: 1px solid var(--pptx-border, #374151); border-radius: 10px;
253506
+ background: var(--pptx-background, #181b20); color: var(--pptx-foreground, #f9fafb); font: 14px/1.5 system-ui; }
253507
+ dialog::backdrop { background: #0008; }
253508
+ h2 { margin: 0 0 12px; font-size: 18px; } p { margin: 0 0 20px; }
253509
+ label { display: block; margin-bottom: 8px; }
253510
+ pptx-ui-select { display: block; width: 100%; }
253511
+ footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
253512
+ footer button { padding: 8px 16px; min-height: 44px; border: 1px solid var(--pptx-border, #374151);
253513
+ border-radius: 6px; background: var(--pptx-secondary, #252830); color: inherit; font: inherit; cursor: pointer; }
253514
+ footer button:last-child { background: var(--pptx-primary, #6366f1); color: var(--pptx-primary-foreground, #fff); }
253515
+ footer button:focus-visible { outline: 2px solid var(--pptx-ring, #6366f1); outline-offset: 2px; }
253516
+ @media (forced-colors: active) { dialog { background: Canvas; color: CanvasText; } footer button { color: ButtonText; } }
253517
+ `;
253518
+ function definePptxSubtitleSettings(registry) {
253519
+ if (registry.get("pptx-ui-subtitle-settings")) {
253520
+ return;
253521
+ }
253522
+ class SubtitleSettingsElement extends HTMLElement {
253523
+ current = normalizeSubtitleSettings();
253524
+ text = {
253525
+ title: "Subtitle Settings",
253526
+ language: "Spoken language",
253527
+ browserLanguage: "Browser language",
253528
+ description: "",
253529
+ apply: "Apply",
253530
+ cancel: "Cancel"
253531
+ };
253532
+ command;
253533
+ dialog;
253534
+ heading;
253535
+ description;
253536
+ languageLabel;
253537
+ language;
253538
+ apply;
253539
+ cancel;
253540
+ constructor() {
253541
+ super();
253542
+ const root = this.attachShadow({ mode: "open" });
253543
+ attachControlStyles(root, SUBTITLE_SETTINGS_STYLES);
253544
+ this.command = document.createElement("pptx-ui-ribbon-command");
253545
+ this.command.setAttribute("data-ribbon-control", "slideShow.captions.subtitleSettings");
253546
+ this.command.setAttribute("icon", "captions");
253547
+ this.command.setAttribute("compact", "");
253548
+ this.dialog = document.createElement("dialog");
253549
+ this.heading = document.createElement("h2");
253550
+ this.description = document.createElement("p");
253551
+ this.languageLabel = document.createElement("label");
253552
+ this.language = document.createElement("pptx-ui-select");
253553
+ this.language.id = "spoken-language";
253554
+ this.languageLabel.htmlFor = this.language.id;
253555
+ const footer = document.createElement("footer");
253556
+ this.cancel = document.createElement("button");
253557
+ this.cancel.type = "button";
253558
+ this.apply = document.createElement("button");
253559
+ this.apply.type = "button";
253560
+ footer.append(this.cancel, this.apply);
253561
+ this.dialog.append(this.heading, this.description, this.languageLabel, this.language, footer);
253562
+ root.append(this.command, this.dialog);
253563
+ this.command.addEventListener("command-request", () => this.open());
253564
+ this.cancel.addEventListener("click", () => this.close());
253565
+ this.dialog.addEventListener("cancel", (event) => {
253566
+ event.preventDefault();
253567
+ this.close();
253568
+ });
253569
+ this.dialog.addEventListener("keydown", (event) => {
253570
+ event.stopPropagation();
253571
+ if (event.key === "Tab") {
253572
+ const picker = this.language.shadowRoot?.querySelector("button");
253573
+ const controls2 = [
253574
+ ...picker && !picker.disabled ? [picker] : [],
253575
+ this.cancel,
253576
+ this.apply
253577
+ ];
253578
+ const active2 = event.composedPath()[0];
253579
+ const index = controls2.findIndex((control) => control === active2);
253580
+ event.preventDefault();
253581
+ controls2[(index + (event.shiftKey ? controls2.length - 1 : 1)) % controls2.length].focus();
253582
+ }
253583
+ if (event.key === "Escape") {
253584
+ event.preventDefault();
253585
+ this.close();
253586
+ }
253587
+ });
253588
+ this.apply.addEventListener("click", () => {
253589
+ const settings = normalizeSubtitleSettings({ spokenLanguage: this.language.value });
253590
+ this.dispatchEvent(
253591
+ new CustomEvent("subtitle-settings-change", {
253592
+ detail: settings,
253593
+ bubbles: true,
253594
+ composed: true
253595
+ })
253596
+ );
253597
+ this.close();
253598
+ });
253599
+ }
253600
+ get settings() {
253601
+ return { ...this.current };
253602
+ }
253603
+ set settings(value) {
253604
+ this.current = normalizeSubtitleSettings(value);
253605
+ }
253606
+ get labels() {
253607
+ return this.text;
253608
+ }
253609
+ set labels(value) {
253610
+ this.text = { ...this.text, ...value };
253611
+ this.sync();
253612
+ }
253613
+ get languageDisabled() {
253614
+ return this.language.disabled;
253615
+ }
253616
+ set languageDisabled(value) {
253617
+ this.language.disabled = value;
253618
+ }
253619
+ connectedCallback() {
253620
+ this.sync();
253621
+ }
253622
+ disconnectedCallback() {
253623
+ if (this.dialog.open) {
253624
+ this.dialog.close();
253625
+ }
253626
+ }
253627
+ open() {
253628
+ if (this.dialog.open) {
253629
+ return;
253630
+ }
253631
+ this.sync();
253632
+ this.language.value = this.current.spokenLanguage;
253633
+ this.dialog.showModal();
253634
+ this.language.shadowRoot?.querySelector("button")?.focus();
253635
+ }
253636
+ close() {
253637
+ this.dialog.close();
253638
+ this.command.shadowRoot?.querySelector("button")?.focus();
253639
+ }
253640
+ sync() {
253641
+ this.command.setAttribute("label", this.text.title);
253642
+ this.dialog.setAttribute("aria-label", this.text.title);
253643
+ this.heading.textContent = this.text.title;
253644
+ this.description.textContent = this.text.description;
253645
+ this.languageLabel.textContent = this.text.language;
253646
+ this.language.setAttribute("aria-label", this.text.language);
253647
+ this.cancel.textContent = this.text.cancel;
253648
+ this.apply.textContent = this.text.apply;
253649
+ this.language.replaceChildren(
253650
+ ...SUBTITLE_LANGUAGES.map((value) => {
253651
+ const option = document.createElement("option");
253652
+ option.value = value;
253653
+ option.textContent = value === "auto" ? this.text.browserLanguage : subtitleLanguageLabel(value);
253654
+ return option;
253655
+ })
253656
+ );
253657
+ }
253658
+ }
253659
+ registry.define("pptx-ui-subtitle-settings", SubtitleSettingsElement);
253660
+ }
253661
+ var controls = [
253662
+ ["pptx-ui-search", definePptxSearchField],
253663
+ ["pptx-ui-checkbox", definePptxCheckbox],
253664
+ ["pptx-ui-select", definePptxSelect],
253665
+ ["pptx-ui-slide-show-options", definePptxSlideShowOptions],
253666
+ ["pptx-ui-ribbon-command", definePptxRibbonCommand],
253667
+ ["pptx-ui-ribbon-group", definePptxRibbonGroup],
253668
+ ["pptx-ui-ribbon-toggle", definePptxRibbonToggle],
253669
+ ["pptx-ui-subtitle-settings", definePptxSubtitleSettings]
253670
+ ];
253671
+ function registerPptxWebControls() {
253672
+ if (typeof window === "undefined" || !window.customElements) {
253673
+ return;
253674
+ }
253675
+ const registry = window.customElements;
253676
+ assertWebControlContract(
253677
+ registry,
253678
+ controls.map(([name]) => name)
253679
+ );
253680
+ if (!document.getElementById("pptx-ui-control-hosts")) {
253681
+ const style = document.createElement("style");
253682
+ style.id = "pptx-ui-control-hosts";
253683
+ style.textContent = HOST_STYLES;
253684
+ document.head.append(style);
253685
+ }
253686
+ for (const [name, define] of controls) {
253687
+ if (!registry.get(name)) {
253688
+ define(registry);
253689
+ markWebControlContract(registry.get(name));
253690
+ }
253691
+ }
253692
+ }
253693
+ var defaultThemeColors = {
253694
+ background: "#030712",
253695
+ // gray-950
253696
+ foreground: "#f3f4f6",
253697
+ // gray-100
253698
+ card: "#111827",
253699
+ // gray-900
253700
+ cardForeground: "#f3f4f6",
253701
+ // gray-100
253702
+ popover: "#111827",
253703
+ // gray-900
253704
+ popoverForeground: "#f3f4f6",
253705
+ // gray-100
253706
+ primary: "#6366f1",
253707
+ // indigo-500
253708
+ primaryForeground: "#ffffff",
253709
+ // white
253710
+ secondary: "#1f2937",
253711
+ // gray-800
253712
+ secondaryForeground: "#f3f4f6",
253713
+ // gray-100
253714
+ muted: "#1f2937",
253715
+ // gray-800
253716
+ mutedForeground: "#9ca3af",
253717
+ // gray-400
253718
+ accent: "#1f2937",
253719
+ // gray-800
253720
+ accentForeground: "#f3f4f6",
253721
+ // gray-100
253722
+ destructive: "#ef4444",
253723
+ // red-500
253724
+ destructiveForeground: "#ffffff",
253725
+ // white
253726
+ border: "#374151",
253727
+ // gray-700
253728
+ input: "#374151",
253729
+ // gray-700
253730
+ ring: "#6366f1"
253731
+ // indigo-500
253732
+ };
253733
+ var defaultRadius = "0.5rem";
253734
+ var lightThemeColors = {
253735
+ background: "#f8fafc",
253736
+ // slate-50
253737
+ foreground: "#0f172a",
253738
+ // slate-900
253739
+ card: "#ffffff",
253740
+ cardForeground: "#0f172a",
253741
+ // slate-900
253742
+ popover: "#ffffff",
253743
+ popoverForeground: "#0f172a",
253744
+ // slate-900
253745
+ primary: "#4f46e5",
253746
+ // indigo-600
253747
+ primaryForeground: "#ffffff",
253748
+ secondary: "#f1f5f9",
253749
+ // slate-100
253750
+ secondaryForeground: "#0f172a",
253751
+ // slate-900
253752
+ muted: "#f1f5f9",
253753
+ // slate-100
253754
+ mutedForeground: "#64748b",
253755
+ // slate-500
253756
+ accent: "#f1f5f9",
253757
+ // slate-100
253758
+ accentForeground: "#0f172a",
253759
+ // slate-900
253760
+ destructive: "#dc2626",
253761
+ // red-600
253762
+ destructiveForeground: "#ffffff",
253763
+ border: "#e2e8f0",
253764
+ // slate-200
253765
+ input: "#e2e8f0",
253766
+ // slate-200
253767
+ ring: "#4f46e5"
253768
+ // indigo-600
253769
+ };
253770
+ var lightTheme = {
253771
+ colors: lightThemeColors
253772
+ };
253773
+ var COLOR_KEY_TO_CSS = {
253774
+ background: "background",
253775
+ foreground: "foreground",
253776
+ card: "card",
253777
+ cardForeground: "card-foreground",
253778
+ popover: "popover",
253779
+ popoverForeground: "popover-foreground",
253780
+ primary: "primary",
253781
+ primaryForeground: "primary-foreground",
253782
+ secondary: "secondary",
253783
+ secondaryForeground: "secondary-foreground",
253784
+ muted: "muted",
253785
+ mutedForeground: "muted-foreground",
253786
+ accent: "accent",
253787
+ accentForeground: "accent-foreground",
253788
+ destructive: "destructive",
253789
+ destructiveForeground: "destructive-foreground",
253790
+ border: "border",
253791
+ input: "input",
253792
+ ring: "ring"
253793
+ };
253794
+ var DERIVED_COLOR_TOKENS = [
253795
+ { source: "primary", cssSuffix: "inspector-active" },
253796
+ { source: "border", cssSuffix: "inspector-border" }
253797
+ ];
253798
+ function themeToCssVars(theme, omitDefaults = false) {
253799
+ const vars = {};
253800
+ if (!theme) {
253801
+ return vars;
253802
+ }
253803
+ const colors = theme.colors;
253804
+ if (colors) {
253805
+ for (const [key2, cssSuffix] of Object.entries(COLOR_KEY_TO_CSS)) {
253806
+ const value = colors[key2];
253807
+ if (value === void 0) {
253808
+ continue;
253809
+ }
253810
+ if (omitDefaults && value === defaultThemeColors[key2]) {
253811
+ continue;
253812
+ }
253813
+ vars[`--pptx-${cssSuffix}`] = value;
253814
+ vars[`--color-${cssSuffix}`] = value;
253815
+ }
253816
+ for (const { source, cssSuffix } of DERIVED_COLOR_TOKENS) {
253817
+ const value = colors[source];
253818
+ if (value === void 0) {
253819
+ continue;
253820
+ }
253821
+ if (omitDefaults && value === defaultThemeColors[source]) {
253822
+ continue;
253823
+ }
253824
+ vars[`--pptx-${cssSuffix}`] = value;
253825
+ }
253826
+ }
253827
+ if (theme.radius !== void 0) {
253828
+ if (!omitDefaults || theme.radius !== defaultRadius) {
253829
+ vars["--pptx-radius"] = theme.radius;
253830
+ const r = theme.radius;
253831
+ vars["--radius-sm"] = `calc(${r} - 4px)`;
253832
+ vars["--radius-md"] = `calc(${r} - 2px)`;
253833
+ vars["--radius-lg"] = r;
253834
+ vars["--radius-xl"] = `calc(${r} + 4px)`;
253835
+ }
253836
+ }
253837
+ if (theme.cssVars) {
253838
+ for (const [key2, value] of Object.entries(theme.cssVars)) {
253839
+ vars[key2] = value;
253840
+ }
253841
+ }
253842
+ return vars;
253843
+ }
253844
+ function defaultCssVars() {
253845
+ const vars = {};
253846
+ for (const [key2, cssSuffix] of Object.entries(COLOR_KEY_TO_CSS)) {
253847
+ vars[`--pptx-${cssSuffix}`] = defaultThemeColors[key2];
253848
+ }
253849
+ for (const { source, cssSuffix } of DERIVED_COLOR_TOKENS) {
253850
+ vars[`--pptx-${cssSuffix}`] = defaultThemeColors[source];
253851
+ }
253852
+ vars["--pptx-radius"] = defaultRadius;
253853
+ return vars;
253854
+ }
253855
+ var vermilionLightColors = {
253856
+ background: "#fbfaf7",
253857
+ foreground: "#1a1d21",
253858
+ card: "#ffffff",
253859
+ cardForeground: "#1a1d21",
253860
+ popover: "#ffffff",
253861
+ popoverForeground: "#1a1d21",
253862
+ primary: "#c2431f",
253863
+ primaryForeground: "#ffffff",
253864
+ secondary: "#f2efe8",
253865
+ secondaryForeground: "#1a1d21",
253866
+ muted: "#f2efe8",
253867
+ mutedForeground: "#5a626e",
253868
+ accent: "rgba(194, 67, 31, 0.08)",
253869
+ accentForeground: "#1a1d21",
253870
+ destructive: "#dc2626",
253871
+ destructiveForeground: "#ffffff",
253872
+ border: "#e6e2d9",
253873
+ input: "#e6e2d9",
253874
+ ring: "#c2431f"
253875
+ };
253876
+ var vermilionDarkColors = {
253877
+ background: "#0f1113",
253878
+ foreground: "#f0efec",
253879
+ card: "#171a1e",
253880
+ cardForeground: "#f0efec",
253881
+ popover: "#171a1e",
253882
+ popoverForeground: "#f0efec",
253883
+ primary: "#e86a40",
253884
+ primaryForeground: "#ffffff",
253885
+ secondary: "#1f242b",
253886
+ secondaryForeground: "#f0efec",
253887
+ muted: "#1f242b",
253888
+ mutedForeground: "#9aa1ab",
253889
+ accent: "rgba(232, 106, 64, 0.1)",
253890
+ accentForeground: "#f0efec",
253891
+ destructive: "#ef4444",
253892
+ destructiveForeground: "#ffffff",
253893
+ border: "#272c33",
253894
+ input: "#272c33",
253895
+ ring: "#e86a40"
253896
+ };
253897
+ var vermilionRadius = "0.375rem";
253898
+ var vermilionLightTheme = {
253899
+ colors: vermilionLightColors,
253900
+ radius: vermilionRadius
253901
+ };
253902
+ var vermilionDarkTheme = {
253903
+ colors: vermilionDarkColors,
253904
+ radius: vermilionRadius
253905
+ };
253906
+ var THEME_CATALOG = [
253907
+ { key: "default", labelKey: "pptx.settings.theme.default", theme: void 0 },
253908
+ { key: "light", labelKey: "pptx.settings.theme.light", theme: lightTheme },
253909
+ {
253910
+ key: "vermilionLight",
253911
+ labelKey: "pptx.settings.theme.vermilionLight",
253912
+ theme: vermilionLightTheme
253913
+ },
253914
+ {
253915
+ key: "vermilionDark",
253916
+ labelKey: "pptx.settings.theme.vermilionDark",
253917
+ theme: vermilionDarkTheme
253918
+ }
253919
+ ];
253920
+ function resolveThemeCatalogEntry(key2, catalog = THEME_CATALOG) {
253921
+ return catalog.find((entry5) => entry5.key === key2)?.theme;
253922
+ }
253923
+ function corePreset(id) {
253924
+ const preset22 = exports.THEME_PRESETS.find((p) => p.id === id);
253925
+ if (!preset22) {
253926
+ throw new Error(`theme-gallery-presets: core THEME_PRESETS is missing "${id}"`);
253927
+ }
253928
+ return preset22;
253929
+ }
253930
+ var WISP_PRESET = {
253931
+ id: "wisp",
253932
+ name: "Wisp",
253933
+ colorScheme: {
253934
+ dk1: "#000000",
253935
+ lt1: "#FFFFFF",
253936
+ dk2: "#46393B",
253937
+ lt2: "#E8DCD8",
253938
+ accent1: "#A53010",
253939
+ accent2: "#DE7E18",
253940
+ accent3: "#9F8351",
253941
+ accent4: "#728653",
253942
+ accent5: "#92AA4C",
253943
+ accent6: "#6AAC91",
253944
+ hlink: "#FB4F14",
253945
+ folHlink: "#E25839"
253946
+ },
253947
+ fontScheme: {
253948
+ majorFont: { latin: "Century Gothic" },
253949
+ minorFont: { latin: "Century Gothic" }
253950
+ }
253951
+ };
253952
+ var BERLIN_PRESET = {
253953
+ id: "berlin",
253954
+ name: "Berlin",
253955
+ colorScheme: {
253956
+ dk1: "#000000",
253957
+ lt1: "#FFFFFF",
253958
+ dk2: "#3E5C61",
253959
+ lt2: "#D5E0D0",
253960
+ accent1: "#F09415",
253961
+ accent2: "#C1B56B",
253962
+ accent3: "#89C2A3",
253963
+ accent4: "#729BBE",
253964
+ accent5: "#9A90C2",
253965
+ accent6: "#BE8DBE",
253966
+ hlink: "#25A0DA",
253967
+ folHlink: "#FF7F00"
253968
+ },
253969
+ fontScheme: {
253970
+ majorFont: { latin: "Trebuchet MS" },
253971
+ minorFont: { latin: "Trebuchet MS" }
253972
+ }
253973
+ };
253974
+ var SLICE_PRESET = {
253975
+ id: "slice",
253976
+ name: "Slice",
253977
+ colorScheme: {
253978
+ dk1: "#000000",
253979
+ lt1: "#FFFFFF",
253980
+ dk2: "#2E3B4C",
253981
+ lt2: "#C7CDD3",
253982
+ accent1: "#E2751D",
253983
+ accent2: "#C53B23",
253984
+ accent3: "#A13D69",
253985
+ accent4: "#58599E",
253986
+ accent5: "#36749D",
253987
+ accent6: "#4EA39A",
253988
+ hlink: "#FD6B32",
253989
+ folHlink: "#D14D0F"
253990
+ },
253991
+ fontScheme: {
253992
+ majorFont: { latin: "Century Gothic" },
253993
+ minorFont: { latin: "Century Gothic" }
253994
+ }
253995
+ };
253996
+ var DIVIDEND_PRESET = {
253997
+ id: "dividend",
253998
+ name: "Dividend",
253999
+ colorScheme: {
254000
+ dk1: "#000000",
254001
+ lt1: "#FFFFFF",
254002
+ dk2: "#3D3D3D",
254003
+ lt2: "#E1E1E1",
254004
+ accent1: "#4D1434",
254005
+ accent2: "#903163",
254006
+ accent3: "#B2324B",
254007
+ accent4: "#D34817",
254008
+ accent5: "#E8971C",
254009
+ accent6: "#FDCB00",
254010
+ hlink: "#A03068",
254011
+ folHlink: "#C34882"
254012
+ },
254013
+ fontScheme: {
254014
+ majorFont: { latin: "Gill Sans MT" },
254015
+ minorFont: { latin: "Gill Sans MT" }
254016
+ }
254017
+ };
254018
+ [
254019
+ corePreset("office"),
254020
+ corePreset("facet"),
254021
+ corePreset("integral"),
254022
+ corePreset("ion"),
254023
+ corePreset("retrospect"),
254024
+ corePreset("organic"),
254025
+ WISP_PRESET,
254026
+ BERLIN_PRESET,
254027
+ SLICE_PRESET,
254028
+ DIVIDEND_PRESET
254029
+ ];
254030
+ function createPresentationLoadResources(handler) {
254031
+ const blobUrls = [];
254032
+ let committed = false;
254033
+ let released = false;
254034
+ return {
254035
+ blobUrls,
254036
+ /** The live viewer now owns the handler and media URLs. */
254037
+ commit() {
254038
+ committed = true;
254039
+ },
254040
+ /** Call in finally, after pending asset reads have settled. */
254041
+ releaseIfUncommitted() {
254042
+ if (committed || released) {
254043
+ return;
254044
+ }
254045
+ released = true;
254046
+ handler.dispose();
254047
+ for (const url of blobUrls) {
254048
+ if (url.startsWith("blob:")) {
254049
+ URL.revokeObjectURL(url);
254050
+ }
254051
+ }
254052
+ }
254053
+ };
254054
+ }
254055
+ function walkAndPatchElements(elements, patch) {
254056
+ let mutated = false;
254057
+ const next = elements.map((el) => {
254058
+ let updated = patch(el);
254059
+ if (updated.type === "group" && updated.children?.length) {
254060
+ const newChildren = walkAndPatchElements(updated.children, patch);
254061
+ if (newChildren !== updated.children) {
254062
+ updated = { ...updated, children: newChildren };
254063
+ }
254064
+ }
254065
+ if (updated !== el) {
254066
+ mutated = true;
254067
+ }
254068
+ return updated;
254069
+ });
254070
+ return mutated ? next : elements;
254071
+ }
254072
+ function applyImagePathPatches(elements, resolvedMap, refs) {
254073
+ const elementPatches = /* @__PURE__ */ new Map();
254074
+ for (const ref of refs) {
254075
+ const url = resolvedMap.get(ref.path);
254076
+ if (!url) {
254077
+ continue;
254078
+ }
254079
+ const existing = elementPatches.get(ref.element.id) ?? {};
254080
+ existing[ref.field] = url;
254081
+ elementPatches.set(ref.element.id, existing);
254082
+ }
254083
+ if (elementPatches.size === 0) {
254084
+ return elements;
254085
+ }
254086
+ return walkAndPatchElements(elements, (el) => {
254087
+ const patch = elementPatches.get(el.id);
254088
+ return patch ? { ...el, ...patch } : el;
254089
+ });
254090
+ }
254091
+ function isExternalUrl(path) {
254092
+ return path.startsWith("http://") || path.startsWith("https://") || path.startsWith("data:") || path.startsWith("blob:");
254093
+ }
254094
+ function collectMediaElements(elements, collector) {
254095
+ for (const element of elements) {
254096
+ if (element.type === "media") {
254097
+ collector.push(element);
254098
+ continue;
254099
+ }
254100
+ if (element.type === "group" && element.children?.length) {
254101
+ collectMediaElements(element.children, collector);
254102
+ }
254103
+ }
254104
+ }
254105
+ function collectImagePaths(slides) {
254106
+ const paths = /* @__PURE__ */ new Set();
254107
+ const refs = [];
254108
+ const walkElements = (elements) => {
254109
+ for (const el of elements) {
254110
+ if (el.type === "picture" || el.type === "image") {
254111
+ const pic = el;
254112
+ if (pic.imagePath && !pic.imageData && !isExternalUrl(pic.imagePath)) {
254113
+ paths.add(pic.imagePath);
254114
+ refs.push({ element: el, field: "imageData", path: pic.imagePath });
254115
+ }
254116
+ if (pic.svgPath && !pic.svgData && !isExternalUrl(pic.svgPath)) {
254117
+ paths.add(pic.svgPath);
254118
+ refs.push({ element: el, field: "svgData", path: pic.svgPath });
254119
+ }
254120
+ }
254121
+ if (el.type === "media") {
254122
+ const media = el;
254123
+ if (media.posterFramePath && !media.posterFrameData && !isExternalUrl(media.posterFramePath)) {
254124
+ paths.add(media.posterFramePath);
254125
+ refs.push({
254126
+ element: el,
254127
+ field: "posterFrameData",
254128
+ path: media.posterFramePath
254129
+ });
254130
+ }
254131
+ }
254132
+ if (el.type === "model3d") {
254133
+ const model = el;
254134
+ if (model.modelPath && !model.modelData && !isExternalUrl(model.modelPath)) {
254135
+ paths.add(model.modelPath);
254136
+ refs.push({ element: el, field: "modelData", path: model.modelPath });
254137
+ }
254138
+ const posterNeedsResolution = model.posterImage ? !isExternalUrl(model.posterImage) : !model.imageData;
254139
+ if (model.imagePath && posterNeedsResolution && !isExternalUrl(model.imagePath)) {
254140
+ paths.add(model.imagePath);
254141
+ refs.push({ element: el, field: "posterImage", path: model.imagePath });
254142
+ }
254143
+ }
254144
+ if (el.type === "group" && el.children?.length) {
254145
+ walkElements(el.children);
254146
+ }
254147
+ }
254148
+ };
254149
+ for (const slide of slides) {
254150
+ walkElements(slide.elements);
254151
+ }
254152
+ return { paths, refs };
254153
+ }
254154
+ function collectTableCellImagePaths(slides) {
254155
+ const paths = /* @__PURE__ */ new Set();
254156
+ const refs = [];
254157
+ const walkElements = (elements) => {
254158
+ for (const el of elements) {
254159
+ if (el.type === "table") {
254160
+ const rows = el.tableData?.rows ?? [];
254161
+ rows.forEach((row, rowIndex) => {
254162
+ row.cells.forEach((cell, cellIndex) => {
254163
+ const path = cell.style?.backgroundImageFillPath;
254164
+ if (path && !cell.style?.backgroundImageFillData && !isExternalUrl(path)) {
254165
+ paths.add(path);
254166
+ refs.push({ element: el, rowIndex, cellIndex, path });
254167
+ }
254168
+ });
254169
+ });
254170
+ }
254171
+ if (el.type === "group" && el.children?.length) {
254172
+ walkElements(el.children);
254173
+ }
254174
+ }
254175
+ };
254176
+ for (const slide of slides) {
254177
+ walkElements(slide.elements);
254178
+ }
254179
+ return { paths, refs };
254180
+ }
254181
+ function applyTableCellImagePatches(elements, resolvedMap, refs) {
254182
+ const patchesByElementId = /* @__PURE__ */ new Map();
254183
+ for (const ref of refs) {
254184
+ const url = resolvedMap.get(ref.path);
254185
+ if (!url) {
254186
+ continue;
254187
+ }
254188
+ const list2 = patchesByElementId.get(ref.element.id) ?? [];
254189
+ list2.push({ rowIndex: ref.rowIndex, cellIndex: ref.cellIndex, url });
254190
+ patchesByElementId.set(ref.element.id, list2);
254191
+ }
254192
+ if (patchesByElementId.size === 0) {
254193
+ return elements;
254194
+ }
254195
+ return walkAndPatchElements(elements, (el) => {
254196
+ const cellPatches = patchesByElementId.get(el.id);
254197
+ if (!cellPatches || el.type !== "table") {
254198
+ return el;
254199
+ }
254200
+ const table2 = el;
254201
+ const tableData = table2.tableData;
254202
+ if (!tableData) {
254203
+ return el;
254204
+ }
254205
+ const newRows = tableData.rows.map((row, rowIndex) => {
254206
+ const rowPatches = cellPatches.filter((p) => p.rowIndex === rowIndex);
254207
+ if (rowPatches.length === 0) {
254208
+ return row;
254209
+ }
254210
+ const newCells = row.cells.map((cell, cellIndex) => {
254211
+ const patch = rowPatches.find((p) => p.cellIndex === cellIndex);
254212
+ if (!patch || !cell.style) {
254213
+ return cell;
254214
+ }
254215
+ return {
254216
+ ...cell,
254217
+ style: { ...cell.style, backgroundImageFillData: patch.url }
254218
+ };
254219
+ });
254220
+ return { ...row, cells: newCells };
254221
+ });
254222
+ return { ...table2, tableData: { ...tableData, rows: newRows } };
254223
+ });
254224
+ }
254225
+ function buildInitialGuides(presentationGuides, firstSlideGuides) {
254226
+ const guides = [];
254227
+ if (presentationGuides) {
254228
+ for (const g2 of presentationGuides) {
254229
+ guides.push({
254230
+ id: g2.id,
254231
+ axis: g2.orientation === "horz" ? "h" : "v",
254232
+ position: guideEmuToPx(g2.positionEmu)
254233
+ });
254234
+ }
254235
+ }
254236
+ if (firstSlideGuides) {
254237
+ for (const g2 of firstSlideGuides) {
254238
+ guides.push({
254239
+ id: g2.id,
254240
+ axis: g2.orientation === "horz" ? "h" : "v",
254241
+ position: guideEmuToPx(g2.positionEmu)
254242
+ });
254243
+ }
254244
+ }
254245
+ return guides;
254246
+ }
254247
+ async function resolveMediaElementSource(mediaElement, handler) {
254248
+ const mediaPath = mediaElement.mediaPath;
254249
+ if (!mediaPath) {
254250
+ return { mediaPath: void 0, url: void 0, isBlobUrl: false, missing: true };
254251
+ }
254252
+ if (isExternalUrl(mediaPath)) {
254253
+ return { mediaPath, url: mediaPath, isBlobUrl: false, missing: false };
254254
+ }
254255
+ try {
254256
+ const isAudioVideo = mediaElement.mediaType === "audio" || mediaElement.mediaType === "video";
254257
+ if (isAudioVideo) {
254258
+ const arrayBuffer = await handler.getMediaArrayBuffer(mediaPath);
254259
+ if (!arrayBuffer) {
254260
+ return { mediaPath, url: void 0, isBlobUrl: false, missing: true };
254261
+ }
254262
+ const mimeType = mediaElement.mediaMimeType || "application/octet-stream";
254263
+ const blobUrl = URL.createObjectURL(new Blob([arrayBuffer], { type: mimeType }));
254264
+ return { mediaPath, url: blobUrl, isBlobUrl: true, missing: false };
254265
+ }
254266
+ const dataUrl = await handler.getImageData(mediaPath);
254267
+ if (!dataUrl) {
254268
+ return { mediaPath, url: void 0, isBlobUrl: false, missing: true };
254269
+ }
254270
+ return { mediaPath, url: dataUrl, isBlobUrl: false, missing: false };
254271
+ } catch {
254272
+ return { mediaPath, url: void 0, isBlobUrl: false, missing: true };
254273
+ }
254274
+ }
254275
+ var TABLE_STYLE_FILL_KEYS = [
254276
+ "wholeTblFill",
254277
+ "band1HFill",
254278
+ "band2HFill",
254279
+ "band1VFill",
254280
+ "band2VFill",
254281
+ "lastColFill",
254282
+ "firstColFill",
254283
+ "lastRowFill",
254284
+ "seCellFill",
254285
+ "swCellFill",
254286
+ "firstRowFill",
254287
+ "neCellFill",
254288
+ "nwCellFill"
254289
+ ];
254290
+ function isExternalUrl2(path) {
254291
+ return path.startsWith("http://") || path.startsWith("https://") || path.startsWith("data:") || path.startsWith("blob:");
254292
+ }
254293
+ function collectTableStyleImagePaths(tableStyleMap) {
254294
+ const paths = /* @__PURE__ */ new Set();
254295
+ const refs = [];
254296
+ if (!tableStyleMap) {
254297
+ return { paths, refs };
254298
+ }
254299
+ for (const [styleId, entry5] of Object.entries(tableStyleMap)) {
254300
+ for (const fillKey of TABLE_STYLE_FILL_KEYS) {
254301
+ const fill = entry5[fillKey];
254302
+ const path = fill?.image?.path;
254303
+ if (path && !fill?.image?.data && !isExternalUrl2(path)) {
254304
+ paths.add(path);
254305
+ refs.push({ styleId, fillKey, path });
254306
+ }
254307
+ }
254308
+ }
254309
+ return { paths, refs };
254310
+ }
254311
+ function applyTableStyleImagePatches(tableStyleMap, resolvedMap, refs) {
254312
+ const patchesByStyleId = /* @__PURE__ */ new Map();
254313
+ for (const ref of refs) {
254314
+ const url = resolvedMap.get(ref.path);
254315
+ if (!url) {
254316
+ continue;
254317
+ }
254318
+ const list2 = patchesByStyleId.get(ref.styleId) ?? [];
254319
+ list2.push({ fillKey: ref.fillKey, url });
254320
+ patchesByStyleId.set(ref.styleId, list2);
254321
+ }
254322
+ if (patchesByStyleId.size === 0) {
254323
+ return tableStyleMap;
254324
+ }
254325
+ const next = { ...tableStyleMap };
254326
+ for (const [styleId, patches] of patchesByStyleId) {
254327
+ const entry5 = next[styleId];
254328
+ if (!entry5) {
254329
+ continue;
254330
+ }
254331
+ const patchedEntry = { ...entry5 };
254332
+ for (const { fillKey, url } of patches) {
254333
+ const fill = patchedEntry[fillKey];
254334
+ if (!fill?.image) {
254335
+ continue;
254336
+ }
254337
+ patchedEntry[fillKey] = { ...fill, image: { ...fill.image, data: url } };
254338
+ }
254339
+ next[styleId] = patchedEntry;
254340
+ }
254341
+ return next;
254342
+ }
254343
+ function collectTextFillBlipPaths(slides) {
254344
+ const paths = /* @__PURE__ */ new Set();
254345
+ const refs = [];
254346
+ const walkElements = (elements) => {
254347
+ for (const el of elements) {
254348
+ if (hasTextProperties(el) && el.textSegments) {
254349
+ el.textSegments.forEach((segment, segmentIndex) => {
254350
+ const path = segment.style?.textFillBlipUrl;
254351
+ if (path && !isExternalUrl(path)) {
254352
+ paths.add(path);
254353
+ refs.push({ element: el, segmentIndex, path });
254354
+ }
254355
+ });
254356
+ }
254357
+ if (el.type === "group" && el.children?.length) {
254358
+ walkElements(el.children);
254359
+ }
254360
+ }
254361
+ };
254362
+ for (const slide of slides) {
254363
+ walkElements(slide.elements);
254364
+ }
254365
+ return { paths, refs };
254366
+ }
254367
+ function applyTextFillBlipPatches(elements, resolvedMap, refs) {
254368
+ const patchesByElementId = /* @__PURE__ */ new Map();
254369
+ for (const ref of refs) {
254370
+ const url = resolvedMap.get(ref.path);
254371
+ if (!url) {
254372
+ continue;
254373
+ }
254374
+ const list2 = patchesByElementId.get(ref.element.id) ?? [];
254375
+ list2.push({ segmentIndex: ref.segmentIndex, url });
254376
+ patchesByElementId.set(ref.element.id, list2);
254377
+ }
254378
+ if (patchesByElementId.size === 0) {
254379
+ return elements;
254380
+ }
254381
+ return walkAndPatchElements(elements, (el) => {
254382
+ const segmentPatches = patchesByElementId.get(el.id);
254383
+ if (!segmentPatches || !hasTextProperties(el) || !el.textSegments) {
254384
+ return el;
254385
+ }
254386
+ const newSegments = el.textSegments.map((segment, segmentIndex) => {
254387
+ const patch = segmentPatches.find((p) => p.segmentIndex === segmentIndex);
254388
+ if (!patch || !segment.style) {
254389
+ return segment;
254390
+ }
254391
+ return { ...segment, style: { ...segment.style, textFillBlipUrl: patch.url } };
254392
+ });
254393
+ return { ...el, textSegments: newSegments };
254394
+ });
254395
+ }
254396
+ async function resolveTableCellImageUrls(slides, getImageData) {
254397
+ const { paths, refs } = collectTableCellImagePaths(slides);
254398
+ if (paths.size === 0) {
254399
+ return slides;
254400
+ }
254401
+ const resolvedMap = /* @__PURE__ */ new Map();
254402
+ await Promise.all(
254403
+ Array.from(paths).map(async (path) => {
254404
+ try {
254405
+ const url = await getImageData(path);
254406
+ if (url) {
254407
+ resolvedMap.set(path, url);
254408
+ }
254409
+ } catch {
254410
+ }
254411
+ })
254412
+ );
254413
+ if (resolvedMap.size === 0) {
254414
+ return slides;
254415
+ }
254416
+ return slides.map((slide) => {
254417
+ const newElements = applyTableCellImagePatches(slide.elements, resolvedMap, refs);
254418
+ return newElements === slide.elements ? slide : { ...slide, elements: newElements };
254419
+ });
254420
+ }
254421
+ async function resolveTableStyleImageUrls(tableStyleMap, getImageData) {
254422
+ const { paths, refs } = collectTableStyleImagePaths(tableStyleMap);
254423
+ if (paths.size === 0 || !tableStyleMap) {
254424
+ return tableStyleMap;
254425
+ }
254426
+ const resolvedMap = /* @__PURE__ */ new Map();
254427
+ await Promise.all(
254428
+ Array.from(paths).map(async (path) => {
254429
+ try {
254430
+ const url = await getImageData(path);
254431
+ if (url) {
254432
+ resolvedMap.set(path, url);
254433
+ }
254434
+ } catch {
254435
+ }
254436
+ })
254437
+ );
254438
+ if (resolvedMap.size === 0) {
254439
+ return tableStyleMap;
254440
+ }
254441
+ return applyTableStyleImagePatches(tableStyleMap, resolvedMap, refs);
254442
+ }
254443
+ async function resolveTextFillBlipUrls(slides, getImageData) {
254444
+ const { paths, refs } = collectTextFillBlipPaths(slides);
254445
+ if (paths.size === 0) {
254446
+ return slides;
254447
+ }
254448
+ const resolvedMap = /* @__PURE__ */ new Map();
254449
+ await Promise.all(
254450
+ Array.from(paths).map(async (path) => {
254451
+ try {
254452
+ const url = await getImageData(path);
254453
+ if (url) {
254454
+ resolvedMap.set(path, url);
254455
+ }
254456
+ } catch {
254457
+ }
254458
+ })
254459
+ );
254460
+ if (resolvedMap.size === 0) {
254461
+ return slides;
254462
+ }
254463
+ return slides.map((slide) => {
254464
+ const newElements = applyTextFillBlipPatches(slide.elements, resolvedMap, refs);
254465
+ return newElements === slide.elements ? slide : { ...slide, elements: newElements };
254466
+ });
254467
+ }
254468
+ init_constants2();
253367
254469
  function isChart3DViewEnabled(flags, chartType) {
253368
254470
  if (!flags || !chartType) {
253369
254471
  return false;
@@ -255971,6 +257073,7 @@ exports.GIF_POST_CAPTURE_MAX_SIDE = GIF_POST_CAPTURE_MAX_SIDE;
255971
257073
  exports.GRADIENT_TYPE_OPTIONS = GRADIENT_TYPE_OPTIONS;
255972
257074
  exports.GlyphOutlineFontCache = GlyphOutlineFontCache;
255973
257075
  exports.HANDOUT_OPTIONS = HANDOUT_OPTIONS;
257076
+ exports.HELP_RIBBON_COMMANDS = HELP_RIBBON_COMMANDS;
255974
257077
  exports.HIDDEN_SLIDE_LABEL_KEY = HIDDEN_SLIDE_LABEL_KEY;
255975
257078
  exports.HIDDEN_SLIDE_SLASH_GRADIENT = HIDDEN_SLIDE_SLASH_GRADIENT;
255976
257079
  exports.HIGHLIGHTER_COLORS = HIGHLIGHTER_COLORS;
@@ -256026,6 +257129,7 @@ exports.PDF_SLIDES_PAGE_HEIGHT_PT = PDF_SLIDES_PAGE_HEIGHT_PT;
256026
257129
  exports.PDF_SLIDES_PAGE_WIDTH_PT = PDF_SLIDES_PAGE_WIDTH_PT;
256027
257130
  exports.PEN_COLORS = PEN_COLORS;
256028
257131
  exports.PPTX_OPEN_ACCEPT = PPTX_OPEN_ACCEPT;
257132
+ exports.PRESENTATION_ANIM_TRIGGER_ATTRIBUTE = PRESENTATION_ANIM_TRIGGER_ATTRIBUTE;
256029
257133
  exports.PRESENTATION_CHANNEL_NAME = PRESENTATION_CHANNEL_NAME;
256030
257134
  exports.PRESENTATION_HASH = PRESENTATION_HASH;
256031
257135
  exports.PRESENTATION_HIT_TEST_CSS = PRESENTATION_HIT_TEST_CSS;
@@ -256047,6 +257151,7 @@ exports.RANDOM_ELIGIBLE_TYPES = RANDOM_ELIGIBLE_TYPES;
256047
257151
  exports.READING_VIEW_ATTR = READING_VIEW_ATTR;
256048
257152
  exports.READING_VIEW_COUNTER_ATTR = READING_VIEW_COUNTER_ATTR;
256049
257153
  exports.READING_VIEW_STAGE_ATTR = READING_VIEW_STAGE_ATTR;
257154
+ exports.RECORD_COMMAND_GROUPS = RECORD_COMMAND_GROUPS;
256050
257155
  exports.RIBBON_CONTEXTUAL_TAB_ATTR = RIBBON_CONTEXTUAL_TAB_ATTR;
256051
257156
  exports.RIBBON_CONTROL_ATTR = RIBBON_CONTROL_ATTR;
256052
257157
  exports.RIBBON_GALLERY_ATTR = RIBBON_GALLERY_ATTR;
@@ -256064,6 +257169,7 @@ exports.SEL = SEL;
256064
257169
  exports.SHAPE_PRESET_DEFS = SHAPE_PRESET_DEFS;
256065
257170
  exports.SHAPE_QUICK_STYLES = SHAPE_QUICK_STYLES;
256066
257171
  exports.SHORTCUT_REFERENCE_ITEMS = SHORTCUT_REFERENCE_ITEMS;
257172
+ exports.SLIDE_SHOW_COMMAND_GROUPS = SLIDE_SHOW_COMMAND_GROUPS;
256067
257173
  exports.SLIDE_SHOW_OPTIONS = SLIDE_SHOW_OPTIONS;
256068
257174
  exports.SLIDE_SIZE_PRESETS = SLIDE_SIZE_PRESETS;
256069
257175
  exports.SLIDE_TEMPLATES = SLIDE_TEMPLATES;
@@ -256581,6 +257687,7 @@ exports.getShapeConnectionSites = getShapeConnectionSites;
256581
257687
  exports.getSlideBackgroundStyle = getSlideBackgroundStyle;
256582
257688
  exports.getSlideTransitionAnimations = getSlideTransitionAnimations;
256583
257689
  exports.getSoftEdgeSvgFilter = getSoftEdgeSvgFilter;
257690
+ exports.getSpeechRecognitionCtor = getSpeechRecognitionCtor;
256584
257691
  exports.getSubstituteFontFamily = getSubstituteFontFamily;
256585
257692
  exports.getSvgStrokeDasharray = getSvgStrokeDasharray;
256586
257693
  exports.getTableCellBandStyle = getTableCellBandStyle;
@@ -256690,6 +257797,7 @@ exports.mediaTrimEndMsFromAbsoluteMs = mediaTrimEndMsFromAbsoluteMs;
256690
257797
  exports.mediaTrimEndMsFromSeconds = mediaTrimEndMsFromSeconds;
256691
257798
  exports.mediaTrimEndSeconds = mediaTrimEndSeconds;
256692
257799
  exports.mergeAdditiveSelection = mergeAdditiveSelection;
257800
+ exports.mergeCaptionResults = mergeCaptionResults;
256693
257801
  exports.mergeCells = mergeCells;
256694
257802
  exports.mergePresentationSnapshot = mergePresentationSnapshot;
256695
257803
  exports.mergeSlideTransition = mergeSlideTransition;
@@ -256792,7 +257900,6 @@ exports.readEditableText = readEditableText;
256792
257900
  exports.readListActivationSelection = readListActivationSelection;
256793
257901
  exports.readOnlyRecommendation = readOnlyRecommendation;
256794
257902
  exports.readRibbonTransitionDraft = readRibbonTransitionDraft;
256795
- exports.readSlideShowOption = readSlideShowOption;
256796
257903
  exports.readSlidesFromYDoc = readSlidesFromYDoc;
256797
257904
  exports.readSoundFileAsDataUrl = readSoundFileAsDataUrl;
256798
257905
  exports.readStoredViewerPrefs = readStoredViewerPrefs;
@@ -256989,7 +258096,6 @@ exports.shouldWriteAutosaveSnapshot = shouldWriteAutosaveSnapshot;
256989
258096
  exports.siblingCount = siblingCount;
256990
258097
  exports.siblingIndex = siblingIndex;
256991
258098
  exports.slideProgressPercent = slideProgressPercent;
256992
- exports.slideShowOptionChange = slideShowOptionChange;
256993
258099
  exports.slideSizeFromPreset = slideSizeFromPreset;
256994
258100
  exports.slideSizeToCanvasPx = slideSizeToCanvasPx;
256995
258101
  exports.slideStatusLabel = slideStatusLabel;
@@ -257012,6 +258118,9 @@ exports.strokeWidthOf = strokeWidthOf;
257012
258118
  exports.styleShadowFilter = styleShadowFilter;
257013
258119
  exports.subscribeBarFacePicturePixelSamples = subscribeBarFacePicturePixelSamples;
257014
258120
  exports.substituteFieldText = substituteFieldText;
258121
+ exports.subtitleRecognitionLanguage = subtitleRecognitionLanguage;
258122
+ exports.subtitleSettingsFromOptions = subtitleSettingsFromOptions;
258123
+ exports.subtitleSettingsLabels = subtitleSettingsLabels;
257015
258124
  exports.surfaceWireframePatch = surfaceWireframePatch;
257016
258125
  exports.svgGradientFillRef = svgGradientFillRef;
257017
258126
  exports.svgLineCap = svgLineCap;
@@ -257057,6 +258166,7 @@ exports.updateElement = updateElement;
257057
258166
  exports.updateMasterViewElement = updateMasterViewElement;
257058
258167
  exports.updateMergeAttrsInRawXml = updateMergeAttrsInRawXml;
257059
258168
  exports.updateSmartArtNodeText = updateSmartArtNodeText;
258169
+ exports.updateSubtitleSettings = updateSubtitleSettings;
257060
258170
  exports.updateTagInCollections = updateTagInCollections;
257061
258171
  exports.validateMediaTrimRange = validateMediaTrimRange;
257062
258172
  exports.validateRoomId = validateRoomId;