pptx-react-viewer 4.51.1 → 4.52.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/{AiChatPanel-EV22O7UO.js → AiChatPanel-7GJQ66GR.js} +19 -19
  3. package/dist/AiChatPanel-7GJQ66GR.js.br +0 -0
  4. package/dist/AiChatPanel-7GJQ66GR.js.gz +0 -0
  5. package/dist/{AiChatPanel-R323KNGN.mjs → AiChatPanel-AI75AT6C.mjs} +1 -1
  6. package/dist/AiChatPanel-AI75AT6C.mjs.br +0 -0
  7. package/dist/AiChatPanel-AI75AT6C.mjs.gz +0 -0
  8. package/dist/{chunk-YJ4DAS4V.js → chunk-2AM5YYWI.js} +586 -615
  9. package/dist/chunk-2AM5YYWI.js.br +0 -0
  10. package/dist/chunk-2AM5YYWI.js.gz +0 -0
  11. package/dist/{chunk-Z22RD3E2.js → chunk-3TN5SUQR.js} +4 -1
  12. package/dist/chunk-3TN5SUQR.js.br +0 -0
  13. package/dist/chunk-3TN5SUQR.js.gz +0 -0
  14. package/dist/{chunk-V4DY4IWP.mjs → chunk-6436YER5.mjs} +390 -420
  15. package/dist/chunk-6436YER5.mjs.br +0 -0
  16. package/dist/chunk-6436YER5.mjs.gz +0 -0
  17. package/dist/{chunk-ZCGYPCZM.mjs → chunk-ID37Y3HG.mjs} +4 -1
  18. package/dist/chunk-ID37Y3HG.mjs.br +0 -0
  19. package/dist/chunk-ID37Y3HG.mjs.gz +0 -0
  20. package/dist/{chunk-VRX5NJY2.js → chunk-JUH4YPMU.js} +1702 -1616
  21. package/dist/chunk-JUH4YPMU.js.br +0 -0
  22. package/dist/chunk-JUH4YPMU.js.gz +0 -0
  23. package/dist/{chunk-KCUXY7DE.mjs → chunk-L77POU5D.mjs} +216 -130
  24. package/dist/chunk-L77POU5D.mjs.br +0 -0
  25. package/dist/chunk-L77POU5D.mjs.gz +0 -0
  26. package/dist/i18n/de.cjs +1 -24
  27. package/dist/i18n/de.cjs.br +0 -0
  28. package/dist/i18n/de.cjs.gz +0 -0
  29. package/dist/i18n/de.mjs +1 -24
  30. package/dist/i18n/de.mjs.br +0 -0
  31. package/dist/i18n/de.mjs.gz +0 -0
  32. package/dist/i18n/es.cjs +1 -24
  33. package/dist/i18n/es.cjs.br +0 -0
  34. package/dist/i18n/es.cjs.gz +0 -0
  35. package/dist/i18n/es.mjs +1 -24
  36. package/dist/i18n/es.mjs.br +0 -0
  37. package/dist/i18n/es.mjs.gz +0 -0
  38. package/dist/i18n/fr.cjs +1 -24
  39. package/dist/i18n/fr.cjs.br +0 -0
  40. package/dist/i18n/fr.cjs.gz +0 -0
  41. package/dist/i18n/fr.mjs +1 -24
  42. package/dist/i18n/fr.mjs.br +0 -0
  43. package/dist/i18n/fr.mjs.gz +0 -0
  44. package/dist/i18n/zh-CN.cjs +0 -23
  45. package/dist/i18n/zh-CN.cjs.br +0 -0
  46. package/dist/i18n/zh-CN.cjs.gz +0 -0
  47. package/dist/i18n/zh-CN.mjs +0 -23
  48. package/dist/i18n/zh-CN.mjs.br +0 -0
  49. package/dist/i18n/zh-CN.mjs.gz +0 -0
  50. package/dist/index.d.ts +14 -2
  51. package/dist/index.js +25 -25
  52. package/dist/index.js.br +0 -0
  53. package/dist/index.js.gz +0 -0
  54. package/dist/index.mjs +3 -3
  55. package/dist/index.mjs.br +0 -0
  56. package/dist/index.mjs.gz +0 -0
  57. package/dist/internals.d.ts +85 -23
  58. package/dist/internals.js +81 -81
  59. package/dist/internals.js.br +0 -0
  60. package/dist/internals.js.gz +0 -0
  61. package/dist/internals.mjs +2 -2
  62. package/dist/internals.mjs.br +0 -0
  63. package/dist/internals.mjs.gz +0 -0
  64. package/dist/viewer/index.d.ts +13 -1
  65. package/dist/viewer/index.js +20 -20
  66. package/dist/viewer/index.js.br +0 -0
  67. package/dist/viewer/index.js.gz +0 -0
  68. package/dist/viewer/index.mjs +3 -3
  69. package/dist/viewer/index.mjs.br +0 -0
  70. package/dist/viewer/index.mjs.gz +0 -0
  71. package/package.json +3 -3
  72. package/dist/AiChatPanel-EV22O7UO.js.br +0 -0
  73. package/dist/AiChatPanel-EV22O7UO.js.gz +0 -0
  74. package/dist/AiChatPanel-R323KNGN.mjs.br +0 -0
  75. package/dist/AiChatPanel-R323KNGN.mjs.gz +0 -0
  76. package/dist/chunk-KCUXY7DE.mjs.br +0 -0
  77. package/dist/chunk-KCUXY7DE.mjs.gz +0 -0
  78. package/dist/chunk-V4DY4IWP.mjs.br +0 -0
  79. package/dist/chunk-V4DY4IWP.mjs.gz +0 -0
  80. package/dist/chunk-VRX5NJY2.js.br +0 -0
  81. package/dist/chunk-VRX5NJY2.js.gz +0 -0
  82. package/dist/chunk-YJ4DAS4V.js.br +0 -0
  83. package/dist/chunk-YJ4DAS4V.js.gz +0 -0
  84. package/dist/chunk-Z22RD3E2.js.br +0 -0
  85. package/dist/chunk-Z22RD3E2.js.gz +0 -0
  86. package/dist/chunk-ZCGYPCZM.mjs.br +0 -0
  87. package/dist/chunk-ZCGYPCZM.mjs.gz +0 -0
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkZ22RD3E2_js = require('./chunk-Z22RD3E2.js');
3
+ var chunk3TN5SUQR_js = require('./chunk-3TN5SUQR.js');
4
4
  var pptx = require('ooxml-ui/pptx');
5
5
  var React17 = require('react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
@@ -577,14 +577,35 @@ function serializeHistoryDocument(snapshot) {
577
577
  slideId,
578
578
  elements.map(historyElementContent)
579
579
  ])
580
- )
580
+ ),
581
+ // A theme pick that changes nothing on the slides is still an edit, and an undo step.
582
+ theme: snapshot.theme
581
583
  });
582
584
  }
585
+ function withMasterPathsIn(snapshot, paths) {
586
+ const { theme, ...rest } = snapshot;
587
+ if (!theme?.masterThemePaths) {
588
+ return snapshot;
589
+ }
590
+ const { masterThemePaths, ...parts } = theme;
591
+ const kept = Object.entries(masterThemePaths).filter(([path]) => paths.has(path));
592
+ const next = kept.length > 0 ? { ...parts, masterThemePaths: Object.fromEntries(kept) } : parts;
593
+ return Object.keys(next).length > 0 ? { ...rest, theme: next } : rest;
594
+ }
595
+ function differsOnlyInMasterSet(previous, next) {
596
+ const before = Object.keys(previous.theme?.masterThemePaths ?? {});
597
+ const after = new Set(Object.keys(next.theme?.masterThemePaths ?? {}));
598
+ if (before.length === after.size && before.every((path) => after.has(path))) {
599
+ return false;
600
+ }
601
+ const shared = new Set(before.filter((path) => after.has(path)));
602
+ return serializeHistoryDocument(withMasterPathsIn(previous, shared)) === serializeHistoryDocument(withMasterPathsIn(next, shared));
603
+ }
583
604
  function recordExplicitSlideUpdate(history, previous, before, label) {
584
605
  if (previous && serializeHistoryDocument(previous) !== serializeHistoryDocument(before)) {
585
- history.record(chunkZ22RD3E2_js.cloneHistorySnapshot(previous), previous.actionLabel);
606
+ history.record(chunk3TN5SUQR_js.cloneHistorySnapshot(previous), previous.actionLabel);
586
607
  }
587
- history.record({ ...chunkZ22RD3E2_js.cloneHistorySnapshot(before), actionLabel: label }, label);
608
+ history.record({ ...chunk3TN5SUQR_js.cloneHistorySnapshot(before), actionLabel: label }, label);
588
609
  }
589
610
  var POLL_INTERVAL_MS = 16;
