@superdoc/mcp 1.9.0-next.1 → 1.9.0-next.2
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 +1071 -590
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31620,7 +31620,7 @@ var init_host = __esm(() => {
|
|
|
31620
31620
|
});
|
|
31621
31621
|
|
|
31622
31622
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31623
|
-
var SDK_VERSION = "2.22.0-next.
|
|
31623
|
+
var SDK_VERSION = "2.22.0-next.2";
|
|
31624
31624
|
|
|
31625
31625
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31626
31626
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -139875,6 +139875,14 @@ var init_source_coverage_chunks = __esm(() => {
|
|
|
139875
139875
|
});
|
|
139876
139876
|
|
|
139877
139877
|
// ../../../v2/editor-core/dist/document/story-slice.js
|
|
139878
|
+
function decodeSourceXmlBytes(bytes) {
|
|
139879
|
+
try {
|
|
139880
|
+
const sourceByteSkip = bytes.length >= 3 && bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191 ? 3 : 0;
|
|
139881
|
+
return { xml: EXACT_TEXT_DECODER.decode(bytes), exact: true, sourceByteSkip };
|
|
139882
|
+
} catch {
|
|
139883
|
+
return { xml: TEXT_DECODER.decode(bytes), exact: false, sourceByteSkip: 0 };
|
|
139884
|
+
}
|
|
139885
|
+
}
|
|
139878
139886
|
function prepareStorySlice(state, request) {
|
|
139879
139887
|
const invalid2 = validateRequestShape(request);
|
|
139880
139888
|
if (invalid2)
|
|
@@ -139943,6 +139951,7 @@ async function readStorySliceFromStateAsync(state, request, signal) {
|
|
|
139943
139951
|
if (!request.includeXml)
|
|
139944
139952
|
return { status: "ok", slice };
|
|
139945
139953
|
const parts = [];
|
|
139954
|
+
const xmlPartByteSpans = [];
|
|
139946
139955
|
const maxXmlBytes = maxXmlBytesForRequest(request);
|
|
139947
139956
|
let xmlBytes = 0;
|
|
139948
139957
|
for (const preparedChunk of selected) {
|
|
@@ -139969,11 +139978,19 @@ async function readStorySliceFromStateAsync(state, request, signal) {
|
|
|
139969
139978
|
}
|
|
139970
139979
|
rangeBytes = read.bytes;
|
|
139971
139980
|
}
|
|
139972
|
-
const
|
|
139981
|
+
const decoded = decodeSourceXmlBytes(rangeBytes);
|
|
139982
|
+
const chunkXml = decoded.xml;
|
|
139973
139983
|
if (request.kind !== "body-child-range") {
|
|
139974
139984
|
const appended2 = appendXmlWithinBudget(parts, chunkXml, xmlBytes, maxXmlBytes);
|
|
139975
139985
|
if (appended2.status === "unsupported")
|
|
139976
139986
|
return appended2.result;
|
|
139987
|
+
if (decoded.exact)
|
|
139988
|
+
xmlPartByteSpans.push({
|
|
139989
|
+
xmlByteStart: xmlBytes,
|
|
139990
|
+
xmlByteEnd: appended2.xmlBytes,
|
|
139991
|
+
partId: chunk.partUri,
|
|
139992
|
+
partByteStart: rangeStart + decoded.sourceByteSkip
|
|
139993
|
+
});
|
|
139977
139994
|
xmlBytes = appended2.xmlBytes;
|
|
139978
139995
|
continue;
|
|
139979
139996
|
}
|
|
@@ -139989,9 +140006,16 @@ async function readStorySliceFromStateAsync(state, request, signal) {
|
|
|
139989
140006
|
reason: "requested body-child XML slice could not be clipped to direct-child boundaries"
|
|
139990
140007
|
};
|
|
139991
140008
|
}
|
|
139992
|
-
const appended = appendXmlWithinBudget(parts, windowed, xmlBytes, maxXmlBytes);
|
|
140009
|
+
const appended = appendXmlWithinBudget(parts, windowed.xml, xmlBytes, maxXmlBytes);
|
|
139993
140010
|
if (appended.status === "unsupported")
|
|
139994
140011
|
return appended.result;
|
|
140012
|
+
if (decoded.exact)
|
|
140013
|
+
xmlPartByteSpans.push({
|
|
140014
|
+
xmlByteStart: xmlBytes,
|
|
140015
|
+
xmlByteEnd: appended.xmlBytes,
|
|
140016
|
+
partId: chunk.partUri,
|
|
140017
|
+
partByteStart: chunk.byteStart + decoded.sourceByteSkip + windowed.byteStartInChunk
|
|
140018
|
+
});
|
|
139995
140019
|
xmlBytes = appended.xmlBytes;
|
|
139996
140020
|
}
|
|
139997
140021
|
if (state.getStoryRevision(slice.storyId) !== slice.storyRevision) {
|
|
@@ -140000,6 +140024,7 @@ async function readStorySliceFromStateAsync(state, request, signal) {
|
|
|
140000
140024
|
reason: "story revision changed while materializing the requested XML slice"
|
|
140001
140025
|
};
|
|
140002
140026
|
}
|
|
140027
|
+
slice.xmlPartByteSpans = xmlPartByteSpans;
|
|
140003
140028
|
return { status: "ok", slice, xml: parts.join(""), xmlByteLength: xmlBytes };
|
|
140004
140029
|
}
|
|
140005
140030
|
function sliceResidentPartRangeBytes(state, partUri, start, end) {
|
|
@@ -140102,7 +140127,7 @@ function windowChunkBodyChildrenXml(xml, chunk, spanCacheIdentity, startOrdinal,
|
|
|
140102
140127
|
const effectiveStart = Math.max(startOrdinal, chunkStart);
|
|
140103
140128
|
const effectiveEnd = Math.min(endOrdinalExclusive, chunkEnd);
|
|
140104
140129
|
if (effectiveStart >= effectiveEnd)
|
|
140105
|
-
return "";
|
|
140130
|
+
return { xml: "", byteStartInChunk: 0 };
|
|
140106
140131
|
let spans = CHUNK_SPAN_CACHE.get(spanCacheIdentity);
|
|
140107
140132
|
if (!spans || spans.length === 0) {
|
|
140108
140133
|
spans = listTopLevelElementSpans(xml);
|
|
@@ -140113,7 +140138,11 @@ function windowChunkBodyChildrenXml(xml, chunk, spanCacheIdentity, startOrdinal,
|
|
|
140113
140138
|
if (localStart < 0 || localEnd > spans.length || localStart >= localEnd) {
|
|
140114
140139
|
return null;
|
|
140115
140140
|
}
|
|
140116
|
-
|
|
140141
|
+
const start = spans[localStart].start;
|
|
140142
|
+
return {
|
|
140143
|
+
xml: xml.slice(start, spans[localEnd - 1].end),
|
|
140144
|
+
byteStartInChunk: TEXT_ENCODER.encode(xml.slice(0, start)).length
|
|
140145
|
+
};
|
|
140117
140146
|
}
|
|
140118
140147
|
function windowStartScanOrdinal(xml, chunk, startOrdinal) {
|
|
140119
140148
|
if (chunk.scanParagraphStartOrdinal == null)
|
|
@@ -140214,12 +140243,14 @@ function dependencyList(chunks) {
|
|
|
140214
140243
|
}
|
|
140215
140244
|
return deps;
|
|
140216
140245
|
}
|
|
140217
|
-
var DEFAULT_MAX_XML_BYTES, TEXT_DECODER, NODE_BUFFER, CHUNK_SPAN_CACHE;
|
|
140246
|
+
var DEFAULT_MAX_XML_BYTES, TEXT_DECODER, EXACT_TEXT_DECODER, TEXT_ENCODER, NODE_BUFFER, CHUNK_SPAN_CACHE;
|
|
140218
140247
|
var init_story_slice = __esm(() => {
|
|
140219
140248
|
init_paragraph_scan_count();
|
|
140220
140249
|
init_source_coverage_chunks();
|
|
140221
140250
|
DEFAULT_MAX_XML_BYTES = 64 * 1024;
|
|
140222
140251
|
TEXT_DECODER = new TextDecoder("utf-8", { fatal: false });
|
|
140252
|
+
EXACT_TEXT_DECODER = new TextDecoder("utf-8", { fatal: true });
|
|
140253
|
+
TEXT_ENCODER = new TextEncoder;
|
|
140223
140254
|
NODE_BUFFER = typeof globalThis !== "undefined" && typeof globalThis.process?.versions?.node === "string" && typeof globalThis.Buffer?.byteLength === "function" ? globalThis.Buffer : null;
|
|
140224
140255
|
CHUNK_SPAN_CACHE = new WeakMap;
|
|
140225
140256
|
});
|
|
@@ -191447,7 +191478,14 @@ function invertPreparedTableStructuralDelta(delta) {
|
|
|
191447
191478
|
return { ...delta, inverse: !delta.inverse, createdNodeIds: delta.deletedNodeIds, deletedNodeIds: delta.createdNodeIds };
|
|
191448
191479
|
}
|
|
191449
191480
|
if (delta.kind === "table.move") {
|
|
191450
|
-
return {
|
|
191481
|
+
return {
|
|
191482
|
+
...delta,
|
|
191483
|
+
from: delta.to,
|
|
191484
|
+
to: delta.from,
|
|
191485
|
+
...delta.storyTrailingXml ? { storyTrailingXml: { before: delta.storyTrailingXml.after, after: delta.storyTrailingXml.before } } : {},
|
|
191486
|
+
createdNodeIds: delta.deletedNodeIds,
|
|
191487
|
+
deletedNodeIds: delta.createdNodeIds
|
|
191488
|
+
};
|
|
191451
191489
|
}
|
|
191452
191490
|
if (delta.kind === "table.row.move") {
|
|
191453
191491
|
return {
|
|
@@ -191466,6 +191504,7 @@ function invertPreparedTableStructuralDelta(delta) {
|
|
|
191466
191504
|
if (delta.kind === "table.rewrite") {
|
|
191467
191505
|
return {
|
|
191468
191506
|
...delta,
|
|
191507
|
+
...delta.storyTrailingXml ? { storyTrailingXml: { before: delta.storyTrailingXml.after, after: delta.storyTrailingXml.before } } : {},
|
|
191469
191508
|
rowsBefore: delta.rowsAfter,
|
|
191470
191509
|
rowsAfter: delta.rowsBefore,
|
|
191471
191510
|
tableXmlBefore: delta.tableXmlAfter,
|
|
@@ -191514,7 +191553,8 @@ function invertPreparedTableStructuralDelta(delta) {
|
|
|
191514
191553
|
updatedNodeIds: [],
|
|
191515
191554
|
remappedNodeIds: [],
|
|
191516
191555
|
projectionScope: delta.projectionScope,
|
|
191517
|
-
tableProjection: { ...delta.tableProjection, tableXmlBefore: delta.tableProjection.tableXmlAfter, tableXmlAfter: "" }
|
|
191556
|
+
tableProjection: { ...delta.tableProjection, tableXmlBefore: delta.tableProjection.tableXmlAfter, tableXmlAfter: "" },
|
|
191557
|
+
...delta.storyTrailingXml ? { storyTrailingXml: { before: delta.storyTrailingXml.after, after: delta.storyTrailingXml.before } } : {}
|
|
191518
191558
|
};
|
|
191519
191559
|
}
|
|
191520
191560
|
return null;
|
|
@@ -234990,6 +235030,153 @@ var init_compile_tracked_change_decide_fenced = __esm(() => {
|
|
|
234990
235030
|
TE30 = new TextEncoder;
|
|
234991
235031
|
});
|
|
234992
235032
|
|
|
235033
|
+
// ../../../v2/editor-core/dist/document/transactions/table-trailing-paragraph.js
|
|
235034
|
+
function isTableMoveClosingMarkerGap(xml, namespaceBindings = {}) {
|
|
235035
|
+
const parsed = collectXmlElementRanges(xml, { fragment: true, additionalNamespaces: namespaceBindings });
|
|
235036
|
+
if (parsed.errors.length)
|
|
235037
|
+
return false;
|
|
235038
|
+
let cursor = 0;
|
|
235039
|
+
for (const range of [...parsed.ranges].sort((a, b) => a.start - b.start)) {
|
|
235040
|
+
const proofEnd = range.tag.localName === "proofErr" && range.tag.attributes.some((attribute2) => attribute2.namespaceUri === W5 && attribute2.localName === "type" && ["spellEnd", "gramEnd"].includes(attribute2.value));
|
|
235041
|
+
if (range.start < cursor || range.tag.namespaceUri !== W5 || !CLOSING_MARKERS.has(range.tag.localName) && !proofEnd || xml.slice(cursor, range.start).trim() || xml.slice(range.openEnd, range.closeStart).trim())
|
|
235042
|
+
return false;
|
|
235043
|
+
cursor = range.end;
|
|
235044
|
+
}
|
|
235045
|
+
return xml.slice(cursor).trim() === "";
|
|
235046
|
+
}
|
|
235047
|
+
function isReusableTableTrailingParagraph(xml, namespaceBindings = {}) {
|
|
235048
|
+
const parsed = collectXmlElementRanges(xml, { fragment: true, additionalNamespaces: namespaceBindings });
|
|
235049
|
+
const root = parsed.ranges.find((range) => range.start === 0 && range.end === xml.length);
|
|
235050
|
+
if (parsed.errors.length || root?.tag.namespaceUri !== W5 || root.tag.localName !== "p")
|
|
235051
|
+
return false;
|
|
235052
|
+
const descendants = parsed.ranges.filter((range) => range !== root);
|
|
235053
|
+
if (descendants.some((range) => range.tag.namespaceUri !== W5 || !SAFE_PROPERTIES.has(range.tag.localName)))
|
|
235054
|
+
return false;
|
|
235055
|
+
let cursor = root.openEnd;
|
|
235056
|
+
for (const range of descendants.sort((a, b) => a.start - b.start)) {
|
|
235057
|
+
if (range.start < cursor)
|
|
235058
|
+
continue;
|
|
235059
|
+
if (range.tag.localName !== "pPr" || xml.slice(cursor, range.start).trim())
|
|
235060
|
+
return false;
|
|
235061
|
+
cursor = range.end;
|
|
235062
|
+
}
|
|
235063
|
+
if (xml.slice(cursor, root.closeStart).trim())
|
|
235064
|
+
return false;
|
|
235065
|
+
return true;
|
|
235066
|
+
}
|
|
235067
|
+
function readPlainTableTrailingParagraphId(xml, namespaceBindings = {}) {
|
|
235068
|
+
const parsed = collectXmlElementRanges(xml, { fragment: true, additionalNamespaces: namespaceBindings });
|
|
235069
|
+
const root = parsed.ranges[0];
|
|
235070
|
+
if (parsed.errors.length || parsed.ranges.length !== 1 || !root || root.start !== 0 || root.end !== xml.length || root.tag.namespaceUri !== W5 || root.tag.localName !== "p" || xml.slice(root.openEnd, root.closeStart).trim())
|
|
235071
|
+
return null;
|
|
235072
|
+
const attributes = root.tag.attributes.filter((attribute2) => attribute2.namespaceUri !== "http://www.w3.org/2000/xmlns/");
|
|
235073
|
+
if (attributes.length !== 1 || attributes[0]?.namespaceUri !== W145 || attributes[0].localName !== "paraId")
|
|
235074
|
+
return null;
|
|
235075
|
+
return attributes[0].value;
|
|
235076
|
+
}
|
|
235077
|
+
var W5 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", W145 = "http://schemas.microsoft.com/office/word/2010/wordml", CLOSING_MARKERS, SAFE_PROPERTIES;
|
|
235078
|
+
var init_table_trailing_paragraph = __esm(() => {
|
|
235079
|
+
init_xml_sax();
|
|
235080
|
+
CLOSING_MARKERS = new Set([
|
|
235081
|
+
"bookmarkEnd",
|
|
235082
|
+
"commentRangeEnd",
|
|
235083
|
+
"permEnd",
|
|
235084
|
+
"moveFromRangeEnd",
|
|
235085
|
+
"moveToRangeEnd",
|
|
235086
|
+
"customXmlInsRangeEnd",
|
|
235087
|
+
"customXmlDelRangeEnd",
|
|
235088
|
+
"customXmlMoveFromRangeEnd",
|
|
235089
|
+
"customXmlMoveToRangeEnd"
|
|
235090
|
+
]);
|
|
235091
|
+
SAFE_PROPERTIES = new Set([
|
|
235092
|
+
"pPr",
|
|
235093
|
+
"pStyle",
|
|
235094
|
+
"keepNext",
|
|
235095
|
+
"keepLines",
|
|
235096
|
+
"widowControl",
|
|
235097
|
+
"spacing",
|
|
235098
|
+
"ind",
|
|
235099
|
+
"jc",
|
|
235100
|
+
"contextualSpacing",
|
|
235101
|
+
"snapToGrid",
|
|
235102
|
+
"bidi",
|
|
235103
|
+
"textDirection",
|
|
235104
|
+
"textAlignment",
|
|
235105
|
+
"outlineLvl",
|
|
235106
|
+
"tabs",
|
|
235107
|
+
"tab",
|
|
235108
|
+
"rPr",
|
|
235109
|
+
"rFonts",
|
|
235110
|
+
"b",
|
|
235111
|
+
"bCs",
|
|
235112
|
+
"i",
|
|
235113
|
+
"iCs",
|
|
235114
|
+
"caps",
|
|
235115
|
+
"smallCaps",
|
|
235116
|
+
"strike",
|
|
235117
|
+
"dstrike",
|
|
235118
|
+
"outline",
|
|
235119
|
+
"shadow",
|
|
235120
|
+
"emboss",
|
|
235121
|
+
"imprint",
|
|
235122
|
+
"noProof",
|
|
235123
|
+
"vanish",
|
|
235124
|
+
"webHidden",
|
|
235125
|
+
"color",
|
|
235126
|
+
"sz",
|
|
235127
|
+
"szCs",
|
|
235128
|
+
"highlight",
|
|
235129
|
+
"u",
|
|
235130
|
+
"vertAlign",
|
|
235131
|
+
"rtl",
|
|
235132
|
+
"cs",
|
|
235133
|
+
"lang",
|
|
235134
|
+
"kern",
|
|
235135
|
+
"position",
|
|
235136
|
+
"w",
|
|
235137
|
+
"shd",
|
|
235138
|
+
"pBdr",
|
|
235139
|
+
"top",
|
|
235140
|
+
"left",
|
|
235141
|
+
"bottom",
|
|
235142
|
+
"right",
|
|
235143
|
+
"between",
|
|
235144
|
+
"bar"
|
|
235145
|
+
]);
|
|
235146
|
+
});
|
|
235147
|
+
|
|
235148
|
+
// ../../../v2/editor-core/dist/document/transactions/tracked-table-move.js
|
|
235149
|
+
function prepareTrackedTableMove(input) {
|
|
235150
|
+
return prepareTrackedBlockMove({
|
|
235151
|
+
...input,
|
|
235152
|
+
rangeName: input.supportingParagraphId ? `${input.rangeName}-supporting-${input.supportingParagraphId}` : input.rangeName
|
|
235153
|
+
});
|
|
235154
|
+
}
|
|
235155
|
+
function unchangedTableMoveSupportingParagraph(xml, pair) {
|
|
235156
|
+
if (!xml.slice(pair.startMarker.start, pair.startMarker.end).includes("-supporting-"))
|
|
235157
|
+
return null;
|
|
235158
|
+
const parsed = collectXmlElementRanges(xml);
|
|
235159
|
+
if (parsed.errors.length)
|
|
235160
|
+
return null;
|
|
235161
|
+
const start = parsed.ranges.find((range) => range.start === pair.startMarker.start);
|
|
235162
|
+
const name = start && readXmlAttribute(start.tag, NS_W, "name")?.value;
|
|
235163
|
+
const id = name && /^move-pair-\d+(?:-\d+)?-supporting-([0-9A-F]{8})$/.exec(name)?.[1];
|
|
235164
|
+
if (!id || start?.tag.namespaceUri !== NS_W || start.tag.localName !== "moveToRangeStart")
|
|
235165
|
+
return null;
|
|
235166
|
+
const table = parsed.ranges.find((range) => range.start >= start.end && range.end <= pair.endMarker.start && range.tag.namespaceUri === NS_W && range.tag.localName === "tbl");
|
|
235167
|
+
if (!table || xml.slice(start.end, table.start).trim() || xml.slice(table.end, pair.endMarker.start).trim())
|
|
235168
|
+
return null;
|
|
235169
|
+
const paragraph = parsed.ranges.filter((range) => range.start >= pair.endMarker.end).sort((a, b) => a.start - b.start)[0];
|
|
235170
|
+
if (!paragraph || xml.slice(pair.endMarker.end, paragraph.start).trim() || readPlainTableTrailingParagraphId(xml.slice(paragraph.start, paragraph.end), paragraph.namespaceBindings) !== id)
|
|
235171
|
+
return null;
|
|
235172
|
+
return { start: paragraph.start, end: paragraph.end, nodeId: id };
|
|
235173
|
+
}
|
|
235174
|
+
var init_tracked_table_move = __esm(() => {
|
|
235175
|
+
init_xml_sax();
|
|
235176
|
+
init_tracked_block_move();
|
|
235177
|
+
init_table_trailing_paragraph();
|
|
235178
|
+
});
|
|
235179
|
+
|
|
234993
235180
|
// ../../../v2/editor-core/dist/document/transactions/bibliography-style.js
|
|
234994
235181
|
function resolveWordBibliographyMetadata(style, fallback = {}) {
|
|
234995
235182
|
const explicitStyleName = normalizeStyleName(style);
|
|
@@ -236912,6 +237099,12 @@ function runTrackedChangeDecideCommitWithLookupContext(lookupContext, input, xml
|
|
|
236912
237099
|
activeXml = workingXml;
|
|
236913
237100
|
f = stripped.fragment;
|
|
236914
237101
|
emptyParagraphMove = stripped.emptyParagraphMove === true;
|
|
237102
|
+
if (stripped.removedSupportingParagraphId)
|
|
237103
|
+
removedRefs.push({
|
|
237104
|
+
kind: "block",
|
|
237105
|
+
storyId: f.storyId,
|
|
237106
|
+
nodeId: stripped.removedSupportingParagraphId
|
|
237107
|
+
});
|
|
236915
237108
|
earliestMutationStart = 0;
|
|
236916
237109
|
if (removeRangePair)
|
|
236917
237110
|
consumedMoveRangePairs.add(pairKey);
|
|
@@ -239973,6 +240166,7 @@ function stripAttributedMoveMarkersForFragment(workingXml, fragment3, rangeMarke
|
|
|
239973
240166
|
return { ok: false, reason: "unsupported-context" };
|
|
239974
240167
|
}
|
|
239975
240168
|
const candidates = scan.candidates;
|
|
240169
|
+
const supportingParagraph = options.removeRangePair && options.decision === "reject" && fragment3.kind === "moveTo" && scan.rangePair ? unchangedTableMoveSupportingParagraph(workingXml, scan.rangePair) : null;
|
|
239976
240170
|
const emptyParagraphMarker = options.verifiedEmptyParagraphMove ? findVerifiedEmptyParagraphMoveMarker(workingXml, fragment3) : collectEmptyParagraphMoveMarkers(workingXml).get(fragment3.byteStart);
|
|
239977
240171
|
if (options.verifiedEmptyParagraphMove && (!emptyParagraphMarker || emptyParagraphMarker.start !== fragment3.byteStart || emptyParagraphMarker.end !== fragment3.byteEnd)) {
|
|
239978
240172
|
return { ok: false, reason: "unsupported-context" };
|
|
@@ -239982,7 +240176,7 @@ function stripAttributedMoveMarkersForFragment(workingXml, fragment3, rangeMarke
|
|
|
239982
240176
|
if (removeOwnedParagraph && !scan.enclosingParagraph)
|
|
239983
240177
|
return { ok: false, reason: "unsupported-context" };
|
|
239984
240178
|
const removal = removeOwnedParagraph ? scan.enclosingParagraph : expandEmptyMoveMarkRemoval(workingXml, emptyParagraphMarker);
|
|
239985
|
-
const ranges = options.removeRangePair && scan.rangePair ? [scan.rangePair.startMarker, scan.rangePair.endMarker].sort((a, b) => b.start - a.start) : [];
|
|
240179
|
+
const ranges = options.removeRangePair && scan.rangePair ? [scan.rangePair.startMarker, scan.rangePair.endMarker, ...supportingParagraph ? [supportingParagraph] : []].sort((a, b) => b.start - a.start) : [];
|
|
239986
240180
|
let xml2 = workingXml;
|
|
239987
240181
|
let shift = 0;
|
|
239988
240182
|
for (const range of ranges) {
|
|
@@ -239996,7 +240190,8 @@ function stripAttributedMoveMarkersForFragment(workingXml, fragment3, rangeMarke
|
|
|
239996
240190
|
ok: true,
|
|
239997
240191
|
xml: xml2,
|
|
239998
240192
|
fragment: { ...fragment3, byteStart: removal.start - shift, byteEnd: removal.end - shift },
|
|
239999
|
-
emptyParagraphMove: true
|
|
240193
|
+
emptyParagraphMove: true,
|
|
240194
|
+
...supportingParagraph ? { removedSupportingParagraphId: supportingParagraph.nodeId } : {}
|
|
240000
240195
|
};
|
|
240001
240196
|
}
|
|
240002
240197
|
if (candidates.length > 1) {
|
|
@@ -240015,7 +240210,8 @@ function stripAttributedMoveMarkersForFragment(workingXml, fragment3, rangeMarke
|
|
|
240015
240210
|
] : candidates[0] && !options.compoundParagraph?.deferParagraphMark ? [expandEmptyMoveMarkRemoval(workingXml, candidates[0])] : [];
|
|
240016
240211
|
const removals = [
|
|
240017
240212
|
...options.removeRangePair && scan.rangePair ? [scan.rangePair.startMarker, scan.rangePair.endMarker] : [],
|
|
240018
|
-
...paragraphShellRemovals
|
|
240213
|
+
...paragraphShellRemovals,
|
|
240214
|
+
...supportingParagraph ? [supportingParagraph] : []
|
|
240019
240215
|
].sort((left, right) => right.start - left.start);
|
|
240020
240216
|
let removedBeforeFragment = 0;
|
|
240021
240217
|
let previousStart = workingXml.length + 1;
|
|
@@ -240035,6 +240231,7 @@ function stripAttributedMoveMarkersForFragment(workingXml, fragment3, rangeMarke
|
|
|
240035
240231
|
return {
|
|
240036
240232
|
ok: true,
|
|
240037
240233
|
xml,
|
|
240234
|
+
...supportingParagraph ? { removedSupportingParagraphId: supportingParagraph.nodeId } : {},
|
|
240038
240235
|
fragment: {
|
|
240039
240236
|
...fragment3,
|
|
240040
240237
|
byteStart: fragment3.byteStart - removedBeforeFragment,
|
|
@@ -241172,7 +241369,7 @@ function dedupeRefs(refs) {
|
|
|
241172
241369
|
const seen = new Set;
|
|
241173
241370
|
const out = [];
|
|
241174
241371
|
for (const r of refs) {
|
|
241175
|
-
const key2 =
|
|
241372
|
+
const key2 = refKey(r);
|
|
241176
241373
|
if (seen.has(key2))
|
|
241177
241374
|
continue;
|
|
241178
241375
|
seen.add(key2);
|
|
@@ -241193,7 +241390,7 @@ function dedupeRemappedRefs(refs) {
|
|
|
241193
241390
|
return out;
|
|
241194
241391
|
}
|
|
241195
241392
|
function refKey(ref3) {
|
|
241196
|
-
return `${ref3.kind}|${ref3.entityId ?? ref3.commentId ?? ""}|${ref3.storyId ?? ""}`;
|
|
241393
|
+
return `${ref3.kind}|${ref3.entityId ?? ref3.commentId ?? ref3.nodeId ?? ""}|${ref3.storyId ?? ""}`;
|
|
241197
241394
|
}
|
|
241198
241395
|
var TD67, XML_TD, TE33, DOCUMENT_PART_URI3 = "/word/document.xml", DOCUMENT_RELS_PART_URI8 = "/word/_rels/document.xml.rels", NUMBERING_PART_URI4 = "/word/numbering.xml", CONTENT_TYPES_PART_URI10 = "/[Content_Types].xml", NUMBERING_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", COMMENTS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", NOTE_LIFECYCLE_PROVENANCE_NS = "urn:superdoc:note-lifecycle", NOTE_FAMILY_PROFILE, INDEXABLE_STRUCTURAL_KINDS, TRACKED_TABLE_COLUMN_RESTORE_NS = "urn:superdoc:tracked-table-column";
|
|
241199
241396
|
var init_compile_tracked_change_decide = __esm(() => {
|
|
@@ -241216,6 +241413,7 @@ var init_compile_tracked_change_decide = __esm(() => {
|
|
|
241216
241413
|
init_compile_tracked_change_decide_local();
|
|
241217
241414
|
init_compile_tracked_change_decide_fenced();
|
|
241218
241415
|
init_comment_tracked_change_metadata();
|
|
241416
|
+
init_tracked_table_move();
|
|
241219
241417
|
init_bibliography_review_resources();
|
|
241220
241418
|
init_image_review_resources();
|
|
241221
241419
|
init_decision_xml_analysis();
|
|
@@ -244644,7 +244842,7 @@ function prepareCompareTableBlockReplay(bytes, step2) {
|
|
|
244644
244842
|
cursor = range.end;
|
|
244645
244843
|
}
|
|
244646
244844
|
const namespaceBindings = new Map(Object.entries(body.namespaceBindings));
|
|
244647
|
-
const occupiedIds = ranges.flatMap((range) => range.tag.namespaceUri === NS_W && ["p", "tr"].includes(range.tag.localName) ? range.tag.attributes.filter((attr3) => attr3.namespaceUri ===
|
|
244845
|
+
const occupiedIds = ranges.flatMap((range) => range.tag.namespaceUri === NS_W && ["p", "tr"].includes(range.tag.localName) ? range.tag.attributes.filter((attr3) => attr3.namespaceUri === W146 && attr3.localName === "paraId").map((attr3) => attr3.value.toUpperCase()) : []);
|
|
244648
244846
|
const ids = safeTableParagraphIds(step2.tableXml, step2.storyId, body.namespaceBindings);
|
|
244649
244847
|
if (!ids)
|
|
244650
244848
|
return null;
|
|
@@ -244664,9 +244862,9 @@ function prepareCompareTableBlockReplay(bytes, step2) {
|
|
|
244664
244862
|
}
|
|
244665
244863
|
if (step2.kind !== "insertTable" || !["before", "after"].includes(step2.placement))
|
|
244666
244864
|
return null;
|
|
244667
|
-
const anchors = children.filter((range) => range.tag.namespaceUri === NS_W && range.tag.localName === "p" && range.tag.attributes.some((attr3) => attr3.namespaceUri ===
|
|
244865
|
+
const anchors = children.filter((range) => range.tag.namespaceUri === NS_W && range.tag.localName === "p" && range.tag.attributes.some((attr3) => attr3.namespaceUri === W146 && attr3.localName === "paraId" && attr3.value === step2.anchorBlockId));
|
|
244668
244866
|
const normalizedIds = ids.map((id) => id.toUpperCase());
|
|
244669
|
-
if (anchors.length !== 1 || ranges.some((range) => range.tag.attributes.some((attr3) => attr3.namespaceUri ===
|
|
244867
|
+
if (anchors.length !== 1 || ranges.some((range) => range.tag.attributes.some((attr3) => attr3.namespaceUri === W146 && attr3.localName === "paraId" && normalizedIds.includes(attr3.value.toUpperCase()))))
|
|
244670
244868
|
return null;
|
|
244671
244869
|
const at = byteOffsets[step2.placement === "before" ? anchors[0].start : anchors[0].end];
|
|
244672
244870
|
return { startByte: at, endByte: at, namespaceBindings, paragraphIds: ids, occupiedIds };
|
|
@@ -244689,8 +244887,8 @@ function safeTableParagraphIds(tableXml, storyId, namespaceBindings) {
|
|
|
244689
244887
|
if (tableCatalog.tables.length !== 1 || tableCatalog.tables.some((table) => table.containsNestedTable || !table.isRectangular || table.hasGridSpan || table.hasVMerge))
|
|
244690
244888
|
return null;
|
|
244691
244889
|
const paragraphs = payload.ranges.filter((range) => range.tag.namespaceUri === NS_W && range.tag.localName === "p");
|
|
244692
|
-
const paragraphIds = paragraphs.map((range) => range.tag.attributes.find((attr3) => attr3.namespaceUri ===
|
|
244693
|
-
const rowIds = payload.ranges.filter((range) => range.tag.namespaceUri === NS_W && range.tag.localName === "tr").flatMap((range) => range.tag.attributes.filter((attr3) => attr3.namespaceUri ===
|
|
244890
|
+
const paragraphIds = paragraphs.map((range) => range.tag.attributes.find((attr3) => attr3.namespaceUri === W146 && attr3.localName === "paraId")?.value);
|
|
244891
|
+
const rowIds = payload.ranges.filter((range) => range.tag.namespaceUri === NS_W && range.tag.localName === "tr").flatMap((range) => range.tag.attributes.filter((attr3) => attr3.namespaceUri === W146 && attr3.localName === "paraId").map((attr3) => attr3.value));
|
|
244694
244892
|
const normalizedIds = [...paragraphIds, ...rowIds].map((id) => id?.toUpperCase());
|
|
244695
244893
|
if (!paragraphs.length || normalizedIds.some((id) => !id || !/^[0-7][0-9A-F]{7}$/.test(id) || id === "00000000") || new Set(normalizedIds).size !== normalizedIds.length)
|
|
244696
244894
|
return null;
|
|
@@ -244703,7 +244901,7 @@ function remapReplacementTableParagraphIds(xml, namespaceBindings, nextId) {
|
|
|
244703
244901
|
});
|
|
244704
244902
|
const paragraphIds = [];
|
|
244705
244903
|
for (const range of parsed.ranges.filter((range2) => range2.tag.namespaceUri === NS_W && ["p", "tr"].includes(range2.tag.localName)).sort((a, b) => b.start - a.start)) {
|
|
244706
|
-
const attr3 = range.tag.attributes.find((attr4) => attr4.namespaceUri ===
|
|
244904
|
+
const attr3 = range.tag.attributes.find((attr4) => attr4.namespaceUri === W146 && attr4.localName === "paraId");
|
|
244707
244905
|
if (!attr3)
|
|
244708
244906
|
continue;
|
|
244709
244907
|
const raw = [...scanRawXmlAttributes(xml.slice(range.start, range.openEnd))].find((raw2) => raw2.name === attr3.name);
|
|
@@ -244714,7 +244912,7 @@ function remapReplacementTableParagraphIds(xml, namespaceBindings, nextId) {
|
|
|
244714
244912
|
}
|
|
244715
244913
|
return { xml, paragraphIds };
|
|
244716
244914
|
}
|
|
244717
|
-
var
|
|
244915
|
+
var W146 = "http://schemas.microsoft.com/office/word/2010/wordml", TE38, TD71, UNSAFE;
|
|
244718
244916
|
var init_compare_table_block_replay = __esm(() => {
|
|
244719
244917
|
init_xml_sax();
|
|
244720
244918
|
init_table_catalog();
|
|
@@ -252644,14 +252842,16 @@ function buildTableCreateDelta(input) {
|
|
|
252644
252842
|
return null;
|
|
252645
252843
|
const patch = input.patches[0];
|
|
252646
252844
|
const replacementXml = patch.kind === "insertBytes" || patch.kind === "replaceBytes" ? TD73.decode(patch.bytes) : "";
|
|
252647
|
-
const
|
|
252648
|
-
|
|
252845
|
+
const patchStart = patch.kind === "insertBytes" ? patch.atByte : patch.startByte;
|
|
252846
|
+
const namespaceBindings = namespaceBindingsAtPosition(input.bytes, patchStart);
|
|
252847
|
+
const tableSpans = findElementSpans(replacementXml, "tbl", namespaceBindings);
|
|
252848
|
+
const tableSpan = tableSpans[0];
|
|
252849
|
+
if (!tableSpan || tableSpans.length !== 1)
|
|
252649
252850
|
return null;
|
|
252650
252851
|
const tableXml = replacementXml.slice(tableSpan.start, tableSpan.end);
|
|
252651
|
-
const tableParagraphs = extractParagraphIds(tableXml);
|
|
252852
|
+
const tableParagraphs = extractParagraphIds(tableXml, tableSpan.namespaceBindings);
|
|
252652
252853
|
if (tableParagraphs[0] !== stripNodePrefix(input.intent.tableNodeId))
|
|
252653
252854
|
return null;
|
|
252654
|
-
const patchStart = patch.kind === "insertBytes" ? patch.atByte : patch.startByte;
|
|
252655
252855
|
const patchEnd = patch.kind === "insertBytes" ? patch.atByte : patch.endByte;
|
|
252656
252856
|
const replacedParagraphBefore = input.intent.replacedBlockId && patch.kind === "replaceBytes" ? extractParagraphPayloads({
|
|
252657
252857
|
storyId: input.storyId,
|
|
@@ -252669,6 +252869,7 @@ function buildTableCreateDelta(input) {
|
|
|
252669
252869
|
partUri: input.partUri,
|
|
252670
252870
|
tableNodeId: input.intent.tableNodeId,
|
|
252671
252871
|
tableXml,
|
|
252872
|
+
namespaceBindings: tableSpan.namespaceBindings,
|
|
252672
252873
|
baseByteOffset: tableByteStart,
|
|
252673
252874
|
baseXmlOffset: tableXmlStart
|
|
252674
252875
|
});
|
|
@@ -252681,6 +252882,7 @@ function buildTableCreateDelta(input) {
|
|
|
252681
252882
|
storyId: input.storyId,
|
|
252682
252883
|
partUri: input.partUri,
|
|
252683
252884
|
fragmentXml: beforeTable,
|
|
252885
|
+
namespaceBindings,
|
|
252684
252886
|
baseByteOffset: patchStart,
|
|
252685
252887
|
baseXmlOffset: xmlOffsetForByte(input.bytes, patchStart)
|
|
252686
252888
|
}).paragraphs,
|
|
@@ -252688,6 +252890,7 @@ function buildTableCreateDelta(input) {
|
|
|
252688
252890
|
storyId: input.storyId,
|
|
252689
252891
|
partUri: input.partUri,
|
|
252690
252892
|
fragmentXml: afterTable,
|
|
252893
|
+
namespaceBindings,
|
|
252691
252894
|
baseByteOffset: patchStart + utf8ByteLength5(replacementXml.slice(0, tableSpan.end)),
|
|
252692
252895
|
baseXmlOffset: xmlOffsetForByte(input.bytes, patchStart) + tableSpan.end
|
|
252693
252896
|
}).paragraphs
|
|
@@ -252829,13 +253032,22 @@ function buildTableMoveDelta(input) {
|
|
|
252829
253032
|
const inserted = input.patches.find((patch) => patch.kind === "insertBytes");
|
|
252830
253033
|
if (!removed || !inserted || inserted.atByte !== input.intent.destinationByte || inserted.atByte >= removed.startByte && inserted.atByte <= removed.endByte)
|
|
252831
253034
|
return null;
|
|
252832
|
-
|
|
253035
|
+
const sourceTableXml = decodeXmlByteRange(input.bytes, removed.startByte, removed.endByte);
|
|
253036
|
+
const insertedXml = TD73.decode(inserted.bytes);
|
|
253037
|
+
if (!insertedXml.startsWith(sourceTableXml))
|
|
253038
|
+
return null;
|
|
253039
|
+
const tailXml = insertedXml.slice(sourceTableXml.length);
|
|
253040
|
+
const trailingId = input.intent.trailingParagraphNodeId;
|
|
253041
|
+
const destinationBindings = namespaceBindingsAtPosition(input.bytes, inserted.atByte);
|
|
253042
|
+
if (trailingId ? readPlainTableTrailingParagraphId(tailXml, destinationBindings) !== trailingId : tailXml !== "")
|
|
253043
|
+
return null;
|
|
253044
|
+
if (trailingId && (input.intent.rowNodeId || collectXmlElementRanges(TD73.decode(input.bytes)).ranges.some((range) => range.tag.attributes.some((attribute2) => attribute2.namespaceUri === "http://schemas.microsoft.com/office/word/2010/wordml" && attribute2.localName === "paraId" && attribute2.value.toUpperCase() === trailingId.toUpperCase()))))
|
|
252833
253045
|
return null;
|
|
252834
253046
|
if (input.intent.rowNodeId)
|
|
252835
253047
|
return buildTableRowMoveDelta(input, removed, inserted);
|
|
252836
253048
|
const rewrite = buildTableRewriteDelta({
|
|
252837
253049
|
...input,
|
|
252838
|
-
patches: [{ kind: "replaceBytes", order: 0, startByte: removed.startByte, endByte: removed.endByte, bytes:
|
|
253050
|
+
patches: [{ kind: "replaceBytes", order: 0, startByte: removed.startByte, endByte: removed.endByte, bytes: TE40.encode(sourceTableXml) }]
|
|
252839
253051
|
});
|
|
252840
253052
|
if (!rewrite || rewrite.kind !== "table.rewrite")
|
|
252841
253053
|
return null;
|
|
@@ -252885,23 +253097,60 @@ function buildTableMoveDelta(input) {
|
|
|
252885
253097
|
const after = (at) => {
|
|
252886
253098
|
const previous = items.filter((item) => item.end <= at).at(-1);
|
|
252887
253099
|
const gapXml = previous ? xml.slice(previous.end, at) : null;
|
|
252888
|
-
return previous && gapXml != null && gapXml.
|
|
253100
|
+
return previous && gapXml != null && isTableMoveClosingMarkerGap(gapXml, parent.namespaceBindings) ? { placement: "after", relativeToBlockId: previous.last, projectionRelativeToBlockId: previous.projectionId, gapXml } : null;
|
|
252889
253101
|
};
|
|
252890
253102
|
const destination = xmlOffsetForByte(input.bytes, inserted.atByte);
|
|
252891
253103
|
const from = before(sourceEnd) ?? after(sourceStart);
|
|
252892
253104
|
const to = before(destination) ?? after(destination);
|
|
252893
253105
|
if (!from || !to)
|
|
252894
253106
|
return null;
|
|
253107
|
+
const trailingParagraph = trailingId ? extractParagraphPayloads({
|
|
253108
|
+
storyId: input.storyId,
|
|
253109
|
+
partUri: input.partUri,
|
|
253110
|
+
fragmentXml: tailXml,
|
|
253111
|
+
baseByteOffset: inserted.atByte + removed.endByte - removed.startByte,
|
|
253112
|
+
baseXmlOffset: destination + sourceTableXml.length,
|
|
253113
|
+
namespaceBindings: destinationBindings
|
|
253114
|
+
}).paragraphs[0] : undefined;
|
|
253115
|
+
if (trailingId && trailingParagraph?.nodeId !== trailingId)
|
|
253116
|
+
return null;
|
|
253117
|
+
const affectedBlockIds = uniqueStrings([...rewrite.affectedBlockIds, ...trailingId ? [trailingId] : []]);
|
|
252895
253118
|
return {
|
|
252896
253119
|
...rewrite,
|
|
252897
253120
|
kind: "table.move",
|
|
252898
253121
|
rows: rewrite.rowsBefore,
|
|
252899
253122
|
from,
|
|
252900
253123
|
to,
|
|
252901
|
-
|
|
253124
|
+
...trailingParagraph ? { trailingParagraph } : {},
|
|
253125
|
+
affectedBlockIds,
|
|
253126
|
+
...trailingParagraph ? tableMoveTrailingXmlChange(input) : {},
|
|
253127
|
+
projectionScope: { ...rewrite.projectionScope, blockIds: affectedBlockIds },
|
|
253128
|
+
createdNodeIds: trailingId ? [structuralNode(input.storyId, input.partUri, trailingId, "paragraph", null)] : [],
|
|
252902
253129
|
deletedNodeIds: []
|
|
252903
253130
|
};
|
|
252904
253131
|
}
|
|
253132
|
+
function tableMoveTrailingXmlChange(input) {
|
|
253133
|
+
const paragraphs = input.state.paragraphIndexes.get(input.storyId)?.entries ?? [];
|
|
253134
|
+
const final = [...paragraphs].sort((a, b) => b.byteEnd - a.byteEnd)[0];
|
|
253135
|
+
if (!final || input.intent.destinationByte <= final.byteEnd)
|
|
253136
|
+
return {};
|
|
253137
|
+
const xml = TD73.decode(input.bytes);
|
|
253138
|
+
const parsed = collectXmlElementRanges(xml);
|
|
253139
|
+
if (parsed.errors.length)
|
|
253140
|
+
return {};
|
|
253141
|
+
const body = parsed.ranges.find((range) => range.tag.namespaceUri === "http://schemas.openxmlformats.org/wordprocessingml/2006/main" && range.tag.localName === "body");
|
|
253142
|
+
const start = xmlOffsetForByte(input.bytes, final.byteEnd);
|
|
253143
|
+
const destination = xmlOffsetForByte(input.bytes, input.intent.destinationByte);
|
|
253144
|
+
if (!body || destination > body.closeStart || !xml.slice(start, destination).trim())
|
|
253145
|
+
return {};
|
|
253146
|
+
const paragraphStart = xmlOffsetForByte(input.bytes, final.byteStart);
|
|
253147
|
+
const container = parsed.ranges.filter((range) => range.start >= body.openEnd && range.end <= body.closeStart && range.start <= paragraphStart && range.end >= start).sort((a, b) => a.start - b.start)[0];
|
|
253148
|
+
const finalTable = container?.tag.namespaceUri === body.tag.namespaceUri && container.tag.localName === "tbl" && getOrBuildTableCatalogForStory(input.state, input.storyId)?.tables.some((table) => xmlOffsetForByte(input.bytes, table.tableByteStart) === container.start && xmlOffsetForByte(input.bytes, table.tableByteEnd) === container.end);
|
|
253149
|
+
const gapStart = finalTable && container ? container.end : start;
|
|
253150
|
+
if (destination < gapStart || !isTableMoveClosingMarkerGap(xml.slice(gapStart, destination), body.namespaceBindings))
|
|
253151
|
+
return {};
|
|
253152
|
+
return { storyTrailingXml: { before: xml.slice(start, body.closeStart), after: xml.slice(destination, body.closeStart) } };
|
|
253153
|
+
}
|
|
252905
253154
|
function buildTrackedTableMoveDeltas(input) {
|
|
252906
253155
|
if (input.patches.length !== 2)
|
|
252907
253156
|
return null;
|
|
@@ -252919,6 +253168,16 @@ function buildTrackedTableMoveDeltas(input) {
|
|
|
252919
253168
|
return null;
|
|
252920
253169
|
const sourceTableXml = sourceReplacement.slice(sourceTables[0].start, sourceTables[0].end);
|
|
252921
253170
|
const destinationTableXml = destinationReplacement.slice(destinationTables[0].start, destinationTables[0].end);
|
|
253171
|
+
const destinationRanges = collectXmlElementRanges(destinationReplacement, {
|
|
253172
|
+
fragment: true,
|
|
253173
|
+
additionalNamespaces: namespaceBindingsAtPosition(input.bytes, destinationPatch.atByte)
|
|
253174
|
+
});
|
|
253175
|
+
if (destinationRanges.errors.length)
|
|
253176
|
+
return null;
|
|
253177
|
+
const rangeEnd = destinationRanges.ranges.find((range) => range.start >= destinationTables[0].end && range.tag.namespaceUri === "http://schemas.openxmlformats.org/wordprocessingml/2006/main" && range.tag.localName === "moveToRangeEnd");
|
|
253178
|
+
const trailingXml = destinationReplacement.slice(rangeEnd?.end ?? destinationTables[0].end);
|
|
253179
|
+
if (input.intent.trailingParagraphNodeId ? readPlainTableTrailingParagraphId(trailingXml) !== input.intent.trailingParagraphNodeId || collectXmlElementRanges(TD73.decode(input.bytes)).ranges.some((range) => range.tag.attributes.some((attribute2) => attribute2.namespaceUri === "http://schemas.microsoft.com/office/word/2010/wordml" && attribute2.localName === "paraId" && attribute2.value.toUpperCase() === input.intent.trailingParagraphNodeId.toUpperCase())) : trailingXml.trim() !== "")
|
|
253180
|
+
return null;
|
|
252922
253181
|
const directMove = buildTableMoveDelta({
|
|
252923
253182
|
...input,
|
|
252924
253183
|
patches: [
|
|
@@ -252930,7 +253189,7 @@ function buildTrackedTableMoveDeltas(input) {
|
|
|
252930
253189
|
bytes: input.bytes.slice(sourcePatch.startByte, sourcePatch.endByte)
|
|
252931
253190
|
}
|
|
252932
253191
|
],
|
|
252933
|
-
intent: input.intent
|
|
253192
|
+
intent: { tableNodeId: input.intent.tableNodeId, destinationByte: input.intent.destinationByte }
|
|
252934
253193
|
});
|
|
252935
253194
|
if (!directMove || directMove.kind !== "table.move")
|
|
252936
253195
|
return null;
|
|
@@ -252948,9 +253207,11 @@ function buildTrackedTableMoveDeltas(input) {
|
|
|
252948
253207
|
};
|
|
252949
253208
|
const destinationRows = findElementSpans(destinationTableXml, "tr", destinationTables[0].namespaceBindings);
|
|
252950
253209
|
const cellCounts = destinationRows.map((row) => findElementSpans(destinationTableXml.slice(row.start, row.end), "tc", row.namespaceBindings).length);
|
|
252951
|
-
const destinationParagraphId = extractParagraphIds(destinationTableXml)[0];
|
|
253210
|
+
const destinationParagraphId = extractParagraphIds(destinationTableXml, destinationTables[0].namespaceBindings)[0];
|
|
252952
253211
|
if (!destinationParagraphId || cellCounts.length === 0 || cellCounts.some((count) => count < 1))
|
|
252953
253212
|
return null;
|
|
253213
|
+
const storyTrailing = input.intent.trailingParagraphNodeId ? tableMoveTrailingXmlChange(input) : {};
|
|
253214
|
+
const tailAnchor = storyTrailing.storyTrailingXml ? input.intent.trailingParagraphNodeId : undefined;
|
|
252954
253215
|
const destinationBase = buildTableCreateDelta({
|
|
252955
253216
|
storyId: input.storyId,
|
|
252956
253217
|
partUri: input.partUri,
|
|
@@ -252961,18 +253222,23 @@ function buildTrackedTableMoveDeltas(input) {
|
|
|
252961
253222
|
tableNodeId: `tbl:${destinationParagraphId}`,
|
|
252962
253223
|
rows: cellCounts.length,
|
|
252963
253224
|
columns: cellCounts[0],
|
|
252964
|
-
placement: directMove.to.placement,
|
|
252965
|
-
relativeToBlockId: directMove.to.relativeToBlockId,
|
|
252966
|
-
...directMove.to.projectionRelativeToBlockId ? { projectionRelativeToBlockId: directMove.to.projectionRelativeToBlockId } : {},
|
|
253225
|
+
placement: tailAnchor ? "before" : directMove.to.placement,
|
|
253226
|
+
relativeToBlockId: tailAnchor ?? directMove.to.relativeToBlockId,
|
|
253227
|
+
...tailAnchor || directMove.to.projectionRelativeToBlockId ? { projectionRelativeToBlockId: tailAnchor ?? directMove.to.projectionRelativeToBlockId } : {},
|
|
252967
253228
|
paragraphNodeIdsBeforeTable: [],
|
|
252968
|
-
paragraphNodeIdsAfterTable: []
|
|
253229
|
+
paragraphNodeIdsAfterTable: input.intent.trailingParagraphNodeId ? [input.intent.trailingParagraphNodeId] : []
|
|
252969
253230
|
}
|
|
252970
253231
|
});
|
|
252971
253232
|
if (!destinationBase)
|
|
252972
253233
|
return null;
|
|
252973
253234
|
const destination = {
|
|
252974
253235
|
...destinationBase,
|
|
252975
|
-
|
|
253236
|
+
...storyTrailing,
|
|
253237
|
+
paragraphsAfterTable: destinationBase.paragraphsAfterTable.map((paragraph) => paragraph.nodeId === input.intent.trailingParagraphNodeId ? { ...paragraph, leadingXml: "" } : paragraph),
|
|
253238
|
+
tableProjection: {
|
|
253239
|
+
...destinationBase.tableProjection,
|
|
253240
|
+
tableXmlAfter: destinationReplacement.slice(0, destinationReplacement.length - trailingXml.length)
|
|
253241
|
+
}
|
|
252976
253242
|
};
|
|
252977
253243
|
return [source, destination];
|
|
252978
253244
|
}
|
|
@@ -253608,8 +253874,8 @@ function structuralNode(storyId, partUri, nodeId, nodeKind, parentNodeId) {
|
|
|
253608
253874
|
function parentCellForParagraph(row, paragraphId2) {
|
|
253609
253875
|
return row.cells.find((cell) => cell.paragraphIds.includes(paragraphId2))?.cellNodeId ?? null;
|
|
253610
253876
|
}
|
|
253611
|
-
function extractParagraphIds(xml) {
|
|
253612
|
-
return findElementSpans(xml, "p").map((span) => readParaIdFromParagraphXml(xml.slice(span.start, span.end))).filter((id) => Boolean(id));
|
|
253877
|
+
function extractParagraphIds(xml, namespaceBindings) {
|
|
253878
|
+
return findElementSpans(xml, "p", namespaceBindings).map((span) => readParaIdFromParagraphXml(xml.slice(span.start, span.end), span.namespaceBindings)).filter((id) => Boolean(id));
|
|
253613
253879
|
}
|
|
253614
253880
|
function extractFirstParaId(xml) {
|
|
253615
253881
|
const spans = findElementSpans(xml, "p");
|
|
@@ -253832,6 +254098,7 @@ var init_compile_table_ops = __esm(() => {
|
|
|
253832
254098
|
init_retired_story_relationships();
|
|
253833
254099
|
init_sd_document_state();
|
|
253834
254100
|
init_paragraph_para_id_attrs();
|
|
254101
|
+
init_table_trailing_paragraph();
|
|
253835
254102
|
init_revision_wid_allocator();
|
|
253836
254103
|
init_table_cell_text_replacement();
|
|
253837
254104
|
init_execution_backend();
|
|
@@ -262515,7 +262782,7 @@ function sanitizeRelationships(relsUri, bytes, finalPartKeys, ownerBytes) {
|
|
|
262515
262782
|
for (const range of removals.reverse()) {
|
|
262516
262783
|
sanitized = sanitized.slice(0, range.start) + sanitized.slice(range.end);
|
|
262517
262784
|
}
|
|
262518
|
-
return
|
|
262785
|
+
return TEXT_ENCODER2.encode(sanitized);
|
|
262519
262786
|
}
|
|
262520
262787
|
function insertRootAttribute(tag, attribute2) {
|
|
262521
262788
|
return tag.replace(/\/?>(?=$)/, (ending) => ` ${attribute2}${ending}`);
|
|
@@ -262560,7 +262827,7 @@ function sanitizeWordNamespaces(bytes) {
|
|
|
262560
262827
|
} else {
|
|
262561
262828
|
tag = insertRootAttribute(tag, `${mcPrefix}:Ignorable="${missing.join(" ")}"`);
|
|
262562
262829
|
}
|
|
262563
|
-
return
|
|
262830
|
+
return TEXT_ENCODER2.encode(xml.slice(0, root.index) + tag + xml.slice(root.index + root[0].length));
|
|
262564
262831
|
}
|
|
262565
262832
|
function removeOrphanContentTypeOverrides(bytes, removedRels) {
|
|
262566
262833
|
if (!removedRels.size)
|
|
@@ -262576,7 +262843,7 @@ function removeOrphanContentTypeOverrides(bytes, removedRels) {
|
|
|
262576
262843
|
for (const range of removals.reverse()) {
|
|
262577
262844
|
sanitized = sanitized.slice(0, range.start) + sanitized.slice(range.end);
|
|
262578
262845
|
}
|
|
262579
|
-
return
|
|
262846
|
+
return TEXT_ENCODER2.encode(sanitized);
|
|
262580
262847
|
}
|
|
262581
262848
|
function sanitizeDocxPackageEntries(entries, options = {}) {
|
|
262582
262849
|
const allKeys = new Set([...entries.keys()].map(partKey));
|
|
@@ -262620,12 +262887,12 @@ function sanitizeDocxPartForExport(partUri, bytes, finalPartUris, ownerBytes, is
|
|
|
262620
262887
|
}
|
|
262621
262888
|
return bytes;
|
|
262622
262889
|
}
|
|
262623
|
-
var TEXT_DECODER6,
|
|
262890
|
+
var TEXT_DECODER6, TEXT_ENCODER2, RELATIONSHIPS_NS2 = "http://schemas.openxmlformats.org/package/2006/relationships", OFFICE_RELATIONSHIPS_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", STYLES_WITH_EFFECTS_RELATIONSHIP_NS = "http://schemas.microsoft.com/office/2007/relationships/stylesWithEffects", CONTENT_TYPES_NS5 = "http://schemas.openxmlformats.org/package/2006/content-types", MC_NS3 = "http://schemas.openxmlformats.org/markup-compatibility/2006", OFFICE_WORD_NAMESPACES;
|
|
262624
262891
|
var init_docx_package_sanitizer = __esm(() => {
|
|
262625
262892
|
init_xml_sax();
|
|
262626
262893
|
init_content_types();
|
|
262627
262894
|
TEXT_DECODER6 = new TextDecoder;
|
|
262628
|
-
|
|
262895
|
+
TEXT_ENCODER2 = new TextEncoder;
|
|
262629
262896
|
OFFICE_WORD_NAMESPACES = {
|
|
262630
262897
|
w14: "http://schemas.microsoft.com/office/word/2010/wordml",
|
|
262631
262898
|
w15: "http://schemas.microsoft.com/office/word/2012/wordml",
|
|
@@ -263625,10 +263892,21 @@ function rebaseTableMoveHistory(state, entry, direction) {
|
|
|
263625
263892
|
const expectedRows = original.kind === "table.move" ? original.rows : direction === "undo" ? original.rowsAfter : original.rowsBefore;
|
|
263626
263893
|
if (JSON.stringify(owners(rows)) !== JSON.stringify(owners(expectedRows)))
|
|
263627
263894
|
return null;
|
|
263895
|
+
const trailing = original.kind === "table.move" ? original.trailingParagraph : undefined;
|
|
263896
|
+
const currentTrailing = trailing ? paragraphs.byParaId(trailing.nodeId) : undefined;
|
|
263897
|
+
if (trailing && (direction === "undo" ? !currentTrailing || currentTrailing.byteStart !== moved.end || readPlainTableTrailingParagraphId(TD82.decode(bytes.subarray(currentTrailing.byteStart, currentTrailing.byteEnd)), namespaceBindingsAtPosition(bytes, currentTrailing.byteStart)) !== trailing.nodeId : currentTrailing != null))
|
|
263898
|
+
return null;
|
|
263628
263899
|
const patches = [
|
|
263629
263900
|
{ kind: "deleteBytes", order: 0, startByte: moved.start, endByte: moved.end },
|
|
263630
|
-
{ kind: "insertBytes", order: 1, atByte, bytes: currentBytes.slice() }
|
|
263901
|
+
{ kind: "insertBytes", order: 1, atByte, bytes: trailing && direction === "redo" ? TE47.encode(TD82.decode(currentBytes) + trailing.xml) : currentBytes.slice() }
|
|
263631
263902
|
];
|
|
263903
|
+
if (trailing && direction === "undo" && currentTrailing)
|
|
263904
|
+
patches.push({
|
|
263905
|
+
kind: "deleteBytes",
|
|
263906
|
+
order: 2,
|
|
263907
|
+
startByte: currentTrailing.byteStart,
|
|
263908
|
+
endByte: currentTrailing.byteEnd
|
|
263909
|
+
});
|
|
263632
263910
|
const delta = original.kind === "table.row.move" ? buildTableMoveDelta({
|
|
263633
263911
|
state,
|
|
263634
263912
|
storyId: original.storyId,
|
|
@@ -263638,15 +263916,18 @@ function rebaseTableMoveHistory(state, entry, direction) {
|
|
|
263638
263916
|
intent: { tableNodeId: table.tableNodeId, rowNodeId: original.rowNodeId, destinationByte: atByte }
|
|
263639
263917
|
}) : {
|
|
263640
263918
|
...original,
|
|
263919
|
+
...original.storyTrailingXml ? { storyTrailingXml: direction === "undo" ? { before: original.storyTrailingXml.after, after: original.storyTrailingXml.before } : original.storyTrailingXml } : {},
|
|
263641
263920
|
from,
|
|
263642
263921
|
to,
|
|
263643
263922
|
rows,
|
|
263923
|
+
createdNodeIds: direction === "undo" ? original.deletedNodeIds : original.createdNodeIds,
|
|
263924
|
+
deletedNodeIds: direction === "undo" ? original.createdNodeIds : original.deletedNodeIds,
|
|
263644
263925
|
tableProjection: { ...original.tableProjection, tableXmlBefore: xml, tableXmlAfter: xml }
|
|
263645
263926
|
};
|
|
263646
263927
|
if (!delta)
|
|
263647
263928
|
return null;
|
|
263648
263929
|
const startByte = Math.min(moved.start, atByte);
|
|
263649
|
-
const endByte = Math.max(moved.end, atByte);
|
|
263930
|
+
const endByte = Math.max(moved.end, atByte, direction === "undo" ? currentTrailing?.byteEnd ?? 0 : 0);
|
|
263650
263931
|
const patch = direction === "undo" ? entry.inversePatchGroup : entry.forwardPatchGroup;
|
|
263651
263932
|
return {
|
|
263652
263933
|
delta,
|
|
@@ -263689,6 +263970,7 @@ var init_table_move_history = __esm(() => {
|
|
|
263689
263970
|
init_compile_table_ops();
|
|
263690
263971
|
init_sha256_sync();
|
|
263691
263972
|
init_paragraph_para_id_attrs();
|
|
263973
|
+
init_table_trailing_paragraph();
|
|
263692
263974
|
TD82 = new TextDecoder;
|
|
263693
263975
|
TE47 = new TextEncoder;
|
|
263694
263976
|
});
|
|
@@ -268961,20 +269243,20 @@ function readScalarDocumentProperty(session, name) {
|
|
|
268961
269243
|
return typedValue(value.tag.localName, value.text);
|
|
268962
269244
|
}
|
|
268963
269245
|
function readScalarDocumentVariable(session, name) {
|
|
268964
|
-
const root = readRelatedRoot(session, REL_TYPE.settings,
|
|
269246
|
+
const root = readRelatedRoot(session, REL_TYPE.settings, W6, "settings", true);
|
|
268965
269247
|
if (root === "missing")
|
|
268966
269248
|
return missing;
|
|
268967
269249
|
if (!root)
|
|
268968
269250
|
return unavailable2;
|
|
268969
|
-
const matches = children(root,
|
|
269251
|
+
const matches = children(root, W6, "docVars").flatMap((vars) => children(vars, W6, "docVar")).filter((entry) => entry.tag.attributes.some((attr3) => attr3.namespaceUri === W6 && attr3.localName === "name" && attr3.value === name));
|
|
268970
269252
|
if (!matches.length)
|
|
268971
269253
|
return missing;
|
|
268972
269254
|
if (matches.length !== 1 || matches[0].children.length)
|
|
268973
269255
|
return unavailable2;
|
|
268974
|
-
const value = matches[0].tag.attributes.find((attr3) => attr3.namespaceUri ===
|
|
269256
|
+
const value = matches[0].tag.attributes.find((attr3) => attr3.namespaceUri === W6 && attr3.localName === "val");
|
|
268975
269257
|
return value ? { kind: "value", value: value.value } : unavailable2;
|
|
268976
269258
|
}
|
|
268977
|
-
var CP = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties", DC = "http://purl.org/dc/elements/1.1/", DCTERMS = "http://purl.org/dc/terms/", APP = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", CUSTOM = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties", VT = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",
|
|
269259
|
+
var CP = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties", DC = "http://purl.org/dc/elements/1.1/", DCTERMS = "http://purl.org/dc/terms/", APP = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", CUSTOM = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties", VT = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", W6 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TD84, unavailable2, missing, BUILTINS;
|
|
268978
269260
|
var init_scalar_properties = __esm(() => {
|
|
268979
269261
|
init_relationships();
|
|
268980
269262
|
init_xml_sax();
|
|
@@ -269757,11 +270039,6 @@ var init_tracked_toc_replacement = __esm(() => {
|
|
|
269757
270039
|
init_tracked_toc_insertion();
|
|
269758
270040
|
});
|
|
269759
270041
|
|
|
269760
|
-
// ../../../v2/editor-core/dist/document/transactions/tracked-table-move.js
|
|
269761
|
-
var init_tracked_table_move = __esm(() => {
|
|
269762
|
-
init_tracked_block_move();
|
|
269763
|
-
});
|
|
269764
|
-
|
|
269765
270042
|
// ../../../v2/editor-core/dist/document/transactions/tracked-inserted-paragraph-content.js
|
|
269766
270043
|
function prepareTrackedInsertedParagraphContent(input) {
|
|
269767
270044
|
const parse6 = (xml2) => {
|
|
@@ -269981,6 +270258,7 @@ var init_sd_document_session_internal = __esm(() => {
|
|
|
269981
270258
|
init_tracked_block_replacement();
|
|
269982
270259
|
init_table_cell_content();
|
|
269983
270260
|
init_tracked_table_move();
|
|
270261
|
+
init_table_trailing_paragraph();
|
|
269984
270262
|
init_tracked_block_move();
|
|
269985
270263
|
init_tracked_sdt_replacement();
|
|
269986
270264
|
init_tracked_inserted_paragraph_content();
|
|
@@ -307231,7 +307509,7 @@ class V2AnchoredMetadataAdapter {
|
|
|
307231
307509
|
throw metadataWrapRejectError(wrapped.reason);
|
|
307232
307510
|
if (wrapped.contained) {
|
|
307233
307511
|
const ids = countBodyControlIds(documentXml);
|
|
307234
|
-
if (!ids || wrapped.parentId !== null && ids.get(wrapped.parentId) !== 1 || buildStructuralBoundaryMap(
|
|
307512
|
+
if (!ids || wrapped.parentId !== null && ids.get(wrapped.parentId) !== 1 || buildStructuralBoundaryMap(TEXT_ENCODER3.encode(documentXml)).byBlockId(segment.blockId)?.blockSdtPath.length) {
|
|
307235
307513
|
throw metadataWrapRejectError("text-range-in-sdt");
|
|
307236
307514
|
}
|
|
307237
307515
|
}
|
|
@@ -307663,7 +307941,7 @@ function countBodyControlIds(documentXml) {
|
|
|
307663
307941
|
function contiguousAnchorPrefix(documentXml, matches) {
|
|
307664
307942
|
if (matches.length <= 1)
|
|
307665
307943
|
return [...matches];
|
|
307666
|
-
const map3 = buildStructuralBoundaryMap(
|
|
307944
|
+
const map3 = buildStructuralBoundaryMap(TEXT_ENCODER3.encode(documentXml));
|
|
307667
307945
|
const first = map3.byBlockId(matches[0].blockId);
|
|
307668
307946
|
if (!first)
|
|
307669
307947
|
return [matches[0]];
|
|
@@ -307752,7 +308030,7 @@ function resolveMultiSegmentTarget(documentXml, target) {
|
|
|
307752
308030
|
function validateContiguousStructuralRun(documentXml, blockIds) {
|
|
307753
308031
|
if (blockIds.length <= 1)
|
|
307754
308032
|
return null;
|
|
307755
|
-
const map3 = buildStructuralBoundaryMap(
|
|
308033
|
+
const map3 = buildStructuralBoundaryMap(TEXT_ENCODER3.encode(documentXml));
|
|
307756
308034
|
const contexts = blockIds.map((blockId) => map3.byBlockId(blockId));
|
|
307757
308035
|
const first = contexts[0];
|
|
307758
308036
|
if (!first) {
|
|
@@ -308002,7 +308280,7 @@ function overlaps(left, right) {
|
|
|
308002
308280
|
return false;
|
|
308003
308281
|
return leftSegments.some((leftSegment) => rightSegments.some((rightSegment) => leftSegment.blockId === rightSegment.blockId && rangesStrictlyOverlap(leftSegment.start, leftSegment.end, rightSegment.start, rightSegment.end)));
|
|
308004
308282
|
}
|
|
308005
|
-
var
|
|
308283
|
+
var TEXT_ENCODER3, WORD_NAMESPACE6 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", METADATA_ANCHOR_ALIAS = "Anchored metadata", W15_NS = "http://schemas.microsoft.com/office/word/2012/wordml", MAX_SDT_ID = 2147483646;
|
|
308006
308284
|
var init_adapter3 = __esm(() => {
|
|
308007
308285
|
init_src3();
|
|
308008
308286
|
init_sd_document_session_internal();
|
|
@@ -308012,7 +308290,7 @@ var init_adapter3 = __esm(() => {
|
|
|
308012
308290
|
init_adapter2();
|
|
308013
308291
|
init_shared();
|
|
308014
308292
|
init_xml();
|
|
308015
|
-
|
|
308293
|
+
TEXT_ENCODER3 = new TextEncoder;
|
|
308016
308294
|
});
|
|
308017
308295
|
|
|
308018
308296
|
// ../../../v2/document-api-v2-adapter/dist/paragraph-run-boundary.js
|
|
@@ -309267,16 +309545,16 @@ function prepareTrackedParagraphBodyReplacement(input) {
|
|
|
309267
309545
|
if (parsed.errors.length)
|
|
309268
309546
|
return null;
|
|
309269
309547
|
const ranges = parsed.ranges.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
309270
|
-
if (ranges.some(({ tag }) => tag.namespaceUri ===
|
|
309548
|
+
if (ranges.some(({ tag }) => tag.namespaceUri === W7 && ["ins", "del", "moveFrom", "moveTo", "pPrChange", "rPrChange"].includes(tag.localName)))
|
|
309271
309549
|
return null;
|
|
309272
309550
|
const paragraphs = [];
|
|
309273
309551
|
let end = 0;
|
|
309274
309552
|
for (const range of ranges) {
|
|
309275
309553
|
if (range.start < end)
|
|
309276
309554
|
continue;
|
|
309277
|
-
if (xml2.slice(end, range.start).trim() || range.tag.namespaceUri !==
|
|
309555
|
+
if (xml2.slice(end, range.start).trim() || range.tag.namespaceUri !== W7 || range.tag.localName !== "p")
|
|
309278
309556
|
return null;
|
|
309279
|
-
const properties2 = ranges.find((child) => child.start >= range.openEnd && child.end <= range.closeStart && child.tag.namespaceUri ===
|
|
309557
|
+
const properties2 = ranges.find((child) => child.start >= range.openEnd && child.end <= range.closeStart && child.tag.namespaceUri === W7 && child.tag.localName === "pPr");
|
|
309280
309558
|
if (properties2 && xml2.slice(range.openEnd, properties2.start).trim())
|
|
309281
309559
|
return null;
|
|
309282
309560
|
paragraphs.push({
|
|
@@ -309326,7 +309604,7 @@ function prepareTrackedParagraphBodyReplacement(input) {
|
|
|
309326
309604
|
const xml = input.beforeXml.slice(0, original.range.openEnd).replace(/\/>$/, ">") + properties + runs.xml + `</${original.range.tag.name}>` + input.beforeXml.slice(original.range.end);
|
|
309327
309605
|
return { xml, wordIds };
|
|
309328
309606
|
}
|
|
309329
|
-
var
|
|
309607
|
+
var W7 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
309330
309608
|
var init_tracked_paragraph_body = __esm(() => {
|
|
309331
309609
|
init_sd_document_session_internal();
|
|
309332
309610
|
});
|
|
@@ -310563,7 +310841,7 @@ function prepareRowOptionsMutation(resolved) {
|
|
|
310563
310841
|
const rowStart = TD91.decode(resolved.bytes.subarray(0, resolved.row.rowByteStart)).length;
|
|
310564
310842
|
const rowEnd = TD91.decode(resolved.bytes.subarray(0, resolved.row.rowByteEnd)).length;
|
|
310565
310843
|
const parsed = collectXmlElementRanges(source);
|
|
310566
|
-
const range = parsed.ranges.find((range2) => range2.start === rowStart && range2.end === rowEnd && range2.tag.namespaceUri ===
|
|
310844
|
+
const range = parsed.ranges.find((range2) => range2.start === rowStart && range2.end === rowEnd && range2.tag.namespaceUri === W8 && range2.tag.localName === "tr");
|
|
310567
310845
|
if (parsed.errors.length || !range)
|
|
310568
310846
|
throw new Error("The resolved table row has no matching source range.");
|
|
310569
310847
|
const children2 = [];
|
|
@@ -310574,15 +310852,15 @@ function prepareRowOptionsMutation(resolved) {
|
|
|
310574
310852
|
children2.push(child);
|
|
310575
310853
|
cursor = child.end;
|
|
310576
310854
|
}
|
|
310577
|
-
const property2 = children2.find((child) => child.tag.namespaceUri ===
|
|
310578
|
-
const exception = children2.find((child) => child.tag.namespaceUri ===
|
|
310579
|
-
const cells = children2.filter((child) => child.tag.namespaceUri ===
|
|
310855
|
+
const property2 = children2.find((child) => child.tag.namespaceUri === W8 && child.tag.localName === "trPr");
|
|
310856
|
+
const exception = children2.find((child) => child.tag.namespaceUri === W8 && child.tag.localName === "tblPrEx");
|
|
310857
|
+
const cells = children2.filter((child) => child.tag.namespaceUri === W8 && child.tag.localName === "tc");
|
|
310580
310858
|
const model = parseTableXmlModel(resolved.tableXml, true);
|
|
310581
310859
|
model.rows = parseTableXmlModel("<w:tbl>" + source.slice(rowStart, rowEnd) + "</w:tbl>", true).rows;
|
|
310582
310860
|
const row = model.rows[0];
|
|
310583
310861
|
if (!row || row.cells.length !== cells.length)
|
|
310584
310862
|
throw new Error("The resolved row cells have no matching source ranges.");
|
|
310585
|
-
const sharedPrefix = Object.keys(range.namespaceBindings).find((prefix) => prefix && range.namespaceBindings[prefix] ===
|
|
310863
|
+
const sharedPrefix = Object.keys(range.namespaceBindings).find((prefix) => prefix && range.namespaceBindings[prefix] === W8 && (!property2 || property2.namespaceBindings[prefix] === W8));
|
|
310586
310864
|
model.prefix = sharedPrefix ?? "tr";
|
|
310587
310865
|
if (!sharedPrefix)
|
|
310588
310866
|
for (let suffix = 1;range.namespaceBindings[model.prefix] != null || property2?.namespaceBindings[model.prefix] != null; suffix++)
|
|
@@ -310599,9 +310877,9 @@ function prepareRowOptionsMutation(resolved) {
|
|
|
310599
310877
|
let cellXml = next ? renderCellXmlModel(next) : "";
|
|
310600
310878
|
if (next && cellXml === originalCellXmls[index])
|
|
310601
310879
|
cellXml = source.slice(cell.start, cell.end);
|
|
310602
|
-
else if (cell.namespaceBindings[model.prefix] !==
|
|
310880
|
+
else if (cell.namespaceBindings[model.prefix] !== W8) {
|
|
310603
310881
|
for (const name of ["tcPr", "cellDel"])
|
|
310604
|
-
cellXml = cellXml.replace(`<${model.prefix}:${name}`, `<${model.prefix}:${name} xmlns:${model.prefix}="${
|
|
310882
|
+
cellXml = cellXml.replace(`<${model.prefix}:${name}`, `<${model.prefix}:${name} xmlns:${model.prefix}="${W8}"`);
|
|
310605
310883
|
}
|
|
310606
310884
|
return {
|
|
310607
310885
|
start: cell.start - tableStart,
|
|
@@ -310615,7 +310893,7 @@ function prepareRowOptionsMutation(resolved) {
|
|
|
310615
310893
|
const close = range.tag.isSelfClosing ? `</${range.tag.name}>` : "";
|
|
310616
310894
|
let propertyXml = row.trPrXml ?? "";
|
|
310617
310895
|
const attributes = property2 ? source.slice(property2.start + 1 + property2.tag.name.length, property2.openEnd).replace(/\/?\s*>$/, "") : "";
|
|
310618
|
-
const declaration = (property2?.namespaceBindings ?? range.namespaceBindings)[model.prefix] ===
|
|
310896
|
+
const declaration = (property2?.namespaceBindings ?? range.namespaceBindings)[model.prefix] === W8 ? "" : ` xmlns:${model.prefix}="${W8}"`;
|
|
310619
310897
|
propertyXml = propertyXml.replace(/^<[^>]+>/, (tag) => `<${model.prefix}:trPr${attributes}${declaration}${/\/\s*>$/.test(tag) ? "/>" : ">"}`);
|
|
310620
310898
|
replacements.push({ start, end, xml: open2 + propertyXml + close });
|
|
310621
310899
|
let xml = resolved.tableXml;
|
|
@@ -310636,7 +310914,7 @@ function renderTableMutationXml(resolved, model) {
|
|
|
310636
310914
|
const source = TD91.decode(resolved.bytes);
|
|
310637
310915
|
const tableStart = TD91.decode(resolved.bytes.subarray(0, resolved.table.tableByteStart)).length;
|
|
310638
310916
|
const parsed = collectXmlElementRanges(source);
|
|
310639
|
-
const table = parsed.ranges.find((range) => range.start === tableStart && range.end === tableStart + resolved.tableXml.length && range.tag.namespaceUri ===
|
|
310917
|
+
const table = parsed.ranges.find((range) => range.start === tableStart && range.end === tableStart + resolved.tableXml.length && range.tag.namespaceUri === W8 && range.tag.localName === "tbl");
|
|
310640
310918
|
if (parsed.errors.length || !table)
|
|
310641
310919
|
return renderTableXmlModel(model);
|
|
310642
310920
|
const ranges = parsed.ranges.filter((range) => range.start >= table.openEnd && range.end <= table.closeStart).sort((left, right) => left.start - right.start || right.end - left.end);
|
|
@@ -310646,7 +310924,7 @@ function renderTableMutationXml(resolved, model) {
|
|
|
310646
310924
|
if (range.start < cursor)
|
|
310647
310925
|
continue;
|
|
310648
310926
|
cursor = range.end;
|
|
310649
|
-
if (range.tag.namespaceUri ===
|
|
310927
|
+
if (range.tag.namespaceUri === W8 && range.tag.localName === "tblPr")
|
|
310650
310928
|
properties.push(range);
|
|
310651
310929
|
}
|
|
310652
310930
|
if (properties.length > 1)
|
|
@@ -310665,7 +310943,7 @@ function prepareRowHeightMutation(resolved, heightTwips, rule, tracked = false)
|
|
|
310665
310943
|
const rowStart = TD91.decode(resolved.bytes.subarray(0, resolved.row.rowByteStart)).length;
|
|
310666
310944
|
const rowEnd = TD91.decode(resolved.bytes.subarray(0, resolved.row.rowByteEnd)).length;
|
|
310667
310945
|
const parsed = collectXmlElementRanges(source);
|
|
310668
|
-
const row = parsed.ranges.find((range) => range.start === rowStart && range.end === rowEnd && range.tag.namespaceUri ===
|
|
310946
|
+
const row = parsed.ranges.find((range) => range.start === rowStart && range.end === rowEnd && range.tag.namespaceUri === W8 && range.tag.localName === "tr");
|
|
310669
310947
|
if (parsed.errors.length || !row)
|
|
310670
310948
|
throw new Error("The resolved table row has no matching source range.");
|
|
310671
310949
|
const directChildren3 = (start2, end2) => {
|
|
@@ -310680,19 +310958,19 @@ function prepareRowHeightMutation(resolved, heightTwips, rule, tracked = false)
|
|
|
310680
310958
|
return children2;
|
|
310681
310959
|
};
|
|
310682
310960
|
const rowChildren = directChildren3(row.openEnd, row.closeStart);
|
|
310683
|
-
const exception = rowChildren.find((range) => range.tag.namespaceUri ===
|
|
310961
|
+
const exception = rowChildren.find((range) => range.tag.namespaceUri === W8 && range.tag.localName === "tblPrEx");
|
|
310684
310962
|
const propertyInsertion = exception?.end ?? row.openEnd;
|
|
310685
|
-
const property2 = rowChildren.find((range) => range.tag.namespaceUri ===
|
|
310963
|
+
const property2 = rowChildren.find((range) => range.tag.namespaceUri === W8 && range.tag.localName === "trPr");
|
|
310686
310964
|
let beforeXml = property2 ? source.slice(property2.start, property2.end) : null;
|
|
310687
310965
|
const namespaceBindings = property2?.namespaceBindings ?? row.namespaceBindings;
|
|
310688
|
-
const prefix = property2?.tag.prefix || row.tag.prefix || Object.keys(namespaceBindings).find((prefix2) => prefix2 && namespaceBindings[prefix2] ===
|
|
310689
|
-
const declaration = namespaceBindings[prefix] ===
|
|
310966
|
+
const prefix = property2?.tag.prefix || row.tag.prefix || Object.keys(namespaceBindings).find((prefix2) => prefix2 && namespaceBindings[prefix2] === W8) || "w";
|
|
310967
|
+
const declaration = namespaceBindings[prefix] === W8 ? "" : ` xmlns:${prefix}="${W8}"`;
|
|
310690
310968
|
const heightXml = `<${prefix}:trHeight${declaration} ${prefix}:val="${heightTwips}"${rule == null ? "" : ` ${prefix}:hRule="${escapeXmlAttribute3(rule)}"`}/>`;
|
|
310691
310969
|
let afterXml;
|
|
310692
310970
|
if (property2 && !property2.tag.isSelfClosing) {
|
|
310693
310971
|
const propertyChildren = directChildren3(property2.openEnd, property2.closeStart);
|
|
310694
|
-
const height = propertyChildren.find((range) => range.tag.namespaceUri ===
|
|
310695
|
-
const revision = propertyChildren.find((range) => range.tag.namespaceUri ===
|
|
310972
|
+
const height = propertyChildren.find((range) => range.tag.namespaceUri === W8 && range.tag.localName === "trHeight");
|
|
310973
|
+
const revision = propertyChildren.find((range) => range.tag.namespaceUri === W8 && ["ins", "del", "trPrChange"].includes(range.tag.localName));
|
|
310696
310974
|
const insertion = height?.start ?? revision?.start ?? property2.closeStart;
|
|
310697
310975
|
const start2 = insertion - property2.start;
|
|
310698
310976
|
const end2 = (height?.end ?? insertion) - property2.start;
|
|
@@ -310708,13 +310986,13 @@ function prepareRowHeightMutation(resolved, heightTwips, rule, tracked = false)
|
|
|
310708
310986
|
const open2 = row.tag.isSelfClosing ? source.slice(row.start, row.openEnd).replace(/\/\s*>$/, ">") : "";
|
|
310709
310987
|
const close = row.tag.isSelfClosing ? `</${row.tag.name}>` : "";
|
|
310710
310988
|
if (tracked && property2 && !property2.tag.prefix) {
|
|
310711
|
-
let trackedPrefix = Object.keys(namespaceBindings).find((prefix2) => prefix2 && namespaceBindings[prefix2] ===
|
|
310989
|
+
let trackedPrefix = Object.keys(namespaceBindings).find((prefix2) => prefix2 && namespaceBindings[prefix2] === W8);
|
|
310712
310990
|
if (!trackedPrefix) {
|
|
310713
310991
|
trackedPrefix = "tr";
|
|
310714
310992
|
for (let suffix = 1;namespaceBindings[trackedPrefix] !== undefined; suffix++)
|
|
310715
310993
|
trackedPrefix = `tr${suffix}`;
|
|
310716
310994
|
}
|
|
310717
|
-
const trackedDeclaration = namespaceBindings[trackedPrefix] ===
|
|
310995
|
+
const trackedDeclaration = namespaceBindings[trackedPrefix] === W8 ? "" : ` xmlns:${trackedPrefix}="${W8}"`;
|
|
310718
310996
|
const qualifyPropertyRoot = (xml) => xml.replace(/^<trPr\b/, `<${trackedPrefix}:trPr${trackedDeclaration}`).replace(/<\/trPr\s*>$/, `</${trackedPrefix}:trPr>`);
|
|
310719
310997
|
beforeXml = qualifyPropertyRoot(beforeXml);
|
|
310720
310998
|
afterXml = qualifyPropertyRoot(afterXml);
|
|
@@ -310725,7 +311003,7 @@ function prepareRowHeightMutation(resolved, heightTwips, rule, tracked = false)
|
|
|
310725
311003
|
render: (propertyXml) => resolved.tableXml.slice(0, start) + open2 + propertyXml + close + resolved.tableXml.slice(end)
|
|
310726
311004
|
};
|
|
310727
311005
|
}
|
|
310728
|
-
var
|
|
311006
|
+
var W8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TD91;
|
|
310729
311007
|
var init_native_table_properties = __esm(() => {
|
|
310730
311008
|
init_sd_document_session_internal();
|
|
310731
311009
|
init_xml3();
|
|
@@ -345299,6 +345577,81 @@ var init_native_table_split = __esm(() => {
|
|
|
345299
345577
|
decoder5 = new TextDecoder;
|
|
345300
345578
|
});
|
|
345301
345579
|
|
|
345580
|
+
// ../../../v2/document-api-v2-adapter/dist/tables/terminal-placement.js
|
|
345581
|
+
function normalizeTerminalTablePlacement(bytes, atByte, documentEnd = false) {
|
|
345582
|
+
const xml = TD98.decode(bytes);
|
|
345583
|
+
const parsed = collectXmlElementRanges(xml);
|
|
345584
|
+
const body = parsed.ranges.find((range) => range.tag.namespaceUri === W9 && range.tag.localName === "body");
|
|
345585
|
+
if (parsed.errors.length || !body)
|
|
345586
|
+
return {
|
|
345587
|
+
atByte,
|
|
345588
|
+
needsTrailingParagraph: false,
|
|
345589
|
+
terminalContentEndByte: null,
|
|
345590
|
+
adjacentTableEndByte: null
|
|
345591
|
+
};
|
|
345592
|
+
const children2 = [];
|
|
345593
|
+
let cursor = body.openEnd;
|
|
345594
|
+
for (const range of [...parsed.ranges].sort((a, b) => a.start - b.start)) {
|
|
345595
|
+
if (range.start < cursor || range.end > body.closeStart)
|
|
345596
|
+
continue;
|
|
345597
|
+
children2.push(range);
|
|
345598
|
+
cursor = range.end;
|
|
345599
|
+
}
|
|
345600
|
+
const section = children2.at(-1)?.tag.localName === "sectPr" && children2.at(-1)?.tag.namespaceUri === W9 ? children2.pop() : undefined;
|
|
345601
|
+
const boundary = section?.start ?? body.closeStart;
|
|
345602
|
+
if (documentEnd)
|
|
345603
|
+
atByte = TE55.encode(xml.slice(0, boundary)).length;
|
|
345604
|
+
while (children2.length && isTableMoveClosingMarkerGap(xml.slice(children2.at(-1).start, children2.at(-1).end), body.namespaceBindings))
|
|
345605
|
+
children2.pop();
|
|
345606
|
+
const final = children2.at(-1);
|
|
345607
|
+
const terminalContentEndByte = final ? TE55.encode(xml.slice(0, final.end)).length : null;
|
|
345608
|
+
const adjacentTableEndByte = (position2) => {
|
|
345609
|
+
for (let index2 = children2.length - 1;index2 >= 0; index2--) {
|
|
345610
|
+
const previous3 = children2[index2];
|
|
345611
|
+
if (previous3.end > position2)
|
|
345612
|
+
continue;
|
|
345613
|
+
if (previous3.tag.namespaceUri === W9 && previous3.tag.localName === "tbl") {
|
|
345614
|
+
return isTableMoveClosingMarkerGap(xml.slice(previous3.end, position2), body.namespaceBindings) ? TE55.encode(xml.slice(0, previous3.end)).length : null;
|
|
345615
|
+
}
|
|
345616
|
+
if (!isTableMoveClosingMarkerGap(xml.slice(previous3.start, previous3.end), body.namespaceBindings))
|
|
345617
|
+
break;
|
|
345618
|
+
}
|
|
345619
|
+
return null;
|
|
345620
|
+
};
|
|
345621
|
+
const at = TD98.decode(bytes.subarray(0, atByte)).length;
|
|
345622
|
+
if (!final || at < final.end || at > boundary || !isTableMoveClosingMarkerGap(xml.slice(final.end, boundary), body.namespaceBindings)) {
|
|
345623
|
+
return {
|
|
345624
|
+
atByte,
|
|
345625
|
+
needsTrailingParagraph: false,
|
|
345626
|
+
terminalContentEndByte,
|
|
345627
|
+
adjacentTableEndByte: adjacentTableEndByte(at)
|
|
345628
|
+
};
|
|
345629
|
+
}
|
|
345630
|
+
if (final.tag.namespaceUri === W9 && final.tag.localName === "p" && isReusableTableTrailingParagraph(xml.slice(final.start, final.end), final.namespaceBindings) && xml.slice(final.end, at).trim() === "") {
|
|
345631
|
+
return {
|
|
345632
|
+
atByte: TE55.encode(xml.slice(0, final.start)).length,
|
|
345633
|
+
needsTrailingParagraph: false,
|
|
345634
|
+
terminalContentEndByte,
|
|
345635
|
+
adjacentTableEndByte: adjacentTableEndByte(final.start)
|
|
345636
|
+
};
|
|
345637
|
+
}
|
|
345638
|
+
return {
|
|
345639
|
+
atByte,
|
|
345640
|
+
needsTrailingParagraph: true,
|
|
345641
|
+
terminalContentEndByte,
|
|
345642
|
+
adjacentTableEndByte: adjacentTableEndByte(at)
|
|
345643
|
+
};
|
|
345644
|
+
}
|
|
345645
|
+
function plainTableTrailingParagraphXml(id) {
|
|
345646
|
+
return `<w:p xmlns:w="${W9}" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" w14:paraId="${id}"/>`;
|
|
345647
|
+
}
|
|
345648
|
+
var W9 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TD98, TE55;
|
|
345649
|
+
var init_terminal_placement = __esm(() => {
|
|
345650
|
+
init_sd_document_session_internal();
|
|
345651
|
+
TD98 = new TextDecoder;
|
|
345652
|
+
TE55 = new TextEncoder;
|
|
345653
|
+
});
|
|
345654
|
+
|
|
345302
345655
|
// ../../../v2/document-api-v2-adapter/dist/tables/tracked-policy.js
|
|
345303
345656
|
function isV2TrackedTableOperation(operationId) {
|
|
345304
345657
|
return isV2TableOperation(operationId) && getV2OperationRegistration(operationId).trackedSupport !== "never";
|
|
@@ -345449,29 +345802,29 @@ function prepareVerticalUnmerge(resolved) {
|
|
|
345449
345802
|
for (const cell of cells) {
|
|
345450
345803
|
const cellStart = decoder6.decode(resolved.bytes.subarray(0, cell.cellByteStart)).length;
|
|
345451
345804
|
const cellEnd = decoder6.decode(resolved.bytes.subarray(0, cell.cellByteEnd)).length;
|
|
345452
|
-
const owner = parsed.ranges.find((range) => range.start === cellStart && range.end === cellEnd && range.tag.namespaceUri ===
|
|
345805
|
+
const owner = parsed.ranges.find((range) => range.start === cellStart && range.end === cellEnd && range.tag.namespaceUri === W10 && range.tag.localName === "tc");
|
|
345453
345806
|
if (!owner)
|
|
345454
345807
|
return null;
|
|
345455
|
-
const properties = directChildren4(owner).filter((range) => range.tag.namespaceUri ===
|
|
345808
|
+
const properties = directChildren4(owner).filter((range) => range.tag.namespaceUri === W10 && range.tag.localName === "tcPr");
|
|
345456
345809
|
if (properties.length !== 1)
|
|
345457
345810
|
return null;
|
|
345458
345811
|
const property2 = properties[0];
|
|
345459
345812
|
const children2 = directChildren4(property2);
|
|
345460
|
-
const spans = children2.filter((range) => range.tag.namespaceUri ===
|
|
345813
|
+
const spans = children2.filter((range) => range.tag.namespaceUri === W10 && range.tag.localName === "gridSpan");
|
|
345461
345814
|
if (spans.length > 1)
|
|
345462
345815
|
return null;
|
|
345463
345816
|
if (spans.length === 1) {
|
|
345464
|
-
const value3 = spans[0].tag.attributes.find((attribute2) => attribute2.namespaceUri ===
|
|
345817
|
+
const value3 = spans[0].tag.attributes.find((attribute2) => attribute2.namespaceUri === W10 && attribute2.localName === "val")?.value.trim();
|
|
345465
345818
|
if (value3 == null || !/^\+?\d+$/.test(value3) || Number(value3) !== 1)
|
|
345466
345819
|
return null;
|
|
345467
345820
|
}
|
|
345468
|
-
if (children2.some((range) => range.tag.namespaceUri ===
|
|
345821
|
+
if (children2.some((range) => range.tag.namespaceUri === W10 && ["tcPrChange", "cellIns", "cellDel", "cellMerge"].includes(range.tag.localName)))
|
|
345469
345822
|
return null;
|
|
345470
|
-
const merges = children2.filter((range) => range.tag.namespaceUri ===
|
|
345823
|
+
const merges = children2.filter((range) => range.tag.namespaceUri === W10 && range.tag.localName === "vMerge");
|
|
345471
345824
|
if (merges.length !== 1)
|
|
345472
345825
|
return null;
|
|
345473
345826
|
const merge2 = merges[0];
|
|
345474
|
-
const value2 = merge2.tag.attributes.find((attribute2) => attribute2.namespaceUri ===
|
|
345827
|
+
const value2 = merge2.tag.attributes.find((attribute2) => attribute2.namespaceUri === W10 && attribute2.localName === "val")?.value;
|
|
345475
345828
|
if ((value2 === "restart" ? "restart" : value2 == null || value2 === "continue" ? "continue" : null) !== cell.vMerge)
|
|
345476
345829
|
return null;
|
|
345477
345830
|
const before = source.slice(property2.start, property2.end);
|
|
@@ -345500,7 +345853,7 @@ function renderVerticalUnmerge(plan, stamp) {
|
|
|
345500
345853
|
}
|
|
345501
345854
|
return xml;
|
|
345502
345855
|
}
|
|
345503
|
-
var
|
|
345856
|
+
var W10 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", decoder6;
|
|
345504
345857
|
var init_vertical_cell_properties = __esm(() => {
|
|
345505
345858
|
init_sd_document_session_internal();
|
|
345506
345859
|
init_tracked_pr_change();
|
|
@@ -345515,7 +345868,7 @@ function prepareNativeCellSplit(resolved, original, columnInsertIndex) {
|
|
|
345515
345868
|
const native4 = collectXmlElementRanges(source);
|
|
345516
345869
|
if (native4.errors.length)
|
|
345517
345870
|
return null;
|
|
345518
|
-
const table = native4.ranges.find((range) => range.start === tableStart && range.tag.namespaceUri ===
|
|
345871
|
+
const table = native4.ranges.find((range) => range.start === tableStart && range.tag.namespaceUri === W11 && range.tag.localName === "tbl");
|
|
345519
345872
|
if (!table)
|
|
345520
345873
|
return null;
|
|
345521
345874
|
const childrenByStart = new Map;
|
|
@@ -345532,7 +345885,7 @@ function prepareNativeCellSplit(resolved, original, columnInsertIndex) {
|
|
|
345532
345885
|
parents.push(range);
|
|
345533
345886
|
}
|
|
345534
345887
|
const children2 = (parent) => childrenByStart.get(parent.start) ?? [];
|
|
345535
|
-
const owns = (range, name) => range.tag.namespaceUri ===
|
|
345888
|
+
const owns = (range, name) => range.tag.namespaceUri === W11 && range.tag.localName === name;
|
|
345536
345889
|
const tableChildren = children2(table);
|
|
345537
345890
|
const grids = tableChildren.filter((range) => owns(range, "tblGrid"));
|
|
345538
345891
|
const rows = tableChildren.filter((range) => owns(range, "tr"));
|
|
@@ -345674,7 +346027,7 @@ function prepareNativeCellSplit(resolved, original, columnInsertIndex) {
|
|
|
345674
346027
|
}
|
|
345675
346028
|
};
|
|
345676
346029
|
}
|
|
345677
|
-
var
|
|
346030
|
+
var W11 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
345678
346031
|
var init_native_cell_split = __esm(() => {
|
|
345679
346032
|
init_sd_document_session_internal();
|
|
345680
346033
|
init_xml3();
|
|
@@ -345687,7 +346040,7 @@ function prepareNativeCellMerge(resolved, model) {
|
|
|
345687
346040
|
const parsed = collectXmlElementRanges(source);
|
|
345688
346041
|
if (parsed.errors.length)
|
|
345689
346042
|
return null;
|
|
345690
|
-
const table = parsed.ranges.find((range) => range.start === start && range.tag.namespaceUri ===
|
|
346043
|
+
const table = parsed.ranges.find((range) => range.start === start && range.tag.namespaceUri === W12 && range.tag.localName === "tbl");
|
|
345691
346044
|
if (!table)
|
|
345692
346045
|
return null;
|
|
345693
346046
|
const children2 = new Map;
|
|
@@ -345703,7 +346056,7 @@ function prepareNativeCellMerge(resolved, model) {
|
|
|
345703
346056
|
}
|
|
345704
346057
|
parents.push(range);
|
|
345705
346058
|
}
|
|
345706
|
-
const nativeChildren = (range, name) => (children2.get(range.start) ?? []).filter((child) => child.tag.namespaceUri ===
|
|
346059
|
+
const nativeChildren = (range, name) => (children2.get(range.start) ?? []).filter((child) => child.tag.namespaceUri === W12 && child.tag.localName === name);
|
|
345707
346060
|
const rows = nativeChildren(table, "tr");
|
|
345708
346061
|
if (rows.length !== model.rows.length)
|
|
345709
346062
|
return null;
|
|
@@ -345712,7 +346065,7 @@ function prepareNativeCellMerge(resolved, model) {
|
|
|
345712
346065
|
for (const properties of nativeChildren(rows[index2], "trPr")) {
|
|
345713
346066
|
for (const name of ["gridBefore", "gridAfter"]) {
|
|
345714
346067
|
const omissions = nativeChildren(properties, name);
|
|
345715
|
-
if (omissions.length > 1 || omissions.some((range) => !/^\+?0+$/.test(range.tag.attributes.find((attr4) => attr4.namespaceUri ===
|
|
346068
|
+
if (omissions.length > 1 || omissions.some((range) => !/^\+?0+$/.test(range.tag.attributes.find((attr4) => attr4.namespaceUri === W12 && attr4.localName === "val")?.value ?? "")))
|
|
345716
346069
|
simpleTopology = false;
|
|
345717
346070
|
}
|
|
345718
346071
|
}
|
|
@@ -345729,7 +346082,7 @@ function prepareNativeCellMerge(resolved, model) {
|
|
|
345729
346082
|
simpleTopology = false;
|
|
345730
346083
|
if (property2) {
|
|
345731
346084
|
const spans = nativeChildren(property2, "gridSpan");
|
|
345732
|
-
if (spans.length > 1 || spans.some((range2) => !/^\+?0*1$/.test(range2.tag.attributes.find((attr4) => attr4.namespaceUri ===
|
|
346085
|
+
if (spans.length > 1 || spans.some((range2) => !/^\+?0*1$/.test(range2.tag.attributes.find((attr4) => attr4.namespaceUri === W12 && attr4.localName === "val")?.value ?? "")) || nativeChildren(property2, "vMerge").length > 0)
|
|
345733
346086
|
simpleTopology = false;
|
|
345734
346087
|
}
|
|
345735
346088
|
const prefix = property2 ? source.slice(range.openEnd, property2.start) : "";
|
|
@@ -345773,7 +346126,7 @@ function prepareNativeCellMerge(resolved, model) {
|
|
|
345773
346126
|
}
|
|
345774
346127
|
};
|
|
345775
346128
|
}
|
|
345776
|
-
var
|
|
346129
|
+
var W12 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
345777
346130
|
var init_native_cell_merge = __esm(() => {
|
|
345778
346131
|
init_sd_document_session_internal();
|
|
345779
346132
|
init_xml3();
|
|
@@ -345823,7 +346176,7 @@ function prepareTrackedCellEmptying(input) {
|
|
|
345823
346176
|
fragment: true,
|
|
345824
346177
|
additionalNamespaces: bindings
|
|
345825
346178
|
});
|
|
345826
|
-
if (parsed.errors.length || parsed.ranges.some((range) => range.tag.namespaceUri !==
|
|
346179
|
+
if (parsed.errors.length || parsed.ranges.some((range) => range.tag.namespaceUri !== W13 || [
|
|
345827
346180
|
"bookmarkStart",
|
|
345828
346181
|
"bookmarkEnd",
|
|
345829
346182
|
"commentRangeStart",
|
|
@@ -345878,7 +346231,7 @@ function prepareTrackedCellContentMove(input) {
|
|
|
345878
346231
|
for (const paragraph3 of [...parsed.ranges].sort((left, right) => left.start - right.start || right.end - left.end)) {
|
|
345879
346232
|
if (paragraph3.start < end)
|
|
345880
346233
|
continue;
|
|
345881
|
-
if (paragraph3.tag.namespaceUri !==
|
|
346234
|
+
if (paragraph3.tag.namespaceUri !== W13 || paragraph3.tag.localName !== "p" || input.source.bodyXml.slice(end, paragraph3.start).trim())
|
|
345882
346235
|
return null;
|
|
345883
346236
|
const source = input.source.bodyXml.slice(paragraph3.start, paragraph3.end);
|
|
345884
346237
|
const local = collectXmlElementRanges(source, {
|
|
@@ -345887,8 +346240,8 @@ function prepareTrackedCellContentMove(input) {
|
|
|
345887
346240
|
});
|
|
345888
346241
|
const destination = assignParagraphIds(source, local.ranges.filter((range) => range.start === 0), input.allocateParagraphId);
|
|
345889
346242
|
const id = input.stamp.revisionIds?.[wordIds.length] ?? input.stamp.revisionId + wordIds.length;
|
|
345890
|
-
const hasRun = local.ranges.some((range) => range.tag.namespaceUri ===
|
|
345891
|
-
const prepare = hasRun ?
|
|
346243
|
+
const hasRun = local.ranges.some((range) => range.tag.namespaceUri === W13 && range.tag.localName === "r");
|
|
346244
|
+
const prepare = hasRun ? prepareTrackedTableMove : prepareTrackedEmptyParagraphMove;
|
|
345892
346245
|
const moved = prepare({
|
|
345893
346246
|
sourceXml: source,
|
|
345894
346247
|
destinationXml: destination.afterContent,
|
|
@@ -345912,7 +346265,7 @@ function prepareTrackedCellContentMove(input) {
|
|
|
345912
346265
|
return null;
|
|
345913
346266
|
return { sourceXml, destinationXml, wordIds };
|
|
345914
346267
|
}
|
|
345915
|
-
var
|
|
346268
|
+
var W13 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
345916
346269
|
var init_tracked_cell_content_move = __esm(() => {
|
|
345917
346270
|
init_sd_document_session_internal();
|
|
345918
346271
|
init_paragraph_ids();
|
|
@@ -345925,7 +346278,7 @@ function commitKernelWholePartXmlRewrite(input) {
|
|
|
345925
346278
|
if (!currentBytes) {
|
|
345926
346279
|
return { ok: false, code: "PRECONDITION_FAILED", message: `Part bytes are unavailable for ${input.partUri}.` };
|
|
345927
346280
|
}
|
|
345928
|
-
const nextBytes =
|
|
346281
|
+
const nextBytes = TE56.encode(input.nextXml);
|
|
345929
346282
|
if (bytesEqual16(currentBytes, nextBytes) && Object.keys(input.extraPerPart ?? {}).length === 0) {
|
|
345930
346283
|
return { ok: true, txId: `${input.txIdPrefix}-noop` };
|
|
345931
346284
|
}
|
|
@@ -345994,12 +346347,12 @@ function bytesEqual16(left, right) {
|
|
|
345994
346347
|
function storyFormatMutationMessage(txIdPrefix, reason) {
|
|
345995
346348
|
return `${txIdPrefix}: ${reason}`;
|
|
345996
346349
|
}
|
|
345997
|
-
var
|
|
346350
|
+
var TE56;
|
|
345998
346351
|
var init_apply3 = __esm(() => {
|
|
345999
346352
|
init_sd_document_session_internal();
|
|
346000
346353
|
init_adapter();
|
|
346001
346354
|
init_xml();
|
|
346002
|
-
|
|
346355
|
+
TE56 = new TextEncoder;
|
|
346003
346356
|
});
|
|
346004
346357
|
|
|
346005
346358
|
// ../../../v2/document-api-v2-adapter/dist/tables/apply-properties.js
|
|
@@ -347006,20 +347359,41 @@ class V2TablesAdapter {
|
|
|
347006
347359
|
if (guard)
|
|
347007
347360
|
return guard;
|
|
347008
347361
|
const resolved = resolvePublicTableLocator(this.context, input, "tables.move", false);
|
|
347362
|
+
if (input.destination.kind === "before" || input.destination.kind === "after") {
|
|
347363
|
+
const nodeId = "nodeId" in input.destination ? input.destination.nodeId : input.destination.target.nodeId;
|
|
347364
|
+
const target = findTableByNodeId(this.context, nodeId);
|
|
347365
|
+
if (target)
|
|
347366
|
+
assertTableHasNoPendingMove(target, "tables.move");
|
|
347367
|
+
}
|
|
347009
347368
|
const destination = resolveCreateLocation(this.context, input.destination, "tables.move");
|
|
347010
347369
|
if (destination.storyId !== resolved.storyId || destination.partUri !== resolved.partUri) {
|
|
347011
347370
|
return mutationFailure("CAPABILITY_UNAVAILABLE", "tables.move currently supports moves within the main story only.");
|
|
347012
347371
|
}
|
|
347013
|
-
|
|
347372
|
+
const placement3 = normalizeTerminalTablePlacement(resolved.bytes, destination.atByte, input.destination.kind === "documentEnd");
|
|
347373
|
+
const insertAt = placement3.atByte;
|
|
347374
|
+
if (input.destination.kind === "documentEnd" && placement3.adjacentTableEndByte !== null) {
|
|
347375
|
+
const preceding = readTableCatalogForSession(this.context.session, resolved.storyId)?.tables.find((table) => table.tableByteEnd === placement3.adjacentTableEndByte);
|
|
347376
|
+
if (preceding) {
|
|
347377
|
+
const adjacent = findTableByNodeId(this.context, preceding.tableNodeId);
|
|
347378
|
+
if (adjacent)
|
|
347379
|
+
assertTableHasNoPendingMove(adjacent, "tables.move");
|
|
347380
|
+
}
|
|
347381
|
+
}
|
|
347382
|
+
const gap = insertAt > resolved.table.tableByteEnd ? TD99.decode(resolved.bytes.subarray(resolved.table.tableByteEnd, insertAt)) : null;
|
|
347383
|
+
if (insertAt >= resolved.table.tableByteStart && insertAt <= resolved.table.tableByteEnd || input.destination.kind === "documentEnd" && placement3.terminalContentEndByte === resolved.table.tableByteEnd || !placement3.needsTrailingParagraph && gap !== null && gap.trim() === "") {
|
|
347014
347384
|
return successMutation(resolved.table.tableNodeId);
|
|
347015
347385
|
}
|
|
347016
347386
|
const tracked = options?.changeMode === "tracked";
|
|
347017
347387
|
if (tracked) {
|
|
347018
|
-
return this.moveTrackedTable(resolved,
|
|
347388
|
+
return this.moveTrackedTable(resolved, insertAt, options.dryRun, placement3.needsTrailingParagraph);
|
|
347019
347389
|
}
|
|
347020
|
-
const insertAt = destination.atByte;
|
|
347021
347390
|
if (options.dryRun && !this.context.isCollaborativeSession())
|
|
347022
347391
|
return successMutation(resolved.table.tableNodeId);
|
|
347392
|
+
const allocate = placement3.needsTrailingParagraph ? options.dryRun ? createParaIdAllocator(this.context) : createParagraphIdBatchAllocator(this.context, 1) : null;
|
|
347393
|
+
if (placement3.needsTrailingParagraph && !allocate)
|
|
347394
|
+
return mutationFailure("CAPABILITY_UNAVAILABLE", "tables.move could not reserve a collision-safe trailing paragraph identity.");
|
|
347395
|
+
const trailingParagraphNodeId = allocate?.();
|
|
347396
|
+
const trailingXml = trailingParagraphNodeId ? plainTableTrailingParagraphXml(trailingParagraphNodeId) : "";
|
|
347023
347397
|
const commit = commitStoryXmlMutation({
|
|
347024
347398
|
context: this.context,
|
|
347025
347399
|
storyId: resolved.storyId,
|
|
@@ -347035,18 +347409,29 @@ class V2TablesAdapter {
|
|
|
347035
347409
|
{
|
|
347036
347410
|
startByte: insertAt,
|
|
347037
347411
|
endByte: insertAt,
|
|
347038
|
-
replacement: resolved.tableXml
|
|
347412
|
+
replacement: resolved.tableXml + trailingXml
|
|
347039
347413
|
}
|
|
347040
347414
|
],
|
|
347041
347415
|
txIdPrefix: "v2-tables-move",
|
|
347042
347416
|
updatedNodeIds: [resolved.table.tableNodeId],
|
|
347043
|
-
...this.context.isCollaborativeSession()
|
|
347417
|
+
...this.context.isCollaborativeSession() || trailingParagraphNodeId ? {
|
|
347418
|
+
moveIntent: {
|
|
347419
|
+
tableNodeId: resolved.table.tableNodeId,
|
|
347420
|
+
destinationByte: insertAt,
|
|
347421
|
+
...trailingParagraphNodeId ? { trailingParagraphNodeId } : {}
|
|
347422
|
+
}
|
|
347423
|
+
} : {},
|
|
347424
|
+
...trailingParagraphNodeId ? { createdRefs: [{
|
|
347425
|
+
kind: "block",
|
|
347426
|
+
storyId: resolved.storyId,
|
|
347427
|
+
nodeId: trailingParagraphNodeId
|
|
347428
|
+
}] } : {}
|
|
347044
347429
|
});
|
|
347045
347430
|
if (!commit.ok)
|
|
347046
347431
|
return mutationFailure(commit.code, commit.message);
|
|
347047
347432
|
return successMutation(resolved.table.tableNodeId, commit.affectedStories);
|
|
347048
347433
|
}
|
|
347049
|
-
moveTrackedTable(resolved, atByte, dryRun = false) {
|
|
347434
|
+
moveTrackedTable(resolved, atByte, dryRun = false, needsTrailingParagraph = false) {
|
|
347050
347435
|
const tableXml = resolved.tableXml;
|
|
347051
347436
|
if (tableCarriesAnchorContent(tableXml)) {
|
|
347052
347437
|
return mutationFailure("CAPABILITY_UNAVAILABLE", "tables.move (tracked): the table carries comment/bookmark/permission anchors that cannot yet be safely duplicated.");
|
|
@@ -347055,12 +347440,12 @@ class V2TablesAdapter {
|
|
|
347055
347440
|
return mutationFailure("CAPABILITY_UNAVAILABLE", "tables.move (tracked): the table already contains tracked-change wrappers; resolve them before moving.");
|
|
347056
347441
|
}
|
|
347057
347442
|
const insertAt = atByte;
|
|
347058
|
-
const plan = this.prepareNativeTableMove(resolved, tableXml, resolved.table.tableByteStart, insertAt, dryRun);
|
|
347443
|
+
const plan = this.prepareNativeTableMove(resolved, tableXml, resolved.table.tableByteStart, insertAt, dryRun, needsTrailingParagraph);
|
|
347059
347444
|
if (!plan.ok)
|
|
347060
347445
|
return mutationFailure(plan.code, plan.message);
|
|
347061
347446
|
if (dryRun)
|
|
347062
347447
|
return successMutation(resolved.table.tableNodeId);
|
|
347063
|
-
const
|
|
347448
|
+
const trailingParagraphNodeId = plan.trailingParagraphNodeId;
|
|
347064
347449
|
const commit = commitStoryXmlMutation({
|
|
347065
347450
|
context: this.context,
|
|
347066
347451
|
storyId: resolved.storyId,
|
|
@@ -347075,24 +347460,34 @@ class V2TablesAdapter {
|
|
|
347075
347460
|
{
|
|
347076
347461
|
startByte: insertAt,
|
|
347077
347462
|
endByte: insertAt,
|
|
347078
|
-
replacement: plan.prepared.destinationXml
|
|
347463
|
+
replacement: plan.prepared.destinationXml + (trailingParagraphNodeId ? plainTableTrailingParagraphXml(trailingParagraphNodeId) : "")
|
|
347079
347464
|
}
|
|
347080
347465
|
],
|
|
347081
347466
|
txIdPrefix: "v2-tables-move-tracked",
|
|
347082
347467
|
updatedNodeIds: [resolved.table.tableNodeId],
|
|
347083
|
-
...
|
|
347084
|
-
|
|
347468
|
+
...this.context.isCollaborativeSession() || trailingParagraphNodeId ? {
|
|
347469
|
+
trackedMoveIntent: {
|
|
347470
|
+
tableNodeId: resolved.table.tableNodeId,
|
|
347471
|
+
destinationByte: insertAt,
|
|
347472
|
+
...trailingParagraphNodeId ? { trailingParagraphNodeId } : {}
|
|
347473
|
+
}
|
|
347474
|
+
} : {},
|
|
347475
|
+
createdRefs: [...plan.prepared.wordIds.map((entityId) => ({
|
|
347085
347476
|
kind: "trackedChange",
|
|
347086
347477
|
entityId,
|
|
347087
347478
|
storyId: resolved.storyId
|
|
347088
|
-
}))
|
|
347479
|
+
})), ...trailingParagraphNodeId ? [{
|
|
347480
|
+
kind: "block",
|
|
347481
|
+
storyId: resolved.storyId,
|
|
347482
|
+
nodeId: trailingParagraphNodeId
|
|
347483
|
+
}] : []]
|
|
347089
347484
|
});
|
|
347090
347485
|
if (!commit.ok)
|
|
347091
347486
|
return mutationFailure(commit.code, commit.message);
|
|
347092
347487
|
const nextTable = readTableCatalogForSession(this.context.session, resolved.storyId)?.tables.find((table) => table.rows.some((row) => row.cells.some((cell) => cell.paragraphs.some((paragraph3) => paragraph3.paragraphId === plan.destinationParagraphIds[0]))));
|
|
347093
347488
|
if (nextTable)
|
|
347094
347489
|
recordTableNodeAlias(this.context, resolved.table.tableNodeId, nextTable.tableNodeId);
|
|
347095
|
-
const result = successMutation(nextTable?.tableNodeId ?? resolved.table.tableNodeId);
|
|
347490
|
+
const result = successMutation(nextTable?.tableNodeId ?? resolved.table.tableNodeId, commit.affectedStories);
|
|
347096
347491
|
return {
|
|
347097
347492
|
...result,
|
|
347098
347493
|
trackedChangeRefs: projectTrackedStructuralEntityIds(this.context, plan.prepared.wordIds).map((entityId) => ({
|
|
@@ -347102,9 +347497,9 @@ class V2TablesAdapter {
|
|
|
347102
347497
|
}))
|
|
347103
347498
|
};
|
|
347104
347499
|
}
|
|
347105
|
-
prepareNativeTableMove(resolved, sourceXml, startByte, destinationByte, dryRun) {
|
|
347106
|
-
const sourceStart =
|
|
347107
|
-
const ranges = collectXmlElementRanges(
|
|
347500
|
+
prepareNativeTableMove(resolved, sourceXml, startByte, destinationByte, dryRun, needsTrailingParagraph = false) {
|
|
347501
|
+
const sourceStart = TD99.decode(resolved.bytes.subarray(0, startByte)).length;
|
|
347502
|
+
const ranges = collectXmlElementRanges(TD99.decode(resolved.bytes)).ranges;
|
|
347108
347503
|
const sourceRange = ranges.find((range) => range.start === sourceStart);
|
|
347109
347504
|
const fail5 = () => ({
|
|
347110
347505
|
ok: false,
|
|
@@ -347113,7 +347508,7 @@ class V2TablesAdapter {
|
|
|
347113
347508
|
});
|
|
347114
347509
|
if (!sourceRange)
|
|
347115
347510
|
return fail5();
|
|
347116
|
-
const destinationStart =
|
|
347511
|
+
const destinationStart = TD99.decode(resolved.bytes.subarray(0, destinationByte)).length;
|
|
347117
347512
|
const destinationParent = ranges.filter((range) => range.start < destinationStart && range.end > destinationStart).sort((a, b) => b.start - a.start)[0];
|
|
347118
347513
|
if (!destinationParent)
|
|
347119
347514
|
return fail5();
|
|
@@ -347125,16 +347520,21 @@ class V2TablesAdapter {
|
|
|
347125
347520
|
if (source.errors.length)
|
|
347126
347521
|
return fail5();
|
|
347127
347522
|
const paragraphs = source.ranges.filter(({ tag }) => tag.namespaceUri === "http://schemas.openxmlformats.org/wordprocessingml/2006/main" && tag.localName === "p").sort((a, b) => a.start - b.start);
|
|
347128
|
-
const
|
|
347523
|
+
const allocate = dryRun ? createParaIdAllocator(this.context) : createParagraphIdBatchAllocator(this.context, paragraphs.length + (needsTrailingParagraph ? 1 : 0));
|
|
347524
|
+
if (!allocate)
|
|
347525
|
+
return fail5();
|
|
347526
|
+
const destination = assignParagraphIds(sourceXml, paragraphs, allocate);
|
|
347527
|
+
const trailingParagraphNodeId = needsTrailingParagraph ? allocate() : undefined;
|
|
347129
347528
|
const author = { ...this.context.readAuthor(), name: readTrackedAuthorName(this.context) };
|
|
347130
347529
|
const date6 = new Date().toISOString();
|
|
347131
347530
|
const existingNames = collectMoveRangeNames(scanPackagePartsXml(listSDDocumentSessionInternalPartUris(this.context.session), (uri) => getSDDocumentSessionInternalPartBytes(this.context.session, uri) ?? undefined));
|
|
347132
|
-
const prepare = (revisionIds) =>
|
|
347531
|
+
const prepare = (revisionIds) => prepareTrackedTableMove({
|
|
347133
347532
|
sourceXml,
|
|
347134
347533
|
destinationXml: destination.afterContent,
|
|
347135
|
-
partXml:
|
|
347534
|
+
partXml: TD99.decode(resolved.bytes),
|
|
347136
347535
|
namespaceBindings,
|
|
347137
347536
|
destinationNamespaceBindings: new Map(Object.entries(destinationParent.namespaceBindings)),
|
|
347537
|
+
supportingParagraphId: trailingParagraphNodeId,
|
|
347138
347538
|
rangeName: chooseUnusedMoveRangeName(`move-pair-${revisionIds?.[0] ?? 0}`, existingNames),
|
|
347139
347539
|
stamp: { revisionId: revisionIds?.[0] ?? 0, revisionIds, author, date: date6 }
|
|
347140
347540
|
});
|
|
@@ -347148,12 +347548,12 @@ class V2TablesAdapter {
|
|
|
347148
347548
|
if (!validated2)
|
|
347149
347549
|
return fail5();
|
|
347150
347550
|
if (dryRun)
|
|
347151
|
-
return { ok: true, prepared: validated2, destinationParagraphIds: destination.paragraphIds };
|
|
347551
|
+
return { ok: true, prepared: validated2, destinationParagraphIds: destination.paragraphIds, trailingParagraphNodeId };
|
|
347152
347552
|
const ids = reserveTrackedRevisionIds(this.context, preview.wordIds.length);
|
|
347153
347553
|
if (!ids)
|
|
347154
347554
|
return fail5();
|
|
347155
347555
|
const prepared = prepare(ids);
|
|
347156
|
-
return prepared ? { ok: true, prepared, destinationParagraphIds: destination.paragraphIds } : fail5();
|
|
347556
|
+
return prepared ? { ok: true, prepared, destinationParagraphIds: destination.paragraphIds, trailingParagraphNodeId } : fail5();
|
|
347157
347557
|
}
|
|
347158
347558
|
split(input, options) {
|
|
347159
347559
|
options = normalizeRuntimeTableMutationOptions(input, options);
|
|
@@ -347549,7 +347949,7 @@ class V2TablesAdapter {
|
|
|
347549
347949
|
{
|
|
347550
347950
|
startByte: insertAt,
|
|
347551
347951
|
endByte: insertAt,
|
|
347552
|
-
replacement:
|
|
347952
|
+
replacement: TD99.decode(resolved.bytes.subarray(sourceRow.rowByteStart, sourceRow.rowByteEnd))
|
|
347553
347953
|
}
|
|
347554
347954
|
],
|
|
347555
347955
|
txIdPrefix: "v2-tables-move-row",
|
|
@@ -347567,7 +347967,7 @@ class V2TablesAdapter {
|
|
|
347567
347967
|
}
|
|
347568
347968
|
moveRowTracked(resolved, destinationRowIndex, dryRun = false) {
|
|
347569
347969
|
const sourceRow = resolved.row;
|
|
347570
|
-
const sourceRowXml =
|
|
347970
|
+
const sourceRowXml = TD99.decode(resolved.bytes.subarray(sourceRow.rowByteStart, sourceRow.rowByteEnd));
|
|
347571
347971
|
if (rowCarriesAnchorContent(sourceRowXml)) {
|
|
347572
347972
|
return mutationFailure("CAPABILITY_UNAVAILABLE", "tables.moveRow (tracked): the row carries comment/bookmark/permission anchors or move-range markers that cannot yet be safely duplicated.");
|
|
347573
347973
|
}
|
|
@@ -347604,7 +348004,7 @@ class V2TablesAdapter {
|
|
|
347604
348004
|
const replacements = collaborative ? [{
|
|
347605
348005
|
startByte: resolved.table.tableByteStart,
|
|
347606
348006
|
endByte: resolved.table.tableByteEnd,
|
|
347607
|
-
replacement:
|
|
348007
|
+
replacement: TD99.decode(composeByteReplacements(resolved.bytes.subarray(resolved.table.tableByteStart, resolved.table.tableByteEnd), [
|
|
347608
348008
|
{
|
|
347609
348009
|
startByte: sourceRow.rowByteStart - resolved.table.tableByteStart,
|
|
347610
348010
|
endByte: sourceRow.rowByteEnd - resolved.table.tableByteStart,
|
|
@@ -349561,7 +349961,7 @@ class V2TablesAdapter {
|
|
|
349561
349961
|
return readTablePropertiesFromXml({
|
|
349562
349962
|
tableXml: resolved.tableXml,
|
|
349563
349963
|
nodeId: resolved.table.tableNodeId,
|
|
349564
|
-
stylesXml: stylesBytes ?
|
|
349964
|
+
stylesXml: stylesBytes ? TD99.decode(stylesBytes) : null
|
|
349565
349965
|
});
|
|
349566
349966
|
}
|
|
349567
349967
|
getStyles(_input) {
|
|
@@ -349579,7 +349979,7 @@ class V2TablesAdapter {
|
|
|
349579
349979
|
if (!settingsBytes) {
|
|
349580
349980
|
return documentMutationFailure("PRECONDITION_FAILED", "word/settings.xml is unavailable in the current package.");
|
|
349581
349981
|
}
|
|
349582
|
-
const settingsXml =
|
|
349982
|
+
const settingsXml = TD99.decode(settingsBytes);
|
|
349583
349983
|
const nextXml = settingsXml.includes(":defaultTableStyle") ? settingsXml.replace(/<([\w.-]+):defaultTableStyle\b[^>]*\b(?:[\w.-]+:)?val="[^"]*"[^>]*\/?>/, (_match, prefix) => `<${prefix}:defaultTableStyle ${prefix}:val="${input.styleId}"/>`) : settingsXml.replace(/<\/([\w.-]+):settings>/, `<$1:defaultTableStyle $1:val="${input.styleId}"/></$1:settings>`);
|
|
349584
349984
|
if (options?.dryRun || nextXml === settingsXml)
|
|
349585
349985
|
return { success: true, changed: false };
|
|
@@ -349603,7 +350003,7 @@ class V2TablesAdapter {
|
|
|
349603
350003
|
if (!settingsBytes) {
|
|
349604
350004
|
return documentMutationFailure("PRECONDITION_FAILED", "word/settings.xml is unavailable in the current package.");
|
|
349605
350005
|
}
|
|
349606
|
-
const settingsXml =
|
|
350006
|
+
const settingsXml = TD99.decode(settingsBytes);
|
|
349607
350007
|
const nextXml = settingsXml.replace(/<[\w.-]+:defaultTableStyle\b[^>]*\/>/g, "");
|
|
349608
350008
|
if (options?.dryRun || nextXml === settingsXml)
|
|
349609
350009
|
return { success: true, changed: false };
|
|
@@ -349736,8 +350136,8 @@ class V2TablesAdapter {
|
|
|
349736
350136
|
if (this.context.isCollaborativeSession())
|
|
349737
350137
|
return mutationFailure("CAPABILITY_UNAVAILABLE", collaborativeStoryTableRewriteMessage());
|
|
349738
350138
|
const model = parseTableXmlModel(resolved.tableXml);
|
|
349739
|
-
const start =
|
|
349740
|
-
const tableRange = collectXmlElementRanges(
|
|
350139
|
+
const start = TD99.decode(resolved.bytes.subarray(0, resolved.table.tableByteStart)).length;
|
|
350140
|
+
const tableRange = collectXmlElementRanges(TD99.decode(resolved.bytes)).ranges.find((range) => range.start === start);
|
|
349741
350141
|
if (!tableRange)
|
|
349742
350142
|
return mutationFailure("PRECONDITION_FAILED", "Table content source range is unavailable.");
|
|
349743
350143
|
const author = readTrackedAuthor(this.context);
|
|
@@ -349828,12 +350228,12 @@ class V2TablesAdapter {
|
|
|
349828
350228
|
});
|
|
349829
350229
|
}
|
|
349830
350230
|
commitTrackedBlockConversion(input) {
|
|
349831
|
-
const beforeXml =
|
|
350231
|
+
const beforeXml = TD99.decode(input.bytes.subarray(input.startByte, input.endByte));
|
|
349832
350232
|
if (rowCarriesExistingTrackedWrappers(beforeXml)) {
|
|
349833
350233
|
return mutationFailure("CAPABILITY_UNAVAILABLE", "Table conversion cannot replace existing proposals.");
|
|
349834
350234
|
}
|
|
349835
|
-
const xml =
|
|
349836
|
-
const start =
|
|
350235
|
+
const xml = TD99.decode(input.bytes);
|
|
350236
|
+
const start = TD99.decode(input.bytes.subarray(0, input.startByte)).length;
|
|
349837
350237
|
const range = collectXmlElementRanges(xml).ranges.find((range2) => range2.start === start);
|
|
349838
350238
|
if (!range)
|
|
349839
350239
|
return mutationFailure("PRECONDITION_FAILED", "Table conversion source range is unavailable.");
|
|
@@ -350530,8 +350930,8 @@ function resolveTableOrCellLocator(context, input, operationId) {
|
|
|
350530
350930
|
function assertTableHasNoPendingMove(resolved, operationId) {
|
|
350531
350931
|
if (["tables.get", "tables.getCells", "tables.getProperties"].includes(operationId) || !/move(?:From|To)/.test(resolved.tableXml))
|
|
350532
350932
|
return;
|
|
350533
|
-
const xml =
|
|
350534
|
-
const start =
|
|
350933
|
+
const xml = TD99.decode(resolved.bytes);
|
|
350934
|
+
const start = TD99.decode(resolved.bytes.subarray(0, resolved.table.tableByteStart)).length;
|
|
350535
350935
|
const end = start + resolved.tableXml.length;
|
|
350536
350936
|
const ranges = collectXmlElementRanges(xml).ranges;
|
|
350537
350937
|
const wordNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
@@ -351315,7 +351715,7 @@ function sumTableGridWidths(model) {
|
|
|
351315
351715
|
function findPendingDeletedRowCells(resolved, cells) {
|
|
351316
351716
|
if (!cells.some((cell) => cell.tcPrXml?.includes("cellDel")))
|
|
351317
351717
|
return new Set;
|
|
351318
|
-
const source =
|
|
351718
|
+
const source = TD99.decode(resolved.bytes);
|
|
351319
351719
|
const encoder3 = new TextEncoder;
|
|
351320
351720
|
const ranges = collectXmlElementRanges(source).ranges.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
351321
351721
|
const stack = [];
|
|
@@ -351432,7 +351832,7 @@ function writeAfterPropertyXml(model, spec, wrappedXml) {
|
|
|
351432
351832
|
}
|
|
351433
351833
|
}
|
|
351434
351834
|
}
|
|
351435
|
-
var COLLABORATIVE_TABLE_REWRITE_PREFIXES,
|
|
351835
|
+
var COLLABORATIVE_TABLE_REWRITE_PREFIXES, TD99, EMPTY_TABLE_CONTEXT_AT_SELECTION, TRACKED_TABLE_COLUMN_RESTORE_NS2 = "urn:superdoc:tracked-table-column", DEFAULT_PAGE_WIDTH_TWIPS = 12240, DEFAULT_PAGE_MARGIN_TWIPS2 = 1440;
|
|
351436
351836
|
var init_adapter8 = __esm(() => {
|
|
351437
351837
|
init_src3();
|
|
351438
351838
|
init_sd_document_session_internal();
|
|
@@ -351447,6 +351847,7 @@ var init_adapter8 = __esm(() => {
|
|
|
351447
351847
|
init_part();
|
|
351448
351848
|
init_section_xml();
|
|
351449
351849
|
init_native_table_split();
|
|
351850
|
+
init_terminal_placement();
|
|
351450
351851
|
init_tracked_policy();
|
|
351451
351852
|
init_lean_read();
|
|
351452
351853
|
init_vertical_cell_properties();
|
|
@@ -351493,7 +351894,7 @@ var init_adapter8 = __esm(() => {
|
|
|
351493
351894
|
"v2-tables-set-row-height",
|
|
351494
351895
|
"v2-tables-set-layout"
|
|
351495
351896
|
]);
|
|
351496
|
-
|
|
351897
|
+
TD99 = new TextDecoder;
|
|
351497
351898
|
EMPTY_TABLE_CONTEXT_AT_SELECTION = { inTable: false };
|
|
351498
351899
|
});
|
|
351499
351900
|
|
|
@@ -353809,7 +354210,7 @@ function readTableBlockText(context, partUriBytes, index2, block, accumulator) {
|
|
|
353809
354210
|
if (entry.byteStart < block.tableByteStart || entry.byteEnd > block.tableByteEnd)
|
|
353810
354211
|
continue;
|
|
353811
354212
|
const windowBytes = entry.byteEnd - entry.byteStart;
|
|
353812
|
-
const paragraphXml =
|
|
354213
|
+
const paragraphXml = TD100.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
353813
354214
|
text4.push(visibleParagraphText2(paragraphXml, accumulator.textProjectionTelemetry));
|
|
353814
354215
|
accumulator.tableParagraphWindowCount += 1;
|
|
353815
354216
|
accumulator.tableParagraphWindowDecodedBytes += windowBytes;
|
|
@@ -354300,7 +354701,7 @@ class V2BlocksAdapter {
|
|
|
354300
354701
|
return failure4("PERMISSION_DENIED", DOCUMENT_PROTECTION_MESSAGE);
|
|
354301
354702
|
}
|
|
354302
354703
|
const partBytes = getSDDocumentSessionInternalPartBytes(this.context.session, storyPartUriFromId5(resolved.storyId));
|
|
354303
|
-
const paraXml = partBytes ?
|
|
354704
|
+
const paraXml = partBytes ? TD100.decode(partBytes.subarray(resolved.entry.byteStart, resolved.entry.byteEnd)) : "";
|
|
354304
354705
|
const objectSlack = (paraXml.match(/<[\w.-]+:(?:drawing|pict|object)\b/g) ?? []).length;
|
|
354305
354706
|
const coordinateSpace = input.coordinateSpace ?? "visible";
|
|
354306
354707
|
const metadataAnchorBindings = storyPartUriFromId5(resolved.storyId) === "/word/document.xml" ? listMetadataSplitBindings(this.context, paraXml) : [];
|
|
@@ -354392,7 +354793,7 @@ class V2BlocksAdapter {
|
|
|
354392
354793
|
return failure4("PERMISSION_DENIED", DOCUMENT_PROTECTION_MESSAGE);
|
|
354393
354794
|
}
|
|
354394
354795
|
const partBytes = getSDDocumentSessionInternalPartBytes(this.context.session, storyPartUriFromId5(first.storyId));
|
|
354395
|
-
const firstParaXml = partBytes ?
|
|
354796
|
+
const firstParaXml = partBytes ? TD100.decode(partBytes.subarray(first.entry.byteStart, first.entry.byteEnd)) : "";
|
|
354396
354797
|
const joinOffset = first.entry.textLength + (firstParaXml.match(/<[\w.-]+:(?:drawing|pict|object)\b/g) ?? []).length;
|
|
354397
354798
|
const begun = this.context.beginMutation({ expectedRevision: options?.expectedRevision });
|
|
354398
354799
|
if ("failure" in begun)
|
|
@@ -354532,7 +354933,7 @@ function traceBlocksList(context, input) {
|
|
|
354532
354933
|
const first = input.firstParagraph;
|
|
354533
354934
|
const partUri = first?.partUri ?? storyPartUriFromId5(input.storyId);
|
|
354534
354935
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, partUri);
|
|
354535
|
-
const xml = first && bytes ?
|
|
354936
|
+
const xml = first && bytes ? TD100.decode(bytes.subarray(first.byteStart, first.byteEnd)) : "";
|
|
354536
354937
|
const text4 = visibleText(xml);
|
|
354537
354938
|
process.stderr?.write?.(`[v2:doc-api] blocks.list storyId=${input.storyId} ` + `storyRange=${input.storyByteRange ? `${input.storyByteRange[0]}-${input.storyByteRange[1]}` : "none"} ` + `indexEntries=${input.indexEntryCount} topLevel=${input.topLevelCount} ` + `partUri=${partUri} bytes=${bytes?.byteLength ?? -1} ` + `first=${first ? `${first.blockId}:${first.byteStart}-${first.byteEnd}` : "none"} ` + `xml=${JSON.stringify(xml.slice(0, 120))} text=${JSON.stringify(text4.slice(0, 120))}
|
|
354538
354939
|
`);
|
|
@@ -355086,7 +355487,7 @@ function appendTopLevelTableBlocks(blocks, tableCatalog, storyId, storyByteRange
|
|
|
355086
355487
|
function readParagraphXml(context, partUriBytes, entry) {
|
|
355087
355488
|
const bytes = partUriBytes.get(entry.partUri) ?? getSDDocumentSessionInternalPartBytes(context.session, entry.partUri);
|
|
355088
355489
|
partUriBytes.set(entry.partUri, bytes ?? null);
|
|
355089
|
-
return bytes ?
|
|
355490
|
+
return bytes ? TD100.decode(bytes.subarray(entry.byteStart, entry.byteEnd)) : "";
|
|
355090
355491
|
}
|
|
355091
355492
|
function collectTocBlockIdsForStory(context, storyId) {
|
|
355092
355493
|
const ids = new Set;
|
|
@@ -355449,7 +355850,7 @@ function buildDeletedBlockSummary(context, entry, nodeType) {
|
|
|
355449
355850
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, entry.partUri);
|
|
355450
355851
|
if (!bytes)
|
|
355451
355852
|
return;
|
|
355452
|
-
const text4 = visibleText(
|
|
355853
|
+
const text4 = visibleText(TD100.decode(bytes.subarray(entry.byteStart, entry.byteEnd)));
|
|
355453
355854
|
const trimmed = text4.trim();
|
|
355454
355855
|
return {
|
|
355455
355856
|
ordinal: entry.ordinal,
|
|
@@ -355462,7 +355863,7 @@ function buildDeletedTableSummary(context, entry, storyId, storyByteRange) {
|
|
|
355462
355863
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, entry.partUri);
|
|
355463
355864
|
if (!bytes)
|
|
355464
355865
|
return;
|
|
355465
|
-
const text4 = visibleText(
|
|
355866
|
+
const text4 = visibleText(TD100.decode(bytes.subarray(entry.tableByteStart, entry.tableByteEnd)));
|
|
355466
355867
|
const trimmed = text4.trim();
|
|
355467
355868
|
let ordinal = -1;
|
|
355468
355869
|
if (storyId) {
|
|
@@ -355537,7 +355938,7 @@ function readTailParaId(provisionalToFinal, createdRefs) {
|
|
|
355537
355938
|
}
|
|
355538
355939
|
return null;
|
|
355539
355940
|
}
|
|
355540
|
-
var
|
|
355941
|
+
var TD100, PARAGRAPH_TYPES, TOP_LEVEL_LIST_ROWS_CACHE, BLOCK_NUMBERING_CACHE;
|
|
355541
355942
|
var init_adapter9 = __esm(() => {
|
|
355542
355943
|
init_sd_document_session_internal();
|
|
355543
355944
|
init_adapter3();
|
|
@@ -355561,7 +355962,7 @@ var init_adapter9 = __esm(() => {
|
|
|
355561
355962
|
init_formatting();
|
|
355562
355963
|
init_table_info();
|
|
355563
355964
|
init_numbering_stories();
|
|
355564
|
-
|
|
355965
|
+
TD100 = new TextDecoder;
|
|
355565
355966
|
PARAGRAPH_TYPES = new Set(["paragraph", "heading", "listItem"]);
|
|
355566
355967
|
TOP_LEVEL_LIST_ROWS_CACHE = new WeakMap;
|
|
355567
355968
|
BLOCK_NUMBERING_CACHE = new WeakMap;
|
|
@@ -355610,11 +356011,11 @@ function normalizeSelectedRuns(input, allowSeparators) {
|
|
|
355610
356011
|
function splitSharedTextRun(source, allowSeparators) {
|
|
355611
356012
|
const parsed = collectXmlElementRanges(source, {
|
|
355612
356013
|
fragment: true,
|
|
355613
|
-
additionalNamespaces: xmlFragmentAdditionalNamespaces(source, new Map, { w:
|
|
356014
|
+
additionalNamespaces: xmlFragmentAdditionalNamespaces(source, new Map, { w: W15 })
|
|
355614
356015
|
});
|
|
355615
356016
|
if (parsed.errors.length)
|
|
355616
356017
|
return null;
|
|
355617
|
-
const root = parsed.ranges.find((range) => range.start === 0 && range.tag.namespaceUri ===
|
|
356018
|
+
const root = parsed.ranges.find((range) => range.start === 0 && range.tag.namespaceUri === W15 && range.tag.localName === "r");
|
|
355618
356019
|
if (!root || root.tag.isSelfClosing)
|
|
355619
356020
|
return null;
|
|
355620
356021
|
const children2 = [];
|
|
@@ -355632,7 +356033,7 @@ function splitSharedTextRun(source, allowSeparators) {
|
|
|
355632
356033
|
let properties = "";
|
|
355633
356034
|
const content3 = [];
|
|
355634
356035
|
for (const child of children2) {
|
|
355635
|
-
if (child.tag.namespaceUri !==
|
|
356036
|
+
if (child.tag.namespaceUri !== W15)
|
|
355636
356037
|
return null;
|
|
355637
356038
|
const raw = source.slice(child.start, child.end);
|
|
355638
356039
|
if (child.tag.localName === "rPr") {
|
|
@@ -355649,7 +356050,7 @@ function splitSharedTextRun(source, allowSeparators) {
|
|
|
355649
356050
|
} else if (!child.tag.isSelfClosing)
|
|
355650
356051
|
return null;
|
|
355651
356052
|
if (child.tag.localName === "br") {
|
|
355652
|
-
const type = child.tag.attributes.find((attribute2) => attribute2.namespaceUri ===
|
|
356053
|
+
const type = child.tag.attributes.find((attribute2) => attribute2.namespaceUri === W15 && attribute2.localName === "type")?.value;
|
|
355653
356054
|
if (type && type !== "textWrapping")
|
|
355654
356055
|
return null;
|
|
355655
356056
|
}
|
|
@@ -355661,7 +356062,7 @@ function splitSharedTextRun(source, allowSeparators) {
|
|
|
355661
356062
|
const close = source.slice(root.closeStart, root.end);
|
|
355662
356063
|
return content3.map((leaf) => `${open2}${properties}${leaf}${close}`).join("");
|
|
355663
356064
|
}
|
|
355664
|
-
var
|
|
356065
|
+
var W15 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
355665
356066
|
var init_wrap_text_selection = __esm(() => {
|
|
355666
356067
|
init_sd_document_session_internal();
|
|
355667
356068
|
init_inline();
|
|
@@ -355695,7 +356096,7 @@ function ensureAppearanceNamespace(xml, controlRange) {
|
|
|
355695
356096
|
return null;
|
|
355696
356097
|
const tag = root.tag;
|
|
355697
356098
|
const bindings = tag.namespaceBindings;
|
|
355698
|
-
if (bindings.w15 !== undefined && bindings.w15 !==
|
|
356099
|
+
if (bindings.w15 !== undefined && bindings.w15 !== W152) {
|
|
355699
356100
|
return hasWordAppearance(xml, controlRange) ? xml : null;
|
|
355700
356101
|
}
|
|
355701
356102
|
let openTag = xml.slice(root.start, root.end);
|
|
@@ -355703,7 +356104,7 @@ function ensureAppearanceNamespace(xml, controlRange) {
|
|
|
355703
356104
|
openTag = openTag.replace(/(\/?>)$/, `${attribute2}$1`);
|
|
355704
356105
|
};
|
|
355705
356106
|
if (bindings.w15 === undefined)
|
|
355706
|
-
append(` xmlns:w15="${
|
|
356107
|
+
append(` xmlns:w15="${W152}"`);
|
|
355707
356108
|
const ignorable = tag.attributes.find((attribute2) => attribute2.namespaceUri === MC && attribute2.localName === "Ignorable");
|
|
355708
356109
|
if (ignorable) {
|
|
355709
356110
|
const tokens = [...new Set([...ignorable.value.split(/\s+/).filter(Boolean), "w15"])];
|
|
@@ -355733,9 +356134,9 @@ function hasWordAppearance(xml, controlRange) {
|
|
|
355733
356134
|
if (!properties)
|
|
355734
356135
|
return false;
|
|
355735
356136
|
const appearances = parsed.ranges.filter((range) => range.start >= properties.openEnd && range.end <= properties.closeStart && range.tag.name === "w15:appearance");
|
|
355736
|
-
return appearances.length > 0 && appearances.every(({ tag }) => tag.namespaceUri ===
|
|
356137
|
+
return appearances.length > 0 && appearances.every(({ tag }) => tag.namespaceUri === W152 && tag.attributesByName["w15:val"]?.namespaceUri === W152);
|
|
355737
356138
|
}
|
|
355738
|
-
var
|
|
356139
|
+
var W152 = "http://schemas.microsoft.com/office/word/2012/wordml", MC = "http://schemas.openxmlformats.org/markup-compatibility/2006";
|
|
355739
356140
|
var init_appearance_namespace = __esm(() => {
|
|
355740
356141
|
init_sd_document_session_internal();
|
|
355741
356142
|
init_shared();
|
|
@@ -355783,7 +356184,7 @@ function richWriteAnalysisSha256(input) {
|
|
|
355783
356184
|
return digest({ ...input, atomic: true });
|
|
355784
356185
|
}
|
|
355785
356186
|
function digest(value2) {
|
|
355786
|
-
return sha256HexSync(
|
|
356187
|
+
return sha256HexSync(TE57.encode(canonicalJson(value2)));
|
|
355787
356188
|
}
|
|
355788
356189
|
function canonicalJson(value2) {
|
|
355789
356190
|
if (value2 === null || typeof value2 === "boolean" || typeof value2 === "string")
|
|
@@ -355801,10 +356202,10 @@ function canonicalJson(value2) {
|
|
|
355801
356202
|
}
|
|
355802
356203
|
throw new Error(`Support-check digests cannot encode ${typeof value2}.`);
|
|
355803
356204
|
}
|
|
355804
|
-
var
|
|
356205
|
+
var TE57;
|
|
355805
356206
|
var init_digest = __esm(() => {
|
|
355806
356207
|
init_sd_document_session_internal();
|
|
355807
|
-
|
|
356208
|
+
TE57 = new TextEncoder;
|
|
355808
356209
|
});
|
|
355809
356210
|
|
|
355810
356211
|
// ../../../v2/document-api-v2-adapter/dist/write/rich-fragment-apply.js
|
|
@@ -356372,7 +356773,7 @@ function readResolvedSelectionText2(context, index2, resolved) {
|
|
|
356372
356773
|
const bytes = getSDDocumentSessionInternalPartRange(context.session, entry.partUri, entry.byteStart, entry.byteEnd);
|
|
356373
356774
|
if (!bytes)
|
|
356374
356775
|
return "";
|
|
356375
|
-
const xml =
|
|
356776
|
+
const xml = TD101.decode(bytes);
|
|
356376
356777
|
const text4 = resolved.coordinateSpace === "tracked" ? readTrackedParagraphText(xml) : readVisibleParagraphText(xml);
|
|
356377
356778
|
return text4.slice(resolved.startOffset, resolved.endOffset);
|
|
356378
356779
|
}
|
|
@@ -356570,7 +356971,7 @@ function mapStructuralCode(code2) {
|
|
|
356570
356971
|
return "INTERNAL_ERROR";
|
|
356571
356972
|
}
|
|
356572
356973
|
}
|
|
356573
|
-
var BODY_STORY,
|
|
356974
|
+
var BODY_STORY, TD101;
|
|
356574
356975
|
var init_rich_fragment_apply = __esm(() => {
|
|
356575
356976
|
init_src3();
|
|
356576
356977
|
init_applied_change_mode();
|
|
@@ -356587,7 +356988,7 @@ var init_rich_fragment_apply = __esm(() => {
|
|
|
356587
356988
|
init_adapter6();
|
|
356588
356989
|
init_digest();
|
|
356589
356990
|
BODY_STORY = { kind: "story", storyType: "body" };
|
|
356590
|
-
|
|
356991
|
+
TD101 = new TextDecoder;
|
|
356591
356992
|
});
|
|
356592
356993
|
|
|
356593
356994
|
// ../../../v2/document-api-v2-adapter/dist/xml-rewrite.js
|
|
@@ -356596,7 +356997,7 @@ function readPartBytes3(context, partUri) {
|
|
|
356596
356997
|
}
|
|
356597
356998
|
function readPartXml2(context, partUri) {
|
|
356598
356999
|
const bytes = readPartBytes3(context, partUri);
|
|
356599
|
-
return bytes ?
|
|
357000
|
+
return bytes ? TD102.decode(bytes) : null;
|
|
356600
357001
|
}
|
|
356601
357002
|
function commitKernelXmlRewrites(input) {
|
|
356602
357003
|
const changed = input.rewrites.map((rewrite) => {
|
|
@@ -356610,7 +357011,7 @@ function commitKernelXmlRewrites(input) {
|
|
|
356610
357011
|
}
|
|
356611
357012
|
};
|
|
356612
357013
|
}
|
|
356613
|
-
const nextBytes =
|
|
357014
|
+
const nextBytes = TE58.encode(rewrite.nextXml);
|
|
356614
357015
|
return bytesEqual17(currentBytes, nextBytes) ? null : {
|
|
356615
357016
|
rewrite,
|
|
356616
357017
|
currentBytes,
|
|
@@ -356686,12 +357087,12 @@ function bytesEqual17(left, right) {
|
|
|
356686
357087
|
}
|
|
356687
357088
|
return true;
|
|
356688
357089
|
}
|
|
356689
|
-
var
|
|
357090
|
+
var TE58, TD102;
|
|
356690
357091
|
var init_xml_rewrite = __esm(() => {
|
|
356691
357092
|
init_sd_document_session_internal();
|
|
356692
357093
|
init_xml();
|
|
356693
|
-
|
|
356694
|
-
|
|
357094
|
+
TE58 = new TextEncoder;
|
|
357095
|
+
TD102 = new TextDecoder;
|
|
356695
357096
|
});
|
|
356696
357097
|
|
|
356697
357098
|
// ../../../v2/document-api-v2-adapter/dist/content-controls/replacement.js
|
|
@@ -356714,13 +357115,13 @@ function buildTextReplacementContentXml(text4, kind, allocate, existingContentXm
|
|
|
356714
357115
|
return kind === "inline" ? run : paragraph3(allocate(), run);
|
|
356715
357116
|
}
|
|
356716
357117
|
function firstRunProperties(contentXml) {
|
|
356717
|
-
const namespaces = { w:
|
|
357118
|
+
const namespaces = { w: W17, w14: W147, r: R };
|
|
356718
357119
|
const { ranges } = collectXmlElementRanges(contentXml, { fragment: true, additionalNamespaces: namespaces });
|
|
356719
357120
|
ranges.sort((left, right) => left.start - right.start);
|
|
356720
|
-
const run = ranges.find((range) => range.tag.namespaceUri ===
|
|
357121
|
+
const run = ranges.find((range) => range.tag.namespaceUri === W17 && range.tag.localName === "r");
|
|
356721
357122
|
if (!run)
|
|
356722
357123
|
return "";
|
|
356723
|
-
const properties = ranges.find((range) => range.start >= run.openEnd && range.end <= run.closeStart && range.tag.namespaceUri ===
|
|
357124
|
+
const properties = ranges.find((range) => range.start >= run.openEnd && range.end <= run.closeStart && range.tag.namespaceUri === W17 && range.tag.localName === "rPr" && !ranges.some((parent) => parent.start > run.start && parent.start < range.start && parent.end > range.end));
|
|
356724
357125
|
if (!properties)
|
|
356725
357126
|
return "";
|
|
356726
357127
|
const inheritedDeclarations = Object.entries(properties.namespaceBindings).filter(([prefix, uri]) => prefix !== "xml" && namespaces[prefix] !== uri && !properties.tag.attributes.some((attribute2) => attribute2.name === (prefix ? `xmlns:${prefix}` : "xmlns"))).map(([prefix, uri]) => ` xmlns${prefix ? `:${prefix}` : ""}="${xmlEscapeAttr(uri)}"`).join("");
|
|
@@ -356729,8 +357130,8 @@ function firstRunProperties(contentXml) {
|
|
|
356729
357130
|
}
|
|
356730
357131
|
function normalizeOoxml(content3, allocate) {
|
|
356731
357132
|
const prefixes = new Map([
|
|
356732
|
-
[
|
|
356733
|
-
[
|
|
357133
|
+
[W17, "w"],
|
|
357134
|
+
[W147, "w14"],
|
|
356734
357135
|
[R, "r"],
|
|
356735
357136
|
["http://schemas.microsoft.com/office/word/2012/wordml", "w15"]
|
|
356736
357137
|
]);
|
|
@@ -356746,11 +357147,11 @@ function normalizeOoxml(content3, allocate) {
|
|
|
356746
357147
|
return `${prefix}:${name2.localName}`;
|
|
356747
357148
|
};
|
|
356748
357149
|
const name = qualifiedName2(range.tag);
|
|
356749
|
-
const attrs = range.tag.attributes.filter((attr4) => !(range.tag.namespaceUri ===
|
|
356750
|
-
if (range.tag.namespaceUri ===
|
|
357150
|
+
const attrs = range.tag.attributes.filter((attr4) => !(range.tag.namespaceUri === W17 && range.tag.localName === "p" && attr4.namespaceUri === W147 && attr4.localName === "paraId")).map((attr4) => ({ name: qualifiedName2(attr4), value: attr4.value }));
|
|
357151
|
+
if (range.tag.namespaceUri === W17 && range.tag.localName === "p") {
|
|
356751
357152
|
attrs.push({ name: "w14:paraId", value: allocate() });
|
|
356752
|
-
if (range.namespaceBindings["w14"] !==
|
|
356753
|
-
bindings.set("w14",
|
|
357153
|
+
if (range.namespaceBindings["w14"] !== W147)
|
|
357154
|
+
bindings.set("w14", W147);
|
|
356754
357155
|
}
|
|
356755
357156
|
const serialized = attrs.filter((attr4) => !bindings.has(attr4.name.replace(/^xmlns:/, ""))).map((attr4) => ` ${attr4.name}="${xmlEscapeAttr(attr4.value).replaceAll(`
|
|
356756
357157
|
`, " ").replaceAll("\r", " ").replaceAll("\t", "	")}"`).join("");
|
|
@@ -356769,7 +357170,7 @@ function normalizeOoxml(content3, allocate) {
|
|
|
356769
357170
|
return xml;
|
|
356770
357171
|
}
|
|
356771
357172
|
function paragraph3(id, runs) {
|
|
356772
|
-
return `<w:p xmlns:w14="${
|
|
357173
|
+
return `<w:p xmlns:w14="${W147}" w14:paraId="${id}">${runs}</w:p>`;
|
|
356773
357174
|
}
|
|
356774
357175
|
function htmlContent(context, content3, kind, allocate) {
|
|
356775
357176
|
const converted = convertContentToFragment({ format: "html", source: content3 });
|
|
@@ -356857,14 +357258,14 @@ function validateOoxml(input) {
|
|
|
356857
357258
|
if (!parent || parent === "sdtContent") {
|
|
356858
357259
|
const placement3 = placements.at(-1);
|
|
356859
357260
|
const allowed = placement3 === "block" ? ["p", "tbl", "sdt", "bookmarkStart", "bookmarkEnd"] : placement3 === "row" ? ["tr", "sdt"] : placement3 === "cell" ? ["tc", "sdt", "bookmarkStart", "bookmarkEnd"] : ["r", "sdt", "hyperlink", "fldSimple", "bookmarkStart", "bookmarkEnd"];
|
|
356860
|
-
if (tag.namespaceUri !==
|
|
357261
|
+
if (tag.namespaceUri !== W17 || !allowed.includes(name))
|
|
356861
357262
|
invalid4("OOXML fragment has invalid content-control placement.");
|
|
356862
357263
|
}
|
|
356863
|
-
if (tag.prefix === "w14" && tag.namespaceUri !==
|
|
357264
|
+
if (tag.prefix === "w14" && tag.namespaceUri !== W147)
|
|
356864
357265
|
invalid4("OOXML fragment binds w14 to an incorrect namespace.");
|
|
356865
|
-
if (tag.prefix === "w" && tag.namespaceUri !==
|
|
357266
|
+
if (tag.prefix === "w" && tag.namespaceUri !== W17)
|
|
356866
357267
|
invalid4("OOXML fragment binds w to an incorrect namespace.");
|
|
356867
|
-
if (tag.namespaceUri ===
|
|
357268
|
+
if (tag.namespaceUri === W17) {
|
|
356868
357269
|
if ([
|
|
356869
357270
|
"document",
|
|
356870
357271
|
"body",
|
|
@@ -356904,16 +357305,16 @@ function validateOoxml(input) {
|
|
|
356904
357305
|
control2.content = true;
|
|
356905
357306
|
}
|
|
356906
357307
|
if (["pStyle", "rStyle", "tblStyle", "numId"].includes(name)) {
|
|
356907
|
-
const value2 = tag.attributes.find((attr4) => attr4.namespaceUri ===
|
|
357308
|
+
const value2 = tag.attributes.find((attr4) => attr4.namespaceUri === W17 && attr4.localName === "val")?.value;
|
|
356908
357309
|
const part = name === "numId" ? "/word/numbering.xml" : "/word/styles.xml";
|
|
356909
357310
|
const attribute2 = name === "numId" ? "numId" : "styleId";
|
|
356910
357311
|
const catalog = collectXmlElementRanges(readPartXml(input.context, part) ?? "").ranges;
|
|
356911
|
-
if (!value2 || !catalog.some((range) => range.tag.attributes.some((attr4) => attr4.namespaceUri ===
|
|
357312
|
+
if (!value2 || !catalog.some((range) => range.tag.attributes.some((attr4) => attr4.namespaceUri === W17 && attr4.localName === attribute2 && attr4.value === value2))) {
|
|
356912
357313
|
invalid4(`OOXML replacement references unavailable ${name}.`);
|
|
356913
357314
|
}
|
|
356914
357315
|
}
|
|
356915
357316
|
if (name === "id" && parent === "sdtPr") {
|
|
356916
|
-
const id = tag.attributes.find((attr4) => attr4.namespaceUri ===
|
|
357317
|
+
const id = tag.attributes.find((attr4) => attr4.namespaceUri === W17 && attr4.localName === "val")?.value;
|
|
356917
357318
|
const numeric = Number(id);
|
|
356918
357319
|
const control2 = controls.at(-1);
|
|
356919
357320
|
if (!id || !/^-?\d+$/.test(id) || !Number.isSafeInteger(numeric) || numeric < -2147483648 || numeric > 2147483647 || ids.has(String(numeric)) || !control2 || control2.id)
|
|
@@ -356930,7 +357331,7 @@ function validateOoxml(input) {
|
|
|
356930
357331
|
});
|
|
356931
357332
|
parser.on("closetag", (tag) => {
|
|
356932
357333
|
stack.pop();
|
|
356933
|
-
if (tag.namespaceUri ===
|
|
357334
|
+
if (tag.namespaceUri === W17 && tag.localName === "sdt") {
|
|
356934
357335
|
placements.pop();
|
|
356935
357336
|
const control2 = controls.pop();
|
|
356936
357337
|
if (!control2?.id || !control2.content)
|
|
@@ -356949,7 +357350,7 @@ function validateOoxml(input) {
|
|
|
356949
357350
|
invalid4("OOXML replacement is not well-formed, namespace-bound XML.");
|
|
356950
357351
|
}
|
|
356951
357352
|
}
|
|
356952
|
-
var
|
|
357353
|
+
var W17 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", W147 = "http://schemas.microsoft.com/office/word/2010/wordml", R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
356953
357354
|
var init_replacement = __esm(() => {
|
|
356954
357355
|
init_sd_document_session_internal();
|
|
356955
357356
|
init_convert_to_fragment();
|
|
@@ -356979,7 +357380,7 @@ function cloneContentControlXml(input) {
|
|
|
356979
357380
|
const edits = [];
|
|
356980
357381
|
for (const range of ranges) {
|
|
356981
357382
|
const owner = parent.get(range);
|
|
356982
|
-
if (range.tag.namespaceUri ===
|
|
357383
|
+
if (range.tag.namespaceUri === W18 && range.tag.localName === "id" && owner?.tag.namespaceUri === W18 && owner.tag.localName === "sdtPr" && !range.tag.attributes.some((attribute2) => attribute2.namespaceUri === W18 && attribute2.localName === "val")) {
|
|
356983
357384
|
throw operationError("INVALID_INPUT", "Copied content-control identity has no Word value.");
|
|
356984
357385
|
}
|
|
356985
357386
|
}
|
|
@@ -356994,16 +357395,16 @@ function cloneContentControlXml(input) {
|
|
|
356994
357395
|
};
|
|
356995
357396
|
let rootId;
|
|
356996
357397
|
for (const range of ranges) {
|
|
356997
|
-
if (range.tag.namespaceUri !==
|
|
357398
|
+
if (range.tag.namespaceUri !== W18)
|
|
356998
357399
|
continue;
|
|
356999
357400
|
if (range.tag.localName === "sdt") {
|
|
357000
|
-
const properties = ranges.find((child) => parent.get(child) === range && child.tag.namespaceUri ===
|
|
357401
|
+
const properties = ranges.find((child) => parent.get(child) === range && child.tag.namespaceUri === W18 && child.tag.localName === "sdtPr");
|
|
357001
357402
|
const id = input.allocateControlId();
|
|
357002
357403
|
rootId ?? (rootId = id);
|
|
357003
357404
|
if (!properties) {
|
|
357004
357405
|
const propertyName = range.tag.prefix ? `${range.tag.prefix}:sdtPr` : "sdtPr";
|
|
357005
357406
|
const prefix = range.tag.prefix || "sdw";
|
|
357006
|
-
const marker = `<${prefix}:id${range.tag.prefix ? "" : ` xmlns:${prefix}="${
|
|
357407
|
+
const marker = `<${prefix}:id${range.tag.prefix ? "" : ` xmlns:${prefix}="${W18}"`} ${prefix}:val="${id}"/>`;
|
|
357007
357408
|
const propertiesXml = `<${propertyName}>${marker}</${propertyName}>`;
|
|
357008
357409
|
if (range.tag.isSelfClosing) {
|
|
357009
357410
|
edits.push({
|
|
@@ -357015,13 +357416,13 @@ function cloneContentControlXml(input) {
|
|
|
357015
357416
|
edits.push({ start: range.openEnd, end: range.openEnd, xml: propertiesXml });
|
|
357016
357417
|
continue;
|
|
357017
357418
|
}
|
|
357018
|
-
const idElement = ranges.find((child) => parent.get(child) === properties && child.tag.namespaceUri ===
|
|
357019
|
-
const attribute2 = idElement?.tag.attributes.find((attribute3) => attribute3.namespaceUri ===
|
|
357419
|
+
const idElement = ranges.find((child) => parent.get(child) === properties && child.tag.namespaceUri === W18 && child.tag.localName === "id");
|
|
357420
|
+
const attribute2 = idElement?.tag.attributes.find((attribute3) => attribute3.namespaceUri === W18 && attribute3.localName === "val");
|
|
357020
357421
|
if (idElement && attribute2) {
|
|
357021
357422
|
replaceAttribute2(idElement, attribute2.name, id);
|
|
357022
357423
|
} else if (!idElement) {
|
|
357023
357424
|
const prefix = properties.tag.prefix || "sdw";
|
|
357024
|
-
const marker = `<${prefix}:id${properties.tag.prefix ? "" : ` xmlns:${prefix}="${
|
|
357425
|
+
const marker = `<${prefix}:id${properties.tag.prefix ? "" : ` xmlns:${prefix}="${W18}"`} ${prefix}:val="${id}"/>`;
|
|
357025
357426
|
if (properties.tag.isSelfClosing) {
|
|
357026
357427
|
edits.push({
|
|
357027
357428
|
start: properties.start,
|
|
@@ -357034,17 +357435,17 @@ function cloneContentControlXml(input) {
|
|
|
357034
357435
|
throw operationError("INVALID_INPUT", "Copied content-control identity has no Word value.");
|
|
357035
357436
|
} else if (range.tag.localName === "p") {
|
|
357036
357437
|
const id = input.allocateParagraphId();
|
|
357037
|
-
const attribute2 = range.tag.attributes.find((attribute3) => attribute3.namespaceUri ===
|
|
357438
|
+
const attribute2 = range.tag.attributes.find((attribute3) => attribute3.namespaceUri === W148 && attribute3.localName === "paraId");
|
|
357038
357439
|
if (attribute2)
|
|
357039
357440
|
replaceAttribute2(range, attribute2.name, id);
|
|
357040
357441
|
else {
|
|
357041
|
-
let prefix = Object.entries(range.namespaceBindings).find(([name, uri]) => name && uri ===
|
|
357442
|
+
let prefix = Object.entries(range.namespaceBindings).find(([name, uri]) => name && uri === W148)?.[0];
|
|
357042
357443
|
let declaration = "";
|
|
357043
357444
|
if (!prefix) {
|
|
357044
357445
|
prefix = "w14";
|
|
357045
357446
|
while (range.namespaceBindings[prefix])
|
|
357046
357447
|
prefix += "_";
|
|
357047
|
-
declaration = ` xmlns:${prefix}="${
|
|
357448
|
+
declaration = ` xmlns:${prefix}="${W148}"`;
|
|
357048
357449
|
}
|
|
357049
357450
|
const open2 = input.xml.slice(range.start, range.openEnd).replace(/(\/?>)$/, `${declaration} ${prefix}:paraId="${id}"$1`);
|
|
357050
357451
|
edits.push({ start: range.start, end: range.openEnd, xml: open2 });
|
|
@@ -357066,15 +357467,15 @@ function collectPackageControlIds(context, removed) {
|
|
|
357066
357467
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, partUri);
|
|
357067
357468
|
if (!bytes)
|
|
357068
357469
|
throw operationError("PRECONDITION_FAILED", "Content-control identity catalog is not available.");
|
|
357069
|
-
let xml =
|
|
357470
|
+
let xml = TD103.decode(bytes);
|
|
357070
357471
|
if (partUri === removed?.partUri)
|
|
357071
357472
|
xml = xml.slice(0, removed.start) + xml.slice(removed.end);
|
|
357072
357473
|
const stack = [];
|
|
357073
357474
|
const parser = createXmlSaxParser({ namespaceAware: true });
|
|
357074
357475
|
parser.on("opentag", (tag) => {
|
|
357075
357476
|
const parent = stack.at(-1);
|
|
357076
|
-
if (tag.namespaceUri ===
|
|
357077
|
-
const value2 = tag.attributes.find((attr4) => attr4.namespaceUri ===
|
|
357477
|
+
if (tag.namespaceUri === W18 && tag.localName === "id" && parent?.namespaceUri === W18 && parent.localName === "sdtPr") {
|
|
357478
|
+
const value2 = tag.attributes.find((attr4) => attr4.namespaceUri === W18 && attr4.localName === "val")?.value;
|
|
357078
357479
|
if (value2 !== undefined)
|
|
357079
357480
|
ids.add(String(Number(value2)));
|
|
357080
357481
|
}
|
|
@@ -357091,11 +357492,11 @@ function collectPackageControlIds(context, removed) {
|
|
|
357091
357492
|
}
|
|
357092
357493
|
return ids;
|
|
357093
357494
|
}
|
|
357094
|
-
var
|
|
357495
|
+
var W18 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TD103, W148 = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
357095
357496
|
var init_identities = __esm(() => {
|
|
357096
357497
|
init_sd_document_session_internal();
|
|
357097
357498
|
init_shared();
|
|
357098
|
-
|
|
357499
|
+
TD103 = new TextDecoder;
|
|
357099
357500
|
});
|
|
357100
357501
|
|
|
357101
357502
|
// ../../../v2/document-api-v2-adapter/dist/content-controls/tracked-content.js
|
|
@@ -357199,7 +357600,7 @@ function prepareTrackedContentControlMove(input) {
|
|
|
357199
357600
|
author: { name: author.name },
|
|
357200
357601
|
date: date6
|
|
357201
357602
|
};
|
|
357202
|
-
const wrapperBindings = { ...Object.fromEntries(input.namespaceBindings), w:
|
|
357603
|
+
const wrapperBindings = { ...Object.fromEntries(input.namespaceBindings), w: W19 };
|
|
357203
357604
|
const sourcePayload = closeTableCellBodyNamespaces(source.xml, Object.fromEntries(input.namespaceBindings), wrapperBindings);
|
|
357204
357605
|
const destinationPayload = closeTableCellBodyNamespaces(destination.xml, Object.fromEntries(input.namespaceBindings), wrapperBindings);
|
|
357205
357606
|
if (sourcePayload === null || destinationPayload === null)
|
|
@@ -357230,8 +357631,8 @@ function prepareTrackedContentControlMove(input) {
|
|
|
357230
357631
|
});
|
|
357231
357632
|
if (ranges.errors.length)
|
|
357232
357633
|
return null;
|
|
357233
|
-
const start = ranges.ranges.find(({ tag, start: start2 }) => start2 === 0 && tag.namespaceUri ===
|
|
357234
|
-
const end = ranges.ranges.find(({ tag, end: end2 }) => end2 === contentXml.length && tag.namespaceUri ===
|
|
357634
|
+
const start = ranges.ranges.find(({ tag, start: start2 }) => start2 === 0 && tag.namespaceUri === W19 && tag.localName === `${kind}RangeStart`);
|
|
357635
|
+
const end = ranges.ranges.find(({ tag, end: end2 }) => end2 === contentXml.length && tag.namespaceUri === W19 && tag.localName === `${kind}RangeEnd`);
|
|
357235
357636
|
if (!start || !end)
|
|
357236
357637
|
return null;
|
|
357237
357638
|
const xml = control2.xml.slice(0, control2.content.openEnd) + contentXml.slice(start.end, end.start) + control2.xml.slice(control2.content.closeStart);
|
|
@@ -357291,7 +357692,7 @@ function readLeafControl(xml, kind, namespaces) {
|
|
|
357291
357692
|
return null;
|
|
357292
357693
|
const ranges = [...parsed.ranges].sort((a, b) => a.start - b.start || b.end - a.end);
|
|
357293
357694
|
const root = ranges[0];
|
|
357294
|
-
if (!root || root.tag.namespaceUri !==
|
|
357695
|
+
if (!root || root.tag.namespaceUri !== W19 || root.tag.localName !== "sdt" || xml.slice(0, root.start).trim() || xml.slice(root.end).trim())
|
|
357295
357696
|
return null;
|
|
357296
357697
|
const parents = new Map;
|
|
357297
357698
|
const stack = [];
|
|
@@ -357304,15 +357705,15 @@ function readLeafControl(xml, kind, namespaces) {
|
|
|
357304
357705
|
stack.push(range);
|
|
357305
357706
|
}
|
|
357306
357707
|
const children2 = ranges.filter((range) => parents.get(range) === root);
|
|
357307
|
-
const properties = children2.filter(({ tag }) => tag.namespaceUri ===
|
|
357308
|
-
const contents = children2.filter(({ tag }) => tag.namespaceUri ===
|
|
357708
|
+
const properties = children2.filter(({ tag }) => tag.namespaceUri === W19 && tag.localName === "sdtPr");
|
|
357709
|
+
const contents = children2.filter(({ tag }) => tag.namespaceUri === W19 && tag.localName === "sdtContent");
|
|
357309
357710
|
if (properties.length !== 1 || contents.length !== 1 || kind === "block" && contents[0].tag.isSelfClosing)
|
|
357310
357711
|
return null;
|
|
357311
|
-
const ids = ranges.filter((range) => parents.get(range) === properties[0] && range.tag.namespaceUri ===
|
|
357312
|
-
const id = ids.length === 1 ? ids[0].tag.attributes.find((attribute2) => attribute2.namespaceUri ===
|
|
357712
|
+
const ids = ranges.filter((range) => parents.get(range) === properties[0] && range.tag.namespaceUri === W19 && range.tag.localName === "id");
|
|
357713
|
+
const id = ids.length === 1 ? ids[0].tag.attributes.find((attribute2) => attribute2.namespaceUri === W19 && attribute2.localName === "val")?.value : undefined;
|
|
357313
357714
|
if (id === undefined || !/^-?\d+$/.test(id) || !Number.isSafeInteger(Number(id)))
|
|
357314
357715
|
return null;
|
|
357315
|
-
if (ranges.some((range) => range !== root && range.tag.namespaceUri ===
|
|
357716
|
+
if (ranges.some((range) => range !== root && range.tag.namespaceUri === W19 && ([
|
|
357316
357717
|
"sdt",
|
|
357317
357718
|
"ins",
|
|
357318
357719
|
"del",
|
|
@@ -357337,7 +357738,7 @@ function readLeafControl(xml, kind, namespaces) {
|
|
|
357337
357738
|
return null;
|
|
357338
357739
|
return { xml, content: contents[0], id };
|
|
357339
357740
|
}
|
|
357340
|
-
var
|
|
357741
|
+
var W19 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
357341
357742
|
var init_tracked_move = __esm(() => {
|
|
357342
357743
|
init_sd_document_session_internal();
|
|
357343
357744
|
init_shared();
|
|
@@ -357368,7 +357769,7 @@ function prepareStructuralSdtReplacement(context, fragment4) {
|
|
|
357368
357769
|
if (lowered.plan.assets?.length)
|
|
357369
357770
|
throw new DocumentApiValidationError2("CAPABILITY_UNSUPPORTED", "Structural SDT replacement cannot import package assets.");
|
|
357370
357771
|
const styleBytes = readStyleDefinitionsPartBytes(context);
|
|
357371
|
-
const styles = new Set(collectXmlElementRanges(styleBytes ? new TextDecoder().decode(styleBytes) : "").ranges.filter((range) => range.tag.namespaceUri ===
|
|
357772
|
+
const styles = new Set(collectXmlElementRanges(styleBytes ? new TextDecoder().decode(styleBytes) : "").ranges.filter((range) => range.tag.namespaceUri === W20 && range.tag.localName === "style").flatMap((range) => range.tag.attributes.filter((attr4) => attr4.namespaceUri === W20 && attr4.localName === "styleId").map((attr4) => attr4.value)));
|
|
357372
357773
|
const allocate = createParaIdAllocator(context);
|
|
357373
357774
|
const contentXml = lowered.plan.blocks.map((block) => {
|
|
357374
357775
|
if (block.kind !== "paragraph" || block.numbering || block.listIntent || block.semanticStyleRole) {
|
|
@@ -357399,7 +357800,7 @@ function prepareStructuralSdtReplacement(context, fragment4) {
|
|
|
357399
357800
|
lockMode: sdt.lock === undefined ? "unlocked" : locks[sdt.lock]
|
|
357400
357801
|
}, contentXml };
|
|
357401
357802
|
}
|
|
357402
|
-
var
|
|
357803
|
+
var W20 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
357403
357804
|
var init_structural_replacement = __esm(() => {
|
|
357404
357805
|
init_src3();
|
|
357405
357806
|
init_sd_document_session_internal();
|
|
@@ -361658,10 +362059,10 @@ function prepareTrackedCaptionPrecedingBoundary(input) {
|
|
|
361658
362059
|
return null;
|
|
361659
362060
|
const ranges = parsed.ranges.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
361660
362061
|
const paragraph4 = ranges[0];
|
|
361661
|
-
if (!paragraph4 || paragraph4.start !== 0 || paragraph4.end !== input.beforeXml.length || paragraph4.tag.namespaceUri !==
|
|
362062
|
+
if (!paragraph4 || paragraph4.start !== 0 || paragraph4.end !== input.beforeXml.length || paragraph4.tag.namespaceUri !== W21 || paragraph4.tag.localName !== "p")
|
|
361662
362063
|
return null;
|
|
361663
|
-
const properties = ranges[1]?.tag.namespaceUri ===
|
|
361664
|
-
if (properties && ranges.some((range) => range.start > properties.start && range.end < properties.end && range.tag.namespaceUri ===
|
|
362064
|
+
const properties = ranges[1]?.tag.namespaceUri === W21 && ranges[1]?.tag.localName === "pPr" ? ranges[1] : undefined;
|
|
362065
|
+
if (properties && ranges.some((range) => range.start > properties.start && range.end < properties.end && range.tag.namespaceUri === W21 && ["ins", "del", "moveFrom", "moveTo", "pPrChange", "rPrChange", "sectPr"].includes(range.tag.localName)))
|
|
361665
362066
|
return null;
|
|
361666
362067
|
const open2 = input.beforeXml.slice(0, paragraph4.openEnd).replace(/\/>$/, ">");
|
|
361667
362068
|
const close = `</${paragraph4.tag.name}>`;
|
|
@@ -361687,9 +362088,9 @@ function prepareTrackedCaptionParagraph(input) {
|
|
|
361687
362088
|
return null;
|
|
361688
362089
|
const ranges = parsed.ranges.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
361689
362090
|
const paragraph4 = ranges[0];
|
|
361690
|
-
if (!paragraph4 || paragraph4.start !== 0 || paragraph4.end !== xml.length || paragraph4.tag.namespaceUri !==
|
|
362091
|
+
if (!paragraph4 || paragraph4.start !== 0 || paragraph4.end !== xml.length || paragraph4.tag.namespaceUri !== W21 || paragraph4.tag.localName !== "p")
|
|
361691
362092
|
return null;
|
|
361692
|
-
if (ranges.some((range) => range.tag.namespaceUri ===
|
|
362093
|
+
if (ranges.some((range) => range.tag.namespaceUri === W21 && ["ins", "del", "moveFrom", "moveTo", "pPrChange", "rPrChange", "sectPr"].includes(range.tag.localName)))
|
|
361693
362094
|
return null;
|
|
361694
362095
|
const children2 = [];
|
|
361695
362096
|
let cursor2 = paragraph4.openEnd;
|
|
@@ -361703,7 +362104,7 @@ function prepareTrackedCaptionParagraph(input) {
|
|
|
361703
362104
|
}
|
|
361704
362105
|
if (!paragraph4.tag.isSelfClosing && xml.slice(cursor2, paragraph4.closeStart).trim())
|
|
361705
362106
|
return null;
|
|
361706
|
-
const properties2 = children2[0]?.tag.namespaceUri ===
|
|
362107
|
+
const properties2 = children2[0]?.tag.namespaceUri === W21 && children2[0]?.tag.localName === "pPr" ? children2.shift() : undefined;
|
|
361707
362108
|
return {
|
|
361708
362109
|
paragraph: paragraph4,
|
|
361709
362110
|
children: children2,
|
|
@@ -361753,7 +362154,7 @@ function prepareTrackedCaptionParagraph(input) {
|
|
|
361753
362154
|
return true;
|
|
361754
362155
|
};
|
|
361755
362156
|
for (const child of before.children) {
|
|
361756
|
-
if (child.tag.namespaceUri !==
|
|
362157
|
+
if (child.tag.namespaceUri !== W21 || child.tag.localName !== "fldSimple")
|
|
361757
362158
|
continue;
|
|
361758
362159
|
if (!appendDeletedRuns(child.start))
|
|
361759
362160
|
return null;
|
|
@@ -361797,7 +362198,7 @@ function prepareTrackedCaptionParagraph(input) {
|
|
|
361797
362198
|
}
|
|
361798
362199
|
return { xml: open2 + properties + content3 + close, wordIds };
|
|
361799
362200
|
}
|
|
361800
|
-
var
|
|
362201
|
+
var W21 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
361801
362202
|
var init_tracked_paragraph = __esm(() => {
|
|
361802
362203
|
init_sd_document_session_internal();
|
|
361803
362204
|
});
|
|
@@ -362576,14 +362977,14 @@ function removeToc(context, field, options) {
|
|
|
362576
362977
|
ancestors.push(range);
|
|
362577
362978
|
}
|
|
362578
362979
|
const parentOf2 = (range) => parents.get(range);
|
|
362579
|
-
const isWord2 = (range, localName2) => range?.tag.namespaceUri ===
|
|
362980
|
+
const isWord2 = (range, localName2) => range?.tag.namespaceUri === W22 && range.tag.localName === localName2;
|
|
362580
362981
|
const child = (range, localName2) => range && ranges.find((candidate2) => isWord2(candidate2, localName2) && parentOf2(candidate2) === range);
|
|
362581
362982
|
const start = new TextDecoder().decode(bytes.subarray(0, field.descriptor.byteStart)).length;
|
|
362582
362983
|
const end = new TextDecoder().decode(bytes.subarray(0, field.descriptor.byteEnd)).length;
|
|
362583
362984
|
const enclosing = ranges.filter((range) => range.start < start && range.end >= end);
|
|
362584
362985
|
const control2 = enclosing.filter((range) => isWord2(range, "sdt")).at(-1);
|
|
362585
362986
|
const gallery = child(child(child(control2, "sdtPr"), "docPartObj"), "docPartGallery");
|
|
362586
|
-
const ownsToc = gallery?.tag.attributes.some((attribute2) => attribute2.namespaceUri ===
|
|
362987
|
+
const ownsToc = gallery?.tag.attributes.some((attribute2) => attribute2.namespaceUri === W22 && attribute2.localName === "val" && attribute2.value === "Table of Contents");
|
|
362587
362988
|
if (ownsToc && control2) {
|
|
362588
362989
|
const content3 = child(control2, "sdtContent");
|
|
362589
362990
|
if (!content3 || content3.openEnd > start || content3.closeStart < end || !isWord2(parentOf2(control2), "body"))
|
|
@@ -362701,7 +363102,7 @@ function removeToc(context, field, options) {
|
|
|
362701
363102
|
return { ok: true };
|
|
362702
363103
|
return deleteParagraph(context, paragraph4, "toc-remove");
|
|
362703
363104
|
}
|
|
362704
|
-
var
|
|
363105
|
+
var W22 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
362705
363106
|
var init_removal = __esm(() => {
|
|
362706
363107
|
init_sd_document_session_internal();
|
|
362707
363108
|
init_deletion_locks();
|
|
@@ -366173,11 +366574,11 @@ function readTrackedChangeFragmentResolveSession(context) {
|
|
|
366173
366574
|
}
|
|
366174
366575
|
function decodeTrackedChangePartXml(partBytes, partUri, resolveSession) {
|
|
366175
366576
|
if (!resolveSession)
|
|
366176
|
-
return
|
|
366577
|
+
return TD104.decode(partBytes);
|
|
366177
366578
|
const cached2 = resolveSession.partXmlByUri.get(partUri);
|
|
366178
366579
|
if (cached2 !== undefined)
|
|
366179
366580
|
return cached2;
|
|
366180
|
-
const xml =
|
|
366581
|
+
const xml = TD104.decode(partBytes);
|
|
366181
366582
|
resolveSession.partXmlByUri.set(partUri, xml);
|
|
366182
366583
|
return xml;
|
|
366183
366584
|
}
|
|
@@ -366308,13 +366709,13 @@ function resolveParagraphLocalFragment(partBytes, paragraph4, fragment4, resolve
|
|
|
366308
366709
|
const cacheKey = `${paragraph4.partUri}\x00${paragraph4.byteStart}\x00${paragraph4.byteEnd}`;
|
|
366309
366710
|
let paragraphXml = resolveSession?.paragraphXmlByKey.get(cacheKey);
|
|
366310
366711
|
if (paragraphXml === undefined) {
|
|
366311
|
-
paragraphXml =
|
|
366712
|
+
paragraphXml = TD104.decode(partBytes.subarray(paragraph4.byteStart, paragraph4.byteEnd));
|
|
366312
366713
|
resolveSession?.paragraphXmlByKey.set(cacheKey, paragraphXml);
|
|
366313
366714
|
}
|
|
366314
366715
|
const localSourceStart = sourceStart - paragraph4.byteStart;
|
|
366315
366716
|
const localSourceEnd = sourceEnd - paragraph4.byteStart;
|
|
366316
|
-
const fragmentStart =
|
|
366317
|
-
const fragmentEnd = fragmentStart +
|
|
366717
|
+
const fragmentStart = TD104.decode(partBytes.subarray(paragraph4.byteStart, sourceStart)).length;
|
|
366718
|
+
const fragmentEnd = fragmentStart + TD104.decode(partBytes.subarray(sourceStart, sourceEnd)).length;
|
|
366318
366719
|
if (localSourceStart < 0 || localSourceEnd > paragraph4.byteEnd - paragraph4.byteStart || fragmentStart < 0 || fragmentEnd > paragraphXml.length)
|
|
366319
366720
|
return null;
|
|
366320
366721
|
return { paragraphXml, fragmentStart, fragmentEnd };
|
|
@@ -366589,16 +366990,16 @@ function decodeXmlText11(value2) {
|
|
|
366589
366990
|
function fail5(code2, message) {
|
|
366590
366991
|
return { ok: false, code: code2, message };
|
|
366591
366992
|
}
|
|
366592
|
-
var
|
|
366993
|
+
var TD104, currentResolveSessionByDocument;
|
|
366593
366994
|
var init_fragment_target = __esm(() => {
|
|
366594
366995
|
init_sd_document_session_internal();
|
|
366595
|
-
|
|
366996
|
+
TD104 = new TextDecoder;
|
|
366596
366997
|
currentResolveSessionByDocument = new WeakMap;
|
|
366597
366998
|
});
|
|
366598
366999
|
|
|
366599
367000
|
// ../../../v2/document-api-v2-adapter/dist/tracked-changes/range-resolver.js
|
|
366600
367001
|
function scanParagraphFragments(paragraph4, partBytes, catalogFragments) {
|
|
366601
|
-
const paragraphXml =
|
|
367002
|
+
const paragraphXml = TD105.decode(partBytes.subarray(paragraph4.byteStart, paragraph4.byteEnd));
|
|
366602
367003
|
const inside = catalogFragments.filter((f) => f.sourceByteStart >= paragraph4.byteStart && f.sourceByteEnd <= paragraph4.byteEnd).sort((a, b) => a.sourceByteStart - b.sourceByteStart);
|
|
366603
367004
|
const map3 = parseParagraphInlineMap(paragraphXml);
|
|
366604
367005
|
const scanEntries = inside.map((fragment4) => {
|
|
@@ -366758,10 +367159,10 @@ function normalizeNestedOverlaps(overlapsByFragment, rangeByFragment) {
|
|
|
366758
367159
|
function fragmentKey(fragment4) {
|
|
366759
367160
|
return `${fragment4.partUri}|${fragment4.byteStart}|${fragment4.byteEnd}`;
|
|
366760
367161
|
}
|
|
366761
|
-
var
|
|
367162
|
+
var TD105;
|
|
366762
367163
|
var init_range_resolver = __esm(() => {
|
|
366763
367164
|
init_sd_document_session_internal();
|
|
366764
|
-
|
|
367165
|
+
TD105 = new TextDecoder;
|
|
366765
367166
|
});
|
|
366766
367167
|
|
|
366767
367168
|
// ../../../v2/document-api-v2-adapter/dist/comments/comment-id-resolution.js
|
|
@@ -369834,7 +370235,7 @@ function mergeInvalidatedRefs(primary, cascade) {
|
|
|
369834
370235
|
const seen = new Set;
|
|
369835
370236
|
const out = [];
|
|
369836
370237
|
const push2 = (ref5) => {
|
|
369837
|
-
const key2 = `${ref5.kind}|${ref5.entityId ?? ref5.commentId ?? ""}|${ref5.storyId ?? ""}`;
|
|
370238
|
+
const key2 = `${ref5.kind}|${ref5.entityId ?? ref5.commentId ?? ref5.nodeId ?? ""}|${ref5.storyId ?? ""}`;
|
|
369838
370239
|
if (seen.has(key2))
|
|
369839
370240
|
return;
|
|
369840
370241
|
seen.add(key2);
|
|
@@ -370369,7 +370770,7 @@ function extractStructuralCellTexts(xml, side) {
|
|
|
370369
370770
|
}
|
|
370370
370771
|
function extractStructuralText(xml, side) {
|
|
370371
370772
|
const readText = side === "deleted" ? extractTrackedTextFromXml : extractVisibleTextFromXml;
|
|
370372
|
-
const paragraphs = scanParagraphXmlSpans({ bytes:
|
|
370773
|
+
const paragraphs = scanParagraphXmlSpans({ bytes: TEXT_ENCODER4.encode(xml) });
|
|
370373
370774
|
if (paragraphs.length === 0)
|
|
370374
370775
|
return readText(xml);
|
|
370375
370776
|
return paragraphs.map((paragraph4) => readText(paragraph4.xml).trim()).filter(Boolean).join(`
|
|
@@ -370968,8 +371369,8 @@ function structuralFieldSemanticSubtype(entry, context, resolveSession) {
|
|
|
370968
371369
|
if (!partBytes)
|
|
370969
371370
|
return null;
|
|
370970
371371
|
const partXml = decodeTrackedChangePartXml(partBytes, entry.partUri, resolveSession);
|
|
370971
|
-
const entryByteStart =
|
|
370972
|
-
const entryByteEnd =
|
|
371372
|
+
const entryByteStart = TEXT_ENCODER4.encode(partXml.slice(0, entry.documentOrderStart)).byteLength;
|
|
371373
|
+
const entryByteEnd = TEXT_ENCODER4.encode(partXml.slice(0, entry.documentOrderEnd)).byteLength;
|
|
370973
371374
|
const fields = catalog.fields.filter((candidate2) => candidate2.complete && candidate2.byteStart >= entryByteStart && candidate2.byteEnd <= entryByteEnd);
|
|
370974
371375
|
const field = fields.length === 1 ? fields[0] : undefined;
|
|
370975
371376
|
const subtype = field && field.classification !== "unknown" ? field.classification : null;
|
|
@@ -371333,7 +371734,7 @@ function createSuccessorRsidAllocator(raw) {
|
|
|
371333
371734
|
return counter.toString(16).toUpperCase().padStart(8, "0");
|
|
371334
371735
|
};
|
|
371335
371736
|
}
|
|
371336
|
-
var resolvedTrackedChangeIdsBySession,
|
|
371737
|
+
var resolvedTrackedChangeIdsBySession, TEXT_ENCODER4, EMUS_PER_CSS_PIXEL = 9525, BROWSER_RENDERABLE_IMAGE_CONTENT_TYPES, DocumentApiAdapterError, STRUCTURAL_DESCRIPTOR_OPERATIONS, logicalSourceAliasIndexes;
|
|
371337
371738
|
var init_adapter15 = __esm(() => {
|
|
371338
371739
|
init_review_read_model();
|
|
371339
371740
|
init_review_read_model();
|
|
@@ -371350,7 +371751,7 @@ var init_adapter15 = __esm(() => {
|
|
|
371350
371751
|
init_logical_view_cache();
|
|
371351
371752
|
init_local_text_projection();
|
|
371352
371753
|
resolvedTrackedChangeIdsBySession = new WeakMap;
|
|
371353
|
-
|
|
371754
|
+
TEXT_ENCODER4 = new TextEncoder;
|
|
371354
371755
|
BROWSER_RENDERABLE_IMAGE_CONTENT_TYPES = new Map([
|
|
371355
371756
|
["png", "image/png"],
|
|
371356
371757
|
["jpg", "image/jpeg"],
|
|
@@ -371406,14 +371807,14 @@ function prepareTrackedListSequenceEdits(context, edits, dryRun) {
|
|
|
371406
371807
|
fragment: true,
|
|
371407
371808
|
additionalNamespaces: Object.fromEntries(edit.namespaceBindings)
|
|
371408
371809
|
});
|
|
371409
|
-
const properties = parsed.ranges.filter((range) => range.tag.namespaceUri ===
|
|
371410
|
-
const change = parsed.ranges.find((range) => range.tag.namespaceUri ===
|
|
371411
|
-
const id = change?.tag.attributes.find((attribute2) => attribute2.namespaceUri ===
|
|
371810
|
+
const properties = parsed.ranges.filter((range) => range.tag.namespaceUri === W23 && range.tag.localName === "pPr").sort((left, right) => left.start - right.start)[0];
|
|
371811
|
+
const change = parsed.ranges.find((range) => range.tag.namespaceUri === W23 && range.tag.localName === "pPrChange");
|
|
371812
|
+
const id = change?.tag.attributes.find((attribute2) => attribute2.namespaceUri === W23 && attribute2.localName === "id")?.value;
|
|
371412
371813
|
if (parsed.errors.length || !properties || id === undefined)
|
|
371413
371814
|
return null;
|
|
371414
371815
|
const wordIds2 = [id];
|
|
371415
371816
|
if (edit.insertedMarker) {
|
|
371416
|
-
const prefix = [...edit.namespaceBindings].find(([name, uri]) => name && uri ===
|
|
371817
|
+
const prefix = [...edit.namespaceBindings].find(([name, uri]) => name && uri === W23)?.[0];
|
|
371417
371818
|
if (!prefix)
|
|
371418
371819
|
return null;
|
|
371419
371820
|
const insertion = prepareTrackedInlineXmlReplacement({
|
|
@@ -371452,7 +371853,7 @@ function prepareTrackedListSequenceEdits(context, edits, dryRun) {
|
|
|
371452
371853
|
}
|
|
371453
371854
|
return { ok: true, edits: replacements, wordIds: [...new Set(wordIds)] };
|
|
371454
371855
|
}
|
|
371455
|
-
var
|
|
371856
|
+
var W23 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
371456
371857
|
var init_tracked_sequence_edits = __esm(() => {
|
|
371457
371858
|
init_sd_document_session_internal();
|
|
371458
371859
|
init_common();
|
|
@@ -371650,7 +372051,7 @@ function deleteListSequence(input) {
|
|
|
371650
372051
|
const author = input.context.readAuthor();
|
|
371651
372052
|
if (!author?.name)
|
|
371652
372053
|
return { ok: false, code: "PRECONDITION_FAILED", message: "Tracked list deletion requires an author." };
|
|
371653
|
-
const parsed = collectXmlElementRanges(
|
|
372054
|
+
const parsed = collectXmlElementRanges(TD106.decode(runtime.value.partBytes));
|
|
371654
372055
|
if (parsed.errors.length)
|
|
371655
372056
|
return { ok: false, code: "PRECONDITION_FAILED", message: "List part XML is malformed." };
|
|
371656
372057
|
const date6 = new Date().toISOString();
|
|
@@ -372032,7 +372433,7 @@ function numberingInstanceIsOwnedByRun(runtime, run) {
|
|
|
372032
372433
|
const bytes = getSDDocumentSessionInternalPartBytes(runtime.context.session, partUri);
|
|
372033
372434
|
if (!bytes)
|
|
372034
372435
|
return false;
|
|
372035
|
-
const xml =
|
|
372436
|
+
const xml = TD106.decode(bytes);
|
|
372036
372437
|
if (!xml.includes("numId"))
|
|
372037
372438
|
continue;
|
|
372038
372439
|
const parsed = collectXmlElementRanges(xml);
|
|
@@ -372585,7 +372986,7 @@ function commitTrackedDefinitionMutation(runtime, abstractNumId, txIdPrefix, mut
|
|
|
372585
372986
|
const bytes = getSDDocumentSessionInternalPartBytes(runtime.context.session, partUri);
|
|
372586
372987
|
if (!bytes)
|
|
372587
372988
|
return { ok: false, code: "PRECONDITION_FAILED", message: `Cannot inspect numbering ownership in ${partUri}.` };
|
|
372588
|
-
const xml =
|
|
372989
|
+
const xml = TD106.decode(bytes);
|
|
372589
372990
|
if (!xml.includes("numId"))
|
|
372590
372991
|
continue;
|
|
372591
372992
|
const parsed = collectXmlElementRanges(xml);
|
|
@@ -372597,8 +372998,8 @@ function commitTrackedDefinitionMutation(runtime, abstractNumId, txIdPrefix, mut
|
|
|
372597
372998
|
const id = reference.tag.attributes.find((attr4) => attr4.namespaceUri === WORDPROCESSINGML_NAMESPACE7 && attr4.localName === "val")?.value;
|
|
372598
372999
|
if (!id || !numIds.has(id))
|
|
372599
373000
|
continue;
|
|
372600
|
-
const startByte =
|
|
372601
|
-
const endByte =
|
|
373001
|
+
const startByte = TE59.encode(xml.slice(0, reference.start)).length;
|
|
373002
|
+
const endByte = TE59.encode(xml.slice(0, reference.end)).length;
|
|
372602
373003
|
if (!owners.some((owner) => owner.runtime.partUri === partUri && owner.paragraph.byteStart < startByte && owner.paragraph.byteEnd > endByte)) {
|
|
372603
373004
|
return { ok: false, code: "CAPABILITY_UNAVAILABLE", message: "Tracked shared numbering has an owner outside the editable paragraph stories." };
|
|
372604
373005
|
}
|
|
@@ -372641,7 +373042,7 @@ function commitTrackedDefinitionMutation(runtime, abstractNumId, txIdPrefix, mut
|
|
|
372641
373042
|
...[...byPart.values()].map((group) => ({
|
|
372642
373043
|
partUri: group.runtime.partUri,
|
|
372643
373044
|
currentBytes: group.runtime.partBytes,
|
|
372644
|
-
nextXml:
|
|
373045
|
+
nextXml: TD106.decode(applyParagraphEdits(group.runtime.partBytes, group.paragraphs, group.edits)),
|
|
372645
373046
|
affectsStoryIndex: true
|
|
372646
373047
|
})),
|
|
372647
373048
|
{ partUri: NUMBERING_PART_URI5, nextXml: serializeNumberingDocument(mutate(versionedNumbering, version2.value.abstractNumId)), affectsStoryIndex: false }
|
|
@@ -372730,7 +373131,7 @@ function loadTargetListRunRuntime(context, storyId, paraId) {
|
|
|
372730
373131
|
styleId: null,
|
|
372731
373132
|
numId: state.numId,
|
|
372732
373133
|
ilvl: state.ilvl,
|
|
372733
|
-
rawXml:
|
|
373134
|
+
rawXml: TD106.decode(partBytes.subarray(entry.byteStart, entry.byteEnd)),
|
|
372734
373135
|
ilvlValue: state.ilvl,
|
|
372735
373136
|
definitionNumId: state.definitionNumId,
|
|
372736
373137
|
effectiveAbstractNumId: state.abstractNumId,
|
|
@@ -372951,7 +373352,7 @@ function commitRuntimeMutation(input) {
|
|
|
372951
373352
|
const nextBytes = applyParagraphEdits(input.runtime.partBytes, input.runtime.paragraphs, input.documentEdits);
|
|
372952
373353
|
rewrites.push({
|
|
372953
373354
|
partUri: input.runtime.partUri,
|
|
372954
|
-
nextXml:
|
|
373355
|
+
nextXml: TD106.decode(nextBytes),
|
|
372955
373356
|
currentBytes: input.runtime.partBytes,
|
|
372956
373357
|
affectsStoryIndex: true
|
|
372957
373358
|
});
|
|
@@ -373009,7 +373410,7 @@ function commitLocalizedRuntimeMutation(input) {
|
|
|
373009
373410
|
paraId: edit.paraId,
|
|
373010
373411
|
startByte: paragraph4.byteStart,
|
|
373011
373412
|
endByte: paragraph4.byteEnd,
|
|
373012
|
-
bytes: edit.replacementXml === null ? new Uint8Array :
|
|
373413
|
+
bytes: edit.replacementXml === null ? new Uint8Array : TE59.encode(edit.replacementXml)
|
|
373013
373414
|
};
|
|
373014
373415
|
}).filter((row) => row !== null).sort((left, right) => left.startByte - right.startByte);
|
|
373015
373416
|
if (patchRows.length !== input.documentEdits.length || patchRows.length === 0) {
|
|
@@ -373056,7 +373457,7 @@ function commitLocalizedRuntimeMutation(input) {
|
|
|
373056
373457
|
order: 0,
|
|
373057
373458
|
startByte: 0,
|
|
373058
373459
|
endByte: currentBytes.length,
|
|
373059
|
-
bytes:
|
|
373460
|
+
bytes: TE59.encode(serializeNumberingDocument(input.nextNumbering))
|
|
373060
373461
|
}]
|
|
373061
373462
|
};
|
|
373062
373463
|
}
|
|
@@ -373109,7 +373510,7 @@ function applyParagraphEdits(currentBytes, paragraphs, edits) {
|
|
|
373109
373510
|
return {
|
|
373110
373511
|
startByte: paragraph4.byteStart,
|
|
373111
373512
|
endByte: paragraph4.byteEnd,
|
|
373112
|
-
bytes: edit.replacementXml === null ? new Uint8Array :
|
|
373513
|
+
bytes: edit.replacementXml === null ? new Uint8Array : TE59.encode(edit.replacementXml)
|
|
373113
373514
|
};
|
|
373114
373515
|
}).filter((entry) => entry !== null).sort((left, right) => left.startByte - right.startByte);
|
|
373115
373516
|
const chunks = [];
|
|
@@ -373666,7 +374067,7 @@ function escapeForRegex2(value2) {
|
|
|
373666
374067
|
function createEmptyLevelXml(level, prefix = "w") {
|
|
373667
374068
|
return `<${prefix}:lvl w:ilvl="${level}"></${prefix}:lvl>`;
|
|
373668
374069
|
}
|
|
373669
|
-
var NUMBERING_PART_URI5 = "/word/numbering.xml", WORDPROCESSINGML_NAMESPACE7 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
374070
|
+
var NUMBERING_PART_URI5 = "/word/numbering.xml", WORDPROCESSINGML_NAMESPACE7 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TE59, TD106;
|
|
373670
374071
|
var init_runtime3 = __esm(() => {
|
|
373671
374072
|
init_src3();
|
|
373672
374073
|
init_sd_document_session_internal();
|
|
@@ -373676,8 +374077,8 @@ var init_runtime3 = __esm(() => {
|
|
|
373676
374077
|
init_xml();
|
|
373677
374078
|
init_xml_rewrite();
|
|
373678
374079
|
init_tracked_sequence_edits();
|
|
373679
|
-
|
|
373680
|
-
|
|
374080
|
+
TE59 = new TextEncoder;
|
|
374081
|
+
TD106 = new TextDecoder;
|
|
373681
374082
|
});
|
|
373682
374083
|
|
|
373683
374084
|
// ../../../v2/document-api-v2-adapter/dist/lists/adapter.js
|
|
@@ -376490,7 +376891,7 @@ class V2ParagraphsAdapter {
|
|
|
376490
376891
|
const bytes = getSDDocumentSessionInternalPartBytes(this.context.session, snapshot2.partUri);
|
|
376491
376892
|
if (!bytes)
|
|
376492
376893
|
return fail6("PRECONDITION_FAILED", `Part bytes are unavailable for ${snapshot2.partUri}.`);
|
|
376493
|
-
const start =
|
|
376894
|
+
const start = TD107.decode(bytes.subarray(0, snapshot2.byteStart)).length;
|
|
376494
376895
|
if (!documentProtectionAllowsXmlRange(this.context, snapshot2.partUri, start, start + snapshot2.rawXml.length)) {
|
|
376495
376896
|
return fail6("PERMISSION_DENIED", DOCUMENT_PROTECTION_MESSAGE);
|
|
376496
376897
|
}
|
|
@@ -377056,12 +377457,12 @@ function storyErrorMessage3(error48) {
|
|
|
377056
377457
|
}
|
|
377057
377458
|
}
|
|
377058
377459
|
function splicePartBytes(bytes, start, end, replacementXml) {
|
|
377059
|
-
const replacement =
|
|
377460
|
+
const replacement = TE60.encode(replacementXml);
|
|
377060
377461
|
const next = new Uint8Array(start + replacement.length + (bytes.length - end));
|
|
377061
377462
|
next.set(bytes.subarray(0, start), 0);
|
|
377062
377463
|
next.set(replacement, start);
|
|
377063
377464
|
next.set(bytes.subarray(end), start + replacement.length);
|
|
377064
|
-
return
|
|
377465
|
+
return TD107.decode(next);
|
|
377065
377466
|
}
|
|
377066
377467
|
function readExplicitParagraphStyleId(paragraphXml) {
|
|
377067
377468
|
const pPrMatch = /<w:pPr\b[\s\S]*?<\/w:pPr>/.exec(paragraphXml);
|
|
@@ -377159,7 +377560,7 @@ function txIdPrefixToOperation(prefix) {
|
|
|
377159
377560
|
return prefix;
|
|
377160
377561
|
}
|
|
377161
377562
|
}
|
|
377162
|
-
var
|
|
377563
|
+
var TD107, TE60;
|
|
377163
377564
|
var init_adapter17 = __esm(() => {
|
|
377164
377565
|
init_sd_document_session_internal();
|
|
377165
377566
|
init_src6();
|
|
@@ -377179,8 +377580,8 @@ var init_adapter17 = __esm(() => {
|
|
|
377179
377580
|
init_text_range_shifts();
|
|
377180
377581
|
init_adapter5();
|
|
377181
377582
|
init_mutation_guard();
|
|
377182
|
-
|
|
377183
|
-
|
|
377583
|
+
TD107 = new TextDecoder;
|
|
377584
|
+
TE60 = new TextEncoder;
|
|
377184
377585
|
});
|
|
377185
377586
|
|
|
377186
377587
|
// ../../../v2/document-api-v2-adapter/dist/header-footers/page-numbers.js
|
|
@@ -388374,7 +388775,7 @@ function readCurrentCaptionStyles(xml) {
|
|
|
388374
388775
|
}
|
|
388375
388776
|
stack.push(range);
|
|
388376
388777
|
}
|
|
388377
|
-
const native4 = (range, name) => range.tag.namespaceUri ===
|
|
388778
|
+
const native4 = (range, name) => range.tag.namespaceUri === W24 && range.tag.localName === name;
|
|
388378
388779
|
for (const paragraph4 of ranges.filter((range) => native4(range, "p"))) {
|
|
388379
388780
|
const content3 = children2.get(paragraph4) ?? [];
|
|
388380
388781
|
const properties = content3.find((range) => native4(range, "pPr"));
|
|
@@ -388386,11 +388787,11 @@ function readCurrentCaptionStyles(xml) {
|
|
|
388386
388787
|
continue;
|
|
388387
388788
|
}
|
|
388388
388789
|
const style = propertyChildren.find((range) => native4(range, "pStyle"));
|
|
388389
|
-
result.set(paragraph4.start, style?.tag.attributes.find((attribute2) => attribute2.namespaceUri ===
|
|
388790
|
+
result.set(paragraph4.start, style?.tag.attributes.find((attribute2) => attribute2.namespaceUri === W24 && attribute2.localName === "val")?.value ?? null);
|
|
388390
388791
|
}
|
|
388391
388792
|
return result;
|
|
388392
388793
|
}
|
|
388393
|
-
var
|
|
388794
|
+
var W24 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
388394
388795
|
var init_caption_style = __esm(() => {
|
|
388395
388796
|
init_sd_document_session_internal();
|
|
388396
388797
|
});
|
|
@@ -388496,7 +388897,7 @@ function prepareImageReadContext(context) {
|
|
|
388496
388897
|
}
|
|
388497
388898
|
function readImageCatalogEntries(context, readContext, source) {
|
|
388498
388899
|
const { storyId, partUri, catalog, partBytes } = source;
|
|
388499
|
-
const partXml =
|
|
388900
|
+
const partXml = TD108.decode(partBytes);
|
|
388500
388901
|
const trackedWrappers = resolveTrackedWrappersForImageOffsets(partXml, catalog.images.map((descriptor) => descriptor.byteStart), leadingUtf8BomLength6(partBytes)).wrappers;
|
|
388501
388902
|
const relsUri = relsPartUriForPart(partUri);
|
|
388502
388903
|
const relsXml = relsUri ? readPartXml2(context, relsUri) ?? "" : "";
|
|
@@ -388517,7 +388918,7 @@ function readImageCatalogEntries(context, readContext, source) {
|
|
|
388517
388918
|
}
|
|
388518
388919
|
async function readImageCatalogEntriesCooperatively(context, readContext, source, checkpoint) {
|
|
388519
388920
|
const { storyId, partUri, catalog, partBytes } = source;
|
|
388520
|
-
const partXml =
|
|
388921
|
+
const partXml = TD108.decode(partBytes);
|
|
388521
388922
|
if (!await checkpoint())
|
|
388522
388923
|
return null;
|
|
388523
388924
|
const trackedWrappers = resolveTrackedWrappersForImageOffsets(partXml, catalog.images.map((descriptor) => descriptor.byteStart), leadingUtf8BomLength6(partBytes)).wrappers;
|
|
@@ -388558,7 +388959,7 @@ async function readImageCatalogEntriesCooperatively(context, readContext, source
|
|
|
388558
388959
|
function readImageCatalogCandidate(partBytes, descriptor, wrapper) {
|
|
388559
388960
|
if (wrapper?.kind === "del" || wrapper?.kind === "moveFrom")
|
|
388560
388961
|
return null;
|
|
388561
|
-
const drawingXml =
|
|
388962
|
+
const drawingXml = TD108.decode(partBytes.subarray(descriptor.byteStart, descriptor.byteEnd));
|
|
388562
388963
|
return descriptor.isPicture ? { descriptor, wrapper, drawingXml } : null;
|
|
388563
388964
|
}
|
|
388564
388965
|
function readImageParagraph(context, readContext, storyId, paraId) {
|
|
@@ -388697,7 +389098,7 @@ function readStructuredImageMutationEntry(context, imageId) {
|
|
|
388697
389098
|
const partBytes = getSDDocumentSessionInternalPartBytes(context.session, partUri);
|
|
388698
389099
|
if (!partBytes)
|
|
388699
389100
|
return null;
|
|
388700
|
-
const partXml =
|
|
389101
|
+
const partXml = TD108.decode(partBytes);
|
|
388701
389102
|
const relsUri = relsPartUriForPart(partUri);
|
|
388702
389103
|
const hyperlinkTargets = parseExternalTargets2(relsUri ? readPartXml2(context, relsUri) ?? "" : "");
|
|
388703
389104
|
const rawEntries = [];
|
|
@@ -388741,11 +389142,11 @@ function findStructuredImageDrawings(partXml, identity2) {
|
|
|
388741
389142
|
const relationshipId = /\br:embed="([^"]+)"/.exec(drawing.xml)?.[1] ?? null;
|
|
388742
389143
|
if (!relationshipId || normalizeImageIdComponent(relationshipId) !== identity2.relationshipScope)
|
|
388743
389144
|
continue;
|
|
388744
|
-
const byteStart =
|
|
389145
|
+
const byteStart = TE61.encode(partXml.slice(0, drawing.start)).byteLength;
|
|
388745
389146
|
out.push({
|
|
388746
389147
|
start: drawing.start,
|
|
388747
389148
|
byteStart,
|
|
388748
|
-
byteEnd: byteStart +
|
|
389149
|
+
byteEnd: byteStart + TE61.encode(drawing.xml).byteLength,
|
|
388749
389150
|
relationshipId,
|
|
388750
389151
|
xml: drawing.xml
|
|
388751
389152
|
});
|
|
@@ -389223,14 +389624,14 @@ function decodeXmlAttr2(value2) {
|
|
|
389223
389624
|
function emuToPx(value2) {
|
|
389224
389625
|
return value2 / EMU_PER_PX5;
|
|
389225
389626
|
}
|
|
389226
|
-
var
|
|
389627
|
+
var TD108, TE61, EMU_PER_PX5 = 9525, CROP_SCALE = 1000, DECORATIVE_DESCRIPTION_CLEARED, BODY_IMAGE_ENTRIES_CACHE, TRACKED_WRAPPER_KINDS2;
|
|
389227
389628
|
var init_public_model2 = __esm(() => {
|
|
389228
389629
|
init_sd_document_session_internal();
|
|
389229
389630
|
init_caption_style();
|
|
389230
389631
|
init_xml_rewrite();
|
|
389231
389632
|
init_document_reader();
|
|
389232
|
-
|
|
389233
|
-
|
|
389633
|
+
TD108 = new TextDecoder;
|
|
389634
|
+
TE61 = new TextEncoder;
|
|
389234
389635
|
DECORATIVE_DESCRIPTION_CLEARED = new WeakMap;
|
|
389235
389636
|
BODY_IMAGE_ENTRIES_CACHE = new WeakMap;
|
|
389236
389637
|
TRACKED_WRAPPER_KINDS2 = new Set(["ins", "del", "moveFrom", "moveTo"]);
|
|
@@ -394737,7 +395138,7 @@ function collectTrackedTextSearchHits(input) {
|
|
|
394737
395138
|
const bytes = getSDDocumentSessionInternalPartBytes(input.context.session, entry.partUri);
|
|
394738
395139
|
if (!bytes)
|
|
394739
395140
|
continue;
|
|
394740
|
-
const paragraphXml =
|
|
395141
|
+
const paragraphXml = TD109.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
394741
395142
|
const text4 = readTrackedParagraphText(paragraphXml);
|
|
394742
395143
|
paragraphs.push({
|
|
394743
395144
|
scope,
|
|
@@ -394909,7 +395310,7 @@ function isWholeWordMatch(text4, start, end) {
|
|
|
394909
395310
|
function isWordChar3(value2) {
|
|
394910
395311
|
return /^[A-Za-z0-9_]$/.test(value2);
|
|
394911
395312
|
}
|
|
394912
|
-
var
|
|
395313
|
+
var TD109, CONTEXT_WINDOW3 = 32;
|
|
394913
395314
|
var init_tracked_text_search = __esm(() => {
|
|
394914
395315
|
init_src3();
|
|
394915
395316
|
init_sd_document_session_internal();
|
|
@@ -394917,7 +395318,7 @@ var init_tracked_text_search = __esm(() => {
|
|
|
394917
395318
|
init_story_identity();
|
|
394918
395319
|
init_document_reader();
|
|
394919
395320
|
init_scope2();
|
|
394920
|
-
|
|
395321
|
+
TD109 = new TextDecoder;
|
|
394921
395322
|
});
|
|
394922
395323
|
|
|
394923
395324
|
// ../../../v2/document-api-v2-adapter/dist/search/within.js
|
|
@@ -396415,12 +396816,12 @@ var init_adapter25 = __esm(() => {
|
|
|
396415
396816
|
|
|
396416
396817
|
// ../../../v2/document-api-v2-adapter/dist/diff/tracked-table-property-replay.js
|
|
396417
396818
|
function buildTrackedTablePropertyReplayPlan(base3, target) {
|
|
396418
|
-
const baseBytes =
|
|
396419
|
-
const targetBytes =
|
|
396819
|
+
const baseBytes = TE62.encode(base3.xml);
|
|
396820
|
+
const targetBytes = TE62.encode(target.xml);
|
|
396420
396821
|
const baseTables = buildTableCatalog({ bytes: baseBytes, storyId: STORY_ID });
|
|
396421
396822
|
const targetTables = buildTableCatalog({ bytes: targetBytes, storyId: STORY_ID });
|
|
396422
|
-
const baseBody = collectXmlElementRanges(base3.xml).ranges.find((range) => range.tag.namespaceUri ===
|
|
396423
|
-
const targetBody = collectXmlElementRanges(target.xml).ranges.find((range) => range.tag.namespaceUri ===
|
|
396823
|
+
const baseBody = collectXmlElementRanges(base3.xml).ranges.find((range) => range.tag.namespaceUri === W25 && range.tag.localName === "body");
|
|
396824
|
+
const targetBody = collectXmlElementRanges(target.xml).ranges.find((range) => range.tag.namespaceUri === W25 && range.tag.localName === "body");
|
|
396424
396825
|
if (!baseBody || !targetBody || base3.xml.slice(0, baseBody.openEnd) !== target.xml.slice(0, targetBody.openEnd) || baseTables.tables.length !== targetTables.tables.length)
|
|
396425
396826
|
return null;
|
|
396426
396827
|
const steps = [];
|
|
@@ -396428,7 +396829,7 @@ function buildTrackedTablePropertyReplayPlan(base3, target) {
|
|
|
396428
396829
|
const after = targetTables.tables[index2];
|
|
396429
396830
|
if (before.tableNodeId !== after.tableNodeId)
|
|
396430
396831
|
return null;
|
|
396431
|
-
const beforeXml =
|
|
396832
|
+
const beforeXml = TD110.decode(baseBytes.subarray(before.tableByteStart, before.tableByteEnd));
|
|
396432
396833
|
const beforeCells = before.rows.flatMap((row) => row.cells);
|
|
396433
396834
|
const afterCells = after.rows.flatMap((row) => row.cells);
|
|
396434
396835
|
if (beforeCells.length !== afterCells.length)
|
|
@@ -396439,14 +396840,14 @@ function buildTrackedTablePropertyReplayPlan(base3, target) {
|
|
|
396439
396840
|
const beforeCell = beforeCells[cellIndex];
|
|
396440
396841
|
if (beforeCell.cellNodeId !== afterCell.cellNodeId)
|
|
396441
396842
|
return null;
|
|
396442
|
-
const beforeBody =
|
|
396443
|
-
const afterBody =
|
|
396843
|
+
const beforeBody = TD110.decode(baseBytes.subarray(beforeCell.bodyByteStart, beforeCell.bodyByteEnd));
|
|
396844
|
+
const afterBody = TD110.decode(targetBytes.subarray(afterCell.bodyByteStart, afterCell.bodyByteEnd));
|
|
396444
396845
|
if (beforeBody !== afterBody && (beforeCell.containsUnsupportedContent || afterCell.containsUnsupportedContent || beforeCell.containsNestedTable || afterCell.containsNestedTable || beforeCell.paragraphs.length !== afterCell.paragraphs.length || beforeCell.paragraphs.some((paragraph4, index3) => !paragraph4.paragraphId || paragraph4.paragraphId !== afterCell.paragraphs[index3]?.paragraphId)))
|
|
396445
396846
|
return null;
|
|
396446
|
-
pieces.push(
|
|
396847
|
+
pieces.push(TD110.decode(targetBytes.subarray(cursor, afterCell.bodyByteStart)), beforeBody);
|
|
396447
396848
|
cursor = afterCell.bodyByteEnd;
|
|
396448
396849
|
}
|
|
396449
|
-
pieces.push(
|
|
396850
|
+
pieces.push(TD110.decode(targetBytes.subarray(cursor, after.tableByteEnd)));
|
|
396450
396851
|
const afterXml = pieces.join("");
|
|
396451
396852
|
if (beforeXml === afterXml)
|
|
396452
396853
|
continue;
|
|
@@ -396462,11 +396863,11 @@ function buildTrackedTablePropertyReplayPlan(base3, target) {
|
|
|
396462
396863
|
}
|
|
396463
396864
|
return steps.length ? { steps } : null;
|
|
396464
396865
|
}
|
|
396465
|
-
var
|
|
396866
|
+
var TE62, TD110, STORY_ID = "body:/word/document.xml", W25 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
396466
396867
|
var init_tracked_table_property_replay = __esm(() => {
|
|
396467
396868
|
init_sd_document_session_internal();
|
|
396468
|
-
|
|
396469
|
-
|
|
396869
|
+
TE62 = new TextEncoder;
|
|
396870
|
+
TD110 = new TextDecoder;
|
|
396470
396871
|
});
|
|
396471
396872
|
|
|
396472
396873
|
// ../../../v2/document-api-v2-adapter/dist/compare/errors.js
|
|
@@ -396564,15 +396965,15 @@ var init_fingerprint = __esm(() => {
|
|
|
396564
396965
|
// ../../../v2/document-api-v2-adapter/dist/compare/part-fingerprint.js
|
|
396565
396966
|
function comparePartContentFingerprint(partUri, bytes) {
|
|
396566
396967
|
const partHash = sha256HexSync(bytes);
|
|
396567
|
-
return `fp:${sha256HexSync(
|
|
396968
|
+
return `fp:${sha256HexSync(TE63.encode(`${partUri}:${partHash}`))}`;
|
|
396568
396969
|
}
|
|
396569
396970
|
function comparePartXmlFingerprint(partUri, xml) {
|
|
396570
|
-
return comparePartContentFingerprint(partUri,
|
|
396971
|
+
return comparePartContentFingerprint(partUri, TE63.encode(xml));
|
|
396571
396972
|
}
|
|
396572
|
-
var
|
|
396973
|
+
var TE63;
|
|
396573
396974
|
var init_part_fingerprint = __esm(() => {
|
|
396574
396975
|
init_sd_document_session_internal();
|
|
396575
|
-
|
|
396976
|
+
TE63 = new TextEncoder;
|
|
396576
396977
|
});
|
|
396577
396978
|
|
|
396578
396979
|
// ../../../v2/document-api-v2-adapter/dist/compare/inventory.js
|
|
@@ -396688,7 +397089,7 @@ function buildCompareSourceObservation(context) {
|
|
|
396688
397089
|
if (acc.sections.present) {
|
|
396689
397090
|
const docBytes = getSDDocumentSessionInternalPartBytes(session, "/word/document.xml");
|
|
396690
397091
|
if (docBytes)
|
|
396691
|
-
acc.sections.fingerprintParts.push(`sectPr:${countOccurrences(
|
|
397092
|
+
acc.sections.fingerprintParts.push(`sectPr:${countOccurrences(TD111.decode(docBytes), "<w:sectPr")}`);
|
|
396692
397093
|
}
|
|
396693
397094
|
try {
|
|
396694
397095
|
const numbering = readNumberingCatalogForSession(session);
|
|
@@ -396721,7 +397122,7 @@ function buildCompareSourceObservation(context) {
|
|
|
396721
397122
|
const bytes = getSDDocumentSessionInternalPartBytes(session, source.partUri);
|
|
396722
397123
|
if (!bytes)
|
|
396723
397124
|
continue;
|
|
396724
|
-
const xml =
|
|
397125
|
+
const xml = TD111.decode(bytes);
|
|
396725
397126
|
const canonicalizeBookmarkIds = bookmarkIdsAreBalanced(xml);
|
|
396726
397127
|
for (const match of xml.matchAll(/<[\w.-]+:bookmarkStart\b([^>]*)>/g)) {
|
|
396727
397128
|
const name = tagAttr(match[1] ?? "", "name");
|
|
@@ -396793,7 +397194,7 @@ function captureCompareSourceInventory(context) {
|
|
|
396793
397194
|
return buildCompareSourceInventory(buildCompareSourceObservation(context));
|
|
396794
397195
|
}
|
|
396795
397196
|
function textBytes(value2) {
|
|
396796
|
-
return
|
|
397197
|
+
return TE64.encode(value2);
|
|
396797
397198
|
}
|
|
396798
397199
|
function countOccurrences(haystack, needle) {
|
|
396799
397200
|
let count = 0;
|
|
@@ -396850,19 +397251,19 @@ function accumulateStoryCatalogs(context, story, acc) {
|
|
|
396850
397251
|
}
|
|
396851
397252
|
} catch {}
|
|
396852
397253
|
}
|
|
396853
|
-
var
|
|
397254
|
+
var TD111, BODY_PART_URI = "/word/document.xml", TE64;
|
|
396854
397255
|
var init_inventory = __esm(() => {
|
|
396855
397256
|
init_src2();
|
|
396856
397257
|
init_sd_document_session_internal();
|
|
396857
397258
|
init_document_reader();
|
|
396858
397259
|
init_part_fingerprint();
|
|
396859
|
-
|
|
396860
|
-
|
|
397260
|
+
TD111 = new TextDecoder("utf-8", { fatal: false });
|
|
397261
|
+
TE64 = new TextEncoder;
|
|
396861
397262
|
});
|
|
396862
397263
|
|
|
396863
397264
|
// ../../../v2/document-api-v2-adapter/dist/compare/definitions.js
|
|
396864
397265
|
function digest2(value2) {
|
|
396865
|
-
return sha256HexSync(
|
|
397266
|
+
return sha256HexSync(TE65.encode(value2));
|
|
396866
397267
|
}
|
|
396867
397268
|
function tagAttr2(tag, local) {
|
|
396868
397269
|
const match = new RegExp(`\\b(?:[\\w.-]+:)?${local}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`).exec(tag);
|
|
@@ -396889,7 +397290,7 @@ function projectStyles2(context) {
|
|
|
396889
397290
|
const bytes = readStyleDefinitionsPartBytes(context);
|
|
396890
397291
|
if (!bytes)
|
|
396891
397292
|
return [];
|
|
396892
|
-
return projectStyleEntriesFromXml(
|
|
397293
|
+
return projectStyleEntriesFromXml(TD112.decode(bytes));
|
|
396893
397294
|
}
|
|
396894
397295
|
function projectStyleEntriesFromXml(xml) {
|
|
396895
397296
|
const entries = [];
|
|
@@ -396978,7 +397379,7 @@ function projectNumbering(context) {
|
|
|
396978
397379
|
if (!bytes)
|
|
396979
397380
|
return [];
|
|
396980
397381
|
try {
|
|
396981
|
-
return projectNumberingEntriesFromXml(
|
|
397382
|
+
return projectNumberingEntriesFromXml(TD112.decode(bytes));
|
|
396982
397383
|
} catch {
|
|
396983
397384
|
return [];
|
|
396984
397385
|
}
|
|
@@ -397120,7 +397521,7 @@ function projectSettings(context) {
|
|
|
397120
397521
|
key: "settings",
|
|
397121
397522
|
stableKey: "settings",
|
|
397122
397523
|
semanticKey: null,
|
|
397123
|
-
contentSignature: settingsContentSignatureFromXml(
|
|
397524
|
+
contentSignature: settingsContentSignatureFromXml(TD112.decode(bytes)),
|
|
397124
397525
|
ordinal: 0,
|
|
397125
397526
|
label: "settings.xml"
|
|
397126
397527
|
}];
|
|
@@ -397138,7 +397539,7 @@ function projectTheme2(context) {
|
|
|
397138
397539
|
key: key2,
|
|
397139
397540
|
stableKey: key2,
|
|
397140
397541
|
semanticKey: null,
|
|
397141
|
-
contentSignature: digest2(
|
|
397542
|
+
contentSignature: digest2(TD112.decode(bytes)),
|
|
397142
397543
|
ordinal: ordinal++,
|
|
397143
397544
|
label: descriptor.partUri
|
|
397144
397545
|
});
|
|
@@ -397166,14 +397567,14 @@ function projectCompareDefinitions(context) {
|
|
|
397166
397567
|
{ family: "theme", entries: projectTheme2(context) }
|
|
397167
397568
|
];
|
|
397168
397569
|
}
|
|
397169
|
-
var
|
|
397570
|
+
var TD112, TE65, SETTINGS_PART_URI4 = "/word/settings.xml", WORDPROCESSINGML_NS3 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", XML_ATTR_RE;
|
|
397170
397571
|
var init_definitions = __esm(() => {
|
|
397171
397572
|
init_src2();
|
|
397172
397573
|
init_sd_document_session_internal();
|
|
397173
397574
|
init_adapter13();
|
|
397174
397575
|
init_part();
|
|
397175
|
-
|
|
397176
|
-
|
|
397576
|
+
TD112 = new TextDecoder("utf-8", { fatal: false });
|
|
397577
|
+
TE65 = new TextEncoder;
|
|
397177
397578
|
XML_ATTR_RE = /\s+[\w.-]+(?::[\w.-]+)?=(?:"[^"]*"|'[^']*')/g;
|
|
397178
397579
|
});
|
|
397179
397580
|
|
|
@@ -397188,7 +397589,7 @@ function contentControlIdentity(properties) {
|
|
|
397188
397589
|
|
|
397189
397590
|
// ../../../v2/document-api-v2-adapter/dist/compare/annotations.js
|
|
397190
397591
|
function digest3(value2) {
|
|
397191
|
-
return sha256HexSync(
|
|
397592
|
+
return sha256HexSync(TE66.encode(value2));
|
|
397192
397593
|
}
|
|
397193
397594
|
function storyLocatorSignature(story) {
|
|
397194
397595
|
if (!story || story.storyType === "body")
|
|
@@ -397260,10 +397661,10 @@ function buildBoundCustomXmlSignatureByStoreItemId(context) {
|
|
|
397260
397661
|
const storageBytes = getSDDocumentSessionInternalPartBytes(context.session, partUri);
|
|
397261
397662
|
if (!propsBytes || !storageBytes)
|
|
397262
397663
|
continue;
|
|
397263
|
-
const storeItemId = parseStoreItemIdFromPropsXml(
|
|
397664
|
+
const storeItemId = parseStoreItemIdFromPropsXml(TD113.decode(propsBytes));
|
|
397264
397665
|
if (!storeItemId || signatures.has(storeItemId))
|
|
397265
397666
|
continue;
|
|
397266
|
-
signatures.set(storeItemId, digest3(
|
|
397667
|
+
signatures.set(storeItemId, digest3(TD113.decode(storageBytes)));
|
|
397267
397668
|
}
|
|
397268
397669
|
return signatures;
|
|
397269
397670
|
}
|
|
@@ -397424,7 +397825,7 @@ function projectFieldsReferences(context) {
|
|
|
397424
397825
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, source.partUri);
|
|
397425
397826
|
if (!bytes)
|
|
397426
397827
|
continue;
|
|
397427
|
-
const xml =
|
|
397828
|
+
const xml = TD113.decode(bytes);
|
|
397428
397829
|
const canonicalizeBookmarkIds = bookmarkIdsAreBalanced2(xml);
|
|
397429
397830
|
for (const match of xml.matchAll(/<[\w.-]+:bookmarkStart\b([^>]*)>/g)) {
|
|
397430
397831
|
const name = tagAttr3(match[1] ?? "", "name");
|
|
@@ -397471,7 +397872,7 @@ function projectContentControls(context) {
|
|
|
397471
397872
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, source.partUri);
|
|
397472
397873
|
if (!bytes)
|
|
397473
397874
|
continue;
|
|
397474
|
-
const xml =
|
|
397875
|
+
const xml = TD113.decode(bytes);
|
|
397475
397876
|
for (const match of xml.matchAll(/<[\w.-]+:sdtPr\b[^>]*>([\s\S]*?)<\/[\w.-]+:sdtPr>/g)) {
|
|
397476
397877
|
const block = match[0];
|
|
397477
397878
|
const tag = childVal2(block, "tag");
|
|
@@ -397504,7 +397905,7 @@ function projectPermissions(context) {
|
|
|
397504
397905
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, source.partUri);
|
|
397505
397906
|
if (!bytes)
|
|
397506
397907
|
continue;
|
|
397507
|
-
const xml =
|
|
397908
|
+
const xml = TD113.decode(bytes);
|
|
397508
397909
|
for (const match of xml.matchAll(/<[\w.-]+:permStart\b([^>]*)>/g)) {
|
|
397509
397910
|
const id = tagAttr3(match[1] ?? "", "id");
|
|
397510
397911
|
if (!id)
|
|
@@ -397547,17 +397948,17 @@ function projectCompareAnnotations(context) {
|
|
|
397547
397948
|
{ family: "permissions", entries: projectPermissions(context) }
|
|
397548
397949
|
];
|
|
397549
397950
|
}
|
|
397550
|
-
var
|
|
397951
|
+
var TD113, TE66, BODY_PART_URI2 = "/word/document.xml", CUSTOM_XML_PROPS_RELS_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps";
|
|
397551
397952
|
var init_annotations2 = __esm(() => {
|
|
397552
397953
|
init_sd_document_session_internal();
|
|
397553
397954
|
init_read();
|
|
397554
|
-
|
|
397555
|
-
|
|
397955
|
+
TD113 = new TextDecoder("utf-8", { fatal: false });
|
|
397956
|
+
TE66 = new TextEncoder;
|
|
397556
397957
|
});
|
|
397557
397958
|
|
|
397558
397959
|
// ../../../v2/document-api-v2-adapter/dist/compare/objects.js
|
|
397559
397960
|
function digest4(value2) {
|
|
397560
|
-
return sha256HexSync(
|
|
397961
|
+
return sha256HexSync(TE67.encode(value2));
|
|
397561
397962
|
}
|
|
397562
397963
|
function isMediaKind(partKind) {
|
|
397563
397964
|
return classifyComparePartKind(partKind).family === "media";
|
|
@@ -397585,7 +397986,7 @@ function projectTables(context) {
|
|
|
397585
397986
|
const omitIndentation = (start, end) => {
|
|
397586
397987
|
if (start === null || start >= end)
|
|
397587
397988
|
return;
|
|
397588
|
-
if (/^[\x20\t\r\n]*$/.test(
|
|
397989
|
+
if (/^[\x20\t\r\n]*$/.test(TD114.decode(bytes.subarray(start, end))))
|
|
397589
397990
|
omitted.push({ start, end });
|
|
397590
397991
|
};
|
|
397591
397992
|
let previousRowEnd = table.tblGridByteEnd;
|
|
@@ -397599,10 +398000,10 @@ function projectTables(context) {
|
|
|
397599
398000
|
let cursor = table.tableByteStart;
|
|
397600
398001
|
const propertyParts = [];
|
|
397601
398002
|
for (const range of omitted.sort((a, b) => a.start - b.start)) {
|
|
397602
|
-
propertyParts.push(
|
|
398003
|
+
propertyParts.push(TD114.decode(bytes.subarray(cursor, range.start)));
|
|
397603
398004
|
cursor = range.end;
|
|
397604
398005
|
}
|
|
397605
|
-
propertyParts.push(
|
|
398006
|
+
propertyParts.push(TD114.decode(bytes.subarray(cursor, table.tableByteEnd)));
|
|
397606
398007
|
const properties = propertyParts.join("");
|
|
397607
398008
|
const topology = `${table.gridColumnCount}#${table.rows.map((r) => `${r.gridCellCount}:${r.isHeaderRow ? "h" : ""}:${r.cells.length}`).join("|")}#nested:${table.containsNestedTable ? 1 : 0}#span:${table.hasGridSpan ? 1 : 0}#vmerge:${table.hasVMerge ? 1 : 0}#rect:${table.isRectangular ? 1 : 0}`;
|
|
397608
398009
|
const cells = table.rows.map((r) => r.cells.map((c) => `${c.cellNodeId}:${c.gridColumnStart}:${c.gridSpan}:${c.vMerge}:${c.containsNestedTable ? "n" : ""}`).join(",")).join(";");
|
|
@@ -397705,7 +398106,7 @@ function readContentTypesRegistry(context) {
|
|
|
397705
398106
|
if (!bytes)
|
|
397706
398107
|
return null;
|
|
397707
398108
|
try {
|
|
397708
|
-
return parseContentTypes(
|
|
398109
|
+
return parseContentTypes(TD114.decode(bytes));
|
|
397709
398110
|
} catch {
|
|
397710
398111
|
return null;
|
|
397711
398112
|
}
|
|
@@ -397774,12 +398175,12 @@ function projectCompareObjects(context) {
|
|
|
397774
398175
|
{ family: "package-graph", entries: projectPackageGraph(context) }
|
|
397775
398176
|
];
|
|
397776
398177
|
}
|
|
397777
|
-
var
|
|
398178
|
+
var TD114, TE67, CONTENT_TYPES_PART_URI15 = "/[Content_Types].xml", PACKAGE_ROOT_OWNER = "/";
|
|
397778
398179
|
var init_objects = __esm(() => {
|
|
397779
398180
|
init_src2();
|
|
397780
398181
|
init_sd_document_session_internal();
|
|
397781
|
-
|
|
397782
|
-
|
|
398182
|
+
TD114 = new TextDecoder("utf-8", { fatal: false });
|
|
398183
|
+
TE67 = new TextEncoder;
|
|
397783
398184
|
});
|
|
397784
398185
|
|
|
397785
398186
|
// ../../../v2/document-api-v2-adapter/dist/compare/run-signature.js
|
|
@@ -398071,7 +398472,7 @@ function headerFooterPartsFromDocumentRelationships(bytes) {
|
|
|
398071
398472
|
const ambiguous2 = new Set;
|
|
398072
398473
|
if (bytes === null)
|
|
398073
398474
|
return result;
|
|
398074
|
-
const xml =
|
|
398475
|
+
const xml = TD115.decode(bytes instanceof Uint8Array ? bytes : Uint8Array.from(bytes));
|
|
398075
398476
|
const parsed = parseOpcRelationshipsXml(xml);
|
|
398076
398477
|
if (!parsed)
|
|
398077
398478
|
return result;
|
|
@@ -398095,7 +398496,7 @@ function notePartsFromDocumentRelationships(bytes) {
|
|
|
398095
398496
|
const candidates = [];
|
|
398096
398497
|
if (bytes === null)
|
|
398097
398498
|
return new Map;
|
|
398098
|
-
const xml =
|
|
398499
|
+
const xml = TD115.decode(bytes instanceof Uint8Array ? bytes : Uint8Array.from(bytes));
|
|
398099
398500
|
const parsed = parseOpcRelationshipsXml(xml);
|
|
398100
398501
|
if (!parsed)
|
|
398101
398502
|
return new Map;
|
|
@@ -398150,10 +398551,10 @@ function resolveDocumentRelationshipTarget(target) {
|
|
|
398150
398551
|
const partUri = `/${normalized.join("/")}`;
|
|
398151
398552
|
return isNormalizedSafePartUri(partUri) ? partUri : null;
|
|
398152
398553
|
}
|
|
398153
|
-
var
|
|
398554
|
+
var TD115, HEADER_REL_SUFFIX = "/relationships/header", FOOTER_REL_SUFFIX = "/relationships/footer", FOOTNOTES_REL_SUFFIX = "/relationships/footnotes", ENDNOTES_REL_SUFFIX = "/relationships/endnotes";
|
|
398154
398555
|
var init_header_footer_parts = __esm(() => {
|
|
398155
398556
|
init_opc_xml();
|
|
398156
|
-
|
|
398557
|
+
TD115 = new TextDecoder;
|
|
398157
398558
|
});
|
|
398158
398559
|
|
|
398159
398560
|
// ../../../v2/document-api-v2-adapter/dist/compare/snapshot.js
|
|
@@ -398967,8 +399368,8 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
398967
399368
|
});
|
|
398968
399369
|
}
|
|
398969
399370
|
}
|
|
398970
|
-
const baseRels = base3.documentRelationshipsBytes ?
|
|
398971
|
-
const targetRels = target.documentRelationshipsBytes ?
|
|
399371
|
+
const baseRels = base3.documentRelationshipsBytes ? TD116.decode(Uint8Array.from(base3.documentRelationshipsBytes)) : EMPTY_RELS_XML;
|
|
399372
|
+
const targetRels = target.documentRelationshipsBytes ? TD116.decode(Uint8Array.from(target.documentRelationshipsBytes)) : EMPTY_RELS_XML;
|
|
398972
399373
|
const nextRels = replaceHeaderFooterRelationships(baseRels, targetRels);
|
|
398973
399374
|
const baseRefByPart = headerFooterRefsByPart(baseRels);
|
|
398974
399375
|
const refByPart = headerFooterRefsByPart(targetRels);
|
|
@@ -398984,7 +399385,7 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
398984
399385
|
family: "header-footer-parts",
|
|
398985
399386
|
partUri: DOCUMENT_RELS_URI2,
|
|
398986
399387
|
kind: "create",
|
|
398987
|
-
nextBytes:
|
|
399388
|
+
nextBytes: TE68.encode(nextRels),
|
|
398988
399389
|
contentType: "application/vnd.openxmlformats-package.relationships+xml"
|
|
398989
399390
|
});
|
|
398990
399391
|
} else if (nextRels !== baseRels) {
|
|
@@ -398992,11 +399393,11 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
398992
399393
|
family: "header-footer-parts",
|
|
398993
399394
|
partUri: DOCUMENT_RELS_URI2,
|
|
398994
399395
|
kind: "modify",
|
|
398995
|
-
nextBytes:
|
|
399396
|
+
nextBytes: TE68.encode(nextRels)
|
|
398996
399397
|
});
|
|
398997
399398
|
}
|
|
398998
|
-
const baseContentTypes =
|
|
398999
|
-
const targetContentTypes =
|
|
399399
|
+
const baseContentTypes = TD116.decode(Uint8Array.from(base3.contentTypesBytes));
|
|
399400
|
+
const targetContentTypes = TD116.decode(Uint8Array.from(target.contentTypesBytes));
|
|
399000
399401
|
const nextContentTypes = replaceHeaderFooterContentTypes(baseContentTypes, targetContentTypes, lifecyclePartUris);
|
|
399001
399402
|
if (nextContentTypes === null)
|
|
399002
399403
|
unsafeReasons.push(`${CONTENT_TYPES_URI2}: content-types XML could not be merged`);
|
|
@@ -399005,7 +399406,7 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
399005
399406
|
family: "header-footer-parts",
|
|
399006
399407
|
partUri: CONTENT_TYPES_URI2,
|
|
399007
399408
|
kind: "modify",
|
|
399008
|
-
nextBytes:
|
|
399409
|
+
nextBytes: TE68.encode(nextContentTypes)
|
|
399009
399410
|
});
|
|
399010
399411
|
}
|
|
399011
399412
|
return {
|
|
@@ -399075,8 +399476,8 @@ function mapsEqual(left, right) {
|
|
|
399075
399476
|
return left.size === right.size && [...left].every(([key2, value2]) => right.get(key2) === value2);
|
|
399076
399477
|
}
|
|
399077
399478
|
function hasRelationshipBackedDependencies(part) {
|
|
399078
|
-
const xml =
|
|
399079
|
-
const relationshipsXml = part.relationshipsBytes === null ? null :
|
|
399479
|
+
const xml = TD116.decode(Uint8Array.from(part.bytes));
|
|
399480
|
+
const relationshipsXml = part.relationshipsBytes === null ? null : TD116.decode(Uint8Array.from(part.relationshipsBytes));
|
|
399080
399481
|
const relationships = relationshipsXml ? parseOpcRelationshipsXml(relationshipsXml) : null;
|
|
399081
399482
|
return Boolean(relationshipsXml && (!relationships || relationships.elements.length > 0) || relationshipReferenceIdsFromXml(xml).size > 0);
|
|
399082
399483
|
}
|
|
@@ -399094,8 +399495,8 @@ function headerFooterPartRelationshipsEqual(left, right) {
|
|
|
399094
399495
|
return left === right;
|
|
399095
399496
|
if (numbersEqual(left, right))
|
|
399096
399497
|
return true;
|
|
399097
|
-
const leftParsed = parseOpcRelationshipsXml(
|
|
399098
|
-
const rightParsed = parseOpcRelationshipsXml(
|
|
399498
|
+
const leftParsed = parseOpcRelationshipsXml(TD116.decode(Uint8Array.from(left)));
|
|
399499
|
+
const rightParsed = parseOpcRelationshipsXml(TD116.decode(Uint8Array.from(right)));
|
|
399099
399500
|
if (!leftParsed || !rightParsed)
|
|
399100
399501
|
return false;
|
|
399101
399502
|
const leftKeys = leftParsed.elements.map(relationshipSemanticKey).sort();
|
|
@@ -399103,7 +399504,7 @@ function headerFooterPartRelationshipsEqual(left, right) {
|
|
|
399103
399504
|
return leftKeys.length === rightKeys.length && leftKeys.every((key2, index2) => key2 === rightKeys[index2]);
|
|
399104
399505
|
}
|
|
399105
399506
|
function relationshipReferenceIds(bytes) {
|
|
399106
|
-
return relationshipReferenceIdsFromXml(
|
|
399507
|
+
return relationshipReferenceIdsFromXml(TD116.decode(Uint8Array.from(bytes)));
|
|
399107
399508
|
}
|
|
399108
399509
|
function relationshipReferenceIdsFromXml(xml) {
|
|
399109
399510
|
const ids = new Set;
|
|
@@ -399132,13 +399533,13 @@ function setsEqual2(left, right) {
|
|
|
399132
399533
|
}
|
|
399133
399534
|
function hasHeaderFooterRoot2(bytes, kind) {
|
|
399134
399535
|
const localName2 = kind === "header" ? "hdr" : "ftr";
|
|
399135
|
-
return new RegExp(`<(?:(?:[A-Za-z_][\\w.-]*):)?${localName2}\\b`).test(
|
|
399536
|
+
return new RegExp(`<(?:(?:[A-Za-z_][\\w.-]*):)?${localName2}\\b`).test(TD116.decode(Uint8Array.from(bytes)));
|
|
399136
399537
|
}
|
|
399137
399538
|
function baseContentTypeXml(source) {
|
|
399138
|
-
return
|
|
399539
|
+
return TD116.decode(Uint8Array.from(source.contentTypesBytes));
|
|
399139
399540
|
}
|
|
399140
399541
|
function targetContentTypeXml(source) {
|
|
399141
|
-
return
|
|
399542
|
+
return TD116.decode(Uint8Array.from(source.contentTypesBytes));
|
|
399142
399543
|
}
|
|
399143
399544
|
function coveredGraphKeys(baseRels, targetRels, baseContentTypes, targetContentTypes) {
|
|
399144
399545
|
const covered = new Set;
|
|
@@ -399154,8 +399555,8 @@ function coveredGraphKeys(baseRels, targetRels, baseContentTypes, targetContentT
|
|
|
399154
399555
|
}
|
|
399155
399556
|
}
|
|
399156
399557
|
const partUris = new Set([
|
|
399157
|
-
...headerFooterPartsFromDocumentRelationships(
|
|
399158
|
-
...headerFooterPartsFromDocumentRelationships(
|
|
399558
|
+
...headerFooterPartsFromDocumentRelationships(TE68.encode(baseRels)).keys(),
|
|
399559
|
+
...headerFooterPartsFromDocumentRelationships(TE68.encode(targetRels)).keys()
|
|
399159
399560
|
]);
|
|
399160
399561
|
const baseOverrides = headerFooterOverrideRecords(baseContentTypes, partUris);
|
|
399161
399562
|
const targetOverrides = headerFooterOverrideRecords(targetContentTypes, partUris);
|
|
@@ -399178,14 +399579,14 @@ function headerFooterOverrideRecords(xml, partUris) {
|
|
|
399178
399579
|
function relationshipSemanticKey(relationship) {
|
|
399179
399580
|
return JSON.stringify([relationship.id, relationship.type, relationship.target, relationship.targetMode ?? "Internal"]);
|
|
399180
399581
|
}
|
|
399181
|
-
var
|
|
399582
|
+
var TD116, TE68, 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;
|
|
399182
399583
|
var init_header_footer_lifecycle = __esm(() => {
|
|
399183
399584
|
init_sd_document_session_internal();
|
|
399184
399585
|
init_part_fingerprint();
|
|
399185
399586
|
init_header_footer_parts();
|
|
399186
399587
|
init_opc_xml();
|
|
399187
|
-
|
|
399188
|
-
|
|
399588
|
+
TD116 = new TextDecoder;
|
|
399589
|
+
TE68 = new TextEncoder;
|
|
399189
399590
|
OFFICE_RELATIONSHIPS_NAMESPACES = new Set([
|
|
399190
399591
|
"http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
399191
399592
|
"http://purl.oclc.org/ooxml/officeDocument/relationships"
|
|
@@ -399353,8 +399754,8 @@ function buildTrackedTableRowReplayPlan(input) {
|
|
|
399353
399754
|
if (input.base.xml === input.target.xml) {
|
|
399354
399755
|
return { steps: [], bodyOperations: input.bodyOperations, unsafeReasons: [] };
|
|
399355
399756
|
}
|
|
399356
|
-
const baseBytes =
|
|
399357
|
-
const targetBytes =
|
|
399757
|
+
const baseBytes = TE69.encode(input.base.xml);
|
|
399758
|
+
const targetBytes = TE69.encode(input.target.xml);
|
|
399358
399759
|
const baseCatalog = buildTableCatalog({ bytes: baseBytes, storyId: STORY_ID2 });
|
|
399359
399760
|
const targetCatalog = buildTableCatalog({ bytes: targetBytes, storyId: STORY_ID2 });
|
|
399360
399761
|
const baseRoot = documentRootContext(input.base.xml);
|
|
@@ -400027,10 +400428,10 @@ function escapeRegExp18(value2) {
|
|
|
400027
400428
|
function escapeXmlAttribute5(value2) {
|
|
400028
400429
|
return value2.replaceAll("&", "&").replaceAll('"', """);
|
|
400029
400430
|
}
|
|
400030
|
-
var
|
|
400431
|
+
var TE69, 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;
|
|
400031
400432
|
var init_tracked_table_row_replay = __esm(() => {
|
|
400032
400433
|
init_sd_document_session_internal();
|
|
400033
|
-
|
|
400434
|
+
TE69 = new TextEncoder;
|
|
400034
400435
|
MC_PREFIX_LIST_ATTRIBUTES = new Set(["Ignorable", "MustUnderstand"]);
|
|
400035
400436
|
MC_QNAME_LIST_ATTRIBUTES = new Set(["PreserveElements", "PreserveAttributes", "ProcessContent"]);
|
|
400036
400437
|
EXACT_ROW_UNSAFE_REVISION_LOCAL_NAMES2 = new Set([
|
|
@@ -400071,7 +400472,7 @@ var init_tracked_table_row_replay = __esm(() => {
|
|
|
400071
400472
|
function read(xml) {
|
|
400072
400473
|
const parsed = collectXmlElementRanges(xml);
|
|
400073
400474
|
const ranges = parsed.ranges.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
400074
|
-
const body = ranges.find((range) => range.tag.namespaceUri ===
|
|
400475
|
+
const body = ranges.find((range) => range.tag.namespaceUri === W26 && range.tag.localName === "body");
|
|
400075
400476
|
if (parsed.errors.length || !body)
|
|
400076
400477
|
return null;
|
|
400077
400478
|
const children2 = [];
|
|
@@ -400079,12 +400480,12 @@ function read(xml) {
|
|
|
400079
400480
|
for (const range of ranges) {
|
|
400080
400481
|
if (range.start < cursor || range.end > body.closeStart)
|
|
400081
400482
|
continue;
|
|
400082
|
-
if (xml.slice(cursor, range.start).trim() || range.tag.namespaceUri !==
|
|
400483
|
+
if (xml.slice(cursor, range.start).trim() || range.tag.namespaceUri !== W26 || !["p", "tbl", "sectPr"].includes(range.tag.localName))
|
|
400083
400484
|
return null;
|
|
400084
400485
|
children2.push(range);
|
|
400085
400486
|
cursor = range.end;
|
|
400086
400487
|
}
|
|
400087
|
-
const bytes =
|
|
400488
|
+
const bytes = TE70.encode(xml);
|
|
400088
400489
|
const byteOffsets = buildUtf8ByteOffsetTable(xml);
|
|
400089
400490
|
const tables2 = buildTableCatalog({ bytes, storyId: STORY }).tables;
|
|
400090
400491
|
if (tables2.some((table) => table.containsNestedTable || !table.isRectangular || table.hasVMerge || table.hasGridSpan))
|
|
@@ -400206,11 +400607,11 @@ function buildTrackedTableBlockReplayPlan(input) {
|
|
|
400206
400607
|
bodyOperations: input.bodyOperations.filter((operation) => !ownedIds.has(operation.blockId))
|
|
400207
400608
|
};
|
|
400208
400609
|
}
|
|
400209
|
-
var
|
|
400610
|
+
var W26 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", W149 = "http://schemas.microsoft.com/office/word/2010/wordml", STORY = "body:/word/document.xml", TE70, paragraphId2 = (range) => range.tag.attributes.find((attr4) => attr4.namespaceUri === W149 && attr4.localName === "paraId")?.value;
|
|
400210
400611
|
var init_tracked_table_block_replay = __esm(() => {
|
|
400211
400612
|
init_sd_document_session_internal();
|
|
400212
400613
|
init_tracked_table_row_replay();
|
|
400213
|
-
|
|
400614
|
+
TE70 = new TextEncoder;
|
|
400214
400615
|
});
|
|
400215
400616
|
|
|
400216
400617
|
// ../../../v2/document-api-v2-adapter/dist/diff/comments-replay.js
|
|
@@ -400262,7 +400663,7 @@ function validateDiffCommentSource(source, snapshot2, label) {
|
|
|
400262
400663
|
return problems;
|
|
400263
400664
|
}
|
|
400264
400665
|
function digest5(value2) {
|
|
400265
|
-
return sha256HexSync(
|
|
400666
|
+
return sha256HexSync(TE71.encode(value2));
|
|
400266
400667
|
}
|
|
400267
400668
|
function commentContentSignature(record3) {
|
|
400268
400669
|
return digest5(`body:${record3.bodyText}#author:${record3.author}#parent:${record3.parentParaId ?? ""}` + `#done:${record3.doneState ? "1" : "0"}#date:${record3.date ?? ""}` + `#anchor:${commentAnchorSignature2(record3.anchor)}`);
|
|
@@ -400617,12 +401018,12 @@ function isResolutionSidecarAddition(key2, targetEntry) {
|
|
|
400617
401018
|
if (!targetEntry)
|
|
400618
401019
|
return false;
|
|
400619
401020
|
if (key2 === "ct:override:/word/commentsExtended.xml") {
|
|
400620
|
-
return targetEntry.semanticKey === key2 && targetEntry.contentSignature === sha256HexSync(
|
|
401021
|
+
return targetEntry.semanticKey === key2 && targetEntry.contentSignature === sha256HexSync(TE71.encode("override:/word/commentsExtended.xml=" + "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"));
|
|
400621
401022
|
}
|
|
400622
401023
|
if (!key2.startsWith("rel:/word/document.xml|"))
|
|
400623
401024
|
return false;
|
|
400624
401025
|
const type = "http://schemas.microsoft.com/office/2011/relationships/commentsExtended";
|
|
400625
|
-
return targetEntry.semanticKey === `/word/document.xml|${type}` && targetEntry.contentSignature === sha256HexSync(
|
|
401026
|
+
return targetEntry.semanticKey === `/word/document.xml|${type}` && targetEntry.contentSignature === sha256HexSync(TE71.encode(`type:${type}#mode:Internal#target:/word/commentsExtended.xml`));
|
|
400626
401027
|
}
|
|
400627
401028
|
function isCommentScopedPackageKey(context, key2, presentInBase, hasCommentCreate, targetEntry) {
|
|
400628
401029
|
if (key2.startsWith("ct:")) {
|
|
@@ -400740,21 +401141,21 @@ function validateAnchorResolvable(context, commentId, anchor) {
|
|
|
400740
401141
|
});
|
|
400741
401142
|
return page.hits.length > 0 ? null : `comment "${commentId}" target text was not found`;
|
|
400742
401143
|
}
|
|
400743
|
-
var
|
|
401144
|
+
var TE71;
|
|
400744
401145
|
var init_comments_replay = __esm(() => {
|
|
400745
401146
|
init_sd_document_session_internal();
|
|
400746
401147
|
init_read();
|
|
400747
401148
|
init_collect_text_page();
|
|
400748
401149
|
init_scope2();
|
|
400749
401150
|
init_part_fingerprint();
|
|
400750
|
-
|
|
401151
|
+
TE71 = new TextEncoder;
|
|
400751
401152
|
});
|
|
400752
401153
|
|
|
400753
401154
|
// ../../../v2/document-api-v2-adapter/dist/diff/styles-replay.js
|
|
400754
401155
|
function projectDiffStylesSource(context) {
|
|
400755
401156
|
const partUri = resolveStyleDefinitionsPartUri2(context);
|
|
400756
401157
|
const bytes = readStyleDefinitionsPartBytes(context);
|
|
400757
|
-
return { partUri, xml: bytes ?
|
|
401158
|
+
return { partUri, xml: bytes ? TD117.decode(bytes) : null };
|
|
400758
401159
|
}
|
|
400759
401160
|
function buildStyleApplyPlan(base3, target) {
|
|
400760
401161
|
const steps = [];
|
|
@@ -400842,18 +401243,18 @@ function validateStylesSourceAgainstSnapshot(source, snapshot2, label) {
|
|
|
400842
401243
|
}
|
|
400843
401244
|
return problems;
|
|
400844
401245
|
}
|
|
400845
|
-
var
|
|
401246
|
+
var TD117, CANONICAL_STYLES_PART_URI = "/word/styles.xml";
|
|
400846
401247
|
var init_styles_replay = __esm(() => {
|
|
400847
401248
|
init_definitions();
|
|
400848
401249
|
init_part_fingerprint();
|
|
400849
401250
|
init_part();
|
|
400850
|
-
|
|
401251
|
+
TD117 = new TextDecoder("utf-8", { fatal: false, ignoreBOM: true });
|
|
400851
401252
|
});
|
|
400852
401253
|
|
|
400853
401254
|
// ../../../v2/document-api-v2-adapter/dist/diff/numbering-replay.js
|
|
400854
401255
|
function projectDiffNumberingSource(context) {
|
|
400855
401256
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, NUMBERING_PART_URI);
|
|
400856
|
-
return { xml: bytes ?
|
|
401257
|
+
return { xml: bytes ? TD118.decode(bytes) : null };
|
|
400857
401258
|
}
|
|
400858
401259
|
function buildNumberingApplyPlan(base3, target) {
|
|
400859
401260
|
const steps = [];
|
|
@@ -400885,8 +401286,8 @@ function snapshotNumberingInventory(snapshot2) {
|
|
|
400885
401286
|
return snapshot2.sourceInventory?.families.find((f) => f.family === "numbering") ?? null;
|
|
400886
401287
|
}
|
|
400887
401288
|
function capturedNumberingFingerprint(xml) {
|
|
400888
|
-
const partHash = sha256HexSync(
|
|
400889
|
-
return `fp:${sha256HexSync(
|
|
401289
|
+
const partHash = sha256HexSync(TE72.encode(xml));
|
|
401290
|
+
return `fp:${sha256HexSync(TE72.encode(`${NUMBERING_PART_URI}:${partHash}`))}`;
|
|
400890
401291
|
}
|
|
400891
401292
|
function validateNumberingSourceAgainstSnapshot(source, snapshot2, label) {
|
|
400892
401293
|
const problems = [];
|
|
@@ -400929,18 +401330,18 @@ function validateNumberingSourceAgainstSnapshot(source, snapshot2, label) {
|
|
|
400929
401330
|
}
|
|
400930
401331
|
return problems;
|
|
400931
401332
|
}
|
|
400932
|
-
var
|
|
401333
|
+
var TD118, TE72;
|
|
400933
401334
|
var init_numbering_replay = __esm(() => {
|
|
400934
401335
|
init_sd_document_session_internal();
|
|
400935
401336
|
init_definitions();
|
|
400936
|
-
|
|
400937
|
-
|
|
401337
|
+
TD118 = new TextDecoder("utf-8", { fatal: false });
|
|
401338
|
+
TE72 = new TextEncoder;
|
|
400938
401339
|
});
|
|
400939
401340
|
|
|
400940
401341
|
// ../../../v2/document-api-v2-adapter/dist/diff/settings-replay.js
|
|
400941
401342
|
function projectDiffSettingsSource(context) {
|
|
400942
401343
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, SETTINGS_PART_URI5);
|
|
400943
|
-
return { xml: bytes ?
|
|
401344
|
+
return { xml: bytes ? TD119.decode(bytes) : null };
|
|
400944
401345
|
}
|
|
400945
401346
|
function buildSettingsApplyPlan(base3, target) {
|
|
400946
401347
|
if (base3.xml === null && target.xml === null)
|
|
@@ -401002,12 +401403,12 @@ function hasSettingsRoot(xml) {
|
|
|
401002
401403
|
}
|
|
401003
401404
|
return valid && rootCount === 1;
|
|
401004
401405
|
}
|
|
401005
|
-
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",
|
|
401406
|
+
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", TD119;
|
|
401006
401407
|
var init_settings_replay = __esm(() => {
|
|
401007
401408
|
init_sd_document_session_internal();
|
|
401008
401409
|
init_definitions();
|
|
401009
401410
|
init_part_fingerprint();
|
|
401010
|
-
|
|
401411
|
+
TD119 = new TextDecoder("utf-8", { fatal: false, ignoreBOM: true });
|
|
401011
401412
|
});
|
|
401012
401413
|
|
|
401013
401414
|
// ../../../v2/document-api-v2-adapter/dist/diff/main-document-source.js
|
|
@@ -401016,7 +401417,7 @@ function projectDiffMainDocumentSource(context) {
|
|
|
401016
401417
|
if (!bytes) {
|
|
401017
401418
|
throw new Error(`missing required main document part: ${MAIN_DOCUMENT_PART_URI}`);
|
|
401018
401419
|
}
|
|
401019
|
-
const xml =
|
|
401420
|
+
const xml = TD120.decode(bytes);
|
|
401020
401421
|
return {
|
|
401021
401422
|
xml,
|
|
401022
401423
|
fingerprint: capturedMainDocumentFingerprint(xml),
|
|
@@ -401101,7 +401502,7 @@ function paragraphStyleOutlineLevelsFromStylesSource(stylesXml) {
|
|
|
401101
401502
|
return stylesXml == null ? new Map : parseParagraphStyleOutlineLevels(stylesXml);
|
|
401102
401503
|
}
|
|
401103
401504
|
function projectMainDocumentBodyEntries(source, options = {}) {
|
|
401104
|
-
const bytes =
|
|
401505
|
+
const bytes = TE73.encode(source.xml);
|
|
401105
401506
|
const paragraphStyleOutlineLevels = options.paragraphStyleOutlineLevels ?? paragraphStyleOutlineLevelMap(source.paragraphStyleOutlineLevels);
|
|
401106
401507
|
const paragraphIndex = buildParagraphIndex({
|
|
401107
401508
|
bytes,
|
|
@@ -401116,7 +401517,7 @@ function projectMainDocumentBodyEntries(source, options = {}) {
|
|
|
401116
401517
|
});
|
|
401117
401518
|
const scopes = mapBodyParagraphStructuralScopes(tableCatalog, paragraphIndex.entries);
|
|
401118
401519
|
const namespaceBindingsByByteStart = scanParagraphNamespaceBindingsByByteStart(source.xml);
|
|
401119
|
-
const rawXmls = paragraphIndex.entries.map((entry) =>
|
|
401520
|
+
const rawXmls = paragraphIndex.entries.map((entry) => TD120.decode(bytes.subarray(entry.byteStart, entry.byteEnd)));
|
|
401120
401521
|
const runXmls = paragraphIndex.entries.map((entry, index2) => {
|
|
401121
401522
|
const namespaceBindings = namespaceBindingsByByteStart.get(entry.byteStart) ?? {};
|
|
401122
401523
|
return extractParagraphRunXml(rawXmls[index2], namespaceBindings);
|
|
@@ -401150,14 +401551,14 @@ function paragraphStyleOutlineLevelMap(record3) {
|
|
|
401150
401551
|
function capturedMainDocumentFingerprint(xml) {
|
|
401151
401552
|
return comparePartXmlFingerprint(MAIN_DOCUMENT_PART_URI, xml);
|
|
401152
401553
|
}
|
|
401153
|
-
var
|
|
401554
|
+
var TD120, TE73, MAIN_DOCUMENT_PART_URI = "/word/document.xml", MAIN_DOCUMENT_STORY_ID = "body:/word/document.xml", SNAPSHOT_REVISION = "snapshot";
|
|
401154
401555
|
var init_main_document_source = __esm(() => {
|
|
401155
401556
|
init_sd_document_session_internal();
|
|
401156
401557
|
init_document_reader();
|
|
401157
401558
|
init_run_signature2();
|
|
401158
401559
|
init_part_fingerprint();
|
|
401159
|
-
|
|
401160
|
-
|
|
401560
|
+
TD120 = new TextDecoder("utf-8", { fatal: false });
|
|
401561
|
+
TE73 = new TextEncoder;
|
|
401161
401562
|
});
|
|
401162
401563
|
|
|
401163
401564
|
// ../../../v2/document-api-v2-adapter/dist/diff/payloads.js
|
|
@@ -402486,7 +402887,7 @@ function embeddedImageOccurrences2(embedIds2, relationships, media) {
|
|
|
402486
402887
|
function relationshipRecords2(source) {
|
|
402487
402888
|
if (!source)
|
|
402488
402889
|
return new Map;
|
|
402489
|
-
return relationshipRecordsXml(
|
|
402890
|
+
return relationshipRecordsXml(TD121.decode(decodePartBytes(source)));
|
|
402490
402891
|
}
|
|
402491
402892
|
function relationshipRecordsXml(xml) {
|
|
402492
402893
|
const records = new Map;
|
|
@@ -402542,7 +402943,7 @@ function saveNoiseProfile(partUri, bytes) {
|
|
|
402542
402943
|
const tokens = [];
|
|
402543
402944
|
const stack = [];
|
|
402544
402945
|
let invalid4 = false;
|
|
402545
|
-
const parsed = parseXml(
|
|
402946
|
+
const parsed = parseXml(TD121.decode(bytes), {
|
|
402546
402947
|
onOpenTag: (tag) => {
|
|
402547
402948
|
const parent = stack.at(-1);
|
|
402548
402949
|
const ignored = parent?.ignored === true || partUri === "/word/settings.xml" && tag.namespaceUri === WORDPROCESSINGML_NS5 && tag.localName === "rsids";
|
|
@@ -402598,7 +402999,7 @@ function contentTypeRecords(source) {
|
|
|
402598
402999
|
let depth = 0;
|
|
402599
403000
|
let rootSeen = false;
|
|
402600
403001
|
let invalid4 = false;
|
|
402601
|
-
const parsed = parseXml(
|
|
403002
|
+
const parsed = parseXml(TD121.decode(decodePartBytes(source)), {
|
|
402602
403003
|
onOpenTag: (tag) => {
|
|
402603
403004
|
if (depth === 0) {
|
|
402604
403005
|
if (rootSeen || tag.localName !== "Types" || tag.namespaceUri !== CONTENT_TYPES_NS7)
|
|
@@ -402658,7 +403059,7 @@ function decodePartBytes(source) {
|
|
|
402658
403059
|
const length = base64DecodedLength(source.bytesBase64);
|
|
402659
403060
|
return length === null ? null : base64ToBytes(source.bytesBase64, length);
|
|
402660
403061
|
}
|
|
402661
|
-
var DOCUMENT_RELS_URI3 = "/word/_rels/document.xml.rels", DOCUMENT_URI = "/word/document.xml", CONTENT_TYPES_URI3 = "/[Content_Types].xml", SAVE_NOISE_PART_URIS, IMAGE_REL_TYPES, OFFICE_DOCUMENT_RELATIONSHIP_NAMESPACES, PACKAGE_RELATIONSHIPS_NS3 = "http://schemas.openxmlformats.org/package/2006/relationships", CONTENT_TYPES_NS7 = "http://schemas.openxmlformats.org/package/2006/content-types", DRAWINGML_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main", WORDPROCESSINGML_NS5 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", CORE_PROPERTIES_NS3 = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties", DCTERMS_NS3 = "http://purl.org/dc/terms/", EXTENDED_PROPERTIES_NS2 = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",
|
|
403062
|
+
var DOCUMENT_RELS_URI3 = "/word/_rels/document.xml.rels", DOCUMENT_URI = "/word/document.xml", CONTENT_TYPES_URI3 = "/[Content_Types].xml", SAVE_NOISE_PART_URIS, IMAGE_REL_TYPES, OFFICE_DOCUMENT_RELATIONSHIP_NAMESPACES, PACKAGE_RELATIONSHIPS_NS3 = "http://schemas.openxmlformats.org/package/2006/relationships", CONTENT_TYPES_NS7 = "http://schemas.openxmlformats.org/package/2006/content-types", DRAWINGML_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main", WORDPROCESSINGML_NS5 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", CORE_PROPERTIES_NS3 = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties", DCTERMS_NS3 = "http://purl.org/dc/terms/", EXTENDED_PROPERTIES_NS2 = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", TD121, PROTECTED_BODY_ELEMENTS;
|
|
402662
403063
|
var init_relationship_backed_body_replay = __esm(() => {
|
|
402663
403064
|
init_sd_document_session_internal();
|
|
402664
403065
|
init_part_fingerprint();
|
|
@@ -402671,7 +403072,7 @@ var init_relationship_backed_body_replay = __esm(() => {
|
|
|
402671
403072
|
"http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
402672
403073
|
"http://purl.oclc.org/ooxml/officeDocument/relationships"
|
|
402673
403074
|
]);
|
|
402674
|
-
|
|
403075
|
+
TD121 = new TextDecoder;
|
|
402675
403076
|
PROTECTED_BODY_ELEMENTS = new Set([
|
|
402676
403077
|
"drawing",
|
|
402677
403078
|
"pict",
|
|
@@ -404404,7 +404805,7 @@ class V2DiffAdapter {
|
|
|
404404
404805
|
family: "tables",
|
|
404405
404806
|
partUri: DOCUMENT_PART_URI6,
|
|
404406
404807
|
kind: "modify",
|
|
404407
|
-
nextBytes:
|
|
404808
|
+
nextBytes: TE74.encode(step3.nextXml)
|
|
404408
404809
|
}));
|
|
404409
404810
|
const packageRewrites = [
|
|
404410
404811
|
...slotPlan.rewrites,
|
|
@@ -405008,7 +405409,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
405008
405409
|
family: "styles",
|
|
405009
405410
|
partUri: step3.partUri,
|
|
405010
405411
|
kind: "modify",
|
|
405011
|
-
nextBytes:
|
|
405412
|
+
nextBytes: TE74.encode(step3.nextXml)
|
|
405012
405413
|
});
|
|
405013
405414
|
}
|
|
405014
405415
|
for (const step3 of numberingSteps) {
|
|
@@ -405018,7 +405419,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
405018
405419
|
family: "numbering",
|
|
405019
405420
|
partUri: NUMBERING_PART_URI6,
|
|
405020
405421
|
kind: "modify",
|
|
405021
|
-
nextBytes:
|
|
405422
|
+
nextBytes: TE74.encode(step3.nextXml)
|
|
405022
405423
|
});
|
|
405023
405424
|
}
|
|
405024
405425
|
for (const step3 of settingsSteps) {
|
|
@@ -405026,7 +405427,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
405026
405427
|
family: "settings",
|
|
405027
405428
|
partUri: step3.partUri,
|
|
405028
405429
|
kind: "modify",
|
|
405029
|
-
nextBytes:
|
|
405430
|
+
nextBytes: TE74.encode(step3.nextXml)
|
|
405030
405431
|
});
|
|
405031
405432
|
}
|
|
405032
405433
|
return rewrites;
|
|
@@ -405068,7 +405469,7 @@ function retainedImageRelationshipsChanged(context, payload) {
|
|
|
405068
405469
|
function imageRelationshipsChanged(payload) {
|
|
405069
405470
|
if (!payload.relationshipBackedBody)
|
|
405070
405471
|
return false;
|
|
405071
|
-
return hasImageRelationshipDelta(
|
|
405472
|
+
return hasImageRelationshipDelta(TD122.decode(Uint8Array.from(payload.base.headerFooterPhysical?.documentRelationshipsBytes ?? [])), payload.relationshipBackedBody.target.documentRelationships);
|
|
405072
405473
|
}
|
|
405073
405474
|
function compareBodySemanticsEqual(base3, target) {
|
|
405074
405475
|
if (base3.length !== target.length)
|
|
@@ -405191,7 +405592,7 @@ function packageGraphDeltaIsCoveredByWholeNoteLifecycle(payload) {
|
|
|
405191
405592
|
const relationshipBytes = source.headerFooterPhysical?.documentRelationshipsBytes;
|
|
405192
405593
|
if (!relationshipBytes)
|
|
405193
405594
|
return false;
|
|
405194
|
-
const relationship = parseOpcRelationshipsXml(
|
|
405595
|
+
const relationship = parseOpcRelationshipsXml(TD122.decode(Uint8Array.from(relationshipBytes)))?.elements.find((candidate2) => candidate2.id === relationshipId);
|
|
405195
405596
|
return relationship?.type.endsWith(relationshipType) === true && relationship.targetMode !== "External" && resolveDocumentRelationshipTarget(relationship.target) === partUri;
|
|
405196
405597
|
}));
|
|
405197
405598
|
}
|
|
@@ -405998,7 +406399,7 @@ function stripRootReplayNamespaceDeclarations(xml) {
|
|
|
405998
406399
|
const openEnd = xml.indexOf(">") + 1;
|
|
405999
406400
|
return stripReplayNamespaceDeclarations(xml.slice(0, openEnd)) + xml.slice(openEnd);
|
|
406000
406401
|
}
|
|
406001
|
-
var FULL_DIFF_APPLY_SUPPORTED_FAMILIES,
|
|
406402
|
+
var FULL_DIFF_APPLY_SUPPORTED_FAMILIES, TE74, TD122, DOCUMENT_PART_URI6 = "/word/document.xml", NUMBERING_PART_URI6 = "/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;
|
|
406002
406403
|
var init_adapter26 = __esm(() => {
|
|
406003
406404
|
init_tracked_table_property_replay();
|
|
406004
406405
|
init_src2();
|
|
@@ -406038,8 +406439,8 @@ var init_adapter26 = __esm(() => {
|
|
|
406038
406439
|
"fields-references",
|
|
406039
406440
|
"tracked-changes"
|
|
406040
406441
|
]);
|
|
406041
|
-
|
|
406042
|
-
|
|
406442
|
+
TE74 = new TextEncoder;
|
|
406443
|
+
TD122 = new TextDecoder;
|
|
406043
406444
|
EMPTY_MAIN_DOCUMENT_SOURCE = { xml: "" };
|
|
406044
406445
|
STRUCTURAL_PARA_EDIT_DELETE_WML_NAMES = new Set([
|
|
406045
406446
|
"fldChar",
|
|
@@ -406608,16 +407009,16 @@ class V2GetTextAdapter {
|
|
|
406608
407009
|
if (!bytes)
|
|
406609
407010
|
return "";
|
|
406610
407011
|
const scopedBytes = resolved.descriptor.storyByteRange ? bytes.subarray(resolved.descriptor.storyByteRange[0], resolved.descriptor.storyByteRange[1]) : bytes;
|
|
406611
|
-
return extractVisibleTextFromXml4(
|
|
407012
|
+
return extractVisibleTextFromXml4(TD123.decode(scopedBytes));
|
|
406612
407013
|
}
|
|
406613
407014
|
}
|
|
406614
|
-
var
|
|
407015
|
+
var TD123, extractVisibleTextFromXml4;
|
|
406615
407016
|
var init_adapter29 = __esm(() => {
|
|
406616
407017
|
init_sd_document_session_internal();
|
|
406617
407018
|
init_story_identity();
|
|
406618
407019
|
init_story_surface();
|
|
406619
407020
|
init_visible_text();
|
|
406620
|
-
|
|
407021
|
+
TD123 = new TextDecoder;
|
|
406621
407022
|
extractVisibleTextFromXml4 = extractVisibleTextFromXml;
|
|
406622
407023
|
});
|
|
406623
407024
|
|
|
@@ -406713,7 +407114,7 @@ function collectRunNodes(context, resolved, story) {
|
|
|
406713
407114
|
continue;
|
|
406714
407115
|
if (entry.byteEnd > bytes.length || entry.byteStart < 0 || entry.byteEnd <= entry.byteStart)
|
|
406715
407116
|
continue;
|
|
406716
|
-
const paragraphXml = stripPendingDeletions(
|
|
407117
|
+
const paragraphXml = stripPendingDeletions(TD124.decode(bytes.subarray(entry.byteStart, entry.byteEnd)));
|
|
406717
407118
|
let offset = 0;
|
|
406718
407119
|
for (const runXml of scanRunSpans(paragraphXml)) {
|
|
406719
407120
|
const text4 = extractVisibleTextFromXml4(runXml);
|
|
@@ -406887,7 +407288,7 @@ function readCellText(context, storyId, bodyStart, bodyEnd) {
|
|
|
406887
407288
|
return "";
|
|
406888
407289
|
if (bodyEnd > bytes.length || bodyStart < 0 || bodyEnd <= bodyStart)
|
|
406889
407290
|
return "";
|
|
406890
|
-
return extractVisibleTextFromXml4(
|
|
407291
|
+
return extractVisibleTextFromXml4(TD124.decode(bytes.subarray(bodyStart, bodyEnd)));
|
|
406891
407292
|
}
|
|
406892
407293
|
function addressStory(locator, resolved) {
|
|
406893
407294
|
if (resolved.storyKind === "main")
|
|
@@ -406915,7 +407316,7 @@ function storyPartUriFromId6(storyId) {
|
|
|
406915
407316
|
const uri = storyId.slice(colonIdx + 1);
|
|
406916
407317
|
return uri.startsWith("/") ? uri : `/${uri}`;
|
|
406917
407318
|
}
|
|
406918
|
-
var
|
|
407319
|
+
var TD124, STORY_PART_URI_MAIN = "/word/document.xml";
|
|
406919
407320
|
var init_node_discovery = __esm(() => {
|
|
406920
407321
|
init_sd_document_session_internal();
|
|
406921
407322
|
init_document_reader();
|
|
@@ -406924,7 +407325,7 @@ var init_node_discovery = __esm(() => {
|
|
|
406924
407325
|
init_note_story();
|
|
406925
407326
|
init_textbox_story();
|
|
406926
407327
|
init_within();
|
|
406927
|
-
|
|
407328
|
+
TD124 = new TextDecoder;
|
|
406928
407329
|
});
|
|
406929
407330
|
|
|
406930
407331
|
// ../../../v2/document-api-v2-adapter/dist/styles/theme-values.js
|
|
@@ -407902,7 +408303,7 @@ async function compileOrderedTextProgram(context, sourceSteps, story, evaluatedR
|
|
|
407902
408303
|
const paragraphBytes = getSDDocumentSessionInternalPartRange(context.session, paragraph4.seedRange.partUri, paragraph4.seedRange.paragraphByteStart ?? paragraph4.seedRange.startByte, paragraph4.seedRange.paragraphByteEnd ?? paragraph4.seedRange.endByte);
|
|
407903
408304
|
if (paragraphBytes) {
|
|
407904
408305
|
spans = planTrackedRewriteReplacement(match.text, replacement, {
|
|
407905
|
-
paragraphXml:
|
|
408306
|
+
paragraphXml: TD125.decode(paragraphBytes),
|
|
407906
408307
|
startOffset: match.from
|
|
407907
408308
|
});
|
|
407908
408309
|
}
|
|
@@ -409247,7 +409648,7 @@ function readResolvedText2(context, index2, resolved, cache) {
|
|
|
409247
409648
|
const cacheKey = `${entry.partUri}:${entry.byteStart}:${entry.byteEnd}:${resolved.coordinateSpace ?? "visible"}`;
|
|
409248
409649
|
let paragraphText3 = cache?.paragraphTexts.get(cacheKey);
|
|
409249
409650
|
if (paragraphText3 === undefined) {
|
|
409250
|
-
const paragraphXml =
|
|
409651
|
+
const paragraphXml = TD125.decode(residentBytes ? bytes.subarray(entry.byteStart, entry.byteEnd) : bytes);
|
|
409251
409652
|
paragraphText3 = resolved.coordinateSpace === "tracked" ? readTrackedParagraphText(paragraphXml) : readVisibleParagraphText(paragraphXml);
|
|
409252
409653
|
cache?.paragraphTexts.set(cacheKey, paragraphText3);
|
|
409253
409654
|
}
|
|
@@ -409308,7 +409709,7 @@ function rangesOverlap11(start, end, otherStart, otherEnd) {
|
|
|
409308
409709
|
function elapsed(startedAt) {
|
|
409309
409710
|
return Math.max(0, performance.now() - startedAt);
|
|
409310
409711
|
}
|
|
409311
|
-
var
|
|
409712
|
+
var TD125, BODY_STORY_LOCATOR2, MAX_APPLY_TRACKED_CHANGE_DETAILS = 100, MAX_APPLY_MUTATION_METADATA_DETAILS = 100, DEFAULT_PREVIEW_DETAIL_LIMIT = 100, MAX_PREVIEW_DETAIL_LIMIT = 1000, MAX_LEGACY_NON_REPLACEMENT_TARGETS = 500;
|
|
409312
409713
|
var init_engine3 = __esm(() => {
|
|
409313
409714
|
init_src3();
|
|
409314
409715
|
init_sd_document_session_internal();
|
|
@@ -409330,7 +409731,7 @@ var init_engine3 = __esm(() => {
|
|
|
409330
409731
|
init_text_range_shifts();
|
|
409331
409732
|
init_support_contract();
|
|
409332
409733
|
init_adapter10();
|
|
409333
|
-
|
|
409734
|
+
TD125 = new TextDecoder;
|
|
409334
409735
|
BODY_STORY_LOCATOR2 = { kind: "story", storyType: "body" };
|
|
409335
409736
|
});
|
|
409336
409737
|
|
|
@@ -410008,7 +410409,7 @@ function resolveParagraphEnd(context, entry) {
|
|
|
410008
410409
|
function resolveTrailingZeroWidthParagraphTailByte(bytes, entry, visibleEndByte) {
|
|
410009
410410
|
if (visibleEndByte < entry.byteStart || visibleEndByte > entry.byteEnd)
|
|
410010
410411
|
return visibleEndByte;
|
|
410011
|
-
const paragraphXml =
|
|
410412
|
+
const paragraphXml = TD126.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
410012
410413
|
const closeMatch = paragraphXml.match(/<\/[\w.-]+:p>\s*$/);
|
|
410013
410414
|
if (!closeMatch || closeMatch.index == null)
|
|
410014
410415
|
return visibleEndByte;
|
|
@@ -410027,7 +410428,7 @@ function containsOnlyZeroWidthReferenceTail(xml) {
|
|
|
410027
410428
|
const normalized = stripped.replace(/<[\w.-]+:r\b[^>]*>\s*<\/[\w.-]+:r>/g, "").replace(/<\/[\w.-]+:r>/g, "").replace(/<[\w.-]+:r\b[^>]*>/g, "").replace(/\s+/g, "");
|
|
410028
410429
|
return normalized.length === 0;
|
|
410029
410430
|
}
|
|
410030
|
-
var
|
|
410431
|
+
var TD126;
|
|
410031
410432
|
var init_adapter32 = __esm(() => {
|
|
410032
410433
|
init_applied_change_mode();
|
|
410033
410434
|
init_sd_document_session_internal();
|
|
@@ -410044,7 +410445,7 @@ var init_adapter32 = __esm(() => {
|
|
|
410044
410445
|
init_xml3();
|
|
410045
410446
|
init_paragraph_content();
|
|
410046
410447
|
init_rich_fragment_apply();
|
|
410047
|
-
|
|
410448
|
+
TD126 = new TextDecoder;
|
|
410048
410449
|
});
|
|
410049
410450
|
|
|
410050
410451
|
// ../../../v2/document-api-v2-adapter/dist/search/find-adapter.js
|
|
@@ -411006,7 +411407,7 @@ class V2HyperlinksAdapter {
|
|
|
411006
411407
|
after: {
|
|
411007
411408
|
partUri: entry.partUri,
|
|
411008
411409
|
startByte: entry.descriptor.byteStart,
|
|
411009
|
-
endByte: entry.descriptor.byteEnd +
|
|
411410
|
+
endByte: entry.descriptor.byteEnd + TE75.encode(nextHyperlinkXml).length - TE75.encode(hyperlinkXml).length
|
|
411010
411411
|
},
|
|
411011
411412
|
...input.patch.rel !== undefined ? { rel: input.patch.rel } : {}
|
|
411012
411413
|
}],
|
|
@@ -411240,11 +411641,11 @@ function provePlainBlockHasNoHyperlink(context, query3) {
|
|
|
411240
411641
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, paragraph4.partUri);
|
|
411241
411642
|
if (!bytes || paragraph4.byteStart < 0 || paragraph4.byteEnd > bytes.byteLength)
|
|
411242
411643
|
return null;
|
|
411243
|
-
const paragraphXml =
|
|
411644
|
+
const paragraphXml = TD127.decode(bytes.subarray(paragraph4.byteStart, paragraph4.byteEnd));
|
|
411244
411645
|
if (/<(?:[\w.-]+:)?(?:hyperlink|fldSimple|fldChar|instrText|delInstrText)\b/i.test(paragraphXml)) {
|
|
411245
411646
|
return null;
|
|
411246
411647
|
}
|
|
411247
|
-
const prefixXml =
|
|
411648
|
+
const prefixXml = TD127.decode(bytes.subarray(0, paragraph4.byteStart));
|
|
411248
411649
|
if (hasOpenHyperlinkOrFieldAtEnd(prefixXml))
|
|
411249
411650
|
return null;
|
|
411250
411651
|
return { storyId: body.storyId, partUri: body.partUri };
|
|
@@ -411310,7 +411711,7 @@ function hyperlinkSessionAnchor(partUri, descriptor) {
|
|
|
411310
411711
|
}
|
|
411311
411712
|
function createdHyperlinkAnchor(paragraph4, nextParagraphXml, nextDocumentXml, start, end) {
|
|
411312
411713
|
const catalog = buildHyperlinkCatalog({
|
|
411313
|
-
bytes:
|
|
411714
|
+
bytes: TE75.encode(nextDocumentXml),
|
|
411314
411715
|
storyId: paragraph4.storyId,
|
|
411315
411716
|
partUri: paragraph4.partUri,
|
|
411316
411717
|
relsBytes: null
|
|
@@ -411506,7 +411907,7 @@ function predictInsertedHyperlinkNodeId(context, input) {
|
|
|
411506
411907
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, entry.partUri);
|
|
411507
411908
|
if (!bytes)
|
|
411508
411909
|
return null;
|
|
411509
|
-
const prefix =
|
|
411910
|
+
const prefix = TD127.decode(bytes.subarray(0, entry.byteStart));
|
|
411510
411911
|
const ordinal = countHyperlinkOpenTags(prefix);
|
|
411511
411912
|
return `hl:${input.paraId}:${ordinal}`;
|
|
411512
411913
|
}
|
|
@@ -411636,7 +412037,7 @@ function escapeRegex15(value2) {
|
|
|
411636
412037
|
function defaultRelationshipsXml3() {
|
|
411637
412038
|
return '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
411638
412039
|
}
|
|
411639
|
-
var HYPERLINK_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
412040
|
+
var HYPERLINK_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", TD127, TE75;
|
|
411640
412041
|
var init_adapter34 = __esm(() => {
|
|
411641
412042
|
init_applied_change_mode();
|
|
411642
412043
|
init_sd_document_session_internal();
|
|
@@ -411652,8 +412053,8 @@ var init_adapter34 = __esm(() => {
|
|
|
411652
412053
|
init_document_reader();
|
|
411653
412054
|
init_stories();
|
|
411654
412055
|
init_registry3();
|
|
411655
|
-
|
|
411656
|
-
|
|
412056
|
+
TD127 = new TextDecoder;
|
|
412057
|
+
TE75 = new TextEncoder;
|
|
411657
412058
|
});
|
|
411658
412059
|
|
|
411659
412060
|
// ../../../v2/document-api-v2-adapter/dist/watermarks/serialization.js
|
|
@@ -411916,7 +412317,7 @@ function prepareTargetPart(context, target, additionalTargets = [], allocatePara
|
|
|
411916
412317
|
part: {
|
|
411917
412318
|
refId: materialized.refId,
|
|
411918
412319
|
partUri: materialized.partUri,
|
|
411919
|
-
partXml:
|
|
412320
|
+
partXml: TD128.decode(materialized.partBytes),
|
|
411920
412321
|
contentType: materialized.contentType,
|
|
411921
412322
|
perPart: { ...materialized.perPart },
|
|
411922
412323
|
created: true
|
|
@@ -411932,7 +412333,7 @@ function preparePicturePlan(context, part, input, shapeId, contentTypesXml) {
|
|
|
411932
412333
|
return { ok: false, message: "Header relationships path could not be resolved." };
|
|
411933
412334
|
const preparedRels = part.perPart[relsUri];
|
|
411934
412335
|
const existingRelsBytes = resultingWholePartBytes(context, relsUri, preparedRels);
|
|
411935
|
-
const relsXml = existingRelsBytes ?
|
|
412336
|
+
const relsXml = existingRelsBytes ? TD128.decode(existingRelsBytes) : EMPTY_RELATIONSHIPS_XML4;
|
|
411936
412337
|
const imageRefId = allocateRId2(relsXml);
|
|
411937
412338
|
const mediaPartUri = allocateMediaPartUri(context, decoded.format);
|
|
411938
412339
|
const mediaTarget = relativeTarget3(part.partUri, mediaPartUri);
|
|
@@ -411964,7 +412365,7 @@ function removePictureResources(context, entry, perPart, contentTypesXml) {
|
|
|
411964
412365
|
if (!relsUri || !entry.imageRefId || !entry.mediaPartUri)
|
|
411965
412366
|
return { contentTypesXml };
|
|
411966
412367
|
const relsBytes = readPartBytes2(context, relsUri);
|
|
411967
|
-
const relsXml = relsBytes ?
|
|
412368
|
+
const relsXml = relsBytes ? TD128.decode(relsBytes) : EMPTY_RELATIONSHIPS_XML4;
|
|
411968
412369
|
const remainingPartXml = replaceExactlyOnce4(entry.partXml, entry.pictXml, "");
|
|
411969
412370
|
if (remainingPartXml && [...remainingPartXml.matchAll(/<[A-Za-z_][^>]*>/g)].some((match) => ["r:id", "r:embed", "r:link"].some((attribute3) => xmlAttribute3(match[0], attribute3) === entry.imageRefId))) {
|
|
411970
412371
|
return { contentTypesXml };
|
|
@@ -412084,7 +412485,7 @@ function contentTypesXmlForPrepared(context, part) {
|
|
|
412084
412485
|
if (current) {
|
|
412085
412486
|
const replacement = entry.patches.find((patch) => patch.kind === "replaceBytes" && patch.startByte === 0 && patch.endByte === current.length);
|
|
412086
412487
|
if (replacement?.kind === "replaceBytes")
|
|
412087
|
-
return
|
|
412488
|
+
return TD128.decode(replacement.bytes);
|
|
412088
412489
|
}
|
|
412089
412490
|
}
|
|
412090
412491
|
return readPartXml(context, CONTENT_TYPES_PART_URI14) ?? "";
|
|
@@ -412258,7 +412659,7 @@ function readAspectLock(pictXml) {
|
|
|
412258
412659
|
return /^(?:t|true|1)$/.test(instanceLock[1] ?? instanceLock[2] ?? "");
|
|
412259
412660
|
return /<o:lock\b[^>]*\baspectratio=["'](?:t|true|1)["']/.test(pictXml);
|
|
412260
412661
|
}
|
|
412261
|
-
var IMAGE_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", RELATIONSHIPS_CT2 = "application/vnd.openxmlformats-package.relationships+xml", EMPTY_RELATIONSHIPS_XML4,
|
|
412662
|
+
var IMAGE_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", RELATIONSHIPS_CT2 = "application/vnd.openxmlformats-package.relationships+xml", EMPTY_RELATIONSHIPS_XML4, TD128;
|
|
412262
412663
|
var init_parts = __esm(() => {
|
|
412263
412664
|
init_sd_document_session_internal();
|
|
412264
412665
|
init_adapter18();
|
|
@@ -412269,7 +412670,7 @@ var init_parts = __esm(() => {
|
|
|
412269
412670
|
init_xml3();
|
|
412270
412671
|
init_serialization();
|
|
412271
412672
|
EMPTY_RELATIONSHIPS_XML4 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
412272
|
-
|
|
412673
|
+
TD128 = new TextDecoder;
|
|
412273
412674
|
});
|
|
412274
412675
|
|
|
412275
412676
|
// ../../../v2/document-api-v2-adapter/dist/watermarks/scoped-apply.js
|
|
@@ -414930,7 +415331,7 @@ function renderPiece(piece, paragraphXml, from, to, tracked, whole, context) {
|
|
|
414930
415331
|
if (parsed.errors.length)
|
|
414931
415332
|
invalid4("PRECONDITION_FAILED", `Selected content control cannot be parsed: ${parsed.errors[0]}`);
|
|
414932
415333
|
const root = treeFromRanges(parsed.ranges)[0];
|
|
414933
|
-
const content3 = root?.children.find((child) => child.range.tag.namespaceUri ===
|
|
415334
|
+
const content3 = root?.children.find((child) => child.range.tag.namespaceUri === W27 && child.range.tag.localName === "sdtContent");
|
|
414934
415335
|
if (!content3)
|
|
414935
415336
|
invalid4("PRECONDITION_FAILED", "Selected content control has no content element.");
|
|
414936
415337
|
return `${piece.rawXml.slice(0, content3.range.openEnd)}${children2}` + piece.rawXml.slice(content3.range.closeStart);
|
|
@@ -415004,10 +415405,10 @@ function treeFromRanges(ranges) {
|
|
|
415004
415405
|
}
|
|
415005
415406
|
function renderStructuralSelection(node4, xml, paragraphs, selectedCells, selectedInterval) {
|
|
415006
415407
|
const { range } = node4;
|
|
415007
|
-
if (selectedCells?.has(range.start) && range.tag.namespaceUri ===
|
|
415408
|
+
if (selectedCells?.has(range.start) && range.tag.namespaceUri === W27 && range.tag.localName === "tc") {
|
|
415008
415409
|
return xml.slice(range.start, range.end);
|
|
415009
415410
|
}
|
|
415010
|
-
if (range.tag.namespaceUri ===
|
|
415411
|
+
if (range.tag.namespaceUri === W27 && range.tag.localName === "p") {
|
|
415011
415412
|
return paragraphs.get(range.start)?.xml ?? "";
|
|
415012
415413
|
}
|
|
415013
415414
|
if (selectedInterval && range.start >= selectedInterval.start && range.end <= selectedInterval.end) {
|
|
@@ -415022,9 +415423,9 @@ function renderStructuralSelection(node4, xml, paragraphs, selectedCells, select
|
|
|
415022
415423
|
const inner = rendered.map(({ node: child, xml: selected }) => {
|
|
415023
415424
|
if (selected)
|
|
415024
415425
|
return selected;
|
|
415025
|
-
return child.range.tag.namespaceUri ===
|
|
415426
|
+
return child.range.tag.namespaceUri === W27 && PROPERTY_NODES.has(child.range.tag.localName) ? xml.slice(child.range.start, child.range.end) : "";
|
|
415026
415427
|
}).join("");
|
|
415027
|
-
if (range.tag.namespaceUri ===
|
|
415428
|
+
if (range.tag.namespaceUri === W27 && [
|
|
415028
415429
|
"body",
|
|
415029
415430
|
"document",
|
|
415030
415431
|
"hdr",
|
|
@@ -415048,7 +415449,7 @@ function clipElementToSourceRange(node4, xml, start, end) {
|
|
|
415048
415449
|
invalid4("PRECONDITION_FAILED", "Selected field boundary cuts through an indivisible XML element.");
|
|
415049
415450
|
}
|
|
415050
415451
|
const children2 = node4.children.map((child) => {
|
|
415051
|
-
if (range.tag.namespaceUri ===
|
|
415452
|
+
if (range.tag.namespaceUri === W27 && ["pPr", "rPr"].includes(child.range.tag.localName)) {
|
|
415052
415453
|
return xml.slice(child.range.start, child.range.end);
|
|
415053
415454
|
}
|
|
415054
415455
|
return clipElementToSourceRange(child, xml, start, end);
|
|
@@ -415056,34 +415457,34 @@ function clipElementToSourceRange(node4, xml, start, end) {
|
|
|
415056
415457
|
return `${xml.slice(range.start, range.openEnd)}${children2}${xml.slice(range.closeStart, range.end)}`;
|
|
415057
415458
|
}
|
|
415058
415459
|
function wordId2(range) {
|
|
415059
|
-
return range.tag.attributes.find((attribute3) => attribute3.namespaceUri ===
|
|
415460
|
+
return range.tag.attributes.find((attribute3) => attribute3.namespaceUri === W27 && attribute3.localName === "id")?.value ?? null;
|
|
415060
415461
|
}
|
|
415061
415462
|
function clipReferencedDefinitions(bytes, kind, ids) {
|
|
415062
|
-
const xml =
|
|
415463
|
+
const xml = TD129.decode(bytes);
|
|
415063
415464
|
const parsed = collectXmlElementRanges(xml);
|
|
415064
415465
|
if (parsed.errors.length)
|
|
415065
415466
|
invalid4("PRECONDITION_FAILED", `${kind} definitions cannot be parsed: ${parsed.errors[0]}`);
|
|
415066
415467
|
const root = treeFromRanges(parsed.ranges)[0];
|
|
415067
415468
|
if (!root)
|
|
415068
415469
|
invalid4("PRECONDITION_FAILED", `${kind} definitions have no XML root.`);
|
|
415069
|
-
const children2 = root.children.filter((child) => child.range.tag.namespaceUri ===
|
|
415470
|
+
const children2 = root.children.filter((child) => child.range.tag.namespaceUri === W27 && child.range.tag.localName === kind && ids.has(wordId2(child.range) ?? ""));
|
|
415070
415471
|
if (children2.length !== ids.size) {
|
|
415071
415472
|
invalid4("PRECONDITION_FAILED", `Selected ${kind} definition is missing.`);
|
|
415072
415473
|
}
|
|
415073
|
-
return
|
|
415474
|
+
return TE76.encode(`${xml.slice(root.range.start, root.range.openEnd)}` + children2.map((child) => xml.slice(child.range.start, child.range.end)).join("") + xml.slice(root.range.closeStart, root.range.end));
|
|
415074
415475
|
}
|
|
415075
415476
|
function wordValue(range, name) {
|
|
415076
|
-
return range.tag.attributes.find((attribute3) => attribute3.namespaceUri ===
|
|
415477
|
+
return range.tag.attributes.find((attribute3) => attribute3.namespaceUri === W27 && attribute3.localName === name)?.value ?? null;
|
|
415077
415478
|
}
|
|
415078
415479
|
function clipStylesPart(bytes, requestedIds) {
|
|
415079
|
-
const xml =
|
|
415480
|
+
const xml = TD129.decode(bytes);
|
|
415080
415481
|
const parsed = collectXmlElementRanges(xml);
|
|
415081
415482
|
if (parsed.errors.length)
|
|
415082
415483
|
invalid4("PRECONDITION_FAILED", `Style definitions cannot be parsed: ${parsed.errors[0]}`);
|
|
415083
415484
|
const root = treeFromRanges(parsed.ranges)[0];
|
|
415084
415485
|
if (!root)
|
|
415085
415486
|
invalid4("PRECONDITION_FAILED", "Style definitions have no XML root.");
|
|
415086
|
-
const styles = root.children.filter((node4) => node4.range.tag.namespaceUri ===
|
|
415487
|
+
const styles = root.children.filter((node4) => node4.range.tag.namespaceUri === W27 && node4.range.tag.localName === "style");
|
|
415087
415488
|
const wanted = new Set(requestedIds);
|
|
415088
415489
|
for (const style of styles) {
|
|
415089
415490
|
if (wordValue(style.range, "default") === "1") {
|
|
@@ -415100,7 +415501,7 @@ function clipStylesPart(bytes, requestedIds) {
|
|
|
415100
415501
|
if (!id || !wanted.has(id))
|
|
415101
415502
|
continue;
|
|
415102
415503
|
for (const child of style.children) {
|
|
415103
|
-
if (child.range.tag.namespaceUri !==
|
|
415504
|
+
if (child.range.tag.namespaceUri !== W27 || !["basedOn", "link"].includes(child.range.tag.localName))
|
|
415104
415505
|
continue;
|
|
415105
415506
|
const next = wordValue(child.range, "val");
|
|
415106
415507
|
if (next)
|
|
@@ -415113,27 +415514,27 @@ function clipStylesPart(bytes, requestedIds) {
|
|
|
415113
415514
|
invalid4("PRECONDITION_FAILED", `Selected style ${id} is missing.`);
|
|
415114
415515
|
}
|
|
415115
415516
|
}
|
|
415116
|
-
const retained = root.children.filter((node4) => node4.range.tag.namespaceUri ===
|
|
415117
|
-
return
|
|
415517
|
+
const retained = root.children.filter((node4) => node4.range.tag.namespaceUri === W27 && (node4.range.tag.localName === "docDefaults" || node4.range.tag.localName === "style" && wanted.has(wordValue(node4.range, "styleId") ?? "")));
|
|
415518
|
+
return TE76.encode(xml.slice(root.range.start, root.range.openEnd) + retained.map((node4) => xml.slice(node4.range.start, node4.range.end)).join("") + xml.slice(root.range.closeStart, root.range.end));
|
|
415118
415519
|
}
|
|
415119
415520
|
function clipNumberingPart(bytes, requestedIds) {
|
|
415120
|
-
const xml =
|
|
415521
|
+
const xml = TD129.decode(bytes);
|
|
415121
415522
|
const parsed = collectXmlElementRanges(xml);
|
|
415122
415523
|
if (parsed.errors.length)
|
|
415123
415524
|
invalid4("PRECONDITION_FAILED", `Numbering definitions cannot be parsed: ${parsed.errors[0]}`);
|
|
415124
415525
|
const root = treeFromRanges(parsed.ranges)[0];
|
|
415125
415526
|
if (!root)
|
|
415126
415527
|
invalid4("PRECONDITION_FAILED", "Numbering definitions have no XML root.");
|
|
415127
|
-
const numbers = root.children.filter((node4) => node4.range.tag.namespaceUri ===
|
|
415528
|
+
const numbers = root.children.filter((node4) => node4.range.tag.namespaceUri === W27 && node4.range.tag.localName === "num" && requestedIds.has(wordValue(node4.range, "numId") ?? ""));
|
|
415128
415529
|
if (numbers.length !== requestedIds.size)
|
|
415129
415530
|
invalid4("PRECONDITION_FAILED", "Selected numbering definition is missing.");
|
|
415130
|
-
const abstractIds = new Set(numbers.flatMap((node4) => node4.children.filter((child) => child.range.tag.namespaceUri ===
|
|
415131
|
-
const abstracts = root.children.filter((node4) => node4.range.tag.namespaceUri ===
|
|
415531
|
+
const abstractIds = new Set(numbers.flatMap((node4) => node4.children.filter((child) => child.range.tag.namespaceUri === W27 && child.range.tag.localName === "abstractNumId").map((child) => wordValue(child.range, "val")).filter((id) => id != null)));
|
|
415532
|
+
const abstracts = root.children.filter((node4) => node4.range.tag.namespaceUri === W27 && node4.range.tag.localName === "abstractNum" && abstractIds.has(wordValue(node4.range, "abstractNumId") ?? ""));
|
|
415132
415533
|
if (abstracts.length !== abstractIds.size)
|
|
415133
415534
|
invalid4("PRECONDITION_FAILED", "Selected abstract numbering definition is missing.");
|
|
415134
|
-
const pictureIds = new Set(abstracts.flatMap((node4) => parsed.ranges.filter((range) => range.start > node4.range.start && range.end < node4.range.end && range.tag.namespaceUri ===
|
|
415135
|
-
const retained = root.children.filter((node4) => node4.range.tag.namespaceUri ===
|
|
415136
|
-
return
|
|
415535
|
+
const pictureIds = new Set(abstracts.flatMap((node4) => parsed.ranges.filter((range) => range.start > node4.range.start && range.end < node4.range.end && range.tag.namespaceUri === W27 && range.tag.localName === "lvlPicBulletId").map((range) => wordValue(range, "val")).filter((id) => id != null)));
|
|
415536
|
+
const retained = root.children.filter((node4) => node4.range.tag.namespaceUri === W27 && (node4.range.tag.localName === "num" && requestedIds.has(wordValue(node4.range, "numId") ?? "") || node4.range.tag.localName === "abstractNum" && abstractIds.has(wordValue(node4.range, "abstractNumId") ?? "") || node4.range.tag.localName === "numPicBullet" && pictureIds.has(wordValue(node4.range, "numPicBulletId") ?? "")));
|
|
415537
|
+
return TE76.encode(xml.slice(root.range.start, root.range.openEnd) + retained.map((node4) => xml.slice(node4.range.start, node4.range.end)).join("") + xml.slice(root.range.closeStart, root.range.end));
|
|
415137
415538
|
}
|
|
415138
415539
|
function collectPairedMarkerContext(partXml, ranges, selectionStart, selectionEnd, context) {
|
|
415139
415540
|
const pairs = [
|
|
@@ -415146,7 +415547,7 @@ function collectPairedMarkerContext(partXml, ranges, selectionStart, selectionEn
|
|
|
415146
415547
|
for (const [startName, endName] of pairs) {
|
|
415147
415548
|
const starts = new Map;
|
|
415148
415549
|
for (const range of ranges) {
|
|
415149
|
-
if (range.tag.namespaceUri !==
|
|
415550
|
+
if (range.tag.namespaceUri !== W27)
|
|
415150
415551
|
continue;
|
|
415151
415552
|
const id = wordId2(range);
|
|
415152
415553
|
if (!id)
|
|
@@ -415165,7 +415566,7 @@ function collectPairedMarkerContext(partXml, ranges, selectionStart, selectionEn
|
|
|
415165
415566
|
}
|
|
415166
415567
|
function collectComplexFieldContext(partXml, ranges, selectionStart, selectionEnd, context) {
|
|
415167
415568
|
const stack = [];
|
|
415168
|
-
const sorted = ranges.filter((range) => range.tag.namespaceUri ===
|
|
415569
|
+
const sorted = ranges.filter((range) => range.tag.namespaceUri === W27 && (range.tag.localName === "fldChar" || range.tag.localName === "instrText")).sort((a, b) => a.start - b.start);
|
|
415169
415570
|
for (const range of sorted) {
|
|
415170
415571
|
if (range.tag.localName === "instrText") {
|
|
415171
415572
|
stack.at(-1)?.instructions.push(range);
|
|
@@ -415192,13 +415593,13 @@ function collectComplexFieldContext(partXml, ranges, selectionStart, selectionEn
|
|
|
415192
415593
|
}
|
|
415193
415594
|
}
|
|
415194
415595
|
function collectAncestorProperties(node4, partXml, paragraphStart, context) {
|
|
415195
|
-
if (node4.range.start === paragraphStart && node4.range.tag.namespaceUri ===
|
|
415596
|
+
if (node4.range.start === paragraphStart && node4.range.tag.namespaceUri === W27 && node4.range.tag.localName === "p")
|
|
415196
415597
|
return true;
|
|
415197
415598
|
const includes = node4.children.some((child) => collectAncestorProperties(child, partXml, paragraphStart, context));
|
|
415198
415599
|
if (!includes)
|
|
415199
415600
|
return false;
|
|
415200
415601
|
for (const child of node4.children) {
|
|
415201
|
-
if (child.range.tag.namespaceUri ===
|
|
415602
|
+
if (child.range.tag.namespaceUri === W27 && PROPERTY_NODES.has(child.range.tag.localName)) {
|
|
415202
415603
|
context.add(partXml.slice(child.range.start, child.range.end));
|
|
415203
415604
|
}
|
|
415204
415605
|
}
|
|
@@ -415211,19 +415612,19 @@ function captureTableSelection(context, at, resultAt = at, whole = false) {
|
|
|
415211
415612
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, story.partUri);
|
|
415212
415613
|
if (!bytes)
|
|
415213
415614
|
invalid4("PRECONDITION_FAILED", "Source story bytes are unavailable.");
|
|
415214
|
-
const partXml =
|
|
415615
|
+
const partXml = TD129.decode(bytes);
|
|
415215
415616
|
const parsed = collectXmlElementRanges(partXml);
|
|
415216
415617
|
if (parsed.errors.length)
|
|
415217
415618
|
invalid4("PRECONDITION_FAILED", `Source story XML cannot be parsed: ${parsed.errors[0]}`);
|
|
415218
415619
|
const catalog = buildTableCatalog({ bytes, storyId: story.storyId });
|
|
415219
415620
|
let table = catalog.byTableId.get(at.tableId);
|
|
415220
415621
|
if (!table) {
|
|
415221
|
-
for (const range of parsed.ranges.filter((candidate2) => candidate2.tag.namespaceUri ===
|
|
415222
|
-
const nested = parsed.ranges.some((ancestor) => ancestor.start < range.start && ancestor.end > range.end && ancestor.tag.namespaceUri ===
|
|
415622
|
+
for (const range of parsed.ranges.filter((candidate2) => candidate2.tag.namespaceUri === W27 && candidate2.tag.localName === "tbl")) {
|
|
415623
|
+
const nested = parsed.ranges.some((ancestor) => ancestor.start < range.start && ancestor.end > range.end && ancestor.tag.namespaceUri === W27 && ancestor.tag.localName === "tbl");
|
|
415223
415624
|
if (!nested)
|
|
415224
415625
|
continue;
|
|
415225
|
-
const byteStart =
|
|
415226
|
-
const byteEnd =
|
|
415626
|
+
const byteStart = TE76.encode(partXml.slice(0, range.start)).byteLength;
|
|
415627
|
+
const byteEnd = TE76.encode(partXml.slice(0, range.end)).byteLength;
|
|
415227
415628
|
const nestedCatalog = buildTableCatalog({
|
|
415228
415629
|
bytes: bytes.subarray(byteStart, byteEnd),
|
|
415229
415630
|
storyId: story.storyId,
|
|
@@ -415255,7 +415656,7 @@ function captureTableSelection(context, at, resultAt = at, whole = false) {
|
|
|
415255
415656
|
const overlapsColumns = cell.gridColumnStart <= at.end.columnIndex && cell.gridColumnStart + cell.gridSpan > at.start.columnIndex;
|
|
415256
415657
|
if (!overlapsColumns)
|
|
415257
415658
|
continue;
|
|
415258
|
-
selectedCells.add(
|
|
415659
|
+
selectedCells.add(TD129.decode(bytes.subarray(0, cell.cellByteStart)).length);
|
|
415259
415660
|
includedCells.push({
|
|
415260
415661
|
rowIndex: row.rowIndex,
|
|
415261
415662
|
columnIndex: cell.gridColumnStart,
|
|
@@ -415279,14 +415680,14 @@ function captureTableSelection(context, at, resultAt = at, whole = false) {
|
|
|
415279
415680
|
}
|
|
415280
415681
|
}
|
|
415281
415682
|
}
|
|
415282
|
-
const tableCharStart =
|
|
415283
|
-
const tableCharEnd =
|
|
415683
|
+
const tableCharStart = TD129.decode(bytes.subarray(0, table.tableByteStart)).length;
|
|
415684
|
+
const tableCharEnd = TD129.decode(bytes.subarray(0, table.tableByteEnd)).length;
|
|
415284
415685
|
const root = treeFromRanges(parsed.ranges.filter((range) => range.start >= tableCharStart && range.end <= tableCharEnd))[0];
|
|
415285
415686
|
if (!root)
|
|
415286
415687
|
invalid4("PRECONDITION_FAILED", "Source story has no XML root.");
|
|
415287
|
-
const rawXml = whole ?
|
|
415688
|
+
const rawXml = whole ? TD129.decode(bytes.subarray(table.tableByteStart, table.tableByteEnd)) : renderStructuralSelection(root, partXml, selected, selectedCells);
|
|
415288
415689
|
const tableRange = parsed.ranges.find((range) => range.start === tableCharStart);
|
|
415289
|
-
const namespaces = { ...tableRange?.namespaceBindings ?? root.range.namespaceBindings, w:
|
|
415690
|
+
const namespaces = { ...tableRange?.namespaceBindings ?? root.range.namespaceBindings, w: W27 };
|
|
415290
415691
|
delete namespaces.xml;
|
|
415291
415692
|
const dependencies = captureDependencies(context, story.partUri, rawXml, namespaces, story.relationshipOwnerPartUri);
|
|
415292
415693
|
const tableMerges = [];
|
|
@@ -415298,9 +415699,9 @@ function captureTableSelection(context, at, resultAt = at, whole = false) {
|
|
|
415298
415699
|
break;
|
|
415299
415700
|
if (prior.vMerge !== "restart")
|
|
415300
415701
|
continue;
|
|
415301
|
-
const cellStart =
|
|
415302
|
-
const cellEnd =
|
|
415303
|
-
const properties = parsed.ranges.find((range) => range.start > cellStart && range.end < cellEnd && range.tag.namespaceUri ===
|
|
415702
|
+
const cellStart = TD129.decode(bytes.subarray(0, prior.cellByteStart)).length;
|
|
415703
|
+
const cellEnd = TD129.decode(bytes.subarray(0, prior.cellByteEnd)).length;
|
|
415704
|
+
const properties = parsed.ranges.find((range) => range.start > cellStart && range.end < cellEnd && range.tag.namespaceUri === W27 && range.tag.localName === "tcPr");
|
|
415304
415705
|
if (properties) {
|
|
415305
415706
|
tableMerges.push({
|
|
415306
415707
|
selectedRowIndex: selectedCell.rowIndex,
|
|
@@ -415351,7 +415752,7 @@ function captureDependencies(context, sourcePartUri, xml, namespaces, definition
|
|
|
415351
415752
|
const bytes = readCapturePartBytes(context, candidate2.resolvedTarget);
|
|
415352
415753
|
if (!bytes)
|
|
415353
415754
|
return false;
|
|
415354
|
-
const properties = collectXmlElementRanges(
|
|
415755
|
+
const properties = collectXmlElementRanges(TD129.decode(bytes));
|
|
415355
415756
|
if (properties.errors.length)
|
|
415356
415757
|
return false;
|
|
415357
415758
|
return properties.ranges.some((range) => range.tag.attributes.some((attribute3) => attribute3.localName === "itemID" && attribute3.value.toLowerCase() === storeItemId.toLowerCase()));
|
|
@@ -415393,12 +415794,12 @@ function captureDependencies(context, sourcePartUri, xml, namespaces, definition
|
|
|
415393
415794
|
if (attr4.namespaceUri === R2) {
|
|
415394
415795
|
ids.add(attr4.value);
|
|
415395
415796
|
}
|
|
415396
|
-
if (range.tag.namespaceUri ===
|
|
415797
|
+
if (range.tag.namespaceUri === W27 && attr4.namespaceUri === W27 && (attr4.localName.startsWith("theme") || attr4.localName.endsWith("Theme"))) {
|
|
415397
415798
|
needsTheme = true;
|
|
415398
415799
|
anyThemeReference = true;
|
|
415399
415800
|
}
|
|
415400
415801
|
}
|
|
415401
|
-
if (range.tag.namespaceUri !==
|
|
415802
|
+
if (range.tag.namespaceUri !== W27)
|
|
415402
415803
|
continue;
|
|
415403
415804
|
if (range.tag.localName === "pStyle" || range.tag.localName === "rStyle" || range.tag.localName === "tblStyle") {
|
|
415404
415805
|
needsStyles = true;
|
|
@@ -415436,7 +415837,7 @@ function captureDependencies(context, sourcePartUri, xml, namespaces, definition
|
|
|
415436
415837
|
endnoteIds.add(id);
|
|
415437
415838
|
}
|
|
415438
415839
|
if (range.tag.localName === "dataBinding") {
|
|
415439
|
-
const id = range.tag.attributes.find((attribute3) => attribute3.namespaceUri ===
|
|
415840
|
+
const id = range.tag.attributes.find((attribute3) => attribute3.namespaceUri === W27 && attribute3.localName === "storeItemID")?.value;
|
|
415440
415841
|
if (id)
|
|
415441
415842
|
storeItemIds.add(id);
|
|
415442
415843
|
}
|
|
@@ -415457,9 +415858,9 @@ function captureDependencies(context, sourcePartUri, xml, namespaces, definition
|
|
|
415457
415858
|
invalid4("PRECONDITION_FAILED", "Selected style definitions are unavailable.");
|
|
415458
415859
|
const included = clipStylesPart(bytes, styleIds);
|
|
415459
415860
|
clippedStyles.set(rel.resolvedTarget, included);
|
|
415460
|
-
const includedStyles = collectXmlElementRanges(
|
|
415861
|
+
const includedStyles = collectXmlElementRanges(TD129.decode(included));
|
|
415461
415862
|
for (const range of includedStyles.ranges) {
|
|
415462
|
-
if (range.tag.namespaceUri !==
|
|
415863
|
+
if (range.tag.namespaceUri !== W27 || range.tag.localName !== "numId")
|
|
415463
415864
|
continue;
|
|
415464
415865
|
const id = wordValue(range, "val");
|
|
415465
415866
|
if (id && id !== "0")
|
|
@@ -415499,7 +415900,7 @@ function captureDependencies(context, sourcePartUri, xml, namespaces, definition
|
|
|
415499
415900
|
}
|
|
415500
415901
|
record3.dataBase64 = bytesToBase64(includedBytes);
|
|
415501
415902
|
if (record3.contentType?.includes("xml") || rel.resolvedTarget.endsWith(".xml")) {
|
|
415502
|
-
queue.push({ partUri: rel.resolvedTarget, xml:
|
|
415903
|
+
queue.push({ partUri: rel.resolvedTarget, xml: TD129.decode(includedBytes), includeDefinitions: false });
|
|
415503
415904
|
}
|
|
415504
415905
|
}
|
|
415505
415906
|
dependencies.push(record3);
|
|
@@ -415565,14 +415966,14 @@ function captureDependencies(context, sourcePartUri, xml, namespaces, definition
|
|
|
415565
415966
|
const previousNumbers = allNumberIds.size;
|
|
415566
415967
|
attachImplicitDependency("styles", (bytes) => {
|
|
415567
415968
|
const clipped = clipStylesPart(bytes, allStyleIds);
|
|
415568
|
-
const parsed = collectXmlElementRanges(
|
|
415969
|
+
const parsed = collectXmlElementRanges(TD129.decode(clipped));
|
|
415569
415970
|
if (parsed.errors.length)
|
|
415570
415971
|
invalid4("PRECONDITION_FAILED", `Selected style definitions cannot be parsed: ${parsed.errors[0]}`);
|
|
415571
415972
|
for (const range of parsed.ranges) {
|
|
415572
|
-
if (range.tag.namespaceUri ===
|
|
415973
|
+
if (range.tag.namespaceUri === W27 && range.tag.attributes.some((attribute3) => attribute3.namespaceUri === W27 && (attribute3.localName.startsWith("theme") || attribute3.localName.endsWith("Theme")))) {
|
|
415573
415974
|
anyThemeReference = true;
|
|
415574
415975
|
}
|
|
415575
|
-
if (range.tag.namespaceUri !==
|
|
415976
|
+
if (range.tag.namespaceUri !== W27 || range.tag.localName !== "numId")
|
|
415576
415977
|
continue;
|
|
415577
415978
|
const id = wordValue(range, "val");
|
|
415578
415979
|
if (id && id !== "0")
|
|
@@ -415583,13 +415984,13 @@ function captureDependencies(context, sourcePartUri, xml, namespaces, definition
|
|
|
415583
415984
|
if (allNumberIds.size)
|
|
415584
415985
|
attachImplicitDependency("numbering", (bytes) => {
|
|
415585
415986
|
const clipped = clipNumberingPart(bytes, allNumberIds);
|
|
415586
|
-
const parsed = collectXmlElementRanges(
|
|
415987
|
+
const parsed = collectXmlElementRanges(TD129.decode(clipped));
|
|
415587
415988
|
if (parsed.errors.length)
|
|
415588
415989
|
invalid4("PRECONDITION_FAILED", `Selected numbering definitions cannot be parsed: ${parsed.errors[0]}`);
|
|
415589
415990
|
for (const range of parsed.ranges) {
|
|
415590
|
-
if (range.tag.namespaceUri !==
|
|
415991
|
+
if (range.tag.namespaceUri !== W27)
|
|
415591
415992
|
continue;
|
|
415592
|
-
if (range.tag.attributes.some((attribute3) => attribute3.namespaceUri ===
|
|
415993
|
+
if (range.tag.attributes.some((attribute3) => attribute3.namespaceUri === W27 && (attribute3.localName.startsWith("theme") || attribute3.localName.endsWith("Theme")))) {
|
|
415593
415994
|
anyThemeReference = true;
|
|
415594
415995
|
}
|
|
415595
415996
|
if (!["pStyle", "rStyle", "tblStyle", "styleLink", "numStyleLink"].includes(range.tag.localName))
|
|
@@ -415619,7 +416020,7 @@ function captureDependencies(context, sourcePartUri, xml, namespaces, definition
|
|
|
415619
416020
|
const decoded = parent.dataBase64 ? base64ToBytes(parent.dataBase64, MAX_CAPTURE_DEPENDENCY_BYTES) : null;
|
|
415620
416021
|
if (!decoded)
|
|
415621
416022
|
invalid4("PRECONDITION_FAILED", `Selected dependency ${parent.target} cannot be decoded.`);
|
|
415622
|
-
const parsed = collectXmlElementRanges(
|
|
416023
|
+
const parsed = collectXmlElementRanges(TD129.decode(decoded));
|
|
415623
416024
|
if (parsed.errors.length)
|
|
415624
416025
|
invalid4("PRECONDITION_FAILED", `Selected dependency ${parent.target} cannot be parsed.`);
|
|
415625
416026
|
const ids = new Set(parsed.ranges.flatMap((range) => range.tag.attributes.filter((attribute3) => attribute3.namespaceUri === R2).map((attribute3) => attribute3.value)));
|
|
@@ -415676,18 +416077,18 @@ function captureImageNodeSelection(context, at) {
|
|
|
415676
416077
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, entry.partUri);
|
|
415677
416078
|
if (!bytes)
|
|
415678
416079
|
invalid4("PRECONDITION_FAILED", "Source story bytes are unavailable.");
|
|
415679
|
-
const partXml =
|
|
416080
|
+
const partXml = TD129.decode(bytes);
|
|
415680
416081
|
const parsed = collectXmlElementRanges(partXml);
|
|
415681
416082
|
if (parsed.errors.length)
|
|
415682
416083
|
invalid4("PRECONDITION_FAILED", `Source story XML cannot be parsed: ${parsed.errors[0]}`);
|
|
415683
|
-
const drawingStart =
|
|
415684
|
-
const drawing = parsed.ranges.find((range) => range.start === drawingStart && range.tag.namespaceUri ===
|
|
416084
|
+
const drawingStart = TD129.decode(bytes.subarray(0, entry.descriptor.byteStart)).length;
|
|
416085
|
+
const drawing = parsed.ranges.find((range) => range.start === drawingStart && range.tag.namespaceUri === W27 && range.tag.localName === "drawing");
|
|
415685
416086
|
if (!drawing)
|
|
415686
416087
|
invalid4("PRECONDITION_FAILED", "Selected image drawing was not found in its source story.");
|
|
415687
|
-
const run = parsed.ranges.filter((range) => range.start < drawing.start && range.end > drawing.end && range.tag.namespaceUri ===
|
|
415688
|
-
const runProperties = run && parsed.ranges.find((range) => range.start >= run.openEnd && range.end < drawing.start && range.tag.namespaceUri ===
|
|
416088
|
+
const run = parsed.ranges.filter((range) => range.start < drawing.start && range.end > drawing.end && range.tag.namespaceUri === W27 && range.tag.localName === "r").at(-1);
|
|
416089
|
+
const runProperties = run && parsed.ranges.find((range) => range.start >= run.openEnd && range.end < drawing.start && range.tag.namespaceUri === W27 && range.tag.localName === "rPr");
|
|
415689
416090
|
const rawXml = `<w:r>${runProperties ? partXml.slice(runProperties.start, runProperties.end) : ""}` + `${partXml.slice(drawing.start, drawing.end)}</w:r>`;
|
|
415690
|
-
const namespaces = { ...drawing.namespaceBindings, w:
|
|
416091
|
+
const namespaces = { ...drawing.namespaceBindings, w: W27 };
|
|
415691
416092
|
delete namespaces.xml;
|
|
415692
416093
|
return {
|
|
415693
416094
|
formatVersion: 1,
|
|
@@ -415745,15 +416146,15 @@ function captureParagraphNodeSelection(context, at) {
|
|
|
415745
416146
|
diagnostics: []
|
|
415746
416147
|
};
|
|
415747
416148
|
}
|
|
415748
|
-
const partXml =
|
|
416149
|
+
const partXml = TD129.decode(bytes);
|
|
415749
416150
|
const parsed = collectXmlElementRanges(partXml);
|
|
415750
416151
|
if (parsed.errors.length)
|
|
415751
416152
|
invalid4("PRECONDITION_FAILED", `Source story XML cannot be parsed: ${parsed.errors[0]}`);
|
|
415752
|
-
const charStart =
|
|
415753
|
-
const range = parsed.ranges.find((candidate2) => candidate2.start === charStart && candidate2.tag.namespaceUri ===
|
|
416153
|
+
const charStart = TD129.decode(bytes.subarray(0, paragraph4.byteStart)).length;
|
|
416154
|
+
const range = parsed.ranges.find((candidate2) => candidate2.start === charStart && candidate2.tag.namespaceUri === W27 && candidate2.tag.localName === "p");
|
|
415754
416155
|
if (!range)
|
|
415755
416156
|
invalid4("PRECONDITION_FAILED", "Selected paragraph was not found in its source story.");
|
|
415756
|
-
const namespaces = { ...range.namespaceBindings, w:
|
|
416157
|
+
const namespaces = { ...range.namespaceBindings, w: W27 };
|
|
415757
416158
|
delete namespaces.xml;
|
|
415758
416159
|
const rawXml = partXml.slice(range.start, range.end).replace(/<[\w.-]+:lastRenderedPageBreak\b[^>]*\/>/g, "");
|
|
415759
416160
|
return {
|
|
@@ -415782,23 +416183,23 @@ function captureSdtNodeSelection(context, at) {
|
|
|
415782
416183
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, story.partUri);
|
|
415783
416184
|
if (!bytes)
|
|
415784
416185
|
invalid4("PRECONDITION_FAILED", "Source story bytes are unavailable.");
|
|
415785
|
-
const partXml =
|
|
416186
|
+
const partXml = TD129.decode(bytes);
|
|
415786
416187
|
const parsed = collectXmlElementRanges(partXml);
|
|
415787
416188
|
if (parsed.errors.length)
|
|
415788
416189
|
invalid4("PRECONDITION_FAILED", `Source story XML cannot be parsed: ${parsed.errors[0]}`);
|
|
415789
416190
|
const nodeId = at.start.node.nodeId;
|
|
415790
|
-
const storyStart = story.storyByteRange ?
|
|
415791
|
-
const storyEnd = story.storyByteRange ?
|
|
415792
|
-
const controls = parsed.ranges.filter((range) => range.tag.namespaceUri ===
|
|
416191
|
+
const storyStart = story.storyByteRange ? TD129.decode(bytes.subarray(0, story.storyByteRange[0])).length : 0;
|
|
416192
|
+
const storyEnd = story.storyByteRange ? TD129.decode(bytes.subarray(0, story.storyByteRange[1])).length : partXml.length;
|
|
416193
|
+
const controls = parsed.ranges.filter((range) => range.tag.namespaceUri === W27 && range.tag.localName === "sdt" && range.start >= storyStart && range.end <= storyEnd && parsed.ranges.some((property2) => property2.start >= range.openEnd && property2.end < range.end && property2.tag.namespaceUri === W27 && property2.tag.localName === "sdtPr" && parsed.ranges.some((id) => id.start >= property2.openEnd && id.end < property2.end && id.tag.namespaceUri === W27 && id.tag.localName === "id" && wordValue(id, "val") === nodeId)));
|
|
415793
416194
|
if (!controls.length)
|
|
415794
416195
|
invalid4("TARGET_NOT_FOUND", "Selected content control was not found.");
|
|
415795
416196
|
if (controls.length > 1)
|
|
415796
416197
|
invalid4("AMBIGUOUS_MATCH", "Selected content-control ID is duplicated.");
|
|
415797
416198
|
const control2 = controls[0];
|
|
415798
|
-
const namespaces = { ...control2.namespaceBindings, w:
|
|
416199
|
+
const namespaces = { ...control2.namespaceBindings, w: W27 };
|
|
415799
416200
|
delete namespaces.xml;
|
|
415800
416201
|
const rawXml = partXml.slice(control2.start, control2.end);
|
|
415801
|
-
const block = parsed.ranges.some((range) => range.start > control2.openEnd && range.end < control2.end && range.tag.namespaceUri ===
|
|
416202
|
+
const block = parsed.ranges.some((range) => range.start > control2.openEnd && range.end < control2.end && range.tag.namespaceUri === W27 && ["p", "tbl"].includes(range.tag.localName) && !parsed.ranges.some((container) => container.start > control2.openEnd && container.end < control2.end && container.start < range.start && container.end > range.end && container.tag.namespaceUri === W27 && container.tag.localName === "r"));
|
|
415802
416203
|
return {
|
|
415803
416204
|
formatVersion: 1,
|
|
415804
416205
|
at,
|
|
@@ -415828,13 +416229,13 @@ function captureTocNodeSelection(context, at) {
|
|
|
415828
416229
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, story.partUri);
|
|
415829
416230
|
if (!bytes)
|
|
415830
416231
|
invalid4("PRECONDITION_FAILED", "Source story bytes are unavailable.");
|
|
415831
|
-
const partXml =
|
|
416232
|
+
const partXml = TD129.decode(bytes);
|
|
415832
416233
|
const parsed = collectXmlElementRanges(partXml);
|
|
415833
416234
|
if (parsed.errors.length)
|
|
415834
416235
|
invalid4("PRECONDITION_FAILED", `Source story XML cannot be parsed: ${parsed.errors[0]}`);
|
|
415835
|
-
const start =
|
|
415836
|
-
const end =
|
|
415837
|
-
const sdt = parsed.ranges.filter((range) => range.tag.namespaceUri ===
|
|
416236
|
+
const start = TD129.decode(bytes.subarray(0, field.descriptor.byteStart)).length;
|
|
416237
|
+
const end = TD129.decode(bytes.subarray(0, field.descriptor.byteEnd)).length;
|
|
416238
|
+
const sdt = parsed.ranges.filter((range) => range.tag.namespaceUri === W27 && range.tag.localName === "sdt" && range.start <= start && range.end >= end).sort((a, b) => a.end - a.start - (b.end - b.start))[0];
|
|
415838
416239
|
let rawXml;
|
|
415839
416240
|
let bindingRange;
|
|
415840
416241
|
if (sdt) {
|
|
@@ -415847,8 +416248,8 @@ function captureTocNodeSelection(context, at) {
|
|
|
415847
416248
|
for (const paragraph4 of index2?.entries ?? []) {
|
|
415848
416249
|
if (paragraph4.byteEnd <= field.descriptor.byteStart || paragraph4.byteStart >= field.descriptor.byteEnd)
|
|
415849
416250
|
continue;
|
|
415850
|
-
const charStart =
|
|
415851
|
-
const paragraphNode = parsed.ranges.find((range) => range.start === charStart && range.tag.namespaceUri ===
|
|
416251
|
+
const charStart = TD129.decode(bytes.subarray(0, paragraph4.byteStart)).length;
|
|
416252
|
+
const paragraphNode = parsed.ranges.find((range) => range.start === charStart && range.tag.namespaceUri === W27 && range.tag.localName === "p");
|
|
415852
416253
|
const node4 = paragraphNode && treeFromRanges(parsed.ranges.filter((range) => range.start >= paragraphNode.start && range.end <= paragraphNode.end))[0];
|
|
415853
416254
|
if (!node4)
|
|
415854
416255
|
invalid4("PRECONDITION_FAILED", "Selected TOC paragraph is unavailable.");
|
|
@@ -415863,9 +416264,9 @@ function captureTocNodeSelection(context, at) {
|
|
|
415863
416264
|
if (!root || !selected.size)
|
|
415864
416265
|
invalid4("PRECONDITION_FAILED", "Selected TOC source paragraphs are unavailable.");
|
|
415865
416266
|
rawXml = renderStructuralSelection(root, partXml, selected);
|
|
415866
|
-
bindingRange = parsed.ranges.find((range) => selected.has(range.start) && range.tag.namespaceUri ===
|
|
416267
|
+
bindingRange = parsed.ranges.find((range) => selected.has(range.start) && range.tag.namespaceUri === W27 && range.tag.localName === "p") ?? root.range;
|
|
415867
416268
|
}
|
|
415868
|
-
const namespaces = { ...bindingRange.namespaceBindings, w:
|
|
416269
|
+
const namespaces = { ...bindingRange.namespaceBindings, w: W27 };
|
|
415869
416270
|
delete namespaces.xml;
|
|
415870
416271
|
return {
|
|
415871
416272
|
formatVersion: 1,
|
|
@@ -415921,7 +416322,7 @@ function resolveBlockBoundarySelection(context, at) {
|
|
|
415921
416322
|
const paragraph4 = index2.entries.find((entry) => entry.ordinal === boundaryOrdinal);
|
|
415922
416323
|
if (!paragraph4)
|
|
415923
416324
|
invalid4("INVALID_TARGET", "Selection boundary lies outside the story.");
|
|
415924
|
-
const paragraphXml =
|
|
416325
|
+
const paragraphXml = TD129.decode(bytes.subarray(paragraph4.byteStart, paragraph4.byteEnd));
|
|
415925
416326
|
const length = at.coordinateSpace === "tracked" ? parseParagraphInlineMap(paragraphXml).trackedLength : paragraph4.textLength;
|
|
415926
416327
|
return {
|
|
415927
416328
|
kind: "text",
|
|
@@ -416020,7 +416421,7 @@ function captureSelectionOoxml(context, input) {
|
|
|
416020
416421
|
const bytes = getSDDocumentSessionInternalPartBytes(context.session, story.partUri);
|
|
416021
416422
|
if (!bytes)
|
|
416022
416423
|
invalid4("PRECONDITION_FAILED", "Source story bytes are unavailable.");
|
|
416023
|
-
const partXml =
|
|
416424
|
+
const partXml = TD129.decode(bytes);
|
|
416024
416425
|
const parsed = collectXmlElementRanges(partXml);
|
|
416025
416426
|
if (parsed.errors.length)
|
|
416026
416427
|
invalid4("PRECONDITION_FAILED", `Source story XML cannot be parsed: ${parsed.errors[0]}`);
|
|
@@ -416030,11 +416431,11 @@ function captureSelectionOoxml(context, input) {
|
|
|
416030
416431
|
for (const entry of index2.entries) {
|
|
416031
416432
|
if (entry.ordinal < first.ordinal || entry.ordinal > last.ordinal)
|
|
416032
416433
|
continue;
|
|
416033
|
-
const paragraphXml =
|
|
416434
|
+
const paragraphXml = TD129.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
416034
416435
|
const from = entry.ordinal === first.ordinal ? start.offset : 0;
|
|
416035
416436
|
const to = entry.ordinal === last.ordinal ? end.offset : tracked ? parseParagraphInlineMap(paragraphXml).trackedLength : entry.textLength;
|
|
416036
416437
|
const rendered = renderParagraph(paragraphXml, from, to, tracked, contextXml);
|
|
416037
|
-
const charStart =
|
|
416438
|
+
const charStart = TD129.decode(bytes.subarray(0, entry.byteStart)).length;
|
|
416038
416439
|
selected.set(charStart, {
|
|
416039
416440
|
xml: rendered.block,
|
|
416040
416441
|
inline: rendered.inline,
|
|
@@ -416042,26 +416443,26 @@ function captureSelectionOoxml(context, input) {
|
|
|
416042
416443
|
charStart
|
|
416043
416444
|
});
|
|
416044
416445
|
}
|
|
416045
|
-
const firstSelected = selected.get(
|
|
416446
|
+
const firstSelected = selected.get(TD129.decode(bytes.subarray(0, first.byteStart)).length);
|
|
416046
416447
|
if (!firstSelected)
|
|
416047
416448
|
invalid4("PRECONDITION_FAILED", "Selected source paragraph was not found.");
|
|
416048
416449
|
const sameParagraph = first.ordinal === last.ordinal;
|
|
416049
416450
|
const storyRange = story.storyByteRange && story.storyKind === "textbox" ? {
|
|
416050
|
-
start:
|
|
416051
|
-
end:
|
|
416451
|
+
start: TD129.decode(bytes.subarray(0, story.storyByteRange[0])).length,
|
|
416452
|
+
end: TD129.decode(bytes.subarray(0, story.storyByteRange[1])).length
|
|
416052
416453
|
} : null;
|
|
416053
|
-
const textboxContent = storyRange && parsed.ranges.find((range) => range.tag.namespaceUri ===
|
|
416454
|
+
const textboxContent = storyRange && parsed.ranges.find((range) => range.tag.namespaceUri === W27 && range.tag.localName === "txbxContent" && range.start <= storyRange.start && range.end >= storyRange.end);
|
|
416054
416455
|
const root = textboxContent ? treeFromRanges(parsed.ranges.filter((range) => range.start >= textboxContent.start && range.end <= textboxContent.end))[0] : treeFromRanges(parsed.ranges)[0];
|
|
416055
416456
|
if (!root)
|
|
416056
416457
|
invalid4("PRECONDITION_FAILED", "Source story has no XML root.");
|
|
416057
416458
|
collectAncestorProperties(root, partXml, firstSelected.charStart, contextXml);
|
|
416058
416459
|
const blockXml = sameParagraph ? "" : renderStructuralSelection(root, partXml, selected, undefined, {
|
|
416059
416460
|
start: firstSelected.charStart,
|
|
416060
|
-
end:
|
|
416461
|
+
end: TD129.decode(bytes.subarray(0, last.byteEnd)).length
|
|
416061
416462
|
});
|
|
416062
416463
|
const rawXml = sameParagraph ? firstSelected.inline : blockXml;
|
|
416063
416464
|
const hasTable = sameParagraph ? false : /<w:tbl\b/.test(blockXml);
|
|
416064
|
-
const paragraphRange = parsed.ranges.find((range) => range.start === firstSelected.charStart && range.tag.namespaceUri ===
|
|
416465
|
+
const paragraphRange = parsed.ranges.find((range) => range.start === firstSelected.charStart && range.tag.namespaceUri === W27);
|
|
416065
416466
|
const coordinateSpace = {
|
|
416066
416467
|
coordinateSpace: tracked ? "tracked" : "visible"
|
|
416067
416468
|
};
|
|
@@ -416069,24 +416470,24 @@ function captureSelectionOoxml(context, input) {
|
|
|
416069
416470
|
const endByte = buildParagraphOffsetMap(bytes, last.byteStart, last.byteEnd, coordinateSpace).charToByte(end.offset);
|
|
416070
416471
|
if (startByte == null || endByte == null)
|
|
416071
416472
|
invalid4("INVALID_TARGET", "Selection offset cannot be mapped to source.");
|
|
416072
|
-
const selectionStart =
|
|
416073
|
-
const selectionEnd =
|
|
416473
|
+
const selectionStart = TD129.decode(bytes.subarray(0, startByte)).length;
|
|
416474
|
+
const selectionEnd = TD129.decode(bytes.subarray(0, endByte)).length;
|
|
416074
416475
|
collectPairedMarkerContext(partXml, parsed.ranges, selectionStart, selectionEnd, contextXml);
|
|
416075
416476
|
collectComplexFieldContext(partXml, parsed.ranges, selectionStart, selectionEnd, contextXml);
|
|
416076
416477
|
for (const entry of [first, ...first === last ? [] : [last]]) {
|
|
416077
|
-
const paragraphXml =
|
|
416478
|
+
const paragraphXml = TD129.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
416078
416479
|
const paragraphProperty = collectXmlElementRanges(paragraphXml, {
|
|
416079
416480
|
fragment: true,
|
|
416080
416481
|
additionalNamespaces: paragraphRange?.namespaceBindings ?? {}
|
|
416081
|
-
}).ranges.find((range) => range.tag.namespaceUri ===
|
|
416482
|
+
}).ranges.find((range) => range.tag.namespaceUri === W27 && range.tag.localName === "pPr");
|
|
416082
416483
|
if (paragraphProperty)
|
|
416083
416484
|
contextXml.add(paragraphXml.slice(paragraphProperty.start, paragraphProperty.end));
|
|
416084
416485
|
}
|
|
416085
|
-
const namespaces = { ...paragraphRange?.namespaceBindings ?? root.range.namespaceBindings, w:
|
|
416486
|
+
const namespaces = { ...paragraphRange?.namespaceBindings ?? root.range.namespaceBindings, w: W27 };
|
|
416086
416487
|
delete namespaces.xml;
|
|
416087
416488
|
const dependencies = captureDependencies(context, story.partUri, `${rawXml}${[...contextXml].join("")}`, namespaces, story.relationshipOwnerPartUri);
|
|
416088
416489
|
const xml = bindFragmentRoots(rawXml, namespaces);
|
|
416089
|
-
const styleId = /<w:pStyle\b[^>]*w:val="([^"]+)"/.exec(
|
|
416490
|
+
const styleId = /<w:pStyle\b[^>]*w:val="([^"]+)"/.exec(TD129.decode(bytes.subarray(first.byteStart, first.byteEnd)))?.[1] ?? null;
|
|
416090
416491
|
return {
|
|
416091
416492
|
formatVersion: 1,
|
|
416092
416493
|
at,
|
|
@@ -416107,22 +416508,22 @@ function captureCommentFamily(context, owner, ids) {
|
|
|
416107
416508
|
const bytes = readCapturePartBytes(context, comments.resolvedTarget);
|
|
416108
416509
|
if (!bytes)
|
|
416109
416510
|
invalid4("PRECONDITION_FAILED", "Comment definitions are unavailable.");
|
|
416110
|
-
const xml =
|
|
416511
|
+
const xml = TD129.decode(bytes);
|
|
416111
416512
|
const parsed = collectXmlElementRanges(xml);
|
|
416112
416513
|
if (parsed.errors.length)
|
|
416113
416514
|
invalid4("PRECONDITION_FAILED", "Comment definitions are malformed.");
|
|
416114
|
-
const commentNodes = parsed.ranges.filter((r) => r.tag.namespaceUri ===
|
|
416515
|
+
const commentNodes = parsed.ranges.filter((r) => r.tag.namespaceUri === W27 && r.tag.localName === "comment");
|
|
416115
416516
|
const paraForId = new Map(commentNodes.map((r) => [wordId2(r), parsed.ranges.filter((p) => p.start > r.start && p.end < r.end && p.tag.localName === "p").flatMap((p) => p.tag.attributes.filter((a) => a.localName === "paraId").map((a) => a.value))]));
|
|
416116
416517
|
const paraIds = new Set([...ids].flatMap((id) => paraForId.get(id) ?? []));
|
|
416117
416518
|
const family = rels.filter((r) => /\/(commentsExtended|commentsIds|commentsExtensible)$/.test(r.type) || r.type.endsWith("/customXml") && (() => {
|
|
416118
416519
|
const bytes2 = readCapturePartBytes(context, r.resolvedTarget);
|
|
416119
|
-
return !!bytes2 &&
|
|
416520
|
+
return !!bytes2 && TD129.decode(bytes2).includes("http://superdoc.dev/2024/comment-metadata");
|
|
416120
416521
|
})());
|
|
416121
416522
|
const entries = family.map((rel) => {
|
|
416122
416523
|
const part = readCapturePartBytes(context, rel.resolvedTarget);
|
|
416123
416524
|
if (!part)
|
|
416124
416525
|
invalid4("PRECONDITION_FAILED", "Modern comment metadata is unavailable.");
|
|
416125
|
-
const partXml =
|
|
416526
|
+
const partXml = TD129.decode(part), ranges = collectXmlElementRanges(partXml);
|
|
416126
416527
|
if (ranges.errors.length)
|
|
416127
416528
|
invalid4("PRECONDITION_FAILED", "Modern comment metadata is malformed.");
|
|
416128
416529
|
const root = treeFromRanges(ranges.ranges)[0];
|
|
@@ -416156,11 +416557,11 @@ function captureCommentFamily(context, owner, ids) {
|
|
|
416156
416557
|
}
|
|
416157
416558
|
for (const part of entries) {
|
|
416158
416559
|
const children2 = part.root.children.filter((c) => paraIds.has(attr4(c.range, "paraId") ?? "") || durableIds.has((attr4(c.range, "durableId") ?? "").toUpperCase()));
|
|
416159
|
-
result.set(part.rel.resolvedTarget,
|
|
416560
|
+
result.set(part.rel.resolvedTarget, TE76.encode(part.xml.slice(part.root.range.start, part.root.range.openEnd) + children2.map((c) => part.xml.slice(c.range.start, c.range.end)).join("") + part.xml.slice(part.root.range.closeStart, part.root.range.end)));
|
|
416160
416561
|
}
|
|
416161
416562
|
return result;
|
|
416162
416563
|
}
|
|
416163
|
-
var
|
|
416564
|
+
var W27 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", TD129, TE76, MAX_CAPTURE_DEPENDENCIES = 1024, MAX_CAPTURE_DEPENDENCY_BYTES, PROPERTY_NODES;
|
|
416164
416565
|
var init_capture2 = __esm(() => {
|
|
416165
416566
|
init_src3();
|
|
416166
416567
|
init_sd_document_session_internal();
|
|
@@ -416168,8 +416569,8 @@ var init_capture2 = __esm(() => {
|
|
|
416168
416569
|
init_common();
|
|
416169
416570
|
init_public_model2();
|
|
416170
416571
|
init_runtime2();
|
|
416171
|
-
|
|
416172
|
-
|
|
416572
|
+
TD129 = new TextDecoder;
|
|
416573
|
+
TE76 = new TextEncoder;
|
|
416173
416574
|
MAX_CAPTURE_DEPENDENCY_BYTES = 128 * 1024 * 1024;
|
|
416174
416575
|
PROPERTY_NODES = new Set([
|
|
416175
416576
|
"tblPr",
|
|
@@ -438933,10 +439334,10 @@ var init_sha2 = __esm(() => {
|
|
|
438933
439334
|
for (let i2 = 0;i2 < 16; i2++, offset += 4)
|
|
438934
439335
|
SHA256_W[i2] = view.getUint32(offset, false);
|
|
438935
439336
|
for (let i2 = 16;i2 < 64; i2++) {
|
|
438936
|
-
const
|
|
438937
|
-
const
|
|
438938
|
-
const s0 = rotr(
|
|
438939
|
-
const s1 = rotr(
|
|
439337
|
+
const W153 = SHA256_W[i2 - 15];
|
|
439338
|
+
const W28 = SHA256_W[i2 - 2];
|
|
439339
|
+
const s0 = rotr(W153, 7) ^ rotr(W153, 18) ^ W153 >>> 3;
|
|
439340
|
+
const s1 = rotr(W28, 17) ^ rotr(W28, 19) ^ W28 >>> 10;
|
|
438940
439341
|
SHA256_W[i2] = s1 + SHA256_W[i2 - 7] + s0 + SHA256_W[i2 - 16] | 0;
|
|
438941
439342
|
}
|
|
438942
439343
|
let { A, B: B2, C, D, E, F, G, H } = this;
|
|
@@ -446086,7 +446487,7 @@ function numericId2(id2) {
|
|
|
446086
446487
|
return match ? Number.parseInt(match[1], 10) : 0;
|
|
446087
446488
|
}
|
|
446088
446489
|
function deriveCommentParaId(commentId) {
|
|
446089
|
-
return sha256Hex2(
|
|
446490
|
+
return sha256Hex2(TE77.encode(`comment:${commentId}`)).slice(0, 8).toUpperCase();
|
|
446090
446491
|
}
|
|
446091
446492
|
function normalizeDurableId(value2) {
|
|
446092
446493
|
if (typeof value2 !== "string")
|
|
@@ -446466,7 +446867,7 @@ function sortCommentIds(a, b) {
|
|
|
446466
446867
|
return na - nb;
|
|
446467
446868
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
446468
446869
|
}
|
|
446469
|
-
var COMMENTS_KEY = "comments", PEOPLE_KEY = "people", SOURCE_PARTS_KEY = "sourceParts", COMMENTS_MODELED_KEY = "commentsModeled", COMMENT_SOURCE_PARTS,
|
|
446870
|
+
var COMMENTS_KEY = "comments", PEOPLE_KEY = "people", SOURCE_PARTS_KEY = "sourceParts", COMMENTS_MODELED_KEY = "commentsModeled", COMMENT_SOURCE_PARTS, TE77;
|
|
446470
446871
|
var init_comments2 = __esm(() => {
|
|
446471
446872
|
init_yjs();
|
|
446472
446873
|
init_sd_document_session_internal();
|
|
@@ -446481,7 +446882,7 @@ var init_comments2 = __esm(() => {
|
|
|
446481
446882
|
"/word/commentsExtended.xml",
|
|
446482
446883
|
"/word/commentsIds.xml"
|
|
446483
446884
|
];
|
|
446484
|
-
|
|
446885
|
+
TE77 = new TextEncoder;
|
|
446485
446886
|
});
|
|
446486
446887
|
|
|
446487
446888
|
// ../../../v2/collaboration-v2/dist/package-part/settings.js
|
|
@@ -449372,13 +449773,13 @@ function maybeMintCommentDurableId(commentsDoc, seed) {
|
|
|
449372
449773
|
return null;
|
|
449373
449774
|
const existing = new Set(listComments(commentsDoc).map((comment) => comment.durableId).filter((value2) => typeof value2 === "string" && value2.length > 0));
|
|
449374
449775
|
for (let i2 = 0;i2 < 16; i2 += 1) {
|
|
449375
|
-
const candidate2 = sha256Hex2(
|
|
449776
|
+
const candidate2 = sha256Hex2(TE78.encode(`comment-durable:${seed}:${i2}`)).slice(0, 8).toUpperCase();
|
|
449376
449777
|
if (!existing.has(candidate2))
|
|
449377
449778
|
return candidate2;
|
|
449378
449779
|
}
|
|
449379
|
-
return sha256Hex2(
|
|
449780
|
+
return sha256Hex2(TE78.encode(`comment-durable:${seed}:fallback`)).slice(0, 8).toUpperCase();
|
|
449380
449781
|
}
|
|
449381
|
-
var EMPTY_REFS2,
|
|
449782
|
+
var EMPTY_REFS2, TE78;
|
|
449382
449783
|
var init_dispatcher = __esm(() => {
|
|
449383
449784
|
init_yjs();
|
|
449384
449785
|
init_diagnostics2();
|
|
@@ -449400,7 +449801,7 @@ var init_dispatcher = __esm(() => {
|
|
|
449400
449801
|
remapped: Object.freeze([]),
|
|
449401
449802
|
invalidated: Object.freeze([])
|
|
449402
449803
|
});
|
|
449403
|
-
|
|
449804
|
+
TE78 = new TextEncoder;
|
|
449404
449805
|
});
|
|
449405
449806
|
|
|
449406
449807
|
// ../../../v2/collaboration-v2/dist/dispatcher/index.js
|
|
@@ -452235,10 +452636,20 @@ function applyPreparedTableStructuralDeltas(input) {
|
|
|
452235
452636
|
const affectedBlockIds = [];
|
|
452236
452637
|
try {
|
|
452237
452638
|
resolveStoryShardScope(input.doc).doc.transact(() => {
|
|
452639
|
+
let trailingXml = getStoryMetaMap(input.doc).get(STORY_META_KEY.trailingXml);
|
|
452640
|
+
for (const delta of tableDeltas) {
|
|
452641
|
+
if (String(delta.storyId) !== input.storyId || !delta.storyTrailingXml)
|
|
452642
|
+
continue;
|
|
452643
|
+
if (trailingXml !== delta.storyTrailingXml.before) {
|
|
452644
|
+
throw new Error("table move story tail changed before its prepared boundary transfer");
|
|
452645
|
+
}
|
|
452646
|
+
trailingXml = delta.storyTrailingXml.after;
|
|
452647
|
+
}
|
|
452238
452648
|
for (const delta of tableDeltas) {
|
|
452239
452649
|
if (String(delta.storyId) !== input.storyId)
|
|
452240
452650
|
continue;
|
|
452241
452651
|
const normalized = normalizeTableDeltaForCurrentStory(input.doc, delta);
|
|
452652
|
+
const trailing = normalized.storyTrailingXml;
|
|
452242
452653
|
for (const blockId of normalized.affectedBlockIds)
|
|
452243
452654
|
affectedBlockIds.push(blockId);
|
|
452244
452655
|
if (normalized.kind === "table.split") {
|
|
@@ -452258,6 +452669,13 @@ function applyPreparedTableStructuralDeltas(input) {
|
|
|
452258
452669
|
placement3 = "after";
|
|
452259
452670
|
relativeToBlockId = blockId;
|
|
452260
452671
|
}
|
|
452672
|
+
if (normalized.trailingParagraph) {
|
|
452673
|
+
if (normalized.deletedNodeIds.some((ref5) => ref5.nodeId === normalized.trailingParagraph.nodeId)) {
|
|
452674
|
+
applyDeleteParagraphs(input.doc, [normalized.trailingParagraph.nodeId]);
|
|
452675
|
+
} else {
|
|
452676
|
+
insertOrUpdateParagraph(input.doc, normalized.trailingParagraph, "after", relativeToBlockId, input.resolveNamespaceBindings);
|
|
452677
|
+
}
|
|
452678
|
+
}
|
|
452261
452679
|
break;
|
|
452262
452680
|
}
|
|
452263
452681
|
case "table.row.move": {
|
|
@@ -452293,6 +452711,8 @@ function applyPreparedTableStructuralDeltas(input) {
|
|
|
452293
452711
|
assertNever3(normalized);
|
|
452294
452712
|
}
|
|
452295
452713
|
writeTableProjectionState(input.doc, input.preparedTxId, normalized, input.historyReplay, input.resolveNamespaceBindings);
|
|
452714
|
+
if (trailing)
|
|
452715
|
+
getStoryMetaMap(input.doc).set(STORY_META_KEY.trailingXml, trailing.after);
|
|
452296
452716
|
}
|
|
452297
452717
|
}, TABLE_STRUCTURAL_BACKEND_ORIGIN);
|
|
452298
452718
|
} catch (error50) {
|
|
@@ -452374,6 +452794,10 @@ function normalizeTableDeltaForCurrentStory(doc2, delta) {
|
|
|
452374
452794
|
}
|
|
452375
452795
|
}
|
|
452376
452796
|
function applyTableCreate(doc2, delta, resolveNamespaceBindings, preserveExistingContent = false) {
|
|
452797
|
+
const tailAnchor = delta.storyTrailingXml && delta.placement === "before" ? delta.paragraphsAfterTable.find((paragraph4) => paragraph4.nodeId === delta.relativeToBlockId) : undefined;
|
|
452798
|
+
if (tailAnchor && !findBlockMap(doc2, tailAnchor.nodeId)) {
|
|
452799
|
+
insertOrUpdateParagraph(doc2, tailAnchor, "append", undefined, resolveNamespaceBindings);
|
|
452800
|
+
}
|
|
452377
452801
|
for (const paragraph4 of delta.paragraphsBeforeTable) {
|
|
452378
452802
|
insertOrUpdateParagraph(doc2, paragraph4, "append", undefined, resolveNamespaceBindings);
|
|
452379
452803
|
}
|
|
@@ -452685,6 +453109,12 @@ function writeTableProjectionState(doc2, preparedTxId, delta, historyReplay, res
|
|
|
452685
453109
|
table.set("rowReordered", true);
|
|
452686
453110
|
table.set("moveSourceProjection", delta.tableProjection);
|
|
452687
453111
|
writeStringArray(table, "tableBlocks", currentTableBlockIds(doc2, delta.tableNodeId));
|
|
453112
|
+
writeStringArray(table, "affectedBlocks", delta.affectedBlockIds.filter((blockId) => delta.kind !== "table.move" || blockId !== delta.trailingParagraph?.nodeId));
|
|
453113
|
+
if (delta.kind === "table.move" && delta.trailingParagraph) {
|
|
453114
|
+
writeStringArray(table, "nonTableAffectedBlocks", [delta.trailingParagraph.nodeId]);
|
|
453115
|
+
} else {
|
|
453116
|
+
table.delete("nonTableAffectedBlocks");
|
|
453117
|
+
}
|
|
452688
453118
|
return;
|
|
452689
453119
|
}
|
|
452690
453120
|
writeRowInsertionProvenance(table, doc2, delta, resolveNamespaceBindings);
|
|
@@ -452702,6 +453132,8 @@ function writeTableProjectionState(doc2, preparedTxId, delta, historyReplay, res
|
|
|
452702
453132
|
...delta.removedBlockIds ?? [],
|
|
452703
453133
|
...(delta.restoredParagraphs ?? []).map((paragraph4) => paragraph4.nodeId)
|
|
452704
453134
|
]);
|
|
453135
|
+
} else if (delta.kind === "table.create" && delta.storyTrailingXml) {
|
|
453136
|
+
writeStringArray(table, "nonTableAffectedBlocks", delta.paragraphsAfterTable.map((paragraph4) => paragraph4.nodeId));
|
|
452705
453137
|
} else {
|
|
452706
453138
|
table.delete("nonTableAffectedBlocks");
|
|
452707
453139
|
}
|
|
@@ -452724,6 +453156,14 @@ function writeTableProjectionState(doc2, preparedTxId, delta, historyReplay, res
|
|
|
452724
453156
|
writeTableStructuralProperties(table, updatedPropertyRows);
|
|
452725
453157
|
if (delta.kind === "table.rewrite") {
|
|
452726
453158
|
writeTableRevisionDecisions(table, delta, historyReplay != null);
|
|
453159
|
+
} else if (delta.kind === "table.create" && historyReplay) {
|
|
453160
|
+
writeTableRevisionDecisions(table, {
|
|
453161
|
+
tableNodeId: delta.tableNodeId,
|
|
453162
|
+
rowsBefore: [],
|
|
453163
|
+
rowsAfter: delta.rows,
|
|
453164
|
+
tableXmlBefore: delta.tableProjection.tableXmlBefore ?? "",
|
|
453165
|
+
tableXmlAfter: delta.tableProjection.tableXmlAfter
|
|
453166
|
+
}, true);
|
|
452727
453167
|
}
|
|
452728
453168
|
writeTableGridChange(table, delta.tableProjection.tableXmlAfter, delta.tableProjection.tableXmlBefore);
|
|
452729
453169
|
if (delta.kind === "table.column.insert") {
|
|
@@ -453443,13 +453883,13 @@ function reorderNativeOwners(xml, blockOrder, containers, ownerNames, containerB
|
|
|
453443
453883
|
if (parsed.errors.length)
|
|
453444
453884
|
throw new Error("Cannot reorder malformed story XML.");
|
|
453445
453885
|
const container = parsed.ranges.find((range) => {
|
|
453446
|
-
if (range.tag.namespaceUri !==
|
|
453886
|
+
if (range.tag.namespaceUri !== W28 || !containers.includes(range.tag.localName))
|
|
453447
453887
|
return false;
|
|
453448
453888
|
if (!containerBlockIds)
|
|
453449
453889
|
return true;
|
|
453450
|
-
const paragraphs = parsed.ranges.filter((child) => child.start > range.start && child.end < range.end && child.tag.namespaceUri ===
|
|
453890
|
+
const paragraphs = parsed.ranges.filter((child) => child.start > range.start && child.end < range.end && child.tag.namespaceUri === W28 && child.tag.localName === "p");
|
|
453451
453891
|
return paragraphs.length === containerBlockIds.size && paragraphs.every((paragraph4) => {
|
|
453452
|
-
const id2 = paragraph4.tag.attributes.find((attribute3) => attribute3.namespaceUri ===
|
|
453892
|
+
const id2 = paragraph4.tag.attributes.find((attribute3) => attribute3.namespaceUri === W1410 && attribute3.localName === "paraId")?.value;
|
|
453453
453893
|
return id2 !== undefined && containerBlockIds.has(id2);
|
|
453454
453894
|
});
|
|
453455
453895
|
});
|
|
@@ -453465,8 +453905,8 @@ function reorderNativeOwners(xml, blockOrder, containers, ownerNames, containerB
|
|
|
453465
453905
|
cursor = range.end;
|
|
453466
453906
|
}
|
|
453467
453907
|
const indexed = children3.map((range) => {
|
|
453468
|
-
const paragraphs = range.tag.namespaceUri ===
|
|
453469
|
-
const orders = paragraphs.map((paragraph4) => paragraph4.tag.attributes.find((attribute3) => attribute3.namespaceUri ===
|
|
453908
|
+
const paragraphs = range.tag.namespaceUri === W28 && ownerNames.includes(range.tag.localName) ? ranges.filter((child) => child.start >= range.start && child.end <= range.end && child.tag.namespaceUri === W28 && child.tag.localName === "p") : [];
|
|
453909
|
+
const orders = paragraphs.map((paragraph4) => paragraph4.tag.attributes.find((attribute3) => attribute3.namespaceUri === W1410 && attribute3.localName === "paraId")?.value).map((id2) => id2 === undefined ? undefined : blockOrder.get(id2));
|
|
453470
453910
|
const order = orders.length && orders.every((value2) => value2 !== undefined) ? Math.min(...orders) : null;
|
|
453471
453911
|
return { range, order };
|
|
453472
453912
|
});
|
|
@@ -453503,7 +453943,7 @@ function reorderNativeOwners(xml, blockOrder, containers, ownerNames, containerB
|
|
|
453503
453943
|
xml = xml.slice(0, patch.start) + patch.xml + xml.slice(patch.end);
|
|
453504
453944
|
return { xml, owners: owners2 };
|
|
453505
453945
|
}
|
|
453506
|
-
var
|
|
453946
|
+
var W28 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", W1410 = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
453507
453947
|
var init_reorder_story_owners = __esm(() => {
|
|
453508
453948
|
init_sd_document_session_internal();
|
|
453509
453949
|
});
|
|
@@ -453540,7 +453980,7 @@ function attributeFrame(xml, row, name) {
|
|
|
453540
453980
|
return null;
|
|
453541
453981
|
}
|
|
453542
453982
|
function threadingIdentityPatch(xml, paragraph4, paraId) {
|
|
453543
|
-
const id2 = paragraph4.tag.attributes.find((attribute3) => attribute3.namespaceUri ===
|
|
453983
|
+
const id2 = paragraph4.tag.attributes.find((attribute3) => attribute3.namespaceUri === W1411 && attribute3.localName === "paraId");
|
|
453544
453984
|
if (id2) {
|
|
453545
453985
|
if (id2.value)
|
|
453546
453986
|
throw new Error("comment threading paragraph identity cannot be replaced");
|
|
@@ -453549,14 +453989,14 @@ function threadingIdentityPatch(xml, paragraph4, paraId) {
|
|
|
453549
453989
|
throw new Error("comment threading paragraph identity cannot be located");
|
|
453550
453990
|
return { ...frame, xml: `${id2.name}="${xmlEscape(paraId)}"` };
|
|
453551
453991
|
}
|
|
453552
|
-
const binding = Object.entries(paragraph4.namespaceBindings).find(([prefix2, namespace2]) => prefix2 && namespace2 ===
|
|
453992
|
+
const binding = Object.entries(paragraph4.namespaceBindings).find(([prefix2, namespace2]) => prefix2 && namespace2 === W1411);
|
|
453553
453993
|
let prefix = binding?.[0] ?? "w14";
|
|
453554
453994
|
if (!binding) {
|
|
453555
453995
|
let suffix = 0;
|
|
453556
453996
|
while (Object.prototype.hasOwnProperty.call(paragraph4.namespaceBindings, prefix))
|
|
453557
453997
|
prefix = `w14_${++suffix}`;
|
|
453558
453998
|
}
|
|
453559
|
-
const namespace = binding ? "" : `xmlns:${prefix}="${
|
|
453999
|
+
const namespace = binding ? "" : `xmlns:${prefix}="${W1411}" `;
|
|
453560
454000
|
const start = paragraph4.openEnd - (paragraph4.tag.isSelfClosing ? 2 : 1);
|
|
453561
454001
|
return { start, end: start, xml: ` ${namespace}${prefix}:paraId="${xmlEscape(paraId)}"` };
|
|
453562
454002
|
}
|
|
@@ -453584,8 +454024,8 @@ function projectCommentsFamilySource(comments, source) {
|
|
|
453584
454024
|
}
|
|
453585
454025
|
const bodyChanged = (entry, comment) => comment.bodyText !== entry.bodyText || comment.paraId !== (entry.paraId || deriveCommentParaId(entry.commentId)) || comment.author !== entry.author.name || (comment.initials ?? "") !== entry.author.initials || comment.date !== entry.date || comment.creatorEmail !== entry.email || comment.isInternal !== entry.isInternal || JSON.stringify(comment.trackedChangeMetadata) !== JSON.stringify(entry.trackedChangeMetadata);
|
|
453586
454026
|
for (const [uri, namespace, localName3] of [
|
|
453587
|
-
[BODY,
|
|
453588
|
-
[EXTENDED,
|
|
454027
|
+
[BODY, W29, "comment"],
|
|
454028
|
+
[EXTENDED, W153, "commentEx"],
|
|
453589
454029
|
[IDS, CID, "commentId"]
|
|
453590
454030
|
]) {
|
|
453591
454031
|
const bytes = source.get(uri);
|
|
@@ -453604,7 +454044,7 @@ function projectCommentsFamilySource(comments, source) {
|
|
|
453604
454044
|
if (uri === BODY) {
|
|
453605
454045
|
let paragraph4;
|
|
453606
454046
|
for (const range of parsed.ranges) {
|
|
453607
|
-
if (range.tag.namespaceUri !==
|
|
454047
|
+
if (range.tag.namespaceUri !== W29)
|
|
453608
454048
|
continue;
|
|
453609
454049
|
if (range.tag.localName === "p")
|
|
453610
454050
|
paragraph4 = range;
|
|
@@ -453647,13 +454087,13 @@ function projectCommentsFamilySource(comments, source) {
|
|
|
453647
454087
|
if (changedBody)
|
|
453648
454088
|
patches.push({ start: row.start, end: row.end, xml: emit(comment) });
|
|
453649
454089
|
else {
|
|
453650
|
-
const id2 = row.tag.attributes.find((attr4) => attr4.namespaceUri ===
|
|
454090
|
+
const id2 = row.tag.attributes.find((attr4) => attr4.namespaceUri === W29 && attr4.localName === "id");
|
|
453651
454091
|
const frame = id2 ? attributeFrame(xml, row, id2.name) : null;
|
|
453652
454092
|
if (id2 && !frame)
|
|
453653
454093
|
throw new Error("comment source identity attribute cannot be located");
|
|
453654
|
-
if (row.namespaceBindings.w && row.namespaceBindings.w !==
|
|
454094
|
+
if (row.namespaceBindings.w && row.namespaceBindings.w !== W29)
|
|
453655
454095
|
throw new Error("comment source identity namespace cannot be rebound");
|
|
453656
|
-
const namespace2 = row.namespaceBindings.w ===
|
|
454096
|
+
const namespace2 = row.namespaceBindings.w === W29 ? "" : `xmlns:w="${W29}" `;
|
|
453657
454097
|
const canonical = `${namespace2}w:id="${xmlEscape(comment.commentId)}"`;
|
|
453658
454098
|
if (frame) {
|
|
453659
454099
|
if (xml.slice(frame.start, frame.end) !== canonical)
|
|
@@ -453695,7 +454135,7 @@ function projectCommentsFamilySource(comments, source) {
|
|
|
453695
454135
|
}
|
|
453696
454136
|
return generated;
|
|
453697
454137
|
}
|
|
453698
|
-
var
|
|
454138
|
+
var W29 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", W1411 = "http://schemas.microsoft.com/office/word/2010/wordml", W153 = "http://schemas.microsoft.com/office/word/2012/wordml", CID = "http://schemas.microsoft.com/office/word/2016/wordml/cid", DECODER4, BODY = "/word/comments.xml", EXTENDED = "/word/commentsExtended.xml", IDS = "/word/commentsIds.xml";
|
|
453699
454139
|
var init_comments_source = __esm(() => {
|
|
453700
454140
|
init_sd_document_session_internal();
|
|
453701
454141
|
init_canonical();
|
|
@@ -454685,6 +455125,15 @@ function resolveInsertedBlockPatchSpan(input) {
|
|
|
454685
455125
|
const inserted = input.currentBlockById.get(input.insertedBlockId);
|
|
454686
455126
|
const preceding = input.currentBlockById.get(input.currentBlockIds[currentIndex - 1] ?? "");
|
|
454687
455127
|
const precedingTableId = preceding?.structuralRefs.tableNodeId;
|
|
455128
|
+
if (input.tableReplacements.some((table) => table.creationPlacement === "before" && table.creationRelativeToBlockId === input.insertedBlockId && table.nonTableAffectedBlockIds.includes(input.insertedBlockId))) {
|
|
455129
|
+
return resolveStoryBodyEndInsertionSpan(input.previous);
|
|
455130
|
+
}
|
|
455131
|
+
const supportingMove = !inserted?.structuralRefs.tableNodeId && precedingTableId ? input.tableReplacements.find((table) => table.tableNodeId === precedingTableId && table.relocation && table.nonTableAffectedBlockIds.includes(input.insertedBlockId)) : undefined;
|
|
455132
|
+
if (supportingMove?.relocation) {
|
|
455133
|
+
const offset = resolveSupportingMoveParagraphOffset(input.previous.xml, input.previous.storyId, supportingMove);
|
|
455134
|
+
const byteStart = UTF8_ENCODER3.encode(input.previous.xml.slice(0, offset)).length;
|
|
455135
|
+
return { xmlStart: offset, xmlEnd: offset, byteStart, byteEnd: byteStart };
|
|
455136
|
+
}
|
|
454688
455137
|
if (!inserted?.structuralRefs.tableNodeId && precedingTableId) {
|
|
454689
455138
|
const overlay = input.previous.tableStructuralOverlays?.find((table) => table.tableNodeId === precedingTableId && table.xmlStart === table.xmlEnd);
|
|
454690
455139
|
const replacement = input.tableReplacements.find((table) => table.tableNodeId === precedingTableId);
|
|
@@ -454716,6 +455165,12 @@ function resolveInsertedBlockPatchSpan(input) {
|
|
|
454716
455165
|
continue;
|
|
454717
455166
|
if (nextEntry.xmlStart == null)
|
|
454718
455167
|
continue;
|
|
455168
|
+
const nextBlock = input.currentBlockById.get(nextBlockId);
|
|
455169
|
+
const nativeMovedTable = !inserted?.structuralRefs.tableNodeId && nextBlock?.structuralRefs.tableNodeId && input.tableReplacements.some((table) => table.tableNodeId === nextBlock.structuralRefs.tableNodeId && table.relocation) ? findContainingTableSpan(input.previous.xml, { start: nextEntry.xmlStart, end: nextEntry.xmlEnd ?? nextEntry.xmlStart }) : null;
|
|
455170
|
+
if (nativeMovedTable) {
|
|
455171
|
+
const byteStart2 = UTF8_ENCODER3.encode(input.previous.xml.slice(0, nativeMovedTable.start)).length;
|
|
455172
|
+
return { xmlStart: nativeMovedTable.start, xmlEnd: nativeMovedTable.start, byteStart: byteStart2, byteEnd: byteStart2 };
|
|
455173
|
+
}
|
|
454719
455174
|
const containingOverlay = isSplitSeparator ? undefined : tableOverlayContainingXmlOffset(input.previous, nextEntry.xmlStart);
|
|
454720
455175
|
if (containingOverlay) {
|
|
454721
455176
|
const byteStart2 = input.previous.xml ? UTF8_ENCODER3.encode(input.previous.xml.slice(0, containingOverlay.xmlStart)).length : nextEntry.byteStart;
|
|
@@ -454726,7 +455181,6 @@ function resolveInsertedBlockPatchSpan(input) {
|
|
|
454726
455181
|
byteEnd: byteStart2
|
|
454727
455182
|
};
|
|
454728
455183
|
}
|
|
454729
|
-
const nextBlock = input.currentBlockById.get(nextBlockId);
|
|
454730
455184
|
const leadingXml = nextBlock?.leadingXml ?? "";
|
|
454731
455185
|
const leadingXmlStart = leadingXml.length > 0 && nextEntry.xmlStart >= leadingXml.length && input.previous.xml.slice(nextEntry.xmlStart - leadingXml.length, nextEntry.xmlStart) === leadingXml ? nextEntry.xmlStart - leadingXml.length : nextEntry.xmlStart;
|
|
454732
455186
|
const leadingByteLength = leadingXml.length > 0 ? UTF8_ENCODER3.encode(leadingXml).length : 0;
|
|
@@ -454745,12 +455199,14 @@ function resolveInsertedBlockPatchSpan(input) {
|
|
|
454745
455199
|
if (previousEntry.xmlEnd == null)
|
|
454746
455200
|
continue;
|
|
454747
455201
|
const containingOverlay = isSplitSeparator || previousEntry.xmlStart == null ? undefined : tableOverlayContainingXmlOffset(input.previous, previousEntry.xmlStart);
|
|
454748
|
-
const
|
|
455202
|
+
const previousBlock = input.currentBlockById.get(input.currentBlockIds[cursor]);
|
|
455203
|
+
const nativeMovedTable = !inserted?.structuralRefs.tableNodeId && previousBlock?.structuralRefs.tableNodeId && previousEntry.xmlStart != null && input.tableReplacements.some((table) => table.tableNodeId === previousBlock.structuralRefs.tableNodeId && table.relocation) ? findContainingTableSpan(input.previous.xml, { start: previousEntry.xmlStart, end: previousEntry.xmlEnd }) : null;
|
|
455204
|
+
const neighborEnd = containingOverlay?.xmlEnd ?? nativeMovedTable?.end ?? previousEntry.xmlEnd;
|
|
454749
455205
|
const leadingXml = input.currentBlockById.get(input.insertedBlockId)?.leadingXml ?? "";
|
|
454750
455206
|
const closingXml = leadingXml.match(/^(?:\s*<\/[\w:.-]+>\s*)+/)?.[0] ?? "";
|
|
454751
455207
|
const retainedLeadingXmlLength = closingXml.includes("</w:tbl>") && input.previous.xml.startsWith(closingXml, neighborEnd) ? closingXml.length : 0;
|
|
454752
455208
|
const xmlStart = neighborEnd + retainedLeadingXmlLength;
|
|
454753
|
-
const byteStart = containingOverlay ? UTF8_ENCODER3.encode(input.previous.xml.slice(0, xmlStart)).length : previousEntry.byteEnd == null ? null : previousEntry.byteEnd + UTF8_ENCODER3.encode(leadingXml.slice(0, retainedLeadingXmlLength)).length;
|
|
455209
|
+
const byteStart = containingOverlay || nativeMovedTable ? UTF8_ENCODER3.encode(input.previous.xml.slice(0, xmlStart)).length : previousEntry.byteEnd == null ? null : previousEntry.byteEnd + UTF8_ENCODER3.encode(leadingXml.slice(0, retainedLeadingXmlLength)).length;
|
|
454754
455210
|
return {
|
|
454755
455211
|
xmlStart,
|
|
454756
455212
|
xmlEnd: xmlStart,
|
|
@@ -454761,6 +455217,21 @@ function resolveInsertedBlockPatchSpan(input) {
|
|
|
454761
455217
|
}
|
|
454762
455218
|
return null;
|
|
454763
455219
|
}
|
|
455220
|
+
function resolveSupportingMoveParagraphOffset(baseXml, storyId, table) {
|
|
455221
|
+
const site = table.relocation;
|
|
455222
|
+
const destination = resolveTableCreateInsertionSpan({
|
|
455223
|
+
baseXml,
|
|
455224
|
+
storyId,
|
|
455225
|
+
placement: site.placement,
|
|
455226
|
+
relativeToBlockId: site.relativeToBlockId,
|
|
455227
|
+
blockDigests: []
|
|
455228
|
+
});
|
|
455229
|
+
const start = site.placement === "after" ? destination.start : destination.start - site.gapXml.length;
|
|
455230
|
+
if (baseXml.slice(start, start + site.gapXml.length) !== site.gapXml) {
|
|
455231
|
+
throw new Error(`table move supporting paragraph gap changed for ${table.tableNodeId}`);
|
|
455232
|
+
}
|
|
455233
|
+
return site.placement === "after" ? destination.start + site.gapXml.length : start;
|
|
455234
|
+
}
|
|
454764
455235
|
function resolveStoryBodyEndInsertionSpan(previous3) {
|
|
454765
455236
|
const sectionStart = previous3.xml.lastIndexOf("<w:sectPr");
|
|
454766
455237
|
const bodyEnd = previous3.xml.lastIndexOf("</w:body>");
|
|
@@ -455530,6 +456001,16 @@ function composeInitialTableBaseProjection(input) {
|
|
|
455530
456001
|
sourceByteSpans.set(block.blockId, sourceByteSpan);
|
|
455531
456002
|
}
|
|
455532
456003
|
const insertionSpanFor = (blockIndex) => {
|
|
456004
|
+
const blockId = snapshot3.blocks[blockIndex].blockId;
|
|
456005
|
+
const supportingMove = input.tableReplacements.find((table) => table.relocation && table.nonTableAffectedBlockIds.includes(blockId));
|
|
456006
|
+
if (supportingMove) {
|
|
456007
|
+
const offset2 = resolveSupportingMoveParagraphOffset(sourceXml, input.storyId, supportingMove);
|
|
456008
|
+
return [offset2, offset2];
|
|
456009
|
+
}
|
|
456010
|
+
if (input.tableReplacements.some((table) => table.creationPlacement === "before" && table.creationRelativeToBlockId === blockId && table.nonTableAffectedBlockIds.includes(blockId))) {
|
|
456011
|
+
const offset2 = resolveTableCreateInsertionSpan({ baseXml: sourceXml, storyId: input.storyId, placement: "append", blockDigests: [] }).start;
|
|
456012
|
+
return [offset2, offset2];
|
|
456013
|
+
}
|
|
455533
456014
|
const split = input.tableReplacements.find((replacement) => replacement.splitSeparatorBlockIds.includes(snapshot3.blocks[blockIndex].blockId));
|
|
455534
456015
|
if (split) {
|
|
455535
456016
|
const following = split.tableBlockIds[0] ?? split.tableNodeId.replace(/^tbl:/, "");
|
|
@@ -459371,7 +459852,7 @@ function readParagraphNamespaceBindings(bytes) {
|
|
|
459371
459852
|
let charCursor = 0;
|
|
459372
459853
|
let byteCursor = leadingBomLength(bytes);
|
|
459373
459854
|
for (const paragraph4 of paragraphs) {
|
|
459374
|
-
byteCursor +=
|
|
459855
|
+
byteCursor += TEXT_ENCODER5.encode(xml.slice(charCursor, paragraph4.openStart)).byteLength;
|
|
459375
459856
|
bindingsByByteStart.set(byteCursor, paragraph4.namespaceBindings);
|
|
459376
459857
|
charCursor = paragraph4.openStart;
|
|
459377
459858
|
}
|
|
@@ -459409,11 +459890,11 @@ function escapeRegex16(value2) {
|
|
|
459409
459890
|
function leadingBomLength(bytes) {
|
|
459410
459891
|
return bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191 ? 3 : 0;
|
|
459411
459892
|
}
|
|
459412
|
-
var TEXT_DECODER9,
|
|
459893
|
+
var TEXT_DECODER9, TEXT_ENCODER5;
|
|
459413
459894
|
var init_paragraph_namespace_bindings = __esm(() => {
|
|
459414
459895
|
init_sd_document_session_internal();
|
|
459415
459896
|
TEXT_DECODER9 = new TextDecoder("utf-8", { fatal: false });
|
|
459416
|
-
|
|
459897
|
+
TEXT_ENCODER5 = new TextEncoder;
|
|
459417
459898
|
});
|
|
459418
459899
|
|
|
459419
459900
|
// ../../../v2/collaboration-v2/dist/story-shard/table-structural-refs.js
|
|
@@ -460524,8 +461005,8 @@ function readSessionStoryPayloads(context) {
|
|
|
460524
461005
|
};
|
|
460525
461006
|
const payloads = [...context.index.entries].sort((left, right) => left.byteStart - right.byteStart).map((entry) => {
|
|
460526
461007
|
const refs = context.tableRefsByBlockId.get(entry.blockId);
|
|
460527
|
-
const leadingXml =
|
|
460528
|
-
const xml =
|
|
461008
|
+
const leadingXml = TD130.decode(context.bytes.slice(cursor, entry.byteStart));
|
|
461009
|
+
const xml = TD130.decode(context.bytes.slice(entry.byteStart, entry.byteEnd));
|
|
460529
461010
|
const namespaceBindings = context.resolveNamespaceBindings({ xml, byteStart: entry.byteStart });
|
|
460530
461011
|
advanceTrackedWrapperIdentityState(leadingXml, namespaceBindings, trackedWrapperIdentityState);
|
|
460531
461012
|
const trackedWrapperOccurrenceStart = trackedWrapperIdentityState.occurrence;
|
|
@@ -460553,7 +461034,7 @@ function readSessionStoryPayloads(context) {
|
|
|
460553
461034
|
});
|
|
460554
461035
|
return {
|
|
460555
461036
|
payloads,
|
|
460556
|
-
trailingXml:
|
|
461037
|
+
trailingXml: TD130.decode(context.bytes.slice(cursor, contentWindow.byteEnd))
|
|
460557
461038
|
};
|
|
460558
461039
|
}
|
|
460559
461040
|
function readSessionBlockPayload(context, blockId) {
|
|
@@ -460562,7 +461043,7 @@ function readSessionBlockPayload(context, blockId) {
|
|
|
460562
461043
|
throw new Error(`story-surface session sync could not resolve paragraph ${blockId} in ${context.storyId}`);
|
|
460563
461044
|
}
|
|
460564
461045
|
const refs = context.tableRefsByBlockId.get(entry.blockId);
|
|
460565
|
-
const xml =
|
|
461046
|
+
const xml = TD130.decode(context.bytes.slice(entry.byteStart, entry.byteEnd));
|
|
460566
461047
|
return {
|
|
460567
461048
|
storyId: entry.storyId,
|
|
460568
461049
|
storyRevision: String(entry.storyRevision),
|
|
@@ -460708,7 +461189,7 @@ function writeParagraphMembershipTableOverlaysFromSession(session, prepared, sto
|
|
|
460708
461189
|
...tableBlockIds,
|
|
460709
461190
|
...affectedBlockIds.filter((blockId) => knownTableBlockIds.has(blockId))
|
|
460710
461191
|
])];
|
|
460711
|
-
const tableXml =
|
|
461192
|
+
const tableXml = TD130.decode(bytes.slice(table.tableByteStart, table.tableByteEnd));
|
|
460712
461193
|
const sourceXmlStart = byteOffsetToCharOffset(bytes, table.tableByteStart);
|
|
460713
461194
|
const sourceXmlEnd = sourceXmlStart + tableXml.length;
|
|
460714
461195
|
writeTableOverlayState({
|
|
@@ -460760,7 +461241,7 @@ function reconcileTableOverlaysFromSession(session, prepared, storyId, doc2, opt
|
|
|
460760
461241
|
return;
|
|
460761
461242
|
for (const table of currentCatalog.tables) {
|
|
460762
461243
|
const affectedBlockIds = currentIndex.entries.filter((entry) => entry.byteStart >= table.tableByteStart && entry.byteEnd <= table.tableByteEnd).map((entry) => entry.blockId);
|
|
460763
|
-
const tableXml =
|
|
461244
|
+
const tableXml = TD130.decode(bytes.slice(table.tableByteStart, table.tableByteEnd));
|
|
460764
461245
|
const sourceXmlStart = byteOffsetToCharOffset(bytes, table.tableByteStart);
|
|
460765
461246
|
const createdTableIdentity = createdTableIdentityBlockId(table.tableNodeId);
|
|
460766
461247
|
writeTableOverlayState({
|
|
@@ -460813,7 +461294,7 @@ function projectionAnchorForCreatedTable(input) {
|
|
|
460813
461294
|
return owningTable?.tableNodeId ?? entry.blockId;
|
|
460814
461295
|
}
|
|
460815
461296
|
function writeCreatedTableOverlayFromSession(input) {
|
|
460816
|
-
const tableXml =
|
|
461297
|
+
const tableXml = TD130.decode(input.context.bytes.slice(input.table.tableByteStart, input.table.tableByteEnd));
|
|
460817
461298
|
const sourceXmlStart = byteOffsetToCharOffset(input.context.bytes, input.table.tableByteStart);
|
|
460818
461299
|
const tableMap = getStoryTablesMap(input.doc);
|
|
460819
461300
|
writeTableOverlayState({
|
|
@@ -460935,7 +461416,7 @@ function syncTrackedDecisionTableOverlaysFromSession(session, prepared, storyId,
|
|
|
460935
461416
|
const overlayTableNodeId = resolveTrackedDecisionTableOverlayOwner(tableMap, table.tableNodeId, affectedBlockIds);
|
|
460936
461417
|
const currentOverlay = tableMap.get(overlayTableNodeId);
|
|
460937
461418
|
const existingOverlay = hasTableOverlaySourceCoordinates(currentOverlay);
|
|
460938
|
-
const tableXml =
|
|
461419
|
+
const tableXml = TD130.decode(bytes.slice(table.tableByteStart, table.tableByteEnd));
|
|
460939
461420
|
const tableCoordinatesChanged = currentOverlay instanceof YMap && (currentOverlay.get("sourceByteStart") !== table.tableByteStart || currentOverlay.get("sourceByteEnd") !== table.tableByteEnd);
|
|
460940
461421
|
const tableXmlChanged = currentOverlay instanceof YMap && currentOverlay.get("xml") !== tableXml;
|
|
460941
461422
|
if (!shouldSyncTable(table.tableNodeId) && !tableCoordinatesChanged && !tableXmlChanged)
|
|
@@ -461039,8 +461520,8 @@ function writeTableOverlayState(input) {
|
|
|
461039
461520
|
reconcileTableStructuralProperties(tableState, input.table, input.tableXml);
|
|
461040
461521
|
}
|
|
461041
461522
|
function reconcileTableStructuralProperties(tableState, table, tableXml) {
|
|
461042
|
-
const tableBytes =
|
|
461043
|
-
const xmlForRange = (start, end) =>
|
|
461523
|
+
const tableBytes = TE79.encode(tableXml);
|
|
461524
|
+
const xmlForRange = (start, end) => TD130.decode(tableBytes.slice(start - table.tableByteStart, end - table.tableByteStart));
|
|
461044
461525
|
for (const row of table.rows) {
|
|
461045
461526
|
reconcileTableStructuralProperty(tableState, `rowProperties:${row.rowNodeId}`, readDirectChildPropertyXml3(xmlForRange(row.rowByteStart, row.rowByteEnd), "tr", "trPr"));
|
|
461046
461527
|
for (const cell of row.cells) {
|
|
@@ -461079,7 +461560,7 @@ function readDirectChildPropertyXml3(xml, rootLocalName, propertyLocalName) {
|
|
|
461079
461560
|
function byteOffsetToCharOffset(bytes, byteOffset) {
|
|
461080
461561
|
if (byteOffset <= 0)
|
|
461081
461562
|
return 0;
|
|
461082
|
-
return
|
|
461563
|
+
return TD130.decode(bytes.slice(0, byteOffset)).length;
|
|
461083
461564
|
}
|
|
461084
461565
|
function writeStringArray2(map5, key2, values2) {
|
|
461085
461566
|
let arrayValue = map5.get(key2);
|
|
@@ -461313,7 +461794,7 @@ function inferStoryKindFromStoryId(storyId) {
|
|
|
461313
461794
|
return storyId.split(":", 1)[0] ?? "preserved";
|
|
461314
461795
|
}
|
|
461315
461796
|
function resolveStoryContentWindow(bytes, storyKind, entries2) {
|
|
461316
|
-
const xml =
|
|
461797
|
+
const xml = TD130.decode(bytes);
|
|
461317
461798
|
const root = extractRootEnvelope(xml);
|
|
461318
461799
|
if (!root) {
|
|
461319
461800
|
return deriveContentWindowFromEntrySpans(bytes, entries2);
|
|
@@ -461388,10 +461869,10 @@ function utf8ByteLength8(xml, codeUnitIndex) {
|
|
|
461388
461869
|
if (codeUnitIndex <= 0)
|
|
461389
461870
|
return 0;
|
|
461390
461871
|
if (codeUnitIndex >= xml.length)
|
|
461391
|
-
return
|
|
461392
|
-
return
|
|
461872
|
+
return TE79.encode(xml).length;
|
|
461873
|
+
return TE79.encode(xml.slice(0, codeUnitIndex)).length;
|
|
461393
461874
|
}
|
|
461394
|
-
var
|
|
461875
|
+
var TD130, TE79;
|
|
461395
461876
|
var init_story_surface_session_sync = __esm(() => {
|
|
461396
461877
|
init_yjs();
|
|
461397
461878
|
init_scope3();
|
|
@@ -461409,8 +461890,8 @@ var init_story_surface_session_sync = __esm(() => {
|
|
|
461409
461890
|
init_story_surface_origin();
|
|
461410
461891
|
init_paragraph_inline_sync();
|
|
461411
461892
|
init_story_surface_origin();
|
|
461412
|
-
|
|
461413
|
-
|
|
461893
|
+
TD130 = new TextDecoder;
|
|
461894
|
+
TE79 = new TextEncoder;
|
|
461414
461895
|
});
|
|
461415
461896
|
|
|
461416
461897
|
// ../../../v2/collaboration-v2/dist/index.js
|
|
@@ -465901,10 +466382,10 @@ function scanWmlParagraphSeedSpans(bytes) {
|
|
|
465901
466382
|
if (paragraph4.openStart < containingParagraphEnd)
|
|
465902
466383
|
continue;
|
|
465903
466384
|
const ordinal = spans.length;
|
|
465904
|
-
byteCursor +=
|
|
466385
|
+
byteCursor += TEXT_ENCODER6.encode(xml.slice(charCursor, paragraph4.openStart)).length;
|
|
465905
466386
|
const paragraphXml = xml.slice(paragraph4.openStart, paragraph4.closeEnd);
|
|
465906
466387
|
const byteStart = byteCursor;
|
|
465907
|
-
const byteEnd = byteStart +
|
|
466388
|
+
const byteEnd = byteStart + TEXT_ENCODER6.encode(paragraphXml).length;
|
|
465908
466389
|
spans.push({
|
|
465909
466390
|
xml: paragraphXml,
|
|
465910
466391
|
byteStart,
|
|
@@ -465968,10 +466449,10 @@ function scanParagraphXmlSpansLocal(bytes, storyKind) {
|
|
|
465968
466449
|
const paragraphXml = match[0];
|
|
465969
466450
|
const matchIndex = match.index ?? 0;
|
|
465970
466451
|
if (matchIndex > charCursor) {
|
|
465971
|
-
byteCursor +=
|
|
466452
|
+
byteCursor += TEXT_ENCODER6.encode(xml.slice(charCursor, matchIndex)).length;
|
|
465972
466453
|
}
|
|
465973
466454
|
const byteStart = byteCursor;
|
|
465974
|
-
const byteEnd = byteStart +
|
|
466455
|
+
const byteEnd = byteStart + TEXT_ENCODER6.encode(paragraphXml).length;
|
|
465975
466456
|
const openTag = paragraphXml.match(/^<[\w.-]+:p\b[^>]*[/]?>/)?.[0] ?? "";
|
|
465976
466457
|
const paraId = attrLocal3(openTag, "paraId");
|
|
465977
466458
|
spans.push({
|
|
@@ -466065,7 +466546,7 @@ function xmlDeclarationPrefixLength2(xml) {
|
|
|
466065
466546
|
function utf8ByteLength9(xml, codeUnitIndex) {
|
|
466066
466547
|
if (codeUnitIndex <= 0)
|
|
466067
466548
|
return 0;
|
|
466068
|
-
return
|
|
466549
|
+
return TEXT_ENCODER6.encode(xml.slice(0, codeUnitIndex)).length;
|
|
466069
466550
|
}
|
|
466070
466551
|
function leadingBomLength2(bytes) {
|
|
466071
466552
|
return bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191 ? 3 : 0;
|
|
@@ -466074,14 +466555,14 @@ function attrLocal3(tag, localName3) {
|
|
|
466074
466555
|
const re = new RegExp(String.raw`(?:[\w.-]+:)?${localName3}="([^"]+)"`);
|
|
466075
466556
|
return tag.match(re)?.[1] ?? null;
|
|
466076
466557
|
}
|
|
466077
|
-
var TEXT_DECODER10,
|
|
466558
|
+
var TEXT_DECODER10, TEXT_ENCODER6, PARAGRAPH_REGEX;
|
|
466078
466559
|
var init_story_paragraph_seed = __esm(() => {
|
|
466079
466560
|
init_sd_document_session_internal();
|
|
466080
466561
|
init_parse_paragraph();
|
|
466081
466562
|
init_paragraph_namespace_bindings();
|
|
466082
466563
|
init_table_structural_refs();
|
|
466083
466564
|
TEXT_DECODER10 = new TextDecoder("utf-8", { fatal: false });
|
|
466084
|
-
|
|
466565
|
+
TEXT_ENCODER6 = new TextEncoder;
|
|
466085
466566
|
PARAGRAPH_REGEX = /<[\w.-]+:p\b[^>]*\/>|<[\w.-]+:p\b[^>]*>[\s\S]*?<\/[\w.-]+:p>/g;
|
|
466086
466567
|
});
|
|
466087
466568
|
|