@beyondwork/docx-react-component 1.0.132 → 1.0.134

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 (94) hide show
  1. package/dist/api/public-types.cjs +161 -68
  2. package/dist/api/public-types.d.cts +1 -1
  3. package/dist/api/public-types.d.ts +1 -1
  4. package/dist/api/public-types.js +3 -3
  5. package/dist/api/v3.cjs +9878 -7387
  6. package/dist/api/v3.d.cts +2 -2
  7. package/dist/api/v3.d.ts +2 -2
  8. package/dist/api/v3.js +10 -10
  9. package/dist/{chunk-QUTVR72L.js → chunk-3YR47WTD.js} +296 -587
  10. package/dist/{chunk-RYMMKOFI.js → chunk-5KTJKTNE.js} +32 -0
  11. package/dist/{chunk-UP2KDOYE.js → chunk-74R5B2EZ.js} +6 -2
  12. package/dist/{chunk-6736GA6J.js → chunk-7Y6JCIK3.js} +1 -1
  13. package/dist/{chunk-43JAPM2F.js → chunk-EBSI6VQX.js} +546 -144
  14. package/dist/{chunk-JVTDBX67.js → chunk-EFEW7BTT.js} +2 -2
  15. package/dist/{chunk-YUHNDEV5.js → chunk-ESEEWELA.js} +3534 -1870
  16. package/dist/{chunk-XYTWOJII.js → chunk-IJD6D7HU.js} +745 -103
  17. package/dist/{chunk-UFPBYJMA.js → chunk-INLRCC4N.js} +2 -2
  18. package/dist/{chunk-N5FTU4HZ.js → chunk-MQ5GAJ54.js} +68 -39
  19. package/dist/{chunk-W2I47J2Q.js → chunk-NJFKPDNG.js} +216 -2
  20. package/dist/{chunk-LPLJZJT2.js → chunk-O4EDZR44.js} +131 -70
  21. package/dist/{chunk-4HGFJ6Z2.js → chunk-PZIEOEJZ.js} +1 -1
  22. package/dist/{chunk-C5LXKR54.js → chunk-QTRJLKR2.js} +1 -1
  23. package/dist/{chunk-SZ6BJA4Q.js → chunk-REFHJ2FN.js} +3 -3
  24. package/dist/{chunk-ZDYGRO2Z.js → chunk-RP76USJE.js} +1 -1
  25. package/dist/{chunk-RBWJHRNP.js → chunk-T66OS7MN.js} +8 -3
  26. package/dist/{chunk-ALWXYGXP.js → chunk-V2JF42SI.js} +2 -2
  27. package/dist/{chunk-CDEZGLQ3.js → chunk-VA24T4EB.js} +1 -1
  28. package/dist/{chunk-6TLZ6CMP.js → chunk-WDDFU2N2.js} +2 -2
  29. package/dist/{chunk-U3UMKA7B.js → chunk-XBQFDBXE.js} +1 -1
  30. package/dist/core/commands/formatting-commands.d.cts +1 -1
  31. package/dist/core/commands/formatting-commands.d.ts +1 -1
  32. package/dist/core/commands/image-commands.cjs +32 -0
  33. package/dist/core/commands/image-commands.d.cts +1 -1
  34. package/dist/core/commands/image-commands.d.ts +1 -1
  35. package/dist/core/commands/image-commands.js +5 -5
  36. package/dist/core/commands/section-layout-commands.d.cts +1 -1
  37. package/dist/core/commands/section-layout-commands.d.ts +1 -1
  38. package/dist/core/commands/style-commands.d.cts +1 -1
  39. package/dist/core/commands/style-commands.d.ts +1 -1
  40. package/dist/core/commands/table-structure-commands.cjs +32 -0
  41. package/dist/core/commands/table-structure-commands.d.cts +1 -1
  42. package/dist/core/commands/table-structure-commands.d.ts +1 -1
  43. package/dist/core/commands/table-structure-commands.js +4 -4
  44. package/dist/core/commands/text-commands.cjs +99 -38
  45. package/dist/core/commands/text-commands.d.cts +12 -1
  46. package/dist/core/commands/text-commands.d.ts +12 -1
  47. package/dist/core/commands/text-commands.js +5 -5
  48. package/dist/core/selection/mapping.d.cts +1 -1
  49. package/dist/core/selection/mapping.d.ts +1 -1
  50. package/dist/core/state/editor-state.d.cts +1 -1
  51. package/dist/core/state/editor-state.d.ts +1 -1
  52. package/dist/index.cjs +5365 -2298
  53. package/dist/index.d.cts +4 -4
  54. package/dist/index.d.ts +4 -4
  55. package/dist/index.js +388 -63
  56. package/dist/io/docx-session.cjs +7 -2
  57. package/dist/io/docx-session.d.cts +3 -3
  58. package/dist/io/docx-session.d.ts +3 -3
  59. package/dist/io/docx-session.js +4 -4
  60. package/dist/legal.js +3 -3
  61. package/dist/{loader-MAa8VpzW.d.cts → loader-CK3lZy4h.d.cts} +2 -2
  62. package/dist/{loader-CfpeEPAa.d.ts → loader-CQXplstv.d.ts} +2 -2
  63. package/dist/{public-types-KBS6JnOs.d.cts → public-types-BR1SYK2F.d.cts} +783 -189
  64. package/dist/{public-types-Cjs8glST.d.ts → public-types-DXNZVKrS.d.ts} +783 -189
  65. package/dist/public-types.cjs +161 -68
  66. package/dist/public-types.d.cts +1 -1
  67. package/dist/public-types.d.ts +1 -1
  68. package/dist/public-types.js +3 -3
  69. package/dist/runtime/collab.d.cts +2 -2
  70. package/dist/runtime/collab.d.ts +2 -2
  71. package/dist/runtime/document-runtime.cjs +1597 -444
  72. package/dist/runtime/document-runtime.d.cts +1 -1
  73. package/dist/runtime/document-runtime.d.ts +1 -1
  74. package/dist/runtime/document-runtime.js +14 -14
  75. package/dist/{session-CkoH8FoY.d.ts → session-C9UjrhJF.d.ts} +2 -2
  76. package/dist/{session-wwe0Gib-.d.cts → session-CSbwkgII.d.cts} +2 -2
  77. package/dist/session.cjs +7 -2
  78. package/dist/session.d.cts +4 -4
  79. package/dist/session.d.ts +4 -4
  80. package/dist/session.js +5 -5
  81. package/dist/tailwind.cjs +451 -650
  82. package/dist/tailwind.d.cts +1 -1
  83. package/dist/tailwind.d.ts +1 -1
  84. package/dist/tailwind.js +7 -7
  85. package/dist/{types-B3SGRW0w.d.cts → types-CZtAueri.d.cts} +1 -1
  86. package/dist/{types-CH7NWqVL.d.ts → types-RzkCXDNV.d.ts} +1 -1
  87. package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +2 -2
  88. package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +2 -2
  89. package/dist/ui-tailwind/editor-surface/search-plugin.js +4 -4
  90. package/dist/ui-tailwind.cjs +451 -650
  91. package/dist/ui-tailwind.d.cts +3 -2
  92. package/dist/ui-tailwind.d.ts +3 -2
  93. package/dist/ui-tailwind.js +7 -7
  94. package/package.json +1 -1
