oasis-editor 0.0.173 → 0.0.175

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.
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
3
3
  var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
4
- import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, q as createSignal, r as cloneEditorState, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, v as probeLocalFontFamilies, w as createEditorParagraphFromRuns, x as isInlineObjectRun, y as stylesEqual, z as cloneStyle, A as createEditorStyledRun, B as cloneParagraphList, C as cloneParagraph, D as getParagraphLength, G as cloneRun, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as MATH_OBJECT_REPLACEMENT, T as setValueStyle, U as setBooleanStyle, V as parseFontSizePtToPx, W as formatFontSizePt, X as setParagraphStyleValue, Y as createEditorParagraph, Z as cloneBlocks, _ as resolveDefaultParagraphStyleId, $ as findParagraphTablePathLocation, a0 as findParagraphLocation, a1 as resolveTablePath, a2 as buildTableCellLayout, a3 as PT_PER_PX, a4 as createEditorTableCell, a5 as createEditorTableRow, a6 as createEditorTable, a7 as clampPosition, a8 as PX_PER_POINT, a9 as underlineStyleToCssDecorationStyle, aa as resolveImageSrc, ab as listKindForTag, ac as isParagraphTag, ad as collectInlineRuns, ae as parseParagraphStyle, af as getRunImage, ag as InlineShell, ah as BalloonShell, ai as DocumentShell, aj as findParagraphTableLocation, ak as createMemo, al as getCaretRectFromSnapshot, am as getParagraphRectFromSnapshot, an as createComponent, ao as CaretOverlay, ap as Show, aq as createRenderEffect, ar as style, as as setStyleProperty, at as setAttribute, au as memo, av as template, aw as Button, ax as useI18n, ay as createEffect, az as TextField, aA as Dialog, aB as insert, aC as className, aD as Grid, aE as SelectField, aF as StatusText, aG as ColorField, aH as UNDERLINE_STYLE_OPTIONS, aI as Stack, aJ as For, aK as ToggleChip, aL as FormField, aM as Checkbox, aN as FieldGroup, aO as Tabs, aP as NumberField, aQ as parseNumber, aR as createStore, aS as reconcile, aT as RadioGroup, aU as Radio$1, aV as TextAreaField, aW as COMMON_SYMBOLS, aX as getRecentSymbols, aY as SYMBOL_CATEGORIES, aZ as rememberSymbol, a_ as delegateEvents, a$ as EMPTY_EDITOR_MATH_EXPRESSION, b0 as serializeLinearMath, b1 as parseLinearMath, b2 as Text, b3 as SurfaceButton, b4 as onMount, b5 as onCleanup, b6 as CheckIcon, b7 as use, b8 as PluginUiHost, b9 as OasisEditorEditor, ba as OasisBrandMark, bb as setPreciseFontPreference, bc as setWelcomeSeen, bd as enablePreciseFontMode, be as WORD_NS$6, bf as XMLSerializer, bg as DOMParser, bh as WORD14_NS, bi as mergeNestedExtensionMarkup, bj as resolveOpcRelationships, bk as parseOpcRelationships, bl as JSZip, bm as normalizeOpcPartPath, bn as OPC_CONTENT_TYPES_PATH, bo as getOpcRelationshipOwnerPath, bp as serializeOpcRelationships, bq as OPC_ROOT_RELATIONSHIPS_PATH, br as hashDocxPartBytes, bs as parseOpcContentTypes, bt as serializeOpcContentTypes, bu as mergeParagraphPropertiesXmlSource, bv as setEditorRunOoxmlSource, bw as mergeRunOoxmlSourceIntoGeneratedXml, bx as mergeTableCellPropertiesXmlSource, by as mergeTableRowPropertiesXmlSource, bz as mergeTablePropertiesXmlSource, bA as getDocumentSectionsCanonical, bB as exportEditorDocumentToDocxBlob, bC as exportEditorDocumentToDocx, bD as pxToPt$1, bE as resolveFloatingObjectRect, bF as getTextBoxFloatingGeometry, bG as getPresetPathSegments, bH as buildListLabels, bI as assertNever, bJ as lineDashPatternPt, bK as DEFAULT_FONT_SIZE_PX, bL as resolveGradientAxis, bM as isDoubleUnderlineStyle, bN as isWavyUnderlineStyle, bO as underlineStyleLineWidthPx, bP as WAVY_UNDERLINE_WAVELENGTH_PX, bQ as WAVY_UNDERLINE_AMPLITUDE_PX, bR as DOUBLE_UNDERLINE_OFFSET_PX, bS as underlineStyleDashArray, bT as resolveEffectiveParagraphStyle, bU as EMPHASIS_GLYPH, bV as parseHexColorToRgb255, bW as rgb255ToHex, bX as getImageFloatingGeometry, bY as resolveEffectiveTextStyleForParagraph, bZ as textStyleToFontSizePt, b_ as mathDisplayText, b$ as TEXT_BASELINE_RATIO, c0 as resolveTextAlignmentBaselineOffset, c1 as resolveRenderedTextChar, c2 as resolveOpenTypeFeatureTags, c3 as isLowercaseSmallCapsChar, c4 as resolveDecorationLineY, c5 as DOUBLE_STRIKE_OFFSET_PX, c6 as resolveListLabel, c7 as getListLabelInset, c8 as getAlignedListLabelInset, c9 as getParagraphBorderInsets, ca as buildSegmentTable, cb as buildCanvasTableLayout, cc as resolveCanvasTableWidth, cd as resolveFloatingTableRect, ce as paragraphBetweenBorderMatches, cf as normalizeFamily, cg as ROBOTO_FONT_FILES, ch as loadFontAsset, ci as getRemotePdfFontFaces, cj as OFFICE_COMPAT_FONT_FAMILIES, ck as BinaryReader, cl as buildSfnt, cm as defaultFontDecoderRegistry, cn as SfntFontProgram, co as zlibSync, cp as renumberImageCaptionsInDocument, cq as collectPdfFontFamilies, cr as outlineFrom, cs as getPageHeaderZoneTop, ct as getPageColumnRects, cu as findFootnoteReference, cv as resolveImporterForFile, cw as roundTo, cx as getDocumentParagraphsCanonical, cy as getDocumentParagraphs, cz as getImageCaptionText, cA as isImageCaptionParagraph, cB as updateImageCaptionParagraph, cC as createImageCaptionParagraph, cD as renumberImageCaptionParagraphs, cE as getCaptionSelectionOffset, cF as PX_PER_CM, cG as getDocumentPageSettings, cH as getTableCellContentWidthForParagraph, cI as layoutMetricsEpoch, cJ as bumpLayoutMetricsEpoch, cK as createCanvasLayoutSnapshotProvider, cL as on, cM as debounce, cN as unwrap, cO as cloneSection, cP as perfTimer, cQ as prepareDocumentFonts, cR as getRunTextBox, cS as EMU_PER_PX, cT as createEditorDocument, cU as cloneBlock, cV as resolveResizedDimensions, cW as axisSignForDirection, cX as clamp$1, cY as MIN_RESIZE_SIZE_PX, cZ as resolveTextBoxRenderHeight, c_ as getToolbarStyleState, c$ as VERTICAL_HIT_WEIGHT, d0 as getCachedCanvasImage, d1 as measureParagraphMinContentWidthPx, d2 as createSectionBoundaryParagraph, d3 as normalizePageSettings, d4 as DEFAULT_EDITOR_PAGE_SETTINGS, d5 as markStart, d6 as markEnd, d7 as getParagraphEntries, d8 as getParagraphById, d9 as createEditorFootnote, da as createFootnoteReferenceRun, db as renumberFootnotes, dc as iterateFootnoteReferenceRuns, dd as preciseFontModeVersion, de as isPreciseFontModeEnabled, df as getRunFieldChar, dg as getRunFieldInstruction, dh as getHeadingLevel, di as createEditorRun, dj as TWIPS_PER_INCH, dk as PX_PER_INCH, dl as togglePreciseFontMode, dm as nextFontSizePt, dn as previousFontSizePt, dp as fontSizePtToPx, dq as resolveNamedTextStyle, dr as resolveNamedTableStyle, ds as resolveEffectiveTableStyle, dt as createDefaultToolbarPreset, du as MenuRegistry, dv as createToolbarRegistry, dw as Editor, dx as resolveCommandRef, dy as commandRefName, dz as createOasisEditorClient, dA as createEditorZoom, dB as startLongTaskObserver, dC as installGlobalReport, dD as applyStoredPreciseFontPreference, dE as getWelcomeSeen, dF as isLocalFontAccessSupported, dG as EDITOR_SCROLL_PADDING_PX, dH as Toolbar, dI as OasisEditorLoading, dJ as I18nProvider, dK as createTranslator, dL as registerDomStatsSurface, dM as createEditorLogger } from "./index-VPNNLM-n.js";
4
+ import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, q as createSignal, r as cloneEditorState, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, v as probeLocalFontFamilies, w as createEditorParagraphFromRuns, x as isInlineObjectRun, y as stylesEqual, z as cloneStyle, A as createEditorStyledRun, B as cloneParagraphList, C as cloneParagraph, D as getParagraphLength, G as cloneRun, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as MATH_OBJECT_REPLACEMENT, T as setValueStyle, U as setBooleanStyle, V as parseFontSizePtToPx, W as formatFontSizePt, X as setParagraphStyleValue, Y as createEditorParagraph, Z as cloneBlocks, _ as resolveDefaultParagraphStyleId, $ as findParagraphTablePathLocation, a0 as findParagraphLocation, a1 as resolveTablePath, a2 as buildTableCellLayout, a3 as PT_PER_PX, a4 as createEditorTableCell, a5 as createEditorTableRow, a6 as createEditorTable, a7 as clampPosition, a8 as PX_PER_POINT, a9 as underlineStyleToCssDecorationStyle, aa as resolveImageSrc, ab as listKindForTag, ac as isParagraphTag, ad as collectInlineRuns, ae as parseParagraphStyle, af as getRunImage, ag as InlineShell, ah as BalloonShell, ai as DocumentShell, aj as findParagraphTableLocation, ak as createMemo, al as getCaretRectFromSnapshot, am as getParagraphRectFromSnapshot, an as createComponent, ao as CaretOverlay, ap as Show, aq as createRenderEffect, ar as style, as as setStyleProperty, at as setAttribute, au as memo, av as template, aw as Button, ax as useI18n, ay as createEffect, az as TextField, aA as Dialog, aB as insert, aC as className, aD as Grid, aE as SelectField, aF as StatusText, aG as ColorField, aH as UNDERLINE_STYLE_OPTIONS, aI as Stack, aJ as For, aK as ToggleChip, aL as FormField, aM as Checkbox, aN as FieldGroup, aO as Tabs, aP as NumberField, aQ as parseNumber, aR as createStore, aS as reconcile, aT as RadioGroup, aU as Radio$1, aV as TextAreaField, aW as COMMON_SYMBOLS, aX as getRecentSymbols, aY as SYMBOL_CATEGORIES, aZ as rememberSymbol, a_ as delegateEvents, a$ as EMPTY_EDITOR_MATH_EXPRESSION, b0 as serializeLinearMath, b1 as parseLinearMath, b2 as Text, b3 as SurfaceButton, b4 as onMount, b5 as onCleanup, b6 as CheckIcon, b7 as use, b8 as PluginUiHost, b9 as OasisEditorEditor, ba as OasisBrandMark, bb as setPreciseFontPreference, bc as setWelcomeSeen, bd as enablePreciseFontMode, be as WORD_NS$6, bf as XMLSerializer, bg as DOMParser, bh as WORD14_NS, bi as mergeNestedExtensionMarkup, bj as resolveOpcRelationships, bk as parseOpcRelationships, bl as JSZip, bm as normalizeOpcPartPath, bn as OPC_CONTENT_TYPES_PATH, bo as getOpcRelationshipOwnerPath, bp as serializeOpcRelationships, bq as OPC_ROOT_RELATIONSHIPS_PATH, br as hashDocxPartBytes, bs as parseOpcContentTypes, bt as serializeOpcContentTypes, bu as mergeParagraphPropertiesXmlSource, bv as setEditorRunOoxmlSource, bw as mergeRunOoxmlSourceIntoGeneratedXml, bx as mergeTableCellPropertiesXmlSource, by as mergeTableRowPropertiesXmlSource, bz as mergeTablePropertiesXmlSource, bA as getDocumentSectionsCanonical, bB as exportEditorDocumentToDocxBlob, bC as exportEditorDocumentToDocx, bD as pxToPt$1, bE as resolveFloatingObjectRect, bF as getTextBoxFloatingGeometry, bG as getPresetPathSegments, bH as buildListLabels, bI as assertNever, bJ as lineDashPatternPt, bK as DEFAULT_FONT_SIZE_PX, bL as resolveGradientAxis, bM as isDoubleUnderlineStyle, bN as isWavyUnderlineStyle, bO as underlineStyleLineWidthPx, bP as WAVY_UNDERLINE_WAVELENGTH_PX, bQ as WAVY_UNDERLINE_AMPLITUDE_PX, bR as DOUBLE_UNDERLINE_OFFSET_PX, bS as underlineStyleDashArray, bT as resolveEffectiveParagraphStyle, bU as EMPHASIS_GLYPH, bV as parseHexColorToRgb255, bW as rgb255ToHex, bX as getImageFloatingGeometry, bY as resolveEffectiveTextStyleForParagraph, bZ as textStyleToFontSizePt, b_ as mathDisplayText, b$ as TEXT_BASELINE_RATIO, c0 as resolveTextAlignmentBaselineOffset, c1 as resolveRenderedTextChar, c2 as resolveOpenTypeFeatureTags, c3 as isLowercaseSmallCapsChar, c4 as resolveDecorationLineY, c5 as DOUBLE_STRIKE_OFFSET_PX, c6 as resolveListLabel, c7 as getListLabelInset, c8 as getAlignedListLabelInset, c9 as getParagraphBorderInsets, ca as buildSegmentTable, cb as buildCanvasTableLayout, cc as resolveCanvasTableWidth, cd as resolveFloatingTableRect, ce as paragraphBetweenBorderMatches, cf as normalizeFamily, cg as ROBOTO_FONT_FILES, ch as loadFontAsset, ci as getRemotePdfFontFaces, cj as OFFICE_COMPAT_FONT_FAMILIES, ck as BinaryReader, cl as buildSfnt, cm as defaultFontDecoderRegistry, cn as SfntFontProgram, co as zlibSync, cp as renumberImageCaptionsInDocument, cq as collectPdfFontFamilies, cr as outlineFrom, cs as getPageHeaderZoneTop, ct as getPageColumnRects, cu as findFootnoteReference, cv as resolveImporterForFile, cw as roundTo, cx as getDocumentParagraphsCanonical, cy as getDocumentParagraphs, cz as getImageCaptionText, cA as isImageCaptionParagraph, cB as updateImageCaptionParagraph, cC as createImageCaptionParagraph, cD as renumberImageCaptionParagraphs, cE as getCaptionSelectionOffset, cF as PX_PER_CM, cG as getDocumentPageSettings, cH as getTableCellContentWidthForParagraph, cI as layoutMetricsEpoch, cJ as bumpLayoutMetricsEpoch, cK as createCanvasLayoutSnapshotProvider, cL as on, cM as debounce, cN as unwrap, cO as cloneSection, cP as perfTimer, cQ as prepareDocumentFonts, cR as getRunTextBox, cS as EMU_PER_PX, cT as createEditorDocument, cU as cloneBlock, cV as resolveResizedDimensions, cW as axisSignForDirection, cX as clamp$1, cY as MIN_RESIZE_SIZE_PX, cZ as resolveTextBoxRenderHeight, c_ as getToolbarStyleState, c$ as VERTICAL_HIT_WEIGHT, d0 as getCachedCanvasImage, d1 as measureParagraphMinContentWidthPx, d2 as createSectionBoundaryParagraph, d3 as normalizePageSettings, d4 as DEFAULT_EDITOR_PAGE_SETTINGS, d5 as markStart, d6 as markEnd, d7 as getParagraphEntries, d8 as getParagraphById, d9 as createEditorFootnote, da as createFootnoteReferenceRun, db as renumberFootnotes, dc as iterateFootnoteReferenceRuns, dd as preciseFontModeVersion, de as isPreciseFontModeEnabled, df as getRunFieldChar, dg as getRunFieldInstruction, dh as getHeadingLevel, di as createEditorRun, dj as TWIPS_PER_INCH, dk as PX_PER_INCH, dl as togglePreciseFontMode, dm as nextFontSizePt, dn as previousFontSizePt, dp as fontSizePtToPx, dq as resolveNamedTextStyle, dr as resolveNamedTableStyle, ds as resolveEffectiveTableStyle, dt as createDefaultToolbarPreset, du as MenuRegistry, dv as createToolbarRegistry, dw as Editor, dx as resolveCommandRef, dy as commandRefName, dz as createOasisEditorClient, dA as createEditorZoom, dB as startLongTaskObserver, dC as installGlobalReport, dD as applyStoredPreciseFontPreference, dE as getWelcomeSeen, dF as isLocalFontAccessSupported, dG as EDITOR_SCROLL_PADDING_PX, dH as Toolbar, dI as OasisEditorLoading, dJ as I18nProvider, dK as createTranslator, dL as registerDomStatsSurface, dM as createEditorLogger } from "./index-CSKfMgDC.js";
5
5
  function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
