ooxml-ui 1.20.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +18 -9
  2. package/dist/{chunk-4XPAPETH.js → chunk-DRBAJ5UO.js} +2 -1
  3. package/dist/{chunk-UB36NYDT.js → chunk-REJECZGV.js} +1 -1
  4. package/dist/docx/building-blocks-actions.d.ts +54 -0
  5. package/dist/docx/building-blocks-status.d.ts +34 -0
  6. package/dist/docx/building-blocks.d.ts +20 -4
  7. package/dist/docx/editor-core.d.ts +5 -0
  8. package/dist/docx/element-api.d.ts +12 -0
  9. package/dist/docx/index.d.ts +3 -1
  10. package/dist/docx/insert-controller.d.ts +2 -0
  11. package/dist/docx/locales/en-app.d.ts +1 -0
  12. package/dist/docx/locales/en.d.ts +1 -0
  13. package/dist/docx/localization-strings.d.ts +1 -0
  14. package/dist/docx/surface-navigation.d.ts +8 -0
  15. package/dist/docx.js +337 -11
  16. package/dist/index.js +2 -2
  17. package/dist/parse-worker.js +5 -1
  18. package/dist/pptx/{chunk-ABDWUQRQ.cjs → chunk-72NIN6QF.cjs} +275 -60
  19. package/dist/pptx/{chunk-F6P7VS5I.mjs → chunk-VGOIAVPA.mjs} +266 -61
  20. package/dist/pptx/dom/index.cjs +209 -209
  21. package/dist/pptx/dom/index.mjs +2 -2
  22. package/dist/pptx/index.cjs +2926 -2886
  23. package/dist/pptx/index.mjs +1 -1
  24. package/dist/pptx/render/collaboration-options.d.ts +11 -9
  25. package/dist/pptx/render/collaboration-options.d.ts.map +1 -1
  26. package/dist/pptx/render/collaboration-owned-session.d.ts +34 -0
  27. package/dist/pptx/render/collaboration-owned-session.d.ts.map +1 -0
  28. package/dist/pptx/render/collaboration-state.d.ts +47 -0
  29. package/dist/pptx/render/collaboration-state.d.ts.map +1 -0
  30. package/dist/pptx/render/collaboration-writeback.d.ts +28 -1
  31. package/dist/pptx/render/collaboration-writeback.d.ts.map +1 -1
  32. package/dist/pptx/render/index.d.ts +2 -0
  33. package/dist/pptx/render/index.d.ts.map +1 -1
  34. package/dist/pptx/render/morph-predicates.d.ts +7 -0
  35. package/dist/pptx/render/morph-predicates.d.ts.map +1 -1
  36. package/dist/pptx/render/viewer-props-manifest.d.ts.map +1 -1
  37. package/dist/pptx/types.d.ts +25 -2
  38. package/dist/pptx/types.d.ts.map +1 -1
  39. package/dist/pptx/web-components/office-aliases.d.ts +1 -1
  40. package/dist/teams.js +1 -1
  41. package/dist/visio/building-blocks-shapes.d.ts +9 -0
  42. package/dist/visio/building-blocks-toolbar.d.ts +87 -0
  43. package/dist/visio/building-blocks.d.ts +9 -32
  44. package/dist/visio/canvas-editing.d.ts +45 -0
  45. package/dist/visio/canvas-keys.d.ts +9 -0
  46. package/dist/visio/canvas-services.d.ts +18 -0
  47. package/dist/visio/collaboration-types.d.ts +2 -2
  48. package/dist/visio/controller.d.ts +31 -1
  49. package/dist/visio/diagram-tool.d.ts +11 -0
  50. package/dist/visio/index.d.ts +1 -1
  51. package/dist/visio/viewer-clipboard.d.ts +7 -1
  52. package/dist/visio/viewer-delete.d.ts +10 -0
  53. package/dist/visio/viewer-presence-overlay.d.ts +12 -0
  54. package/dist/visio/viewer-presence.d.ts +19 -0
  55. package/dist/visio/viewer-share-sync.d.ts +15 -10
  56. package/dist/visio/viewer-share.d.ts +9 -7
  57. package/dist/visio/viewer-stencil.d.ts +8 -0
  58. package/dist/visio/viewer-write-back.d.ts +32 -0
  59. package/dist/visio/worker-parser.d.ts +11 -1
  60. package/dist/visio.js +19930 -19210
  61. package/dist/xlsx/building-blocks.d.ts +34 -0
  62. package/dist/xlsx/editor-core.d.ts +8 -0
  63. package/dist/xlsx/element-api.d.ts +12 -1
  64. package/dist/xlsx/events.d.ts +12 -1
  65. package/dist/xlsx/grid/alert-route.d.ts +21 -0
  66. package/dist/xlsx/index.d.ts +2 -1
  67. package/dist/xlsx/surface-actions.d.ts +73 -0
  68. package/dist/xlsx.js +190 -23
  69. package/package.json +2 -2