@@ -12,6 +12,7 @@ import {
12
12
  parseTextStory
13
13
  } from "./chunk-QIO6V46H.js";
14
14
  import {
15
+ NO_EDITABLE_TARGETS_INDEX,
15
16
  createEditorSurfaceSnapshot,
16
17
  formatPageNumber,
17
18
  formatPageNumberWithChapter,
@@ -19,13 +20,13 @@ import {
19
20
  resolveSectionVariants,
20
21
  sectionSupportsStoryTarget,
21
22
  storyTargetKey
22
- } from "./chunk-U3UMKA7B.js";
23
+ } from "./chunk-XBQFDBXE.js";
23
24
  import {
24
25
  createSelectionSnapshot
25
26
  } from "./chunk-OYGMRRR7.js";
26
27
  import {
27
28
  collectCanonicalLayoutInputs
28
- } from "./chunk-RYMMKOFI.js";
29
+ } from "./chunk-5KTJKTNE.js";
29
30
  import {
30
31
  MAIN_STORY_TARGET,
31
32
  createDetachedAnchor,
@@ -2176,7 +2177,8 @@ function buildResolvedSections(document2) {
2176
2177
  const mainSurface = createEditorSurfaceSnapshot(
2177
2178
  document2,
2178
2179
  createSelectionSnapshot(0, 0),
2179
- MAIN_STORY_TARGET
2180
+ MAIN_STORY_TARGET,
2181
+ { editableTargetsByBlockPath: NO_EDITABLE_TARGETS_INDEX }
2180
2182
  );
2181
2183
  const sections = [];
2182
2184
  let sectionStart = 0;
@@ -8085,7 +8087,7 @@ function fnv1a(input) {
8085
8087
  }
8086
8088
 
8087
8089
  // src/runtime/layout/layout-engine-version.ts
8088
- var LAYOUT_ENGINE_VERSION = 93;
8090
+ var LAYOUT_ENGINE_VERSION = 94;
8089
8091
  var LAYCACHE_SCHEMA_VERSION = 13;
8090
8092
 
8091
8093
  // src/runtime/layout/layout-engine-instance.ts
@@ -8312,11 +8314,45 @@ function createLayoutEngine(options = {}) {
8312
8314
  const telemetryBus = options.telemetryBus;
8313
8315
  const dirtyFieldFamilies = /* @__PURE__ */ new Set();
8314
8316
  const listeners = /* @__PURE__ */ new Set();
8315
- let cachedKey = null;
8316
- let cachedGraph = null;
8317
- let cachedFormatting = null;
8318
- let cachedMapper = null;
8317
+ let cachedFull = null;
8318
+ let cachedWindowed = null;
8319
8319
  let previousPageCount = 0;
8320
+ function isFullViewportKey(key) {
8321
+ return key === FULL_VIEWPORT_WINDOW_KEY;
8322
+ }
8323
+ function getCachedSlot(viewportWindowKeyValue) {
8324
+ return isFullViewportKey(viewportWindowKeyValue) ? cachedFull : cachedWindowed;
8325
+ }
8326
+ function preferredCachedGraph() {
8327
+ return cachedFull?.graph ?? cachedWindowed?.graph ?? null;
8328
+ }
8329
+ function clearAllSlots() {
8330
+ cachedFull = null;
8331
+ cachedWindowed = null;
8332
+ }
8333
+ function clearWindowedSlot() {
8334
+ cachedWindowed = null;
8335
+ }
8336
+ function evictStaleSiblingSlot(freshKey) {
8337
+ const sibling = isFullViewportKey(freshKey.viewportWindowKey) ? cachedWindowed : cachedFull;
8338
+ if (sibling === null) return;
8339
+ if (sibling.key.content === freshKey.content && sibling.key.styles === freshKey.styles && sibling.key.subParts === freshKey.subParts) {
8340
+ return;
8341
+ }
8342
+ if (isFullViewportKey(freshKey.viewportWindowKey)) {
8343
+ cachedWindowed = null;
8344
+ } else {
8345
+ cachedFull = null;
8346
+ }
8347
+ }
8348
+ function commitSlot(slot) {
8349
+ if (isFullViewportKey(slot.key.viewportWindowKey)) {
8350
+ cachedFull = slot;
8351
+ } else {
8352
+ cachedWindowed = slot;
8353
+ }
8354
+ evictStaleSiblingSlot(slot.key);
8355
+ }
8320
8356
  let pendingInvalidation = null;
8321
8357
  function emit(event) {
8322
8358
  for (const listener of listeners) {
@@ -8462,27 +8498,31 @@ function createLayoutEngine(options = {}) {
8462
8498
  subParts: document2.subParts,
8463
8499
  anchors: layoutInputs.anchors
8464
8500
  });
8501
+ const priorGraphForMaterialization = preferredCachedGraph();
8465
8502
  const graph = applyViewportWindowMaterialization(
8466
8503
  measuredGraph,
8467
8504
  viewportWindow,
8468
- cachedGraph
8505
+ priorGraphForMaterialization
8469
8506
  );
8470
- const dirtyFamilies = computeFieldDirtiness(cachedGraph, graph);
8507
+ const priorGraphForFieldDirtiness = preferredCachedGraph();
8508
+ const dirtyFamilies = computeFieldDirtiness(priorGraphForFieldDirtiness, graph);
8471
8509
  for (const family of dirtyFamilies) {
8472
8510
  dirtyFieldFamilies.add(family);
8473
8511
  }
8474
8512
  const formatting = buildResolvedFormattingState(document2, mainSurface);
8475
8513
  const currentPageCount = graph.contentPageCount;
8476
8514
  const pageCountDelta = currentPageCount !== previousPageCount ? { previous: previousPageCount, current: currentPageCount } : void 0;
8477
- cachedKey = {
8478
- content: document2.content,
8479
- styles: document2.styles,
8480
- subParts: document2.subParts,
8481
- viewportWindowKey: viewportWindowKey(viewportWindow)
8482
- };
8483
- cachedGraph = graph;
8484
- cachedFormatting = formatting;
8485
- cachedMapper = createPageFragmentMapper(graph);
8515
+ commitSlot({
8516
+ key: {
8517
+ content: document2.content,
8518
+ styles: document2.styles,
8519
+ subParts: document2.subParts,
8520
+ viewportWindowKey: viewportWindowKey(viewportWindow)
8521
+ },
8522
+ graph,
8523
+ formatting,
8524
+ mapper: createPageFragmentMapper(graph)
8525
+ });
8486
8526
  if (pageCountDelta) {
8487
8527
  emit({
8488
8528
  kind: "page_count_changed",
@@ -8523,7 +8563,7 @@ function createLayoutEngine(options = {}) {
8523
8563
  return graph;
8524
8564
  }
8525
8565
  function incrementalRelayout(input, pending) {
8526
- const priorGraph = cachedGraph;
8566
+ const priorGraph = cachedFull?.graph ?? null;
8527
8567
  const range = pending.result.dirtyPageRange;
8528
8568
  if (!priorGraph || !range) return null;
8529
8569
  const telemetryOn = telemetryBus?.isEnabled("layout") ?? false;
@@ -8616,6 +8656,22 @@ function createLayoutEngine(options = {}) {
8616
8656
  deriveDocumentPageSnapshots(splicedGraph)
8617
8657
  );
8618
8658
  const pageCountDelta = currentPageCount !== previousPageCount ? { previous: previousPageCount, current: currentPageCount } : void 0;
8659
+ const priorMapper = cachedFull?.mapper ?? null;
8660
+ commitSlot({
8661
+ key: {
8662
+ content: document2.content,
8663
+ styles: document2.styles,
8664
+ subParts: document2.subParts,
8665
+ viewportWindowKey: FULL_VIEWPORT_WINDOW_KEY
8666
+ },
8667
+ graph: splicedGraph,
8668
+ formatting,
8669
+ mapper: rebuildMapper(
8670
+ priorMapper ?? createPageFragmentMapper(splicedGraph),
8671
+ splicedGraph,
8672
+ firstDirty
8673
+ )
8674
+ });
8619
8675
  if (pageCountDelta) {
8620
8676
  emit({
8621
8677
  kind: "page_count_changed",
@@ -8645,19 +8701,6 @@ function createLayoutEngine(options = {}) {
8645
8701
  ...dirtyFamilies.length > 0 ? { dirtyFieldFamilies: dirtyFamilies } : {},
8646
8702
  ...pageCountDelta ? { pageCountDelta } : {}
8647
8703
  });
8648
- cachedKey = {
8649
- content: document2.content,
8650
- styles: document2.styles,
8651
- subParts: document2.subParts,
8652
- viewportWindowKey: FULL_VIEWPORT_WINDOW_KEY
8653
- };
8654
- cachedGraph = splicedGraph;
8655
- cachedFormatting = formatting;
8656
- cachedMapper = rebuildMapper(
8657
- cachedMapper ?? createPageFragmentMapper(splicedGraph),
8658
- splicedGraph,
8659
- firstDirty
8660
- );
8661
8704
  if (telemetryOn) {
8662
8705
  emitRecomputeCompleted(
8663
8706
  "bounded",
@@ -8674,13 +8717,14 @@ function createLayoutEngine(options = {}) {
8674
8717
  const document2 = input.document;
8675
8718
  const normalizedWindow = normalizeViewportPageWindow(input.viewportPageWindow);
8676
8719
  const currentViewportWindowKey = viewportWindowKey(normalizedWindow);
8677
- const keyEqual = cachedGraph !== null && cachedKey !== null && cachedKey.content === document2.content && cachedKey.styles === document2.styles && cachedKey.subParts === document2.subParts && cachedKey.viewportWindowKey === currentViewportWindowKey;
8720
+ const slot = getCachedSlot(currentViewportWindowKey);
8721
+ const keyEqual = slot !== null && slot.key.content === document2.content && slot.key.styles === document2.styles && slot.key.subParts === document2.subParts && slot.key.viewportWindowKey === currentViewportWindowKey;
8678
8722
  if (keyEqual && pendingInvalidation === null) {
8679
- return cachedGraph;
8723
+ return slot.graph;
8680
8724
  }
8681
8725
  const pending = pendingInvalidation;
8682
8726
  pendingInvalidation = null;
8683
- if (pending !== null && pending.result.scope === "bounded" && cachedGraph !== null && normalizedWindow === void 0) {
8727
+ if (pending !== null && pending.result.scope === "bounded" && cachedFull !== null && normalizedWindow === void 0) {
8684
8728
  const spliced = incrementalRelayout(input, pending);
8685
8729
  if (spliced !== null) {
8686
8730
  return spliced;
@@ -8689,16 +8733,39 @@ function createLayoutEngine(options = {}) {
8689
8733
  }
8690
8734
  return fullRebuild(input, pending?.reason);
8691
8735
  }
8736
+ function ensureSlotMapperAndFormatting(slot, document2) {
8737
+ if (slot.mapper === null) {
8738
+ slot.mapper = createPageFragmentMapper(slot.graph);
8739
+ }
8740
+ if (slot.formatting === null) {
8741
+ const mainSurface = createEditorSurfaceSnapshot(
8742
+ document2,
8743
+ createSelectionSnapshot(0, 0),
8744
+ MAIN_STORY_TARGET
8745
+ );
8746
+ slot.formatting = buildResolvedFormattingState(document2, mainSurface);
8747
+ }
8748
+ }
8692
8749
  function getMapper(input) {
8693
8750
  getGraphInternal(input);
8694
- return cachedMapper;
8751
+ const currentViewportWindowKey = viewportWindowKey(
8752
+ normalizeViewportPageWindow(input.viewportPageWindow)
8753
+ );
8754
+ const slot = getCachedSlot(currentViewportWindowKey);
8755
+ ensureSlotMapperAndFormatting(slot, input.document);
8756
+ return slot.mapper;
8695
8757
  }
8696
8758
  function getFormatting(input) {
8697
8759
  getGraphInternal(input);
8698
- return cachedFormatting;
8760
+ const currentViewportWindowKey = viewportWindowKey(
8761
+ normalizeViewportPageWindow(input.viewportPageWindow)
8762
+ );
8763
+ const slot = getCachedSlot(currentViewportWindowKey);
8764
+ ensureSlotMapperAndFormatting(slot, input.document);
8765
+ return slot.formatting;
8699
8766
  }
8700
8767
  if (autoUpgradeToCanvas && options.measurementProvider === void 0 && typeof document !== "undefined" && typeof HTMLCanvasElement !== "undefined") {
8701
- const readCachedRevision = () => cachedGraph?.revision ?? 0;
8768
+ const readCachedRevision = () => preferredCachedGraph()?.revision ?? 0;
8702
8769
  void (async () => {
8703
8770
  try {
8704
8771
  const mod = await import("./measurement-backend-canvas-F7ZYDACK.js");
@@ -8708,10 +8775,7 @@ function createLayoutEngine(options = {}) {
8708
8775
  options.measurementCache,
8709
8776
  telemetryBus
8710
8777
  );
8711
- cachedKey = null;
8712
- cachedGraph = null;
8713
- cachedFormatting = null;
8714
- cachedMapper = null;
8778
+ clearAllSlots();
8715
8779
  emit({
8716
8780
  kind: "measurement_backend_ready",
8717
8781
  revision: readCachedRevision(),
@@ -8755,22 +8819,19 @@ function createLayoutEngine(options = {}) {
8755
8819
  return getMapper(input);
8756
8820
  },
8757
8821
  invalidate(reason) {
8758
- const result = analyzeInvalidation(reason, cachedGraph);
8822
+ const result = analyzeInvalidation(reason, preferredCachedGraph());
8759
8823
  for (const family of result.dirtyFieldFamilies) {
8760
8824
  dirtyFieldFamilies.add(family);
8761
8825
  }
8762
8826
  if (result.scope === "bounded") {
8763
8827
  pendingInvalidation = { reason, result };
8764
8828
  } else {
8765
- cachedKey = null;
8766
- cachedGraph = null;
8767
- cachedFormatting = null;
8768
- cachedMapper = null;
8829
+ clearAllSlots();
8769
8830
  pendingInvalidation = { reason, result };
8770
8831
  }
8771
8832
  },
8772
8833
  analyzeInvalidation(reason) {
8773
- return analyzeInvalidation(reason, cachedGraph);
8834
+ return analyzeInvalidation(reason, preferredCachedGraph());
8774
8835
  },
8775
8836
  getDirtyFieldFamilies() {
8776
8837
  return Array.from(dirtyFieldFamilies);
@@ -8798,14 +8859,11 @@ function createLayoutEngine(options = {}) {
8798
8859
  telemetryBus
8799
8860
  );
8800
8861
  if (previousFidelity !== provider.fidelity) {
8801
- cachedKey = null;
8802
- cachedGraph = null;
8803
- cachedFormatting = null;
8804
- cachedMapper = null;
8862
+ clearAllSlots();
8805
8863
  }
8806
8864
  emit({
8807
8865
  kind: "measurement_backend_ready",
8808
- revision: cachedGraph?.revision ?? 0,
8866
+ revision: preferredCachedGraph()?.revision ?? 0,
8809
8867
  fidelity: provider.fidelity
8810
8868
  });
8811
8869
  },
@@ -8820,30 +8878,33 @@ function createLayoutEngine(options = {}) {
8820
8878
  */
8821
8879
  invalidateMeasurementCache() {
8822
8880
  measurementProvider.invalidateCache();
8823
- cachedKey = null;
8824
- cachedGraph = null;
8825
- cachedFormatting = null;
8826
- cachedMapper = null;
8881
+ clearAllSlots();
8827
8882
  },
8828
8883
  getMeasurementCacheStats() {
8829
8884
  if (!isCachedLayoutMeasurementProvider(measurementProvider)) return null;
8830
8885
  return measurementProvider.measurementCacheStats();
8831
8886
  },
8832
8887
  /**
8833
- * L7 Phase 2.5 — seed the cached graph from a prerender envelope.
8834
- * Populates both `cachedGraph` and `cachedKey` (keyed on the provided
8835
- * document's identity-equal slots) so the next getPageGraph query
8836
- * returns the seeded graph directly. Any subsequent mutation
8837
- * invalidates normally through the existing path.
8888
+ * L7 Phase 2.5 — seed the full-slot cached graph from a prerender
8889
+ * envelope. Populates the full slot (graph + key, with formatting and
8890
+ * mapper computed lazily on first read) so the next viewport-
8891
+ * independent `getPageGraph` query returns the seeded graph directly.
8892
+ * Any subsequent mutation invalidates normally through the existing
8893
+ * path; sibling eviction in `commitSlot` clears `cachedWindowed` if
8894
+ * it carried a different document tuple.
8838
8895
  */
8839
8896
  seedCachedGraph(graph, document2) {
8840
- cachedGraph = graph;
8841
- cachedKey = {
8842
- content: document2.content,
8843
- styles: document2.styles,
8844
- subParts: document2.subParts,
8845
- viewportWindowKey: FULL_VIEWPORT_WINDOW_KEY
8846
- };
8897
+ commitSlot({
8898
+ key: {
8899
+ content: document2.content,
8900
+ styles: document2.styles,
8901
+ subParts: document2.subParts,
8902
+ viewportWindowKey: FULL_VIEWPORT_WINDOW_KEY
8903
+ },
8904
+ graph,
8905
+ formatting: null,
8906
+ mapper: null
8907
+ });
8847
8908
  previousPageCount = graph.contentPageCount;
8848
8909
  }
8849
8910
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  classifyFieldInstruction
3
- } from "./chunk-RBWJHRNP.js";
3
+ } from "./chunk-T66OS7MN.js";
4
4
  import {
5
5
  describeOpaqueFragment,
6
6
  describeStructuredWrapperBlock,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  NO_EDITABLE_TARGETS_INDEX,
3
3
  createEditorSurfaceSnapshot
4
- } from "./chunk-U3UMKA7B.js";
4
+ } from "./chunk-XBQFDBXE.js";
5
5
  import {
6
6
  createSelectionSnapshot
7
7
  } from "./chunk-OYGMRRR7.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-Y4XZCMCS.js";
4
4
  import {
5
5
  applyTextTransaction
6
- } from "./chunk-N5FTU4HZ.js";
6
+ } from "./chunk-MQ5GAJ54.js";
7
7
  import {
8
8
  createInsertedTableBlock,
9
9
  createNoopStructuralMutation,
@@ -11,11 +11,11 @@ import {
11
11
  replaceParagraphScope,
12
12
  resolveInsertedTableStyleId,
13
13
  resolveParagraphScope
14
- } from "./chunk-C5LXKR54.js";
14
+ } from "./chunk-QTRJLKR2.js";
15
15
  import {
16
16
  NO_EDITABLE_TARGETS_INDEX,
17
17
  createEditorSurfaceSnapshot
18
- } from "./chunk-U3UMKA7B.js";
18
+ } from "./chunk-XBQFDBXE.js";
19
19
  import {
20
20
  createSelectionSnapshot
21
21
  } from "./chunk-OYGMRRR7.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  extractBookmarksFromBodyXml
3
- } from "./chunk-RBWJHRNP.js";
3
+ } from "./chunk-T66OS7MN.js";
4
4
 
5
5
  // src/legal/document-root.ts
6
6
  function resolveWalkableRoot(document) {
@@ -6,7 +6,7 @@ import {
6
6
  createHeaderFooterStoryKey,
7
7
  createNoteStoryKey,
8
8
  sha256TextHex
9
- } from "./chunk-RYMMKOFI.js";
9
+ } from "./chunk-5KTJKTNE.js";
10
10
  import {
11
11
  SCOPE_MARKER_BOOKMARK_PREFIX,
12
12
  buildGrabBagSourceChildFromParsed,
@@ -1147,7 +1147,7 @@ function readNumPicBullet(node, numPicBulletId, context, xmlPath) {
1147
1147
  const rEmbed = blip?.attributes["r:embed"] ?? blip?.attributes.embed;
1148
1148
  if (rEmbed) {
1149
1149
  const rel = context.relationships.find((r) => r.id === rEmbed);
1150
- if (rel) {
1150
+ if (isEmbeddedImageRelationship(rel)) {
1151
1151
  const packagePartName = normalizePartPath(
1152
1152
  resolveRelationshipTarget(context.partPath ?? "/word/numbering.xml", rel)
1153
1153
  );
@@ -1165,7 +1165,7 @@ function readNumPicBullet(node, numPicBulletId, context, xmlPath) {
1165
1165
  const rId = imagedata?.attributes["r:id"] ?? imagedata?.attributes.id;
1166
1166
  if (rId && context?.relationships && context.relationships.length > 0) {
1167
1167
  const rel = context.relationships.find((r) => r.id === rId);
1168
- if (rel) {
1168
+ if (isEmbeddedImageRelationship(rel)) {
1169
1169
  const packagePartName = normalizePartPath(
1170
1170
  resolveRelationshipTarget(context.partPath ?? "/word/numbering.xml", rel)
1171
1171
  );
@@ -1190,6 +1190,11 @@ function readNumPicBullet(node, numPicBulletId, context, xmlPath) {
1190
1190
  ...mediaId !== void 0 ? { mediaId } : {}
1191
1191
  };
1192
1192
  }
1193
+ function isEmbeddedImageRelationship(relationship) {
1194
+ return Boolean(
1195
+ relationship && relationship.targetMode === "internal" && relationship.type.endsWith("/image")
1196
+ );
1197
+ }
1193
1198
  function toCanonicalAbstractNumberingId(value) {
1194
1199
  return value.startsWith("abstract-num:") ? value : `abstract-num:${value}`;
1195
1200
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  loadDocxSessionAsync
3
- } from "./chunk-JVTDBX67.js";
3
+ } from "./chunk-EFEW7BTT.js";
4
4
  import {
5
5
  buildCompatibilityReport,
6
6
  createLoadScheduler
7
- } from "./chunk-4HGFJ6Z2.js";
7
+ } from "./chunk-PZIEOEJZ.js";
8
8
  import {
9
9
  decodePersistedSourcePackageBytes,
10
10
  hasValidPersistedSourcePackageDigest,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildSearchPattern
3
- } from "./chunk-LPLJZJT2.js";
3
+ } from "./chunk-O4EDZR44.js";
4
4
 
5
5
  // src/ui-tailwind/editor-surface/search-plugin.ts
6
6
  import { Plugin, PluginKey } from "prosemirror-state";
@@ -3,12 +3,12 @@ import {
3
3
  createNoopStructuralMutation,
4
4
  findTableCellParagraphSelection,
5
5
  findTopLevelParagraphSelectionNearBlock
6
- } from "./chunk-C5LXKR54.js";
6
+ } from "./chunk-QTRJLKR2.js";
7
7
  import {
8
8
  collectEditableTargetRefs,
9
9
  collectStoryBlockContexts,
10
10
  createHeaderFooterStoryKey
11
- } from "./chunk-RYMMKOFI.js";
11
+ } from "./chunk-5KTJKTNE.js";
12
12
  import {
13
13
  createDetachedAnchor,
14
14
  createNodeAnchor,
@@ -4,7 +4,7 @@ import {
4
4
  MAIN_STORY_KEY,
5
5
  collectCanonicalFieldRegionIdentities,
6
6
  collectEditableTargetRefs
7
- } from "./chunk-RYMMKOFI.js";
7
+ } from "./chunk-5KTJKTNE.js";
8
8
  import {
9
9
  describeOpaqueFragment,
10
10
  describeStructuredWrapperBlock,
@@ -1,6 +1,6 @@
1
1
  import 'prosemirror-state';
2
2
  import 'prosemirror-model';
3
- export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-KBS6JnOs.cjs';
3
+ export { gc as Alignment, gd as FormattingMutationResult, ge as FormattingOperation, gf as TextMarkClearTarget, gg as TextMarkRangeOperation, gh as applyFormattingOperationToDocument, gi as applyIndentation, gj as applyTextMarkOperationToDocumentRange, gk as getFormattingStateFromRenderSnapshot, gl as isMarkActive, gm as makeSetAlignment, gn as makeSetFontFamily, go as makeSetFontSize, gp as makeSetHighlight, gq as makeSetTextColor, gr as makeToggleAllCaps, gs as makeToggleBold, gt as makeToggleItalic, gu as makeToggleSmallCaps, gv as makeToggleStrikethrough, gw as makeToggleSubscript, gx as makeToggleSuperscript, gy as makeToggleUnderline } from '../../public-types-BR1SYK2F.cjs';
4
4
  import '../../canonical-document-CfZIc-fC.cjs';
5
5
  import 'react';
6
6
  import 'yjs';
@@ -1,6 +1,6 @@
1
1
  import 'prosemirror-state';
2
2
  import 'prosemirror-model';
3
- export { g4 as Alignment, g5 as FormattingMutationResult, g6 as FormattingOperation, g7 as TextMarkClearTarget, g8 as TextMarkRangeOperation, g9 as applyFormattingOperationToDocument, ga as applyIndentation, gb as applyTextMarkOperationToDocumentRange, gc as getFormattingStateFromRenderSnapshot, gd as isMarkActive, ge as makeSetAlignment, gf as makeSetFontFamily, gg as makeSetFontSize, gh as makeSetHighlight, gi as makeSetTextColor, gj as makeToggleAllCaps, gk as makeToggleBold, gl as makeToggleItalic, gm as makeToggleSmallCaps, gn as makeToggleStrikethrough, go as makeToggleSubscript, gp as makeToggleSuperscript, gq as makeToggleUnderline } from '../../public-types-Cjs8glST.js';
3
+ export { gc as Alignment, gd as FormattingMutationResult, ge as FormattingOperation, gf as TextMarkClearTarget, gg as TextMarkRangeOperation, gh as applyFormattingOperationToDocument, gi as applyIndentation, gj as applyTextMarkOperationToDocumentRange, gk as getFormattingStateFromRenderSnapshot, gl as isMarkActive, gm as makeSetAlignment, gn as makeSetFontFamily, go as makeSetFontSize, gp as makeSetHighlight, gq as makeSetTextColor, gr as makeToggleAllCaps, gs as makeToggleBold, gt as makeToggleItalic, gu as makeToggleSmallCaps, gv as makeToggleStrikethrough, gw as makeToggleSubscript, gx as makeToggleSuperscript, gy as makeToggleUnderline } from '../../public-types-DXNZVKrS.js';
4
4
  import '../../canonical-document-CfZIc-fC.js';
5
5
  import 'react';
6
6
  import 'yjs';
@@ -2402,7 +2402,20 @@ function sourceJoinHash(refs) {
2402
2402
  if (sourceIds.length === 0) return void 0;
2403
2403
  return hashText(sourceIds.join("\0"));
2404
2404
  }
2405
+ var numberingCatalogHashCache = /* @__PURE__ */ new WeakMap();
2406
+ var numberingTargetHashCache = /* @__PURE__ */ new WeakMap();
2405
2407
  function createNumberingCatalogRevisionHash(doc) {
2408
+ const numbering = doc.numbering;
2409
+ if (numbering !== void 0) {
2410
+ const cached = numberingCatalogHashCache.get(numbering);
2411
+ if (cached !== void 0) return cached;
2412
+ const fresh = computeNumberingCatalogRevisionHash(doc);
2413
+ numberingCatalogHashCache.set(numbering, fresh);
2414
+ return fresh;
2415
+ }
2416
+ return computeNumberingCatalogRevisionHash(doc);
2417
+ }
2418
+ function computeNumberingCatalogRevisionHash(doc) {
2406
2419
  const catalog = doc.numbering ?? { abstractDefinitions: {}, instances: {} };
2407
2420
  const abstractDefinitions = catalog.abstractDefinitions ?? {};
2408
2421
  const instances = catalog.instances ?? {};
@@ -2453,8 +2466,27 @@ function createNumberingCatalogRevisionHash(doc) {
2453
2466
  }));
2454
2467
  }
2455
2468
  function createNumberingTargetRevisionHash(doc) {
2469
+ const numbering = doc.numbering;
2470
+ const styles = doc.styles;
2471
+ if (numbering !== void 0 && styles !== void 0) {
2472
+ let inner = numberingTargetHashCache.get(numbering);
2473
+ if (inner === void 0) {
2474
+ inner = /* @__PURE__ */ new WeakMap();
2475
+ numberingTargetHashCache.set(numbering, inner);
2476
+ }
2477
+ const cached = inner.get(styles);
2478
+ if (cached !== void 0) return cached;
2479
+ const fresh = computeNumberingTargetRevisionHash(doc);
2480
+ inner.set(styles, fresh);
2481
+ return fresh;
2482
+ }
2483
+ return computeNumberingTargetRevisionHash(doc);
2484
+ }
2485
+ function computeNumberingTargetRevisionHash(doc) {
2456
2486
  const paragraphStyles = doc.styles?.paragraphs ?? {};
2457
2487
  return hashText(JSON.stringify({
2488
+ // Reuses the memoized catalog hash on the hot path so a typing edit
2489
+ // pays for the catalog hash at most once across both helpers.
2458
2490
  numberingCatalogHash: createNumberingCatalogRevisionHash(doc),
2459
2491
  paragraphStyleNumbering: Object.keys(paragraphStyles).sort().map((styleId) => {
2460
2492
  const style = paragraphStyles[styleId];
@@ -1,4 +1,4 @@
1
- import { C as CanonicalDocumentEnvelope, S as SelectionSnapshot, g as TransactionMapping } from '../../public-types-KBS6JnOs.cjs';
1
+ import { C as CanonicalDocumentEnvelope, e as SelectionSnapshot, i as TransactionMapping } from '../../public-types-BR1SYK2F.cjs';
2
2
  import 'react';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
@@ -1,4 +1,4 @@
1
- import { C as CanonicalDocumentEnvelope, S as SelectionSnapshot, g as TransactionMapping } from '../../public-types-Cjs8glST.js';
1
+ import { C as CanonicalDocumentEnvelope, e as SelectionSnapshot, i as TransactionMapping } from '../../public-types-DXNZVKrS.js';
2
2
  import 'react';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
@@ -2,13 +2,13 @@ import {
2
2
  insertImage,
3
3
  repositionFloatingImage,
4
4
  resizeImage
5
- } from "../../chunk-UFPBYJMA.js";
6
- import "../../chunk-N5FTU4HZ.js";
7
- import "../../chunk-C5LXKR54.js";
5
+ } from "../../chunk-INLRCC4N.js";
6
+ import "../../chunk-MQ5GAJ54.js";
7
+ import "../../chunk-QTRJLKR2.js";
8
8
  import "../../chunk-QIO6V46H.js";
9
- import "../../chunk-U3UMKA7B.js";
9
+ import "../../chunk-XBQFDBXE.js";
10
10
  import "../../chunk-OYGMRRR7.js";
11
- import "../../chunk-RYMMKOFI.js";
11
+ import "../../chunk-5KTJKTNE.js";
12
12
  import "../../chunk-UFVDIR2C.js";
13
13
  import "../../chunk-PGGPPZ65.js";
14
14
  import "../../chunk-DNXYUIIS.js";
@@ -1,4 +1,4 @@
1
- import { h as SelectionSnapshot, M as MarginPresetDefinition, i as PageFormatDefinition, R as RuntimeRenderSnapshot } from '../../public-types-KBS6JnOs.cjs';
1
+ import { j as SelectionSnapshot, M as MarginPresetDefinition, k as PageFormatDefinition, R as RuntimeRenderSnapshot } from '../../public-types-BR1SYK2F.cjs';
2
2
  import { C as CanonicalDocument, P as PageSize, a as PageMargins, b as ColumnProperties, c as PageNumbering } from '../../canonical-document-CfZIc-fC.cjs';
3
3
  import 'react';
4
4
  import 'yjs';
@@ -1,4 +1,4 @@
1
- import { h as SelectionSnapshot, M as MarginPresetDefinition, i as PageFormatDefinition, R as RuntimeRenderSnapshot } from '../../public-types-Cjs8glST.js';
1
+ import { j as SelectionSnapshot, M as MarginPresetDefinition, k as PageFormatDefinition, R as RuntimeRenderSnapshot } from '../../public-types-DXNZVKrS.js';
2
2
  import { C as CanonicalDocument, P as PageSize, a as PageMargins, b as ColumnProperties, c as PageNumbering } from '../../canonical-document-CfZIc-fC.js';
3
3
  import 'react';
4
4
  import 'yjs';
@@ -1,4 +1,4 @@
1
- import { P as PersistedEditorSnapshot, R as RuntimeRenderSnapshot } from '../../public-types-KBS6JnOs.cjs';
1
+ import { P as PersistedEditorSnapshot, R as RuntimeRenderSnapshot } from '../../public-types-BR1SYK2F.cjs';
2
2
  import 'react';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';
@@ -1,4 +1,4 @@
1
- import { P as PersistedEditorSnapshot, R as RuntimeRenderSnapshot } from '../../public-types-Cjs8glST.js';
1
+ import { P as PersistedEditorSnapshot, R as RuntimeRenderSnapshot } from '../../public-types-DXNZVKrS.js';
2
2
  import 'react';
3
3
  import 'yjs';
4
4
  import 'y-protocols/awareness';