590
611
  function usePointerReleaseWakeup(hasActivePointerInteraction) {
@@ -632,6 +653,9 @@ function useEditorHistory(input) {
632
653
  hasActivePointerInteraction,
633
654
  pointerCommitNonce,
634
655
  onDirty,
656
+ theme,
657
+ slideMasters,
658
+ onRestoreTheme,
635
659
  setSlides,
636
660
  setCanvasSize,
637
661
  setActiveSlideIndex,
@@ -658,16 +682,18 @@ function useEditorHistory(input) {
658
682
  }, [history, maxHistoryEntries]);
659
683
  const buildHistorySnapshot = React17.useCallback(
660
684
  (actionLabel) => {
685
+ const recordedTheme = pptx.historyTheme(theme, slideMasters);
661
686
  return {
662
687
  width: canvasSize.width,
663
688
  height: canvasSize.height,
664
689
  activeSlideIndex,
665
- slides: slides.map(chunkZ22RD3E2_js.cloneSlide),
666
- templateElementsBySlideId: chunkZ22RD3E2_js.cloneTemplateElementsBySlideId(templateElementsBySlideId),
690
+ slides: slides.map(chunk3TN5SUQR_js.cloneSlide),
691
+ templateElementsBySlideId: chunk3TN5SUQR_js.cloneTemplateElementsBySlideId(templateElementsBySlideId),
692
+ ...recordedTheme ? { theme: recordedTheme } : {},
667
693
  ...actionLabel ? { actionLabel } : {}
668
694
  };
669
695
  },
670
- [activeSlideIndex, canvasSize, slides, templateElementsBySlideId]
696
+ [activeSlideIndex, canvasSize, slideMasters, slides, templateElementsBySlideId, theme]
671
697
  );
672
698
  const applyHistorySnapshot = React17.useCallback(
673
699
  (snapshot) => {
@@ -676,9 +702,9 @@ function useEditorHistory(input) {
676
702
  width: snapshot.width,
677
703
  height: snapshot.height
678
704
  });
679
- setSlides(snapshot.slides.map(chunkZ22RD3E2_js.cloneSlide));
705
+ setSlides(snapshot.slides.map(chunk3TN5SUQR_js.cloneSlide));
680
706
  setTemplateElementsBySlideId(
681
- chunkZ22RD3E2_js.cloneTemplateElementsBySlideId(snapshot.templateElementsBySlideId)
707
+ chunk3TN5SUQR_js.cloneTemplateElementsBySlideId(snapshot.templateElementsBySlideId)
682
708
  );
683
709
  setActiveSlideIndex(Math.min(snapshot.activeSlideIndex, maxSlideIndex));
684
710
  setSelectedElementIds([]);
@@ -705,47 +731,90 @@ function useEditorHistory(input) {
705
731
  React17.useEffect(() => {
706
732
  onDirtyRef.current = onDirty;
707
733
  }, [onDirty]);
734
+ const untrackedDepthRef = React17.useRef(0);
708
735
  const markDirty = React17.useCallback(() => {
736
+ if (untrackedDepthRef.current > 0) {
737
+ return;
738
+ }
709
739
  setEditCommitNonce((previous) => previous + 1);
710
740
  onDirtyRef.current?.();
711
741
  }, []);
742
+ const onRestoreThemeRef = React17.useRef(onRestoreTheme);
743
+ React17.useEffect(() => {
744
+ onRestoreThemeRef.current = onRestoreTheme;
745
+ }, [onRestoreTheme]);
746
+ const restoreTheme = React17.useCallback(
747
+ (current, target) => {
748
+ const crossed = pptx.crossedHistoryTheme(current.theme, target.theme);
749
+ if (crossed) {
750
+ onRestoreThemeRef.current?.(crossed);
751
+ }
752
+ },
753
+ []
754
+ );
755
+ const withoutUndoStep = React17.useCallback((apply) => {
756
+ untrackedDepthRef.current += 1;
757
+ try {
758
+ apply();
759
+ } finally {
760
+ untrackedDepthRef.current -= 1;
761
+ }
762
+ }, []);
712
763
  const handleUndo = React17.useCallback(() => {
713
764
  if (!history.getSnapshot().canUndo) {
714
765
  return;
715
766
  }
716
- const result = history.undo(buildHistorySnapshot());
767
+ const currentSnapshot = buildHistorySnapshot();
768
+ const result = history.undo(currentSnapshot);
717
769
  if (!result) {
718
770
  return;
719
771
  }
720
772
  isApplyingHistoryRef.current = true;
721
- const nextSnapshot = chunkZ22RD3E2_js.cloneHistorySnapshot(result.snapshot);
722
- lastHistorySnapshotRef.current = chunkZ22RD3E2_js.cloneHistorySnapshot(nextSnapshot);
773
+ const nextSnapshot = chunk3TN5SUQR_js.cloneHistorySnapshot(result.snapshot);
774
+ lastHistorySnapshotRef.current = chunk3TN5SUQR_js.cloneHistorySnapshot(nextSnapshot);
723
775
  lastHistorySerializedRef.current = serializeHistoryDocument(nextSnapshot);
724
776
  applyHistorySnapshot(nextSnapshot);
777
+ restoreTheme(currentSnapshot, nextSnapshot);
725
778
  unlockHistoryTracking();
726
779
  markDirty();
727
- }, [applyHistorySnapshot, buildHistorySnapshot, history, markDirty, unlockHistoryTracking]);
780
+ }, [
781
+ applyHistorySnapshot,
782
+ buildHistorySnapshot,
783
+ history,
784
+ markDirty,
785
+ restoreTheme,
786
+ unlockHistoryTracking
787
+ ]);
728
788
  const handleRedo = React17.useCallback(() => {
729
789
  if (!history.getSnapshot().canRedo) {
730
790
  return;
731
791
  }
732
- const result = history.redo(buildHistorySnapshot());
792
+ const currentSnapshot = buildHistorySnapshot();
793
+ const result = history.redo(currentSnapshot);
733
794
  if (!result) {
734
795
  return;
735
796
  }
736
797
  isApplyingHistoryRef.current = true;
737
- const targetSnapshot = chunkZ22RD3E2_js.cloneHistorySnapshot(result.snapshot);
738
- lastHistorySnapshotRef.current = chunkZ22RD3E2_js.cloneHistorySnapshot(targetSnapshot);
798
+ const targetSnapshot = chunk3TN5SUQR_js.cloneHistorySnapshot(result.snapshot);
799
+ lastHistorySnapshotRef.current = chunk3TN5SUQR_js.cloneHistorySnapshot(targetSnapshot);
739
800
  lastHistorySerializedRef.current = serializeHistoryDocument(targetSnapshot);
740
801
  applyHistorySnapshot(targetSnapshot);
802
+ restoreTheme(currentSnapshot, targetSnapshot);
741
803
  unlockHistoryTracking();
742
804
  markDirty();
743
- }, [applyHistorySnapshot, buildHistorySnapshot, history, markDirty, unlockHistoryTracking]);
805
+ }, [
806
+ applyHistorySnapshot,
807
+ buildHistorySnapshot,
808
+ history,
809
+ markDirty,
810
+ restoreTheme,
811
+ unlockHistoryTracking
812
+ ]);
744
813
  const resetHistory = React17.useCallback(
745
814
  (initialSnapshot) => {
746
815
  history.clear();
747
816
  if (initialSnapshot) {
748
- const clonedInitial = chunkZ22RD3E2_js.cloneHistorySnapshot(initialSnapshot);
817
+ const clonedInitial = chunk3TN5SUQR_js.cloneHistorySnapshot(initialSnapshot);
749
818
  lastHistorySnapshotRef.current = clonedInitial;
750
819
  lastHistorySerializedRef.current = serializeHistoryDocument(clonedInitial);
751
820
  } else {
@@ -792,7 +861,7 @@ function useEditorHistory(input) {
792
861
  return;
793
862
  }
794
863
  const previousSnapshot = lastHistorySnapshotRef.current;
795
- if (!previousSnapshot) {
864
+ if (!previousSnapshot || differsOnlyInMasterSet(previousSnapshot, snapshot)) {
796
865
  lastHistorySnapshotRef.current = snapshot;
797
866
  lastHistorySerializedRef.current = serialized;
798
867
  lastCheapHashRef.current = cheapHash;
@@ -818,11 +887,17 @@ function useEditorHistory(input) {
818
887
  pointerReleaseNonce,
819
888
  slides
820
889
  ]);
821
- const commitSlides = (nextSlides, label, beforeSlides = slides) => {
822
- const before = { ...buildHistorySnapshot(), slides: beforeSlides.map(chunkZ22RD3E2_js.cloneSlide) };
823
- const after = { ...before, slides: nextSlides.map(chunkZ22RD3E2_js.cloneSlide) };
890
+ const commitSlides = (nextSlides, label, beforeSlides = slides, nextSlideMasters) => {
891
+ const before = { ...buildHistorySnapshot(), slides: beforeSlides.map(chunk3TN5SUQR_js.cloneSlide) };
892
+ const { theme: beforeTheme, ...unthemed } = before;
893
+ const afterTheme = nextSlideMasters ? pptx.historyTheme(theme, nextSlideMasters) : beforeTheme;
894
+ const after = {
895
+ ...unthemed,
896
+ slides: nextSlides.map(chunk3TN5SUQR_js.cloneSlide),
897
+ ...afterTheme ? { theme: afterTheme } : {}
898
+ };
824
899
  recordExplicitSlideUpdate(history, lastHistorySnapshotRef.current, before, label);
825
- lastHistorySnapshotRef.current = chunkZ22RD3E2_js.cloneHistorySnapshot(after);
900
+ lastHistorySnapshotRef.current = chunk3TN5SUQR_js.cloneHistorySnapshot(after);
826
901
  lastHistorySerializedRef.current = serializeHistoryDocument(after);
827
902
  isApplyingHistoryRef.current = false;
828
903
  setSlides(nextSlides);
@@ -841,7 +916,9 @@ function useEditorHistory(input) {
841
916
  handleUndo,
842
917
  handleRedo,
843
918
  resetHistory,
919
+ forgetHistory: history.forget,
844
920
  markDirty,
921
+ withoutUndoStep,
845
922
  buildHistorySnapshot
846
923
  };
847
924
  }
@@ -1007,22 +1084,22 @@ function useZoomViewport({
1007
1084
  selectedElements.forEach((element) => {
1008
1085
  minX = Math.min(minX, element.x);
1009
1086
  minY = Math.min(minY, element.y);
1010
- maxX = Math.max(maxX, element.x + Math.max(element.width, chunkZ22RD3E2_js.MIN_ELEMENT_SIZE));
1011
- maxY = Math.max(maxY, element.y + Math.max(element.height, chunkZ22RD3E2_js.MIN_ELEMENT_SIZE));
1087
+ maxX = Math.max(maxX, element.x + Math.max(element.width, chunk3TN5SUQR_js.MIN_ELEMENT_SIZE));
1088
+ maxY = Math.max(maxY, element.y + Math.max(element.height, chunk3TN5SUQR_js.MIN_ELEMENT_SIZE));
1012
1089
  });
1013
1090
  if (!Number.isFinite(minX) || !Number.isFinite(minY) || !Number.isFinite(maxX) || !Number.isFinite(maxY)) {
1014
1091
  return;
1015
1092
  }
1016
1093
  const selectionBounds = { minX, minY, maxX, maxY };
1017
- const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX, chunkZ22RD3E2_js.MIN_ELEMENT_SIZE);
1018
- const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY, chunkZ22RD3E2_js.MIN_ELEMENT_SIZE);
1094
+ const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX, chunk3TN5SUQR_js.MIN_ELEMENT_SIZE);
1095
+ const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY, chunk3TN5SUQR_js.MIN_ELEMENT_SIZE);
1019
1096
  const availableWidth = Math.max(
1020
- effectiveEditorDimensions.width - chunkZ22RD3E2_js.ZOOM_TO_SELECTION_PADDING,
1021
- chunkZ22RD3E2_js.MIN_ELEMENT_SIZE
1097
+ effectiveEditorDimensions.width - chunk3TN5SUQR_js.ZOOM_TO_SELECTION_PADDING,
1098
+ chunk3TN5SUQR_js.MIN_ELEMENT_SIZE
1022
1099
  );
1023
1100
  const availableHeight = Math.max(
1024
- effectiveEditorDimensions.height - chunkZ22RD3E2_js.ZOOM_TO_SELECTION_PADDING,
1025
- chunkZ22RD3E2_js.MIN_ELEMENT_SIZE
1101
+ effectiveEditorDimensions.height - chunk3TN5SUQR_js.ZOOM_TO_SELECTION_PADDING,
1102
+ chunk3TN5SUQR_js.MIN_ELEMENT_SIZE
1026
1103
  );
1027
1104
  const targetEditorScale = Math.min(
1028
1105
  availableWidth / boundsWidth,
@@ -3140,109 +3217,62 @@ function usePresentationAnnotations(input) {
3140
3217
  function useFindReplace({
3141
3218
  slides,
3142
3219
  mode,
3143
- onSetActiveSlideIndex,
3144
- onSetSelectedElementId,
3220
+ onShowMatch,
3145
3221
  onUpdateSlides,
3146
3222
  onMarkDirty,
3147
3223
  keyboard
3148
3224
  }) {
3149
3225
  const [findReplaceOpen, setFindReplaceOpen] = React17.useState(false);
3150
- const [findQuery, setFindQuery] = React17.useState("");
3151
- const [replaceQuery, setReplaceQuery] = React17.useState("");
3152
- const [findMatchCase, setFindMatchCase] = React17.useState(false);
3153
- const [findIncludeNotes, setFindIncludeNotes] = React17.useState(false);
3154
- const [findIncludeChartTitles, setFindIncludeChartTitles] = React17.useState(true);
3155
- const [findIncludeChartData, setFindIncludeChartData] = React17.useState(false);
3156
- const [findResults, setFindResults] = React17.useState([]);
3157
- const [findResultIndex, setFindResultIndex] = React17.useState(-1);
3158
- const pendingRefindRef = React17.useRef(false);
3159
- React17.useEffect(() => {
3160
- if (findReplaceOpen) {
3161
- return;
3162
- }
3163
- setFindResults([]);
3164
- setFindResultIndex(-1);
3165
- pendingRefindRef.current = false;
3166
- }, [findReplaceOpen]);
3167
- const performFind = React17.useCallback(() => {
3168
- const results = pptx.findInSlides(slides, findQuery, {
3169
- matchCase: findMatchCase,
3170
- includeNotes: findIncludeNotes,
3171
- includeChartTitles: findIncludeChartTitles,
3172
- includeChartData: findIncludeChartData
3173
- });
3174
- if (!findQuery) {
3175
- setFindResults([]);
3176
- setFindResultIndex(-1);
3177
- return;
3178
- }
3179
- setFindResults(results);
3180
- setFindResultIndex(results.length > 0 ? 0 : -1);
3181
- if (results.length > 0) {
3182
- onSetActiveSlideIndex(results[0].slideIndex);
3183
- onSetSelectedElementId(results[0].elementId);
3184
- }
3185
- }, [
3186
- slides,
3187
- findQuery,
3188
- findMatchCase,
3189
- findIncludeNotes,
3190
- findIncludeChartTitles,
3191
- findIncludeChartData,
3192
- onSetActiveSlideIndex,
3193
- onSetSelectedElementId
3194
- ]);
3195
- const navigateFindResult = React17.useCallback(
3196
- (direction) => {
3197
- if (findResults.length === 0) {
3198
- return;
3199
- }
3200
- const nextIdx = (findResultIndex + direction + findResults.length) % findResults.length;
3201
- setFindResultIndex(nextIdx);
3202
- const match = findResults[nextIdx];
3203
- if (match) {
3204
- onSetActiveSlideIndex(match.slideIndex);
3205
- onSetSelectedElementId(match.elementId);
3206
- }
3207
- },
3208
- [findResults, findResultIndex, onSetActiveSlideIndex, onSetSelectedElementId]
3209
- );
3210
- const applyReplacements = React17.useCallback(
3211
- (toReplace) => {
3212
- if (toReplace.length === 0) {
3213
- return;
3214
- }
3215
- if (toReplace.some((match) => match.readOnly)) {
3216
- return;
3226
+ const [session, setSession] = React17.useState(pptx.INITIAL_FIND_REPLACE_SESSION);
3227
+ const latest = React17.useRef({ slides, onShowMatch, onUpdateSlides, onMarkDirty });
3228
+ latest.current = { slides, onShowMatch, onUpdateSlides, onMarkDirty };
3229
+ const latestSession = React17.useRef(session);
3230
+ const [actions] = React17.useState(
3231
+ () => pptx.findReplaceSessionActions(
3232
+ {
3233
+ get: () => latestSession.current,
3234
+ set: (next) => {
3235
+ latestSession.current = next;
3236
+ setSession(next);
3237
+ }
3238
+ },
3239
+ {
3240
+ slides: () => latest.current.slides,
3241
+ commit: (next) => {
3242
+ latest.current.onUpdateSlides(() => next);
3243
+ latest.current.onMarkDirty();
3244
+ },
3245
+ navigate: ({ slideIndex, elementId }) => latest.current.onShowMatch(slideIndex, elementId)
3217
3246
  }
3218
- onUpdateSlides(
3219
- (prevSlides) => pptx.applyFindReplacements(prevSlides, toReplace, replaceQuery).slides
3220
- );
3221
- onMarkDirty();
3222
- },
3223
- [replaceQuery, onUpdateSlides, onMarkDirty]
3247
+ )
3224
3248
  );
3225
- const handleReplace = React17.useCallback(() => {
3226
- if (findResults.length === 0 || findResultIndex < 0) {
3227
- return;
3228
- }
3229
- applyReplacements([findResults[findResultIndex]]);
3230
- pendingRefindRef.current = true;
3231
- }, [findResults, findResultIndex, applyReplacements]);
3232
- const handleReplaceAll = React17.useCallback(() => {
3233
- if (findResults.length === 0) {
3234
- return;
3235
- }
3236
- applyReplacements(findResults);
3237
- pendingRefindRef.current = true;
3238
- }, [findResults, applyReplacements]);
3239
3249
  React17.useEffect(() => {
3240
- if (!pendingRefindRef.current) {
3241
- return;
3250
+ if (!findReplaceOpen) {
3251
+ actions.close();
3242
3252
  }
3243
- pendingRefindRef.current = false;
3244
- performFind();
3245
- }, [performFind]);
3253
+ }, [findReplaceOpen, actions]);
3254
+ React17.useEffect(() => {
3255
+ actions.slidesChanged();
3256
+ }, [slides, actions]);
3257
+ const handlers = React17.useMemo(
3258
+ () => ({
3259
+ setFindQuery: (query) => actions.search({ query }),
3260
+ setReplaceQuery: actions.setReplacement,
3261
+ setFindMatchCase: (matchCase) => actions.search({ options: { matchCase } }),
3262
+ setFindIncludeNotes: (includeNotes) => actions.search({ options: { includeNotes } }),
3263
+ setFindIncludeChartTitles: (includeChartTitles) => actions.search({ options: { includeChartTitles } }),
3264
+ setFindIncludeChartData: (includeChartData) => actions.search({ options: { includeChartData } }),
3265
+ performFind: () => actions.search(),
3266
+ navigateFindResult: (direction) => direction > 0 ? actions.next() : actions.previous(),
3267
+ handleReplace: () => {
3268
+ actions.replaceCurrent();
3269
+ },
3270
+ handleReplaceAll: () => {
3271
+ actions.replaceAll();
3272
+ }
3273
+ }),
3274
+ [actions]
3275
+ );
3246
3276
  React17.useEffect(() => {
3247
3277
  const handler = (event) => {
3248
3278
  const { action } = pptx.mapCustomizedEditorKey(
@@ -3265,24 +3295,15 @@ function useFindReplace({
3265
3295
  return {
3266
3296
  findReplaceOpen,
3267
3297
  setFindReplaceOpen,
3268
- findQuery,
3269
- setFindQuery,
3270
- replaceQuery,
3271
- setReplaceQuery,
3272
- findMatchCase,
3273
- setFindMatchCase,
3274
- findIncludeNotes,
3275
- setFindIncludeNotes,
3276
- findIncludeChartTitles,
3277
- findIncludeChartData,
3278
- setFindIncludeChartTitles,
3279
- setFindIncludeChartData,
3280
- findResults,
3281
- findResultIndex,
3282
- performFind,
3283
- navigateFindResult,
3284
- handleReplace,
3285
- handleReplaceAll
3298
+ findQuery: session.query,
3299
+ replaceQuery: session.replacement,
3300
+ findMatchCase: session.options.matchCase,
3301
+ findIncludeNotes: session.options.includeNotes,
3302
+ findIncludeChartTitles: session.options.includeChartTitles,
3303
+ findIncludeChartData: session.options.includeChartData,
3304
+ findResults: session.matches,
3305
+ findResultIndex: session.current,
3306
+ ...handlers
3286
3307
  };
3287
3308
  }
3288
3309
  function useModalDismissDrag(onClose, threshold = 120) {
@@ -3942,6 +3963,35 @@ function useInlineEditingState(onTextChange) {
3942
3963
  registerInlineEditReader
3943
3964
  };
3944
3965
  }
3966
+ function useSlideChangeSelection({
3967
+ setActiveSlideIndex,
3968
+ setSelectedElementId,
3969
+ setSelectedElementIds
3970
+ }) {
3971
+ const slideSelectionRef = React17.useRef(null);
3972
+ const showSlideSelection = React17.useCallback(
3973
+ (slideIndex, elementId) => {
3974
+ slideSelectionRef.current = slideIndex;
3975
+ setActiveSlideIndex(slideIndex);
3976
+ setSelectedElementId(elementId);
3977
+ setSelectedElementIds([]);
3978
+ },
3979
+ [setActiveSlideIndex, setSelectedElementId, setSelectedElementIds]
3980
+ );
3981
+ return { slideSelectionRef, showSlideSelection };
3982
+ }
3983
+ function useClearSelectionOnSlideChange(state, activeSlideIndex) {
3984
+ React17.useEffect(() => {
3985
+ const kept = state.slideSelectionRef.current === activeSlideIndex;
3986
+ state.slideSelectionRef.current = null;
3987
+ state.setInlineEditingElementId(null);
3988
+ if (kept) {
3989
+ return;
3990
+ }
3991
+ state.setSelectedElementId(null);
3992
+ state.setSelectedElementIds([]);
3993
+ }, [activeSlideIndex]);
3994
+ }
3945
3995
  function useSlideState() {
3946
3996
  const [renderedSlides, setRenderedSlides] = React17.useState([]);
3947
3997
  const slidesRef = React17.useRef(renderedSlides);
@@ -3974,13 +4024,18 @@ function useViewerCoreState(_input) {
3974
4024
  const { slides, setSlides, slidesRef } = useSlideState();
3975
4025
  const [templateElementsBySlideId, setTemplateElementsBySlideId] = React17.useState({});
3976
4026
  const [canvasSize, setCanvasSize] = React17.useState({
3977
- width: chunkZ22RD3E2_js.DEFAULT_CANVAS_WIDTH,
3978
- height: chunkZ22RD3E2_js.DEFAULT_CANVAS_HEIGHT
4027
+ width: chunk3TN5SUQR_js.DEFAULT_CANVAS_WIDTH,
4028
+ height: chunk3TN5SUQR_js.DEFAULT_CANVAS_HEIGHT
3979
4029
  });
3980
4030
  const [slideSizeEmu, setSlideSizeEmu] = React17.useState();
3981
4031
  const [activeSlideIndex, setActiveSlideIndex] = React17.useState(0);
3982
4032
  const [selectedElementId, setSelectedElementId] = React17.useState(null);
3983
4033
  const [selectedElementIds, setSelectedElementIds] = React17.useState([]);
4034
+ const slideChangeSelection = useSlideChangeSelection({
4035
+ setActiveSlideIndex,
4036
+ setSelectedElementId,
4037
+ setSelectedElementIds
4038
+ });
3984
4039
  const [isDirty, setIsDirty] = React17.useState(false);
3985
4040
  const autosaveDraftSinkRef = React17.useRef(null);
3986
4041
  const publishInlineText = React17.useCallback(
@@ -4084,6 +4139,7 @@ function useViewerCoreState(_input) {
4084
4139
  setSelectedElementId,
4085
4140
  selectedElementIds,
4086
4141
  setSelectedElementIds,
4142
+ ...slideChangeSelection,
4087
4143
  isDirty,
4088
4144
  setIsDirty,
4089
4145
  editTemplateMode,
@@ -4451,12 +4507,12 @@ function useLoadContent({
4451
4507
  }
4452
4508
  resources.commit();
4453
4509
  handlerRef.current = handler;
4454
- const partition = chunkZ22RD3E2_js.partitionTemplateElements(nextSlides);
4510
+ const partition = chunk3TN5SUQR_js.partitionTemplateElements(nextSlides);
4455
4511
  setSlides(partition.slides);
4456
4512
  setTemplateElementsBySlideId(partition.templateElementsBySlideId);
4457
4513
  setCanvasSize({
4458
- width: parsed.width ?? chunkZ22RD3E2_js.DEFAULT_CANVAS_WIDTH,
4459
- height: parsed.height ?? chunkZ22RD3E2_js.DEFAULT_CANVAS_HEIGHT
4514
+ width: parsed.width ?? chunk3TN5SUQR_js.DEFAULT_CANVAS_WIDTH,
4515
+ height: parsed.height ?? chunk3TN5SUQR_js.DEFAULT_CANVAS_HEIGHT
4460
4516
  });
4461
4517
  setSlideSizeEmu(
4462
4518
  typeof parsed.widthEmu === "number" && typeof parsed.heightEmu === "number" && parsed.widthEmu > 0 && parsed.heightEmu > 0 ? {
@@ -4862,7 +4918,7 @@ function useElementOperations(input) {
4862
4918
  );
4863
4919
  return;
4864
4920
  }
4865
- if (chunkZ22RD3E2_js.isTemplateElementId(elementId)) {
4921
+ if (chunk3TN5SUQR_js.isTemplateElementId(elementId)) {
4866
4922
  const slideId = activeSlide?.id;
4867
4923
  if (slideId) {
4868
4924
  setTemplateElementsBySlideId((prev) => ({
@@ -5148,8 +5204,8 @@ function createCanvasGestures(getInput, frames = animationFrames) {
5148
5204
  }
5149
5205
  function paintResize(resize, transform) {
5150
5206
  const { x, y } = transform;
5151
- const width = Math.max(transform.width, chunkZ22RD3E2_js.MIN_ELEMENT_SIZE);
5152
- const height = Math.max(transform.height, chunkZ22RD3E2_js.MIN_ELEMENT_SIZE);
5207
+ const width = Math.max(transform.width, chunk3TN5SUQR_js.MIN_ELEMENT_SIZE);
5208
+ const height = Math.max(transform.height, chunk3TN5SUQR_js.MIN_ELEMENT_SIZE);
5153
5209
  resize.lastX = x;
5154
5210
  resize.lastY = y;
5155
5211
  resize.lastWidth = transform.width;
@@ -5206,7 +5262,7 @@ function createCanvasGestures(getInput, frames = animationFrames) {
5206
5262
  getGridSize: () => getInput().gridSpacingPx,
5207
5263
  getSnapToShape: () => getInput().snapToShape,
5208
5264
  getGuides: () => getInput().guides.map(({ axis, position }) => ({ axis, position })),
5209
- getMinSize: () => chunkZ22RD3E2_js.MIN_ELEMENT_SIZE,
5265
+ getMinSize: () => chunk3TN5SUQR_js.MIN_ELEMENT_SIZE,
5210
5266
  getSnapExcludeIds: () => armed?.kind === "move" ? Object.keys(armed.drag.startPositionsById) : [],
5211
5267
  getStageOrigin: () => {
5212
5268
  const rect = getInput().canvasStageRef.current?.getBoundingClientRect();
@@ -5287,7 +5343,7 @@ function commitMove(input, drag) {
5287
5343
  const start = drag.startPositionsById[el.id];
5288
5344
  return start ? { ...el, x: start.x + dx, y: start.y + dy } : el;
5289
5345
  });
5290
- return chunkZ22RD3E2_js.applyReroutedConnectors(moved, chunkZ22RD3E2_js.rerouteConnectorsForMovedElements(moved, movedIds));
5346
+ return chunk3TN5SUQR_js.applyReroutedConnectors(moved, chunk3TN5SUQR_js.rerouteConnectorsForMovedElements(moved, movedIds));
5291
5347
  };
5292
5348
  if (input.editTemplateMode) {
5293
5349
  const slideId = input.activeSlide?.id;
@@ -5318,8 +5374,8 @@ function commitResize(input, resize) {
5318
5374
  if (i !== input.activeSlideIndex) {
5319
5375
  return s;
5320
5376
  }
5321
- const rerouted = chunkZ22RD3E2_js.rerouteConnectorsForMovedElements(s.elements, movedIds);
5322
- return rerouted.length === 0 ? s : { ...s, elements: chunkZ22RD3E2_js.applyReroutedConnectors(s.elements, rerouted) };
5377
+ const rerouted = chunk3TN5SUQR_js.rerouteConnectorsForMovedElements(s.elements, movedIds);
5378
+ return rerouted.length === 0 ? s : { ...s, elements: chunk3TN5SUQR_js.applyReroutedConnectors(s.elements, rerouted) };
5323
5379
  })
5324
5380
  );
5325
5381
  }
@@ -6154,7 +6210,7 @@ function createStructuredElementHandlers(deps) {
6154
6210
  return;
6155
6211
  }
6156
6212
  const resolved = resolveHyperlinkEditResult(data);
6157
- if (resolved.url && !chunkZ22RD3E2_js.isUrlSafe(resolved.url)) {
6213
+ if (resolved.url && !chunk3TN5SUQR_js.isUrlSafe(resolved.url)) {
6158
6214
  return;
6159
6215
  }
6160
6216
  const actionClick = {
@@ -6200,7 +6256,7 @@ function createStructuredElementHandlers(deps) {
6200
6256
  if (!activeSlide) {
6201
6257
  return;
6202
6258
  }
6203
- const preset = chunkZ22RD3E2_js.ACTION_BUTTON_PRESETS.find((p) => p.shapeType === shapeType);
6259
+ const preset = chunk3TN5SUQR_js.ACTION_BUTTON_PRESETS.find((p) => p.shapeType === shapeType);
6204
6260
  if (!preset) {
6205
6261
  return;
6206
6262
  }
@@ -6287,7 +6343,7 @@ function useInsertElements(input) {
6287
6343
  width: 300,
6288
6344
  height: 60,
6289
6345
  text: "",
6290
- textStyle: { fontSize: chunkZ22RD3E2_js.DEFAULT_TEXT_FONT_SIZE }
6346
+ textStyle: { fontSize: chunk3TN5SUQR_js.DEFAULT_TEXT_FONT_SIZE }
6291
6347
  });
6292
6348
  };
6293
6349
  const handleAddShape = () => {
@@ -6309,7 +6365,7 @@ function useInsertElements(input) {
6309
6365
  }
6310
6366
  });
6311
6367
  };
6312
- const handleAddTable = (rows = chunkZ22RD3E2_js.DEFAULT_TABLE_ROWS, columns = chunkZ22RD3E2_js.DEFAULT_TABLE_COLUMNS) => {
6368
+ const handleAddTable = (rows = chunk3TN5SUQR_js.DEFAULT_TABLE_ROWS, columns = chunk3TN5SUQR_js.DEFAULT_TABLE_COLUMNS) => {
6313
6369
  if (!activeSlide) {
6314
6370
  return;
6315
6371
  }
@@ -6483,7 +6539,7 @@ function useGroupAlignLayerHandlers(input) {
6483
6539
  history
6484
6540
  } = input;
6485
6541
  const updateElementsOwning = (elementId, updater) => {
6486
- if (editTemplateMode && !chunkZ22RD3E2_js.isTemplateElementId(elementId)) {
6542
+ if (editTemplateMode && !chunk3TN5SUQR_js.isTemplateElementId(elementId)) {
6487
6543
  ops.updateSlides(
6488
6544
  (prev) => prev.map(
6489
6545
  (slide, index) => index === activeSlideIndex ? { ...slide, elements: updater(slide.elements) } : slide
@@ -6517,9 +6573,9 @@ function useGroupAlignLayerHandlers(input) {
6517
6573
  return;
6518
6574
  }
6519
6575
  const group = selectedElement;
6520
- const intoTemplate = chunkZ22RD3E2_js.isTemplateElementId(group.id);
6576
+ const intoTemplate = chunk3TN5SUQR_js.isTemplateElementId(group.id);
6521
6577
  const childIds = group.children.map(
6522
- (child) => intoTemplate ? chunkZ22RD3E2_js.makeCloneId(true, child.id || group.id) : child.id || pptx.generateElementId()
6578
+ (child) => intoTemplate ? chunk3TN5SUQR_js.makeCloneId(true, child.id || group.id) : child.id || pptx.generateElementId()
6523
6579
  );
6524
6580
  const { elements, childIds: usedIds } = pptx.ungroupElements(
6525
6581
  ops.activeElements,
@@ -6891,7 +6947,7 @@ function useSlideManagement(input) {
6891
6947
  async (updated) => {
6892
6948
  const templateElements = await handler.getTemplateElementsForSlide(updated.id).catch(() => []);
6893
6949
  ops.updateSlides((prev) => {
6894
- if (prev[insertAt]?.id !== draft.id) {
6950
+ if (pptx.insertedLayoutCompletion(prev[insertAt], draft) !== "replace") {
6895
6951
  return prev;
6896
6952
  }
6897
6953
  const next = [...prev];
@@ -6955,7 +7011,7 @@ function createTableMergeHandlers(input) {
6955
7011
  if (!nextCell || nextCell.hMerge || nextCell.vMerge) {
6956
7012
  return;
6957
7013
  }
6958
- const newTableData = chunkZ22RD3E2_js.mergeCells(
7014
+ const newTableData = chunk3TN5SUQR_js.mergeCells(
6959
7015
  [
6960
7016
  { row: rowIndex, col: columnIndex },
6961
7017
  { row: rowIndex, col: nextColIdx }
@@ -6963,7 +7019,7 @@ function createTableMergeHandlers(input) {
6963
7019
  td
6964
7020
  );
6965
7021
  const updates = { tableData: newTableData };
6966
- const newRawXml = chunkZ22RD3E2_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
7022
+ const newRawXml = chunk3TN5SUQR_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
6967
7023
  if (newRawXml) {
6968
7024
  updates.rawXml = newRawXml;
6969
7025
  }
@@ -6989,7 +7045,7 @@ function createTableMergeHandlers(input) {
6989
7045
  if (!targetNextCell || targetNextCell.hMerge || targetNextCell.vMerge) {
6990
7046
  return;
6991
7047
  }
6992
- const newTableData = chunkZ22RD3E2_js.mergeCells(
7048
+ const newTableData = chunk3TN5SUQR_js.mergeCells(
6993
7049
  [
6994
7050
  { row: rowIndex, col: columnIndex },
6995
7051
  { row: targetNextRowIdx, col: columnIndex }
@@ -6997,7 +7053,7 @@ function createTableMergeHandlers(input) {
6997
7053
  td
6998
7054
  );
6999
7055
  const updates = { tableData: newTableData };
7000
- const newRawXml = chunkZ22RD3E2_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
7056
+ const newRawXml = chunk3TN5SUQR_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
7001
7057
  if (newRawXml) {
7002
7058
  updates.rawXml = newRawXml;
7003
7059
  }
@@ -7012,9 +7068,9 @@ function createTableMergeHandlers(input) {
7012
7068
  return;
7013
7069
  }
7014
7070
  const td = selectedElement.tableData;
7015
- const newTableData = chunkZ22RD3E2_js.mergeCells(ts.selectedCells, td);
7071
+ const newTableData = chunk3TN5SUQR_js.mergeCells(ts.selectedCells, td);
7016
7072
  const updates = { tableData: newTableData };
7017
- const newRawXml = chunkZ22RD3E2_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
7073
+ const newRawXml = chunk3TN5SUQR_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
7018
7074
  if (newRawXml) {
7019
7075
  updates.rawXml = newRawXml;
7020
7076
  }
@@ -7031,9 +7087,9 @@ function createTableMergeHandlers(input) {
7031
7087
  }
7032
7088
  const { rowIndex, columnIndex } = ts;
7033
7089
  const td = selectedElement.tableData;
7034
- const newTableData = chunkZ22RD3E2_js.splitCell(rowIndex, columnIndex, td);
7090
+ const newTableData = chunk3TN5SUQR_js.splitCell(rowIndex, columnIndex, td);
7035
7091
  const updates = { tableData: newTableData };
7036
- const newRawXml = chunkZ22RD3E2_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
7092
+ const newRawXml = chunk3TN5SUQR_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
7037
7093
  if (newRawXml) {
7038
7094
  updates.rawXml = newRawXml;
7039
7095
  }
@@ -7068,7 +7124,7 @@ function createTableStructHandlers(input) {
7068
7124
  updates.tableData = pptx.setCellText(el, rowIndex, colIndex, text).tableData;
7069
7125
  }
7070
7126
  if (el.rawXml) {
7071
- const newRawXml = chunkZ22RD3E2_js.updateCellTextInRawXml(el, rowIndex, colIndex, text);
7127
+ const newRawXml = chunk3TN5SUQR_js.updateCellTextInRawXml(el, rowIndex, colIndex, text);
7072
7128
  if (newRawXml) {
7073
7129
  updates.rawXml = newRawXml;
7074
7130
  }
@@ -7092,7 +7148,7 @@ function createTableStructHandlers(input) {
7092
7148
  const { rowIndex, columnIndex: colIndex } = ts;
7093
7149
  const updates = {};
7094
7150
  if (selectedElement.rawXml) {
7095
- const newRawXml = chunkZ22RD3E2_js.updateCellTextStyleInRawXml(
7151
+ const newRawXml = chunk3TN5SUQR_js.updateCellTextStyleInRawXml(
7096
7152
  selectedElement,
7097
7153
  rowIndex,
7098
7154
  colIndex,
@@ -7270,7 +7326,7 @@ function useExportSaveAs(input) {
7270
7326
  const sourceName = filePath ? filePath.replace(/\\/gu, "/").split("/").pop() : void 0;
7271
7327
  const slideSize = pptx.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size;
7272
7328
  const data = {
7273
- slides: chunkZ22RD3E2_js.buildSaveSlides(slides, templateElementsBySlideId),
7329
+ slides: chunk3TN5SUQR_js.buildSaveSlides(slides, templateElementsBySlideId),
7274
7330
  width: canvasSize.width,
7275
7331
  height: canvasSize.height,
7276
7332
  widthEmu: slideSize.widthEmu,
@@ -7411,28 +7467,29 @@ async function copySlideToClipboard(slideElement, options = {}) {
7411
7467
  const blob = await exportSlideToPngBlob(slideElement, options);
7412
7468
  await navigator.clipboard.write([new ClipboardItem({ "image/png": blob })]);
7413
7469
  }
7414
- async function captureAllSlidesAsPngDataUrls(slideStageRef, totalSlides, setActiveSlide, currentSlideIndex, options = {}) {
7470
+ async function captureSlidesAsPngDataUrls(slideStageRef, slideIndices, setActiveSlide, currentSlideIndex, options = {}) {
7415
7471
  const { scale = 2, onProgress } = options;
7416
- const dataUrls = [];
7417
- for (let i = 0; i < totalSlides; i++) {
7418
- onProgress?.(i, totalSlides);
7419
- setActiveSlide(i);
7472
+ const total = slideIndices.length;
7473
+ const captures = [];
7474
+ for (const [position, slideIndex] of slideIndices.entries()) {
7475
+ onProgress?.(position, total);
7476
+ setActiveSlide(slideIndex);
7420
7477
  await waitForRender(150);
7421
7478
  const stageEl = slideStageRef.current;
7422
7479
  if (!stageEl) {
7423
- console.warn(`[export] Could not find slide stage element for slide ${i}`);
7480
+ console.warn(`[export] Could not find slide stage element for slide ${slideIndex}`);
7424
7481
  continue;
7425
7482
  }
7426
7483
  const { canvas } = await renderElementToTiledCanvas(stageEl, scale);
7427
- dataUrls.push(canvas.toDataURL("image/png"));
7484
+ captures.push({ slideIndex, dataUrl: canvas.toDataURL("image/png") });
7428
7485
  }
7429
- onProgress?.(totalSlides, totalSlides);
7486
+ onProgress?.(total, total);
7430
7487
  setActiveSlide(currentSlideIndex);
7431
- return dataUrls;
7488
+ return captures;
7432
7489
  }
7433
7490
  function tilesToPdfPage(tilesResult) {
7434
7491
  return tilesResult.tiles.map((tile) => ({
7435
- image: chunkZ22RD3E2_js.canvasToJpegData(tile.canvas),
7492
+ image: chunk3TN5SUQR_js.canvasToJpegData(tile.canvas),
7436
7493
  placement: pptx.placeTileOnPage(
7437
7494
  tile,
7438
7495
  tilesResult.fullWidth,
@@ -7465,7 +7522,7 @@ async function exportAllSlidesAsPdf(slideStageRef, totalSlides, setActiveSlide,
7465
7522
  if (pages.length === 0) {
7466
7523
  throw new Error(i18n.translationsEn["pptx.export.errorNoSlidesPdf"]);
7467
7524
  }
7468
- const pdfBlobUrl = chunkZ22RD3E2_js.buildPdfFromTiledImageData(pages);
7525
+ const pdfBlobUrl = chunk3TN5SUQR_js.buildPdfFromTiledImageData(pages);
7469
7526
  pptx.downloadDataUrl(pdfBlobUrl, filename);
7470
7527
  }
7471
7528
  async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSlide, currentSlideIndex, slideNotes, filename = "presentation-notes.pdf", options = {}) {
@@ -7495,7 +7552,7 @@ async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSl
7495
7552
  if (pages.length === 0) {
7496
7553
  throw new Error(i18n.translationsEn["pptx.export.errorNoSlidesNotesPdf"]);
7497
7554
  }
7498
- const pdfDataUrl = chunkZ22RD3E2_js.buildNotesPdf(pages);
7555
+ const pdfDataUrl = chunk3TN5SUQR_js.buildNotesPdf(pages);
7499
7556
  pptx.downloadDataUrl(pdfDataUrl, filename);
7500
7557
  }
7501
7558
  async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide, currentSlideIndex, options = {}) {
@@ -7668,35 +7725,12 @@ function injectFontFaces(svg, fontFaces) {
7668
7725
  }
7669
7726
  return `${svg.slice(0, closingBracket + 1)}<defs>${styleBlock}</defs>${svg.slice(closingBracket + 1)}`;
7670
7727
  }
7671
- function exportAllSlidesToSvg(data, options = {}) {
7672
- const { onProgress, embedFonts, fontFaces } = options;
7673
- const svgOptions = {
7674
- includeHidden: options.includeHidden,
7675
- slideIndices: options.slideIndices,
7676
- defaultFontFamily: options.defaultFontFamily,
7677
- defaultFontSize: options.defaultFontSize
7678
- };
7679
- const results = [];
7680
- const includeHidden = svgOptions.includeHidden ?? false;
7681
- let processedCount = 0;
7682
- for (let i = 0; i < data.slides.length; i++) {
7683
- if (svgOptions.slideIndices && !svgOptions.slideIndices.includes(i)) {
7684
- continue;
7685
- }
7686
- const slide = data.slides[i];
7687
- if (slide.hidden && !includeHidden) {
7688
- continue;
7689
- }
7690
- onProgress?.(processedCount, data.slides.length);
7691
- let svg = pptx$1.SvgExporter.exportSlide(slide, data.width, data.height, svgOptions);
7692
- if (embedFonts && fontFaces?.length) {
7693
- svg = injectFontFaces(svg, fontFaces);
7694
- }
7695
- results.push(svg);
7696
- processedCount++;
7728
+ function exportSlideToSvg(slide, width, height, options = {}) {
7729
+ let svg = pptx$1.SvgExporter.exportSlide(slide, width, height, options);
7730
+ if (options.embedFonts && options.fontFaces?.length) {
7731
+ svg = injectFontFaces(svg, options.fontFaces);
7697
7732
  }
7698
- onProgress?.(processedCount, data.slides.length);
7699
- return results;
7733
+ return svg;
7700
7734
  }
7701
7735
  function safePrompt(message, defaultValue) {
7702
7736
  try {
@@ -8105,161 +8139,95 @@ function useViewerOptionsContext() {
8105
8139
  }
8106
8140
 
8107
8141
  // src/viewer/hooks/usePrintHandlers.ts
8142
+ var BLOCKED_WARNING = "[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print.";
8108
8143
  function usePrintHandlers(input) {
8109
- const { slides, activeSlideIndex, canvasStageRef, setActiveSlideIndex, pptxData } = input;
8144
+ const { slides, activeSlideIndex, canvasStageRef, setActiveSlideIndex, canvasSize } = input;
8145
+ const handoutMaster = input.handoutMaster ?? input.pptxData?.handoutMaster;
8110
8146
  const [isPrintDialogOpen, setIsPrintDialogOpen] = React17.useState(false);
8111
- const { t } = chunkZ22RD3E2_js.useTranslation();
8147
+ const { t } = chunk3TN5SUQR_js.useTranslation();
8112
8148
  const viewerOptions = useViewerOptionsContext();
8113
- const includeHiddenSlides = viewerOptions.advanced.printHiddenSlides;
8114
8149
  const printRasterScale = (viewerOptions.advanced.printHighQuality ? 4 : 3) * pptx.resolveImageResolutionScale(viewerOptions);
8115
8150
  const handlePrint = () => {
8116
8151
  setIsPrintDialogOpen(true);
8117
8152
  };
8118
- const handlePrintSvg = async (settings) => {
8119
- setIsPrintDialogOpen(false);
8120
- const printWindow = pptx.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
8121
- if (!printWindow) {
8122
- console.warn(
8123
- "[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
8124
- );
8125
- return;
8126
- }
8127
- if (!pptxData || settings.printWhat !== "slides") {
8128
- return runRasterPrint(printWindow, settings);
8129
- }
8130
- const colorFilter = pptx.computeColorFilter(settings.colorMode);
8131
- const slideIndices = pptx.filterHiddenSlideIndices(
8132
- pptx.computeSlideIndices(
8133
- settings.slideRange,
8134
- activeSlideIndex,
8135
- slides.length,
8136
- settings.customRangeFrom,
8137
- settings.customRangeTo
8138
- ),
8139
- slides,
8140
- includeHiddenSlides
8141
- );
8142
- try {
8143
- const svgs = exportAllSlidesToSvg(pptxData, {
8144
- slideIndices
8145
- });
8146
- if (svgs.length === 0) {
8147
- printWindow.close();
8148
- return;
8149
- }
8150
- const printDoc = pptx.buildPrintDocument(svgs, pptxData.width, pptxData.height, {
8151
- title: "Slides (Vector)",
8152
- orientation: settings.orientation,
8153
- colorFilter,
8154
- scaleToFit: settings.scaleToFit
8155
- });
8156
- pptx.finishPrintWindow(printWindow, printDoc);
8157
- } catch (err) {
8158
- console.warn("[PowerPointViewer] SVG print path failed, falling back to raster:", err);
8159
- return runRasterPrint(printWindow, settings);
8160
- }
8161
- };
8162
- const runRasterPrint = async (printWindow, settings) => {
8163
- const colorFilter = pptx.computeColorFilter(settings.colorMode);
8164
- const slideIndices = pptx.filterHiddenSlideIndices(
8165
- pptx.computeSlideIndices(
8166
- settings.slideRange,
8167
- activeSlideIndex,
8168
- slides.length,
8169
- settings.customRangeFrom,
8170
- settings.customRangeTo
8171
- ),
8172
- slides,
8173
- includeHiddenSlides
8174
- );
8175
- if (settings.printWhat === "outline") {
8176
- pptx.finishPrintWindow(
8177
- printWindow,
8178
- pptx.buildPrintHtmlDocument({
8179
- title: "Outline",
8180
- bodyHtml: `<div class="outline-page">${pptx.buildOutlineHtml(slideIndices, slides)}</div>`,
8181
- orientation: settings.orientation,
8182
- colorFilter,
8183
- frameSlides: settings.frameSlides,
8184
- scaleToFit: settings.scaleToFit
8185
- })
8186
- );
8187
- return;
8188
- }
8153
+ const deckSlides = () => input.templateElementsBySlideId ? chunk3TN5SUQR_js.buildSaveSlides(slides, input.templateElementsBySlideId) : slides;
8154
+ const plan = (settings, deck) => pptx.planPrintJob(settings, {
8155
+ slides: deck,
8156
+ activeSlideIndex,
8157
+ // Options > Advanced > "Print hidden slides".
8158
+ includeHiddenSlides: viewerOptions.advanced.printHiddenSlides
8159
+ });
8160
+ const title = (job) => t(job.title.key, job.title.params);
8161
+ const runRasterPrint = async (printWindow, job, deck) => {
8189
8162
  try {
8190
8163
  if (!canvasStageRef.current) {
8191
8164
  printWindow.close();
8192
8165
  return;
8193
8166
  }
8194
- const allImages = await captureAllSlidesAsPngDataUrls(
8167
+ const captures = await captureSlidesAsPngDataUrls(
8195
8168
  canvasStageRef,
8196
- slides.length,
8169
+ job.slideIndices,
8197
8170
  setActiveSlideIndex,
8198
8171
  activeSlideIndex,
8199
8172
  { scale: printRasterScale }
8200
8173
  );
8201
- if (allImages.length === 0) {
8174
+ if (captures.length === 0) {
8202
8175
  printWindow.close();
8203
8176
  return;
8204
8177
  }
8205
- const slideImages = slideIndices.map((idx) => allImages[idx]).filter(Boolean);
8206
- if (settings.printWhat === "slides") {
8207
- pptx.finishPrintWindow(
8208
- printWindow,
8209
- pptx.buildPrintHtmlDocument({
8210
- title: "Slides",
8211
- bodyHtml: pptx.buildSlidesHtml(slideImages, slideIndices),
8212
- orientation: settings.orientation,
8213
- colorFilter,
8214
- frameSlides: settings.frameSlides,
8215
- scaleToFit: settings.scaleToFit
8216
- })
8217
- );
8218
- return;
8219
- }
8220
- if (settings.printWhat === "notes") {
8221
- pptx.finishPrintWindow(
8222
- printWindow,
8223
- pptx.buildPrintHtmlDocument({
8224
- title: "Notes Pages",
8225
- bodyHtml: pptx.buildNotesHtml(slideImages, slideIndices, slides),
8226
- orientation: "portrait",
8227
- colorFilter,
8228
- frameSlides: settings.frameSlides,
8229
- scaleToFit: settings.scaleToFit
8230
- })
8231
- );
8232
- return;
8233
- }
8234
- if (settings.printWhat === "handouts") {
8235
- const spp = settings.slidesPerPage;
8236
- pptx.finishPrintWindow(
8237
- printWindow,
8238
- pptx.buildPrintHtmlDocument({
8239
- title: `Handout ${spp} per page`,
8240
- bodyHtml: pptx.buildHandoutsHtml(slideImages, slideIndices, spp, pptxData?.handoutMaster),
8241
- orientation: "portrait",
8242
- colorFilter,
8243
- frameSlides: settings.frameSlides,
8244
- scaleToFit: settings.scaleToFit
8245
- })
8246
- );
8247
- }
8178
+ pptx.finishPrintWindow(
8179
+ printWindow,
8180
+ pptx.buildRasterPrintJobDocument(job, title(job), captures, deck, handoutMaster)
8181
+ );
8248
8182
  } catch (err) {
8249
8183
  console.error("[PowerPointViewer] Print layout failed:", err);
8184
+ printWindow.close();
8250
8185
  }
8251
8186
  };
8252
- const handlePrintWithSettings = async (settings) => {
8253
- setIsPrintDialogOpen(false);
8187
+ const openNow = (html) => {
8188
+ if (!pptx.openPrintWindow(html)) {
8189
+ console.warn(BLOCKED_WARNING);
8190
+ }
8191
+ };
8192
+ const startRasterPrint = async (job, deck) => {
8254
8193
  const printWindow = pptx.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
8255
8194
  if (!printWindow) {
8256
- console.warn(
8257
- "[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
8195
+ console.warn(BLOCKED_WARNING);
8196
+ return;
8197
+ }
8198
+ await runRasterPrint(printWindow, job, deck);
8199
+ };
8200
+ const vectorDocument = (job, deck) => {
8201
+ try {
8202
+ const svgs = job.slideIndices.map(
8203
+ (index) => exportSlideToSvg(deck[index], canvasSize.width, canvasSize.height)
8258
8204
  );
8205
+ return pptx.buildVectorPrintJobDocument(job, title(job), svgs, canvasSize);
8206
+ } catch (err) {
8207
+ console.warn("[PowerPointViewer] SVG print path failed, falling back to raster:", err);
8208
+ return void 0;
8209
+ }
8210
+ };
8211
+ const runPrintJob = async (settings, vector) => {
8212
+ setIsPrintDialogOpen(false);
8213
+ const deck = deckSlides();
8214
+ const job = plan(settings, deck);
8215
+ if (!job.ok) {
8216
+ return;
8217
+ }
8218
+ if (job.output === "outline") {
8219
+ openNow(pptx.buildOutlinePrintJobDocument(job, title(job), deck));
8220
+ return;
8221
+ }
8222
+ const html = vector && job.output === "vector" ? vectorDocument(job, deck) : void 0;
8223
+ if (html !== void 0) {
8224
+ openNow(html);
8259
8225
  return;
8260
8226
  }
8261
- return runRasterPrint(printWindow, settings);
8227
+ await startRasterPrint(pptx.printJobRasterFallback(job), deck);
8262
8228
  };
8229
+ const handlePrintSvg = (settings) => runPrintJob(settings, true);
8230
+ const handlePrintWithSettings = (settings) => runPrintJob(settings, false);
8263
8231
  return {
8264
8232
  handlePrint,
8265
8233
  handlePrintWithSettings,
@@ -8268,6 +8236,27 @@ function usePrintHandlers(input) {
8268
8236
  setIsPrintDialogOpen
8269
8237
  };
8270
8238
  }
8239
+ async function applyThemePartInPlace(input, themePath, applyToAllMasters) {
8240
+ const change = await pptx.applyThemeByPath(input.handlerRef.current, {
8241
+ themePath,
8242
+ applyToAllMasters,
8243
+ slides: input.slides,
8244
+ slideMasters: input.slideMasters,
8245
+ theme: input.theme,
8246
+ templateElementsBySlideId: input.templateElementsBySlideId
8247
+ });
8248
+ if (!change) {
8249
+ return;
8250
+ }
8251
+ input.bumpHistory();
8252
+ input.setSlides(change.slides);
8253
+ input.setTemplateElementsBySlideId(change.templateElementsBySlideId);
8254
+ input.setSlideMasters(change.slideMasters);
8255
+ if (change.deckTheme) {
8256
+ input.setTheme(change.deckTheme.theme);
8257
+ }
8258
+ input.history.markDirty();
8259
+ }
8271
8260
  async function applyThemeEditorEdit(input, { colorScheme, fontScheme, name }) {
8272
8261
  const {
8273
8262
  handlerRef,
@@ -8282,7 +8271,7 @@ async function applyThemeEditorEdit(input, { colorScheme, fontScheme, name }) {
8282
8271
  if (!handler) {
8283
8272
  return;
8284
8273
  }
8285
- await handler.applyTheme(colorScheme, fontScheme, name);
8274
+ await pptx.queueThemeWrite(handler, () => handler.applyTheme(colorScheme, fontScheme, name));
8286
8275
  const previousMap = theme?.colorScheme ? pptx$1.buildThemeColorMap(theme.colorScheme) : {};
8287
8276
  bumpHistory();
8288
8277
  setSlides(
@@ -8308,14 +8297,27 @@ async function applyThemeEditorEdit(input, { colorScheme, fontScheme, name }) {
8308
8297
  setTheme((prev) => ({ ...prev, colorScheme, fontScheme, name }));
8309
8298
  history.markDirty();
8310
8299
  }
8300
+ function restoreHistoryTheme(input, target) {
8301
+ const masters = input.slideMasters;
8302
+ const current = pptx.historyTheme(input.theme, masters);
8303
+ input.setTheme((prev) => pptx.withHistoryTheme(prev, target));
8304
+ if (target.masterThemePaths) {
8305
+ input.setSlideMasters(
8306
+ (prev) => pptx.withHistoryMasterThemes(prev, target)
8307
+ );
8308
+ }
8309
+ return pptx.writeThemeParts(
8310
+ input.handlerRef.current,
8311
+ current,
8312
+ target,
8313
+ pptx.loadedThemeName(input.themeOptions, input.slideMasters)
8314
+ );
8315
+ }
8311
8316
 
8312
8317
  // src/viewer/hooks/useThemeHandlers.ts
8313
8318
  function useThemeHandlers(input) {
8314
8319
  const {
8315
8320
  handlerRef,
8316
- serializeSlides,
8317
- setContent,
8318
- onContentChange,
8319
8321
  setTheme,
8320
8322
  setSlideMasters,
8321
8323
  slideMasters,
@@ -8326,36 +8328,13 @@ function useThemeHandlers(input) {
8326
8328
  theme,
8327
8329
  bumpHistory
8328
8330
  } = input;
8329
- const refreshContentAfterThemeChange = async () => {
8330
- const updated = await serializeSlides();
8331
- if (!updated) {
8332
- return;
8333
- }
8334
- setContent(updated);
8335
- if (onContentChange) {
8336
- onContentChange(updated);
8337
- }
8338
- history.markDirty();
8339
- };
8340
- const handleApplyTheme = async (themePath, applyToAllMasters) => {
8341
- const handler = handlerRef.current;
8342
- if (!handler) {
8343
- return;
8344
- }
8345
- await handler.setPresentationTheme(themePath, applyToAllMasters);
8346
- setSlideMasters(
8347
- (prev) => prev.map(
8348
- (master, index) => applyToAllMasters || index === 0 ? { ...master, themePath } : master
8349
- )
8350
- );
8351
- await refreshContentAfterThemeChange();
8352
- };
8331
+ const handleApplyTheme = (themePath, applyToAllMasters) => applyThemePartInPlace(input, themePath, applyToAllMasters);
8353
8332
  const handleUpdateThemeColorScheme = async (colorScheme) => {
8354
8333
  const handler = handlerRef.current;
8355
8334
  if (!handler) {
8356
8335
  return;
8357
8336
  }
8358
- await handler.updateThemeColorScheme(colorScheme);
8337
+ await pptx.queueThemeWrite(handler, () => handler.updateThemeColorScheme(colorScheme));
8359
8338
  const previousMap = theme?.colorScheme ? pptx$1.buildThemeColorMap(theme.colorScheme) : {};
8360
8339
  setSlides((prev) => pptx$1.reResolveSlideColors(prev, previousMap, colorScheme));
8361
8340
  if (Object.keys(templateElementsBySlideId).length > 0) {
@@ -8376,7 +8355,7 @@ function useThemeHandlers(input) {
8376
8355
  if (!handler) {
8377
8356
  return;
8378
8357
  }
8379
- await handler.updateThemeFontScheme(fontScheme);
8358
+ await pptx.queueThemeWrite(handler, () => handler.updateThemeFontScheme(fontScheme));
8380
8359
  const previousFonts = theme?.fontScheme;
8381
8360
  bumpHistory();
8382
8361
  setSlides((prev) => pptx$1.reResolveSlideFonts(prev, previousFonts, fontScheme));
@@ -8396,20 +8375,15 @@ function useThemeHandlers(input) {
8396
8375
  if (!handler) {
8397
8376
  return;
8398
8377
  }
8399
- await handler.updateThemeName(name);
8378
+ await pptx.queueThemeWrite(handler, () => handler.updateThemeName(name));
8400
8379
  setTheme((prev) => prev ? { ...prev, name } : { name });
8401
8380
  history.markDirty();
8402
8381
  };
8403
8382
  const handleApplyThemeToPresentation = async () => {
8404
- const handler = handlerRef.current;
8405
- if (!handler) {
8406
- return;
8407
- }
8408
8383
  const primaryThemePath = slideMasters[0]?.themePath;
8409
8384
  if (primaryThemePath) {
8410
- await handler.setPresentationTheme(primaryThemePath, true);
8385
+ await applyThemePartInPlace(input, primaryThemePath, true);
8411
8386
  }
8412
- await refreshContentAfterThemeChange();
8413
8387
  };
8414
8388
  const handleApplyThemeData = (colorScheme, fontScheme, themeName) => applyThemeEditorEdit(input, { colorScheme, fontScheme, name: themeName ?? theme?.name ?? "" });
8415
8389
  const handleSetTemplateBackground = (path, backgroundColor) => {
@@ -8437,16 +8411,9 @@ function useThemeHandlers(input) {
8437
8411
  }
8438
8412
  return handler.getAvailableThemes();
8439
8413
  };
8440
- const handleSwitchTheme = async (themePath) => {
8441
- const handler = handlerRef.current;
8442
- if (!handler) {
8443
- return;
8444
- }
8445
- await handler.setPresentationTheme(themePath, true);
8446
- setSlideMasters((prev) => prev.map((master) => ({ ...master, themePath })));
8447
- await refreshContentAfterThemeChange();
8448
- };
8414
+ const handleSwitchTheme = (themePath) => applyThemePartInPlace(input, themePath, true);
8449
8415
  const handleApplyThemeEdit = (edit) => applyThemeEditorEdit(input, edit);
8416
+ const handleRestoreHistoryTheme = (target) => restoreHistoryTheme(input, target);
8450
8417
  return {
8451
8418
  handleApplyThemeEdit,
8452
8419
  handleApplyTheme,
@@ -8455,6 +8422,7 @@ function useThemeHandlers(input) {
8455
8422
  handleUpdateThemeName,
8456
8423
  handleApplyThemeToPresentation,
8457
8424
  handleApplyThemeData,
8425
+ handleRestoreHistoryTheme,
8458
8426
  handleSetTemplateBackground,
8459
8427
  handleGetTemplateBackgroundColor,
8460
8428
  handleGetAvailableThemes,
@@ -8596,7 +8564,7 @@ function usePropertyHandlers(input) {
8596
8564
  width: canvasSize.width,
8597
8565
  height: canvasSize.height
8598
8566
  };
8599
- setCompareResult(chunkZ22RD3E2_js.comparePresentation(cur, other));
8567
+ setCompareResult(chunk3TN5SUQR_js.comparePresentation(cur, other));
8600
8568
  setIsComparePanelOpen(true);
8601
8569
  } catch (err) {
8602
8570
  console.warn("Compare failed:", err);
@@ -8952,7 +8920,7 @@ function useViewerDialogs(input) {
8952
8920
  };
8953
8921
  }
8954
8922
  function computeGridSpacingPx(documentGridSpacing) {
8955
- return pptx.computeGridSpacingPx(documentGridSpacing, chunkZ22RD3E2_js.GRID_SIZE);
8923
+ return pptx.computeGridSpacingPx(documentGridSpacing, chunk3TN5SUQR_js.GRID_SIZE);
8956
8924
  }
8957
8925
  function computeVisibleSlideIndexes(slides, activeCustomShowId, customShows, presentationProperties) {
8958
8926
  const activeShow = activeCustomShowId ? customShows.find((show) => show.id === activeCustomShowId) : void 0;
@@ -8961,7 +8929,7 @@ function computeVisibleSlideIndexes(slides, activeCustomShowId, customShows, pre
8961
8929
  }
8962
8930
  function computeSlideSectionGroups(slides, sections) {
8963
8931
  return pptx.groupSlidesBySection(sections, slides).map((group) => ({
8964
- id: group.section?.id ?? (sections.length > 0 ? chunkZ22RD3E2_js.UNGROUPED_SECTION_ID : chunkZ22RD3E2_js.DEFAULT_SECTION_GROUP_ID),
8932
+ id: group.section?.id ?? (sections.length > 0 ? chunk3TN5SUQR_js.UNGROUPED_SECTION_ID : chunk3TN5SUQR_js.DEFAULT_SECTION_GROUP_ID),
8965
8933
  label: group.section?.name ?? (sections.length > 0 ? "Ungrouped Slides" : "Slides"),
8966
8934
  slideIndexes: group.slideIndexes,
8967
8935
  ...group.section?.color !== void 0 ? { color: group.section.color } : {},
@@ -8980,7 +8948,7 @@ function computeMasterPseudoSlide(mode, activeLayout, activeMaster) {
8980
8948
  });
8981
8949
  }
8982
8950
  function useDerivedSlideState(input) {
8983
- const { t } = chunkZ22RD3E2_js.useTranslation();
8951
+ const { t } = chunk3TN5SUQR_js.useTranslation();
8984
8952
  const {
8985
8953
  slides,
8986
8954
  sections,
@@ -9006,10 +8974,10 @@ function useDerivedSlideState(input) {
9006
8974
  );
9007
8975
  const slideSectionGroups = React17.useMemo(
9008
8976
  () => computeSlideSectionGroups(slides, sections).map((group) => {
9009
- if (group.id === chunkZ22RD3E2_js.UNGROUPED_SECTION_ID && group.label === "Ungrouped Slides") {
8977
+ if (group.id === chunk3TN5SUQR_js.UNGROUPED_SECTION_ID && group.label === "Ungrouped Slides") {
9010
8978
  return { ...group, label: t("pptx.slides.ungroupedSlides") };
9011
8979
  }
9012
- if (group.id === chunkZ22RD3E2_js.DEFAULT_SECTION_GROUP_ID && group.label === "Slides") {
8980
+ if (group.id === chunk3TN5SUQR_js.DEFAULT_SECTION_GROUP_ID && group.label === "Slides") {
9013
8981
  return { ...group, label: t("pptx.sections.slides") };
9014
8982
  }
9015
8983
  return group;
@@ -9116,7 +9084,7 @@ function useAnnotationHandlers(input) {
9116
9084
  if (nextMode === "present") {
9117
9085
  presentation.enterPresentMode();
9118
9086
  } else if (mode === "present" && annotations.hasAnyAnnotations) {
9119
- chunkZ22RD3E2_js.stopAllPersistentAudio();
9087
+ chunk3TN5SUQR_js.stopAllPersistentAudio();
9120
9088
  if (promptKeepInkAnnotations) {
9121
9089
  pendingModeAfterAnnotationsRef.current = nextMode;
9122
9090
  setShowKeepAnnotationsDialog(true);
@@ -9126,7 +9094,7 @@ function useAnnotationHandlers(input) {
9126
9094
  }
9127
9095
  } else {
9128
9096
  if (mode === "present") {
9129
- chunkZ22RD3E2_js.stopAllPersistentAudio();
9097
+ chunk3TN5SUQR_js.stopAllPersistentAudio();
9130
9098
  }
9131
9099
  setMode(nextMode);
9132
9100
  }
@@ -9293,7 +9261,7 @@ function useSerialize(input) {
9293
9261
  guides: pptxGuides.length > 0 ? pptxGuides : void 0
9294
9262
  };
9295
9263
  });
9296
- const slidesToSave = chunkZ22RD3E2_js.buildSaveSlides(slidesWithGuides, pending.templateElementsBySlideId);
9264
+ const slidesToSave = chunk3TN5SUQR_js.buildSaveSlides(slidesWithGuides, pending.templateElementsBySlideId);
9297
9265
  const saveOptions = pptx.buildDeckSaveOptions({
9298
9266
  // Without this the Slide Size card edited a viewer-only pixel value and
9299
9267
  // the saved `p:sldSz` never moved: passing `slideSize` is the only way a
@@ -9437,7 +9405,7 @@ function usePresentationSetup(input) {
9437
9405
  return;
9438
9406
  }
9439
9407
  if (mode === "present" && nextMode !== "present") {
9440
- chunkZ22RD3E2_js.stopAllPersistentAudio();
9408
+ chunk3TN5SUQR_js.stopAllPersistentAudio();
9441
9409
  stopAnimationSound();
9442
9410
  const exitHandler = exitModeHandlerRef.current;
9443
9411
  if (exitHandler) {
@@ -9558,7 +9526,7 @@ function useCanvasImagePaste(input) {
9558
9526
  );
9559
9527
  }
9560
9528
  function formatPatchFor(element, format) {
9561
- const updated = chunkZ22RD3E2_js.applyFormatToElement(element, format);
9529
+ const updated = chunk3TN5SUQR_js.applyFormatToElement(element, format);
9562
9530
  const updates = {};
9563
9531
  if (pptx$1.hasShapeProperties(updated)) {
9564
9532
  updates.shapeStyle = updated.shapeStyle;
@@ -9581,7 +9549,7 @@ function useFormatPainterEditing(input) {
9581
9549
  const prevFormatPainterRef = React17.useRef(false);
9582
9550
  React17.useEffect(() => {
9583
9551
  if (formatPainterActive && !prevFormatPainterRef.current && selectedElement) {
9584
- copiedFormatRef.current = chunkZ22RD3E2_js.copyFormatFromElement(selectedElement);
9552
+ copiedFormatRef.current = chunk3TN5SUQR_js.copyFormatFromElement(selectedElement);
9585
9553
  } else if (!formatPainterActive) {
9586
9554
  copiedFormatRef.current = null;
9587
9555
  }
@@ -9825,8 +9793,7 @@ function useEditorOperations(input) {
9825
9793
  const findReplace = useFindReplace({
9826
9794
  slides,
9827
9795
  mode,
9828
- onSetActiveSlideIndex: state.setActiveSlideIndex,
9829
- onSetSelectedElementId: state.setSelectedElementId,
9796
+ onShowMatch: state.showSlideSelection,
9830
9797
  onUpdateSlides: ops.updateSlides,
9831
9798
  onMarkDirty: history.markDirty,
9832
9799
  keyboard
@@ -10031,9 +9998,7 @@ function useIOHandlers(input) {
10031
9998
  zoom,
10032
9999
  handlerRef,
10033
10000
  serializeSlides,
10034
- serializeForRecovery,
10035
10001
  setContent,
10036
- onContentChange,
10037
10002
  onPropertiesChange,
10038
10003
  onNotesUpdate,
10039
10004
  imageExportScale,
@@ -10070,19 +10035,19 @@ function useIOHandlers(input) {
10070
10035
  slides,
10071
10036
  activeSlideIndex,
10072
10037
  canvasStageRef: zoom.canvasStageRef,
10073
- setActiveSlideIndex: state.setActiveSlideIndex
10038
+ setActiveSlideIndex: state.setActiveSlideIndex,
10039
+ canvasSize,
10040
+ templateElementsBySlideId: state.templateElementsBySlideId,
10041
+ handoutMaster: state.handoutMaster
10074
10042
  });
10075
10043
  const themeHandlers = useThemeHandlers({
10076
10044
  handlerRef,
10077
- // Theme apply re-serialises and re-parses through `setContent`, so these
10078
- // bytes go back into our own loader: plaintext, never the protected save.
10079
- serializeSlides: serializeForRecovery,
10080
- setContent,
10081
- onContentChange,
10082
10045
  setTheme: state.setTheme,
10083
10046
  setSlideMasters: state.setSlideMasters,
10084
10047
  slideMasters: state.slideMasters,
10048
+ themeOptions: state.themeOptions,
10085
10049
  history,
10050
+ slides,
10086
10051
  setSlides: state.setSlides,
10087
10052
  templateElementsBySlideId: state.templateElementsBySlideId,
10088
10053
  setTemplateElementsBySlideId: state.setTemplateElementsBySlideId,
@@ -10136,7 +10101,12 @@ function isFontDataUrlSafe(url) {
10136
10101
  }
10137
10102
  return FONT_DATA_URL_PATTERN.test(url);
10138
10103
  }
10139
- function useFontInjection({ embeddedFonts, slides }) {
10104
+ function useFontInjection({
10105
+ embeddedFonts,
10106
+ slides,
10107
+ googleFonts
10108
+ }) {
10109
+ const googleFontsBase = pptx.resolveGoogleFontsCss2Base(googleFonts);
10140
10110
  React17.useEffect(() => {
10141
10111
  if (!embeddedFonts.length) {
10142
10112
  return;
@@ -10178,17 +10148,19 @@ function useFontInjection({ embeddedFonts, slides }) {
10178
10148
  const referencedFamilies = React17.useMemo(() => pptx.collectReferencedFontFamilies(slides), [slides]);
10179
10149
  React17.useEffect(() => {
10180
10150
  let cancelled = false;
10181
- void pptx.resolveGoogleWebfontHref(slides, embeddedFonts).then((href) => {
10182
- if (cancelled) {
10183
- return null;
10151
+ void pptx.resolveGoogleWebfontHref(slides, embeddedFonts, void 0, googleFontsBase).then(
10152
+ (href) => {
10153
+ if (cancelled) {
10154
+ return null;
10155
+ }
10156
+ pptx.syncGoogleWebfontStylesheet(document, GOOGLE_FONTS_LINK_ID, href);
10157
+ return href;
10184
10158
  }
10185
- pptx.syncGoogleWebfontStylesheet(document, GOOGLE_FONTS_LINK_ID, href);
10186
- return href;
10187
- });
10159
+ );
10188
10160
  return () => {
10189
10161
  cancelled = true;
10190
10162
  };
10191
- }, [embeddedFonts, slides]);
10163
+ }, [embeddedFonts, slides, googleFontsBase]);
10192
10164
  React17.useEffect(() => () => document.getElementById(GOOGLE_FONTS_LINK_ID)?.remove(), []);
10193
10165
  const [, setOutlineFontsTick] = React17.useState(0);
10194
10166
  React17.useEffect(() => {
@@ -10201,41 +10173,43 @@ function useFontInjection({ embeddedFonts, slides }) {
10201
10173
  if (candidates.length === 0) {
10202
10174
  return;
10203
10175
  }
10204
- void pptx.resolveGoogleWebfontHref(slides, embeddedFonts).then(async (href) => {
10205
- if (cancelled || !href) {
10206
- return;
10207
- }
10208
- const boldItalicVariants = [
10209
- { bold: false, italic: false },
10210
- { bold: true, italic: false }
10211
- ];
10212
- let registeredAny = false;
10213
- for (const family of candidates) {
10214
- for (const variant of boldItalicVariants) {
10215
- if (cancelled) {
10216
- return;
10217
- }
10218
- const bytes = await pptx.fetchGoogleWebfontOutlineBytes(
10219
- href,
10220
- family,
10221
- variant.bold,
10222
- variant.italic,
10223
- fetch
10224
- );
10225
- if (bytes && glyphOutlineFontCache.registerFontBytes(family, variant.bold, variant.italic, bytes)) {
10226
- registeredAny = true;
10176
+ void pptx.resolveGoogleWebfontHref(slides, embeddedFonts, void 0, googleFontsBase).then(
10177
+ async (href) => {
10178
+ if (cancelled || !href) {
10179
+ return;
10180
+ }
10181
+ const boldItalicVariants = [
10182
+ { bold: false, italic: false },
10183
+ { bold: true, italic: false }
10184
+ ];
10185
+ let registeredAny = false;
10186
+ for (const family of candidates) {
10187
+ for (const variant of boldItalicVariants) {
10188
+ if (cancelled) {
10189
+ return;
10190
+ }
10191
+ const bytes = await pptx.fetchGoogleWebfontOutlineBytes(
10192
+ href,
10193
+ family,
10194
+ variant.bold,
10195
+ variant.italic,
10196
+ fetch
10197
+ );
10198
+ if (bytes && glyphOutlineFontCache.registerFontBytes(family, variant.bold, variant.italic, bytes)) {
10199
+ registeredAny = true;
10200
+ }
10227
10201
  }
10228
10202
  }
10203
+ if (registeredAny && !cancelled) {
10204
+ setOutlineFontsTick((tick) => tick + 1);
10205
+ }
10206
+ return void 0;
10229
10207
  }
10230
- if (registeredAny && !cancelled) {
10231
- setOutlineFontsTick((tick) => tick + 1);
10232
- }
10233
- return void 0;
10234
- });
10208
+ );
10235
10209
  return () => {
10236
10210
  cancelled = true;
10237
10211
  };
10238
- }, [embeddedFonts, slides]);
10212
+ }, [embeddedFonts, slides, googleFontsBase]);
10239
10213
  React17.useEffect(() => {
10240
10214
  const neededSymbolFonts = SYMBOL_FONT_FAMILIES.filter((f) => referencedFamilies.has(f));
10241
10215
  if (neededSymbolFonts.length === 0) {
@@ -10283,6 +10257,7 @@ function useContentLifecycle(input) {
10283
10257
  onContentApplied,
10284
10258
  allowExternalImages,
10285
10259
  initialSlide,
10260
+ googleFonts,
10286
10261
  setReadOnlyRecommendation,
10287
10262
  setModifyVerifier,
10288
10263
  setCompatToasts
@@ -10339,7 +10314,7 @@ function useContentLifecycle(input) {
10339
10314
  React17.useEffect(() => {
10340
10315
  actionSoundHandlerRef.current = handlerRef.current;
10341
10316
  }, [handlerRef, actionSoundHandlerRef, state.loading]);
10342
- useFontInjection({ embeddedFonts: state.embeddedFonts, slides });
10317
+ useFontInjection({ embeddedFonts: state.embeddedFonts, slides, googleFonts });
10343
10318
  const serializeInput = {
10344
10319
  slides,
10345
10320
  templateElementsBySlideId: state.templateElementsBySlideId,
@@ -10695,6 +10670,7 @@ function useViewerIntegration(input) {
10695
10670
  autosaveIntervalMs,
10696
10671
  allowExternalImages,
10697
10672
  initialSlide,
10673
+ googleFonts,
10698
10674
  setReadOnlyRecommendation,
10699
10675
  setModifyVerifier,
10700
10676
  setCompatToasts,
@@ -10759,32 +10735,31 @@ function useViewerIntegration(input) {
10759
10735
  });
10760
10736
  const [isEncryptedDialogOpen, setIsEncryptedDialogOpen] = React17.useState(false);
10761
10737
  const [loadVersion, setLoadVersion] = React17.useState(0);
10762
- const { handlerRef, serializeSlides, serializeForRecovery, autosaveStatus } = useContentLifecycle(
10763
- {
10764
- content,
10765
- filePath,
10766
- storage,
10767
- autosaveEnabled,
10768
- autosaveIntervalMs,
10769
- onAutosave,
10770
- // The File > Fonts toggle, finally reaching a save call.
10771
- embedFonts: dialogs.embedFontsEnabled,
10772
- slides,
10773
- state,
10774
- history,
10775
- ops: editorOps.ops,
10776
- transformCommittedText: input.transformCommittedText,
10777
- actionSoundHandlerRef,
10778
- setIsEncryptedDialogOpen,
10779
- password: dialogs.presentationPassword ?? void 0,
10780
- onContentApplied: () => setLoadVersion((v) => v + 1),
10781
- allowExternalImages,
10782
- initialSlide,
10783
- setReadOnlyRecommendation,
10784
- setModifyVerifier,
10785
- setCompatToasts
10786
- }
10787
- );
10738
+ const { handlerRef, serializeSlides, autosaveStatus } = useContentLifecycle({
10739
+ content,
10740
+ filePath,
10741
+ storage,
10742
+ autosaveEnabled,
10743
+ autosaveIntervalMs,
10744
+ onAutosave,
10745
+ // The File > Fonts toggle, finally reaching a save call.
10746
+ embedFonts: dialogs.embedFontsEnabled,
10747
+ slides,
10748
+ state,
10749
+ history,
10750
+ ops: editorOps.ops,
10751
+ transformCommittedText: input.transformCommittedText,
10752
+ actionSoundHandlerRef,
10753
+ setIsEncryptedDialogOpen,
10754
+ password: dialogs.presentationPassword ?? void 0,
10755
+ onContentApplied: () => setLoadVersion((v) => v + 1),
10756
+ allowExternalImages,
10757
+ initialSlide,
10758
+ googleFonts,
10759
+ setReadOnlyRecommendation,
10760
+ setModifyVerifier,
10761
+ setCompatToasts
10762
+ });
10788
10763
  const { exportHandlers, printHandlers, themeHandlers, propertyHandlers } = useIOHandlers({
10789
10764
  state,
10790
10765
  slides,
@@ -10798,9 +10773,7 @@ function useViewerIntegration(input) {
10798
10773
  zoom,
10799
10774
  handlerRef,
10800
10775
  serializeSlides,
10801
- serializeForRecovery,
10802
10776
  setContent,
10803
- onContentChange,
10804
10777
  onPropertiesChange,
10805
10778
  onNotesUpdate,
10806
10779
  imageExportScale,
@@ -11203,7 +11176,7 @@ function useCollaborationWriteBack(input) {
11203
11176
  getSourceBytes: () => latest.current.getSourceBytes?.() ?? null,
11204
11177
  getSaveOptions: () => latest.current.getSaveOptions?.(),
11205
11178
  getTemplateElements: () => latest.current.templateElementsBySlideId,
11206
- mergeTemplateElements: chunkZ22RD3E2_js.buildSaveSlides,
11179
+ mergeTemplateElements: chunk3TN5SUQR_js.buildSaveSlides,
11207
11180
  onWriteBackStatus: () => latest.current.onWriteBackStatus?.(
11208
11181
  pptx.writeBackReport(latest.current.config, created.getState())
11209
11182
  )
@@ -11613,11 +11586,9 @@ function useLayoutSwitching(input) {
11613
11586
  }
11614
11587
  setIsLoading(true);
11615
11588
  try {
11616
- const updated = await handler.applyLayoutToSlide(
11617
- activeSlideIndex,
11618
- layoutPath,
11619
- slidesRef.current
11620
- );
11589
+ const updated = await handler.applyLayoutToSlide(activeSlideIndex, layoutPath, [
11590
+ ...slidesRef.current
11591
+ ]);
11621
11592
  ops.updateSlides((prev) => {
11622
11593
  const next = [...prev];
11623
11594
  next[activeSlideIndex] = updated;
@@ -11762,8 +11733,8 @@ function useTouchGestures(input) {
11762
11733
  }
11763
11734
  const recognizer = pptx.createTouchGestureRecognizer({
11764
11735
  getScale: () => scaleRef.current,
11765
- minScale: chunkZ22RD3E2_js.MIN_ZOOM_SCALE,
11766
- maxScale: chunkZ22RD3E2_js.MAX_ZOOM_SCALE,
11736
+ minScale: chunk3TN5SUQR_js.MIN_ZOOM_SCALE,
11737
+ maxScale: chunk3TN5SUQR_js.MAX_ZOOM_SCALE,
11767
11738
  callbacks: {
11768
11739
  onPinchZoom: (newScale) => callbacksRef.current.onPinchZoom?.(newScale),
11769
11740
  onSwipe: (direction) => callbacksRef.current.onSwipe?.(direction),
@@ -11887,7 +11858,7 @@ function buildCanvasProps(input) {
11887
11858
  if (pptx.shouldConfirmExternalHyperlink(viewerOptions, url) && !window.confirm(buildHyperlinkConfirmMessage(url))) {
11888
11859
  return;
11889
11860
  }
11890
- chunkZ22RD3E2_js.safeOpenUrl(url, target);
11861
+ chunk3TN5SUQR_js.safeOpenUrl(url, target);
11891
11862
  };
11892
11863
  const handleActionClick = (elementId, action) => {
11893
11864
  if (mode === "present") {
@@ -11902,9 +11873,9 @@ function buildCanvasProps(input) {
11902
11873
  }
11903
11874
  };
11904
11875
  const handleHyperlinkClick = (url, target) => {
11905
- if (chunkZ22RD3E2_js.isPpactionUrl(url)) {
11876
+ if (chunk3TN5SUQR_js.isPpactionUrl(url)) {
11906
11877
  if (mode === "present") {
11907
- const parsed = chunkZ22RD3E2_js.parsePpactionUrl(url);
11878
+ const parsed = chunk3TN5SUQR_js.parsePpactionUrl(url);
11908
11879
  if (parsed) {
11909
11880
  presentation.handlePresentationAction({
11910
11881
  action: parsed.action,
@@ -12332,7 +12303,7 @@ function buildToolbarProps(input) {
12332
12303
  markDirty: history.markDirty
12333
12304
  }),
12334
12305
  formatPainterActive: s.formatPainterActive,
12335
- canActivateFormatPainter: chunkZ22RD3E2_js.hasCopyableFormat(selectedElement),
12306
+ canActivateFormatPainter: chunk3TN5SUQR_js.hasCopyableFormat(selectedElement),
12336
12307
  onToggleFormatPainter: () => s.setFormatPainterActive((p) => !p),
12337
12308
  isSelectionPaneOpen: s.isSelectionPaneOpen,
12338
12309
  onToggleSelectionPane: () => s.setIsSelectionPaneOpen((p) => !p),
@@ -12838,7 +12809,7 @@ function useViewPreferencesSync(input) {
12838
12809
  // src/viewer/hooks/useViewerBuildingBlocksState.ts
12839
12810
  function useViewerBuildingBlocksState(input) {
12840
12811
  const { core, content, canEdit, filePath, autosaveEnabled, userName, handle, setContent } = input;
12841
- const { initialSlide } = input;
12812
+ const { initialSlide, googleFonts } = input;
12842
12813
  const {
12843
12814
  onContentChange,
12844
12815
  onDirtyChange,
@@ -12896,11 +12867,7 @@ function useViewerBuildingBlocksState(input) {
12896
12867
  });
12897
12868
  const readOnlyRec = useReadOnlyRecommendationState(content);
12898
12869
  const compatToastsState = useCompatibilityToastsState();
12899
- React17.useEffect(() => {
12900
- state.setSelectedElementId(null);
12901
- state.setSelectedElementIds([]);
12902
- state.setInlineEditingElementId(null);
12903
- }, [activeSlideIndex]);
12870
+ useClearSelectionOnSlideChange(state, activeSlideIndex);
12904
12871
  const editorOps = useEditorOperations({
12905
12872
  state,
12906
12873
  history,
@@ -12942,6 +12909,7 @@ function useViewerBuildingBlocksState(input) {
12942
12909
  filePath,
12943
12910
  autosaveEnabled,
12944
12911
  initialSlide,
12912
+ googleFonts,
12945
12913
  // Trust Center > "Allow external content": same gate `PowerPointViewer`
12946
12914
  // applies, so the headless building-blocks API loads http(s) images
12947
12915
  // under the same default-off, core-side SSRF/privacy guard.
@@ -13006,6 +12974,7 @@ function useViewerBuildingBlocks(input) {
13006
12974
  filePath,
13007
12975
  fileName,
13008
12976
  initialSlide,
12977
+ googleFonts,
13009
12978
  autosaveEnabled = true,
13010
12979
  userName,
13011
12980
  hiddenActions,
@@ -13023,7 +12992,7 @@ function useViewerBuildingBlocks(input) {
13023
12992
  } = input;
13024
12993
  const collaborationConfig = pptx.resolveCollaborationConfig(input.collaboration);
13025
12994
  const [collaborationReadOnly, setCollaborationReadOnly] = React17.useState(Boolean(collaborationConfig));
13026
- const { t } = chunkZ22RD3E2_js.useTranslation();
12995
+ const { t } = chunk3TN5SUQR_js.useTranslation();
13027
12996
  const [content, setContent] = React17.useState(incomingContent ?? null);
13028
12997
  const [loadOrigin, setLoadOrigin] = React17.useState("bootstrap");
13029
12998
  React17.useEffect(() => {
@@ -13094,6 +13063,7 @@ function useViewerBuildingBlocks(input) {
13094
13063
  canEdit,
13095
13064
  filePath,
13096
13065
  initialSlide,
13066
+ googleFonts,
13097
13067
  autosaveEnabled,
13098
13068
  userName,
13099
13069
  handle,
@@ -13210,23 +13180,23 @@ function ColorChangedImage({
13210
13180
  className,
13211
13181
  alt
13212
13182
  }) {
13213
- const tolerance = tolerancePct ?? chunkZ22RD3E2_js.DEFAULT_COLOR_CHANGE_TOLERANCE;
13214
- const cacheKey = chunkZ22RD3E2_js.buildCacheKey(
13183
+ const tolerance = tolerancePct ?? chunk3TN5SUQR_js.DEFAULT_COLOR_CHANGE_TOLERANCE;
13184
+ const cacheKey = chunk3TN5SUQR_js.buildCacheKey(
13215
13185
  src,
13216
13186
  clrChange.clrFrom,
13217
13187
  clrChange.clrTo,
13218
13188
  tolerance,
13219
13189
  Boolean(clrChange.clrToTransparent)
13220
13190
  );
13221
- const cached = chunkZ22RD3E2_js.getCachedResult(cacheKey);
13191
+ const cached = chunk3TN5SUQR_js.getCachedResult(cacheKey);
13222
13192
  const [processedSrc, setProcessedSrc] = React17.useState(cached ?? null);
13223
13193
  React17.useEffect(() => {
13224
- if (chunkZ22RD3E2_js.getCachedResult(cacheKey)) {
13225
- setProcessedSrc(chunkZ22RD3E2_js.getCachedResult(cacheKey) ?? null);
13194
+ if (chunk3TN5SUQR_js.getCachedResult(cacheKey)) {
13195
+ setProcessedSrc(chunk3TN5SUQR_js.getCachedResult(cacheKey) ?? null);
13226
13196
  return;
13227
13197
  }
13228
13198
  let cancelled = false;
13229
- chunkZ22RD3E2_js.applyColorChange(
13199
+ chunk3TN5SUQR_js.applyColorChange(
13230
13200
  src,
13231
13201
  clrChange.clrFrom,
13232
13202
  clrChange.clrTo,
@@ -13234,7 +13204,7 @@ function ColorChangedImage({
13234
13204
  Boolean(clrChange.clrToTransparent)
13235
13205
  ).then((result) => {
13236
13206
  if (!cancelled) {
13237
- chunkZ22RD3E2_js.setCachedResult(cacheKey, result.dataUrl);
13207
+ chunk3TN5SUQR_js.setCachedResult(cacheKey, result.dataUrl);
13238
13208
  setProcessedSrc(result.dataUrl);
13239
13209
  }
13240
13210
  return void 0;
@@ -13326,7 +13296,7 @@ function TiledImageLayer({
13326
13296
  cancelled = true;
13327
13297
  };
13328
13298
  }, [src]);
13329
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className, style: { ...chunkZ22RD3E2_js.getImageTilingStyle(element, nativeSize), ...style } });
13299
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className, style: { ...chunk3TN5SUQR_js.getImageTilingStyle(element, nativeSize), ...style } });
13330
13300
  }
13331
13301
  function renderImageEffectDefinitions(element, excludeDuotone = false) {
13332
13302
  return pptx.getImageSvgFilters(element).filter((definition) => !excludeDuotone || definition.id !== `duotone-${element.id}`).map((definition) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -13395,7 +13365,7 @@ function renderImg(el, style, filter, alt, opacity) {
13395
13365
  ...filter ? { filter } : {},
13396
13366
  ...opacity !== void 0 ? { opacity } : {}
13397
13367
  };
13398
- if (chunkZ22RD3E2_js.isImageTiled(el)) {
13368
+ if (chunk3TN5SUQR_js.isImageTiled(el)) {
13399
13369
  const tileSrc = imgSrc(el);
13400
13370
  if (!tileSrc) {
13401
13371
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-gray-500 bg-gray-100", children: "Image" });
@@ -13417,9 +13387,9 @@ function renderImg(el, style, filter, alt, opacity) {
13417
13387
  pptx$1.isImageLikeElement(el) ? el.imageEffects?.colorWash : void 0
13418
13388
  );
13419
13389
  const clrChange = "imageEffects" in el ? el.imageEffects?.clrChange : void 0;
13420
- const duotoneColors = chunkZ22RD3E2_js.getDuotoneColors(el);
13390
+ const duotoneColors = chunk3TN5SUQR_js.getDuotoneColors(el);
13421
13391
  const useDuotoneCanvas = Boolean(duotoneColors && !clrChange);
13422
- const filterForImg = useDuotoneCanvas ? chunkZ22RD3E2_js.getImageEffectsFilter(el, { excludeDuotone: true }) : filter;
13392
+ const filterForImg = useDuotoneCanvas ? chunk3TN5SUQR_js.getImageEffectsFilter(el, { excludeDuotone: true }) : filter;
13423
13393
  const canvasEffectStyles = {
13424
13394
  ...filterForImg ? { filter: filterForImg } : {},
13425
13395
  ...opacity !== void 0 ? { opacity } : {}
@@ -13495,10 +13465,10 @@ function SlideBackgroundImageLayer({
13495
13465
  style: { zIndex: 0 },
13496
13466
  children: renderImg(
13497
13467
  backgroundElement,
13498
- chunkZ22RD3E2_js.getImageRenderStyle(backgroundElement),
13499
- chunkZ22RD3E2_js.getImageEffectsFilter(backgroundElement),
13468
+ chunk3TN5SUQR_js.getImageRenderStyle(backgroundElement),
13469
+ chunk3TN5SUQR_js.getImageEffectsFilter(backgroundElement),
13500
13470
  "",
13501
- chunkZ22RD3E2_js.getImageEffectsOpacity(backgroundElement)
13471
+ chunk3TN5SUQR_js.getImageEffectsOpacity(backgroundElement)
13502
13472
  )
13503
13473
  }
13504
13474
  );
@@ -13769,7 +13739,7 @@ function ChartElementView({
13769
13739
  onUpdateElement,
13770
13740
  animationState
13771
13741
  }) {
13772
- const { t } = chunkZ22RD3E2_js.useTranslation();
13742
+ const { t } = chunk3TN5SUQR_js.useTranslation();
13773
13743
  const wrapperRef = React17.useRef(null);
13774
13744
  const { selection, setSelection } = useChartPartSelection();
13775
13745
  const [titleDraft, setTitleDraft] = React17.useState(null);
@@ -13784,7 +13754,7 @@ function ChartElementView({
13784
13754
  pptx.getBarFacePicturePixelSampleVersion
13785
13755
  );
13786
13756
  const viewModel = React17.useMemo(() => {
13787
- return canEdit ? chunkZ22RD3E2_js.buildReactChartViewModel(element) : null;
13757
+ return canEdit ? chunk3TN5SUQR_js.buildReactChartViewModel(element) : null;
13788
13758
  }, [canEdit, element, barFacePictureSampleVersion]);
13789
13759
  React17.useEffect(pptx.ensureChartInteractionStyles, []);
13790
13760
  React17.useEffect(() => {
@@ -13889,9 +13859,9 @@ function ChartElementView({
13889
13859
  textStyle: animationState?.textStyle,
13890
13860
  onSelect: chart3D.onSelect,
13891
13861
  onDrag: chart3D.onDrag,
13892
- children: chunkZ22RD3E2_js.renderChartElement(renderedElement, (key) => t(key))
13862
+ children: chunk3TN5SUQR_js.renderChartElement(renderedElement, (key) => t(key))
13893
13863
  }
13894
- ) : chunkZ22RD3E2_js.renderChartElement(renderedElement, (key) => t(key)),
13864
+ ) : chunk3TN5SUQR_js.renderChartElement(renderedElement, (key) => t(key)),
13895
13865
  dragValue !== null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-1 right-1 z-10 rounded bg-primary/90 px-1.5 py-0.5 text-[10px] font-medium text-white pointer-events-none", children: pptx.formatAxisValue(dragValue) }),
13896
13866
  titleDraft !== null && /* @__PURE__ */ jsxRuntime.jsx(
13897
13867
  "input",
@@ -13919,7 +13889,7 @@ function ChartElementView({
13919
13889
  );
13920
13890
  }
13921
13891
  function useActionAffordance(element, canInteract) {
13922
- const { t } = chunkZ22RD3E2_js.useTranslation();
13892
+ const { t } = chunk3TN5SUQR_js.useTranslation();
13923
13893
  pptx.ensureActionAffordanceStyles();
13924
13894
  return React17.useMemo(
13925
13895
  () => pptx.resolveElementActionAffordance(element, {
@@ -14197,7 +14167,7 @@ function ResizeHandles({
14197
14167
  nonRotationTransform,
14198
14168
  onRotate
14199
14169
  }) {
14200
- const { t } = chunkZ22RD3E2_js.useTranslation();
14170
+ const { t } = chunk3TN5SUQR_js.useTranslation();
14201
14171
  const rotateRef = useRotateHandlePlacement(elementId, Boolean(onRotate));
14202
14172
  const peStyle = forcePointerEvents ? { ...HANDLE_TOUCH_ACTION, pointerEvents: "auto" } : HANDLE_TOUCH_ACTION;
14203
14173
  const resizeStyle = { ...HANDLE_TOUCH_ACTION, pointerEvents: "none" };
@@ -14230,7 +14200,7 @@ function ResizeHandles({
14230
14200
  "aria-label": t("pptx.selectionOverlay.resize", { handle }),
14231
14201
  "data-pptx-handle-kind": "resize",
14232
14202
  "data-pptx-compact": true,
14233
- className: chunkZ22RD3E2_js.cn(
14203
+ className: chunk3TN5SUQR_js.cn(
14234
14204
  "absolute z-10 group border-0 bg-transparent p-0",
14235
14205
  RESIZE_DEFAULT_CLASSES,
14236
14206
  posClass,
@@ -14256,7 +14226,7 @@ function ResizeHandles({
14256
14226
  "div",
14257
14227
  {
14258
14228
  "data-pptx-handle-hit": true,
14259
- className: chunkZ22RD3E2_js.cn(
14229
+ className: chunk3TN5SUQR_js.cn(
14260
14230
  "absolute -inset-px pointer-events-auto [--pptx-handle-hit-inset:-1px]",
14261
14231
  corner ? "max-md:-inset-1.5 max-md:[--pptx-handle-hit-inset:-6px]" : "max-md:-inset-2 max-md:[--pptx-handle-hit-inset:-8px]"
14262
14232
  ),
@@ -14277,7 +14247,7 @@ function ResizeHandles({
14277
14247
  "aria-label": t("pptx.selectionOverlay.rotate"),
14278
14248
  "data-pptx-handle-kind": "rotate",
14279
14249
  "data-pptx-compact": true,
14280
- className: chunkZ22RD3E2_js.cn(
14250
+ className: chunk3TN5SUQR_js.cn(
14281
14251
  "absolute left-1/2 top-0 -translate-x-1/2 -translate-y-1/2 z-20 border-0 bg-transparent p-0 cursor-grab active:cursor-grabbing",
14282
14252
  ROTATE_DEFAULT_CLASSES
14283
14253
  ),
@@ -14354,10 +14324,10 @@ var ConnectorElementRendererMemo = /* @__PURE__ */ React17__default.default.memo
14354
14324
  const svgHeight = Math.max(el.height, 1);
14355
14325
  const ss = shapeEl?.shapeStyle;
14356
14326
  const strokeWidth = Math.max(0, ss?.strokeWidth ?? 2);
14357
- const strokeColor = chunkZ22RD3E2_js.normalizeHexColor(ss?.strokeColor, chunkZ22RD3E2_js.DEFAULT_STROKE_COLOR);
14358
- const strokePaint = chunkZ22RD3E2_js.colorWithOpacity(strokeColor, ss?.strokeOpacity);
14359
- const dashType = chunkZ22RD3E2_js.normalizeStrokeDashType(ss?.strokeDash);
14360
- const dashArray = chunkZ22RD3E2_js.getSvgStrokeDasharray(
14327
+ const strokeColor = chunk3TN5SUQR_js.normalizeHexColor(ss?.strokeColor, chunk3TN5SUQR_js.DEFAULT_STROKE_COLOR);
14328
+ const strokePaint = chunk3TN5SUQR_js.colorWithOpacity(strokeColor, ss?.strokeOpacity);
14329
+ const dashType = chunk3TN5SUQR_js.normalizeStrokeDashType(ss?.strokeDash);
14330
+ const dashArray = chunk3TN5SUQR_js.getSvgStrokeDasharray(
14361
14331
  dashType,
14362
14332
  Math.max(strokeWidth, 1),
14363
14333
  ss?.customDashSegments
@@ -14368,14 +14338,14 @@ var ConnectorElementRendererMemo = /* @__PURE__ */ React17__default.default.memo
14368
14338
  const markerSeed = el.id.replace(/[^a-zA-Z0-9_-]/gu, "_");
14369
14339
  const startMarkerId = `${markerSeed}-sel-start`;
14370
14340
  const endMarkerId = `${markerSeed}-sel-end`;
14371
- const compoundOffsets = chunkZ22RD3E2_js.getCompoundLineOffsets(compoundLine, strokeWidth);
14372
- const compoundWidths = chunkZ22RD3E2_js.getCompoundLineWidths(compoundLine, strokeWidth);
14341
+ const compoundOffsets = chunk3TN5SUQR_js.getCompoundLineOffsets(compoundLine, strokeWidth);
14342
+ const compoundWidths = chunk3TN5SUQR_js.getCompoundLineWidths(compoundLine, strokeWidth);
14373
14343
  const strokeCap = pptx.svgLineCap(ss?.lineCap);
14374
14344
  const textEl = pptx$1.hasTextProperties(el) ? el : void 0;
14375
14345
  const connectorText = textEl?.text?.trim() ?? "";
14376
14346
  const connectorTextSegments = textEl?.textSegments;
14377
14347
  const connectorTextStyle = textEl?.textStyle;
14378
- const pathGeometry = shapeEl ? chunkZ22RD3E2_js.getConnectorPathGeometry(shapeEl) : {
14348
+ const pathGeometry = shapeEl ? chunk3TN5SUQR_js.getConnectorPathGeometry(shapeEl) : {
14379
14349
  pathData: `M 0 0 L ${viewWidth} ${viewHeight}`,
14380
14350
  startX: 0,
14381
14351
  startY: 0,
@@ -14384,16 +14354,16 @@ var ConnectorElementRendererMemo = /* @__PURE__ */ React17__default.default.memo
14384
14354
  };
14385
14355
  const hitTargetWidth = Math.max(strokeWidth * 3, 14);
14386
14356
  const selColor = selClr === "blue-400" ? "#60a5fa" : "#3b82f6";
14387
- const lineShadow = chunkZ22RD3E2_js.buildLineShadowCss(el);
14388
- const lineGlow = chunkZ22RD3E2_js.buildLineGlowFilter(el);
14357
+ const lineShadow = chunk3TN5SUQR_js.buildLineShadowCss(el);
14358
+ const lineGlow = chunk3TN5SUQR_js.buildLineGlowFilter(el);
14389
14359
  return /* @__PURE__ */ jsxRuntime.jsxs(
14390
14360
  "div",
14391
14361
  {
14392
14362
  "data-pptx-element": "true",
14393
14363
  "data-element-id": el.id,
14394
- role: chunkZ22RD3E2_js.getAriaRole(el, { actionable: false }),
14395
- "aria-label": chunkZ22RD3E2_js.getAriaLabel(el),
14396
- "aria-roledescription": chunkZ22RD3E2_js.getAriaRoleDescription(el),
14364
+ role: chunk3TN5SUQR_js.getAriaRole(el, { actionable: false }),
14365
+ "aria-label": chunk3TN5SUQR_js.getAriaLabel(el),
14366
+ "aria-roledescription": chunk3TN5SUQR_js.getAriaRoleDescription(el),
14397
14367
  "aria-selected": isSelected ? true : void 0,
14398
14368
  className: "absolute",
14399
14369
  style: {
@@ -14426,14 +14396,14 @@ var ConnectorElementRendererMemo = /* @__PURE__ */ React17__default.default.memo
14426
14396
  style: { overflow: "visible", pointerEvents: "none" },
14427
14397
  children: [
14428
14398
  /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
14429
- chunkZ22RD3E2_js.renderConnectorMarker(
14399
+ chunk3TN5SUQR_js.renderConnectorMarker(
14430
14400
  startMarkerId,
14431
14401
  startArrow,
14432
14402
  strokePaint,
14433
14403
  ss?.connectorStartArrowWidth,
14434
14404
  ss?.connectorStartArrowLength
14435
14405
  ),
14436
- chunkZ22RD3E2_js.renderConnectorMarker(
14406
+ chunk3TN5SUQR_js.renderConnectorMarker(
14437
14407
  endMarkerId,
14438
14408
  endArrow,
14439
14409
  strokePaint,
@@ -14642,14 +14612,14 @@ function getElementInteractionProps({
14642
14612
  };
14643
14613
  }
14644
14614
  function renderDagDuotoneFilterForElement(el) {
14645
- if (!chunkZ22RD3E2_js.hasDagDuotoneEffect(el)) {
14615
+ if (!chunk3TN5SUQR_js.hasDagDuotoneEffect(el)) {
14646
14616
  return null;
14647
14617
  }
14648
14618
  const duotone = el.shapeStyle?.dagDuotone;
14649
14619
  if (!duotone) {
14650
14620
  return null;
14651
14621
  }
14652
- return chunkZ22RD3E2_js.renderDagDuotoneSvgFilter(el.id, duotone.color1, duotone.color2);
14622
+ return chunk3TN5SUQR_js.renderDagDuotoneSvgFilter(el.id, duotone.color1, duotone.color2);
14653
14623
  }
14654
14624
  function getContainerStyle({
14655
14625
  el,
@@ -14676,10 +14646,10 @@ function getContainerStyle({
14676
14646
  top: isFullscreenMedia ? fs.top : el.y,
14677
14647
  width: isFullscreenMedia ? fs.width : painted.width,
14678
14648
  ...heightStyle,
14679
- transform: isFullscreenMedia ? fs.transform : chunkZ22RD3E2_js.getElementTransform(el),
14649
+ transform: isFullscreenMedia ? fs.transform : chunk3TN5SUQR_js.getElementTransform(el),
14680
14650
  transformOrigin: "center",
14681
14651
  overflow: overflowValue,
14682
- clipPath: isPicture ? void 0 : isImg && !has3DExtrusion ? chunkZ22RD3E2_js.getCropShapeClipPath(el) : void 0,
14652
+ clipPath: isPicture ? void 0 : isImg && !has3DExtrusion ? chunk3TN5SUQR_js.getCropShapeClipPath(el) : void 0,
14683
14653
  zIndex: isFullscreenMedia ? fs.zIndex : zIndex,
14684
14654
  visibility: animationState?.visible === false ? "hidden" : "visible",
14685
14655
  animation: animationState?.cssAnimation,
@@ -14716,9 +14686,9 @@ function getContainerStyle({
14716
14686
  function shapeParams(element) {
14717
14687
  const style = pptx$1.hasShapeProperties(element) ? element.shapeStyle : void 0;
14718
14688
  const strokeWidth = pptx.paintedStrokeWidth(style);
14719
- const strokeColor = chunkZ22RD3E2_js.normalizeHexColor(style?.strokeColor, chunkZ22RD3E2_js.DEFAULT_STROKE_COLOR);
14720
- const fillColor = chunkZ22RD3E2_js.normalizeHexColor(style?.fillColor, chunkZ22RD3E2_js.DEFAULT_FILL_COLOR);
14721
- const hasFill = style?.fillColor !== void 0 && style.fillColor !== "transparent" || Boolean(chunkZ22RD3E2_js.buildCssGradientFromShapeStyle(style) || style?.fillGradient) || style?.fillMode === "pattern" && Boolean(style.fillPatternPreset);
14689
+ const strokeColor = chunk3TN5SUQR_js.normalizeHexColor(style?.strokeColor, chunk3TN5SUQR_js.DEFAULT_STROKE_COLOR);
14690
+ const fillColor = chunk3TN5SUQR_js.normalizeHexColor(style?.fillColor, chunk3TN5SUQR_js.DEFAULT_FILL_COLOR);
14691
+ const hasFill = style?.fillColor !== void 0 && style.fillColor !== "transparent" || Boolean(chunk3TN5SUQR_js.buildCssGradientFromShapeStyle(style) || style?.fillGradient) || style?.fillMode === "pattern" && Boolean(style.fillPatternPreset);
14722
14692
  return { hf: hasFill, fc: fillColor, sw: strokeWidth, sc: strokeColor };
14723
14693
  }
14724
14694
  var Extrusion3DOverlayMemo = /* @__PURE__ */ React17__default.default.memo(
@@ -14826,7 +14796,7 @@ function ShapeEffectOverlay({
14826
14796
  const fillOverlayStyle = overlay ? {
14827
14797
  position: "absolute",
14828
14798
  inset: 0,
14829
- ...pptx$1.isImageLikeElement(element) ? chunkZ22RD3E2_js.getImageSurfaceMaskStyle(element) : {},
14799
+ ...pptx$1.isImageLikeElement(element) ? chunk3TN5SUQR_js.getImageSurfaceMaskStyle(element) : {},
14830
14800
  background: overlay.color,
14831
14801
  mixBlendMode: overlay.blendMode,
14832
14802
  pointerEvents: "none"
@@ -15033,10 +15003,10 @@ var ElementRenderer = /* @__PURE__ */ React17__default.default.memo(
15033
15003
  const backgroundAnimationState = pptx.getBackgroundAnimationState(el, presentationElementStates);
15034
15004
  const effectPlacement = pptx.getShapeEffectLayerPlacement(el);
15035
15005
  const visualAnimationState = backgroundAnimationState ?? animationState;
15036
- const isTxt = chunkZ22RD3E2_js.isEditableTextElement(el) && allow.textEditable;
15006
+ const isTxt = chunk3TN5SUQR_js.isEditableTextElement(el) && allow.textEditable;
15037
15007
  const txtSE = pptx$1.hasTextProperties(el) ? el.textStyle : void 0;
15038
15008
  const textStyleOverrideCss = pptx.buildTextStyleOverrideCss(el.id, visualAnimationState?.textStyle);
15039
- const ss = chunkZ22RD3E2_js.getShapeVisualStyle(
15009
+ const ss = chunk3TN5SUQR_js.getShapeVisualStyle(
15040
15010
  el,
15041
15011
  hf,
15042
15012
  fc,
@@ -15045,9 +15015,9 @@ var ElementRenderer = /* @__PURE__ */ React17__default.default.memo(
15045
15015
  visualAnimationState?.animatesFill,
15046
15016
  visualAnimationState?.animatesStroke
15047
15017
  );
15048
- const ts = chunkZ22RD3E2_js.getTextStyleForElement(el, chunkZ22RD3E2_js.DEFAULT_TEXT_COLOR);
15018
+ const ts = chunk3TN5SUQR_js.getTextStyleForElement(el, chunk3TN5SUQR_js.DEFAULT_TEXT_COLOR);
15049
15019
  const isImg = el.type === "picture" || el.type === "image";
15050
- const vs = chunkZ22RD3E2_js.renderVectorShape(
15020
+ const vs = chunk3TN5SUQR_js.renderVectorShape(
15051
15021
  el,
15052
15022
  isImg ? false : hf,
15053
15023
  fc,
@@ -15057,10 +15027,10 @@ var ElementRenderer = /* @__PURE__ */ React17__default.default.memo(
15057
15027
  visualAnimationState?.animatesStroke
15058
15028
  );
15059
15029
  const isModel3D = el.type === "model3d";
15060
- const isConn = chunkZ22RD3E2_js.isConnectorOrLineElement(el);
15030
+ const isConn = chunk3TN5SUQR_js.isConnectorOrLineElement(el);
15061
15031
  const shapeStyle3d = pptx$1.hasShapeProperties(el) ? el.shapeStyle : void 0;
15062
15032
  const extrusionData = React17.useMemo(
15063
- () => chunkZ22RD3E2_js.build3DExtrusionData(shapeStyle3d?.shape3d, shapeStyle3d?.scene3d, fc, el.width, el.height),
15033
+ () => chunk3TN5SUQR_js.build3DExtrusionData(shapeStyle3d?.shape3d, shapeStyle3d?.scene3d, fc, el.width, el.height),
15064
15034
  [shapeStyle3d?.shape3d, shapeStyle3d?.scene3d, fc, el.width, el.height]
15065
15035
  );
15066
15036
  const actionAffordance = useActionAffordance(el, canInteract);
@@ -15150,7 +15120,7 @@ var ElementRenderer = /* @__PURE__ */ React17__default.default.memo(
15150
15120
  "aria-hidden": aria.hidden ? true : void 0,
15151
15121
  "aria-selected": isSelected ? true : void 0,
15152
15122
  tabIndex: isFocusable ? 0 : -1,
15153
- className: chunkZ22RD3E2_js.cn(
15123
+ className: chunk3TN5SUQR_js.cn(
15154
15124
  "absolute",
15155
15125
  "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",
15156
15126
  cur,
@@ -15223,9 +15193,9 @@ var ElementRenderer = /* @__PURE__ */ React17__default.default.memo(
15223
15193
  txtSE,
15224
15194
  txtS: ts,
15225
15195
  vecShape: backgroundAnimationState && !isImg ? null : vs,
15226
- imgStyle: chunkZ22RD3E2_js.getImageRenderStyle(el),
15227
- imgFilter: chunkZ22RD3E2_js.getImageEffectsFilter(el),
15228
- imgOpacity: chunkZ22RD3E2_js.getImageEffectsOpacity(el),
15196
+ imgStyle: chunk3TN5SUQR_js.getImageRenderStyle(el),
15197
+ imgFilter: chunk3TN5SUQR_js.getImageEffectsFilter(el),
15198
+ imgOpacity: chunk3TN5SUQR_js.getImageEffectsOpacity(el),
15229
15199
  imgAlt: imageAltText,
15230
15200
  isTxtEl: isTxt,
15231
15201
  media: mediaDataUrls,
@@ -15362,10 +15332,10 @@ function renderStrokeView(view, pressureSensitive, replayStyle, key) {
15362
15332
  }
15363
15333
  function renderInk(el, options) {
15364
15334
  const replay = options?.replay ?? false;
15365
- const strokes = chunkZ22RD3E2_js.buildInkGroupStrokes(el, { color: "#000", width: 3 });
15335
+ const strokes = chunk3TN5SUQR_js.buildInkGroupStrokes(el, { color: "#000", width: 3 });
15366
15336
  strokes.some((s) => s.circles || s.nibMarks);
15367
15337
  const pressureSensitive = options?.pressureSensitive;
15368
- const replayStyles = replay ? chunkZ22RD3E2_js.getInkReplayStyles(el, options?.replayConfig) : null;
15338
+ const replayStyles = replay ? chunk3TN5SUQR_js.getInkReplayStyles(el, options?.replayConfig) : null;
15369
15339
  return /* @__PURE__ */ jsxRuntime.jsxs(
15370
15340
  "svg",
15371
15341
  {
@@ -15373,7 +15343,7 @@ function renderInk(el, options) {
15373
15343
  viewBox: `0 0 ${Math.max(el.width, 1)} ${Math.max(el.height, 1)}`,
15374
15344
  preserveAspectRatio: "none",
15375
15345
  children: [
15376
- replay && /* @__PURE__ */ jsxRuntime.jsx("style", { children: chunkZ22RD3E2_js.INK_REPLAY_KEYFRAMES }),
15346
+ replay && /* @__PURE__ */ jsxRuntime.jsx("style", { children: chunk3TN5SUQR_js.INK_REPLAY_KEYFRAMES }),
15377
15347
  strokes.map(
15378
15348
  (s, i) => renderStrokeView(s, pressureSensitive, replayStyles?.[i], `${el.id}-ink-${i}`)
15379
15349
  )
@@ -15384,7 +15354,7 @@ function renderInk(el, options) {
15384
15354
  function renderGroup(children, parentGroupFill) {
15385
15355
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full h-full pointer-events-none", children: pptx.filterRenderedElements(children).map((c, childIndex) => {
15386
15356
  const { hf, fc, sw, sc } = shapeParams(c);
15387
- const baseSs = chunkZ22RD3E2_js.getShapeVisualStyle(c, hf, fc, sw, sc);
15357
+ const baseSs = chunk3TN5SUQR_js.getShapeVisualStyle(c, hf, fc, sw, sc);
15388
15358
  const inheritedFill = pptx.resolveGroupChildFill(c, parentGroupFill);
15389
15359
  const ss = inheritedFill ? {
15390
15360
  ...baseSs,
@@ -15395,9 +15365,9 @@ function renderGroup(children, parentGroupFill) {
15395
15365
  backgroundPosition: inheritedFill.backgroundPosition
15396
15366
  } : baseSs;
15397
15367
  const isI = c.type === "picture" || c.type === "image";
15398
- const vs = chunkZ22RD3E2_js.renderVectorShape(c, isI ? false : hf, fc, sw, sc);
15399
- const ts = chunkZ22RD3E2_js.getTextStyleForElement(c, chunkZ22RD3E2_js.DEFAULT_TEXT_COLOR);
15400
- const isTxt = chunkZ22RD3E2_js.isEditableTextElement(c);
15368
+ const vs = chunk3TN5SUQR_js.renderVectorShape(c, isI ? false : hf, fc, sw, sc);
15369
+ const ts = chunk3TN5SUQR_js.getTextStyleForElement(c, chunk3TN5SUQR_js.DEFAULT_TEXT_COLOR);
15370
+ const isTxt = chunk3TN5SUQR_js.isEditableTextElement(c);
15401
15371
  return /* @__PURE__ */ jsxRuntime.jsxs(
15402
15372
  "div",
15403
15373
  {
@@ -15406,9 +15376,9 @@ function renderGroup(children, parentGroupFill) {
15406
15376
  style: {
15407
15377
  left: c.x,
15408
15378
  top: c.y,
15409
- width: Math.max(c.width, chunkZ22RD3E2_js.MIN_ELEMENT_SIZE),
15410
- height: Math.max(c.height, chunkZ22RD3E2_js.MIN_ELEMENT_SIZE),
15411
- transform: chunkZ22RD3E2_js.getElementTransform(c),
15379
+ width: Math.max(c.width, chunk3TN5SUQR_js.MIN_ELEMENT_SIZE),
15380
+ height: Math.max(c.height, chunk3TN5SUQR_js.MIN_ELEMENT_SIZE),
15381
+ transform: chunk3TN5SUQR_js.getElementTransform(c),
15412
15382
  transformOrigin: "center",
15413
15383
  ...ss,
15414
15384
  ...isI ? {
@@ -15433,8 +15403,8 @@ function renderGroup(children, parentGroupFill) {
15433
15403
  // A nested group: recurse, chaining the inherited fill so a
15434
15404
  // `grpFill` shape under a fill-less sub-group still paints.
15435
15405
  renderGroup(c.children, pptx.getGroupChildParentFill(c, parentGroupFill))
15436
- ) : isI && ("svgData" in c && c.svgData || "imageData" in c && c.imageData) ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute inset-0 pointer-events-none", style: chunkZ22RD3E2_js.getImageSurfaceStyle(c), children: [
15437
- chunkZ22RD3E2_js.isImageTiled(c) ? /* @__PURE__ */ jsxRuntime.jsx(
15406
+ ) : isI && ("svgData" in c && c.svgData || "imageData" in c && c.imageData) ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute inset-0 pointer-events-none", style: chunk3TN5SUQR_js.getImageSurfaceStyle(c), children: [
15407
+ chunk3TN5SUQR_js.isImageTiled(c) ? /* @__PURE__ */ jsxRuntime.jsx(
15438
15408
  TiledImageLayer,
15439
15409
  {
15440
15410
  element: c,
@@ -15447,7 +15417,7 @@ function renderGroup(children, parentGroupFill) {
15447
15417
  src: "svgData" in c && c.svgData ? c.svgData : c.imageData,
15448
15418
  alt: i18n.translationsEn["pptx.ink.groupChildAlt"],
15449
15419
  className: "pointer-events-none select-none",
15450
- style: chunkZ22RD3E2_js.getImageRenderStyle(c),
15420
+ style: chunk3TN5SUQR_js.getImageRenderStyle(c),
15451
15421
  draggable: false
15452
15422
  }
15453
15423
  ),
@@ -15459,7 +15429,7 @@ function renderGroup(children, parentGroupFill) {
15459
15429
  {
15460
15430
  className: "relative z-10 w-full h-full pointer-events-none whitespace-pre-wrap break-words leading-[1.3]",
15461
15431
  style: ts,
15462
- children: chunkZ22RD3E2_js.renderTextSegments(c, chunkZ22RD3E2_js.DEFAULT_TEXT_COLOR)
15432
+ children: chunk3TN5SUQR_js.renderTextSegments(c, chunk3TN5SUQR_js.DEFAULT_TEXT_COLOR)
15463
15433
  }
15464
15434
  ) : null
15465
15435
  ] })
@@ -15473,8 +15443,8 @@ function renderContentPart(el, options) {
15473
15443
  if (el.inkStrokes && el.inkStrokes.length > 0) {
15474
15444
  const replay = options?.replay ?? false;
15475
15445
  const pressureSensitive = options?.pressureSensitive ?? true;
15476
- const strokes = chunkZ22RD3E2_js.buildContentPartStrokes(el);
15477
- const replayStyles = replay ? chunkZ22RD3E2_js.getContentPartReplayStyles(el.inkStrokes, options?.replayConfig) : null;
15446
+ const strokes = chunk3TN5SUQR_js.buildContentPartStrokes(el);
15447
+ const replayStyles = replay ? chunk3TN5SUQR_js.getContentPartReplayStyles(el.inkStrokes, options?.replayConfig) : null;
15478
15448
  return /* @__PURE__ */ jsxRuntime.jsxs(
15479
15449
  "svg",
15480
15450
  {
@@ -15482,7 +15452,7 @@ function renderContentPart(el, options) {
15482
15452
  viewBox: `0 0 ${Math.max(el.width, 1)} ${Math.max(el.height, 1)}`,
15483
15453
  preserveAspectRatio: "none",
15484
15454
  children: [
15485
- replay && /* @__PURE__ */ jsxRuntime.jsx("style", { children: chunkZ22RD3E2_js.INK_REPLAY_KEYFRAMES }),
15455
+ replay && /* @__PURE__ */ jsxRuntime.jsx("style", { children: chunk3TN5SUQR_js.INK_REPLAY_KEYFRAMES }),
15486
15456
  strokes.map(
15487
15457
  (s, i) => renderStrokeView(s, pressureSensitive, replayStyles?.[i], `${el.id}-cp-ink-${i}`)
15488
15458
  )
@@ -15709,9 +15679,9 @@ function useInlineListEditor(element, rootRef, onChange, onModelReplacement) {
15709
15679
  collaboration: connected,
15710
15680
  model: pptx.createInlineListModelObserver(element),
15711
15681
  activationSelection,
15712
- children: seed && !connected ? chunkZ22RD3E2_js.renderTextSegments(
15682
+ children: seed && !connected ? chunk3TN5SUQR_js.renderTextSegments(
15713
15683
  element,
15714
- chunkZ22RD3E2_js.DEFAULT_TEXT_COLOR,
15684
+ chunk3TN5SUQR_js.DEFAULT_TEXT_COLOR,
15715
15685
  void 0,
15716
15686
  void 0,
15717
15687
  void 0,
@@ -15947,8 +15917,8 @@ function InlineTextEditor({
15947
15917
  pending.endOffset
15948
15918
  );
15949
15919
  });
15950
- const warpStyle = chunkZ22RD3E2_js.getTextWarpStyle(textStyleRaw);
15951
- const compensationTransform = chunkZ22RD3E2_js.getTextCompensationTransform(element);
15920
+ const warpStyle = chunk3TN5SUQR_js.getTextWarpStyle(textStyleRaw);
15921
+ const compensationTransform = chunk3TN5SUQR_js.getTextCompensationTransform(element);
15952
15922
  const warpTransform = warpStyle?.transform;
15953
15923
  const mergedTransform = [compensationTransform, warpTransform].filter(Boolean).join(" ") || void 0;
15954
15924
  const wrapperStyle = {
@@ -16036,7 +16006,7 @@ function InlineTextEditor({
16036
16006
  const text = e.clipboardData.getData("text/plain");
16037
16007
  document.execCommand("insertText", false, text);
16038
16008
  },
16039
- children: list.seed ? list.children : seed.hasRichSegments ? chunkZ22RD3E2_js.renderTextSegments(element, chunkZ22RD3E2_js.DEFAULT_TEXT_COLOR) : seed.initialText
16009
+ children: list.seed ? list.children : seed.hasRichSegments ? chunk3TN5SUQR_js.renderTextSegments(element, chunk3TN5SUQR_js.DEFAULT_TEXT_COLOR) : seed.initialText
16040
16010
  },
16041
16011
  list.seed?.paragraphs[0].token ?? "plain"
16042
16012
  );
@@ -16201,7 +16171,7 @@ function OleActionFooter({
16201
16171
  info,
16202
16172
  showActions
16203
16173
  }) {
16204
- const { t } = chunkZ22RD3E2_js.useTranslation();
16174
+ const { t } = chunk3TN5SUQR_js.useTranslation();
16205
16175
  if (!showActions || !info.canDownload || !el.oleEmbeddedData) {
16206
16176
  return null;
16207
16177
  }
@@ -16310,7 +16280,7 @@ function SmartArtInlineNodeEditor({
16310
16280
  onCommit,
16311
16281
  onCancel
16312
16282
  }) {
16313
- const { t } = chunkZ22RD3E2_js.useTranslation();
16283
+ const { t } = chunk3TN5SUQR_js.useTranslation();
16314
16284
  const ref = React17__default.default.useRef(null);
16315
16285
  const [value, setValue] = React17__default.default.useState(initialText);
16316
16286
  const settled = React17__default.default.useRef(false);
@@ -16937,7 +16907,7 @@ function SmartArtRendererImpl({
16937
16907
  onUpdateElement,
16938
16908
  animationState
16939
16909
  }) {
16940
- const { t } = chunkZ22RD3E2_js.useTranslation();
16910
+ const { t } = chunk3TN5SUQR_js.useTranslation();
16941
16911
  if (element.type !== "smartArt" || !element.smartArtData) {
16942
16912
  return /* @__PURE__ */ jsxRuntime.jsx(
16943
16913
  "div",
@@ -17183,7 +17153,7 @@ function groupIntoParagraphs(element, fieldContext) {
17183
17153
  element,
17184
17154
  fieldContext ? (seg) => {
17185
17155
  if (seg.fieldType) {
17186
- const substituted = chunkZ22RD3E2_js.substituteFieldText(
17156
+ const substituted = chunk3TN5SUQR_js.substituteFieldText(
17187
17157
  seg.text,
17188
17158
  seg.fieldType,
17189
17159
  fieldContext,
@@ -17218,13 +17188,13 @@ function getSegmentTspanProps(segment, element, fallbackColor) {
17218
17188
  if (s.strikethrough) {
17219
17189
  decos.push("line-through");
17220
17190
  }
17221
- const fill = s.hyperlink ? chunkZ22RD3E2_js.normalizeHexColor(s.color || element.textStyle?.color, chunkZ22RD3E2_js.HYPERLINK_COLOR) : chunkZ22RD3E2_js.normalizeHexColor(s.color || element.textStyle?.color, fallbackColor);
17191
+ const fill = s.hyperlink ? chunk3TN5SUQR_js.normalizeHexColor(s.color || element.textStyle?.color, chunk3TN5SUQR_js.HYPERLINK_COLOR) : chunk3TN5SUQR_js.normalizeHexColor(s.color || element.textStyle?.color, fallbackColor);
17222
17192
  return {
17223
17193
  fill,
17224
- fontSize: s.fontSize ?? element.textStyle?.fontSize ?? chunkZ22RD3E2_js.DEFAULT_TEXT_FONT_SIZE,
17194
+ fontSize: s.fontSize ?? element.textStyle?.fontSize ?? chunk3TN5SUQR_js.DEFAULT_TEXT_FONT_SIZE,
17225
17195
  fontWeight: pptx.resolveFontWeight(s.fontFamily || element.textStyle?.fontFamily, s.bold),
17226
17196
  fontStyle: pptx.resolveFontItalic(s.fontFamily || element.textStyle?.fontFamily, s.italic) ? "italic" : void 0,
17227
- fontFamily: s.fontFamily || element.textStyle?.fontFamily ? pptx$1.getSubstituteFontFamily(s.fontFamily || element.textStyle?.fontFamily || "") : chunkZ22RD3E2_js.DEFAULT_FONT_FAMILY,
17197
+ fontFamily: s.fontFamily || element.textStyle?.fontFamily ? pptx$1.getSubstituteFontFamily(s.fontFamily || element.textStyle?.fontFamily || "") : chunk3TN5SUQR_js.DEFAULT_FONT_FAMILY,
17228
17198
  textDecoration: decos.length > 0 ? decos.join(" ") : void 0
17229
17199
  };
17230
17200
  }
@@ -17232,8 +17202,8 @@ function resolveSegmentFont(segment, element) {
17232
17202
  const s = segment.style || {};
17233
17203
  const family = s.fontFamily || element.textStyle?.fontFamily;
17234
17204
  return {
17235
- fontFamily: family ? pptx$1.getSubstituteFontFamily(family) : chunkZ22RD3E2_js.DEFAULT_FONT_FAMILY,
17236
- fontSizePx: s.fontSize ?? element.textStyle?.fontSize ?? chunkZ22RD3E2_js.DEFAULT_TEXT_FONT_SIZE,
17205
+ fontFamily: family ? pptx$1.getSubstituteFontFamily(family) : chunk3TN5SUQR_js.DEFAULT_FONT_FAMILY,
17206
+ fontSizePx: s.fontSize ?? element.textStyle?.fontSize ?? chunk3TN5SUQR_js.DEFAULT_TEXT_FONT_SIZE,
17237
17207
  bold: s.bold ?? element.textStyle?.bold,
17238
17208
  italic: s.italic ?? element.textStyle?.italic
17239
17209
  };
@@ -17317,9 +17287,9 @@ function WarpedText({
17317
17287
  const warpAdj2 = textEl.textStyle?.textWarpAdj2;
17318
17288
  const align = textEl.textStyle?.align ?? "center";
17319
17289
  const { startOffset, textAnchor } = getAlignmentProps(align);
17320
- const baseFontSize = textEl.textStyle?.fontSize ?? chunkZ22RD3E2_js.DEFAULT_TEXT_FONT_SIZE;
17321
- const baseFontFamily = textEl.textStyle?.fontFamily ? pptx$1.getSubstituteFontFamily(textEl.textStyle.fontFamily) : chunkZ22RD3E2_js.DEFAULT_FONT_FAMILY;
17322
- const baseFill = chunkZ22RD3E2_js.normalizeHexColor(textEl.textStyle?.color, fallbackColor);
17290
+ const baseFontSize = textEl.textStyle?.fontSize ?? chunk3TN5SUQR_js.DEFAULT_TEXT_FONT_SIZE;
17291
+ const baseFontFamily = textEl.textStyle?.fontFamily ? pptx$1.getSubstituteFontFamily(textEl.textStyle.fontFamily) : chunk3TN5SUQR_js.DEFAULT_FONT_FAMILY;
17292
+ const baseFill = chunk3TN5SUQR_js.normalizeHexColor(textEl.textStyle?.color, fallbackColor);
17323
17293
  if (pptx.hasGlyphEnvelope(preset)) {
17324
17294
  const perLine = pptx.buildGlyphEnvelopeBlock(
17325
17295
  preset,
@@ -17421,7 +17391,7 @@ function WarpedText({
17421
17391
  var GLYPH_BY_SHAPE = /* @__PURE__ */ buildGlyphByShape();
17422
17392
  function buildGlyphByShape() {
17423
17393
  const glyphs = Object.fromEntries(
17424
- chunkZ22RD3E2_js.ACTION_BUTTON_PRESETS.map((p) => [p.shapeType, p.iconPath])
17394
+ chunk3TN5SUQR_js.ACTION_BUTTON_PRESETS.map((p) => [p.shapeType, p.iconPath])
17425
17395
  );
17426
17396
  glyphs["actionButtonForwardOrNext"] = glyphs["actionButtonForwardNext"];
17427
17397
  glyphs["actionButtonBackOrPrevious"] = glyphs["actionButtonBackPrevious"];
@@ -17495,9 +17465,9 @@ function renderTextElementBody(options) {
17495
17465
  const useSvgWarp = pptx.shouldUseSvgWarp(
17496
17466
  pptx$1.hasTextProperties(el) ? el.textStyle?.textWarpPreset : void 0
17497
17467
  );
17498
- const scene3dStyle = pptx$1.hasTextProperties(el) ? chunkZ22RD3E2_js.buildTextBody3DSceneStyle(el.textStyle, { width: el.width, height: el.height }) : void 0;
17468
+ const scene3dStyle = pptx$1.hasTextProperties(el) ? chunk3TN5SUQR_js.buildTextBody3DSceneStyle(el.textStyle, { width: el.width, height: el.height }) : void 0;
17499
17469
  const rotationTransform = pptx.getTextBodyRotationTransform(el);
17500
- const composedTransform = [rotationTransform, chunkZ22RD3E2_js.getTextCompensationTransform(el), scene3dStyle?.transform].filter(Boolean).join(" ") || void 0;
17470
+ const composedTransform = [rotationTransform, chunk3TN5SUQR_js.getTextCompensationTransform(el), scene3dStyle?.transform].filter(Boolean).join(" ") || void 0;
17501
17471
  const transformStyle = {
17502
17472
  transform: composedTransform,
17503
17473
  // A COM-measured homography (`scene3dStyle.transformOrigin === '0 0'`)
@@ -17527,18 +17497,18 @@ function renderTextElementBody(options) {
17527
17497
  shouldRenderText && (useSvgWarp ? /* @__PURE__ */ jsxRuntime.jsx(
17528
17498
  "div",
17529
17499
  {
17530
- className: chunkZ22RD3E2_js.cn(
17500
+ className: chunk3TN5SUQR_js.cn(
17531
17501
  "relative z-10 w-full h-full",
17532
17502
  onHyperlinkClick ? "" : "pointer-events-none"
17533
17503
  ),
17534
- style: { ...chunkZ22RD3E2_js.getTextLayoutStyle(el), ...transformStyle },
17504
+ style: { ...chunk3TN5SUQR_js.getTextLayoutStyle(el), ...transformStyle },
17535
17505
  children: /* @__PURE__ */ jsxRuntime.jsx(
17536
17506
  WarpedText,
17537
17507
  {
17538
17508
  element: el,
17539
17509
  width: el.width,
17540
17510
  height: el.height,
17541
- fallbackColor: chunkZ22RD3E2_js.DEFAULT_TEXT_COLOR,
17511
+ fallbackColor: chunk3TN5SUQR_js.DEFAULT_TEXT_COLOR,
17542
17512
  findHighlights: findHl,
17543
17513
  fieldContext
17544
17514
  }
@@ -17547,19 +17517,19 @@ function renderTextElementBody(options) {
17547
17517
  ) : /* @__PURE__ */ jsxRuntime.jsx(
17548
17518
  "div",
17549
17519
  {
17550
- className: chunkZ22RD3E2_js.cn(
17520
+ className: chunk3TN5SUQR_js.cn(
17551
17521
  "relative z-10 w-full h-full whitespace-pre-wrap break-words leading-[1.3]",
17552
17522
  onHyperlinkClick ? "" : "pointer-events-none"
17553
17523
  ),
17554
17524
  style: {
17555
- ...chunkZ22RD3E2_js.getTextLayoutStyle(el),
17525
+ ...chunk3TN5SUQR_js.getTextLayoutStyle(el),
17556
17526
  ...txtS,
17557
- ...chunkZ22RD3E2_js.getTextWarpStyle(txtSE),
17527
+ ...chunk3TN5SUQR_js.getTextWarpStyle(txtSE),
17558
17528
  ...transformStyle
17559
17529
  },
17560
- children: chunkZ22RD3E2_js.renderTextSegments(
17530
+ children: chunk3TN5SUQR_js.renderTextSegments(
17561
17531
  el,
17562
- chunkZ22RD3E2_js.DEFAULT_TEXT_COLOR,
17532
+ chunk3TN5SUQR_js.DEFAULT_TEXT_COLOR,
17563
17533
  void 0,
17564
17534
  findHl,
17565
17535
  onHyperlinkClick,
@@ -17580,7 +17550,7 @@ function ZoomElementRenderer({
17580
17550
  onZoomClick,
17581
17551
  sourceSlideIndex
17582
17552
  }) {
17583
- const { t } = chunkZ22RD3E2_js.useTranslation();
17553
+ const { t } = chunk3TN5SUQR_js.useTranslation();
17584
17554
  const summaryView = pptx.buildSummaryZoomView(
17585
17555
  element,
17586
17556
  (index) => {
@@ -17878,7 +17848,7 @@ function renderBody(options) {
17878
17848
  );
17879
17849
  }
17880
17850
  if (isImg) {
17881
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute inset-0 pointer-events-none", style: chunkZ22RD3E2_js.getImageSurfaceStyle(el), children: [
17851
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute inset-0 pointer-events-none", style: chunk3TN5SUQR_js.getImageSurfaceStyle(el), children: [
17882
17852
  renderImg(el, imgStyle, imgFilter, imgAlt, imgOpacity),
17883
17853
  vecShape ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none absolute inset-0", children: vecShape }) : null
17884
17854
  ] });
@@ -17895,7 +17865,7 @@ function renderBody(options) {
17895
17865
  textDirection: txtSE?.textDirection,
17896
17866
  textStyle: txtS,
17897
17867
  textStyleRaw: txtSE,
17898
- layoutStyle: chunkZ22RD3E2_js.getTextLayoutStyle(el),
17868
+ layoutStyle: chunk3TN5SUQR_js.getTextLayoutStyle(el),
17899
17869
  element: el,
17900
17870
  onCommit,
17901
17871
  onCancel,
@@ -17906,7 +17876,7 @@ function renderBody(options) {
17906
17876
  ] });
17907
17877
  }
17908
17878
  if (el.type === "table") {
17909
- return chunkZ22RD3E2_js.renderTableElement(el, txtS, {
17879
+ return chunk3TN5SUQR_js.renderTableElement(el, txtS, {
17910
17880
  editable: isSel,
17911
17881
  selectedCell: isSel ? tableSt : null,
17912
17882
  onSelectCell: onCellSel,
@@ -17939,7 +17909,7 @@ function renderBody(options) {
17939
17909
  );
17940
17910
  }
17941
17911
  if (el.type === "media") {
17942
- return chunkZ22RD3E2_js.renderMediaElement(el, media, {
17912
+ return chunk3TN5SUQR_js.renderMediaElement(el, media, {
17943
17913
  // Present mode autoplays every media element on the active slide,
17944
17914
  // not only ones persisted with their own `autoPlay` flag (matching
17945
17915
  // the other four bindings' unconditional `presenting`-gated
@@ -17991,27 +17961,27 @@ function renderBody(options) {
17991
17961
  }
17992
17962
  return renderGroup(el.children, pptx.getGroupChildParentFill(el));
17993
17963
  }
17994
- if (chunkZ22RD3E2_js.shouldRenderFallbackLabel(el, isTxtEl)) {
17995
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children: chunkZ22RD3E2_js.getElementLabel(el) });
17964
+ if (chunk3TN5SUQR_js.shouldRenderFallbackLabel(el, isTxtEl)) {
17965
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children: chunk3TN5SUQR_js.getElementLabel(el) });
17996
17966
  }
17997
17967
  return renderTextElementBody(options);
17998
17968
  }
17999
17969
  function defaultTextColorForFill(fillColor) {
18000
17970
  const hex = String(fillColor ?? "").replace(/^#/u, "");
18001
17971
  if (!/^[0-9a-f]{6}$/iu.test(hex)) {
18002
- return chunkZ22RD3E2_js.DEFAULT_TEXT_COLOR;
17972
+ return chunk3TN5SUQR_js.DEFAULT_TEXT_COLOR;
18003
17973
  }
18004
17974
  const channels = [0, 2, 4].map((offset) => Number.parseInt(hex.slice(offset, offset + 2), 16) / 255).map((channel) => channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4);
18005
17975
  const luminance = channels[0] * 0.2126 + channels[1] * 0.7152 + channels[2] * 0.0722;
18006
- return luminance > 0.179 ? chunkZ22RD3E2_js.DEFAULT_TEXT_COLOR : "#ffffff";
17976
+ return luminance > 0.179 ? chunk3TN5SUQR_js.DEFAULT_TEXT_COLOR : "#ffffff";
18007
17977
  }
18008
17978
  function getStaticElementVisualState(element, parentGroupFill) {
18009
17979
  const style = pptx$1.hasShapeProperties(element) ? element.shapeStyle : void 0;
18010
- const hasFill = style?.fillColor !== void 0 && style.fillColor !== "transparent" || Boolean(chunkZ22RD3E2_js.buildCssGradientFromShapeStyle(style) || style?.fillGradient) || style?.fillMode === "pattern" && Boolean(style.fillPatternPreset);
18011
- const fill = chunkZ22RD3E2_js.normalizeHexColor(style?.fillColor, chunkZ22RD3E2_js.DEFAULT_FILL_COLOR);
17980
+ const hasFill = style?.fillColor !== void 0 && style.fillColor !== "transparent" || Boolean(chunk3TN5SUQR_js.buildCssGradientFromShapeStyle(style) || style?.fillGradient) || style?.fillMode === "pattern" && Boolean(style.fillPatternPreset);
17981
+ const fill = chunk3TN5SUQR_js.normalizeHexColor(style?.fillColor, chunk3TN5SUQR_js.DEFAULT_FILL_COLOR);
18012
17982
  const strokeWidth = pptx.paintedStrokeWidth(style);
18013
- const stroke = chunkZ22RD3E2_js.normalizeHexColor(style?.strokeColor, chunkZ22RD3E2_js.DEFAULT_STROKE_COLOR);
18014
- const baseVisualStyle = chunkZ22RD3E2_js.getShapeVisualStyle(element, hasFill, fill, strokeWidth, stroke);
17983
+ const stroke = chunk3TN5SUQR_js.normalizeHexColor(style?.strokeColor, chunk3TN5SUQR_js.DEFAULT_STROKE_COLOR);
17984
+ const baseVisualStyle = chunk3TN5SUQR_js.getShapeVisualStyle(element, hasFill, fill, strokeWidth, stroke);
18015
17985
  const inheritedFill = pptx.resolveGroupChildFill(element, parentGroupFill);
18016
17986
  const visualStyle = inheritedFill ? {
18017
17987
  ...baseVisualStyle,
@@ -18021,9 +17991,9 @@ function getStaticElementVisualState(element, parentGroupFill) {
18021
17991
  backgroundSize: inheritedFill.backgroundSize,
18022
17992
  backgroundPosition: inheritedFill.backgroundPosition
18023
17993
  } : baseVisualStyle;
18024
- const textStyle = chunkZ22RD3E2_js.getTextStyleForElement(
17994
+ const textStyle = chunk3TN5SUQR_js.getTextStyleForElement(
18025
17995
  element,
18026
- element.type === "shape" && hasFill ? defaultTextColorForFill(fill) : chunkZ22RD3E2_js.DEFAULT_TEXT_COLOR
17996
+ element.type === "shape" && hasFill ? defaultTextColorForFill(fill) : chunk3TN5SUQR_js.DEFAULT_TEXT_COLOR
18027
17997
  );
18028
17998
  const isImage = element.type === "picture" || element.type === "image";
18029
17999
  const letsTextOverflow = pptx$1.hasTextProperties(element) && element.textStyle?.autoFitMode === "shrink" && (element.type === "text" || element.locks?.txBox === true);
@@ -18048,7 +18018,7 @@ function getStaticElementInteractionState(element, hasActionHandler, exposeEleme
18048
18018
  return { action, isActionable, contractRole };
18049
18019
  }
18050
18020
  function getStaticElementWrapperClassName(element, visual, positioned, isActionable) {
18051
- const overflowClass = visual.isImage || visual.strokeWidth > 0 || element.type === "group" || chunkZ22RD3E2_js.isConnectorOrLineElement(element) || visual.isCallout || visual.letsTextOverflow ? "" : "overflow-hidden";
18021
+ const overflowClass = visual.isImage || visual.strokeWidth > 0 || element.type === "group" || chunk3TN5SUQR_js.isConnectorOrLineElement(element) || visual.isCallout || visual.letsTextOverflow ? "" : "overflow-hidden";
18052
18022
  const pointerClass = isActionable ? "pointer-events-auto cursor-pointer" : "pointer-events-none";
18053
18023
  return `${positioned ? "absolute" : "relative"} ${overflowClass} ${pointerClass}`;
18054
18024
  }
@@ -18131,7 +18101,7 @@ function StaticElementRendererImpl({
18131
18101
  top: positioned ? element.y : void 0,
18132
18102
  width: positioned ? Math.max(element.width, 1) : "100%",
18133
18103
  height: positioned ? Math.max(element.height, 1) : "100%",
18134
- transform: positioned ? chunkZ22RD3E2_js.getElementTransform(element) : void 0,
18104
+ transform: positioned ? chunk3TN5SUQR_js.getElementTransform(element) : void 0,
18135
18105
  transformOrigin: "center",
18136
18106
  zIndex,
18137
18107
  ...visualStyle,
@@ -18174,18 +18144,18 @@ function StaticElementRendererImpl({
18174
18144
  spellCheck: false,
18175
18145
  txtSE: pptx$1.hasTextProperties(element) ? element.textStyle : void 0,
18176
18146
  txtS: textStyle,
18177
- vecShape: chunkZ22RD3E2_js.renderVectorShape(
18147
+ vecShape: chunk3TN5SUQR_js.renderVectorShape(
18178
18148
  element,
18179
18149
  isImage ? false : hasFill,
18180
18150
  fill,
18181
18151
  strokeWidth,
18182
18152
  stroke
18183
18153
  ),
18184
- imgStyle: imageAnimation ? { ...chunkZ22RD3E2_js.getImageRenderStyle(element), animation: imageAnimation } : chunkZ22RD3E2_js.getImageRenderStyle(element),
18185
- imgFilter: chunkZ22RD3E2_js.getImageEffectsFilter(element),
18186
- imgOpacity: chunkZ22RD3E2_js.getImageEffectsOpacity(element),
18154
+ imgStyle: imageAnimation ? { ...chunk3TN5SUQR_js.getImageRenderStyle(element), animation: imageAnimation } : chunk3TN5SUQR_js.getImageRenderStyle(element),
18155
+ imgFilter: chunk3TN5SUQR_js.getImageEffectsFilter(element),
18156
+ imgOpacity: chunk3TN5SUQR_js.getImageEffectsOpacity(element),
18187
18157
  imgAlt: "",
18188
- isTxtEl: chunkZ22RD3E2_js.isEditableTextElement(element),
18158
+ isTxtEl: chunk3TN5SUQR_js.isEditableTextElement(element),
18189
18159
  media: mediaDataUrls,
18190
18160
  tableSt: null,
18191
18161
  isSel: false,
@@ -18233,7 +18203,7 @@ function SlideLayer({
18233
18203
  style: {
18234
18204
  width: safeWidth,
18235
18205
  height: safeHeight,
18236
- backgroundColor: slide.backgroundColor ? chunkZ22RD3E2_js.normalizeHexColor(slide.backgroundColor, "#ffffff") : "#ffffff",
18206
+ backgroundColor: slide.backgroundColor ? chunk3TN5SUQR_js.normalizeHexColor(slide.backgroundColor, "#ffffff") : "#ffffff",
18237
18207
  backgroundImage: slide.backgroundImage ? `url(${slide.backgroundImage})` : slide.backgroundGradient ? slide.backgroundGradient : void 0,
18238
18208
  backgroundSize: slide.backgroundImage ? "cover" : void 0,
18239
18209
  backgroundPosition: slide.backgroundImage ? "center" : void 0
@@ -18780,6 +18750,7 @@ exports.useBroadcastFollower = useBroadcastFollower;
18780
18750
  exports.useCanvasInteractions = useCanvasInteractions;
18781
18751
  exports.useChartFormatContext = useChartFormatContext;
18782
18752
  exports.useChartPartSelection = useChartPartSelection;
18753
+ exports.useClearSelectionOnSlideChange = useClearSelectionOnSlideChange;
18783
18754
  exports.useClipboardHandlers = useClipboardHandlers;
18784
18755
  exports.useCollaboration = useCollaboration;
18785
18756
  exports.useCollaborationDocumentSync = useCollaborationDocumentSync;