@@ -81,6 +81,7 @@ var collaborationTextNativeEdit = require('ooxml-core/pptx/editor/render/collabo
81
81
  var collaborationTextSnapshotPositions = require('ooxml-core/pptx/editor/render/collaboration-text-snapshot-positions');
82
82
  var collaborationLoadOrigin = require('ooxml-core/pptx/editor/render/collaboration-load-origin');
83
83
  var collaborationDeparture = require('ooxml-core/pptx/editor/render/collaboration-departure');
84
+ var collab = require('ooxml-core/collab');
84
85
  var slideTransitionEdits = require('ooxml-core/pptx/editor/render/slide-transition-edits');
85
86
  var diagram = require('ooxml-core/diagram');
86
87
  var slideSearch = require('ooxml-core/pptx/editor/render/slide-search');
@@ -218,6 +219,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
218
219
  CHART_TYPE_OPTIONS: () => CHART_TYPE_OPTIONS,
219
220
  CINEMATIC_TRANSITION_KEYFRAMES: () => CINEMATIC_TRANSITION_KEYFRAMES,
220
221
  CLOSED_READING_VIEW: () => CLOSED_READING_VIEW,
222
+ COLLABORATION_OFF: () => COLLABORATION_OFF,
221
223
  COLLAB_LEAVE_MESSAGE: () => COLLAB_LEAVE_MESSAGE,
222
224
  COMBO_SERIES_TYPE_OPTIONS: () => COMBO_SERIES_TYPE_OPTIONS,
223
225
  COMBO_SUPPORTED_TYPES: () => COMBO_SUPPORTED_TYPES,
@@ -305,6 +307,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
305
307
  DEFAULT_MOTION_PATH_DURATION_MS: () => DEFAULT_MOTION_PATH_DURATION_MS,
306
308
  DEFAULT_MOTION_PATH_PRESET_ID: () => chunkXFQ2RD4I_cjs.DEFAULT_MOTION_PATH_PRESET_ID,
307
309
  DEFAULT_NOTES_FONT_SIZE_PT: () => DEFAULT_NOTES_FONT_SIZE_PT,
310
+ DEFAULT_OWNED_USER_NAME: () => DEFAULT_OWNED_USER_NAME,
308
311
  DEFAULT_PALETTE: () => chunkG3UVZ5FO_cjs.DEFAULT_PALETTE,
309
312
  DEFAULT_POINTER_PRESSURE: () => DEFAULT_POINTER_PRESSURE,
310
313
  DEFAULT_PREVIEW_ELEMENT_CAP: () => DEFAULT_PREVIEW_ELEMENT_CAP,
@@ -599,6 +602,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
599
602
  PIXELATE_OUT_KEYFRAMES: () => PIXELATE_OUT_KEYFRAMES,
600
603
  PNG_COLOR_TYPE_RGBA: () => PNG_COLOR_TYPE_RGBA,
601
604
  PNG_SIGNATURE: () => PNG_SIGNATURE,
605
+ POWERPOINT_BROADCAST_PREFIX: () => POWERPOINT_BROADCAST_PREFIX,
602
606
  PPTX_OPEN_ACCEPT: () => PPTX_OPEN_ACCEPT,
603
607
  PRESENCE_HEARTBEAT_MS: () => PRESENCE_HEARTBEAT_MS,
604
608
  PRESENTATION_ANIM_TRIGGER_ATTRIBUTE: () => PRESENTATION_ANIM_TRIGGER_ATTRIBUTE,
@@ -1066,6 +1070,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
1066
1070
  buildClearHyperlinkPatch: () => buildClearHyperlinkPatch,
1067
1071
  buildClickGroups: () => buildClickGroups,
1068
1072
  buildCollaborationShareUrl: () => buildCollaborationShareUrl,
1073
+ buildCollaborationState: () => buildCollaborationState,
1069
1074
  buildColorAnimationKeyframes: () => buildColorAnimationKeyframes,
1070
1075
  buildColorInterpolationProps: () => buildColorInterpolationProps,
1071
1076
  buildColorTavKeyframe: () => buildColorTavKeyframe,
@@ -1413,6 +1418,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
1413
1418
  cloneXmlObject: () => clone.cloneXmlObject,
1414
1419
  closeEditPath: () => closeEditPath,
1415
1420
  closeReadingView: () => closeReadingView,
1421
+ collaborationStatesEqual: () => collaborationStatesEqual,
1416
1422
  collapseChartTitleRunsForEdit: () => chunkG3UVZ5FO_cjs.collapseChartTitleRunsForEdit,
1417
1423
  collectAccessibilityIssues: () => collectAccessibilityIssues,
1418
1424
  collectAnimationSoundPaths: () => chunkU47LRWDT_cjs.collectAnimationSoundPaths,
@@ -1593,6 +1599,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
1593
1599
  createBackstagePresentation: () => createBackstagePresentation,
1594
1600
  createBlankSlide: () => slideOperations.createBlankSlide,
1595
1601
  createCollaborationLivePatcher: () => createCollaborationLivePatcher,
1602
+ createCollaborationStateReporter: () => createCollaborationStateReporter,
1596
1603
  createCustomShow: () => createCustomShow,
1597
1604
  createCustomThemeEdit: () => themeEditorModel.createCustomThemeEdit,
1598
1605
  createCustomizationController: () => createCustomizationController,
@@ -2376,6 +2383,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
2376
2383
  isRunHyperlinkClickable: () => isRunHyperlinkClickable,
2377
2384
  isSafeSvgMarkup: () => isSafeSvgMarkup,
2378
2385
  isSameArtisticEffect: () => isSameArtisticEffect,
2386
+ isSameBrowserRoom: () => isSameBrowserRoom,
2379
2387
  isSameChartPart: () => chunkLCB46TH2_cjs.isSameChartPart,
2380
2388
  isSeriesOnSecondaryAxis: () => chunkG3UVZ5FO_cjs.isSeriesOnSecondaryAxis,
2381
2389
  isSeriesUsingSecondaryAxis: () => isSeriesUsingSecondaryAxis,
@@ -2542,6 +2550,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
2542
2550
  nearestCubicParam: () => nearestCubicParam,
2543
2551
  nearestLineParam: () => nearestLineParam,
2544
2552
  needsMorphFlattening: () => needsMorphFlattening,
2553
+ needsOwnedSession: () => needsOwnedSession,
2545
2554
  needsSvgArtisticFilter: () => needsSvgArtisticFilter,
2546
2555
  nestedTextDecorationStyle: () => nestedTextDecorationStyle,
2547
2556
  neutralizeDeviceStrokes: () => chunkW7CBPO77_cjs.neutralizeDeviceStrokes,
@@ -2590,6 +2599,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
2590
2599
  openEditPathAtNode: () => openEditPathAtNode,
2591
2600
  openFilePicker: () => openFilePicker,
2592
2601
  openNativeEyeDropper: () => openNativeEyeDropper,
2602
+ openOwnedCollaboration: () => openOwnedCollaboration,
2593
2603
  openPendingPrintWindow: () => openPendingPrintWindow,
2594
2604
  openPptxFile: () => openPptxFile,
2595
2605
  openPrintWindow: () => openPrintWindow,
@@ -3566,6 +3576,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
3566
3576
  wrapNotesText: () => wrapNotesText,
3567
3577
  wrapTextByEstimatedWidth: () => chunkG3UVZ5FO_cjs.wrapTextByEstimatedWidth,
3568
3578
  writeAssetFields: () => collaborationSync.writeAssetFields,
3579
+ writeBackReport: () => writeBackReport,
3569
3580
  writeElementParagraphs: () => writeElementParagraphs,
3570
3581
  writeElementToYMap: () => collaborationSync.writeElementToYMap,
3571
3582
  writeSlideToYMap: () => collaborationSync.writeSlideToYMap,
@@ -3887,6 +3898,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
3887
3898
  CHART_TYPE_LABEL_KEYS: () => CHART_TYPE_LABEL_KEYS,
3888
3899
  CHART_TYPE_OPTIONS: () => CHART_TYPE_OPTIONS,
3889
3900
  CLOSED_READING_VIEW: () => CLOSED_READING_VIEW,
3901
+ COLLABORATION_OFF: () => COLLABORATION_OFF,
3890
3902
  COLLAB_LEAVE_MESSAGE: () => COLLAB_LEAVE_MESSAGE,
3891
3903
  COMBO_SERIES_TYPE_OPTIONS: () => COMBO_SERIES_TYPE_OPTIONS,
3892
3904
  COMBO_SUPPORTED_TYPES: () => COMBO_SUPPORTED_TYPES,
@@ -3966,6 +3978,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
3966
3978
  DEFAULT_MOTION_PATH_DURATION_MS: () => DEFAULT_MOTION_PATH_DURATION_MS,
3967
3979
  DEFAULT_MOTION_PATH_PRESET_ID: () => chunkXFQ2RD4I_cjs.DEFAULT_MOTION_PATH_PRESET_ID,
3968
3980
  DEFAULT_NOTES_FONT_SIZE_PT: () => DEFAULT_NOTES_FONT_SIZE_PT,
3981
+ DEFAULT_OWNED_USER_NAME: () => DEFAULT_OWNED_USER_NAME,
3969
3982
  DEFAULT_PALETTE: () => chunkG3UVZ5FO_cjs.DEFAULT_PALETTE,
3970
3983
  DEFAULT_POINTER_PRESSURE: () => DEFAULT_POINTER_PRESSURE,
3971
3984
  DEFAULT_PREVIEW_ELEMENT_CAP: () => DEFAULT_PREVIEW_ELEMENT_CAP,
@@ -4232,6 +4245,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
4232
4245
  PIXELATE_IN_KEYFRAMES: () => PIXELATE_IN_KEYFRAMES,
4233
4246
  PIXELATE_LEVELS: () => PIXELATE_LEVELS,
4234
4247
  PIXELATE_OUT_KEYFRAMES: () => PIXELATE_OUT_KEYFRAMES,
4248
+ POWERPOINT_BROADCAST_PREFIX: () => POWERPOINT_BROADCAST_PREFIX,
4235
4249
  PPTX_OPEN_ACCEPT: () => PPTX_OPEN_ACCEPT,
4236
4250
  PRESENCE_HEARTBEAT_MS: () => PRESENCE_HEARTBEAT_MS,
4237
4251
  PRESENTATION_ANIM_TRIGGER_ATTRIBUTE: () => PRESENTATION_ANIM_TRIGGER_ATTRIBUTE,
@@ -4679,6 +4693,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
4679
4693
  buildClearHyperlinkPatch: () => buildClearHyperlinkPatch,
4680
4694
  buildClickGroups: () => buildClickGroups,
4681
4695
  buildCollaborationShareUrl: () => buildCollaborationShareUrl,
4696
+ buildCollaborationState: () => buildCollaborationState,
4682
4697
  buildColorAnimationKeyframes: () => buildColorAnimationKeyframes,
4683
4698
  buildColorInterpolationProps: () => buildColorInterpolationProps,
4684
4699
  buildColorTavKeyframe: () => buildColorTavKeyframe,
@@ -5004,6 +5019,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
5004
5019
  cloneXmlObject: () => clone.cloneXmlObject,
5005
5020
  closeEditPath: () => closeEditPath,
5006
5021
  closeReadingView: () => closeReadingView,
5022
+ collaborationStatesEqual: () => collaborationStatesEqual,
5007
5023
  collapseChartTitleRunsForEdit: () => chunkG3UVZ5FO_cjs.collapseChartTitleRunsForEdit,
5008
5024
  collectAccessibilityIssues: () => collectAccessibilityIssues,
5009
5025
  collectChartBuildInfo: () => collectChartBuildInfo,
@@ -5164,6 +5180,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
5164
5180
  createBackstagePresentation: () => createBackstagePresentation,
5165
5181
  createBlankSlide: () => slideOperations.createBlankSlide,
5166
5182
  createCollaborationLivePatcher: () => createCollaborationLivePatcher,
5183
+ createCollaborationStateReporter: () => createCollaborationStateReporter,
5167
5184
  createCustomShow: () => createCustomShow,
5168
5185
  createCustomThemeEdit: () => themeEditorModel.createCustomThemeEdit,
5169
5186
  createCustomizationController: () => createCustomizationController,
@@ -5899,6 +5916,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
5899
5916
  isRowBoundaryMergedAt: () => isRowBoundaryMergedAt,
5900
5917
  isRunHyperlinkClickable: () => isRunHyperlinkClickable,
5901
5918
  isSameArtisticEffect: () => isSameArtisticEffect,
5919
+ isSameBrowserRoom: () => isSameBrowserRoom,
5902
5920
  isSameChartPart: () => chunkLCB46TH2_cjs.isSameChartPart,
5903
5921
  isSeriesOnSecondaryAxis: () => chunkG3UVZ5FO_cjs.isSeriesOnSecondaryAxis,
5904
5922
  isSeriesUsingSecondaryAxis: () => isSeriesUsingSecondaryAxis,
@@ -6061,6 +6079,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
6061
6079
  nearestCubicParam: () => nearestCubicParam,
6062
6080
  nearestLineParam: () => nearestLineParam,
6063
6081
  needsMorphFlattening: () => needsMorphFlattening,
6082
+ needsOwnedSession: () => needsOwnedSession,
6064
6083
  needsSvgArtisticFilter: () => needsSvgArtisticFilter,
6065
6084
  nestedTextDecorationStyle: () => nestedTextDecorationStyle,
6066
6085
  neutralizeDeviceStrokes: () => chunkW7CBPO77_cjs.neutralizeDeviceStrokes,
@@ -6107,6 +6126,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
6107
6126
  openEditPathAtNode: () => openEditPathAtNode,
6108
6127
  openFilePicker: () => openFilePicker,
6109
6128
  openNativeEyeDropper: () => openNativeEyeDropper,
6129
+ openOwnedCollaboration: () => openOwnedCollaboration,
6110
6130
  openPptxFile: () => openPptxFile,
6111
6131
  openReadingView: () => openReadingView,
6112
6132
  optionValueKey: () => optionValueKey,
@@ -7014,6 +7034,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
7014
7034
  wrapForeignObjectSvg: () => wrapForeignObjectSvg,
7015
7035
  wrapTextByEstimatedWidth: () => chunkG3UVZ5FO_cjs.wrapTextByEstimatedWidth,
7016
7036
  writeAssetFields: () => collaborationSync.writeAssetFields,
7037
+ writeBackReport: () => writeBackReport,
7017
7038
  writeElementParagraphs: () => writeElementParagraphs,
7018
7039
  writeElementToYMap: () => collaborationSync.writeElementToYMap,
7019
7040
  writeSlideToYMap: () => collaborationSync.writeSlideToYMap,
@@ -37721,6 +37742,14 @@ function centreDistance(a, b) {
37721
37742
  const dy = a.y - b.y;
37722
37743
  return Math.sqrt(dx * dx + dy * dy);
37723
37744
  }
37745
+ function differentMedia(a, b) {
37746
+ if (a.type !== "picture" && a.type !== "image") {
37747
+ return false;
37748
+ }
37749
+ const aMedia = mediaIdentity(a);
37750
+ const bMedia = mediaIdentity(b);
37751
+ return Boolean(aMedia) && Boolean(bMedia) && aMedia !== bMedia;
37752
+ }
37724
37753
  function sameMediaPicture(a, b) {
37725
37754
  if (a.type !== "picture" && a.type !== "image") {
37726
37755
  return false;
@@ -37763,7 +37792,7 @@ function appearanceSignature(el) {
37763
37792
  return parts.join("|");
37764
37793
  }
37765
37794
  function proximityAccepts(a, b) {
37766
- if (a.type !== b.type || differentText(a, b) || conflictingMorphNames(a, b)) {
37795
+ if (a.type !== b.type || differentText(a, b) || conflictingMorphNames(a, b) || differentMedia(a, b)) {
37767
37796
  return false;
37768
37797
  }
37769
37798
  if (a.type === "picture" || a.type === "image") {
@@ -40800,6 +40829,10 @@ function borrowExternalCollaborationAwareness(host2) {
40800
40829
  // src/pptx/render/collaboration-options.ts
40801
40830
  var externalSessions = /* @__PURE__ */ new WeakMap();
40802
40831
  var resolved = /* @__PURE__ */ new WeakMap();
40832
+ var sameBrowserRooms = /* @__PURE__ */ new WeakSet();
40833
+ function isSameBrowserRoom(config) {
40834
+ return sameBrowserRooms.has(config);
40835
+ }
40803
40836
  function externalSessionFromCollabSession(session) {
40804
40837
  const known = externalSessions.get(session);
40805
40838
  if (known) return known;
@@ -40830,16 +40863,15 @@ function externalSessionFromCollabSession(session) {
40830
40863
  function resolveCollaborationConfig(input) {
40831
40864
  if (!input) return void 0;
40832
40865
  const raw = input;
40833
- if (!raw.session && !raw.user && !raw.intent && !raw.provider) {
40866
+ if (!raw.session && !raw.user && !raw.intent && !raw.provider && !raw.webrtc) {
40834
40867
  return input;
40835
40868
  }
40836
40869
  const cached = resolved.get(input);
40837
40870
  if (cached) return cached;
40838
- const { session, user, intent, provider, ...legacy } = raw;
40839
- const unsupported2 = Boolean(provider) && !session && !legacy.externalSession;
40871
+ const { session, user, intent, ...legacy } = raw;
40840
40872
  const config = {
40841
40873
  ...legacy,
40842
- roomId: unsupported2 ? "" : legacy.roomId ?? session?.roomId ?? "",
40874
+ roomId: legacy.roomId ?? session?.roomId ?? "",
40843
40875
  serverUrl: legacy.serverUrl ?? "",
40844
40876
  userName: legacy.userName ?? user?.name ?? session?.identity.userName ?? ""
40845
40877
  };
@@ -40854,10 +40886,91 @@ function resolveCollaborationConfig(input) {
40854
40886
  if (session && !legacy.externalSession) {
40855
40887
  config.externalSession = externalSessionFromCollabSession(session);
40856
40888
  }
40889
+ if (raw.serverUrl === void 0 && !raw.transport && !raw.provider && !raw.webrtc && !config.externalSession) {
40890
+ sameBrowserRooms.add(config);
40891
+ }
40857
40892
  resolved.set(input, config);
40858
40893
  return config;
40859
40894
  }
40860
40895
 
40896
+ // src/pptx/render/collaboration-owned-session.ts
40897
+ var DEFAULT_OWNED_USER_NAME = "PowerPoint user";
40898
+ var POWERPOINT_BROADCAST_PREFIX = "ooxml-pptx:";
40899
+ function needsOwnedSession(config) {
40900
+ if (config.externalSession) {
40901
+ return false;
40902
+ }
40903
+ if (config.provider || config.webrtc) {
40904
+ return true;
40905
+ }
40906
+ return isSameBrowserRoom(config);
40907
+ }
40908
+ function keepPowerPointPresence(awareness) {
40909
+ const write = awareness.setLocalStateField.bind(awareness);
40910
+ let latest;
40911
+ awareness.setLocalStateField = (field, value) => {
40912
+ if (field === "presence" && value && typeof value === "object") {
40913
+ const next = value;
40914
+ if ("activeSlideIndex" in next) {
40915
+ latest = next;
40916
+ } else if (latest) {
40917
+ write(field, { ...latest, ...next });
40918
+ return;
40919
+ }
40920
+ }
40921
+ write(field, value);
40922
+ };
40923
+ }
40924
+ function openOwnedCollaboration(config) {
40925
+ let released = false;
40926
+ let session;
40927
+ const destroy = () => {
40928
+ const current = session;
40929
+ session = void 0;
40930
+ current?.destroy();
40931
+ };
40932
+ const ready = (async () => {
40933
+ const { openCollaborationSession } = await import('ooxml-core/collab');
40934
+ if (released) {
40935
+ return null;
40936
+ }
40937
+ const opened = openCollaborationSession(
40938
+ {
40939
+ roomId: config.roomId,
40940
+ ...config.provider ? { provider: config.provider } : {},
40941
+ ...config.webrtc ? { webrtc: config.webrtc } : {},
40942
+ ...config.serverUrl ? { serverUrl: config.serverUrl } : {},
40943
+ ...config.authToken ? { authToken: config.authToken } : {},
40944
+ user: {
40945
+ ...config.userName ? { name: config.userName } : {},
40946
+ ...config.userColor ? { color: config.userColor } : {},
40947
+ ...config.userAvatar ? { avatar: config.userAvatar } : {},
40948
+ ...config.role ? { role: config.role } : {}
40949
+ }
40950
+ },
40951
+ {
40952
+ defaultName: config.userName || DEFAULT_OWNED_USER_NAME,
40953
+ broadcastPrefix: POWERPOINT_BROADCAST_PREFIX
40954
+ }
40955
+ );
40956
+ session = opened.session;
40957
+ keepPowerPointPresence(opened.session.awareness);
40958
+ return {
40959
+ ...config,
40960
+ userName: config.userName || opened.session.identity.userName,
40961
+ userColor: config.userColor ?? opened.session.identity.userColor,
40962
+ externalSession: externalSessionFromCollabSession(opened.session)
40963
+ };
40964
+ })();
40965
+ return {
40966
+ ready,
40967
+ release: () => {
40968
+ released = true;
40969
+ destroy();
40970
+ }
40971
+ };
40972
+ }
40973
+
40861
40974
  // src/pptx/render/collaboration-external-readiness.ts
40862
40975
  function observeExternalCollaborationReadiness(session, options) {
40863
40976
  let active2 = true;
@@ -41993,83 +42106,112 @@ function registerCollaborationTeardown(options) {
41993
42106
  function clearLocalAwareness(awareness) {
41994
42107
  awareness?.setLocalState?.(null);
41995
42108
  }
41996
- var DEFAULT_DEBOUNCE_MS = 5e3;
41997
42109
  function createWriteBackScheduler(deps) {
41998
- let timer = null;
41999
- let generation = 0;
42110
+ let core = null;
42111
+ let coreKey = "";
42112
+ let current = null;
42000
42113
  let unsubscribe = null;
42001
- function cancel() {
42002
- generation++;
42114
+ let detachPageClose = null;
42115
+ const isReady = () => current?.externalSession?.getSnapshot().synced ?? true;
42116
+ const detachSession = () => {
42003
42117
  unsubscribe?.();
42004
42118
  unsubscribe = null;
42005
- if (timer !== null) {
42006
- clearTimeout(timer);
42007
- timer = null;
42119
+ };
42120
+ function serialize(isCurrentWrite) {
42121
+ const ydoc = deps.getYDoc();
42122
+ const isCurrent = () => isCurrentWrite() && isReady() && deps.getYDoc() === ydoc;
42123
+ if (!ydoc || !current?.onWriteBack || !isReady()) return Promise.resolve(null);
42124
+ return serializeDoc(ydoc, isCurrent);
42125
+ }
42126
+ async function serializeDoc(ydoc, isCurrent) {
42127
+ if (deps.serialize) {
42128
+ try {
42129
+ const bytes2 = await deps.serialize(isCurrent);
42130
+ return bytes2 && isCurrent() ? bytes2 : null;
42131
+ } catch (error) {
42132
+ if (!isCurrent()) return null;
42133
+ throw error;
42134
+ }
42135
+ }
42136
+ const sourceBytes = deps.getSourceBytes?.();
42137
+ if (!sourceBytes) return null;
42138
+ const handler = new pptx.PptxHandler();
42139
+ await handler.load(sourceBytes.buffer);
42140
+ if (!isCurrent()) return null;
42141
+ const slides = collaborationSync.readSlidesFromYDoc(ydoc);
42142
+ const merged = deps.mergeTemplateElements ? deps.mergeTemplateElements(slides, deps.getTemplateElements?.() ?? {}) : slides;
42143
+ const bytes = await handler.save(merged, deps.getSaveOptions?.());
42144
+ return isCurrent() ? bytes : null;
42145
+ }
42146
+ function coreFor(config) {
42147
+ const retry = config.writeBackRetry;
42148
+ const key = [
42149
+ config.writeBackDebounceMs,
42150
+ retry?.attempts,
42151
+ retry?.baseDelayMs,
42152
+ retry?.maxDelayMs
42153
+ ].join("|");
42154
+ if (core && key === coreKey) return core;
42155
+ core?.dispose();
42156
+ coreKey = key;
42157
+ core = collab.createWriteBackScheduler({
42158
+ debounceMs: config.writeBackDebounceMs ?? collab.DEFAULT_WRITE_BACK_DEBOUNCE_MS,
42159
+ ...retry ? { retry } : {},
42160
+ serialize: ({ isCurrent }) => serialize(isCurrent),
42161
+ // Read at write time, so a host callback changed meanwhile is the one called.
42162
+ write: (bytes) => current?.onWriteBack?.(bytes),
42163
+ onStatus: (state) => {
42164
+ if (state.status === "saved" || state.status === "failed" || state.status === "idle") {
42165
+ detachSession();
42166
+ }
42167
+ deps.onWriteBackStatus?.();
42168
+ }
42169
+ });
42170
+ return core;
42171
+ }
42172
+ function cancel() {
42173
+ const config = current;
42174
+ const ydoc = deps.getYDoc();
42175
+ const final = core?.dirty && ydoc && config?.onWriteBack && config.role === "owner" && isReady() ? { ydoc, onWriteBack: config.onWriteBack } : null;
42176
+ if (final) {
42177
+ void serializeDoc(final.ydoc, () => true).then((bytes) => bytes ? final.onWriteBack(bytes) : void 0).catch(() => {
42178
+ });
42008
42179
  }
42180
+ core?.cancel();
42181
+ detachSession();
42182
+ detachPageClose?.();
42183
+ detachPageClose = null;
42009
42184
  }
42010
42185
  function schedule(config) {
42011
- const isReady = () => config.externalSession?.getSnapshot().synced ?? true;
42012
42186
  if (!config.onWriteBack || config.role !== "owner" || !deps.getYDoc()) {
42013
42187
  return;
42014
42188
  }
42015
- cancel();
42189
+ current = config;
42190
+ const scheduler = coreFor(config);
42191
+ detachSession();
42016
42192
  if (!isReady()) {
42193
+ scheduler.cancel();
42017
42194
  return;
42018
42195
  }
42019
- const token = generation;
42020
42196
  if (config.externalSession) {
42021
42197
  const detach = config.externalSession.subscribe(() => {
42022
- if (!isReady()) {
42023
- cancel();
42024
- }
42198
+ if (!isReady()) scheduler.cancel();
42025
42199
  });
42026
- if (token !== generation || !isReady()) {
42200
+ if (!isReady()) {
42027
42201
  detach();
42028
42202
  return;
42029
42203
  }
42030
42204
  unsubscribe = detach;
42031
42205
  }
42032
- const debounceMs = config.writeBackDebounceMs ?? DEFAULT_DEBOUNCE_MS;
42033
- timer = setTimeout(async () => {
42034
- timer = null;
42035
- const ydoc = deps.getYDoc();
42036
- const isCurrent = () => token === generation && isReady() && deps.getYDoc() === ydoc;
42037
- try {
42038
- if (!ydoc || !config.onWriteBack || !isReady()) {
42039
- return;
42040
- }
42041
- if (deps.serialize) {
42042
- const bytes2 = await deps.serialize(isCurrent);
42043
- if (bytes2 && isCurrent()) {
42044
- await config.onWriteBack(bytes2);
42045
- }
42046
- return;
42047
- }
42048
- const sourceBytes = deps.getSourceBytes?.();
42049
- if (!sourceBytes) {
42050
- return;
42051
- }
42052
- const handler = new pptx.PptxHandler();
42053
- await handler.load(sourceBytes.buffer);
42054
- if (!isCurrent()) {
42055
- return;
42056
- }
42057
- const slides = collaborationSync.readSlidesFromYDoc(ydoc);
42058
- const merged = deps.mergeTemplateElements ? deps.mergeTemplateElements(slides, deps.getTemplateElements?.() ?? {}) : slides;
42059
- const bytes = await handler.save(merged, deps.getSaveOptions?.());
42060
- if (isCurrent()) {
42061
- await config.onWriteBack(bytes);
42062
- }
42063
- } catch {
42064
- } finally {
42065
- if (token === generation) {
42066
- unsubscribe?.();
42067
- unsubscribe = null;
42068
- }
42069
- }
42070
- }, debounceMs);
42206
+ detachPageClose ??= collab.flushWriteBackOnPageClose(scheduler);
42207
+ scheduler.schedule();
42071
42208
  }
42072
- return { schedule, cancel };
42209
+ return {
42210
+ schedule,
42211
+ cancel,
42212
+ flush: () => core?.flush() ?? Promise.resolve(),
42213
+ getState: () => core ? collab.writeBackStateOf(core.state) : void 0
42214
+ };
42073
42215
  }
42074
42216
  var POSITION_THRESHOLD = 2;
42075
42217
  var SIZE_THRESHOLD = 2;
@@ -77252,6 +77394,69 @@ function createSlidePackageClipboard(initialHost) {
77252
77394
  };
77253
77395
  }
77254
77396
 
77397
+ // src/pptx/render/collaboration-state.ts
77398
+ function writeBackReport(config, state) {
77399
+ if (!config?.onWriteBack || config.role !== "owner") return void 0;
77400
+ return state ?? { status: "idle" };
77401
+ }
77402
+ var COLLABORATION_OFF = Object.freeze({
77403
+ active: false,
77404
+ roomId: void 0,
77405
+ status: "off",
77406
+ synced: false,
77407
+ people: Object.freeze([])
77408
+ });
77409
+ function buildCollaborationState(input) {
77410
+ if (!input.active) return COLLABORATION_OFF;
77411
+ const name = input.userName ?? "";
77412
+ const people = [];
77413
+ if (input.clientId !== null && input.clientId !== void 0) {
77414
+ people.push({
77415
+ clientId: input.clientId,
77416
+ name,
77417
+ color: input.userColor || assignUserColor(name),
77418
+ self: true
77419
+ });
77420
+ }
77421
+ for (const user of input.remoteUsers) {
77422
+ people.push({
77423
+ clientId: user.clientId,
77424
+ name: user.userName,
77425
+ color: user.userColor,
77426
+ self: false
77427
+ });
77428
+ }
77429
+ return {
77430
+ active: true,
77431
+ roomId: input.roomId || void 0,
77432
+ status: input.status,
77433
+ synced: input.synced,
77434
+ people,
77435
+ ...input.writeBack ? { writeBack: input.writeBack } : {}
77436
+ };
77437
+ }
77438
+ function collaborationStatesEqual(a, b) {
77439
+ if (a === b) return true;
77440
+ if (a.active !== b.active || a.roomId !== b.roomId || a.status !== b.status || a.synced !== b.synced || a.people.length !== b.people.length || a.writeBack?.status !== b.writeBack?.status || a.writeBack?.lastSavedAt !== b.writeBack?.lastSavedAt || a.writeBack?.error !== b.writeBack?.error) {
77441
+ return false;
77442
+ }
77443
+ return a.people.every((person, index) => {
77444
+ const other = b.people[index];
77445
+ return other !== void 0 && person.clientId === other.clientId && person.name === other.name && person.color === other.color && person.self === other.self;
77446
+ });
77447
+ }
77448
+ function createCollaborationStateReporter(report) {
77449
+ let last = COLLABORATION_OFF;
77450
+ return {
77451
+ update: (state) => {
77452
+ if (collaborationStatesEqual(last, state)) return;
77453
+ last = state;
77454
+ report(state);
77455
+ },
77456
+ current: () => last
77457
+ };
77458
+ }
77459
+
77255
77460
  // src/pptx/web-components/mobile-bar-styles.ts
77256
77461
  var MOBILE_BAR_STYLES = `
77257
77462
  :host { display: block; flex: none; }
@@ -92220,6 +92425,7 @@ exports.CHART_TYPE_LABEL_KEYS = CHART_TYPE_LABEL_KEYS;
92220
92425
  exports.CHART_TYPE_OPTIONS = CHART_TYPE_OPTIONS;
92221
92426
  exports.CINEMATIC_TRANSITION_KEYFRAMES = CINEMATIC_TRANSITION_KEYFRAMES;
92222
92427
  exports.CLOSED_READING_VIEW = CLOSED_READING_VIEW;
92428
+ exports.COLLABORATION_OFF = COLLABORATION_OFF;
92223
92429
  exports.COLLAB_LEAVE_MESSAGE = COLLAB_LEAVE_MESSAGE;
92224
92430
  exports.COMBO_SERIES_TYPE_OPTIONS = COMBO_SERIES_TYPE_OPTIONS;
92225
92431
  exports.COMBO_SUPPORTED_TYPES = COMBO_SUPPORTED_TYPES;
@@ -92272,6 +92478,7 @@ exports.DEFAULT_LINE_HEIGHT = DEFAULT_LINE_HEIGHT;
92272
92478
  exports.DEFAULT_MORPH_DURATION_MS = DEFAULT_MORPH_DURATION_MS;
92273
92479
  exports.DEFAULT_MOTION_PATH_DURATION_MS = DEFAULT_MOTION_PATH_DURATION_MS;
92274
92480
  exports.DEFAULT_NOTES_FONT_SIZE_PT = DEFAULT_NOTES_FONT_SIZE_PT;
92481
+ exports.DEFAULT_OWNED_USER_NAME = DEFAULT_OWNED_USER_NAME;
92275
92482
  exports.DEFAULT_PALETTE = DEFAULT_PALETTE2;
92276
92483
  exports.DEFAULT_POINTER_PRESSURE = DEFAULT_POINTER_PRESSURE;
92277
92484
  exports.DEFAULT_PREVIEW_ELEMENT_CAP = DEFAULT_PREVIEW_ELEMENT_CAP;
@@ -92527,6 +92734,7 @@ exports.PIXELATE_LEVELS = PIXELATE_LEVELS;
92527
92734
  exports.PIXELATE_OUT_KEYFRAMES = PIXELATE_OUT_KEYFRAMES;
92528
92735
  exports.PNG_COLOR_TYPE_RGBA = PNG_COLOR_TYPE_RGBA;
92529
92736
  exports.PNG_SIGNATURE = PNG_SIGNATURE;
92737
+ exports.POWERPOINT_BROADCAST_PREFIX = POWERPOINT_BROADCAST_PREFIX;
92530
92738
  exports.PPTX_OPEN_ACCEPT = PPTX_OPEN_ACCEPT;
92531
92739
  exports.PRESENCE_HEARTBEAT_MS = PRESENCE_HEARTBEAT_MS;
92532
92740
  exports.PRESENTATION_ANIM_TRIGGER_ATTRIBUTE = PRESENTATION_ANIM_TRIGGER_ATTRIBUTE;
@@ -92893,6 +93101,7 @@ exports.buildChromeStyle = buildChromeStyle;
92893
93101
  exports.buildClearHyperlinkPatch = buildClearHyperlinkPatch;
92894
93102
  exports.buildClickGroups = buildClickGroups;
92895
93103
  exports.buildCollaborationShareUrl = buildCollaborationShareUrl;
93104
+ exports.buildCollaborationState = buildCollaborationState;
92896
93105
  exports.buildColorAnimationKeyframes = buildColorAnimationKeyframes;
92897
93106
  exports.buildColorInterpolationProps = buildColorInterpolationProps;
92898
93107
  exports.buildColorTavKeyframe = buildColorTavKeyframe;
@@ -93137,6 +93346,7 @@ exports.cloneHeaderFooterDraft = cloneHeaderFooterDraft;
93137
93346
  exports.cloneOptions = cloneOptions;
93138
93347
  exports.closeEditPath = closeEditPath;
93139
93348
  exports.closeReadingView = closeReadingView;
93349
+ exports.collaborationStatesEqual = collaborationStatesEqual;
93140
93350
  exports.collectAccessibilityIssues = collectAccessibilityIssues;
93141
93351
  exports.collectChartBuildInfo = collectChartBuildInfo;
93142
93352
  exports.collectCoherent3DOffNodeIds = collectCoherent3DOffNodeIds;
@@ -93238,6 +93448,7 @@ exports.crc32 = crc32;
93238
93448
  exports.createActiveAnimationGroup = createActiveAnimationGroup;
93239
93449
  exports.createBackstagePresentation = createBackstagePresentation;
93240
93450
  exports.createCollaborationLivePatcher = createCollaborationLivePatcher;
93451
+ exports.createCollaborationStateReporter = createCollaborationStateReporter;
93241
93452
  exports.createCustomShow = createCustomShow;
93242
93453
  exports.createCustomizationController = createCustomizationController;
93243
93454
  exports.createDeckStyleHost = createDeckStyleHost;
@@ -93831,6 +94042,7 @@ exports.isRowBoundaryMergedAt = isRowBoundaryMergedAt;
93831
94042
  exports.isRunHyperlinkClickable = isRunHyperlinkClickable;
93832
94043
  exports.isSafeSvgMarkup = isSafeSvgMarkup;
93833
94044
  exports.isSameArtisticEffect = isSameArtisticEffect;
94045
+ exports.isSameBrowserRoom = isSameBrowserRoom;
93834
94046
  exports.isSeriesUsingSecondaryAxis = isSeriesUsingSecondaryAxis;
93835
94047
  exports.isSettingLocked = isSettingLocked;
93836
94048
  exports.isSettingVisible = isSettingVisible;
@@ -93959,6 +94171,7 @@ exports.msToFrameDelayCs = msToFrameDelayCs;
93959
94171
  exports.nearestCubicParam = nearestCubicParam;
93960
94172
  exports.nearestLineParam = nearestLineParam;
93961
94173
  exports.needsMorphFlattening = needsMorphFlattening;
94174
+ exports.needsOwnedSession = needsOwnedSession;
93962
94175
  exports.needsSvgArtisticFilter = needsSvgArtisticFilter;
93963
94176
  exports.nestedTextDecorationStyle = nestedTextDecorationStyle;
93964
94177
  exports.newEquationElement = newEquationElement;
@@ -93993,6 +94206,7 @@ exports.openBoundaryRuns = openBoundaryRuns;
93993
94206
  exports.openEditPathAtNode = openEditPathAtNode;
93994
94207
  exports.openFilePicker = openFilePicker;
93995
94208
  exports.openNativeEyeDropper = openNativeEyeDropper;
94209
+ exports.openOwnedCollaboration = openOwnedCollaboration;
93996
94210
  exports.openPendingPrintWindow = openPendingPrintWindow;
93997
94211
  exports.openPptxFile = openPptxFile;
93998
94212
  exports.openPrintWindow = openPrintWindow;
@@ -94678,6 +94892,7 @@ exports.withRecordEntry = withRecordEntry;
94678
94892
  exports.withSlideSizeOrientation = withSlideSizeOrientation;
94679
94893
  exports.wrapForeignObjectSvg = wrapForeignObjectSvg;
94680
94894
  exports.wrapNotesText = wrapNotesText;
94895
+ exports.writeBackReport = writeBackReport;
94681
94896
  exports.writeElementParagraphs = writeElementParagraphs;
94682
94897
  exports.writeStoredViewerPrefs = writeStoredViewerPrefs;
94683
94898
  exports.zeroDelayCssAnimation = zeroDelayCssAnimation;