@superdoc/mcp 1.6.0-next.17 → 1.6.0-next.19
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.
- package/dist/index.js +1048 -800
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31600,7 +31600,7 @@ var init_host = __esm(() => {
|
|
|
31600
31600
|
});
|
|
31601
31601
|
|
|
31602
31602
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31603
|
-
var SDK_VERSION = "2.19.0-next.
|
|
31603
|
+
var SDK_VERSION = "2.19.0-next.19";
|
|
31604
31604
|
|
|
31605
31605
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31606
31606
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -103230,12 +103230,19 @@ function normalizeMutationOptions(options, supportCheckOperation) {
|
|
|
103230
103230
|
}
|
|
103231
103231
|
}
|
|
103232
103232
|
const offsetSpace = options?.offsetSpace;
|
|
103233
|
+
const tableCellSelection = options?.tableCellSelection;
|
|
103233
103234
|
return {
|
|
103234
103235
|
expectedRevision: options?.expectedRevision,
|
|
103235
103236
|
changeMode: options?.changeMode ?? "direct",
|
|
103236
103237
|
dryRun: options?.dryRun ?? false,
|
|
103237
103238
|
...supportCheck ? { supportCheck } : {},
|
|
103238
|
-
...offsetSpace === "selection" || offsetSpace === "kernel" ? { offsetSpace } : {}
|
|
103239
|
+
...offsetSpace === "selection" || offsetSpace === "kernel" ? { offsetSpace } : {},
|
|
103240
|
+
...typeof tableCellSelection?.anchorBlockId === "string" && typeof tableCellSelection?.focusBlockId === "string" ? {
|
|
103241
|
+
tableCellSelection: {
|
|
103242
|
+
anchorBlockId: tableCellSelection.anchorBlockId,
|
|
103243
|
+
focusBlockId: tableCellSelection.focusBlockId
|
|
103244
|
+
}
|
|
103245
|
+
} : {}
|
|
103239
103246
|
};
|
|
103240
103247
|
}
|
|
103241
103248
|
function validateSupportCheckGuard(value, operation) {
|
|
@@ -195388,7 +195395,7 @@ function isBreakRunToken(token) {
|
|
|
195388
195395
|
}
|
|
195389
195396
|
function compileOverlapEdit(input) {
|
|
195390
195397
|
const paragraphInlineMap = input.paragraphInlineMap ?? parseParagraphInlineMap(input.paragraphXml, input.namespaceBindings);
|
|
195391
|
-
const consecutiveBreakInsertion = tryConsecutiveManualBreakInsertion(input, paragraphInlineMap);
|
|
195398
|
+
const consecutiveBreakInsertion = input.newTextRunsXml === undefined ? tryConsecutiveManualBreakInsertion(input, paragraphInlineMap) : null;
|
|
195392
195399
|
if (consecutiveBreakInsertion)
|
|
195393
195400
|
return consecutiveBreakInsertion;
|
|
195394
195401
|
const readsComplexDeletionForCollapsedInsert = input.newText.length > 0 && input.rangeStart === input.rangeEnd && ((input.coordinateSpace ?? "visible") === "visible" || input.changeMode === "tracked");
|
|
@@ -195483,6 +195490,12 @@ function compileParsedOverlapEdit(input, tokens, descendedEditableContainers) {
|
|
|
195483
195490
|
if (touched.length === 0 && touchedBreaks.length === 0) {
|
|
195484
195491
|
return { ok: false, reason: "invalid-range", detail: "overlap compiler: no tokens touched by the range." };
|
|
195485
195492
|
}
|
|
195493
|
+
if (input.newTextRunsXml !== undefined) {
|
|
195494
|
+
const parent = touched.length === 1 ? touched[0].token : null;
|
|
195495
|
+
if (input.changeMode !== "tracked" || input.rangeStart !== input.rangeEnd || !input.newText.length || parent?.kind !== "ins" || input.rangeStart <= parent.visibleStart || input.rangeStart >= parent.visibleEnd || parent.nestedDeletions?.length || parent.commentedBoundary || descendedEditableContainers.length || !parent.sourceIdentity.rsid && !parent.sourceIdentity.wId) {
|
|
195496
|
+
return { ok: false, reason: "text-range-in-unsupported-tracked-wrapper" };
|
|
195497
|
+
}
|
|
195498
|
+
}
|
|
195486
195499
|
if (touchedBreaks.length > 0) {
|
|
195487
195500
|
const withBreaks = tryPureDeleteAcrossTokens(input, tokens, touched, touchedBreaks);
|
|
195488
195501
|
if (withBreaks)
|
|
@@ -196587,7 +196600,10 @@ function foldInsideOwnInsertion(input, allTokens, parent) {
|
|
|
196587
196600
|
return result2.ok && input.changeMode === "direct" ? { ...result2, requiresCollaborationSessionSync: true } : result2;
|
|
196588
196601
|
}
|
|
196589
196602
|
let innerXml = null;
|
|
196590
|
-
if (
|
|
196603
|
+
if (input.newTextRunsXml !== undefined) {
|
|
196604
|
+
const runs = parent.innerRuns ?? [parent.inner];
|
|
196605
|
+
innerXml = buildInsInnerXmlFromRuns(sliceWrappedRuns(runs, 0, localStart)) + input.newTextRunsXml + buildInsInnerXmlFromRuns(sliceWrappedRuns(runs, localEnd, text.length));
|
|
196606
|
+
} else if (nestedDeletions.length > 0) {
|
|
196591
196607
|
const runs = spliceInnerRuns(parent.innerRuns ?? [parent.inner], localStart, localEnd, input.newText, parent, localStart);
|
|
196592
196608
|
const delta = input.newText.length - (localEnd - localStart);
|
|
196593
196609
|
const preservedDeletions = nestedDeletions.map((entry) => {
|
|
@@ -196988,7 +197004,8 @@ function splitInsertionAroundChildChange(input, allTokens, parent) {
|
|
|
196988
197004
|
runClose: insertMeta.runClose,
|
|
196989
197005
|
rPr: insertRPr,
|
|
196990
197006
|
text: input.newText
|
|
196991
|
-
}
|
|
197007
|
+
},
|
|
197008
|
+
...input.newTextRunsXml !== undefined ? { innerXml: input.newTextRunsXml } : {}
|
|
196992
197009
|
});
|
|
196993
197010
|
const closed = closeFreshInsertionScope(childInsXml, Object.fromEntries(parent.namespaceBindings), input.namespaceBindings ?? {});
|
|
196994
197011
|
if (closed == null)
|
|
@@ -221707,7 +221724,12 @@ function planDirectParagraphRangeRewrite(input) {
|
|
|
221707
221724
|
if (!bytes || end.partUri !== start.partUri)
|
|
221708
221725
|
return { ok: false, reason: "unsupported-context" };
|
|
221709
221726
|
const partXml = TD56.decode(bytes);
|
|
221710
|
-
const
|
|
221727
|
+
const commentMarkers = collectBodyCommentMarkers(partXml);
|
|
221728
|
+
const touchedComments = collectCommentsTouchedByByteRange(commentMarkers, input.selectionStartByte, input.selectionEndByte);
|
|
221729
|
+
const retainedStarts = retainedCommentStarts(input, bytes, commentMarkers, touchedComments);
|
|
221730
|
+
for (const marker of retainedStarts)
|
|
221731
|
+
touchedComments.delete(marker.id);
|
|
221732
|
+
const cascadingComments = expandCommentThreadWIds(state, touchedComments);
|
|
221711
221733
|
const startXml = decodeByteRange2(bytes, start.byteStart, start.byteEnd);
|
|
221712
221734
|
const endXml = decodeByteRange2(bytes, end.byteStart, end.byteEnd);
|
|
221713
221735
|
const beforeWindowXml = decodeByteRange2(bytes, start.byteStart, end.byteEnd);
|
|
@@ -221741,7 +221763,13 @@ function planDirectParagraphRangeRewrite(input) {
|
|
|
221741
221763
|
});
|
|
221742
221764
|
if (!endSlice.ok)
|
|
221743
221765
|
return endSlice;
|
|
221744
|
-
|
|
221766
|
+
let movedStarts = "";
|
|
221767
|
+
if (retainedStarts.length > 0) {
|
|
221768
|
+
const destinationNamespaces = namespaceBindingsAtPosition(bytes, start.byteStart, matchParagraphOpenTag(startXml) ?? "");
|
|
221769
|
+
const retainedHeadStarts = collectBodyCommentMarkers(startSlice.head, destinationNamespaces).filter((marker) => marker.kind === "commentRangeStart").map((marker) => marker.id);
|
|
221770
|
+
movedStarts = retainedStarts.filter((marker) => !retainedHeadStarts.includes(marker.id)).map((marker) => commentMarkerWithNamespaces(bytes, marker, destinationNamespaces)).join("");
|
|
221771
|
+
}
|
|
221772
|
+
const collapsed = sectionCollapse ? sectionCollapse.render(startSlice.head + movedStarts, endSlice.tail) : renderCollapsedParagraph(startXml, startSlice.head + movedStarts, endSlice.tail);
|
|
221745
221773
|
if (!collapsed)
|
|
221746
221774
|
return { ok: false, reason: "invalid-range" };
|
|
221747
221775
|
collapsedXml = collapsed;
|
|
@@ -223555,14 +223583,42 @@ function collectCascadingComments(paraXml, resolveNamespaceBindings) {
|
|
|
223555
223583
|
return new Set;
|
|
223556
223584
|
return new Set(collectBodyCommentMarkers(paraXml, resolveNamespaceBindings()).map((marker) => marker.id));
|
|
223557
223585
|
}
|
|
223558
|
-
function collectCommentsTouchedByByteRange(
|
|
223586
|
+
function collectCommentsTouchedByByteRange(markers, startByte, endByte) {
|
|
223559
223587
|
const touched = new Set;
|
|
223560
|
-
for (const marker of
|
|
223588
|
+
for (const marker of markers) {
|
|
223561
223589
|
if (marker.range.byteStart < endByte && marker.range.byteEnd > startByte)
|
|
223562
223590
|
touched.add(marker.id);
|
|
223563
223591
|
}
|
|
223564
223592
|
return touched;
|
|
223565
223593
|
}
|
|
223594
|
+
function retainedCommentStarts(input, bytes, markers, touched) {
|
|
223595
|
+
if (input.fullBlockReplacementXml !== undefined)
|
|
223596
|
+
return [];
|
|
223597
|
+
return markers.filter((marker) => {
|
|
223598
|
+
if (marker.kind !== "commentRangeStart" || !touched.has(marker.id))
|
|
223599
|
+
return false;
|
|
223600
|
+
const anchors = markers.filter((candidate2) => candidate2.id === marker.id);
|
|
223601
|
+
const end = anchors.find((candidate2) => candidate2.kind === "commentRangeEnd");
|
|
223602
|
+
const reference = anchors.find((candidate2) => candidate2.kind === "commentReference");
|
|
223603
|
+
if (anchors.length !== 3 || !end || !reference || marker.range.byteStart < input.selectionStartByte || marker.range.byteEnd > input.selectionEndByte || end.range.byteStart < input.selectionEndByte || reference.range.byteStart < end.range.byteEnd)
|
|
223604
|
+
return false;
|
|
223605
|
+
const endEntry = input.indexEntries.find((entry) => end.range.byteStart >= entry.byteStart && end.range.byteStart < entry.byteEnd);
|
|
223606
|
+
if (!endEntry || endEntry.ordinal < input.end.ordinal)
|
|
223607
|
+
return false;
|
|
223608
|
+
const endXml = decodeByteRange2(bytes, endEntry.byteStart, endEntry.byteEnd);
|
|
223609
|
+
const model = parseParagraphInlineMap(endXml, end.paragraph?.namespaceBindings);
|
|
223610
|
+
const endMarkerOffset = resolveParagraphVisibleOffsetAtByte(model, end.range.byteStart - endEntry.byteStart);
|
|
223611
|
+
const remainingChars = endEntry.ordinal === input.end.ordinal ? endMarkerOffset - input.endOffset : input.end.textLength - input.endOffset + endMarkerOffset + input.indexEntries.filter((entry) => entry.ordinal > input.end.ordinal && entry.ordinal < endEntry.ordinal).reduce((sum, entry) => sum + entry.textLength, 0);
|
|
223612
|
+
return remainingChars > 0;
|
|
223613
|
+
});
|
|
223614
|
+
}
|
|
223615
|
+
function commentMarkerWithNamespaces(bytes, marker, destinationNamespaces) {
|
|
223616
|
+
const xml = decodeByteRange2(bytes, marker.range.byteStart, marker.range.byteEnd);
|
|
223617
|
+
const openTag = xml.match(/^<(?:"[^"]*"|'[^']*'|[^>"'])*>/)?.[0] ?? "";
|
|
223618
|
+
const localNamespaces = namespaceBindingsAtPosition(TE25.encode(xml), 0, openTag);
|
|
223619
|
+
const declarations = Object.entries(namespaceBindingsAtPosition(bytes, marker.range.byteStart)).filter(([prefix, uri]) => localNamespaces[prefix] === undefined && destinationNamespaces[prefix] !== uri).map(([prefix, uri]) => ` xmlns${prefix ? `:${prefix}` : ""}="${escapeXmlAttribute(uri)}"`).join("");
|
|
223620
|
+
return xml.replace(/^<[\w.-]+(?::[\w.-]+)?\b/, (tag) => tag + declarations);
|
|
223621
|
+
}
|
|
223566
223622
|
function stripCommentAnchorsFromXml(xml, commentIds, resolveNamespaceBindings) {
|
|
223567
223623
|
const bytes = TE25.encode(xml);
|
|
223568
223624
|
if (commentIds.size === 0)
|
|
@@ -238014,6 +238070,50 @@ var init_types6 = __esm(() => {
|
|
|
238014
238070
|
});
|
|
238015
238071
|
|
|
238016
238072
|
// ../../../v2/editor-core/dist/document/transactions/compile-paste-splice.js
|
|
238073
|
+
function planTrackedInsertionSplice(input) {
|
|
238074
|
+
const block = input.blocks.length === 1 ? input.blocks[0] : null;
|
|
238075
|
+
const stamp = input.trackedStamp;
|
|
238076
|
+
if (!stamp || input.wrapAllTracked === false || input.collapsedObjectBoundary || (input.replaceToOffset ?? input.charOffset) !== input.charOffset || block?.kind !== "paragraph" || block.styleRef || block.numbering || block.listIntent || block.paragraphProps || block.pPrXml || block.blockSdts?.length || block.complete)
|
|
238077
|
+
return null;
|
|
238078
|
+
const runs = input.inlineSpecs?.get(block) ?? block.runs.map(toPasteTextRunSpec);
|
|
238079
|
+
if (runs.some((run) => run.kind !== undefined && run.kind !== "text" || ("commentIds" in run) && run.commentIds?.length || ("trackedInsertion" in run) && run.trackedInsertion))
|
|
238080
|
+
return null;
|
|
238081
|
+
const newText = runs.map((run) => ("text" in run) ? run.text : "").join("");
|
|
238082
|
+
if (!newText)
|
|
238083
|
+
return null;
|
|
238084
|
+
const envelope = parseParagraphEnvelope(input.anchorXml);
|
|
238085
|
+
if (!envelope)
|
|
238086
|
+
return null;
|
|
238087
|
+
const newTextRunsXml = renderPasteRuns(runs).replace(/<w:r(?=[\s>])/g, '<w:r xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"');
|
|
238088
|
+
const overlap = compileOverlapEdit({
|
|
238089
|
+
storyId: input.storyId,
|
|
238090
|
+
paragraphXml: input.anchorXml,
|
|
238091
|
+
namespaceBindings: namespaceBindingsAtPosition(input.partBytes, input.paragraphStartByte, envelope.open),
|
|
238092
|
+
rangeStart: input.charOffset,
|
|
238093
|
+
rangeEnd: input.charOffset,
|
|
238094
|
+
newText,
|
|
238095
|
+
newTextRunsXml,
|
|
238096
|
+
changeMode: "tracked",
|
|
238097
|
+
currentAuthor: stamp.author,
|
|
238098
|
+
txTimestamp: stamp.date,
|
|
238099
|
+
rsid: stamp.rsid,
|
|
238100
|
+
insRsid: stamp.rsid,
|
|
238101
|
+
nextWId: () => stamp.allocateWId(),
|
|
238102
|
+
reserveWId: () => stamp.allocateWId()
|
|
238103
|
+
});
|
|
238104
|
+
if (!overlap.ok)
|
|
238105
|
+
return { ok: false, reason: overlap.reason };
|
|
238106
|
+
return {
|
|
238107
|
+
ok: true,
|
|
238108
|
+
xml: overlap.xml,
|
|
238109
|
+
createdParaIds: [],
|
|
238110
|
+
destinationParaIdsByBlock: [[input.anchorParaId ?? ""]],
|
|
238111
|
+
insertedVisibleChars: newText.length,
|
|
238112
|
+
removedVisibleChars: 0,
|
|
238113
|
+
anchorParagraphUnchanged: false,
|
|
238114
|
+
trackedChangeRsids: { created: overlap.emittedRsids, updated: overlap.updatedRsids ?? [] }
|
|
238115
|
+
};
|
|
238116
|
+
}
|
|
238017
238117
|
function planParagraphSplice(input) {
|
|
238018
238118
|
const start = input.charOffset;
|
|
238019
238119
|
const end = input.replaceToOffset ?? input.charOffset;
|
|
@@ -238341,6 +238441,7 @@ function withTrackedRsid(openTag, rsid) {
|
|
|
238341
238441
|
var init_compile_paste_splice = __esm(() => {
|
|
238342
238442
|
init_paragraph_inline_model();
|
|
238343
238443
|
init_xml_text();
|
|
238444
|
+
init_overlap_edit_compiler();
|
|
238344
238445
|
init_paragraph_contribution();
|
|
238345
238446
|
init_paragraph_para_id_attrs();
|
|
238346
238447
|
});
|
|
@@ -242680,7 +242781,7 @@ function runPasteSpliceCommit(input, target, resolvedBlocks, listExtras, imageEx
|
|
|
242680
242781
|
return deleted;
|
|
242681
242782
|
rewrittenXml = deleted.xml;
|
|
242682
242783
|
}
|
|
242683
|
-
|
|
242784
|
+
const spliceInput = {
|
|
242684
242785
|
anchorXml: rewrittenXml,
|
|
242685
242786
|
anchorParaId: anchor.entry.blockId,
|
|
242686
242787
|
blocks: resolvedBlocks,
|
|
@@ -242695,7 +242796,12 @@ function runPasteSpliceCommit(input, target, resolvedBlocks, listExtras, imageEx
|
|
|
242695
242796
|
...stamp ? { trackedStamp: stamp, wrapAllTracked } : {},
|
|
242696
242797
|
...listExtras.commentIdMap ? { commentIdMap: listExtras.commentIdMap } : {},
|
|
242697
242798
|
...listExtras.noteIdMap ? { noteIdMap: listExtras.noteIdMap } : {}
|
|
242698
|
-
}
|
|
242799
|
+
};
|
|
242800
|
+
const ordinary = planParagraphSplice(spliceInput);
|
|
242801
|
+
if (!ordinary.ok && ordinary.reason === "paste-target-unsupported" && wrapAllTracked && (target.replaceToOffset ?? target.charOffset) === target.charOffset) {
|
|
242802
|
+
return planTrackedInsertionSplice({ ...spliceInput, storyId: target.storyId }) ?? ordinary;
|
|
242803
|
+
}
|
|
242804
|
+
return ordinary;
|
|
242699
242805
|
};
|
|
242700
242806
|
const plan = planForParagraph(anchorXml, trackedStamp, () => mintParaId(state, state.packageRevision, anchor.ordinal + 1 + (mintSalt += 1)));
|
|
242701
242807
|
if (!plan.ok)
|
|
@@ -242767,8 +242873,9 @@ function runPasteSpliceCommit(input, target, resolvedBlocks, listExtras, imageEx
|
|
|
242767
242873
|
nodeId: paraId,
|
|
242768
242874
|
storyId: target.storyId
|
|
242769
242875
|
}));
|
|
242770
|
-
|
|
242771
|
-
|
|
242876
|
+
const createdTrackedRsids = plan.trackedChangeRsids?.created ?? (trackedStamp ? [trackedStamp.rsid] : []);
|
|
242877
|
+
for (const entityId of createdTrackedRsids) {
|
|
242878
|
+
createdRefs.push({ kind: "trackedChange", entityId, storyId: target.storyId });
|
|
242772
242879
|
}
|
|
242773
242880
|
if (listExtras.createdRefs)
|
|
242774
242881
|
createdRefs.push(...listExtras.createdRefs);
|
|
@@ -242780,7 +242887,14 @@ function runPasteSpliceCommit(input, target, resolvedBlocks, listExtras, imageEx
|
|
|
242780
242887
|
textRangeShifts,
|
|
242781
242888
|
createdParaIds: [...plan.createdParaIds],
|
|
242782
242889
|
createdRefs,
|
|
242783
|
-
updatedRefs: [
|
|
242890
|
+
updatedRefs: [
|
|
242891
|
+
{ kind: "block", nodeId: target.paraId, storyId: target.storyId },
|
|
242892
|
+
...(plan.trackedChangeRsids?.updated ?? []).map((entityId) => ({
|
|
242893
|
+
kind: "trackedChange",
|
|
242894
|
+
entityId,
|
|
242895
|
+
storyId: target.storyId
|
|
242896
|
+
}))
|
|
242897
|
+
],
|
|
242784
242898
|
relativeToBlockId: target.paraId,
|
|
242785
242899
|
provisionalToFinal: buildPasteProvisionalMappings(txId, plan.createdParaIds, resolvedBlocks, plan.destinationParaIdsByBlock),
|
|
242786
242900
|
extraPatchMaps: listExtras.patchMaps,
|
|
@@ -330619,6 +330733,731 @@ var init_review_read_model = __esm(() => {
|
|
|
330619
330733
|
init_comparison_hunk_groups();
|
|
330620
330734
|
});
|
|
330621
330735
|
|
|
330736
|
+
// ../../../v2/document-api-v2-adapter/dist/core/text-coordinate-space.js
|
|
330737
|
+
function projectVisibleOffsetToTracked(map3, offset, bias) {
|
|
330738
|
+
if (!Number.isInteger(offset) || offset < 0 || offset > map3.visibleLength)
|
|
330739
|
+
return null;
|
|
330740
|
+
const candidates = new Set;
|
|
330741
|
+
if (offset === 0)
|
|
330742
|
+
candidates.add(0);
|
|
330743
|
+
if (offset === map3.visibleLength)
|
|
330744
|
+
candidates.add(map3.trackedLength);
|
|
330745
|
+
for (const piece of map3.leaves()) {
|
|
330746
|
+
const visibleWidth2 = piece.visibleEnd - piece.visibleStart;
|
|
330747
|
+
const trackedWidth2 = piece.trackedEnd - piece.trackedStart;
|
|
330748
|
+
if (visibleWidth2 > 0 && trackedWidth2 === visibleWidth2) {
|
|
330749
|
+
if (offset >= piece.visibleStart && offset <= piece.visibleEnd) {
|
|
330750
|
+
candidates.add(piece.trackedStart + offset - piece.visibleStart);
|
|
330751
|
+
}
|
|
330752
|
+
continue;
|
|
330753
|
+
}
|
|
330754
|
+
if (offset === piece.visibleStart)
|
|
330755
|
+
candidates.add(piece.trackedStart);
|
|
330756
|
+
if (offset === piece.visibleEnd)
|
|
330757
|
+
candidates.add(piece.trackedEnd);
|
|
330758
|
+
}
|
|
330759
|
+
if (candidates.size === 0)
|
|
330760
|
+
return null;
|
|
330761
|
+
const values2 = [...candidates];
|
|
330762
|
+
return bias === "upstream" ? Math.min(...values2) : Math.max(...values2);
|
|
330763
|
+
}
|
|
330764
|
+
function projectTrackedOffsetToVisible(map3, offset) {
|
|
330765
|
+
if (!Number.isInteger(offset) || offset < 0 || offset > map3.trackedLength)
|
|
330766
|
+
return null;
|
|
330767
|
+
if (offset === map3.trackedLength)
|
|
330768
|
+
return map3.visibleLength;
|
|
330769
|
+
for (const piece of map3.leaves()) {
|
|
330770
|
+
if (offset < piece.trackedStart || offset > piece.trackedEnd)
|
|
330771
|
+
continue;
|
|
330772
|
+
if (offset === piece.trackedStart)
|
|
330773
|
+
return piece.visibleStart;
|
|
330774
|
+
if (offset === piece.trackedEnd)
|
|
330775
|
+
return piece.visibleEnd;
|
|
330776
|
+
const trackedWidth2 = piece.trackedEnd - piece.trackedStart;
|
|
330777
|
+
const visibleWidth2 = piece.visibleEnd - piece.visibleStart;
|
|
330778
|
+
if (trackedWidth2 === 0 || visibleWidth2 === 0)
|
|
330779
|
+
return piece.visibleStart;
|
|
330780
|
+
if (trackedWidth2 !== visibleWidth2)
|
|
330781
|
+
return null;
|
|
330782
|
+
return piece.visibleStart + offset - piece.trackedStart;
|
|
330783
|
+
}
|
|
330784
|
+
return null;
|
|
330785
|
+
}
|
|
330786
|
+
function projectVisibleRangeToTracked(map3, start, end) {
|
|
330787
|
+
if (!Number.isInteger(start) || !Number.isInteger(end) || start < 0 || end < start)
|
|
330788
|
+
return null;
|
|
330789
|
+
if (start === end) {
|
|
330790
|
+
const offset = projectVisibleOffsetToTracked(map3, start, "upstream");
|
|
330791
|
+
return offset == null ? null : { start: offset, end: offset };
|
|
330792
|
+
}
|
|
330793
|
+
const trackedStart = projectVisibleOffsetToTracked(map3, start, "downstream");
|
|
330794
|
+
const trackedEnd = projectVisibleOffsetToTracked(map3, end, "upstream");
|
|
330795
|
+
if (trackedStart == null || trackedEnd == null || trackedEnd < trackedStart)
|
|
330796
|
+
return null;
|
|
330797
|
+
return { start: trackedStart, end: trackedEnd };
|
|
330798
|
+
}
|
|
330799
|
+
|
|
330800
|
+
// ../../../v2/document-api-v2-adapter/dist/selection/footnote-range.js
|
|
330801
|
+
function resolveFootnoteRangeIndex(session, index2, start, end) {
|
|
330802
|
+
if (start.story.storyType !== "footnote" || end.story.storyType !== "footnote")
|
|
330803
|
+
return null;
|
|
330804
|
+
const main = getSDDocumentSessionInternalSourceSignalsSnapshot(session)?.stories.find((story) => story.storyKind === "main");
|
|
330805
|
+
const bytes = getSDDocumentSessionInternalPartBytes(session, FOOTNOTES_PART_URI3);
|
|
330806
|
+
if (!main || main.completeness.noteAnchorRefs !== "complete" || !bytes)
|
|
330807
|
+
return null;
|
|
330808
|
+
const xml = new TextDecoder().decode(bytes);
|
|
330809
|
+
const parsed = collectXmlElementRanges(xml);
|
|
330810
|
+
if (parsed.errors.length)
|
|
330811
|
+
return null;
|
|
330812
|
+
const notes = parsed.ranges.filter(({ tag }) => tag.namespaceUri === W_NS6 && tag.localName === "footnote").sort((a, b) => a.start - b.start);
|
|
330813
|
+
const sourceEntries = [...index2.entries].sort((a, b) => a.byteStart - b.byteStart);
|
|
330814
|
+
const groups = new Map;
|
|
330815
|
+
let charCursor = 0;
|
|
330816
|
+
let byteCursor = bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191 ? 3 : 0;
|
|
330817
|
+
let entryCursor = 0;
|
|
330818
|
+
for (const note of notes) {
|
|
330819
|
+
const id = readXmlAttributes(note.tag, W_NS6, "id")[0]?.value;
|
|
330820
|
+
if (!id || groups.has(id))
|
|
330821
|
+
return null;
|
|
330822
|
+
byteCursor += TE49.encode(xml.slice(charCursor, note.start)).byteLength;
|
|
330823
|
+
const byteStart = byteCursor;
|
|
330824
|
+
byteCursor += TE49.encode(xml.slice(note.start, note.end)).byteLength;
|
|
330825
|
+
charCursor = note.end;
|
|
330826
|
+
const group = [];
|
|
330827
|
+
while (entryCursor < sourceEntries.length && sourceEntries[entryCursor].byteStart < byteCursor) {
|
|
330828
|
+
const entry = sourceEntries[entryCursor++];
|
|
330829
|
+
if (entry.byteStart >= byteStart && entry.byteEnd <= byteCursor)
|
|
330830
|
+
group.push(entry);
|
|
330831
|
+
}
|
|
330832
|
+
groups.set(id, group);
|
|
330833
|
+
}
|
|
330834
|
+
const entries = [];
|
|
330835
|
+
const seen = new Set;
|
|
330836
|
+
let startOwned = false;
|
|
330837
|
+
let endOwned = false;
|
|
330838
|
+
const references = [...main.noteAnchorRefs].sort((a, b) => (a.bodyChildOrdinal ?? 0) - (b.bodyChildOrdinal ?? 0) || (a.sourceAnchor.stability === "byte-span" ? a.sourceAnchor.byteSpan[0] : 0) - (b.sourceAnchor.stability === "byte-span" ? b.sourceAnchor.byteSpan[0] : 0));
|
|
330839
|
+
for (const ref5 of references) {
|
|
330840
|
+
if (ref5.kind !== "footnote" || !ref5.nativeId || ref5.trackedChangeState === "deleted" || ref5.trackedChangeState === "move-from" || seen.has(ref5.nativeId))
|
|
330841
|
+
continue;
|
|
330842
|
+
seen.add(ref5.nativeId);
|
|
330843
|
+
const group = groups.get(ref5.nativeId);
|
|
330844
|
+
if (!group)
|
|
330845
|
+
return null;
|
|
330846
|
+
for (const entry of group) {
|
|
330847
|
+
startOwned || (startOwned = ref5.nativeId === start.story.noteId && entry.blockId === start.blockId);
|
|
330848
|
+
endOwned || (endOwned = ref5.nativeId === end.story.noteId && entry.blockId === end.blockId);
|
|
330849
|
+
entries.push({ ...entry, ordinal: entries.length });
|
|
330850
|
+
}
|
|
330851
|
+
}
|
|
330852
|
+
if (!startOwned || !endOwned)
|
|
330853
|
+
return null;
|
|
330854
|
+
const byBlockId = new Map(entries.map((entry) => [entry.blockId, entry]));
|
|
330855
|
+
return {
|
|
330856
|
+
entries,
|
|
330857
|
+
duplicateParaIds: index2.duplicateParaIds,
|
|
330858
|
+
entriesByBlockId: byBlockId,
|
|
330859
|
+
byParaId: (blockId) => byBlockId.get(blockId) ?? null
|
|
330860
|
+
};
|
|
330861
|
+
}
|
|
330862
|
+
var W_NS6 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TE49;
|
|
330863
|
+
var init_footnote_range = __esm(() => {
|
|
330864
|
+
init_sd_document_session_internal();
|
|
330865
|
+
init_note_story();
|
|
330866
|
+
TE49 = new TextEncoder;
|
|
330867
|
+
});
|
|
330868
|
+
|
|
330869
|
+
// ../../../v2/document-api-v2-adapter/dist/selection/live-selection.js
|
|
330870
|
+
function distinctFootnotes(start, end) {
|
|
330871
|
+
return start.storyType === "footnote" && end.storyType === "footnote" && start.noteId !== end.noteId;
|
|
330872
|
+
}
|
|
330873
|
+
function buildVisibleSelectionTarget(story, start, end) {
|
|
330874
|
+
return {
|
|
330875
|
+
kind: "selection",
|
|
330876
|
+
start: { kind: "text", blockId: start.blockId, offset: start.offset, story: start.story ?? story },
|
|
330877
|
+
end: { kind: "text", blockId: end.blockId, offset: end.offset, story: end.story ?? story },
|
|
330878
|
+
...distinctFootnotes(start.story ?? story, end.story ?? story) ? {} : { story }
|
|
330879
|
+
};
|
|
330880
|
+
}
|
|
330881
|
+
function buildSelectionTarget(session, story, start, end, entries) {
|
|
330882
|
+
const hasTrackedEndpoint = start.trackedOffset != null || end.trackedOffset != null;
|
|
330883
|
+
if (!hasTrackedEndpoint)
|
|
330884
|
+
return buildVisibleSelectionTarget(story, start, end);
|
|
330885
|
+
const startEntry = entries[0];
|
|
330886
|
+
const endEntry = entries[entries.length - 1];
|
|
330887
|
+
if (!startEntry || !endEntry)
|
|
330888
|
+
return null;
|
|
330889
|
+
const startMap = readParagraphInlineMap(session, startEntry);
|
|
330890
|
+
const endMap = startEntry === endEntry ? startMap : readParagraphInlineMap(session, endEntry);
|
|
330891
|
+
if (!startMap || !endMap)
|
|
330892
|
+
return null;
|
|
330893
|
+
const resolvedStart = resolveTrackedSelectionEndpoint(startMap, start, "upstream");
|
|
330894
|
+
const resolvedEnd = resolveTrackedSelectionEndpoint(endMap, end, "downstream");
|
|
330895
|
+
if (resolvedStart == null || resolvedEnd == null) {
|
|
330896
|
+
return null;
|
|
330897
|
+
}
|
|
330898
|
+
const [orderedStart2, orderedEnd] = start.blockId === end.blockId && resolvedEnd < resolvedStart ? [resolvedEnd, resolvedStart] : [resolvedStart, resolvedEnd];
|
|
330899
|
+
return {
|
|
330900
|
+
kind: "selection",
|
|
330901
|
+
start: { kind: "text", blockId: start.blockId, offset: orderedStart2, story: start.story ?? story },
|
|
330902
|
+
end: { kind: "text", blockId: end.blockId, offset: orderedEnd, story: end.story ?? story },
|
|
330903
|
+
...distinctFootnotes(start.story ?? story, end.story ?? story) ? {} : { story },
|
|
330904
|
+
coordinateSpace: "tracked"
|
|
330905
|
+
};
|
|
330906
|
+
}
|
|
330907
|
+
function readParagraphInlineMap(session, entry) {
|
|
330908
|
+
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
330909
|
+
if (!bytes)
|
|
330910
|
+
return null;
|
|
330911
|
+
return parseParagraphInlineMap(TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd)));
|
|
330912
|
+
}
|
|
330913
|
+
function resolveTrackedSelectionEndpoint(map3, point3, bias) {
|
|
330914
|
+
if (point3.trackedOffset != null) {
|
|
330915
|
+
return Number.isInteger(point3.trackedOffset) && point3.trackedOffset >= 0 && point3.trackedOffset <= map3.trackedLength ? point3.trackedOffset : null;
|
|
330916
|
+
}
|
|
330917
|
+
return projectVisibleOffsetToTracked(map3, clampOffset(point3.offset, map3.visibleLength), bias);
|
|
330918
|
+
}
|
|
330919
|
+
function resolveBrowserLiveSelectionParagraphIndex(session, story, startBlockId, endBlockId) {
|
|
330920
|
+
const mainIndex = getSDDocumentSessionInternalParagraphIndex(session);
|
|
330921
|
+
const stories = listSDDocumentSessionInternalStories(session);
|
|
330922
|
+
if (!story || story.storyType === "body") {
|
|
330923
|
+
return hasSelectionBlocks(mainIndex, startBlockId, endBlockId) ? mainIndex : null;
|
|
330924
|
+
}
|
|
330925
|
+
if (story.storyType === "headerFooterPart") {
|
|
330926
|
+
const resolved = getSDDocumentSessionInternalHeaderFooterPartUriForRefId(session, story.refId);
|
|
330927
|
+
if (!resolved)
|
|
330928
|
+
return null;
|
|
330929
|
+
const match = stories.find((candidate2) => candidate2.partUri === resolved.partUri);
|
|
330930
|
+
if (!match)
|
|
330931
|
+
return null;
|
|
330932
|
+
return paragraphIndexForStory2(session, match.storyId, mainIndex);
|
|
330933
|
+
}
|
|
330934
|
+
const candidates = stories.filter((candidate2) => storyCandidateMatches(candidate2, story));
|
|
330935
|
+
for (const candidate2 of candidates) {
|
|
330936
|
+
const index2 = paragraphIndexForStory2(session, candidate2.storyId, mainIndex);
|
|
330937
|
+
if (hasSelectionBlocks(index2, startBlockId, endBlockId))
|
|
330938
|
+
return index2;
|
|
330939
|
+
}
|
|
330940
|
+
return null;
|
|
330941
|
+
}
|
|
330942
|
+
function paragraphIndexForStory2(session, storyId, mainIndex) {
|
|
330943
|
+
if (mainIndex?.entries[0]?.storyId === storyId)
|
|
330944
|
+
return mainIndex;
|
|
330945
|
+
return getSDDocumentSessionInternalStoryParagraphIndex(session, storyId);
|
|
330946
|
+
}
|
|
330947
|
+
function storyCandidateMatches(candidate2, story) {
|
|
330948
|
+
switch (story.storyType) {
|
|
330949
|
+
case "headerFooterSlot":
|
|
330950
|
+
return candidate2.storyKind === story.headerFooterKind;
|
|
330951
|
+
case "footnote":
|
|
330952
|
+
return candidate2.storyKind === "footnotes";
|
|
330953
|
+
case "endnote":
|
|
330954
|
+
return candidate2.storyKind === "endnotes";
|
|
330955
|
+
case "textbox":
|
|
330956
|
+
return candidate2.storyKind === "textbox" && candidate2.textboxId === story.textboxId;
|
|
330957
|
+
default:
|
|
330958
|
+
return false;
|
|
330959
|
+
}
|
|
330960
|
+
}
|
|
330961
|
+
function hasSelectionBlocks(index2, startBlockId, endBlockId) {
|
|
330962
|
+
return Boolean(index2?.byParaId(startBlockId) && index2.byParaId(endBlockId));
|
|
330963
|
+
}
|
|
330964
|
+
function clampOffset(offset, textLength) {
|
|
330965
|
+
return Math.max(0, Math.min(textLength, offset));
|
|
330966
|
+
}
|
|
330967
|
+
function resolveTableCellSelectionEntries(session, story, anchorBlockId, focusBlockId) {
|
|
330968
|
+
const index2 = resolveBrowserLiveSelectionParagraphIndex(session, story, anchorBlockId, focusBlockId);
|
|
330969
|
+
const anchorEntry = index2?.byParaId(anchorBlockId);
|
|
330970
|
+
if (!index2 || !anchorEntry || index2.duplicateParaIds.has(anchorBlockId) || index2.duplicateParaIds.has(focusBlockId))
|
|
330971
|
+
return null;
|
|
330972
|
+
const catalog = readTableCatalogForSession(session, anchorEntry.storyId);
|
|
330973
|
+
const anchor = catalog?.byParagraphId.get(anchorBlockId);
|
|
330974
|
+
const focus = catalog?.byParagraphId.get(focusBlockId);
|
|
330975
|
+
if (!anchor || !focus || anchor.table !== focus.table || anchor.cell === focus.cell)
|
|
330976
|
+
return null;
|
|
330977
|
+
for (const endpoint of [anchor, focus]) {
|
|
330978
|
+
if (endpoint.paragraph.isDirectCellChild)
|
|
330979
|
+
continue;
|
|
330980
|
+
const bytes = getSDDocumentSessionInternalPartBytes(session, anchorEntry.partUri);
|
|
330981
|
+
if (!bytes)
|
|
330982
|
+
return null;
|
|
330983
|
+
const context = buildStructuralBoundaryMap(bytes.subarray(endpoint.cell.bodyByteStart, endpoint.cell.bodyByteEnd)).byBlockId(endpoint.paragraph.paragraphId);
|
|
330984
|
+
if (!context?.blockSdtPath.length || context.tableCellPath.length || context.hasNonEditableBlockSdtContent)
|
|
330985
|
+
return null;
|
|
330986
|
+
}
|
|
330987
|
+
const minRow = Math.min(anchor.row.rowIndex, focus.row.rowIndex);
|
|
330988
|
+
const maxRow = Math.max(anchor.row.rowIndex, focus.row.rowIndex);
|
|
330989
|
+
const minCol = Math.min(anchor.cell.cellOrdinal, focus.cell.cellOrdinal);
|
|
330990
|
+
const maxCol = Math.max(anchor.cell.cellOrdinal, focus.cell.cellOrdinal);
|
|
330991
|
+
const selectedCells = anchor.table.rows.filter((row) => row.rowIndex >= minRow && row.rowIndex <= maxRow).flatMap((row) => row.cells.filter((cell) => cell.cellOrdinal >= minCol && cell.cellOrdinal <= maxCol));
|
|
330992
|
+
const entries = [];
|
|
330993
|
+
for (const cell of selectedCells) {
|
|
330994
|
+
for (const paragraph3 of cell.paragraphs) {
|
|
330995
|
+
if (!paragraph3.paragraphId || index2.duplicateParaIds.has(paragraph3.paragraphId))
|
|
330996
|
+
return null;
|
|
330997
|
+
const entry = index2.byParaId(paragraph3.paragraphId);
|
|
330998
|
+
if (!entry || entry.byteStart < cell.bodyByteStart || entry.byteEnd > cell.bodyByteEnd)
|
|
330999
|
+
return null;
|
|
331000
|
+
if (!entries.includes(entry))
|
|
331001
|
+
entries.push(entry);
|
|
331002
|
+
}
|
|
331003
|
+
}
|
|
331004
|
+
return entries.length ? entries.sort((a, b) => a.ordinal - b.ordinal) : null;
|
|
331005
|
+
}
|
|
331006
|
+
function resolveEntries(session, input) {
|
|
331007
|
+
let index2 = resolveBrowserLiveSelectionParagraphIndex(session, input.story, input.start.blockId, input.end.blockId);
|
|
331008
|
+
if (!index2)
|
|
331009
|
+
return null;
|
|
331010
|
+
if (input.tableCells) {
|
|
331011
|
+
const entries2 = resolveTableCellSelectionEntries(session, input.story, input.start.blockId, input.end.blockId);
|
|
331012
|
+
if (!entries2?.length)
|
|
331013
|
+
return null;
|
|
331014
|
+
const first = entries2[0];
|
|
331015
|
+
const last = entries2[entries2.length - 1];
|
|
331016
|
+
return {
|
|
331017
|
+
entries: entries2,
|
|
331018
|
+
start: { blockId: first.blockId, offset: 0 },
|
|
331019
|
+
end: { blockId: last.blockId, offset: last.textLength },
|
|
331020
|
+
target: {
|
|
331021
|
+
kind: "text",
|
|
331022
|
+
segments: entries2.map((entry) => ({
|
|
331023
|
+
blockId: entry.blockId,
|
|
331024
|
+
range: { start: 0, end: entry.textLength }
|
|
331025
|
+
})),
|
|
331026
|
+
story: input.story
|
|
331027
|
+
}
|
|
331028
|
+
};
|
|
331029
|
+
}
|
|
331030
|
+
const startStory = input.start.story ?? input.story;
|
|
331031
|
+
const endStory = input.end.story ?? input.story;
|
|
331032
|
+
if (distinctFootnotes(startStory, endStory)) {
|
|
331033
|
+
index2 = resolveFootnoteRangeIndex(session, index2, { blockId: input.start.blockId, story: startStory }, { blockId: input.end.blockId, story: endStory });
|
|
331034
|
+
if (!index2)
|
|
331035
|
+
return null;
|
|
331036
|
+
}
|
|
331037
|
+
if (index2.duplicateParaIds.has(input.start.blockId) || index2.duplicateParaIds.has(input.end.blockId))
|
|
331038
|
+
return null;
|
|
331039
|
+
let startEntry = index2.byParaId(input.start.blockId);
|
|
331040
|
+
let endEntry = index2.byParaId(input.end.blockId);
|
|
331041
|
+
if (!startEntry || !endEntry || startEntry.storyId !== endEntry.storyId)
|
|
331042
|
+
return null;
|
|
331043
|
+
let startPoint = input.start;
|
|
331044
|
+
let endPoint = input.end;
|
|
331045
|
+
if (startEntry.ordinal > endEntry.ordinal) {
|
|
331046
|
+
[startEntry, endEntry] = [endEntry, startEntry];
|
|
331047
|
+
[startPoint, endPoint] = [endPoint, startPoint];
|
|
331048
|
+
}
|
|
331049
|
+
const entries = index2.entries.slice(startEntry.ordinal, endEntry.ordinal + 1);
|
|
331050
|
+
if (entries.length === 0)
|
|
331051
|
+
return null;
|
|
331052
|
+
const visibleStart = resolveVisibleSelectionOffset(session, startEntry, startPoint);
|
|
331053
|
+
const visibleEnd = resolveVisibleSelectionOffset(session, endEntry, endPoint);
|
|
331054
|
+
if (visibleStart == null || visibleEnd == null)
|
|
331055
|
+
return null;
|
|
331056
|
+
const segments = entries.map((entry, idx) => {
|
|
331057
|
+
const start = idx === 0 ? visibleStart : 0;
|
|
331058
|
+
const end = idx === entries.length - 1 ? visibleEnd : entry.textLength;
|
|
331059
|
+
return {
|
|
331060
|
+
blockId: entry.blockId,
|
|
331061
|
+
range: { start, end: Math.max(start, end) }
|
|
331062
|
+
};
|
|
331063
|
+
});
|
|
331064
|
+
return {
|
|
331065
|
+
target: {
|
|
331066
|
+
kind: "text",
|
|
331067
|
+
segments,
|
|
331068
|
+
...input.story ? { story: input.story } : {}
|
|
331069
|
+
},
|
|
331070
|
+
entries,
|
|
331071
|
+
start: startPoint,
|
|
331072
|
+
end: endPoint
|
|
331073
|
+
};
|
|
331074
|
+
}
|
|
331075
|
+
function resolveVisibleSelectionOffset(session, entry, point3) {
|
|
331076
|
+
if (point3.trackedOffset == null)
|
|
331077
|
+
return clampOffset(point3.offset, entry.textLength);
|
|
331078
|
+
const map3 = readParagraphInlineMap(session, entry);
|
|
331079
|
+
return map3 ? projectTrackedOffsetToVisible(map3, point3.trackedOffset) : null;
|
|
331080
|
+
}
|
|
331081
|
+
function resolveBrowserLiveSelectionForSession(session, input, options = {}) {
|
|
331082
|
+
const resolved = resolveEntries(session, input);
|
|
331083
|
+
if (!resolved)
|
|
331084
|
+
return null;
|
|
331085
|
+
const selectionTarget = buildSelectionTarget(session, input.story, resolved.start, resolved.end, resolved.entries);
|
|
331086
|
+
if (!selectionTarget)
|
|
331087
|
+
return null;
|
|
331088
|
+
const contiguous = resolved.entries.every((entry, i2) => i2 === 0 || entry.ordinal === resolved.entries[i2 - 1].ordinal + 1);
|
|
331089
|
+
const reviewIds = readActiveReviewIds(session, resolved.entries, resolved.target.segments, options);
|
|
331090
|
+
return {
|
|
331091
|
+
target: distinctFootnotes(resolved.start.story ?? input.story, resolved.end.story ?? input.story) ? null : resolved.target,
|
|
331092
|
+
selectionTarget: input.tableCells && !contiguous ? null : selectionTarget,
|
|
331093
|
+
text: input.includeText === true ? readSelectionText(session, resolved.entries, resolved.target.segments) : "",
|
|
331094
|
+
activeMarks: readActiveMarks(session, resolved.entries, resolved.target.segments),
|
|
331095
|
+
activeCommentIds: reviewIds.activeCommentIds,
|
|
331096
|
+
activeChangeIds: reviewIds.activeChangeIds
|
|
331097
|
+
};
|
|
331098
|
+
}
|
|
331099
|
+
function readSelectionText(session, entries, segments) {
|
|
331100
|
+
const slices = [];
|
|
331101
|
+
for (let i2 = 0;i2 < entries.length && i2 < segments.length; i2 += 1) {
|
|
331102
|
+
const entry = entries[i2];
|
|
331103
|
+
const segment = segments[i2];
|
|
331104
|
+
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
331105
|
+
if (!bytes)
|
|
331106
|
+
return "";
|
|
331107
|
+
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
331108
|
+
const paragraphText2 = visibleParagraphTextFromXml(xml);
|
|
331109
|
+
const start = clampOffset(segment.range.start, paragraphText2.length);
|
|
331110
|
+
const end = clampOffset(segment.range.end, paragraphText2.length);
|
|
331111
|
+
slices.push(paragraphText2.slice(start, Math.max(start, end)));
|
|
331112
|
+
}
|
|
331113
|
+
return slices.join(" ");
|
|
331114
|
+
}
|
|
331115
|
+
function readActiveMarks(session, entries, segments) {
|
|
331116
|
+
let common = null;
|
|
331117
|
+
for (let i2 = 0;i2 < entries.length && i2 < segments.length; i2 += 1) {
|
|
331118
|
+
const entry = entries[i2];
|
|
331119
|
+
const segment = segments[i2];
|
|
331120
|
+
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
331121
|
+
if (!bytes)
|
|
331122
|
+
return [];
|
|
331123
|
+
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
331124
|
+
const paragraphText2 = visibleParagraphTextFromXml(xml);
|
|
331125
|
+
const start = clampOffset(segment.range.start, paragraphText2.length);
|
|
331126
|
+
const end = clampOffset(segment.range.end, paragraphText2.length);
|
|
331127
|
+
const marks = new Set(activeMarksForParagraphXmlRange(xml, start, Math.max(start, end)));
|
|
331128
|
+
common = common == null ? marks : intersectStringSets(common, marks);
|
|
331129
|
+
}
|
|
331130
|
+
if (!common)
|
|
331131
|
+
return [];
|
|
331132
|
+
return ACTIVE_MARK_ORDER.filter((mark) => common.has(mark));
|
|
331133
|
+
}
|
|
331134
|
+
function readActiveReviewIds(session, entries, segments, options) {
|
|
331135
|
+
return {
|
|
331136
|
+
activeCommentIds: readActiveCommentIds(session, segments),
|
|
331137
|
+
activeChangeIds: readActiveChangeIds(session, entries, segments, options)
|
|
331138
|
+
};
|
|
331139
|
+
}
|
|
331140
|
+
function readActiveCommentIds(session, segments) {
|
|
331141
|
+
const catalog = getSDDocumentSessionInternalCommentsCatalog(session);
|
|
331142
|
+
if (!catalog)
|
|
331143
|
+
return [];
|
|
331144
|
+
const anchorIndex = getSDDocumentSessionInternalCommentAnchorIndex(session);
|
|
331145
|
+
const ids = [];
|
|
331146
|
+
for (const [sourceWId, hits] of anchorIndex.hitsBySourceWId) {
|
|
331147
|
+
const catalogEntries = catalog.commentsBySourceWId.get(sourceWId);
|
|
331148
|
+
if (!catalogEntries || catalogEntries.length === 0)
|
|
331149
|
+
continue;
|
|
331150
|
+
let overlaps2 = false;
|
|
331151
|
+
for (const hit of hits) {
|
|
331152
|
+
for (const hitSegment of hit.segments) {
|
|
331153
|
+
if (!hitSegment.blockId)
|
|
331154
|
+
continue;
|
|
331155
|
+
const selectionSegment = segments.find((segment) => segment.blockId === hitSegment.blockId);
|
|
331156
|
+
if (!selectionSegment)
|
|
331157
|
+
continue;
|
|
331158
|
+
if (rangesOverlap9(hitSegment.start, hitSegment.end, selectionSegment.range.start, selectionSegment.range.end)) {
|
|
331159
|
+
overlaps2 = true;
|
|
331160
|
+
break;
|
|
331161
|
+
}
|
|
331162
|
+
}
|
|
331163
|
+
if (overlaps2)
|
|
331164
|
+
break;
|
|
331165
|
+
}
|
|
331166
|
+
if (!overlaps2)
|
|
331167
|
+
continue;
|
|
331168
|
+
for (const entry of catalogEntries)
|
|
331169
|
+
pushUnique(ids, entry.commentId);
|
|
331170
|
+
}
|
|
331171
|
+
return ids;
|
|
331172
|
+
}
|
|
331173
|
+
function readActiveChangeIds(session, entries, segments, options) {
|
|
331174
|
+
const activeSourceIds = new Set;
|
|
331175
|
+
for (let i2 = 0;i2 < entries.length && i2 < segments.length; i2 += 1) {
|
|
331176
|
+
const entry = entries[i2];
|
|
331177
|
+
const segment = segments[i2];
|
|
331178
|
+
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
331179
|
+
if (!bytes)
|
|
331180
|
+
return [];
|
|
331181
|
+
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
331182
|
+
const paragraphText2 = visibleParagraphTextFromXml(xml);
|
|
331183
|
+
const start = clampOffset(segment.range.start, paragraphText2.length);
|
|
331184
|
+
const end = clampOffset(segment.range.end, paragraphText2.length);
|
|
331185
|
+
for (const sourceId of activeTrackedChangeSourceIdsForParagraphXmlRange(xml, start, Math.max(start, end))) {
|
|
331186
|
+
activeSourceIds.add(sourceId);
|
|
331187
|
+
}
|
|
331188
|
+
}
|
|
331189
|
+
if (activeSourceIds.size === 0)
|
|
331190
|
+
return [];
|
|
331191
|
+
const resolved = options.resolveTrackChangeIds?.(activeSourceIds);
|
|
331192
|
+
if (resolved)
|
|
331193
|
+
return [...new Set(resolved)];
|
|
331194
|
+
const sourceIdToChangeIds = buildTrackedChangeSourceMap(options.trackChangesList?.()?.items ?? []);
|
|
331195
|
+
if (sourceIdToChangeIds.size === 0)
|
|
331196
|
+
return [];
|
|
331197
|
+
const out = [];
|
|
331198
|
+
for (const sourceId of activeSourceIds) {
|
|
331199
|
+
const changeIds = sourceIdToChangeIds.get(sourceId);
|
|
331200
|
+
if (!changeIds)
|
|
331201
|
+
continue;
|
|
331202
|
+
for (const changeId of changeIds)
|
|
331203
|
+
pushUnique(out, changeId);
|
|
331204
|
+
}
|
|
331205
|
+
return out;
|
|
331206
|
+
}
|
|
331207
|
+
function buildTrackedChangeSourceMap(items) {
|
|
331208
|
+
const map3 = new Map;
|
|
331209
|
+
for (const item of items) {
|
|
331210
|
+
if (!item || typeof item !== "object")
|
|
331211
|
+
continue;
|
|
331212
|
+
const record3 = item;
|
|
331213
|
+
const id = typeof record3.id === "string" ? record3.id : null;
|
|
331214
|
+
if (!id)
|
|
331215
|
+
continue;
|
|
331216
|
+
const sourceIds = record3.sourceIds && typeof record3.sourceIds === "object" ? record3.sourceIds : {};
|
|
331217
|
+
const wordRevisionIds = record3.wordRevisionIds && typeof record3.wordRevisionIds === "object" ? record3.wordRevisionIds : {};
|
|
331218
|
+
pushTrackedSourceMap(map3, sourceIds.wordIdInsert, id);
|
|
331219
|
+
pushTrackedSourceMap(map3, sourceIds.wordIdDelete, id);
|
|
331220
|
+
for (const sourceId of Array.isArray(sourceIds.wordIdOther) ? sourceIds.wordIdOther : []) {
|
|
331221
|
+
pushTrackedSourceMap(map3, sourceId, id);
|
|
331222
|
+
}
|
|
331223
|
+
pushTrackedSourceMap(map3, wordRevisionIds.insert, id);
|
|
331224
|
+
pushTrackedSourceMap(map3, wordRevisionIds.delete, id);
|
|
331225
|
+
pushTrackedSourceMap(map3, wordRevisionIds.format, id);
|
|
331226
|
+
}
|
|
331227
|
+
return map3;
|
|
331228
|
+
}
|
|
331229
|
+
function pushTrackedSourceMap(map3, sourceId, changeId) {
|
|
331230
|
+
if (typeof sourceId !== "string" || sourceId.length === 0)
|
|
331231
|
+
return;
|
|
331232
|
+
const ids = map3.get(sourceId) ?? [];
|
|
331233
|
+
pushUnique(ids, changeId);
|
|
331234
|
+
map3.set(sourceId, ids);
|
|
331235
|
+
}
|
|
331236
|
+
function visibleParagraphTextFromXml(xml) {
|
|
331237
|
+
const stripped = stripTextboxContent2(stripParagraphProperties3(stripDeletedRevisions(xml)));
|
|
331238
|
+
let out = "";
|
|
331239
|
+
for (const token of stripped.matchAll(/<[\w.-]+:t\b[^>]*>([\s\S]*?)<\/[\w.-]+:t>|<[\w.-]+:(tab|br|cr)\b[^>]*\/>/g)) {
|
|
331240
|
+
if (token[1] != null) {
|
|
331241
|
+
out += decodeXmlText10(token[1]);
|
|
331242
|
+
continue;
|
|
331243
|
+
}
|
|
331244
|
+
out += token[2] === "tab" ? "\t" : `
|
|
331245
|
+
`;
|
|
331246
|
+
}
|
|
331247
|
+
return out;
|
|
331248
|
+
}
|
|
331249
|
+
function visibleRunMarkSlicesFromXml(xml) {
|
|
331250
|
+
const stripped = stripTextboxContent2(stripParagraphProperties3(stripDeletedRevisions(xml)));
|
|
331251
|
+
const slices = [];
|
|
331252
|
+
let cursor = 0;
|
|
331253
|
+
for (const match of stripped.matchAll(/<(?:[\w.-]+:)?r\b[^>]*>[\s\S]*?<\/(?:[\w.-]+:)?r>/g)) {
|
|
331254
|
+
const runXml = match[0];
|
|
331255
|
+
const textLength = visibleParagraphTextFromXml(runXml).length;
|
|
331256
|
+
if (textLength > 0) {
|
|
331257
|
+
slices.push({ start: cursor, end: cursor + textLength, marks: activeMarksForRunXml(runXml) });
|
|
331258
|
+
}
|
|
331259
|
+
cursor += textLength;
|
|
331260
|
+
}
|
|
331261
|
+
return slices;
|
|
331262
|
+
}
|
|
331263
|
+
function activeMarksForRunXml(runXml) {
|
|
331264
|
+
const rPr = findFirstElement(runXml, "rPr")?.xml ?? "";
|
|
331265
|
+
if (!rPr)
|
|
331266
|
+
return [];
|
|
331267
|
+
const marks = [];
|
|
331268
|
+
if (hasOnOffRunProperty(rPr, "b"))
|
|
331269
|
+
marks.push("bold");
|
|
331270
|
+
if (hasOnOffRunProperty(rPr, "i"))
|
|
331271
|
+
marks.push("italic");
|
|
331272
|
+
if (hasOnOffRunProperty(rPr, "u"))
|
|
331273
|
+
marks.push("underline");
|
|
331274
|
+
if (hasOnOffRunProperty(rPr, "strike"))
|
|
331275
|
+
marks.push("strikethrough");
|
|
331276
|
+
return marks;
|
|
331277
|
+
}
|
|
331278
|
+
function hasOnOffRunProperty(rPrXml, localName2) {
|
|
331279
|
+
const match = rPrXml.match(new RegExp(`<(?:[\\w.-]+:)?${localName2}\\b([^>]*)\\/?>`, "i"));
|
|
331280
|
+
if (!match)
|
|
331281
|
+
return false;
|
|
331282
|
+
const attrs = match[1] ?? "";
|
|
331283
|
+
const val = attrs.match(/(?:^|\s)(?:[\w.-]+:)?val=(["'])(.*?)\1/i)?.[2]?.toLowerCase();
|
|
331284
|
+
return val !== "0" && val !== "false" && val !== "off" && val !== "none";
|
|
331285
|
+
}
|
|
331286
|
+
function activeMarksForParagraphXmlRange(xml, start, end) {
|
|
331287
|
+
const slices = visibleRunMarkSlicesFromXml(xml);
|
|
331288
|
+
if (slices.length === 0)
|
|
331289
|
+
return [];
|
|
331290
|
+
if (start === end) {
|
|
331291
|
+
const containing = slices.find((slice) => start > slice.start && start < slice.end);
|
|
331292
|
+
if (containing)
|
|
331293
|
+
return containing.marks;
|
|
331294
|
+
let previous3 = null;
|
|
331295
|
+
for (const slice of slices) {
|
|
331296
|
+
if (slice.end <= start)
|
|
331297
|
+
previous3 = slice;
|
|
331298
|
+
}
|
|
331299
|
+
if (previous3)
|
|
331300
|
+
return previous3.marks;
|
|
331301
|
+
return slices[0]?.marks ?? [];
|
|
331302
|
+
}
|
|
331303
|
+
let common = null;
|
|
331304
|
+
for (const slice of slices) {
|
|
331305
|
+
if (Math.max(start, slice.start) >= Math.min(end, slice.end))
|
|
331306
|
+
continue;
|
|
331307
|
+
const marks = new Set(slice.marks);
|
|
331308
|
+
common = common == null ? marks : intersectStringSets(common, marks);
|
|
331309
|
+
}
|
|
331310
|
+
if (!common)
|
|
331311
|
+
return [];
|
|
331312
|
+
return ACTIVE_MARK_ORDER.filter((mark) => common.has(mark));
|
|
331313
|
+
}
|
|
331314
|
+
function activeTrackedChangeSourceIdsForParagraphXmlRange(xml, start, end) {
|
|
331315
|
+
const slices = visibleTrackedChangeSourceSlicesFromXml(xml);
|
|
331316
|
+
if (slices.length === 0)
|
|
331317
|
+
return [];
|
|
331318
|
+
const out = [];
|
|
331319
|
+
for (const slice of slices) {
|
|
331320
|
+
if (!rangesOverlap9(slice.start, slice.end, start, end))
|
|
331321
|
+
continue;
|
|
331322
|
+
for (const sourceId of slice.sourceIds)
|
|
331323
|
+
pushUnique(out, sourceId);
|
|
331324
|
+
}
|
|
331325
|
+
return out;
|
|
331326
|
+
}
|
|
331327
|
+
function visibleTrackedChangeSourceSlicesFromXml(xml) {
|
|
331328
|
+
const stripped = stripTextboxContent2(stripParagraphProperties3(xml));
|
|
331329
|
+
const slices = [];
|
|
331330
|
+
const activeSourceIdStack = [];
|
|
331331
|
+
const elementStack = [];
|
|
331332
|
+
let delDepth = 0;
|
|
331333
|
+
let cursor = 0;
|
|
331334
|
+
const tokenRe = /<\/(?:[\w.-]+:)?(ins|del|moveFrom|moveTo)>|<(?:[\w.-]+:)?t\b[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?t>|<(?:[\w.-]+:)?delText\b[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?delText>|<(?:[\w.-]+:)?(ins|del|moveFrom|moveTo|tab|br|cr)\b([^>]*)\/?>/g;
|
|
331335
|
+
for (const match of stripped.matchAll(tokenRe)) {
|
|
331336
|
+
const closingName = match[1];
|
|
331337
|
+
const tText = match[2];
|
|
331338
|
+
const delText = match[3];
|
|
331339
|
+
const openingName = match[4];
|
|
331340
|
+
const attrs = match[5] ?? "";
|
|
331341
|
+
if (closingName) {
|
|
331342
|
+
const frame = elementStack.pop();
|
|
331343
|
+
if (frame?.hadId)
|
|
331344
|
+
activeSourceIdStack.pop();
|
|
331345
|
+
if (closingName === "del")
|
|
331346
|
+
delDepth = Math.max(0, delDepth - 1);
|
|
331347
|
+
continue;
|
|
331348
|
+
}
|
|
331349
|
+
if (tText != null) {
|
|
331350
|
+
if (delDepth > 0) {
|
|
331351
|
+
pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIdStack);
|
|
331352
|
+
} else {
|
|
331353
|
+
cursor = pushTrackedSourceSlice(slices, cursor, decodeXmlText10(tText).length, activeSourceIdStack);
|
|
331354
|
+
}
|
|
331355
|
+
continue;
|
|
331356
|
+
}
|
|
331357
|
+
if (delText != null) {
|
|
331358
|
+
pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIdStack);
|
|
331359
|
+
continue;
|
|
331360
|
+
}
|
|
331361
|
+
if (!openingName)
|
|
331362
|
+
continue;
|
|
331363
|
+
if (openingName === "tab" || openingName === "br" || openingName === "cr") {
|
|
331364
|
+
if (delDepth > 0) {
|
|
331365
|
+
pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIdStack);
|
|
331366
|
+
} else {
|
|
331367
|
+
cursor = pushTrackedSourceSlice(slices, cursor, 1, activeSourceIdStack);
|
|
331368
|
+
}
|
|
331369
|
+
continue;
|
|
331370
|
+
}
|
|
331371
|
+
const sourceId = readXmlAttribute4(attrs, "id");
|
|
331372
|
+
const selfClosing = match[0].endsWith("/>");
|
|
331373
|
+
if (!selfClosing) {
|
|
331374
|
+
elementStack.push({ name: openingName, hadId: Boolean(sourceId) });
|
|
331375
|
+
if (sourceId)
|
|
331376
|
+
activeSourceIdStack.push(sourceId);
|
|
331377
|
+
if (openingName === "del")
|
|
331378
|
+
delDepth += 1;
|
|
331379
|
+
}
|
|
331380
|
+
}
|
|
331381
|
+
return slices;
|
|
331382
|
+
}
|
|
331383
|
+
function pushTrackedSourceSlice(slices, cursor, textLength, activeSourceIds) {
|
|
331384
|
+
if (textLength <= 0)
|
|
331385
|
+
return cursor;
|
|
331386
|
+
if (activeSourceIds.length > 0) {
|
|
331387
|
+
slices.push({ start: cursor, end: cursor + textLength, sourceIds: [...new Set(activeSourceIds)] });
|
|
331388
|
+
}
|
|
331389
|
+
return cursor + textLength;
|
|
331390
|
+
}
|
|
331391
|
+
function pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIds) {
|
|
331392
|
+
if (activeSourceIds.length === 0)
|
|
331393
|
+
return;
|
|
331394
|
+
slices.push({ start: cursor, end: cursor, sourceIds: [...new Set(activeSourceIds)] });
|
|
331395
|
+
}
|
|
331396
|
+
function readXmlAttribute4(attrs, localName2) {
|
|
331397
|
+
const match = attrs.match(new RegExp(`(?:^|\\s)(?:[\\w.-]+:)?${localName2}=(["'])(.*?)\\1`, "i"));
|
|
331398
|
+
return match?.[2] ?? null;
|
|
331399
|
+
}
|
|
331400
|
+
function rangesOverlap9(aStart, aEnd, bStart, bEnd) {
|
|
331401
|
+
const leftStart = Math.min(aStart, aEnd);
|
|
331402
|
+
const leftEnd = Math.max(aStart, aEnd);
|
|
331403
|
+
const rightStart = Math.min(bStart, bEnd);
|
|
331404
|
+
const rightEnd = Math.max(bStart, bEnd);
|
|
331405
|
+
if (rightStart === rightEnd)
|
|
331406
|
+
return rightStart >= leftStart && rightStart <= leftEnd;
|
|
331407
|
+
if (leftStart === leftEnd)
|
|
331408
|
+
return leftStart >= rightStart && leftStart <= rightEnd;
|
|
331409
|
+
return Math.max(leftStart, rightStart) < Math.min(leftEnd, rightEnd);
|
|
331410
|
+
}
|
|
331411
|
+
function intersectStringSets(left, right) {
|
|
331412
|
+
const out = new Set;
|
|
331413
|
+
for (const value2 of left) {
|
|
331414
|
+
if (right.has(value2))
|
|
331415
|
+
out.add(value2);
|
|
331416
|
+
}
|
|
331417
|
+
return out;
|
|
331418
|
+
}
|
|
331419
|
+
function stripParagraphProperties3(xml) {
|
|
331420
|
+
return stripElements(xml, "pPr");
|
|
331421
|
+
}
|
|
331422
|
+
function stripDeletedRevisions(xml) {
|
|
331423
|
+
return xml.replace(/<[\w.-]+:del\b(?![^>]*\/>)[^>]*>[\s\S]*?<\/[\w.-]+:del>/g, "");
|
|
331424
|
+
}
|
|
331425
|
+
function stripTextboxContent2(xml) {
|
|
331426
|
+
return xml.replace(/<(?:[\w.-]+:)?txbxContent\b[^>]*>[\s\S]*?<\/(?:[\w.-]+:)?txbxContent>/g, "").replace(/<(?:[\w.-]+:)?txbxContent\b[^>]*>[\s\S]*$/g, "");
|
|
331427
|
+
}
|
|
331428
|
+
function decodeXmlText10(escaped) {
|
|
331429
|
+
return escaped.replace(/&(lt|gt|amp|quot|apos|#\d+|#x[0-9a-fA-F]+);/g, (_, entity) => {
|
|
331430
|
+
switch (entity) {
|
|
331431
|
+
case "lt":
|
|
331432
|
+
return "<";
|
|
331433
|
+
case "gt":
|
|
331434
|
+
return ">";
|
|
331435
|
+
case "amp":
|
|
331436
|
+
return "&";
|
|
331437
|
+
case "quot":
|
|
331438
|
+
return '"';
|
|
331439
|
+
case "apos":
|
|
331440
|
+
return "'";
|
|
331441
|
+
default: {
|
|
331442
|
+
const cp = entity.startsWith("#x") ? Number.parseInt(entity.slice(2), 16) : Number.parseInt(entity.slice(1), 10);
|
|
331443
|
+
return Number.isFinite(cp) ? String.fromCodePoint(cp) : `&${entity};`;
|
|
331444
|
+
}
|
|
331445
|
+
}
|
|
331446
|
+
});
|
|
331447
|
+
}
|
|
331448
|
+
function pushUnique(out, id) {
|
|
331449
|
+
if (typeof id === "string" && id.length > 0 && !out.includes(id))
|
|
331450
|
+
out.push(id);
|
|
331451
|
+
}
|
|
331452
|
+
var TEXT_DECODER7, ACTIVE_MARK_ORDER;
|
|
331453
|
+
var init_live_selection = __esm(() => {
|
|
331454
|
+
init_sd_document_session_internal();
|
|
331455
|
+
init_sd_document_session_internal();
|
|
331456
|
+
init_footnote_range();
|
|
331457
|
+
TEXT_DECODER7 = new TextDecoder;
|
|
331458
|
+
ACTIVE_MARK_ORDER = ["bold", "italic", "underline", "strikethrough"];
|
|
331459
|
+
});
|
|
331460
|
+
|
|
330622
331461
|
// ../../../v2/document-api-v2-adapter/dist/tracked-changes/local-text-projection.js
|
|
330623
331462
|
function currentCache(context) {
|
|
330624
331463
|
const revision = getSDDocumentSessionInternalPackageRevision(context.session);
|
|
@@ -331598,7 +332437,7 @@ class V2ClearContentAdapter {
|
|
|
331598
332437
|
}
|
|
331599
332438
|
if (options?.dryRun)
|
|
331600
332439
|
return { success: true };
|
|
331601
|
-
const nextBytes =
|
|
332440
|
+
const nextBytes = TE50.encode(nextXml);
|
|
331602
332441
|
const committed = commitKernelStorySurfacePatch({
|
|
331603
332442
|
context: this.context,
|
|
331604
332443
|
txIdPrefix: selectedBlockIds ? "range-ref-whole-body-replace" : "internal-clearContent",
|
|
@@ -331701,14 +332540,14 @@ function rewriteBodyToSingleEmptyParagraph(xml, paragraphId2) {
|
|
|
331701
332540
|
const emptyParagraph = `<${wordPrefix}:p${identityNamespace} ${identityPrefix}:paraId="${paragraphId2}">` + `<${wordPrefix}:r><${wordPrefix}:t></${wordPrefix}:t></${wordPrefix}:r></${wordPrefix}:p>`;
|
|
331702
332541
|
return `${xml.slice(0, body.openEnd)}${emptyParagraph}${sectPrXml}${xml.slice(body.closeStart)}`;
|
|
331703
332542
|
}
|
|
331704
|
-
var
|
|
332543
|
+
var TE50, WORD_NS4 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", STRICT_WORD_NS = "http://purl.oclc.org/ooxml/wordprocessingml/main", WORD_2010_NS = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
331705
332544
|
var init_clear_content_adapter = __esm(() => {
|
|
331706
332545
|
init_sd_document_session_internal();
|
|
331707
332546
|
init_document_reader();
|
|
331708
332547
|
init_xml();
|
|
331709
332548
|
init_tracked_body_replacement();
|
|
331710
332549
|
init_receipt_entities();
|
|
331711
|
-
|
|
332550
|
+
TE50 = new TextEncoder;
|
|
331712
332551
|
});
|
|
331713
332552
|
|
|
331714
332553
|
// ../../../v2/document-api-v2-adapter/dist/selection-mutation/replacement-span.js
|
|
@@ -333135,7 +333974,35 @@ async function readEffectiveInlineUniformity(context, input) {
|
|
|
333135
333974
|
...input.offsetSpace ? { offsetSpace: input.offsetSpace } : {}
|
|
333136
333975
|
};
|
|
333137
333976
|
let ranges;
|
|
333138
|
-
if (
|
|
333977
|
+
if (input.tableCellSelection) {
|
|
333978
|
+
const entries = resolveTableCellSelectionEntries(context.session, storyLocator ?? { kind: "story", storyType: "body" }, input.tableCellSelection.anchorBlockId, input.tableCellSelection.focusBlockId);
|
|
333979
|
+
if (!entries) {
|
|
333980
|
+
return {
|
|
333981
|
+
success: false,
|
|
333982
|
+
failure: { code: "TARGET_NOT_FOUND", message: "The selected table cells no longer resolve." }
|
|
333983
|
+
};
|
|
333984
|
+
}
|
|
333985
|
+
const cellRanges = [];
|
|
333986
|
+
for (const entry of entries) {
|
|
333987
|
+
if (entry.textLength === 0)
|
|
333988
|
+
continue;
|
|
333989
|
+
const resolved = resolveSelectionTargetToRange({
|
|
333990
|
+
...resolveInput,
|
|
333991
|
+
target: {
|
|
333992
|
+
kind: "selection",
|
|
333993
|
+
start: { kind: "text", blockId: entry.blockId, offset: 0 },
|
|
333994
|
+
end: { kind: "text", blockId: entry.blockId, offset: entry.textLength },
|
|
333995
|
+
...storyLocator ? { story: storyLocator } : {}
|
|
333996
|
+
},
|
|
333997
|
+
offsetSpace: "kernel"
|
|
333998
|
+
});
|
|
333999
|
+
if ("error" in resolved) {
|
|
334000
|
+
return { success: false, failure: { code: resolved.error, message: resolved.message } };
|
|
334001
|
+
}
|
|
334002
|
+
cellRanges.push(resolved);
|
|
334003
|
+
}
|
|
334004
|
+
ranges = cellRanges;
|
|
334005
|
+
} else if (target.start.blockId !== target.end.blockId) {
|
|
333139
334006
|
const plan = resolveCrossBlockFormatSelection(resolveInput, input.in);
|
|
333140
334007
|
if ("error" in plan) {
|
|
333141
334008
|
return { success: false, failure: { code: plan.error, message: plan.message } };
|
|
@@ -333239,6 +334106,7 @@ var init_effective_inline_uniformity = __esm(() => {
|
|
|
333239
334106
|
init_sd_document_session_internal();
|
|
333240
334107
|
init_story_surface();
|
|
333241
334108
|
init_part();
|
|
334109
|
+
init_live_selection();
|
|
333242
334110
|
TD92 = new TextDecoder;
|
|
333243
334111
|
MODEL_CACHE = new WeakMap;
|
|
333244
334112
|
TABLE_CELLS_BY_CATALOG = new WeakMap;
|
|
@@ -333370,7 +334238,7 @@ class V2SelectionMutationAdapter {
|
|
|
333370
334238
|
};
|
|
333371
334239
|
if (newText.length !== 0)
|
|
333372
334240
|
return { on, newText, ...stamps, resultKey };
|
|
333373
|
-
const matchingFields = fieldEntries.filter((entry) => entry.storyId === on.storyId && entry.blockId === on.startBlockId && entry.descriptor.resultText === resolution.text &&
|
|
334241
|
+
const matchingFields = fieldEntries.filter((entry) => entry.storyId === on.storyId && entry.blockId === on.startBlockId && entry.descriptor.resultText === resolution.text && rangesOverlap10(on.startByte, on.endByte, entry.descriptor.byteStart, entry.descriptor.byteEnd));
|
|
333374
334242
|
if (matchingFields.length !== 1)
|
|
333375
334243
|
return { on, newText, ...stamps, resultKey };
|
|
333376
334244
|
if (options?.changeMode === "tracked") {
|
|
@@ -333442,11 +334310,11 @@ class V2SelectionMutationAdapter {
|
|
|
333442
334310
|
const updatedRefs = receipt3.updatedRefs ?? [];
|
|
333443
334311
|
const inserted = createdRefs.length <= 100 ? projectTrackedTextEntities(this.context, createdRefs, edits[0].on.startBlockId) : undefined;
|
|
333444
334312
|
const updated = updatedRefs.length <= 100 ? projectTrackedTextEntities(this.context, updatedRefs, edits[0].on.startBlockId) : undefined;
|
|
333445
|
-
|
|
333446
|
-
|
|
333447
|
-
|
|
333448
|
-
|
|
333449
|
-
|
|
334313
|
+
let trackedOutcomeLogicalView = null;
|
|
334314
|
+
const resolveTrackedOutcomeId = (rawId) => {
|
|
334315
|
+
trackedOutcomeLogicalView ?? (trackedOutcomeLogicalView = buildCachedTrackedChangeLogicalView(this.context).logical);
|
|
334316
|
+
return trackedOutcomeLogicalView.rsidToLogicalId.get(rawId) ?? rawId;
|
|
334317
|
+
};
|
|
333450
334318
|
const trackedChangeOutcomes = (receipt3.trackedTextEditOutcomes ?? []).map((outcome) => {
|
|
333451
334319
|
const source = edits[Number(outcome.resultKey)];
|
|
333452
334320
|
const origin = source.rewriteIntent ? ownerIds.get(source.ownerStepId ?? "") : undefined;
|
|
@@ -333454,7 +334322,7 @@ class V2SelectionMutationAdapter {
|
|
|
333454
334322
|
const refs = parentId && (outcome.createdRsids.length > 0 || outcome.updatedRsids.length > 0) ? [{ kind: "entity", entityType: "trackedChange", entityId: parentId }] : dedupeTrackedChangeReceiptEntities([...outcome.createdRsids, ...outcome.updatedRsids].map((rawId) => ({
|
|
333455
334323
|
kind: "entity",
|
|
333456
334324
|
entityType: "trackedChange",
|
|
333457
|
-
entityId:
|
|
334325
|
+
entityId: resolveTrackedOutcomeId(rawId)
|
|
333458
334326
|
})));
|
|
333459
334327
|
return {
|
|
333460
334328
|
editIndex: Number(outcome.resultKey),
|
|
@@ -334676,7 +335544,8 @@ class V2SelectionMutationAdapter {
|
|
|
334676
335544
|
};
|
|
334677
335545
|
}
|
|
334678
335546
|
executeFormat(request, options, offsetSpace) {
|
|
334679
|
-
const
|
|
335547
|
+
const cellSelection = options?.tableCellSelection;
|
|
335548
|
+
const resolvedTarget = cellSelection ? this.resolveCellFormatSelection(request.target, request.in, options, cellSelection) : request.ref !== undefined && request.target === undefined ? this.resolveRefSelection(request.ref, request.in, options) : this.resolveExplicitSelection(request.target, request.in, options, offsetSpace);
|
|
334680
335549
|
if (!resolvedTarget.ok)
|
|
334681
335550
|
return resolvedTarget.receipt;
|
|
334682
335551
|
const { resolution, storyLocator } = resolvedTarget.value;
|
|
@@ -334822,6 +335691,49 @@ class V2SelectionMutationAdapter {
|
|
|
334822
335691
|
resolution
|
|
334823
335692
|
};
|
|
334824
335693
|
}
|
|
335694
|
+
resolveCellFormatSelection(target, overrideStory, options, cellSelection) {
|
|
335695
|
+
const story = target ? pickStoryLocator(target, overrideStory) : overrideStory;
|
|
335696
|
+
const entries = resolveTableCellSelectionEntries(this.context.session, story ?? { kind: "story", storyType: "body" }, cellSelection.anchorBlockId, cellSelection.focusBlockId);
|
|
335697
|
+
if (!entries)
|
|
335698
|
+
return {
|
|
335699
|
+
ok: false,
|
|
335700
|
+
receipt: failureWithoutResolution("TARGET_NOT_FOUND", "The selected table cells no longer resolve.")
|
|
335701
|
+
};
|
|
335702
|
+
const ranges = [];
|
|
335703
|
+
const texts = [];
|
|
335704
|
+
let firstResolved;
|
|
335705
|
+
for (const entry of entries) {
|
|
335706
|
+
if (entry.textLength === 0)
|
|
335707
|
+
continue;
|
|
335708
|
+
const selected = this.resolveExplicitSelection({
|
|
335709
|
+
kind: "selection",
|
|
335710
|
+
start: { kind: "text", blockId: entry.blockId, offset: 0 },
|
|
335711
|
+
end: { kind: "text", blockId: entry.blockId, offset: entry.textLength },
|
|
335712
|
+
...story ? { story } : {}
|
|
335713
|
+
}, overrideStory, options, "kernel");
|
|
335714
|
+
if (!selected.ok)
|
|
335715
|
+
return selected;
|
|
335716
|
+
firstResolved ?? (firstResolved = selected.value);
|
|
335717
|
+
ranges.push(...selected.value.mode === "multi" ? selected.value.ranges : [selected.value.resolved]);
|
|
335718
|
+
texts.push(selected.value.resolution.text);
|
|
335719
|
+
}
|
|
335720
|
+
if (!firstResolved || !ranges.length)
|
|
335721
|
+
return { ok: false, receipt: failureWithoutResolution("NO_OP", "The selected cells contain no text.") };
|
|
335722
|
+
return {
|
|
335723
|
+
ok: true,
|
|
335724
|
+
value: {
|
|
335725
|
+
mode: "multi",
|
|
335726
|
+
ranges,
|
|
335727
|
+
storyLocator: firstResolved.storyLocator,
|
|
335728
|
+
resolution: {
|
|
335729
|
+
...firstResolved.resolution,
|
|
335730
|
+
text: texts.join(`
|
|
335731
|
+
`),
|
|
335732
|
+
range: { from: ranges[0].startByte, to: ranges[ranges.length - 1].endByte }
|
|
335733
|
+
}
|
|
335734
|
+
}
|
|
335735
|
+
};
|
|
335736
|
+
}
|
|
334825
335737
|
resolveExplicitSelection(target, overrideStory, _options, offsetSpace) {
|
|
334826
335738
|
if (!target) {
|
|
334827
335739
|
return {
|
|
@@ -335125,7 +336037,7 @@ class V2SelectionMutationAdapter {
|
|
|
335125
336037
|
txIdPrefix: "range-ref-whole-body-replace",
|
|
335126
336038
|
expectedRevision: options?.expectedRevision != null ? String(options.expectedRevision) : undefined,
|
|
335127
336039
|
perPart: {
|
|
335128
|
-
[story.partUri]: replaceWholePartEntry(bytes,
|
|
336040
|
+
[story.partUri]: replaceWholePartEntry(bytes, TE51.encode(nextXml))
|
|
335129
336041
|
},
|
|
335130
336042
|
storyIds: [story.storyId],
|
|
335131
336043
|
createdRefs,
|
|
@@ -335412,7 +336324,7 @@ function typingHistoryMetadata(options) {
|
|
|
335412
336324
|
function tryDeleteMatchedFieldRef(context, replacementText, outcome, resolution) {
|
|
335413
336325
|
if (replacementText.length !== 0)
|
|
335414
336326
|
return null;
|
|
335415
|
-
const matches = listCanonicalFieldEntries(context).filter((entry2) => entry2.storyId === outcome.payload.storyId && entry2.blockId === outcome.payload.blockId && entry2.descriptor.resultText === outcome.payload.matchText &&
|
|
336327
|
+
const matches = listCanonicalFieldEntries(context).filter((entry2) => entry2.storyId === outcome.payload.storyId && entry2.blockId === outcome.payload.blockId && entry2.descriptor.resultText === outcome.payload.matchText && rangesOverlap10(outcome.resolved.startByte, outcome.resolved.endByte, entry2.descriptor.byteStart, entry2.descriptor.byteEnd));
|
|
335416
336328
|
if (matches.length !== 1)
|
|
335417
336329
|
return null;
|
|
335418
336330
|
const entry = matches[0];
|
|
@@ -335432,7 +336344,7 @@ function tryDeleteMatchedFieldRef(context, replacementText, outcome, resolution)
|
|
|
335432
336344
|
resolution
|
|
335433
336345
|
};
|
|
335434
336346
|
}
|
|
335435
|
-
function
|
|
336347
|
+
function rangesOverlap10(start, end, otherStart, otherEnd) {
|
|
335436
336348
|
return start < otherEnd && end > otherStart;
|
|
335437
336349
|
}
|
|
335438
336350
|
function failureWithoutResolution(code2, message) {
|
|
@@ -335940,9 +336852,10 @@ function rewriteReviewId(on, resolution, origin) {
|
|
|
335940
336852
|
const noteId = story && "noteId" in story ? story.noteId : undefined;
|
|
335941
336853
|
return buildTextRewriteReviewGroupId(on.storyId, origin, noteId);
|
|
335942
336854
|
}
|
|
335943
|
-
var TD93,
|
|
336855
|
+
var TD93, TE51, PERMISSION_DENIED_DOC_PROTECTION = "document protection permits edits only within an everyone permission range.", FORMAT_STRADDLE_MARKER_KINDS;
|
|
335944
336856
|
var init_adapter9 = __esm(() => {
|
|
335945
336857
|
init_review_read_model();
|
|
336858
|
+
init_live_selection();
|
|
335946
336859
|
init_sd_document_session_internal();
|
|
335947
336860
|
init_logical_view_cache();
|
|
335948
336861
|
init_local_text_projection();
|
|
@@ -335976,7 +336889,7 @@ var init_adapter9 = __esm(() => {
|
|
|
335976
336889
|
init_cross_cell_delete();
|
|
335977
336890
|
init_effective_inline_uniformity();
|
|
335978
336891
|
TD93 = new TextDecoder;
|
|
335979
|
-
|
|
336892
|
+
TE51 = new TextEncoder;
|
|
335980
336893
|
FORMAT_STRADDLE_MARKER_KINDS = new Set([
|
|
335981
336894
|
"bookmarkStart",
|
|
335982
336895
|
"bookmarkEnd",
|
|
@@ -336770,7 +337683,7 @@ function richWriteAnalysisSha256(input) {
|
|
|
336770
337683
|
return digest({ ...input, atomic: true });
|
|
336771
337684
|
}
|
|
336772
337685
|
function digest(value2) {
|
|
336773
|
-
return sha256HexSync(
|
|
337686
|
+
return sha256HexSync(TE52.encode(canonicalJson(value2)));
|
|
336774
337687
|
}
|
|
336775
337688
|
function canonicalJson(value2) {
|
|
336776
337689
|
if (value2 === null || typeof value2 === "boolean" || typeof value2 === "string")
|
|
@@ -336788,10 +337701,10 @@ function canonicalJson(value2) {
|
|
|
336788
337701
|
}
|
|
336789
337702
|
throw new Error(`Support-check digests cannot encode ${typeof value2}.`);
|
|
336790
337703
|
}
|
|
336791
|
-
var
|
|
337704
|
+
var TE52;
|
|
336792
337705
|
var init_digest = __esm(() => {
|
|
336793
337706
|
init_sd_document_session_internal();
|
|
336794
|
-
|
|
337707
|
+
TE52 = new TextEncoder;
|
|
336795
337708
|
});
|
|
336796
337709
|
|
|
336797
337710
|
// ../../../v2/document-api-v2-adapter/dist/write/rich-fragment-apply.js
|
|
@@ -337589,7 +338502,7 @@ function commitKernelXmlRewrites(input) {
|
|
|
337589
338502
|
}
|
|
337590
338503
|
};
|
|
337591
338504
|
}
|
|
337592
|
-
const nextBytes =
|
|
338505
|
+
const nextBytes = TE53.encode(rewrite.nextXml);
|
|
337593
338506
|
return bytesEqual16(currentBytes, nextBytes) ? null : {
|
|
337594
338507
|
rewrite,
|
|
337595
338508
|
currentBytes,
|
|
@@ -337664,11 +338577,11 @@ function bytesEqual16(left, right) {
|
|
|
337664
338577
|
}
|
|
337665
338578
|
return true;
|
|
337666
338579
|
}
|
|
337667
|
-
var
|
|
338580
|
+
var TE53, TD95;
|
|
337668
338581
|
var init_xml_rewrite = __esm(() => {
|
|
337669
338582
|
init_sd_document_session_internal();
|
|
337670
338583
|
init_xml();
|
|
337671
|
-
|
|
338584
|
+
TE53 = new TextEncoder;
|
|
337672
338585
|
TD95 = new TextDecoder;
|
|
337673
338586
|
});
|
|
337674
338587
|
|
|
@@ -347232,7 +348145,7 @@ function storyErrorMessage3(error48) {
|
|
|
347232
348145
|
}
|
|
347233
348146
|
}
|
|
347234
348147
|
function splicePartBytes(bytes, start, end, replacementXml) {
|
|
347235
|
-
const replacement =
|
|
348148
|
+
const replacement = TE54.encode(replacementXml);
|
|
347236
348149
|
const next = new Uint8Array(start + replacement.length + (bytes.length - end));
|
|
347237
348150
|
next.set(bytes.subarray(0, start), 0);
|
|
347238
348151
|
next.set(replacement, start);
|
|
@@ -347335,7 +348248,7 @@ function txIdPrefixToOperation(prefix) {
|
|
|
347335
348248
|
return prefix;
|
|
347336
348249
|
}
|
|
347337
348250
|
}
|
|
347338
|
-
var TD97,
|
|
348251
|
+
var TD97, TE54;
|
|
347339
348252
|
var init_adapter15 = __esm(() => {
|
|
347340
348253
|
init_sd_document_session_internal();
|
|
347341
348254
|
init_src6();
|
|
@@ -347349,7 +348262,7 @@ var init_adapter15 = __esm(() => {
|
|
|
347349
348262
|
init_part();
|
|
347350
348263
|
init_paragraph();
|
|
347351
348264
|
TD97 = new TextDecoder;
|
|
347352
|
-
|
|
348265
|
+
TE54 = new TextEncoder;
|
|
347353
348266
|
});
|
|
347354
348267
|
|
|
347355
348268
|
// ../../../v2/document-api-v2-adapter/dist/header-footers/page-numbers.js
|
|
@@ -351016,7 +351929,7 @@ function readInsertedTextFromXml(xml) {
|
|
|
351016
351929
|
const textRe = /<([\w.-]+):t\b([^>]*?)>([\s\S]*?)<\/\1:t>/g;
|
|
351017
351930
|
let match;
|
|
351018
351931
|
while (match = textRe.exec(xml)) {
|
|
351019
|
-
out.push(
|
|
351932
|
+
out.push(decodeXmlText11(match[3] ?? ""));
|
|
351020
351933
|
}
|
|
351021
351934
|
return out.join("");
|
|
351022
351935
|
}
|
|
@@ -351259,7 +352172,7 @@ function computeFragmentCharRangesForParagraph(paragraphXml, paragraphByteStart,
|
|
|
351259
352172
|
}
|
|
351260
352173
|
}
|
|
351261
352174
|
} else if (m[7]) {
|
|
351262
|
-
const decoded =
|
|
352175
|
+
const decoded = decodeXmlText11(m[9] ?? "");
|
|
351263
352176
|
charCursor += decoded.length;
|
|
351264
352177
|
}
|
|
351265
352178
|
}
|
|
@@ -351542,7 +352455,7 @@ function rangesContainOrAreContained(left, right) {
|
|
|
351542
352455
|
function rangesAreAdjacent(left, right) {
|
|
351543
352456
|
return Math.abs(left.start - right.byteEnd) <= 64 || Math.abs(right.byteStart - left.end) <= 64;
|
|
351544
352457
|
}
|
|
351545
|
-
function
|
|
352458
|
+
function decodeXmlText11(value2) {
|
|
351546
352459
|
return value2.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
351547
352460
|
}
|
|
351548
352461
|
function escapeRegex12(value2) {
|
|
@@ -358673,11 +359586,11 @@ function findStructuredImageDrawings(partXml, identity2) {
|
|
|
358673
359586
|
const relationshipId = /\br:embed="([^"]+)"/.exec(drawing.xml)?.[1] ?? null;
|
|
358674
359587
|
if (!relationshipId || normalizeImageIdComponent(relationshipId) !== identity2.relationshipScope)
|
|
358675
359588
|
continue;
|
|
358676
|
-
const byteStart =
|
|
359589
|
+
const byteStart = TE55.encode(partXml.slice(0, drawing.start)).byteLength;
|
|
358677
359590
|
out.push({
|
|
358678
359591
|
start: drawing.start,
|
|
358679
359592
|
byteStart,
|
|
358680
|
-
byteEnd: byteStart +
|
|
359593
|
+
byteEnd: byteStart + TE55.encode(drawing.xml).byteLength,
|
|
358681
359594
|
relationshipId,
|
|
358682
359595
|
xml: drawing.xml
|
|
358683
359596
|
});
|
|
@@ -359155,14 +360068,14 @@ function decodeXmlAttr2(value2) {
|
|
|
359155
360068
|
function emuToPx(value2) {
|
|
359156
360069
|
return value2 / EMU_PER_PX4;
|
|
359157
360070
|
}
|
|
359158
|
-
var TD98,
|
|
360071
|
+
var TD98, TE55, EMU_PER_PX4 = 9525, CROP_SCALE = 1000, DECORATIVE_DESCRIPTION_CLEARED, BODY_IMAGE_ENTRIES_CACHE, TRACKED_WRAPPER_KINDS2;
|
|
359159
360072
|
var init_public_model = __esm(() => {
|
|
359160
360073
|
init_sd_document_session_internal();
|
|
359161
360074
|
init_caption_style();
|
|
359162
360075
|
init_xml_rewrite();
|
|
359163
360076
|
init_document_reader();
|
|
359164
360077
|
TD98 = new TextDecoder;
|
|
359165
|
-
|
|
360078
|
+
TE55 = new TextEncoder;
|
|
359166
360079
|
DECORATIVE_DESCRIPTION_CLEARED = new WeakMap;
|
|
359167
360080
|
BODY_IMAGE_ENTRIES_CACHE = new WeakMap;
|
|
359168
360081
|
TRACKED_WRAPPER_KINDS2 = new Set(["ins", "del", "moveFrom", "moveTo"]);
|
|
@@ -364558,7 +365471,7 @@ function computeFragmentParagraphCharRange(paragraphXml, fragLocalStart, fragLoc
|
|
|
364558
365471
|
let match;
|
|
364559
365472
|
while (match = re.exec(paragraphXml)) {
|
|
364560
365473
|
const raw = match[1] ?? "";
|
|
364561
|
-
const decoded =
|
|
365474
|
+
const decoded = decodeXmlText12(raw);
|
|
364562
365475
|
const tOpenStart = match.index;
|
|
364563
365476
|
const tCloseEnd = match.index + match[0].length;
|
|
364564
365477
|
const insideFragment = tOpenStart >= fragLocalStart && tCloseEnd <= fragLocalEnd;
|
|
@@ -364650,7 +365563,7 @@ function buildParagraphCharOffsetMap(paragraphXml, paragraphByteStart, coordinat
|
|
|
364650
365563
|
const re = coordinateSpace === "tracked" ? /<[\w.-]+:(?:t|delText)\b[^>]*>([\s\S]*?)<\/[\w.-]+:(?:t|delText)>/g : /<[\w.-]+:t\b[^>]*>([\s\S]*?)<\/[\w.-]+:t>/g;
|
|
364651
365564
|
for (const match of paragraphXml.matchAll(re)) {
|
|
364652
365565
|
const raw = match[1] ?? "";
|
|
364653
|
-
const decoded =
|
|
365566
|
+
const decoded = decodeXmlText12(raw);
|
|
364654
365567
|
const contentCharStart = (match.index ?? 0) + match[0].indexOf(">") + 1;
|
|
364655
365568
|
advanceXmlTo(contentCharStart);
|
|
364656
365569
|
const contentStart = paragraphByteStart + xmlByteCursor;
|
|
@@ -364717,7 +365630,7 @@ function deriveStoryLocatorForFragment(context, fragment4) {
|
|
|
364717
365630
|
}
|
|
364718
365631
|
return;
|
|
364719
365632
|
}
|
|
364720
|
-
function
|
|
365633
|
+
function decodeXmlText12(value2) {
|
|
364721
365634
|
return value2.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
364722
365635
|
}
|
|
364723
365636
|
function fail4(code2, message) {
|
|
@@ -366782,8 +367695,8 @@ var init_adapter23 = __esm(() => {
|
|
|
366782
367695
|
|
|
366783
367696
|
// ../../../v2/document-api-v2-adapter/dist/diff/tracked-table-property-replay.js
|
|
366784
367697
|
function buildTrackedTablePropertyReplayPlan(base3, target) {
|
|
366785
|
-
const baseBytes =
|
|
366786
|
-
const targetBytes =
|
|
367698
|
+
const baseBytes = TE56.encode(base3.xml);
|
|
367699
|
+
const targetBytes = TE56.encode(target.xml);
|
|
366787
367700
|
const baseTables = buildTableCatalog({ bytes: baseBytes, storyId: STORY_ID });
|
|
366788
367701
|
const targetTables = buildTableCatalog({ bytes: targetBytes, storyId: STORY_ID });
|
|
366789
367702
|
const baseBody = collectXmlElementRanges(base3.xml).ranges.find((range) => range.tag.namespaceUri === W20 && range.tag.localName === "body");
|
|
@@ -366829,10 +367742,10 @@ function buildTrackedTablePropertyReplayPlan(base3, target) {
|
|
|
366829
367742
|
}
|
|
366830
367743
|
return steps.length ? { steps } : null;
|
|
366831
367744
|
}
|
|
366832
|
-
var
|
|
367745
|
+
var TE56, TD101, STORY_ID = "body:/word/document.xml", W20 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
366833
367746
|
var init_tracked_table_property_replay = __esm(() => {
|
|
366834
367747
|
init_sd_document_session_internal();
|
|
366835
|
-
|
|
367748
|
+
TE56 = new TextEncoder;
|
|
366836
367749
|
TD101 = new TextDecoder;
|
|
366837
367750
|
});
|
|
366838
367751
|
|
|
@@ -366931,15 +367844,15 @@ var init_fingerprint = __esm(() => {
|
|
|
366931
367844
|
// ../../../v2/document-api-v2-adapter/dist/compare/part-fingerprint.js
|
|
366932
367845
|
function comparePartContentFingerprint(partUri, bytes) {
|
|
366933
367846
|
const partHash = sha256HexSync(bytes);
|
|
366934
|
-
return `fp:${sha256HexSync(
|
|
367847
|
+
return `fp:${sha256HexSync(TE57.encode(`${partUri}:${partHash}`))}`;
|
|
366935
367848
|
}
|
|
366936
367849
|
function comparePartXmlFingerprint(partUri, xml) {
|
|
366937
|
-
return comparePartContentFingerprint(partUri,
|
|
367850
|
+
return comparePartContentFingerprint(partUri, TE57.encode(xml));
|
|
366938
367851
|
}
|
|
366939
|
-
var
|
|
367852
|
+
var TE57;
|
|
366940
367853
|
var init_part_fingerprint = __esm(() => {
|
|
366941
367854
|
init_sd_document_session_internal();
|
|
366942
|
-
|
|
367855
|
+
TE57 = new TextEncoder;
|
|
366943
367856
|
});
|
|
366944
367857
|
|
|
366945
367858
|
// ../../../v2/document-api-v2-adapter/dist/compare/inventory.js
|
|
@@ -367160,7 +368073,7 @@ function captureCompareSourceInventory(context) {
|
|
|
367160
368073
|
return buildCompareSourceInventory(buildCompareSourceObservation(context));
|
|
367161
368074
|
}
|
|
367162
368075
|
function textBytes(value2) {
|
|
367163
|
-
return
|
|
368076
|
+
return TE58.encode(value2);
|
|
367164
368077
|
}
|
|
367165
368078
|
function countOccurrences(haystack, needle) {
|
|
367166
368079
|
let count = 0;
|
|
@@ -367217,19 +368130,19 @@ function accumulateStoryCatalogs(context, story, acc) {
|
|
|
367217
368130
|
}
|
|
367218
368131
|
} catch {}
|
|
367219
368132
|
}
|
|
367220
|
-
var TD102, BODY_PART_URI = "/word/document.xml",
|
|
368133
|
+
var TD102, BODY_PART_URI = "/word/document.xml", TE58;
|
|
367221
368134
|
var init_inventory = __esm(() => {
|
|
367222
368135
|
init_src2();
|
|
367223
368136
|
init_sd_document_session_internal();
|
|
367224
368137
|
init_document_reader();
|
|
367225
368138
|
init_part_fingerprint();
|
|
367226
368139
|
TD102 = new TextDecoder("utf-8", { fatal: false });
|
|
367227
|
-
|
|
368140
|
+
TE58 = new TextEncoder;
|
|
367228
368141
|
});
|
|
367229
368142
|
|
|
367230
368143
|
// ../../../v2/document-api-v2-adapter/dist/compare/definitions.js
|
|
367231
368144
|
function digest2(value2) {
|
|
367232
|
-
return sha256HexSync(
|
|
368145
|
+
return sha256HexSync(TE59.encode(value2));
|
|
367233
368146
|
}
|
|
367234
368147
|
function tagAttr2(tag, local) {
|
|
367235
368148
|
const match = new RegExp(`\\b(?:[\\w.-]+:)?${local}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`).exec(tag);
|
|
@@ -367533,14 +368446,14 @@ function projectCompareDefinitions(context) {
|
|
|
367533
368446
|
{ family: "theme", entries: projectTheme(context) }
|
|
367534
368447
|
];
|
|
367535
368448
|
}
|
|
367536
|
-
var TD103,
|
|
368449
|
+
var TD103, TE59, SETTINGS_PART_URI4 = "/word/settings.xml", WORDPROCESSINGML_NS3 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", XML_ATTR_RE;
|
|
367537
368450
|
var init_definitions = __esm(() => {
|
|
367538
368451
|
init_src2();
|
|
367539
368452
|
init_sd_document_session_internal();
|
|
367540
368453
|
init_adapter13();
|
|
367541
368454
|
init_part();
|
|
367542
368455
|
TD103 = new TextDecoder("utf-8", { fatal: false });
|
|
367543
|
-
|
|
368456
|
+
TE59 = new TextEncoder;
|
|
367544
368457
|
XML_ATTR_RE = /\s+[\w.-]+(?::[\w.-]+)?=(?:"[^"]*"|'[^']*')/g;
|
|
367545
368458
|
});
|
|
367546
368459
|
|
|
@@ -367555,7 +368468,7 @@ function contentControlIdentity(properties) {
|
|
|
367555
368468
|
|
|
367556
368469
|
// ../../../v2/document-api-v2-adapter/dist/compare/annotations.js
|
|
367557
368470
|
function digest3(value2) {
|
|
367558
|
-
return sha256HexSync(
|
|
368471
|
+
return sha256HexSync(TE60.encode(value2));
|
|
367559
368472
|
}
|
|
367560
368473
|
function storyLocatorSignature(story) {
|
|
367561
368474
|
if (!story || story.storyType === "body")
|
|
@@ -367902,17 +368815,17 @@ function projectCompareAnnotations(context) {
|
|
|
367902
368815
|
{ family: "permissions", entries: projectPermissions(context) }
|
|
367903
368816
|
];
|
|
367904
368817
|
}
|
|
367905
|
-
var TD104,
|
|
368818
|
+
var TD104, TE60, BODY_PART_URI2 = "/word/document.xml", CUSTOM_XML_PROPS_RELS_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps";
|
|
367906
368819
|
var init_annotations2 = __esm(() => {
|
|
367907
368820
|
init_sd_document_session_internal();
|
|
367908
368821
|
init_read();
|
|
367909
368822
|
TD104 = new TextDecoder("utf-8", { fatal: false });
|
|
367910
|
-
|
|
368823
|
+
TE60 = new TextEncoder;
|
|
367911
368824
|
});
|
|
367912
368825
|
|
|
367913
368826
|
// ../../../v2/document-api-v2-adapter/dist/compare/objects.js
|
|
367914
368827
|
function digest4(value2) {
|
|
367915
|
-
return sha256HexSync(
|
|
368828
|
+
return sha256HexSync(TE61.encode(value2));
|
|
367916
368829
|
}
|
|
367917
368830
|
function isMediaKind(partKind) {
|
|
367918
368831
|
return classifyComparePartKind(partKind).family === "media";
|
|
@@ -368129,12 +369042,12 @@ function projectCompareObjects(context) {
|
|
|
368129
369042
|
{ family: "package-graph", entries: projectPackageGraph(context) }
|
|
368130
369043
|
];
|
|
368131
369044
|
}
|
|
368132
|
-
var TD105,
|
|
369045
|
+
var TD105, TE61, CONTENT_TYPES_PART_URI15 = "/[Content_Types].xml", PACKAGE_ROOT_OWNER = "/";
|
|
368133
369046
|
var init_objects = __esm(() => {
|
|
368134
369047
|
init_src2();
|
|
368135
369048
|
init_sd_document_session_internal();
|
|
368136
369049
|
TD105 = new TextDecoder("utf-8", { fatal: false });
|
|
368137
|
-
|
|
369050
|
+
TE61 = new TextEncoder;
|
|
368138
369051
|
});
|
|
368139
369052
|
|
|
368140
369053
|
// ../../../v2/document-api-v2-adapter/dist/compare/run-signature.js
|
|
@@ -368189,12 +369102,12 @@ function paragraphContext(rawXml, inherited) {
|
|
|
368189
369102
|
const paragraph4 = /^<(([A-Za-z_][\w.-]*)(?::([A-Za-z_][\w.-]*))?)/.exec(openTag);
|
|
368190
369103
|
const paragraphPrefix = paragraph4?.[3] === undefined ? "" : paragraph4[2];
|
|
368191
369104
|
if (paragraph4 && context[paragraphPrefix] === undefined)
|
|
368192
|
-
context[paragraphPrefix] =
|
|
369105
|
+
context[paragraphPrefix] = W_NS7;
|
|
368193
369106
|
return context;
|
|
368194
369107
|
}
|
|
368195
369108
|
function isWordprocessingElement4(element, context) {
|
|
368196
369109
|
const local = namespaceDeclarations3(element.openTag);
|
|
368197
|
-
return (local[element.prefix] ?? context[element.prefix]) ===
|
|
369110
|
+
return (local[element.prefix] ?? context[element.prefix]) === W_NS7;
|
|
368198
369111
|
}
|
|
368199
369112
|
function makeTopLevelElementsSelfContained2(xml, context) {
|
|
368200
369113
|
let result = xml;
|
|
@@ -368255,7 +369168,7 @@ function computeParagraphPropertiesSignature2(paragraphPropertiesXml) {
|
|
|
368255
369168
|
}
|
|
368256
369169
|
return `v2-ppr-${hash2.toString(16).padStart(8, "0")}`;
|
|
368257
369170
|
}
|
|
368258
|
-
var REVISION_ATTR_RE2,
|
|
369171
|
+
var REVISION_ATTR_RE2, W_NS7 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", XML_TAG_RE3, XML_ATTRIBUTE_RE2;
|
|
368259
369172
|
var init_run_signature2 = __esm(() => {
|
|
368260
369173
|
init_src2();
|
|
368261
369174
|
init_src2();
|
|
@@ -369188,70 +370101,6 @@ var init_compare = __esm(() => {
|
|
|
369188
370101
|
init_src2();
|
|
369189
370102
|
});
|
|
369190
370103
|
|
|
369191
|
-
// ../../../v2/document-api-v2-adapter/dist/core/text-coordinate-space.js
|
|
369192
|
-
function projectVisibleOffsetToTracked(map3, offset, bias) {
|
|
369193
|
-
if (!Number.isInteger(offset) || offset < 0 || offset > map3.visibleLength)
|
|
369194
|
-
return null;
|
|
369195
|
-
const candidates = new Set;
|
|
369196
|
-
if (offset === 0)
|
|
369197
|
-
candidates.add(0);
|
|
369198
|
-
if (offset === map3.visibleLength)
|
|
369199
|
-
candidates.add(map3.trackedLength);
|
|
369200
|
-
for (const piece of map3.leaves()) {
|
|
369201
|
-
const visibleWidth2 = piece.visibleEnd - piece.visibleStart;
|
|
369202
|
-
const trackedWidth2 = piece.trackedEnd - piece.trackedStart;
|
|
369203
|
-
if (visibleWidth2 > 0 && trackedWidth2 === visibleWidth2) {
|
|
369204
|
-
if (offset >= piece.visibleStart && offset <= piece.visibleEnd) {
|
|
369205
|
-
candidates.add(piece.trackedStart + offset - piece.visibleStart);
|
|
369206
|
-
}
|
|
369207
|
-
continue;
|
|
369208
|
-
}
|
|
369209
|
-
if (offset === piece.visibleStart)
|
|
369210
|
-
candidates.add(piece.trackedStart);
|
|
369211
|
-
if (offset === piece.visibleEnd)
|
|
369212
|
-
candidates.add(piece.trackedEnd);
|
|
369213
|
-
}
|
|
369214
|
-
if (candidates.size === 0)
|
|
369215
|
-
return null;
|
|
369216
|
-
const values2 = [...candidates];
|
|
369217
|
-
return bias === "upstream" ? Math.min(...values2) : Math.max(...values2);
|
|
369218
|
-
}
|
|
369219
|
-
function projectTrackedOffsetToVisible(map3, offset) {
|
|
369220
|
-
if (!Number.isInteger(offset) || offset < 0 || offset > map3.trackedLength)
|
|
369221
|
-
return null;
|
|
369222
|
-
if (offset === map3.trackedLength)
|
|
369223
|
-
return map3.visibleLength;
|
|
369224
|
-
for (const piece of map3.leaves()) {
|
|
369225
|
-
if (offset < piece.trackedStart || offset > piece.trackedEnd)
|
|
369226
|
-
continue;
|
|
369227
|
-
if (offset === piece.trackedStart)
|
|
369228
|
-
return piece.visibleStart;
|
|
369229
|
-
if (offset === piece.trackedEnd)
|
|
369230
|
-
return piece.visibleEnd;
|
|
369231
|
-
const trackedWidth2 = piece.trackedEnd - piece.trackedStart;
|
|
369232
|
-
const visibleWidth2 = piece.visibleEnd - piece.visibleStart;
|
|
369233
|
-
if (trackedWidth2 === 0 || visibleWidth2 === 0)
|
|
369234
|
-
return piece.visibleStart;
|
|
369235
|
-
if (trackedWidth2 !== visibleWidth2)
|
|
369236
|
-
return null;
|
|
369237
|
-
return piece.visibleStart + offset - piece.trackedStart;
|
|
369238
|
-
}
|
|
369239
|
-
return null;
|
|
369240
|
-
}
|
|
369241
|
-
function projectVisibleRangeToTracked(map3, start, end) {
|
|
369242
|
-
if (!Number.isInteger(start) || !Number.isInteger(end) || start < 0 || end < start)
|
|
369243
|
-
return null;
|
|
369244
|
-
if (start === end) {
|
|
369245
|
-
const offset = projectVisibleOffsetToTracked(map3, start, "upstream");
|
|
369246
|
-
return offset == null ? null : { start: offset, end: offset };
|
|
369247
|
-
}
|
|
369248
|
-
const trackedStart = projectVisibleOffsetToTracked(map3, start, "downstream");
|
|
369249
|
-
const trackedEnd = projectVisibleOffsetToTracked(map3, end, "upstream");
|
|
369250
|
-
if (trackedStart == null || trackedEnd == null || trackedEnd < trackedStart)
|
|
369251
|
-
return null;
|
|
369252
|
-
return { start: trackedStart, end: trackedEnd };
|
|
369253
|
-
}
|
|
369254
|
-
|
|
369255
370104
|
// ../../../v2/document-api-v2-adapter/dist/tracked-changes/range-resolver.js
|
|
369256
370105
|
function scanParagraphFragments(paragraph4, partBytes, catalogFragments) {
|
|
369257
370106
|
const paragraphXml = TD107.decode(partBytes.subarray(paragraph4.byteStart, paragraph4.byteEnd));
|
|
@@ -369291,7 +370140,7 @@ function scanParagraphFragments(paragraph4, partBytes, catalogFragments) {
|
|
|
369291
370140
|
});
|
|
369292
370141
|
}
|
|
369293
370142
|
} else if (m[7]) {
|
|
369294
|
-
const decoded =
|
|
370143
|
+
const decoded = decodeXmlText13(m[9] ?? "");
|
|
369295
370144
|
trackedTextLength += decoded.length;
|
|
369296
370145
|
}
|
|
369297
370146
|
}
|
|
@@ -369304,7 +370153,7 @@ function findLastStackIndex2(stack, kind) {
|
|
|
369304
370153
|
}
|
|
369305
370154
|
return -1;
|
|
369306
370155
|
}
|
|
369307
|
-
function
|
|
370156
|
+
function decodeXmlText13(escaped) {
|
|
369308
370157
|
return escaped.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
369309
370158
|
}
|
|
369310
370159
|
function resolveTextRangeToFragmentOverlaps(input) {
|
|
@@ -371773,7 +372622,7 @@ function extractImageRelationshipId(xml) {
|
|
|
371773
372622
|
}
|
|
371774
372623
|
function extractImagePreviewAlt(xml) {
|
|
371775
372624
|
const docPr = /<[^>]*(?:[\w.-]+:)?docPr\b[^>]*>/i.exec(xml)?.[0] ?? "";
|
|
371776
|
-
const raw =
|
|
372625
|
+
const raw = readXmlAttribute5(docPr, "descr") ?? readXmlAttribute5(docPr, "title") ?? readXmlAttribute5(docPr, "name");
|
|
371777
372626
|
const normalized = raw ? decodeXmlAttribute3(raw).trim() : "";
|
|
371778
372627
|
return normalized.length > 0 ? normalized : null;
|
|
371779
372628
|
}
|
|
@@ -371790,7 +372639,7 @@ function extractImagePreviewExtent(xml) {
|
|
|
371790
372639
|
height: Math.max(1, Math.round(cy / EMUS_PER_CSS_PIXEL))
|
|
371791
372640
|
};
|
|
371792
372641
|
}
|
|
371793
|
-
function
|
|
372642
|
+
function readXmlAttribute5(tagXml, localName2) {
|
|
371794
372643
|
const match = new RegExp(`\\b(?:[\\w.-]+:)?${localName2}=["']([^"']*)["']`).exec(tagXml);
|
|
371795
372644
|
return match?.[1] ?? null;
|
|
371796
372645
|
}
|
|
@@ -372401,7 +373250,7 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
372401
373250
|
family: "header-footer-parts",
|
|
372402
373251
|
partUri: DOCUMENT_RELS_URI2,
|
|
372403
373252
|
kind: "create",
|
|
372404
|
-
nextBytes:
|
|
373253
|
+
nextBytes: TE62.encode(nextRels),
|
|
372405
373254
|
contentType: "application/vnd.openxmlformats-package.relationships+xml"
|
|
372406
373255
|
});
|
|
372407
373256
|
} else if (nextRels !== baseRels) {
|
|
@@ -372409,7 +373258,7 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
372409
373258
|
family: "header-footer-parts",
|
|
372410
373259
|
partUri: DOCUMENT_RELS_URI2,
|
|
372411
373260
|
kind: "modify",
|
|
372412
|
-
nextBytes:
|
|
373261
|
+
nextBytes: TE62.encode(nextRels)
|
|
372413
373262
|
});
|
|
372414
373263
|
}
|
|
372415
373264
|
const baseContentTypes = TD108.decode(Uint8Array.from(base3.contentTypesBytes));
|
|
@@ -372422,7 +373271,7 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
372422
373271
|
family: "header-footer-parts",
|
|
372423
373272
|
partUri: CONTENT_TYPES_URI2,
|
|
372424
373273
|
kind: "modify",
|
|
372425
|
-
nextBytes:
|
|
373274
|
+
nextBytes: TE62.encode(nextContentTypes)
|
|
372426
373275
|
});
|
|
372427
373276
|
}
|
|
372428
373277
|
return {
|
|
@@ -372571,8 +373420,8 @@ function coveredGraphKeys(baseRels, targetRels, baseContentTypes, targetContentT
|
|
|
372571
373420
|
}
|
|
372572
373421
|
}
|
|
372573
373422
|
const partUris = new Set([
|
|
372574
|
-
...headerFooterPartsFromDocumentRelationships(
|
|
372575
|
-
...headerFooterPartsFromDocumentRelationships(
|
|
373423
|
+
...headerFooterPartsFromDocumentRelationships(TE62.encode(baseRels)).keys(),
|
|
373424
|
+
...headerFooterPartsFromDocumentRelationships(TE62.encode(targetRels)).keys()
|
|
372576
373425
|
]);
|
|
372577
373426
|
const baseOverrides = headerFooterOverrideRecords(baseContentTypes, partUris);
|
|
372578
373427
|
const targetOverrides = headerFooterOverrideRecords(targetContentTypes, partUris);
|
|
@@ -372595,14 +373444,14 @@ function headerFooterOverrideRecords(xml, partUris) {
|
|
|
372595
373444
|
function relationshipSemanticKey(relationship) {
|
|
372596
373445
|
return JSON.stringify([relationship.id, relationship.type, relationship.target, relationship.targetMode ?? "Internal"]);
|
|
372597
373446
|
}
|
|
372598
|
-
var TD108,
|
|
373447
|
+
var TD108, TE62, DOCUMENT_RELS_URI2 = "/word/_rels/document.xml.rels", CONTENT_TYPES_URI2 = "/[Content_Types].xml", EMPTY_RELS_XML = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>', HEADER_REL_SUFFIX2 = "/relationships/header", FOOTER_REL_SUFFIX2 = "/relationships/footer", OFFICE_RELATIONSHIPS_NAMESPACES, RELATIONSHIP_REFERENCE_ATTRIBUTES;
|
|
372599
373448
|
var init_header_footer_lifecycle = __esm(() => {
|
|
372600
373449
|
init_sd_document_session_internal();
|
|
372601
373450
|
init_part_fingerprint();
|
|
372602
373451
|
init_header_footer_parts();
|
|
372603
373452
|
init_opc_xml();
|
|
372604
373453
|
TD108 = new TextDecoder;
|
|
372605
|
-
|
|
373454
|
+
TE62 = new TextEncoder;
|
|
372606
373455
|
OFFICE_RELATIONSHIPS_NAMESPACES = new Set([
|
|
372607
373456
|
"http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
372608
373457
|
"http://purl.oclc.org/ooxml/officeDocument/relationships"
|
|
@@ -372770,8 +373619,8 @@ function buildTrackedTableRowReplayPlan(input) {
|
|
|
372770
373619
|
if (input.base.xml === input.target.xml) {
|
|
372771
373620
|
return { steps: [], bodyOperations: input.bodyOperations, unsafeReasons: [] };
|
|
372772
373621
|
}
|
|
372773
|
-
const baseBytes =
|
|
372774
|
-
const targetBytes =
|
|
373622
|
+
const baseBytes = TE63.encode(input.base.xml);
|
|
373623
|
+
const targetBytes = TE63.encode(input.target.xml);
|
|
372775
373624
|
const baseCatalog = buildTableCatalog({ bytes: baseBytes, storyId: STORY_ID2 });
|
|
372776
373625
|
const targetCatalog = buildTableCatalog({ bytes: targetBytes, storyId: STORY_ID2 });
|
|
372777
373626
|
const baseRoot = documentRootContext(input.base.xml);
|
|
@@ -373444,10 +374293,10 @@ function escapeRegExp18(value2) {
|
|
|
373444
374293
|
function escapeXmlAttribute5(value2) {
|
|
373445
374294
|
return value2.replaceAll("&", "&").replaceAll('"', """);
|
|
373446
374295
|
}
|
|
373447
|
-
var
|
|
374296
|
+
var TE63, STORY_ID2 = "body:/word/document.xml", WORDPROCESSINGML_NS4 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", WORDPROCESSINGML_2010_NS = "http://schemas.microsoft.com/office/word/2010/wordml", MARKUP_COMPATIBILITY_NS2 = "http://schemas.openxmlformats.org/markup-compatibility/2006", MC_PREFIX_LIST_ATTRIBUTES, MC_QNAME_LIST_ATTRIBUTES, EXACT_ROW_UNSAFE_REVISION_LOCAL_NAMES2, EXACT_ROW_UNSAFE_W14_REVISION_LOCAL_NAMES2;
|
|
373448
374297
|
var init_tracked_table_row_replay = __esm(() => {
|
|
373449
374298
|
init_sd_document_session_internal();
|
|
373450
|
-
|
|
374299
|
+
TE63 = new TextEncoder;
|
|
373451
374300
|
MC_PREFIX_LIST_ATTRIBUTES = new Set(["Ignorable", "MustUnderstand"]);
|
|
373452
374301
|
MC_QNAME_LIST_ATTRIBUTES = new Set(["PreserveElements", "PreserveAttributes", "ProcessContent"]);
|
|
373453
374302
|
EXACT_ROW_UNSAFE_REVISION_LOCAL_NAMES2 = new Set([
|
|
@@ -373501,7 +374350,7 @@ function read(xml) {
|
|
|
373501
374350
|
children2.push(range);
|
|
373502
374351
|
cursor = range.end;
|
|
373503
374352
|
}
|
|
373504
|
-
const bytes =
|
|
374353
|
+
const bytes = TE64.encode(xml);
|
|
373505
374354
|
const byteOffsets = buildUtf8ByteOffsetTable(xml);
|
|
373506
374355
|
const tables2 = buildTableCatalog({ bytes, storyId: STORY }).tables;
|
|
373507
374356
|
if (tables2.some((table) => table.containsNestedTable || !table.isRectangular || table.hasVMerge || table.hasGridSpan))
|
|
@@ -373623,11 +374472,11 @@ function buildTrackedTableBlockReplayPlan(input) {
|
|
|
373623
374472
|
bodyOperations: input.bodyOperations.filter((operation) => !ownedIds.has(operation.blockId))
|
|
373624
374473
|
};
|
|
373625
374474
|
}
|
|
373626
|
-
var W21 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", W146 = "http://schemas.microsoft.com/office/word/2010/wordml", STORY = "body:/word/document.xml",
|
|
374475
|
+
var W21 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", W146 = "http://schemas.microsoft.com/office/word/2010/wordml", STORY = "body:/word/document.xml", TE64, paragraphId2 = (range) => range.tag.attributes.find((attr3) => attr3.namespaceUri === W146 && attr3.localName === "paraId")?.value;
|
|
373627
374476
|
var init_tracked_table_block_replay = __esm(() => {
|
|
373628
374477
|
init_sd_document_session_internal();
|
|
373629
374478
|
init_tracked_table_row_replay();
|
|
373630
|
-
|
|
374479
|
+
TE64 = new TextEncoder;
|
|
373631
374480
|
});
|
|
373632
374481
|
|
|
373633
374482
|
// ../../../v2/document-api-v2-adapter/dist/diff/comments-replay.js
|
|
@@ -373679,7 +374528,7 @@ function validateDiffCommentSource(source, snapshot2, label) {
|
|
|
373679
374528
|
return problems;
|
|
373680
374529
|
}
|
|
373681
374530
|
function digest5(value2) {
|
|
373682
|
-
return sha256HexSync(
|
|
374531
|
+
return sha256HexSync(TE65.encode(value2));
|
|
373683
374532
|
}
|
|
373684
374533
|
function commentContentSignature(record3) {
|
|
373685
374534
|
return digest5(`body:${record3.bodyText}#author:${record3.author}#parent:${record3.parentParaId ?? ""}` + `#done:${record3.doneState ? "1" : "0"}#date:${record3.date ?? ""}` + `#anchor:${commentAnchorSignature2(record3.anchor)}`);
|
|
@@ -374027,12 +374876,12 @@ function isResolutionSidecarAddition(key2, targetEntry) {
|
|
|
374027
374876
|
if (!targetEntry)
|
|
374028
374877
|
return false;
|
|
374029
374878
|
if (key2 === "ct:override:/word/commentsExtended.xml") {
|
|
374030
|
-
return targetEntry.semanticKey === key2 && targetEntry.contentSignature === sha256HexSync(
|
|
374879
|
+
return targetEntry.semanticKey === key2 && targetEntry.contentSignature === sha256HexSync(TE65.encode("override:/word/commentsExtended.xml=" + "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"));
|
|
374031
374880
|
}
|
|
374032
374881
|
if (!key2.startsWith("rel:/word/document.xml|"))
|
|
374033
374882
|
return false;
|
|
374034
374883
|
const type = "http://schemas.microsoft.com/office/2011/relationships/commentsExtended";
|
|
374035
|
-
return targetEntry.semanticKey === `/word/document.xml|${type}` && targetEntry.contentSignature === sha256HexSync(
|
|
374884
|
+
return targetEntry.semanticKey === `/word/document.xml|${type}` && targetEntry.contentSignature === sha256HexSync(TE65.encode(`type:${type}#mode:Internal#target:/word/commentsExtended.xml`));
|
|
374036
374885
|
}
|
|
374037
374886
|
function isCommentScopedPackageKey(context, key2, presentInBase, hasCommentCreate, targetEntry) {
|
|
374038
374887
|
if (key2.startsWith("ct:")) {
|
|
@@ -374150,14 +374999,14 @@ function validateAnchorResolvable(context, commentId, anchor) {
|
|
|
374150
374999
|
});
|
|
374151
375000
|
return page.hits.length > 0 ? null : `comment "${commentId}" target text was not found`;
|
|
374152
375001
|
}
|
|
374153
|
-
var
|
|
375002
|
+
var TE65;
|
|
374154
375003
|
var init_comments_replay = __esm(() => {
|
|
374155
375004
|
init_sd_document_session_internal();
|
|
374156
375005
|
init_read();
|
|
374157
375006
|
init_collect_text_page();
|
|
374158
375007
|
init_scope2();
|
|
374159
375008
|
init_part_fingerprint();
|
|
374160
|
-
|
|
375009
|
+
TE65 = new TextEncoder;
|
|
374161
375010
|
});
|
|
374162
375011
|
|
|
374163
375012
|
// ../../../v2/document-api-v2-adapter/dist/diff/styles-replay.js
|
|
@@ -374295,8 +375144,8 @@ function snapshotNumberingInventory(snapshot2) {
|
|
|
374295
375144
|
return snapshot2.sourceInventory?.families.find((f) => f.family === "numbering") ?? null;
|
|
374296
375145
|
}
|
|
374297
375146
|
function capturedNumberingFingerprint(xml) {
|
|
374298
|
-
const partHash = sha256HexSync(
|
|
374299
|
-
return `fp:${sha256HexSync(
|
|
375147
|
+
const partHash = sha256HexSync(TE66.encode(xml));
|
|
375148
|
+
return `fp:${sha256HexSync(TE66.encode(`${NUMBERING_PART_URI}:${partHash}`))}`;
|
|
374300
375149
|
}
|
|
374301
375150
|
function validateNumberingSourceAgainstSnapshot(source, snapshot2, label) {
|
|
374302
375151
|
const problems = [];
|
|
@@ -374339,12 +375188,12 @@ function validateNumberingSourceAgainstSnapshot(source, snapshot2, label) {
|
|
|
374339
375188
|
}
|
|
374340
375189
|
return problems;
|
|
374341
375190
|
}
|
|
374342
|
-
var TD110,
|
|
375191
|
+
var TD110, TE66;
|
|
374343
375192
|
var init_numbering_replay = __esm(() => {
|
|
374344
375193
|
init_sd_document_session_internal();
|
|
374345
375194
|
init_definitions();
|
|
374346
375195
|
TD110 = new TextDecoder("utf-8", { fatal: false });
|
|
374347
|
-
|
|
375196
|
+
TE66 = new TextEncoder;
|
|
374348
375197
|
});
|
|
374349
375198
|
|
|
374350
375199
|
// ../../../v2/document-api-v2-adapter/dist/diff/settings-replay.js
|
|
@@ -374399,7 +375248,7 @@ function hasSettingsRoot(xml) {
|
|
|
374399
375248
|
});
|
|
374400
375249
|
parser.on("opentag", (tag) => {
|
|
374401
375250
|
if (rootCount === 0) {
|
|
374402
|
-
if (tag.namespaceUri !==
|
|
375251
|
+
if (tag.namespaceUri !== W_NS8 && tag.namespaceUri !== STRICT_W_NS || tag.localName !== "settings")
|
|
374403
375252
|
valid = false;
|
|
374404
375253
|
rootCount++;
|
|
374405
375254
|
}
|
|
@@ -374412,7 +375261,7 @@ function hasSettingsRoot(xml) {
|
|
|
374412
375261
|
}
|
|
374413
375262
|
return valid && rootCount === 1;
|
|
374414
375263
|
}
|
|
374415
|
-
var SETTINGS_PART_URI5 = "/word/settings.xml",
|
|
375264
|
+
var SETTINGS_PART_URI5 = "/word/settings.xml", W_NS8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", STRICT_W_NS = "http://purl.oclc.org/ooxml/wordprocessingml/main", TD111;
|
|
374416
375265
|
var init_settings_replay = __esm(() => {
|
|
374417
375266
|
init_sd_document_session_internal();
|
|
374418
375267
|
init_definitions();
|
|
@@ -374511,7 +375360,7 @@ function paragraphStyleOutlineLevelsFromStylesSource(stylesXml) {
|
|
|
374511
375360
|
return stylesXml == null ? new Map : parseParagraphStyleOutlineLevels(stylesXml);
|
|
374512
375361
|
}
|
|
374513
375362
|
function projectMainDocumentBodyEntries(source, options = {}) {
|
|
374514
|
-
const bytes =
|
|
375363
|
+
const bytes = TE67.encode(source.xml);
|
|
374515
375364
|
const paragraphStyleOutlineLevels = options.paragraphStyleOutlineLevels ?? paragraphStyleOutlineLevelMap(source.paragraphStyleOutlineLevels);
|
|
374516
375365
|
const paragraphIndex = buildParagraphIndex({
|
|
374517
375366
|
bytes,
|
|
@@ -374560,14 +375409,14 @@ function paragraphStyleOutlineLevelMap(record3) {
|
|
|
374560
375409
|
function capturedMainDocumentFingerprint(xml) {
|
|
374561
375410
|
return comparePartXmlFingerprint(MAIN_DOCUMENT_PART_URI, xml);
|
|
374562
375411
|
}
|
|
374563
|
-
var TD112,
|
|
375412
|
+
var TD112, TE67, MAIN_DOCUMENT_PART_URI = "/word/document.xml", MAIN_DOCUMENT_STORY_ID = "body:/word/document.xml", SNAPSHOT_REVISION = "snapshot";
|
|
374564
375413
|
var init_main_document_source = __esm(() => {
|
|
374565
375414
|
init_sd_document_session_internal();
|
|
374566
375415
|
init_document_reader();
|
|
374567
375416
|
init_run_signature2();
|
|
374568
375417
|
init_part_fingerprint();
|
|
374569
375418
|
TD112 = new TextDecoder("utf-8", { fatal: false });
|
|
374570
|
-
|
|
375419
|
+
TE67 = new TextEncoder;
|
|
374571
375420
|
});
|
|
374572
375421
|
|
|
374573
375422
|
// ../../../v2/document-api-v2-adapter/dist/diff/payloads.js
|
|
@@ -377810,7 +378659,7 @@ class V2DiffAdapter {
|
|
|
377810
378659
|
family: "tables",
|
|
377811
378660
|
partUri: DOCUMENT_PART_URI6,
|
|
377812
378661
|
kind: "modify",
|
|
377813
|
-
nextBytes:
|
|
378662
|
+
nextBytes: TE68.encode(step3.nextXml)
|
|
377814
378663
|
}));
|
|
377815
378664
|
const packageRewrites = [
|
|
377816
378665
|
...slotPlan.rewrites,
|
|
@@ -378398,7 +379247,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
378398
379247
|
family: "styles",
|
|
378399
379248
|
partUri: step3.partUri,
|
|
378400
379249
|
kind: "modify",
|
|
378401
|
-
nextBytes:
|
|
379250
|
+
nextBytes: TE68.encode(step3.nextXml)
|
|
378402
379251
|
});
|
|
378403
379252
|
}
|
|
378404
379253
|
for (const step3 of numberingSteps) {
|
|
@@ -378408,7 +379257,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
378408
379257
|
family: "numbering",
|
|
378409
379258
|
partUri: NUMBERING_PART_URI4,
|
|
378410
379259
|
kind: "modify",
|
|
378411
|
-
nextBytes:
|
|
379260
|
+
nextBytes: TE68.encode(step3.nextXml)
|
|
378412
379261
|
});
|
|
378413
379262
|
}
|
|
378414
379263
|
for (const step3 of settingsSteps) {
|
|
@@ -378416,7 +379265,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
378416
379265
|
family: "settings",
|
|
378417
379266
|
partUri: step3.partUri,
|
|
378418
379267
|
kind: "modify",
|
|
378419
|
-
nextBytes:
|
|
379268
|
+
nextBytes: TE68.encode(step3.nextXml)
|
|
378420
379269
|
});
|
|
378421
379270
|
}
|
|
378422
379271
|
return rewrites;
|
|
@@ -379388,7 +380237,7 @@ function stripRootReplayNamespaceDeclarations(xml) {
|
|
|
379388
380237
|
const openEnd = xml.indexOf(">") + 1;
|
|
379389
380238
|
return stripReplayNamespaceDeclarations(xml.slice(0, openEnd)) + xml.slice(openEnd);
|
|
379390
380239
|
}
|
|
379391
|
-
var FULL_DIFF_APPLY_SUPPORTED_FAMILIES,
|
|
380240
|
+
var FULL_DIFF_APPLY_SUPPORTED_FAMILIES, TE68, TD114, DOCUMENT_PART_URI6 = "/word/document.xml", NUMBERING_PART_URI4 = "/word/numbering.xml", EMPTY_MAIN_DOCUMENT_SOURCE, WORDPROCESSINGML_NS7 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", WORDPROCESSINGML_2010_NS2 = "http://schemas.microsoft.com/office/word/2010/wordml", WORDPROCESSING_MATH_NS = "http://schemas.openxmlformats.org/officeDocument/2006/math", MARKUP_COMPATIBILITY_NS3 = "http://schemas.openxmlformats.org/markup-compatibility/2006", VML_NS = "urn:schemas-microsoft-com:vml", STRUCTURAL_PARA_EDIT_DELETE_WML_NAMES, STRUCTURAL_PARA_EDIT_DELETE_MATH_NAMES, STRUCTURAL_PARA_FORMAT_EDIT_WML_NAMES;
|
|
379392
380241
|
var init_adapter25 = __esm(() => {
|
|
379393
380242
|
init_tracked_table_property_replay();
|
|
379394
380243
|
init_src2();
|
|
@@ -379428,7 +380277,7 @@ var init_adapter25 = __esm(() => {
|
|
|
379428
380277
|
"fields-references",
|
|
379429
380278
|
"tracked-changes"
|
|
379430
380279
|
]);
|
|
379431
|
-
|
|
380280
|
+
TE68 = new TextEncoder;
|
|
379432
380281
|
TD114 = new TextDecoder;
|
|
379433
380282
|
EMPTY_MAIN_DOCUMENT_SOURCE = { xml: "" };
|
|
379434
380283
|
STRUCTURAL_PARA_EDIT_DELETE_WML_NAMES = new Set([
|
|
@@ -381196,8 +382045,8 @@ function commitTrackedDefinitionMutation(runtime, abstractNumId, txIdPrefix, mut
|
|
|
381196
382045
|
const id = reference.tag.attributes.find((attr3) => attr3.namespaceUri === WORDPROCESSINGML_NAMESPACE8 && attr3.localName === "val")?.value;
|
|
381197
382046
|
if (!id || !numIds.has(id))
|
|
381198
382047
|
continue;
|
|
381199
|
-
const startByte =
|
|
381200
|
-
const endByte =
|
|
382048
|
+
const startByte = TE69.encode(xml.slice(0, reference.start)).length;
|
|
382049
|
+
const endByte = TE69.encode(xml.slice(0, reference.end)).length;
|
|
381201
382050
|
if (!owners.some((owner) => owner.runtime.partUri === partUri && owner.paragraph.byteStart < startByte && owner.paragraph.byteEnd > endByte)) {
|
|
381202
382051
|
return { ok: false, code: "CAPABILITY_UNAVAILABLE", message: "Tracked shared numbering has an owner outside the editable paragraph stories." };
|
|
381203
382052
|
}
|
|
@@ -381607,7 +382456,7 @@ function commitLocalizedRuntimeMutation(input) {
|
|
|
381607
382456
|
paraId: edit.paraId,
|
|
381608
382457
|
startByte: paragraph4.byteStart,
|
|
381609
382458
|
endByte: paragraph4.byteEnd,
|
|
381610
|
-
bytes: edit.replacementXml === null ? new Uint8Array :
|
|
382459
|
+
bytes: edit.replacementXml === null ? new Uint8Array : TE69.encode(edit.replacementXml)
|
|
381611
382460
|
};
|
|
381612
382461
|
}).filter((row) => row !== null).sort((left, right) => left.startByte - right.startByte);
|
|
381613
382462
|
if (patchRows.length !== input.documentEdits.length || patchRows.length === 0) {
|
|
@@ -381654,7 +382503,7 @@ function commitLocalizedRuntimeMutation(input) {
|
|
|
381654
382503
|
order: 0,
|
|
381655
382504
|
startByte: 0,
|
|
381656
382505
|
endByte: currentBytes.length,
|
|
381657
|
-
bytes:
|
|
382506
|
+
bytes: TE69.encode(serializeNumberingDocument(input.nextNumbering))
|
|
381658
382507
|
}]
|
|
381659
382508
|
};
|
|
381660
382509
|
}
|
|
@@ -381706,7 +382555,7 @@ function applyParagraphEdits(currentBytes, paragraphs, edits) {
|
|
|
381706
382555
|
return {
|
|
381707
382556
|
startByte: paragraph4.byteStart,
|
|
381708
382557
|
endByte: paragraph4.byteEnd,
|
|
381709
|
-
bytes: edit.replacementXml === null ? new Uint8Array :
|
|
382558
|
+
bytes: edit.replacementXml === null ? new Uint8Array : TE69.encode(edit.replacementXml)
|
|
381710
382559
|
};
|
|
381711
382560
|
}).filter((entry) => entry !== null).sort((left, right) => left.startByte - right.startByte);
|
|
381712
382561
|
const chunks = [];
|
|
@@ -382263,7 +383112,7 @@ function escapeForRegex2(value2) {
|
|
|
382263
383112
|
function createEmptyLevelXml(level, prefix = "w") {
|
|
382264
383113
|
return `<${prefix}:lvl w:ilvl="${level}"></${prefix}:lvl>`;
|
|
382265
383114
|
}
|
|
382266
|
-
var NUMBERING_PART_URI5 = "/word/numbering.xml", WORDPROCESSINGML_NAMESPACE8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
383115
|
+
var NUMBERING_PART_URI5 = "/word/numbering.xml", WORDPROCESSINGML_NAMESPACE8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TE69, TD115;
|
|
382267
383116
|
var init_runtime3 = __esm(() => {
|
|
382268
383117
|
init_src3();
|
|
382269
383118
|
init_sd_document_session_internal();
|
|
@@ -382273,7 +383122,7 @@ var init_runtime3 = __esm(() => {
|
|
|
382273
383122
|
init_xml();
|
|
382274
383123
|
init_xml_rewrite();
|
|
382275
383124
|
init_tracked_sequence_edits();
|
|
382276
|
-
|
|
383125
|
+
TE69 = new TextEncoder;
|
|
382277
383126
|
TD115 = new TextDecoder;
|
|
382278
383127
|
});
|
|
382279
383128
|
|
|
@@ -384328,7 +385177,7 @@ function resolveStoryIdForParagraphInStory(context, paraId, story) {
|
|
|
384328
385177
|
const storyId = resolveStoryIdForListRange(context, story);
|
|
384329
385178
|
if (!storyId)
|
|
384330
385179
|
return null;
|
|
384331
|
-
const entry =
|
|
385180
|
+
const entry = paragraphIndexForStory3(context, storyId)?.byParaId(paraId) ?? null;
|
|
384332
385181
|
return entry?.storyId === storyId ? storyId : null;
|
|
384333
385182
|
}
|
|
384334
385183
|
function resolveStoryIdForListRange(context, story) {
|
|
@@ -384402,7 +385251,7 @@ function resolveParagraphIdsForTarget(context, target) {
|
|
|
384402
385251
|
const toEntry = findParagraphEntry(context, toId);
|
|
384403
385252
|
if (!fromEntry || !toEntry || fromEntry.storyId !== toEntry.storyId)
|
|
384404
385253
|
return [];
|
|
384405
|
-
const index2 =
|
|
385254
|
+
const index2 = paragraphIndexForStory3(context, fromEntry.storyId);
|
|
384406
385255
|
if (!index2)
|
|
384407
385256
|
return [];
|
|
384408
385257
|
const start = index2.entries.findIndex((entry) => entry.blockId === fromId);
|
|
@@ -384807,7 +385656,7 @@ function findPreviousListItemId(context, paraId) {
|
|
|
384807
385656
|
const storyId = resolveStoryIdForParagraph(context, paraId);
|
|
384808
385657
|
if (!storyId)
|
|
384809
385658
|
return null;
|
|
384810
|
-
const index2 =
|
|
385659
|
+
const index2 = paragraphIndexForStory3(context, storyId);
|
|
384811
385660
|
if (!index2)
|
|
384812
385661
|
return null;
|
|
384813
385662
|
const targetIndex = index2.entries.findIndex((entry) => entry.blockId === paraId && entry.storyId === storyId);
|
|
@@ -384841,7 +385690,7 @@ function compatibleMergeParaIds(context, storyId, paraIds, options) {
|
|
|
384841
385690
|
const authorName = tracked ? readTrackedAuthor(context).name : "";
|
|
384842
385691
|
if (tracked && authorName.length === 0)
|
|
384843
385692
|
return [];
|
|
384844
|
-
const index2 =
|
|
385693
|
+
const index2 = paragraphIndexForStory3(context, storyId);
|
|
384845
385694
|
if (!index2)
|
|
384846
385695
|
return [];
|
|
384847
385696
|
for (const paraId of paraIds) {
|
|
@@ -384862,7 +385711,7 @@ function compatibleMergeParaIds(context, storyId, paraIds, options) {
|
|
|
384862
385711
|
return paraIds;
|
|
384863
385712
|
}
|
|
384864
385713
|
function findImmediatelyAdjacentCompatibleListReuse(context, storyId, paraIds, seed, ilvl, requestedPreset) {
|
|
384865
|
-
const index2 =
|
|
385714
|
+
const index2 = paragraphIndexForStory3(context, storyId);
|
|
384866
385715
|
if (!index2 || paraIds.length === 0)
|
|
384867
385716
|
return;
|
|
384868
385717
|
const targetIndexes = paraIds.map((paraId) => index2.entries.findIndex((entry) => entry.blockId === paraId && entry.storyId === storyId));
|
|
@@ -384995,7 +385844,7 @@ function canReuseAdjacentListDefinition(context, definitionNumId, abstractNumId,
|
|
|
384995
385844
|
}
|
|
384996
385845
|
return Array.from(abstract.levels.values()).every((level) => !level.isLgl && !/\blgl\b/i.test(level.numFmt));
|
|
384997
385846
|
}
|
|
384998
|
-
function
|
|
385847
|
+
function paragraphIndexForStory3(context, storyId) {
|
|
384999
385848
|
return getSDDocumentSessionInternalStoryParagraphIndex(context.session, storyId);
|
|
385000
385849
|
}
|
|
385001
385850
|
function findParagraphEntry(context, paraId) {
|
|
@@ -386491,7 +387340,7 @@ function detectTargetConflicts(context, steps, failures) {
|
|
|
386491
387340
|
const key2 = `${storyKeyForTarget(target)}::${target.blockId}`;
|
|
386492
387341
|
const { from, to } = conflictRangeForResolution(context, step3, resolution);
|
|
386493
387342
|
for (const prior of claimedByKey.get(key2) ?? []) {
|
|
386494
|
-
if (
|
|
387343
|
+
if (rangesOverlap11(from, to, prior.from, prior.to)) {
|
|
386495
387344
|
failures.push({
|
|
386496
387345
|
code: "PLAN_CONFLICT_OVERLAP",
|
|
386497
387346
|
stepId: step3.stepId,
|
|
@@ -387487,7 +388336,7 @@ function paragraphOrdinalForTarget(context, target) {
|
|
|
387487
388336
|
const index2 = isMainStoryId(story.storyId) ? getSDDocumentSessionInternalParagraphIndex(context.session) : getSDDocumentSessionInternalStoryParagraphIndex(context.session, story.storyId);
|
|
387488
388337
|
return index2?.byParaId(target.blockId)?.ordinal ?? -1;
|
|
387489
388338
|
}
|
|
387490
|
-
function
|
|
388339
|
+
function rangesOverlap11(start, end, otherStart, otherEnd) {
|
|
387491
388340
|
return start < otherEnd && end > otherStart;
|
|
387492
388341
|
}
|
|
387493
388342
|
function elapsed(startedAt) {
|
|
@@ -389156,7 +390005,7 @@ class V2HyperlinksAdapter {
|
|
|
389156
390005
|
if (!paragraph4) {
|
|
389157
390006
|
return mutationFailure4("TARGET_NOT_FOUND", `Block "${resolved.startBlockId}" was not found.`);
|
|
389158
390007
|
}
|
|
389159
|
-
const existingOverlap = readBodyHyperlinkEntries(this.context).some((entry) => entry.address.anchor.start.blockId === paragraph4.blockId &&
|
|
390008
|
+
const existingOverlap = readBodyHyperlinkEntries(this.context).some((entry) => entry.address.anchor.start.blockId === paragraph4.blockId && rangesOverlap12(entry.address.anchor.start.offset, entry.address.anchor.end.offset, resolved.startOffset, resolved.endOffset));
|
|
389160
390009
|
if (existingOverlap) {
|
|
389161
390010
|
return mutationFailure4("INVALID_TARGET", "hyperlinks.wrap does not support ranges that overlap an existing hyperlink.");
|
|
389162
390011
|
}
|
|
@@ -389485,7 +390334,7 @@ class V2HyperlinksAdapter {
|
|
|
389485
390334
|
after: {
|
|
389486
390335
|
partUri: entry.partUri,
|
|
389487
390336
|
startByte: entry.descriptor.byteStart,
|
|
389488
|
-
endByte: entry.descriptor.byteEnd +
|
|
390337
|
+
endByte: entry.descriptor.byteEnd + TE70.encode(nextHyperlinkXml).length - TE70.encode(hyperlinkXml).length
|
|
389489
390338
|
},
|
|
389490
390339
|
...input.patch.rel !== undefined ? { rel: input.patch.rel } : {}
|
|
389491
390340
|
}],
|
|
@@ -389767,7 +390616,7 @@ function hyperlinkSessionAnchor(partUri, descriptor) {
|
|
|
389767
390616
|
}
|
|
389768
390617
|
function createdHyperlinkAnchor(paragraph4, nextParagraphXml, nextDocumentXml, start, end) {
|
|
389769
390618
|
const catalog = buildHyperlinkCatalog({
|
|
389770
|
-
bytes:
|
|
390619
|
+
bytes: TE70.encode(nextDocumentXml),
|
|
389771
390620
|
storyId: paragraph4.storyId,
|
|
389772
390621
|
partUri: paragraph4.partUri,
|
|
389773
390622
|
relsBytes: null
|
|
@@ -389988,7 +390837,7 @@ function operationError12(code2, message, operationId) {
|
|
|
389988
390837
|
error48.details = { operationId };
|
|
389989
390838
|
return error48;
|
|
389990
390839
|
}
|
|
389991
|
-
function
|
|
390840
|
+
function rangesOverlap12(startA, endA, startB, endB) {
|
|
389992
390841
|
return startA < endB && startB < endA;
|
|
389993
390842
|
}
|
|
389994
390843
|
function relsPartUriForPart2(partUri) {
|
|
@@ -390092,7 +390941,7 @@ function escapeRegex15(value2) {
|
|
|
390092
390941
|
function defaultRelationshipsXml3() {
|
|
390093
390942
|
return '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
390094
390943
|
}
|
|
390095
|
-
var HYPERLINK_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", TD120,
|
|
390944
|
+
var HYPERLINK_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", TD120, TE70;
|
|
390096
390945
|
var init_adapter34 = __esm(() => {
|
|
390097
390946
|
init_sd_document_session_internal();
|
|
390098
390947
|
init_inline();
|
|
@@ -390103,7 +390952,7 @@ var init_adapter34 = __esm(() => {
|
|
|
390103
390952
|
init_stories();
|
|
390104
390953
|
init_registry3();
|
|
390105
390954
|
TD120 = new TextDecoder;
|
|
390106
|
-
|
|
390955
|
+
TE70 = new TextEncoder;
|
|
390107
390956
|
});
|
|
390108
390957
|
|
|
390109
390958
|
// ../../../v2/document-api-v2-adapter/dist/watermarks/serialization.js
|
|
@@ -394298,75 +395147,6 @@ var init_parse5 = __esm(() => {
|
|
|
394298
395147
|
init_plan3();
|
|
394299
395148
|
});
|
|
394300
395149
|
|
|
394301
|
-
// ../../../v2/document-api-v2-adapter/dist/selection/footnote-range.js
|
|
394302
|
-
function resolveFootnoteRangeIndex(session, index2, start, end) {
|
|
394303
|
-
if (start.story.storyType !== "footnote" || end.story.storyType !== "footnote")
|
|
394304
|
-
return null;
|
|
394305
|
-
const main = getSDDocumentSessionInternalSourceSignalsSnapshot(session)?.stories.find((story) => story.storyKind === "main");
|
|
394306
|
-
const bytes = getSDDocumentSessionInternalPartBytes(session, FOOTNOTES_PART_URI3);
|
|
394307
|
-
if (!main || main.completeness.noteAnchorRefs !== "complete" || !bytes)
|
|
394308
|
-
return null;
|
|
394309
|
-
const xml = new TextDecoder().decode(bytes);
|
|
394310
|
-
const parsed = collectXmlElementRanges(xml);
|
|
394311
|
-
if (parsed.errors.length)
|
|
394312
|
-
return null;
|
|
394313
|
-
const notes = parsed.ranges.filter(({ tag }) => tag.namespaceUri === W_NS8 && tag.localName === "footnote").sort((a, b) => a.start - b.start);
|
|
394314
|
-
const sourceEntries = [...index2.entries].sort((a, b) => a.byteStart - b.byteStart);
|
|
394315
|
-
const groups = new Map;
|
|
394316
|
-
let charCursor = 0;
|
|
394317
|
-
let byteCursor = bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191 ? 3 : 0;
|
|
394318
|
-
let entryCursor = 0;
|
|
394319
|
-
for (const note of notes) {
|
|
394320
|
-
const id = readXmlAttributes(note.tag, W_NS8, "id")[0]?.value;
|
|
394321
|
-
if (!id || groups.has(id))
|
|
394322
|
-
return null;
|
|
394323
|
-
byteCursor += TE70.encode(xml.slice(charCursor, note.start)).byteLength;
|
|
394324
|
-
const byteStart = byteCursor;
|
|
394325
|
-
byteCursor += TE70.encode(xml.slice(note.start, note.end)).byteLength;
|
|
394326
|
-
charCursor = note.end;
|
|
394327
|
-
const group = [];
|
|
394328
|
-
while (entryCursor < sourceEntries.length && sourceEntries[entryCursor].byteStart < byteCursor) {
|
|
394329
|
-
const entry = sourceEntries[entryCursor++];
|
|
394330
|
-
if (entry.byteStart >= byteStart && entry.byteEnd <= byteCursor)
|
|
394331
|
-
group.push(entry);
|
|
394332
|
-
}
|
|
394333
|
-
groups.set(id, group);
|
|
394334
|
-
}
|
|
394335
|
-
const entries = [];
|
|
394336
|
-
const seen = new Set;
|
|
394337
|
-
let startOwned = false;
|
|
394338
|
-
let endOwned = false;
|
|
394339
|
-
const references = [...main.noteAnchorRefs].sort((a, b) => (a.bodyChildOrdinal ?? 0) - (b.bodyChildOrdinal ?? 0) || (a.sourceAnchor.stability === "byte-span" ? a.sourceAnchor.byteSpan[0] : 0) - (b.sourceAnchor.stability === "byte-span" ? b.sourceAnchor.byteSpan[0] : 0));
|
|
394340
|
-
for (const ref5 of references) {
|
|
394341
|
-
if (ref5.kind !== "footnote" || !ref5.nativeId || ref5.trackedChangeState === "deleted" || ref5.trackedChangeState === "move-from" || seen.has(ref5.nativeId))
|
|
394342
|
-
continue;
|
|
394343
|
-
seen.add(ref5.nativeId);
|
|
394344
|
-
const group = groups.get(ref5.nativeId);
|
|
394345
|
-
if (!group)
|
|
394346
|
-
return null;
|
|
394347
|
-
for (const entry of group) {
|
|
394348
|
-
startOwned || (startOwned = ref5.nativeId === start.story.noteId && entry.blockId === start.blockId);
|
|
394349
|
-
endOwned || (endOwned = ref5.nativeId === end.story.noteId && entry.blockId === end.blockId);
|
|
394350
|
-
entries.push({ ...entry, ordinal: entries.length });
|
|
394351
|
-
}
|
|
394352
|
-
}
|
|
394353
|
-
if (!startOwned || !endOwned)
|
|
394354
|
-
return null;
|
|
394355
|
-
const byBlockId = new Map(entries.map((entry) => [entry.blockId, entry]));
|
|
394356
|
-
return {
|
|
394357
|
-
entries,
|
|
394358
|
-
duplicateParaIds: index2.duplicateParaIds,
|
|
394359
|
-
entriesByBlockId: byBlockId,
|
|
394360
|
-
byParaId: (blockId) => byBlockId.get(blockId) ?? null
|
|
394361
|
-
};
|
|
394362
|
-
}
|
|
394363
|
-
var W_NS8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TE70;
|
|
394364
|
-
var init_footnote_range = __esm(() => {
|
|
394365
|
-
init_sd_document_session_internal();
|
|
394366
|
-
init_note_story();
|
|
394367
|
-
TE70 = new TextEncoder;
|
|
394368
|
-
});
|
|
394369
|
-
|
|
394370
395150
|
// ../../../v2/document-api-v2-adapter/dist/clipboard/serialize.js
|
|
394371
395151
|
class SelectionHyperlinkDescriptorResolver {
|
|
394372
395152
|
constructor(context, storyId) {
|
|
@@ -394855,7 +395635,7 @@ function serializeSelectedDrawing(input) {
|
|
|
394855
395635
|
return fail6("inline-object", "Inline objects (drawings, pictures, embedded objects) are not preserved by copy.");
|
|
394856
395636
|
if (/<[\w.-]+:srcRect\b/.test(xml))
|
|
394857
395637
|
return fail6("cropped-image", "Cropped images are not preserved by copy.");
|
|
394858
|
-
const rId =
|
|
395638
|
+
const rId = readXmlAttribute6(xml, "blip", "embed", "r");
|
|
394859
395639
|
if (!rId)
|
|
394860
395640
|
return fail6("inline-object", "Inline objects (drawings, pictures, embedded objects) are not preserved by copy.");
|
|
394861
395641
|
const mediaPartUri = resolveImageRelationship(input.context, input.storyPartUri, rId);
|
|
@@ -394946,9 +395726,9 @@ function clampImageDimension(value2) {
|
|
|
394946
395726
|
return Math.max(1, Math.min(1e4, Number.isFinite(value2) ? value2 : 1));
|
|
394947
395727
|
}
|
|
394948
395728
|
function boundedAttribute(xml, tag, attribute2) {
|
|
394949
|
-
return
|
|
395729
|
+
return readXmlAttribute6(xml, tag, attribute2)?.slice(0, MAX_IMAGE_METADATA_CHARS) || undefined;
|
|
394950
395730
|
}
|
|
394951
|
-
function
|
|
395731
|
+
function readXmlAttribute6(xml, tag, attribute2, prefix) {
|
|
394952
395732
|
const open2 = new RegExp(`<[\\w.-]+:${tag}\\b[^>]*>`).exec(xml)?.[0];
|
|
394953
395733
|
return open2 ? readBareAttribute(open2, prefix ? `${prefix}:${attribute2}` : attribute2) : null;
|
|
394954
395734
|
}
|
|
@@ -401166,538 +401946,6 @@ var init_prepared_mutation2 = __esm(() => {
|
|
|
401166
401946
|
]);
|
|
401167
401947
|
});
|
|
401168
401948
|
|
|
401169
|
-
// ../../../v2/document-api-v2-adapter/dist/selection/live-selection.js
|
|
401170
|
-
function distinctFootnotes(start, end) {
|
|
401171
|
-
return start.storyType === "footnote" && end.storyType === "footnote" && start.noteId !== end.noteId;
|
|
401172
|
-
}
|
|
401173
|
-
function buildVisibleSelectionTarget(story, start, end) {
|
|
401174
|
-
return {
|
|
401175
|
-
kind: "selection",
|
|
401176
|
-
start: { kind: "text", blockId: start.blockId, offset: start.offset, story: start.story ?? story },
|
|
401177
|
-
end: { kind: "text", blockId: end.blockId, offset: end.offset, story: end.story ?? story },
|
|
401178
|
-
...distinctFootnotes(start.story ?? story, end.story ?? story) ? {} : { story }
|
|
401179
|
-
};
|
|
401180
|
-
}
|
|
401181
|
-
function buildSelectionTarget(session, story, start, end, entries) {
|
|
401182
|
-
const hasTrackedEndpoint = start.trackedOffset != null || end.trackedOffset != null;
|
|
401183
|
-
if (!hasTrackedEndpoint)
|
|
401184
|
-
return buildVisibleSelectionTarget(story, start, end);
|
|
401185
|
-
const startEntry = entries[0];
|
|
401186
|
-
const endEntry = entries[entries.length - 1];
|
|
401187
|
-
if (!startEntry || !endEntry)
|
|
401188
|
-
return null;
|
|
401189
|
-
const startMap = readParagraphInlineMap(session, startEntry);
|
|
401190
|
-
const endMap = startEntry === endEntry ? startMap : readParagraphInlineMap(session, endEntry);
|
|
401191
|
-
if (!startMap || !endMap)
|
|
401192
|
-
return null;
|
|
401193
|
-
const resolvedStart = resolveTrackedSelectionEndpoint(startMap, start, "upstream");
|
|
401194
|
-
const resolvedEnd = resolveTrackedSelectionEndpoint(endMap, end, "downstream");
|
|
401195
|
-
if (resolvedStart == null || resolvedEnd == null) {
|
|
401196
|
-
return null;
|
|
401197
|
-
}
|
|
401198
|
-
const [orderedStart2, orderedEnd] = start.blockId === end.blockId && resolvedEnd < resolvedStart ? [resolvedEnd, resolvedStart] : [resolvedStart, resolvedEnd];
|
|
401199
|
-
return {
|
|
401200
|
-
kind: "selection",
|
|
401201
|
-
start: { kind: "text", blockId: start.blockId, offset: orderedStart2, story: start.story ?? story },
|
|
401202
|
-
end: { kind: "text", blockId: end.blockId, offset: orderedEnd, story: end.story ?? story },
|
|
401203
|
-
...distinctFootnotes(start.story ?? story, end.story ?? story) ? {} : { story },
|
|
401204
|
-
coordinateSpace: "tracked"
|
|
401205
|
-
};
|
|
401206
|
-
}
|
|
401207
|
-
function readParagraphInlineMap(session, entry) {
|
|
401208
|
-
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
401209
|
-
if (!bytes)
|
|
401210
|
-
return null;
|
|
401211
|
-
return parseParagraphInlineMap(TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd)));
|
|
401212
|
-
}
|
|
401213
|
-
function resolveTrackedSelectionEndpoint(map3, point3, bias) {
|
|
401214
|
-
if (point3.trackedOffset != null) {
|
|
401215
|
-
return Number.isInteger(point3.trackedOffset) && point3.trackedOffset >= 0 && point3.trackedOffset <= map3.trackedLength ? point3.trackedOffset : null;
|
|
401216
|
-
}
|
|
401217
|
-
return projectVisibleOffsetToTracked(map3, clampOffset(point3.offset, map3.visibleLength), bias);
|
|
401218
|
-
}
|
|
401219
|
-
function resolveBrowserLiveSelectionParagraphIndex(session, story, startBlockId, endBlockId) {
|
|
401220
|
-
const mainIndex = getSDDocumentSessionInternalParagraphIndex(session);
|
|
401221
|
-
const stories = listSDDocumentSessionInternalStories(session);
|
|
401222
|
-
if (!story || story.storyType === "body") {
|
|
401223
|
-
return hasSelectionBlocks(mainIndex, startBlockId, endBlockId) ? mainIndex : null;
|
|
401224
|
-
}
|
|
401225
|
-
if (story.storyType === "headerFooterPart") {
|
|
401226
|
-
const resolved = getSDDocumentSessionInternalHeaderFooterPartUriForRefId(session, story.refId);
|
|
401227
|
-
if (!resolved)
|
|
401228
|
-
return null;
|
|
401229
|
-
const match = stories.find((candidate2) => candidate2.partUri === resolved.partUri);
|
|
401230
|
-
if (!match)
|
|
401231
|
-
return null;
|
|
401232
|
-
return paragraphIndexForStory3(session, match.storyId, mainIndex);
|
|
401233
|
-
}
|
|
401234
|
-
const candidates = stories.filter((candidate2) => storyCandidateMatches(candidate2, story));
|
|
401235
|
-
for (const candidate2 of candidates) {
|
|
401236
|
-
const index2 = paragraphIndexForStory3(session, candidate2.storyId, mainIndex);
|
|
401237
|
-
if (hasSelectionBlocks(index2, startBlockId, endBlockId))
|
|
401238
|
-
return index2;
|
|
401239
|
-
}
|
|
401240
|
-
return null;
|
|
401241
|
-
}
|
|
401242
|
-
function paragraphIndexForStory3(session, storyId, mainIndex) {
|
|
401243
|
-
if (mainIndex?.entries[0]?.storyId === storyId)
|
|
401244
|
-
return mainIndex;
|
|
401245
|
-
return getSDDocumentSessionInternalStoryParagraphIndex(session, storyId);
|
|
401246
|
-
}
|
|
401247
|
-
function storyCandidateMatches(candidate2, story) {
|
|
401248
|
-
switch (story.storyType) {
|
|
401249
|
-
case "headerFooterSlot":
|
|
401250
|
-
return candidate2.storyKind === story.headerFooterKind;
|
|
401251
|
-
case "footnote":
|
|
401252
|
-
return candidate2.storyKind === "footnotes";
|
|
401253
|
-
case "endnote":
|
|
401254
|
-
return candidate2.storyKind === "endnotes";
|
|
401255
|
-
case "textbox":
|
|
401256
|
-
return candidate2.storyKind === "textbox" && candidate2.textboxId === story.textboxId;
|
|
401257
|
-
default:
|
|
401258
|
-
return false;
|
|
401259
|
-
}
|
|
401260
|
-
}
|
|
401261
|
-
function hasSelectionBlocks(index2, startBlockId, endBlockId) {
|
|
401262
|
-
return Boolean(index2?.byParaId(startBlockId) && index2.byParaId(endBlockId));
|
|
401263
|
-
}
|
|
401264
|
-
function clampOffset(offset, textLength) {
|
|
401265
|
-
return Math.max(0, Math.min(textLength, offset));
|
|
401266
|
-
}
|
|
401267
|
-
function resolveEntries(session, input) {
|
|
401268
|
-
let index2 = resolveBrowserLiveSelectionParagraphIndex(session, input.story, input.start.blockId, input.end.blockId);
|
|
401269
|
-
if (!index2)
|
|
401270
|
-
return null;
|
|
401271
|
-
const startStory = input.start.story ?? input.story;
|
|
401272
|
-
const endStory = input.end.story ?? input.story;
|
|
401273
|
-
if (distinctFootnotes(startStory, endStory)) {
|
|
401274
|
-
index2 = resolveFootnoteRangeIndex(session, index2, { blockId: input.start.blockId, story: startStory }, { blockId: input.end.blockId, story: endStory });
|
|
401275
|
-
if (!index2)
|
|
401276
|
-
return null;
|
|
401277
|
-
}
|
|
401278
|
-
if (index2.duplicateParaIds.has(input.start.blockId) || index2.duplicateParaIds.has(input.end.blockId))
|
|
401279
|
-
return null;
|
|
401280
|
-
let startEntry = index2.byParaId(input.start.blockId);
|
|
401281
|
-
let endEntry = index2.byParaId(input.end.blockId);
|
|
401282
|
-
if (!startEntry || !endEntry || startEntry.storyId !== endEntry.storyId)
|
|
401283
|
-
return null;
|
|
401284
|
-
let startPoint = input.start;
|
|
401285
|
-
let endPoint = input.end;
|
|
401286
|
-
if (startEntry.ordinal > endEntry.ordinal) {
|
|
401287
|
-
[startEntry, endEntry] = [endEntry, startEntry];
|
|
401288
|
-
[startPoint, endPoint] = [endPoint, startPoint];
|
|
401289
|
-
}
|
|
401290
|
-
const entries = index2.entries.slice(startEntry.ordinal, endEntry.ordinal + 1);
|
|
401291
|
-
if (entries.length === 0)
|
|
401292
|
-
return null;
|
|
401293
|
-
const visibleStart = resolveVisibleSelectionOffset(session, startEntry, startPoint);
|
|
401294
|
-
const visibleEnd = resolveVisibleSelectionOffset(session, endEntry, endPoint);
|
|
401295
|
-
if (visibleStart == null || visibleEnd == null)
|
|
401296
|
-
return null;
|
|
401297
|
-
const segments = entries.map((entry, idx) => {
|
|
401298
|
-
const start = idx === 0 ? visibleStart : 0;
|
|
401299
|
-
const end = idx === entries.length - 1 ? visibleEnd : entry.textLength;
|
|
401300
|
-
return {
|
|
401301
|
-
blockId: entry.blockId,
|
|
401302
|
-
range: { start, end: Math.max(start, end) }
|
|
401303
|
-
};
|
|
401304
|
-
});
|
|
401305
|
-
return {
|
|
401306
|
-
target: {
|
|
401307
|
-
kind: "text",
|
|
401308
|
-
segments,
|
|
401309
|
-
...input.story ? { story: input.story } : {}
|
|
401310
|
-
},
|
|
401311
|
-
entries,
|
|
401312
|
-
start: startPoint,
|
|
401313
|
-
end: endPoint
|
|
401314
|
-
};
|
|
401315
|
-
}
|
|
401316
|
-
function resolveVisibleSelectionOffset(session, entry, point3) {
|
|
401317
|
-
if (point3.trackedOffset == null)
|
|
401318
|
-
return clampOffset(point3.offset, entry.textLength);
|
|
401319
|
-
const map3 = readParagraphInlineMap(session, entry);
|
|
401320
|
-
return map3 ? projectTrackedOffsetToVisible(map3, point3.trackedOffset) : null;
|
|
401321
|
-
}
|
|
401322
|
-
function resolveBrowserLiveSelectionForSession(session, input, options = {}) {
|
|
401323
|
-
const resolved = resolveEntries(session, input);
|
|
401324
|
-
if (!resolved)
|
|
401325
|
-
return null;
|
|
401326
|
-
const selectionTarget = buildSelectionTarget(session, input.story, resolved.start, resolved.end, resolved.entries);
|
|
401327
|
-
if (!selectionTarget)
|
|
401328
|
-
return null;
|
|
401329
|
-
const reviewIds = readActiveReviewIds(session, resolved.entries, resolved.target.segments, options);
|
|
401330
|
-
return {
|
|
401331
|
-
target: distinctFootnotes(resolved.start.story ?? input.story, resolved.end.story ?? input.story) ? null : resolved.target,
|
|
401332
|
-
selectionTarget,
|
|
401333
|
-
text: input.includeText === true ? readSelectionText(session, resolved.entries, resolved.target.segments) : "",
|
|
401334
|
-
activeMarks: readActiveMarks(session, resolved.entries, resolved.target.segments),
|
|
401335
|
-
activeCommentIds: reviewIds.activeCommentIds,
|
|
401336
|
-
activeChangeIds: reviewIds.activeChangeIds
|
|
401337
|
-
};
|
|
401338
|
-
}
|
|
401339
|
-
function readSelectionText(session, entries, segments) {
|
|
401340
|
-
const slices = [];
|
|
401341
|
-
for (let i2 = 0;i2 < entries.length && i2 < segments.length; i2 += 1) {
|
|
401342
|
-
const entry = entries[i2];
|
|
401343
|
-
const segment = segments[i2];
|
|
401344
|
-
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
401345
|
-
if (!bytes)
|
|
401346
|
-
return "";
|
|
401347
|
-
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
401348
|
-
const paragraphText3 = visibleParagraphTextFromXml(xml);
|
|
401349
|
-
const start = clampOffset(segment.range.start, paragraphText3.length);
|
|
401350
|
-
const end = clampOffset(segment.range.end, paragraphText3.length);
|
|
401351
|
-
slices.push(paragraphText3.slice(start, Math.max(start, end)));
|
|
401352
|
-
}
|
|
401353
|
-
return slices.join(" ");
|
|
401354
|
-
}
|
|
401355
|
-
function readActiveMarks(session, entries, segments) {
|
|
401356
|
-
let common = null;
|
|
401357
|
-
for (let i2 = 0;i2 < entries.length && i2 < segments.length; i2 += 1) {
|
|
401358
|
-
const entry = entries[i2];
|
|
401359
|
-
const segment = segments[i2];
|
|
401360
|
-
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
401361
|
-
if (!bytes)
|
|
401362
|
-
return [];
|
|
401363
|
-
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
401364
|
-
const paragraphText3 = visibleParagraphTextFromXml(xml);
|
|
401365
|
-
const start = clampOffset(segment.range.start, paragraphText3.length);
|
|
401366
|
-
const end = clampOffset(segment.range.end, paragraphText3.length);
|
|
401367
|
-
const marks = new Set(activeMarksForParagraphXmlRange(xml, start, Math.max(start, end)));
|
|
401368
|
-
common = common == null ? marks : intersectStringSets(common, marks);
|
|
401369
|
-
}
|
|
401370
|
-
if (!common)
|
|
401371
|
-
return [];
|
|
401372
|
-
return ACTIVE_MARK_ORDER.filter((mark) => common.has(mark));
|
|
401373
|
-
}
|
|
401374
|
-
function readActiveReviewIds(session, entries, segments, options) {
|
|
401375
|
-
return {
|
|
401376
|
-
activeCommentIds: readActiveCommentIds(session, segments),
|
|
401377
|
-
activeChangeIds: readActiveChangeIds(session, entries, segments, options)
|
|
401378
|
-
};
|
|
401379
|
-
}
|
|
401380
|
-
function readActiveCommentIds(session, segments) {
|
|
401381
|
-
const catalog = getSDDocumentSessionInternalCommentsCatalog(session);
|
|
401382
|
-
if (!catalog)
|
|
401383
|
-
return [];
|
|
401384
|
-
const anchorIndex = getSDDocumentSessionInternalCommentAnchorIndex(session);
|
|
401385
|
-
const ids = [];
|
|
401386
|
-
for (const [sourceWId, hits] of anchorIndex.hitsBySourceWId) {
|
|
401387
|
-
const catalogEntries = catalog.commentsBySourceWId.get(sourceWId);
|
|
401388
|
-
if (!catalogEntries || catalogEntries.length === 0)
|
|
401389
|
-
continue;
|
|
401390
|
-
let overlaps2 = false;
|
|
401391
|
-
for (const hit of hits) {
|
|
401392
|
-
for (const hitSegment of hit.segments) {
|
|
401393
|
-
if (!hitSegment.blockId)
|
|
401394
|
-
continue;
|
|
401395
|
-
const selectionSegment = segments.find((segment) => segment.blockId === hitSegment.blockId);
|
|
401396
|
-
if (!selectionSegment)
|
|
401397
|
-
continue;
|
|
401398
|
-
if (rangesOverlap12(hitSegment.start, hitSegment.end, selectionSegment.range.start, selectionSegment.range.end)) {
|
|
401399
|
-
overlaps2 = true;
|
|
401400
|
-
break;
|
|
401401
|
-
}
|
|
401402
|
-
}
|
|
401403
|
-
if (overlaps2)
|
|
401404
|
-
break;
|
|
401405
|
-
}
|
|
401406
|
-
if (!overlaps2)
|
|
401407
|
-
continue;
|
|
401408
|
-
for (const entry of catalogEntries)
|
|
401409
|
-
pushUnique(ids, entry.commentId);
|
|
401410
|
-
}
|
|
401411
|
-
return ids;
|
|
401412
|
-
}
|
|
401413
|
-
function readActiveChangeIds(session, entries, segments, options) {
|
|
401414
|
-
const activeSourceIds = new Set;
|
|
401415
|
-
for (let i2 = 0;i2 < entries.length && i2 < segments.length; i2 += 1) {
|
|
401416
|
-
const entry = entries[i2];
|
|
401417
|
-
const segment = segments[i2];
|
|
401418
|
-
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
401419
|
-
if (!bytes)
|
|
401420
|
-
return [];
|
|
401421
|
-
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
401422
|
-
const paragraphText3 = visibleParagraphTextFromXml(xml);
|
|
401423
|
-
const start = clampOffset(segment.range.start, paragraphText3.length);
|
|
401424
|
-
const end = clampOffset(segment.range.end, paragraphText3.length);
|
|
401425
|
-
for (const sourceId of activeTrackedChangeSourceIdsForParagraphXmlRange(xml, start, Math.max(start, end))) {
|
|
401426
|
-
activeSourceIds.add(sourceId);
|
|
401427
|
-
}
|
|
401428
|
-
}
|
|
401429
|
-
if (activeSourceIds.size === 0)
|
|
401430
|
-
return [];
|
|
401431
|
-
const resolved = options.resolveTrackChangeIds?.(activeSourceIds);
|
|
401432
|
-
if (resolved)
|
|
401433
|
-
return [...new Set(resolved)];
|
|
401434
|
-
const sourceIdToChangeIds = buildTrackedChangeSourceMap(options.trackChangesList?.()?.items ?? []);
|
|
401435
|
-
if (sourceIdToChangeIds.size === 0)
|
|
401436
|
-
return [];
|
|
401437
|
-
const out = [];
|
|
401438
|
-
for (const sourceId of activeSourceIds) {
|
|
401439
|
-
const changeIds = sourceIdToChangeIds.get(sourceId);
|
|
401440
|
-
if (!changeIds)
|
|
401441
|
-
continue;
|
|
401442
|
-
for (const changeId of changeIds)
|
|
401443
|
-
pushUnique(out, changeId);
|
|
401444
|
-
}
|
|
401445
|
-
return out;
|
|
401446
|
-
}
|
|
401447
|
-
function buildTrackedChangeSourceMap(items) {
|
|
401448
|
-
const map3 = new Map;
|
|
401449
|
-
for (const item of items) {
|
|
401450
|
-
if (!item || typeof item !== "object")
|
|
401451
|
-
continue;
|
|
401452
|
-
const record3 = item;
|
|
401453
|
-
const id = typeof record3.id === "string" ? record3.id : null;
|
|
401454
|
-
if (!id)
|
|
401455
|
-
continue;
|
|
401456
|
-
const sourceIds = record3.sourceIds && typeof record3.sourceIds === "object" ? record3.sourceIds : {};
|
|
401457
|
-
const wordRevisionIds = record3.wordRevisionIds && typeof record3.wordRevisionIds === "object" ? record3.wordRevisionIds : {};
|
|
401458
|
-
pushTrackedSourceMap(map3, sourceIds.wordIdInsert, id);
|
|
401459
|
-
pushTrackedSourceMap(map3, sourceIds.wordIdDelete, id);
|
|
401460
|
-
for (const sourceId of Array.isArray(sourceIds.wordIdOther) ? sourceIds.wordIdOther : []) {
|
|
401461
|
-
pushTrackedSourceMap(map3, sourceId, id);
|
|
401462
|
-
}
|
|
401463
|
-
pushTrackedSourceMap(map3, wordRevisionIds.insert, id);
|
|
401464
|
-
pushTrackedSourceMap(map3, wordRevisionIds.delete, id);
|
|
401465
|
-
pushTrackedSourceMap(map3, wordRevisionIds.format, id);
|
|
401466
|
-
}
|
|
401467
|
-
return map3;
|
|
401468
|
-
}
|
|
401469
|
-
function pushTrackedSourceMap(map3, sourceId, changeId) {
|
|
401470
|
-
if (typeof sourceId !== "string" || sourceId.length === 0)
|
|
401471
|
-
return;
|
|
401472
|
-
const ids = map3.get(sourceId) ?? [];
|
|
401473
|
-
pushUnique(ids, changeId);
|
|
401474
|
-
map3.set(sourceId, ids);
|
|
401475
|
-
}
|
|
401476
|
-
function visibleParagraphTextFromXml(xml) {
|
|
401477
|
-
const stripped = stripTextboxContent2(stripParagraphProperties3(stripDeletedRevisions(xml)));
|
|
401478
|
-
let out = "";
|
|
401479
|
-
for (const token of stripped.matchAll(/<[\w.-]+:t\b[^>]*>([\s\S]*?)<\/[\w.-]+:t>|<[\w.-]+:(tab|br|cr)\b[^>]*\/>/g)) {
|
|
401480
|
-
if (token[1] != null) {
|
|
401481
|
-
out += decodeXmlText13(token[1]);
|
|
401482
|
-
continue;
|
|
401483
|
-
}
|
|
401484
|
-
out += token[2] === "tab" ? "\t" : `
|
|
401485
|
-
`;
|
|
401486
|
-
}
|
|
401487
|
-
return out;
|
|
401488
|
-
}
|
|
401489
|
-
function visibleRunMarkSlicesFromXml(xml) {
|
|
401490
|
-
const stripped = stripTextboxContent2(stripParagraphProperties3(stripDeletedRevisions(xml)));
|
|
401491
|
-
const slices = [];
|
|
401492
|
-
let cursor = 0;
|
|
401493
|
-
for (const match of stripped.matchAll(/<(?:[\w.-]+:)?r\b[^>]*>[\s\S]*?<\/(?:[\w.-]+:)?r>/g)) {
|
|
401494
|
-
const runXml = match[0];
|
|
401495
|
-
const textLength = visibleParagraphTextFromXml(runXml).length;
|
|
401496
|
-
if (textLength > 0) {
|
|
401497
|
-
slices.push({ start: cursor, end: cursor + textLength, marks: activeMarksForRunXml(runXml) });
|
|
401498
|
-
}
|
|
401499
|
-
cursor += textLength;
|
|
401500
|
-
}
|
|
401501
|
-
return slices;
|
|
401502
|
-
}
|
|
401503
|
-
function activeMarksForRunXml(runXml) {
|
|
401504
|
-
const rPr = findFirstElement(runXml, "rPr")?.xml ?? "";
|
|
401505
|
-
if (!rPr)
|
|
401506
|
-
return [];
|
|
401507
|
-
const marks = [];
|
|
401508
|
-
if (hasOnOffRunProperty(rPr, "b"))
|
|
401509
|
-
marks.push("bold");
|
|
401510
|
-
if (hasOnOffRunProperty(rPr, "i"))
|
|
401511
|
-
marks.push("italic");
|
|
401512
|
-
if (hasOnOffRunProperty(rPr, "u"))
|
|
401513
|
-
marks.push("underline");
|
|
401514
|
-
if (hasOnOffRunProperty(rPr, "strike"))
|
|
401515
|
-
marks.push("strikethrough");
|
|
401516
|
-
return marks;
|
|
401517
|
-
}
|
|
401518
|
-
function hasOnOffRunProperty(rPrXml, localName2) {
|
|
401519
|
-
const match = rPrXml.match(new RegExp(`<(?:[\\w.-]+:)?${localName2}\\b([^>]*)\\/?>`, "i"));
|
|
401520
|
-
if (!match)
|
|
401521
|
-
return false;
|
|
401522
|
-
const attrs = match[1] ?? "";
|
|
401523
|
-
const val = attrs.match(/(?:^|\s)(?:[\w.-]+:)?val=(["'])(.*?)\1/i)?.[2]?.toLowerCase();
|
|
401524
|
-
return val !== "0" && val !== "false" && val !== "off" && val !== "none";
|
|
401525
|
-
}
|
|
401526
|
-
function activeMarksForParagraphXmlRange(xml, start, end) {
|
|
401527
|
-
const slices = visibleRunMarkSlicesFromXml(xml);
|
|
401528
|
-
if (slices.length === 0)
|
|
401529
|
-
return [];
|
|
401530
|
-
if (start === end) {
|
|
401531
|
-
const containing = slices.find((slice) => start > slice.start && start < slice.end);
|
|
401532
|
-
if (containing)
|
|
401533
|
-
return containing.marks;
|
|
401534
|
-
let previous3 = null;
|
|
401535
|
-
for (const slice of slices) {
|
|
401536
|
-
if (slice.end <= start)
|
|
401537
|
-
previous3 = slice;
|
|
401538
|
-
}
|
|
401539
|
-
if (previous3)
|
|
401540
|
-
return previous3.marks;
|
|
401541
|
-
return slices[0]?.marks ?? [];
|
|
401542
|
-
}
|
|
401543
|
-
let common = null;
|
|
401544
|
-
for (const slice of slices) {
|
|
401545
|
-
if (Math.max(start, slice.start) >= Math.min(end, slice.end))
|
|
401546
|
-
continue;
|
|
401547
|
-
const marks = new Set(slice.marks);
|
|
401548
|
-
common = common == null ? marks : intersectStringSets(common, marks);
|
|
401549
|
-
}
|
|
401550
|
-
if (!common)
|
|
401551
|
-
return [];
|
|
401552
|
-
return ACTIVE_MARK_ORDER.filter((mark) => common.has(mark));
|
|
401553
|
-
}
|
|
401554
|
-
function activeTrackedChangeSourceIdsForParagraphXmlRange(xml, start, end) {
|
|
401555
|
-
const slices = visibleTrackedChangeSourceSlicesFromXml(xml);
|
|
401556
|
-
if (slices.length === 0)
|
|
401557
|
-
return [];
|
|
401558
|
-
const out = [];
|
|
401559
|
-
for (const slice of slices) {
|
|
401560
|
-
if (!rangesOverlap12(slice.start, slice.end, start, end))
|
|
401561
|
-
continue;
|
|
401562
|
-
for (const sourceId of slice.sourceIds)
|
|
401563
|
-
pushUnique(out, sourceId);
|
|
401564
|
-
}
|
|
401565
|
-
return out;
|
|
401566
|
-
}
|
|
401567
|
-
function visibleTrackedChangeSourceSlicesFromXml(xml) {
|
|
401568
|
-
const stripped = stripTextboxContent2(stripParagraphProperties3(xml));
|
|
401569
|
-
const slices = [];
|
|
401570
|
-
const activeSourceIdStack = [];
|
|
401571
|
-
const elementStack = [];
|
|
401572
|
-
let delDepth = 0;
|
|
401573
|
-
let cursor = 0;
|
|
401574
|
-
const tokenRe = /<\/(?:[\w.-]+:)?(ins|del|moveFrom|moveTo)>|<(?:[\w.-]+:)?t\b[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?t>|<(?:[\w.-]+:)?delText\b[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?delText>|<(?:[\w.-]+:)?(ins|del|moveFrom|moveTo|tab|br|cr)\b([^>]*)\/?>/g;
|
|
401575
|
-
for (const match of stripped.matchAll(tokenRe)) {
|
|
401576
|
-
const closingName = match[1];
|
|
401577
|
-
const tText = match[2];
|
|
401578
|
-
const delText = match[3];
|
|
401579
|
-
const openingName = match[4];
|
|
401580
|
-
const attrs = match[5] ?? "";
|
|
401581
|
-
if (closingName) {
|
|
401582
|
-
const frame = elementStack.pop();
|
|
401583
|
-
if (frame?.hadId)
|
|
401584
|
-
activeSourceIdStack.pop();
|
|
401585
|
-
if (closingName === "del")
|
|
401586
|
-
delDepth = Math.max(0, delDepth - 1);
|
|
401587
|
-
continue;
|
|
401588
|
-
}
|
|
401589
|
-
if (tText != null) {
|
|
401590
|
-
if (delDepth > 0) {
|
|
401591
|
-
pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIdStack);
|
|
401592
|
-
} else {
|
|
401593
|
-
cursor = pushTrackedSourceSlice(slices, cursor, decodeXmlText13(tText).length, activeSourceIdStack);
|
|
401594
|
-
}
|
|
401595
|
-
continue;
|
|
401596
|
-
}
|
|
401597
|
-
if (delText != null) {
|
|
401598
|
-
pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIdStack);
|
|
401599
|
-
continue;
|
|
401600
|
-
}
|
|
401601
|
-
if (!openingName)
|
|
401602
|
-
continue;
|
|
401603
|
-
if (openingName === "tab" || openingName === "br" || openingName === "cr") {
|
|
401604
|
-
if (delDepth > 0) {
|
|
401605
|
-
pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIdStack);
|
|
401606
|
-
} else {
|
|
401607
|
-
cursor = pushTrackedSourceSlice(slices, cursor, 1, activeSourceIdStack);
|
|
401608
|
-
}
|
|
401609
|
-
continue;
|
|
401610
|
-
}
|
|
401611
|
-
const sourceId = readXmlAttribute6(attrs, "id");
|
|
401612
|
-
const selfClosing = match[0].endsWith("/>");
|
|
401613
|
-
if (!selfClosing) {
|
|
401614
|
-
elementStack.push({ name: openingName, hadId: Boolean(sourceId) });
|
|
401615
|
-
if (sourceId)
|
|
401616
|
-
activeSourceIdStack.push(sourceId);
|
|
401617
|
-
if (openingName === "del")
|
|
401618
|
-
delDepth += 1;
|
|
401619
|
-
}
|
|
401620
|
-
}
|
|
401621
|
-
return slices;
|
|
401622
|
-
}
|
|
401623
|
-
function pushTrackedSourceSlice(slices, cursor, textLength, activeSourceIds) {
|
|
401624
|
-
if (textLength <= 0)
|
|
401625
|
-
return cursor;
|
|
401626
|
-
if (activeSourceIds.length > 0) {
|
|
401627
|
-
slices.push({ start: cursor, end: cursor + textLength, sourceIds: [...new Set(activeSourceIds)] });
|
|
401628
|
-
}
|
|
401629
|
-
return cursor + textLength;
|
|
401630
|
-
}
|
|
401631
|
-
function pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIds) {
|
|
401632
|
-
if (activeSourceIds.length === 0)
|
|
401633
|
-
return;
|
|
401634
|
-
slices.push({ start: cursor, end: cursor, sourceIds: [...new Set(activeSourceIds)] });
|
|
401635
|
-
}
|
|
401636
|
-
function readXmlAttribute6(attrs, localName2) {
|
|
401637
|
-
const match = attrs.match(new RegExp(`(?:^|\\s)(?:[\\w.-]+:)?${localName2}=(["'])(.*?)\\1`, "i"));
|
|
401638
|
-
return match?.[2] ?? null;
|
|
401639
|
-
}
|
|
401640
|
-
function rangesOverlap12(aStart, aEnd, bStart, bEnd) {
|
|
401641
|
-
const leftStart = Math.min(aStart, aEnd);
|
|
401642
|
-
const leftEnd = Math.max(aStart, aEnd);
|
|
401643
|
-
const rightStart = Math.min(bStart, bEnd);
|
|
401644
|
-
const rightEnd = Math.max(bStart, bEnd);
|
|
401645
|
-
if (rightStart === rightEnd)
|
|
401646
|
-
return rightStart >= leftStart && rightStart <= leftEnd;
|
|
401647
|
-
if (leftStart === leftEnd)
|
|
401648
|
-
return leftStart >= rightStart && leftStart <= rightEnd;
|
|
401649
|
-
return Math.max(leftStart, rightStart) < Math.min(leftEnd, rightEnd);
|
|
401650
|
-
}
|
|
401651
|
-
function intersectStringSets(left, right) {
|
|
401652
|
-
const out = new Set;
|
|
401653
|
-
for (const value2 of left) {
|
|
401654
|
-
if (right.has(value2))
|
|
401655
|
-
out.add(value2);
|
|
401656
|
-
}
|
|
401657
|
-
return out;
|
|
401658
|
-
}
|
|
401659
|
-
function stripParagraphProperties3(xml) {
|
|
401660
|
-
return stripElements(xml, "pPr");
|
|
401661
|
-
}
|
|
401662
|
-
function stripDeletedRevisions(xml) {
|
|
401663
|
-
return xml.replace(/<[\w.-]+:del\b(?![^>]*\/>)[^>]*>[\s\S]*?<\/[\w.-]+:del>/g, "");
|
|
401664
|
-
}
|
|
401665
|
-
function stripTextboxContent2(xml) {
|
|
401666
|
-
return xml.replace(/<(?:[\w.-]+:)?txbxContent\b[^>]*>[\s\S]*?<\/(?:[\w.-]+:)?txbxContent>/g, "").replace(/<(?:[\w.-]+:)?txbxContent\b[^>]*>[\s\S]*$/g, "");
|
|
401667
|
-
}
|
|
401668
|
-
function decodeXmlText13(escaped) {
|
|
401669
|
-
return escaped.replace(/&(lt|gt|amp|quot|apos|#\d+|#x[0-9a-fA-F]+);/g, (_, entity) => {
|
|
401670
|
-
switch (entity) {
|
|
401671
|
-
case "lt":
|
|
401672
|
-
return "<";
|
|
401673
|
-
case "gt":
|
|
401674
|
-
return ">";
|
|
401675
|
-
case "amp":
|
|
401676
|
-
return "&";
|
|
401677
|
-
case "quot":
|
|
401678
|
-
return '"';
|
|
401679
|
-
case "apos":
|
|
401680
|
-
return "'";
|
|
401681
|
-
default: {
|
|
401682
|
-
const cp = entity.startsWith("#x") ? Number.parseInt(entity.slice(2), 16) : Number.parseInt(entity.slice(1), 10);
|
|
401683
|
-
return Number.isFinite(cp) ? String.fromCodePoint(cp) : `&${entity};`;
|
|
401684
|
-
}
|
|
401685
|
-
}
|
|
401686
|
-
});
|
|
401687
|
-
}
|
|
401688
|
-
function pushUnique(out, id) {
|
|
401689
|
-
if (typeof id === "string" && id.length > 0 && !out.includes(id))
|
|
401690
|
-
out.push(id);
|
|
401691
|
-
}
|
|
401692
|
-
var TEXT_DECODER7, ACTIVE_MARK_ORDER;
|
|
401693
|
-
var init_live_selection = __esm(() => {
|
|
401694
|
-
init_sd_document_session_internal();
|
|
401695
|
-
init_sd_document_session_internal();
|
|
401696
|
-
init_footnote_range();
|
|
401697
|
-
TEXT_DECODER7 = new TextDecoder;
|
|
401698
|
-
ACTIVE_MARK_ORDER = ["bold", "italic", "underline", "strikethrough"];
|
|
401699
|
-
});
|
|
401700
|
-
|
|
401701
401949
|
// ../../../v2/document-api-v2-adapter/dist/selection/story-text-extent.js
|
|
401702
401950
|
async function resolveBrowserStoryTextExtentForSession(session, input, options) {
|
|
401703
401951
|
try {
|