6
6
  const {
7
7
  pageIndex,
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
2863
2863
  onCleanup(() => {
2864
2864
  cancelled = true;
2865
2865
  });
2866
- import("./OasisEditorApp-DAON1Lo9.js").then((m) => {
2866
+ import("./OasisEditorApp-Bf9zCPBd.js").then((m) => {
2867
2867
  cancelled = true;
2868
2868
  setProgress(1);
2869
2869
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -52063,6 +52063,57 @@ function pushIssue(context2, issue) {
52063
52063
  context2.unresolvedKeys.add(key);
52064
52064
  context2.unresolved.push(issue);
52065
52065
  }
52066
+ function collectParagraphsDeep(blocks) {
52067
+ const paragraphs = [];
52068
+ const collectBlocks2 = (story) => {
52069
+ for (const block of story) {
52070
+ if (block.type === "paragraph") {
52071
+ paragraphs.push(block);
52072
+ for (const run of block.runs) {
52073
+ if (run.kind === "textBox") collectBlocks2(run.textBox.blocks);
52074
+ }
52075
+ continue;
52076
+ }
52077
+ for (const row of block.rows) {
52078
+ for (const cell of row.cells) collectBlocks2(cell.blocks);
52079
+ }
52080
+ }
52081
+ };
52082
+ collectBlocks2(blocks);
52083
+ return paragraphs;
52084
+ }
52085
+ function recordRemovedParagraphRelocations(before, after, context2) {
52086
+ const oldParagraphs = collectParagraphsDeep([before]);
52087
+ const newParagraphs = collectParagraphsDeep([after]);
52088
+ const newById = new Map(newParagraphs.map((paragraph) => [paragraph.id, paragraph]));
52089
+ for (let index = 0; index < oldParagraphs.length; index += 1) {
52090
+ const paragraph = oldParagraphs[index];
52091
+ if (newById.has(paragraph.id) || context2.paragraphRelocations.has(paragraph.id)) {
52092
+ continue;
52093
+ }
52094
+ let relocation = null;
52095
+ for (let previous = index - 1; previous >= 0; previous -= 1) {
52096
+ const candidate = newById.get(oldParagraphs[previous].id);
52097
+ if (candidate) {
52098
+ relocation = {
52099
+ paragraphId: candidate.id,
52100
+ offset: getParagraphText(candidate).length
52101
+ };
52102
+ break;
52103
+ }
52104
+ }
52105
+ if (!relocation) {
52106
+ for (let following = index + 1; following < oldParagraphs.length; following += 1) {
52107
+ const candidate = newById.get(oldParagraphs[following].id);
52108
+ if (candidate) {
52109
+ relocation = { paragraphId: candidate.id, offset: 0 };
52110
+ break;
52111
+ }
52112
+ }
52113
+ }
52114
+ context2.paragraphRelocations.set(paragraph.id, relocation);
52115
+ }
52116
+ }
52066
52117
  function stripTextPropertyRevision(style2) {
52067
52118
  const next = cloneStyle(style2);
52068
52119
  if (!next) return void 0;
@@ -52170,6 +52221,16 @@ function transformParagraph(paragraph, path, context2) {
52170
52221
  for (let index = 0; index < paragraph.runs.length; index += 1) {
52171
52222
  const run = paragraph.runs[index];
52172
52223
  const nextRun = resolveRun(run, `${path}.runs[${index}]`, context2);
52224
+ if (!nextRun && run.kind === "textBox") {
52225
+ for (const nested of collectParagraphsDeep(run.textBox.blocks)) {
52226
+ if (!context2.paragraphRelocations.has(nested.id)) {
52227
+ context2.paragraphRelocations.set(nested.id, {
52228
+ paragraphId: paragraph.id,
52229
+ offset: newCursor
52230
+ });
52231
+ }
52232
+ }
52233
+ }
52173
52234
  const length = run.text.length;
52174
52235
  segments.push({
52175
52236
  oldStart: oldCursor,
@@ -52219,16 +52280,6 @@ function resolveRowStructuralRevision(row, path, context2) {
52219
52280
  const revision = (_a2 = row.style) == null ? void 0 : _a2.revision;
52220
52281
  if (!revision || !matchesRevision(context2, revision.id)) return row;
52221
52282
  markMatched(context2);
52222
- const requiresRemoval = context2.action === "accept" && revision.type === "delete" || context2.action === "reject" && revision.type === "insert";
52223
- if (requiresRemoval) {
52224
- pushIssue(context2, {
52225
- kind: "structural-removal-unavailable",
52226
- revisionId: revision.id,
52227
- path,
52228
- message: "Resolving this row revision would remove a table subtree; anchor-safe subtree removal is not implemented yet."
52229
- });
52230
- return row;
52231
- }
52232
52283
  if (context2.action === "reject" && revision.type === "merge") {
52233
52284
  pushIssue(context2, {
52234
52285
  kind: "cell-merge-original-unavailable",
@@ -52250,16 +52301,6 @@ function resolveCellStructuralRevision(cell, path, context2) {
52250
52301
  const mergeStateMatches = cell.mergeRevisionState && matchesRevision(context2, cell.mergeRevisionState.revisionId);
52251
52302
  if (revision && matchesRevision(context2, revision.id)) {
52252
52303
  markMatched(context2);
52253
- const requiresRemoval = context2.action === "accept" && revision.type === "delete" || context2.action === "reject" && revision.type === "insert";
52254
- if (requiresRemoval) {
52255
- pushIssue(context2, {
52256
- kind: "structural-removal-unavailable",
52257
- revisionId: revision.id,
52258
- path,
52259
- message: "Resolving this cell revision would remove a table subtree; anchor-safe subtree removal is not implemented yet."
52260
- });
52261
- return cell;
52262
- }
52263
52304
  if (context2.action === "reject" && revision.type === "merge") {
52264
52305
  pushIssue(context2, {
52265
52306
  kind: "cell-merge-original-unavailable",
@@ -52301,6 +52342,7 @@ function transformCell(cell, path, context2) {
52301
52342
  return next;
52302
52343
  }
52303
52344
  function transformRow(row, path, context2) {
52345
+ var _a2;
52304
52346
  let next = resolveRowStructuralRevision(row, path, context2);
52305
52347
  const style2 = resolveRowPropertyStyle(next.style, `${path}.style`, context2);
52306
52348
  if (style2 !== next.style) next = { ...next, style: style2 };
@@ -52321,15 +52363,26 @@ function transformRow(row, path, context2) {
52321
52363
  }
52322
52364
  }
52323
52365
  }
52324
- const cells = next.cells.map(
52325
- (cell, index) => transformCell(cell, `${path}.cells[${index}]`, context2)
52326
- );
52327
- if (cells.some((cell, index) => cell !== next.cells[index])) {
52328
- next = { ...next, cells };
52366
+ const cells = [];
52367
+ let cellsChanged = false;
52368
+ for (let index = 0; index < next.cells.length; index += 1) {
52369
+ const cell = next.cells[index];
52370
+ const revision = (_a2 = cell.style) == null ? void 0 : _a2.revision;
52371
+ const remove = revision && matchesRevision(context2, revision.id) && (context2.action === "accept" && revision.type === "delete" || context2.action === "reject" && revision.type === "insert");
52372
+ if (remove) {
52373
+ markResolved(context2, revision.id);
52374
+ cellsChanged = true;
52375
+ continue;
52376
+ }
52377
+ const transformed = transformCell(cell, `${path}.cells[${index}]`, context2);
52378
+ cells.push(transformed);
52379
+ if (transformed !== cell) cellsChanged = true;
52329
52380
  }
52381
+ if (cellsChanged) next = { ...next, cells };
52330
52382
  return next;
52331
52383
  }
52332
52384
  function transformTable(table, path, context2) {
52385
+ var _a2;
52333
52386
  let next = table;
52334
52387
  const style2 = resolveTableStyle(next.style, `${path}.style`, context2);
52335
52388
  if (style2 !== next.style) next = { ...next, style: style2 };
@@ -52346,12 +52399,23 @@ function transformTable(table, path, context2) {
52346
52399
  };
52347
52400
  }
52348
52401
  }
52349
- const rows = next.rows.map(
52350
- (row, index) => transformRow(row, `${path}.rows[${index}]`, context2)
52351
- );
52352
- if (rows.some((row, index) => row !== next.rows[index])) {
52353
- next = { ...next, rows };
52402
+ const rows = [];
52403
+ let rowsChanged = false;
52404
+ for (let index = 0; index < next.rows.length; index += 1) {
52405
+ const row = next.rows[index];
52406
+ const revision = (_a2 = row.style) == null ? void 0 : _a2.revision;
52407
+ const remove = revision && matchesRevision(context2, revision.id) && (context2.action === "accept" && revision.type === "delete" || context2.action === "reject" && revision.type === "insert");
52408
+ if (remove) {
52409
+ markResolved(context2, revision.id);
52410
+ rowsChanged = true;
52411
+ continue;
52412
+ }
52413
+ const transformed = transformRow(row, `${path}.rows[${index}]`, context2);
52414
+ rows.push(transformed);
52415
+ if (transformed !== row) rowsChanged = true;
52354
52416
  }
52417
+ if (rowsChanged) next = { ...next, rows };
52418
+ if (rowsChanged) recordRemovedParagraphRelocations(table, next, context2);
52355
52419
  return next;
52356
52420
  }
52357
52421
  function transformBlocks(blocks, path, context2) {
@@ -52480,44 +52544,76 @@ function mapParagraphOffset(transform2, offset) {
52480
52544
  }
52481
52545
  return transform2.newLength;
52482
52546
  }
52483
- function transformAnchor(anchor, transforms) {
52547
+ function transformAnchor(anchor, transforms, relocations) {
52484
52548
  if (!anchor) return void 0;
52485
- const transform2 = transforms.get(anchor.paragraphId);
52486
- if (!transform2) return anchor;
52487
- const offset = mapParagraphOffset(transform2, anchor.offset);
52488
- return offset === anchor.offset ? anchor : { ...anchor, offset };
52489
- }
52490
- function transformBookmarks(document2, transforms) {
52491
- if (!document2.bookmarks || transforms.size === 0) return;
52549
+ let paragraphId = anchor.paragraphId;
52550
+ let offset = anchor.offset;
52551
+ let relocated = false;
52552
+ const seen = /* @__PURE__ */ new Set();
52553
+ while (relocations.has(paragraphId)) {
52554
+ if (seen.has(paragraphId)) return void 0;
52555
+ seen.add(paragraphId);
52556
+ const relocation = relocations.get(paragraphId);
52557
+ if (!relocation) return void 0;
52558
+ paragraphId = relocation.paragraphId;
52559
+ offset = relocation.offset;
52560
+ relocated = true;
52561
+ }
52562
+ if (!relocated) {
52563
+ const transform2 = transforms.get(paragraphId);
52564
+ if (transform2) offset = mapParagraphOffset(transform2, offset);
52565
+ }
52566
+ return paragraphId === anchor.paragraphId && offset === anchor.offset ? anchor : { ...anchor, paragraphId, offset };
52567
+ }
52568
+ function transformBookmarks(document2, transforms, relocations) {
52569
+ if (!document2.bookmarks || transforms.size === 0 && relocations.size === 0) return;
52492
52570
  let changed = false;
52493
52571
  const items = { ...document2.bookmarks.items };
52572
+ const order = [];
52494
52573
  for (const id of document2.bookmarks.order) {
52495
52574
  const bookmark = document2.bookmarks.items[id];
52496
52575
  if (!bookmark) continue;
52497
- const start = transformAnchor(bookmark.start, transforms);
52498
- const end = transformAnchor(bookmark.end, transforms);
52576
+ const mappedStart = transformAnchor(bookmark.start, transforms, relocations);
52577
+ const mappedEnd = transformAnchor(bookmark.end, transforms, relocations);
52578
+ const start = mappedStart ?? (bookmark.start ? mappedEnd : void 0);
52579
+ const end = mappedEnd ?? (bookmark.end ? mappedStart : void 0);
52580
+ if (!start && !end) {
52581
+ delete items[id];
52582
+ changed = true;
52583
+ continue;
52584
+ }
52585
+ order.push(id);
52499
52586
  if (start !== bookmark.start || end !== bookmark.end) {
52500
52587
  items[id] = { ...bookmark, start, end };
52501
52588
  changed = true;
52502
52589
  }
52503
52590
  }
52504
- if (changed) document2.bookmarks = { ...document2.bookmarks, items };
52591
+ if (changed) document2.bookmarks = { ...document2.bookmarks, items, order };
52505
52592
  }
52506
- function transformComments(comments, transforms) {
52507
- if (!comments || transforms.size === 0) return comments;
52593
+ function transformComments(comments, transforms, relocations) {
52594
+ if (!comments || transforms.size === 0 && relocations.size === 0) return comments;
52508
52595
  let changed = false;
52509
52596
  const items = { ...comments.items };
52597
+ const order = [];
52510
52598
  for (const id of comments.order) {
52511
52599
  const comment = comments.items[id];
52512
52600
  if (!comment) continue;
52513
- const start = transformAnchor(comment.start, transforms);
52514
- const end = transformAnchor(comment.end, transforms);
52601
+ const mappedStart = transformAnchor(comment.start, transforms, relocations);
52602
+ const mappedEnd = transformAnchor(comment.end, transforms, relocations);
52603
+ const start = mappedStart ?? (comment.start ? mappedEnd : void 0);
52604
+ const end = mappedEnd ?? (comment.end ? mappedStart : void 0);
52605
+ if (!start && !end) {
52606
+ delete items[id];
52607
+ changed = true;
52608
+ continue;
52609
+ }
52610
+ order.push(id);
52515
52611
  if (start !== comment.start || end !== comment.end) {
52516
52612
  items[id] = { ...comment, start, end };
52517
52613
  changed = true;
52518
52614
  }
52519
52615
  }
52520
- return changed ? { ...comments, items } : comments;
52616
+ return changed ? { ...comments, items, order } : comments;
52521
52617
  }
52522
52618
  function resolve(document2, action, revisionId) {
52523
52619
  const context2 = {
@@ -52528,7 +52624,8 @@ function resolve(document2, action, revisionId) {
52528
52624
  resolvedRevisionIds: /* @__PURE__ */ new Set(),
52529
52625
  unresolved: [],
52530
52626
  unresolvedKeys: /* @__PURE__ */ new Set(),
52531
- paragraphOffsetTransforms: /* @__PURE__ */ new Map()
52627
+ paragraphOffsetTransforms: /* @__PURE__ */ new Map(),
52628
+ paragraphRelocations: /* @__PURE__ */ new Map()
52532
52629
  };
52533
52630
  const sections = getDocumentSectionsCanonical(document2).map(cloneSection);
52534
52631
  const next = {
@@ -52540,10 +52637,15 @@ function resolve(document2, action, revisionId) {
52540
52637
  transformSectionStories(sections, context2);
52541
52638
  transformNoteStories(next, context2);
52542
52639
  applySectionPropertyRevisions(sections, context2);
52543
- transformBookmarks(next, context2.paragraphOffsetTransforms);
52640
+ transformBookmarks(
52641
+ next,
52642
+ context2.paragraphOffsetTransforms,
52643
+ context2.paragraphRelocations
52644
+ );
52544
52645
  next.comments = transformComments(
52545
52646
  next.comments,
52546
- context2.paragraphOffsetTransforms
52647
+ context2.paragraphOffsetTransforms,
52648
+ context2.paragraphRelocations
52547
52649
  );
52548
52650
  if (revisionId !== void 0 && !context2.matched) {
52549
52651
  context2.unresolved.push({
@@ -1,4 +1,4 @@
1
- import { dN, ah, aw, aM, aG, dO, dP, dQ, aA, dR, ai, dS, dw, aN, dT, dU, aL, aD, dV, dW, dX, ag, dY, du, aP, dZ, d_, d$, e0, e1, dI, e2, e3, e4, aU, aT, e5, aE, e6, e7, e8, e9, ea, eb, aI, aF, ec, b3, aO, b2, aV, az, aK, dH, ed, dO as dO2, dV as dV2, dY as dY2, e5 as e52, e6 as e62, eb as eb2, ee, ef, dy, dt, eg, eh, ei, ej, ek, el, em, dv, en, eo, ep, eq, er, dx, es, et } from "./index-VPNNLM-n.js";
1
+ import { dN, ah, aw, aM, aG, dO, dP, dQ, aA, dR, ai, dS, dw, aN, dT, dU, aL, aD, dV, dW, dX, ag, dY, du, aP, dZ, d_, d$, e0, e1, dI, e2, e3, e4, aU, aT, e5, aE, e6, e7, e8, e9, ea, eb, aI, aF, ec, b3, aO, b2, aV, az, aK, dH, ed, dO as dO2, dV as dV2, dY as dY2, e5 as e52, e6 as e62, eb as eb2, ee, ef, dy, dt, eg, eh, ei, ej, ek, el, em, dv, en, eo, ep, eq, er, dx, es, et } from "./index-CSKfMgDC.js";
2
2
  export {
3
3
  dN as ActionRow,
4
4
  ah as BalloonShell,