@superdoc/mcp 1.10.0-next.11 → 1.10.0-next.12
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 +325 -77
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31630,7 +31630,7 @@ var init_host = __esm(() => {
|
|
|
31630
31630
|
});
|
|
31631
31631
|
|
|
31632
31632
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31633
|
-
var SDK_VERSION = "2.23.0-next.
|
|
31633
|
+
var SDK_VERSION = "2.23.0-next.12";
|
|
31634
31634
|
|
|
31635
31635
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31636
31636
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -218056,6 +218056,7 @@ function compileSemanticStyleDependencies(state, requestedRoles, roleStyleIdHint
|
|
|
218056
218056
|
const occupied = new Set(Object.keys(records));
|
|
218057
218057
|
const styleIdByRole = new Map;
|
|
218058
218058
|
const definitions = [];
|
|
218059
|
+
const hasThemePart = documentHasThemePart(state);
|
|
218059
218060
|
for (const role of roles) {
|
|
218060
218061
|
const resolution = index.resolve(role);
|
|
218061
218062
|
if (resolution.status === "authored") {
|
|
@@ -218082,6 +218083,8 @@ function compileSemanticStyleDependencies(state, requestedRoles, roleStyleIdHint
|
|
|
218082
218083
|
});
|
|
218083
218084
|
if (!definition)
|
|
218084
218085
|
return { ok: false, reason: "style-reference-not-found" };
|
|
218086
|
+
if (!hasThemePart)
|
|
218087
|
+
withoutThemeReferences(definition);
|
|
218085
218088
|
definitions.push(definition);
|
|
218086
218089
|
occupied.add(styleId);
|
|
218087
218090
|
records[styleId] = definition;
|
|
@@ -218453,7 +218456,52 @@ function byteWindowPrecondition3(partUri, bytes) {
|
|
|
218453
218456
|
exactLength: bytes.length
|
|
218454
218457
|
};
|
|
218455
218458
|
}
|
|
218456
|
-
|
|
218459
|
+
function withoutThemeReferences(definition) {
|
|
218460
|
+
const run = definition.runProperties;
|
|
218461
|
+
if (!run)
|
|
218462
|
+
return;
|
|
218463
|
+
const fontFamily = run.fontFamily;
|
|
218464
|
+
if (fontFamily) {
|
|
218465
|
+
const literal3 = {};
|
|
218466
|
+
for (const [key3, value] of Object.entries(fontFamily)) {
|
|
218467
|
+
if (!/Theme$|^cstheme$/i.test(key3))
|
|
218468
|
+
literal3[key3] = value;
|
|
218469
|
+
}
|
|
218470
|
+
const ascii = fontFamily.ascii ?? THEME_FONT_FALLBACKS[fontFamily.asciiTheme ?? ""];
|
|
218471
|
+
const hAnsi = fontFamily.hAnsi ?? THEME_FONT_FALLBACKS[fontFamily.hAnsiTheme ?? ""] ?? ascii;
|
|
218472
|
+
if (ascii)
|
|
218473
|
+
literal3.ascii = ascii;
|
|
218474
|
+
if (hAnsi)
|
|
218475
|
+
literal3.hAnsi = hAnsi;
|
|
218476
|
+
if (Object.keys(literal3).length)
|
|
218477
|
+
run.fontFamily = literal3;
|
|
218478
|
+
else
|
|
218479
|
+
delete run.fontFamily;
|
|
218480
|
+
}
|
|
218481
|
+
const color = run.color;
|
|
218482
|
+
if (color?.themeColor) {
|
|
218483
|
+
if (color.val)
|
|
218484
|
+
run.color = { val: color.val };
|
|
218485
|
+
else
|
|
218486
|
+
delete run.color;
|
|
218487
|
+
}
|
|
218488
|
+
}
|
|
218489
|
+
function documentHasThemePart(state) {
|
|
218490
|
+
const relsUri = "/word/_rels/document.xml.rels";
|
|
218491
|
+
const relsBytes = ensurePackagePartBytes(state, relsUri);
|
|
218492
|
+
if (relsBytes) {
|
|
218493
|
+
const rels = parseRelationshipsXml(new TextDecoder().decode(relsBytes), {
|
|
218494
|
+
ownerPartUri: "/word/document.xml",
|
|
218495
|
+
relsUri,
|
|
218496
|
+
resolveTarget: (target, mode) => mode === "External" ? target : resolveTargetUri("/word/document.xml", target, mode, state.parts)
|
|
218497
|
+
});
|
|
218498
|
+
const related = rels.relationships.some((rel) => rel.targetMode === "Internal" && rel.type.endsWith("/relationships/theme") && state.parts.has(rel.resolvedTarget));
|
|
218499
|
+
if (related)
|
|
218500
|
+
return true;
|
|
218501
|
+
}
|
|
218502
|
+
return [...state.parts.keys()].some((uri) => /\/theme\/theme\d*\.xml$/i.test(uri));
|
|
218503
|
+
}
|
|
218504
|
+
var TE22, TD48, CONTENT_TYPES_NS3 = "http://schemas.openxmlformats.org/package/2006/content-types", STYLES_PART_URI, CONTENT_TYPES_PART_URI4 = "/[Content_Types].xml", STYLES_CONTENT_TYPE, STYLES_RELATIONSHIP_TYPE, THEME_FONT_FALLBACKS;
|
|
218457
218505
|
var init_semantic_style_dependencies = __esm(() => {
|
|
218458
218506
|
init_semantic_style_roles();
|
|
218459
218507
|
init_semantic_style_definitions();
|
|
@@ -218468,6 +218516,12 @@ var init_semantic_style_dependencies = __esm(() => {
|
|
|
218468
218516
|
STYLES_PART_URI = CANONICAL_STYLE_DEFINITIONS_PART_URI;
|
|
218469
218517
|
STYLES_CONTENT_TYPE = CONTENT_TYPE_FOR_KIND.styles;
|
|
218470
218518
|
STYLES_RELATIONSHIP_TYPE = RELATIONSHIP_TYPE_FOR_KIND.styles;
|
|
218519
|
+
THEME_FONT_FALLBACKS = {
|
|
218520
|
+
majorHAnsi: "Calibri Light",
|
|
218521
|
+
majorAscii: "Calibri Light",
|
|
218522
|
+
minorHAnsi: "Calibri",
|
|
218523
|
+
minorAscii: "Calibri"
|
|
218524
|
+
};
|
|
218471
218525
|
});
|
|
218472
218526
|
|
|
218473
218527
|
// ../../../v2/editor-core/dist/document/transactions/types.js
|
|
@@ -223018,6 +223072,7 @@ function runListApplyCommit(input) {
|
|
|
223018
223072
|
const paraRewrite = trackedFormatting ? rewriteParagraphNumPrTracked(paraXml, { numId: chosenNumId, ilvl }, trackedFormatting) : rewriteParagraphNumPr(paraXml, { numId: chosenNumId, ilvl });
|
|
223019
223073
|
if (!paraRewrite.ok)
|
|
223020
223074
|
return rejected4(input.txId, paraRewrite.reason);
|
|
223075
|
+
const recordedRevision = recordedFormatting(trackedFormatting, paraRewrite);
|
|
223021
223076
|
const paragraphPatch = {
|
|
223022
223077
|
kind: "replaceBytes",
|
|
223023
223078
|
order: 0,
|
|
@@ -223059,10 +223114,10 @@ function runListApplyCommit(input) {
|
|
|
223059
223114
|
perPart,
|
|
223060
223115
|
preconditions,
|
|
223061
223116
|
extraPatchMaps,
|
|
223062
|
-
createdRefs:
|
|
223117
|
+
createdRefs: recordedRevision ? [
|
|
223063
223118
|
{
|
|
223064
223119
|
kind: "trackedChange",
|
|
223065
|
-
entityId:
|
|
223120
|
+
entityId: recordedRevision.entityKey,
|
|
223066
223121
|
storyId: op.target.storyId
|
|
223067
223122
|
}
|
|
223068
223123
|
] : [],
|
|
@@ -223260,10 +223315,11 @@ function runListApplyRangeCommit(input) {
|
|
|
223260
223315
|
const paraRewrite = trackedFormatting ? rewriteParagraphNumPrTracked(target.paraXml, { numId: chosenNumId, ilvl: writeIlvl }, trackedFormatting) : rewriteParagraphNumPr(target.paraXml, { numId: chosenNumId, ilvl: writeIlvl });
|
|
223261
223316
|
if (!paraRewrite.ok)
|
|
223262
223317
|
return rejected4(input.txId, paraRewrite.reason);
|
|
223263
|
-
|
|
223318
|
+
const recordedRevision = recordedFormatting(trackedFormatting, paraRewrite);
|
|
223319
|
+
if (recordedRevision) {
|
|
223264
223320
|
trackedCreatedRefs.push({
|
|
223265
223321
|
kind: "trackedChange",
|
|
223266
|
-
entityId:
|
|
223322
|
+
entityId: recordedRevision.entityKey,
|
|
223267
223323
|
storyId: op.target.storyId
|
|
223268
223324
|
});
|
|
223269
223325
|
}
|
|
@@ -223438,6 +223494,7 @@ function runListRestartCommit(input) {
|
|
|
223438
223494
|
});
|
|
223439
223495
|
if (!paraRewrite.ok)
|
|
223440
223496
|
return rejected4(input.txId, paraRewrite.reason);
|
|
223497
|
+
const recordedRevision = recordedFormatting(trackedFormatting, paraRewrite);
|
|
223441
223498
|
const paragraphPatch = {
|
|
223442
223499
|
kind: "replaceBytes",
|
|
223443
223500
|
order: 0,
|
|
@@ -223481,10 +223538,10 @@ function runListRestartCommit(input) {
|
|
|
223481
223538
|
extraPatchMaps: {
|
|
223482
223539
|
[NUMBERING_PART_URI]: { partUri: NUMBERING_PART_URI, ranges: [] }
|
|
223483
223540
|
},
|
|
223484
|
-
createdRefs:
|
|
223541
|
+
createdRefs: recordedRevision ? [
|
|
223485
223542
|
{
|
|
223486
223543
|
kind: "trackedChange",
|
|
223487
|
-
entityId:
|
|
223544
|
+
entityId: recordedRevision.entityKey,
|
|
223488
223545
|
storyId: op.target.storyId
|
|
223489
223546
|
}
|
|
223490
223547
|
] : [],
|
|
@@ -223725,7 +223782,7 @@ function changeIlvlRange(input, delta) {
|
|
|
223725
223782
|
entry: target.entry,
|
|
223726
223783
|
paraXml,
|
|
223727
223784
|
nextXml: rewrite.xml,
|
|
223728
|
-
trackedEntityKey: trackedFormatting?.entityKey ?? null
|
|
223785
|
+
trackedEntityKey: recordedFormatting(trackedFormatting, rewrite)?.entityKey ?? null
|
|
223729
223786
|
});
|
|
223730
223787
|
}
|
|
223731
223788
|
if (!storyPartUri || !storyBytes)
|
|
@@ -223825,15 +223882,16 @@ function runListRemoveCommit(input) {
|
|
|
223825
223882
|
const rewrite = trackedFormatting ? wrapParagraphTrackedChange(directRewrite.xml, paraXml, trackedFormatting) : directRewrite;
|
|
223826
223883
|
if (!rewrite.ok)
|
|
223827
223884
|
return rejected4(input.txId, rewrite.reason);
|
|
223885
|
+
const recordedRevision = recordedFormatting(trackedFormatting, rewrite);
|
|
223828
223886
|
return commitParagraphRewrite({
|
|
223829
223887
|
input,
|
|
223830
223888
|
target,
|
|
223831
223889
|
bytes,
|
|
223832
223890
|
nextXml: rewrite.xml,
|
|
223833
|
-
createdRefs:
|
|
223891
|
+
createdRefs: recordedRevision ? [
|
|
223834
223892
|
{
|
|
223835
223893
|
kind: "trackedChange",
|
|
223836
|
-
entityId:
|
|
223894
|
+
entityId: recordedRevision.entityKey,
|
|
223837
223895
|
storyId: op.target.storyId
|
|
223838
223896
|
}
|
|
223839
223897
|
] : [],
|
|
@@ -224110,15 +224168,16 @@ function commitParagraphNumPrRewrite(args) {
|
|
|
224110
224168
|
const rewrite = args.trackedFormatting ? rewriteParagraphNumPrTracked(args.paraXml, args.numPr, args.trackedFormatting, args.paragraphStyleId) : rewriteParagraphNumPr(args.paraXml, args.numPr, args.paragraphStyleId);
|
|
224111
224169
|
if (!rewrite.ok)
|
|
224112
224170
|
return rejected4(args.input.txId, rewrite.reason);
|
|
224171
|
+
const recordedRevision = recordedFormatting(args.trackedFormatting, rewrite);
|
|
224113
224172
|
return commitParagraphRewrite({
|
|
224114
224173
|
input: args.input,
|
|
224115
224174
|
target: args.target,
|
|
224116
224175
|
bytes: args.bytes,
|
|
224117
224176
|
nextXml: rewrite.xml,
|
|
224118
|
-
createdRefs:
|
|
224177
|
+
createdRefs: recordedRevision ? [
|
|
224119
224178
|
{
|
|
224120
224179
|
kind: "trackedChange",
|
|
224121
|
-
entityId:
|
|
224180
|
+
entityId: recordedRevision.entityKey,
|
|
224122
224181
|
storyId: args.input.op.target.storyId
|
|
224123
224182
|
}
|
|
224124
224183
|
] : [],
|
|
@@ -224208,6 +224267,9 @@ function buildTrackedListFormattingAllocator(input, storyId) {
|
|
|
224208
224267
|
}
|
|
224209
224268
|
};
|
|
224210
224269
|
}
|
|
224270
|
+
function recordedFormatting(tracked, rewrite) {
|
|
224271
|
+
return tracked && rewrite.recorded ? tracked : undefined;
|
|
224272
|
+
}
|
|
224211
224273
|
function rewriteParagraphNumPrTracked(paraXml, numPr, tracked, paragraphStyleId) {
|
|
224212
224274
|
const direct = rewriteParagraphNumPr(paraXml, numPr, paragraphStyleId);
|
|
224213
224275
|
if (!direct.ok)
|
|
@@ -224223,6 +224285,9 @@ function wrapParagraphTrackedChange(nextParaXml, beforeParaXml, tracked) {
|
|
|
224223
224285
|
if (existingChange && existingChange.author !== tracked.author) {
|
|
224224
224286
|
return { ok: false, reason: "list-tracked-wrapper-unsupported" };
|
|
224225
224287
|
}
|
|
224288
|
+
if (beforeBlock && paragraphMarkInsertedBy(beforeBlock.inner, tracked.author) || paragraphMarkInsertedBy(afterBlock.inner, tracked.author)) {
|
|
224289
|
+
return { ok: true, xml: nextParaXml, recorded: false };
|
|
224290
|
+
}
|
|
224226
224291
|
const beforeXml = buildParagraphPropertyBaseSnapshot(existingChange?.innerXml ?? beforeBlock?.fullXml, afterBlock.prefix);
|
|
224227
224292
|
const afterInner = removeParagraphPropertyChangeBlocks(afterBlock.inner);
|
|
224228
224293
|
const names = wordNamesForPrefix(afterBlock.prefix);
|
|
@@ -224231,9 +224296,23 @@ function wrapParagraphTrackedChange(nextParaXml, beforeParaXml, tracked) {
|
|
|
224231
224296
|
const replacement2 = `${afterBlock.openTag}${afterInner}${wrapper}${afterBlock.closeTag}`;
|
|
224232
224297
|
return {
|
|
224233
224298
|
ok: true,
|
|
224234
|
-
xml: nextParaXml.slice(0, afterBlock.start) + replacement2 + nextParaXml.slice(afterBlock.end)
|
|
224299
|
+
xml: nextParaXml.slice(0, afterBlock.start) + replacement2 + nextParaXml.slice(afterBlock.end),
|
|
224300
|
+
recorded: true
|
|
224235
224301
|
};
|
|
224236
224302
|
}
|
|
224303
|
+
function paragraphMarkInsertedBy(pPrInner, author) {
|
|
224304
|
+
const markProps = /<(?:\w+:)?rPr\b[^>]*>([\s\S]*?)<\/(?:\w+:)?rPr>/.exec(pPrInner)?.[1];
|
|
224305
|
+
if (!markProps)
|
|
224306
|
+
return false;
|
|
224307
|
+
const ins = /<(?:\w+:)?ins\b([^>]*)\/?>/.exec(markProps)?.[1];
|
|
224308
|
+
if (ins == null)
|
|
224309
|
+
return false;
|
|
224310
|
+
const insAuthor = /(?:^|\s)(?:\w+:)?author="([^"]*)"/.exec(ins)?.[1];
|
|
224311
|
+
return insAuthor != null && unescapeAttr(insAuthor) === author;
|
|
224312
|
+
}
|
|
224313
|
+
function unescapeAttr(value) {
|
|
224314
|
+
return value.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
224315
|
+
}
|
|
224237
224316
|
function directXmlChildren(xml) {
|
|
224238
224317
|
const tagPattern = /<\/?([\w.-]+):([\w.-]+)\b[^>]*>/g;
|
|
224239
224318
|
const children = [];
|
|
@@ -271539,7 +271618,7 @@ function prepareLocalCommentInsert(state, bytes, range, commentId) {
|
|
|
271539
271618
|
});
|
|
271540
271619
|
if (!rewritten.ok)
|
|
271541
271620
|
return rewritten;
|
|
271542
|
-
const after = TE46.encode(rewritten.xml);
|
|
271621
|
+
const after = TE46.encode(hoistCommentAnchorsOutOfTrackedWrappers(rewritten.xml, commentId));
|
|
271543
271622
|
const evidence = commentParagraphEvidence(bytes, paragraph, paragraph.byteStart, paragraph.byteEnd, after.length);
|
|
271544
271623
|
return evidence ? {
|
|
271545
271624
|
ok: true,
|
|
@@ -271586,10 +271665,30 @@ function rewriteDocumentXml(documentXml, range, commentId, commentReferenceXml,
|
|
|
271586
271665
|
});
|
|
271587
271666
|
if (!rewritten.ok)
|
|
271588
271667
|
return rewritten;
|
|
271589
|
-
xml = xml.slice(0, p.byteStart) + rewritten.xml + xml.slice(p.byteEnd);
|
|
271668
|
+
xml = xml.slice(0, p.byteStart) + hoistCommentAnchorsOutOfTrackedWrappers(rewritten.xml, commentId) + xml.slice(p.byteEnd);
|
|
271590
271669
|
}
|
|
271591
271670
|
return { ok: true, xml };
|
|
271592
271671
|
}
|
|
271672
|
+
function hoistCommentAnchorsOutOfTrackedWrappers(paragraphXml, commentId) {
|
|
271673
|
+
const id = commentId.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
271674
|
+
const start = `(?:\\s*<(?:[\\w.-]+:)?commentRangeStart\\b[^>]*\\bw:id="${id}"[^>]*/>)`;
|
|
271675
|
+
const end = `(?:\\s*<(?:[\\w.-]+:)?commentRangeEnd\\b[^>]*\\bw:id="${id}"[^>]*/>)`;
|
|
271676
|
+
const reference = `(?:\\s*<(?:[\\w.-]+:)?r\\b[^>]*>(?:<(?:[\\w.-]+:)?rPr>[\\s\\S]*?</(?:[\\w.-]+:)?rPr>)?<(?:[\\w.-]+:)?commentReference\\b[^>]*\\bw:id="${id}"[^>]*/></(?:[\\w.-]+:)?r>)`;
|
|
271677
|
+
const leading = new RegExp(`^(${start}+)`);
|
|
271678
|
+
const trailing = new RegExp(`(${end}(?:${reference})?)\\s*$`);
|
|
271679
|
+
const wrapper = /<((?:[\w.-]+:)?(?:ins|del))\b([^>]*)>([\s\S]*?)<\/\1>/g;
|
|
271680
|
+
return paragraphXml.replace(wrapper, (whole, tag, attrs, inner) => {
|
|
271681
|
+
const before = leading.exec(inner)?.[1] ?? "";
|
|
271682
|
+
let body = inner.slice(before.length);
|
|
271683
|
+
const tail = trailing.exec(body);
|
|
271684
|
+
const after = tail ? body.slice(tail.index) : "";
|
|
271685
|
+
body = tail ? body.slice(0, tail.index) : body;
|
|
271686
|
+
if (!before && !after)
|
|
271687
|
+
return whole;
|
|
271688
|
+
const kept = body.trim() ? `<${tag}${attrs}>${body}</${tag}>` : "";
|
|
271689
|
+
return `${before}${kept}${after}`;
|
|
271690
|
+
});
|
|
271691
|
+
}
|
|
271593
271692
|
function prepareCommentAnchor(documentXml, range, inheritedNamespaceBindings) {
|
|
271594
271693
|
if (range.startBlockId !== range.endBlockId)
|
|
271595
271694
|
return null;
|
|
@@ -326296,22 +326395,75 @@ function setPageBordersXml(sectPrXml, borders) {
|
|
|
326296
326395
|
function clearPageBordersXml(sectPrXml) {
|
|
326297
326396
|
return removeSectPrChild(sectPrXml, "pgBorders");
|
|
326298
326397
|
}
|
|
326299
|
-
function
|
|
326300
|
-
const
|
|
326301
|
-
|
|
326302
|
-
|
|
326398
|
+
function prepareSettingsPart(context) {
|
|
326399
|
+
const relsBytes = readPartBytes2(context, DOCUMENT_RELS_PART_URI12);
|
|
326400
|
+
const relsXml = relsBytes ? readPartXml(context, DOCUMENT_RELS_PART_URI12) ?? "" : EMPTY_RELATIONSHIPS_XML3;
|
|
326401
|
+
const rels = readDocumentRelationships(relsXml);
|
|
326402
|
+
const related = rels.settingsUri;
|
|
326403
|
+
const settingsUri = related ?? SETTINGS_PART_URI5;
|
|
326404
|
+
const settingsBytes = readPartBytes2(context, settingsUri);
|
|
326405
|
+
if (settingsBytes) {
|
|
326406
|
+
return {
|
|
326407
|
+
ok: true,
|
|
326408
|
+
xml: readPartXml(context, settingsUri) ?? "",
|
|
326409
|
+
perPart: (nextXml) => ({ [settingsUri]: replaceWholePartEntry(settingsBytes, encodeXml(nextXml)) })
|
|
326410
|
+
};
|
|
326411
|
+
}
|
|
326412
|
+
if (related) {
|
|
326413
|
+
return { ok: false, failure: { code: "PRECONDITION_FAILED", message: `settings part ${related} is related but unreadable.` } };
|
|
326414
|
+
}
|
|
326415
|
+
if (rels.parseError) {
|
|
326416
|
+
return { ok: false, failure: { code: "PRECONDITION_FAILED", message: `document relationships are unreadable: ${rels.parseError}` } };
|
|
326417
|
+
}
|
|
326418
|
+
const contentTypesBytes = readPartBytes2(context, CONTENT_TYPES_PART_URI14);
|
|
326419
|
+
if (!contentTypesBytes) {
|
|
326420
|
+
return { ok: false, failure: { code: "PRECONDITION_FAILED", message: "[Content_Types].xml bytes are unavailable." } };
|
|
326303
326421
|
}
|
|
326304
|
-
|
|
326305
|
-
|
|
326422
|
+
let index = 1;
|
|
326423
|
+
while (rels.ids.has(`rId${index}`))
|
|
326424
|
+
index += 1;
|
|
326425
|
+
const nextRelsXml = addRelationship(relsXml, { id: `rId${index}`, type: SETTINGS_REL, target: "settings.xml" });
|
|
326426
|
+
const nextContentTypesXml = addContentTypeOverride(readPartXml(context, CONTENT_TYPES_PART_URI14) ?? "", SETTINGS_PART_URI5, SETTINGS_CT);
|
|
326427
|
+
return {
|
|
326428
|
+
ok: true,
|
|
326429
|
+
xml: EMPTY_SETTINGS_XML,
|
|
326430
|
+
perPart: (nextXml) => ({
|
|
326431
|
+
[SETTINGS_PART_URI5]: { kind: "create", bytes: encodeXml(nextXml), contentType: SETTINGS_CT },
|
|
326432
|
+
[DOCUMENT_RELS_PART_URI12]: relsBytes ? replaceWholePartEntry(relsBytes, encodeXml(nextRelsXml)) : { kind: "create", bytes: encodeXml(nextRelsXml), contentType: RELATIONSHIPS_CT },
|
|
326433
|
+
[CONTENT_TYPES_PART_URI14]: replaceWholePartEntry(contentTypesBytes, encodeXml(nextContentTypesXml))
|
|
326434
|
+
})
|
|
326435
|
+
};
|
|
326436
|
+
}
|
|
326437
|
+
function readableSettingsPartUri(context) {
|
|
326438
|
+
return readDocumentRelationships(readPartXml(context, DOCUMENT_RELS_PART_URI12) ?? "").settingsUri ?? SETTINGS_PART_URI5;
|
|
326439
|
+
}
|
|
326440
|
+
function readDocumentRelationships(relsXml) {
|
|
326441
|
+
if (!relsXml.trim())
|
|
326442
|
+
return { settingsUri: null, ids: new Set, parseError: null };
|
|
326443
|
+
const parsed = parseRelationshipsXml(relsXml, {
|
|
326444
|
+
ownerPartUri: DOCUMENT_PART_URI5,
|
|
326445
|
+
relsUri: DOCUMENT_RELS_PART_URI12,
|
|
326446
|
+
resolveTarget: (target, mode) => mode === "External" ? target : resolveTargetUri(DOCUMENT_PART_URI5, target, mode)
|
|
326447
|
+
});
|
|
326448
|
+
const settings = parsed.relationships.find((rel) => rel.targetMode === "Internal" && rel.type.endsWith("/relationships/settings"));
|
|
326449
|
+
return {
|
|
326450
|
+
settingsUri: settings?.resolvedTarget ?? null,
|
|
326451
|
+
ids: new Set(parsed.relationships.map((rel) => rel.id)),
|
|
326452
|
+
parseError: parsed.parseError
|
|
326453
|
+
};
|
|
326454
|
+
}
|
|
326455
|
+
function setOddEvenHeadersFootersXml(context, enabled, options) {
|
|
326456
|
+
const settings = prepareSettingsPart(context);
|
|
326457
|
+
if (!settings.ok)
|
|
326458
|
+
return settings;
|
|
326459
|
+
const nextXml = enabled ? upsertSettingsChild(settings.xml, "evenAndOddHeaders", "<w:evenAndOddHeaders/>") : removeSettingsChild(settings.xml, "evenAndOddHeaders");
|
|
326306
326460
|
if (options?.dryRun)
|
|
326307
326461
|
return { ok: true, dryRun: true };
|
|
326308
326462
|
const committed = commitKernelStorySurfacePatch({
|
|
326309
326463
|
context,
|
|
326310
326464
|
txIdPrefix: "sections-settings",
|
|
326311
326465
|
expectedRevision: options?.expectedRevision,
|
|
326312
|
-
perPart:
|
|
326313
|
-
[SETTINGS_PART_URI5]: replaceWholePartEntry(settingsBytes, encodeXml(nextXml))
|
|
326314
|
-
},
|
|
326466
|
+
perPart: settings.perPart(nextXml),
|
|
326315
326467
|
signalLanesToRebuild: ["sections"]
|
|
326316
326468
|
});
|
|
326317
326469
|
if (!committed.ok)
|
|
@@ -326520,12 +326672,14 @@ function borderElement(name, border) {
|
|
|
326520
326672
|
attrs.frame = border.frame ? "1" : "0";
|
|
326521
326673
|
return emptyElement(name, attrs);
|
|
326522
326674
|
}
|
|
326523
|
-
var RELATIONSHIPS_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", LIVE_SECTION_SIGNALS_CACHE, SECTPR_CHILD_ORDER, SECTPR_CHILD_RANK;
|
|
326675
|
+
var RELATIONSHIPS_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", LIVE_SECTION_SIGNALS_CACHE, SETTINGS_CT = "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", SETTINGS_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", RELATIONSHIPS_CT = "application/vnd.openxmlformats-package.relationships+xml", EMPTY_SETTINGS_XML, EMPTY_RELATIONSHIPS_XML3, SECTPR_CHILD_ORDER, SECTPR_CHILD_RANK;
|
|
326524
326676
|
var init_section_xml = __esm(() => {
|
|
326525
326677
|
init_xml();
|
|
326526
326678
|
init_sd_document_session_internal();
|
|
326527
326679
|
init_tracked_pr_change();
|
|
326528
326680
|
LIVE_SECTION_SIGNALS_CACHE = new WeakMap;
|
|
326681
|
+
EMPTY_SETTINGS_XML = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<w:settings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"></w:settings>';
|
|
326682
|
+
EMPTY_RELATIONSHIPS_XML3 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
326529
326683
|
SECTPR_CHILD_ORDER = [
|
|
326530
326684
|
"headerReference",
|
|
326531
326685
|
"footerReference",
|
|
@@ -336816,12 +336970,18 @@ function pushTrackedSourceMap(map3, sourceId, changeId) {
|
|
|
336816
336970
|
function visibleParagraphTextFromXml(xml) {
|
|
336817
336971
|
const stripped = stripTextboxContent2(stripParagraphProperties3(stripDeletedRevisions(xml)));
|
|
336818
336972
|
let out = "";
|
|
336819
|
-
for (const token of stripped.matchAll(/<[\w.-]+:t\b[^>]*>([\s\S]*?)<\/[\w.-]+:t>|<[\w.-]+:(tab|br|cr)\b[^>]
|
|
336973
|
+
for (const token of stripped.matchAll(/<(?:[\w.-]+:)?t\b(?![^>]*\/>)[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?t>|<(?:[\w.-]+:)?(tab|br|cr|noBreakHyphen|footnoteReference|endnoteReference)\b[^>]*\/?>/g)) {
|
|
336820
336974
|
if (token[1] != null) {
|
|
336821
336975
|
out += decodeXmlText9(token[1]);
|
|
336822
336976
|
continue;
|
|
336823
336977
|
}
|
|
336824
|
-
|
|
336978
|
+
const control2 = token[2];
|
|
336979
|
+
if (control2 === "noBreakHyphen")
|
|
336980
|
+
out += "‑";
|
|
336981
|
+
else if (control2 === "footnoteReference" || control2 === "endnoteReference")
|
|
336982
|
+
out += "";
|
|
336983
|
+
else
|
|
336984
|
+
out += control2 === "tab" ? "\t" : `
|
|
336825
336985
|
`;
|
|
336826
336986
|
}
|
|
336827
336987
|
return out;
|
|
@@ -336909,9 +337069,9 @@ function visibleTrackedChangeSourceSlicesFromXml(xml, qualified, storyId) {
|
|
|
336909
337069
|
const slices = [];
|
|
336910
337070
|
const activeSourceIdStack = [];
|
|
336911
337071
|
const elementStack = [];
|
|
336912
|
-
let
|
|
337072
|
+
let removalDepth = 0;
|
|
336913
337073
|
let cursor = 0;
|
|
336914
|
-
const tokenRe = /<\/(?:[\w.-]+:)?(ins|del|moveFrom|moveTo)>|<(?:[\w.-]+:)?t\b[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?t>|<(?:[\w.-]+:)?delText\b[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?delText>|<(?:[\w.-]+:)?(ins|del|moveFrom|moveTo|tab|br|cr)\b([^>]*)\/?>/g;
|
|
337074
|
+
const tokenRe = /<\/(?:[\w.-]+:)?(ins|del|moveFrom|moveTo)>|<(?:[\w.-]+:)?t\b(?![^>]*\/>)[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?t>|<(?:[\w.-]+:)?delText\b(?![^>]*\/>)[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?delText>|<(?:[\w.-]+:)?(ins|del|moveFrom|moveTo|tab|br|cr|noBreakHyphen|footnoteReference|endnoteReference)\b([^>]*)\/?>/g;
|
|
336915
337075
|
for (const match of stripped.matchAll(tokenRe)) {
|
|
336916
337076
|
const closingName = match[1];
|
|
336917
337077
|
const tText = match[2];
|
|
@@ -336922,12 +337082,12 @@ function visibleTrackedChangeSourceSlicesFromXml(xml, qualified, storyId) {
|
|
|
336922
337082
|
const frame = elementStack.pop();
|
|
336923
337083
|
if (frame?.hadId)
|
|
336924
337084
|
activeSourceIdStack.pop();
|
|
336925
|
-
if (closingName === "del")
|
|
336926
|
-
|
|
337085
|
+
if (closingName === "del" || closingName === "moveFrom")
|
|
337086
|
+
removalDepth = Math.max(0, removalDepth - 1);
|
|
336927
337087
|
continue;
|
|
336928
337088
|
}
|
|
336929
337089
|
if (tText != null) {
|
|
336930
|
-
if (
|
|
337090
|
+
if (removalDepth > 0) {
|
|
336931
337091
|
pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIdStack);
|
|
336932
337092
|
} else {
|
|
336933
337093
|
cursor = pushTrackedSourceSlice(slices, cursor, decodeXmlText9(tText).length, activeSourceIdStack);
|
|
@@ -336940,8 +337100,8 @@ function visibleTrackedChangeSourceSlicesFromXml(xml, qualified, storyId) {
|
|
|
336940
337100
|
}
|
|
336941
337101
|
if (!openingName)
|
|
336942
337102
|
continue;
|
|
336943
|
-
if (openingName === "tab" || openingName === "br" || openingName === "cr") {
|
|
336944
|
-
if (
|
|
337103
|
+
if (openingName === "tab" || openingName === "br" || openingName === "cr" || openingName === "noBreakHyphen" || openingName === "footnoteReference" || openingName === "endnoteReference") {
|
|
337104
|
+
if (removalDepth > 0) {
|
|
336945
337105
|
pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIdStack);
|
|
336946
337106
|
} else {
|
|
336947
337107
|
cursor = pushTrackedSourceSlice(slices, cursor, 1, activeSourceIdStack);
|
|
@@ -336956,8 +337116,8 @@ function visibleTrackedChangeSourceSlicesFromXml(xml, qualified, storyId) {
|
|
|
336956
337116
|
elementStack.push({ name: openingName, hadId: Boolean(sourceId) });
|
|
336957
337117
|
if (sourceId)
|
|
336958
337118
|
activeSourceIdStack.push(sourceId);
|
|
336959
|
-
if (openingName === "del")
|
|
336960
|
-
|
|
337119
|
+
if (openingName === "del" || openingName === "moveFrom")
|
|
337120
|
+
removalDepth += 1;
|
|
336961
337121
|
}
|
|
336962
337122
|
}
|
|
336963
337123
|
return slices;
|
|
@@ -337002,7 +337162,7 @@ function stripParagraphProperties3(xml) {
|
|
|
337002
337162
|
return stripElements(xml, "pPr");
|
|
337003
337163
|
}
|
|
337004
337164
|
function stripDeletedRevisions(xml) {
|
|
337005
|
-
return xml
|
|
337165
|
+
return stripElements(stripElements(xml, "del"), "moveFrom");
|
|
337006
337166
|
}
|
|
337007
337167
|
function stripTextboxContent2(xml) {
|
|
337008
337168
|
return xml.replace(/<(?:[\w.-]+:)?txbxContent\b[^>]*>[\s\S]*?<\/(?:[\w.-]+:)?txbxContent>/g, "").replace(/<(?:[\w.-]+:)?txbxContent\b[^>]*>[\s\S]*$/g, "");
|
|
@@ -366818,12 +366978,25 @@ function greedyTokenMatches(before, after, aStart, aEnd, bStart, bEnd) {
|
|
|
366818
366978
|
}
|
|
366819
366979
|
return matches;
|
|
366820
366980
|
}
|
|
366981
|
+
function wordTokens(text4) {
|
|
366982
|
+
const out = [];
|
|
366983
|
+
for (const chunk of text4.match(/\S+|\s+/gu) ?? []) {
|
|
366984
|
+
const trailing = /\S/.test(chunk) ? TRAILING_PUNCTUATION.exec(chunk)?.[0] : undefined;
|
|
366985
|
+
if (trailing && trailing.length < chunk.length) {
|
|
366986
|
+
out.push(chunk.slice(0, chunk.length - trailing.length));
|
|
366987
|
+
for (const mark of trailing)
|
|
366988
|
+
out.push(mark);
|
|
366989
|
+
} else {
|
|
366990
|
+
out.push(chunk);
|
|
366991
|
+
}
|
|
366992
|
+
}
|
|
366993
|
+
return out;
|
|
366994
|
+
}
|
|
366821
366995
|
function narrowTextReplacement(before, after) {
|
|
366822
366996
|
if (before === after)
|
|
366823
366997
|
return null;
|
|
366824
|
-
const
|
|
366825
|
-
const
|
|
366826
|
-
const newTokens = after.match(tokens) ?? [];
|
|
366998
|
+
const oldTokens = wordTokens(before);
|
|
366999
|
+
const newTokens = wordTokens(after);
|
|
366827
367000
|
let prefix2 = 0;
|
|
366828
367001
|
let start = 0;
|
|
366829
367002
|
while (prefix2 < oldTokens.length && prefix2 < newTokens.length && oldTokens[prefix2] === newTokens[prefix2]) {
|
|
@@ -366844,9 +367017,8 @@ function planTextReplacement(before, after) {
|
|
|
366844
367017
|
const boundary = narrowTextReplacement(before, after);
|
|
366845
367018
|
if (!boundary)
|
|
366846
367019
|
return [];
|
|
366847
|
-
const
|
|
366848
|
-
const
|
|
366849
|
-
const newTokens = boundary.text.match(tokens) ?? [];
|
|
367020
|
+
const oldTokens = wordTokens(before.slice(boundary.start, boundary.end));
|
|
367021
|
+
const newTokens = wordTokens(boundary.text);
|
|
366850
367022
|
const matches = [];
|
|
366851
367023
|
const oldValues = new Set(oldTokens);
|
|
366852
367024
|
if (!newTokens.some((token) => oldValues.has(token)))
|
|
@@ -366938,6 +367110,10 @@ function planTextReplacement(before, after) {
|
|
|
366938
367110
|
}
|
|
366939
367111
|
return spans;
|
|
366940
367112
|
}
|
|
367113
|
+
var TRAILING_PUNCTUATION;
|
|
367114
|
+
var init_replacement_span = __esm(() => {
|
|
367115
|
+
TRAILING_PUNCTUATION = /[.,;:!?)\]}'"\u00bb\u2019\u201d]+$/u;
|
|
367116
|
+
});
|
|
366941
367117
|
|
|
366942
367118
|
// ../../../v2/document-api-v2-adapter/dist/selection-mutation/structural-rewrite-span.js
|
|
366943
367119
|
function planTrackedRewriteReplacement(before, after, scope) {
|
|
@@ -366978,6 +367154,7 @@ function rewriteRangeContainsCoupledStructure(paragraphXml, start, end, coordina
|
|
|
366978
367154
|
}
|
|
366979
367155
|
var init_structural_rewrite_span = __esm(() => {
|
|
366980
367156
|
init_sd_document_session_internal();
|
|
367157
|
+
init_replacement_span();
|
|
366981
367158
|
});
|
|
366982
367159
|
|
|
366983
367160
|
// ../../../v2/document-api-v2-adapter/dist/fields/tracked-field-removal.js
|
|
@@ -372159,6 +372336,7 @@ var init_adapter7 = __esm(() => {
|
|
|
372159
372336
|
init_mutation_guard();
|
|
372160
372337
|
init_story_surface();
|
|
372161
372338
|
init_textbox_story();
|
|
372339
|
+
init_replacement_span();
|
|
372162
372340
|
init_structural_rewrite_span();
|
|
372163
372341
|
init_runtime2();
|
|
372164
372342
|
init_tracked_field_removal();
|
|
@@ -391768,7 +391946,7 @@ function projectSectionDomain(mainStory, section, index2, oddEvenHeadersFooters)
|
|
|
391768
391946
|
};
|
|
391769
391947
|
}
|
|
391770
391948
|
function readLiveOddEvenHeadersFooters(context, snapshot2) {
|
|
391771
|
-
const settingsXml = readPartXml(context,
|
|
391949
|
+
const settingsXml = readPartXml(context, readableSettingsPartUri(context));
|
|
391772
391950
|
if (!settingsXml)
|
|
391773
391951
|
return projectToggle(snapshot2.settings?.evenAndOddHeaders ?? null) ?? false;
|
|
391774
391952
|
const match = /<w:evenAndOddHeaders\b[^>]*\/?>/i.exec(settingsXml);
|
|
@@ -392329,6 +392507,7 @@ class V2CreateAdapter {
|
|
|
392329
392507
|
});
|
|
392330
392508
|
const carrierParagraph = `<w:p><w:pPr>${sectPrPlan.previousSectPr}</w:pPr></w:p>`;
|
|
392331
392509
|
let nextXml;
|
|
392510
|
+
let splitSectionIndex = null;
|
|
392332
392511
|
if (!input.at || input.at.kind === "documentEnd") {
|
|
392333
392512
|
if (representation === "attachToPreviousParagraph") {
|
|
392334
392513
|
const attached = attachSectPrToPreviousBodyParagraph(documentXml, sectPrPlan);
|
|
@@ -392344,8 +392523,24 @@ class V2CreateAdapter {
|
|
|
392344
392523
|
nextXml = documentXml.replace(/<\/w:body>/, `${carrierParagraph}${sectPrPlan.finalSectPr}</w:body>`);
|
|
392345
392524
|
}
|
|
392346
392525
|
}
|
|
392526
|
+
} else if ((input.at.kind === "before" || input.at.kind === "after") && input.at.target?.kind === "block" && (!input.at.target.story || input.at.target.story.storyType === "body")) {
|
|
392527
|
+
if (options?.changeMode === "tracked") {
|
|
392528
|
+
return createFailure("CAPABILITY_UNAVAILABLE", "create.sectionBreak records only document-end breaks as tracked changes.");
|
|
392529
|
+
}
|
|
392530
|
+
const placed = placeSectionBreakAtBodyParagraph(documentXml, {
|
|
392531
|
+
nodeId: input.at.target.nodeId,
|
|
392532
|
+
placement: input.at.kind,
|
|
392533
|
+
representation,
|
|
392534
|
+
breakType,
|
|
392535
|
+
pageMargins: input.pageMargins,
|
|
392536
|
+
headerFooterMargins: input.headerFooterMargins
|
|
392537
|
+
});
|
|
392538
|
+
if (!placed.ok)
|
|
392539
|
+
return createFailure(placed.code, placed.message);
|
|
392540
|
+
nextXml = placed.xml;
|
|
392541
|
+
splitSectionIndex = placed.sectionIndex;
|
|
392347
392542
|
} else {
|
|
392348
|
-
return createFailure("INVALID_TARGET", "create.sectionBreak
|
|
392543
|
+
return createFailure("INVALID_TARGET", "create.sectionBreak supports documentEnd and before/after a body paragraph on v2.");
|
|
392349
392544
|
}
|
|
392350
392545
|
const dryRun = options?.dryRun || input.dryRun;
|
|
392351
392546
|
const createdRefs = [];
|
|
@@ -392378,8 +392573,8 @@ class V2CreateAdapter {
|
|
|
392378
392573
|
if (!committed.ok)
|
|
392379
392574
|
return createFailure(committed.code, committed.message);
|
|
392380
392575
|
const sectionItems = new V2SectionsAdapter(this.context).list().items;
|
|
392381
|
-
const
|
|
392382
|
-
const section = { kind: "section", sectionId:
|
|
392576
|
+
const createdSectionId = splitSectionIndex === null ? sectionItems[sectionItems.length - 1]?.id : sectionItems[splitSectionIndex]?.id;
|
|
392577
|
+
const section = { kind: "section", sectionId: createdSectionId ?? "section-0" };
|
|
392383
392578
|
const trackedChangeRefs = projectTrackedStructuralEntityIds(this.context, createdRefs.flatMap((ref5) => ref5.kind === "trackedChange" ? [ref5.entityId] : [])).map((entityId) => ({ kind: "entity", entityType: "trackedChange", entityId }));
|
|
392384
392579
|
return { success: true, section, ...trackedChangeRefs.length ? { trackedChangeRefs } : {} };
|
|
392385
392580
|
}
|
|
@@ -392801,6 +392996,54 @@ function attachSectPrToPreviousBodyParagraph(documentXml, plan) {
|
|
|
392801
392996
|
xml: documentXml.slice(0, body.start + target.start) + merged + documentXml.slice(body.start + target.end, finalStart) + plan.finalSectPr + documentXml.slice(finalEnd)
|
|
392802
392997
|
};
|
|
392803
392998
|
}
|
|
392999
|
+
function placeSectionBreakAtBodyParagraph(documentXml, input) {
|
|
393000
|
+
const body = readBodyInnerWithOffsets(documentXml);
|
|
393001
|
+
if (!body)
|
|
393002
|
+
return { ok: false, code: "PRECONDITION_FAILED", message: "document body was not found." };
|
|
393003
|
+
const children2 = scanDirectBodyChildrenWithOffsets(body.inner);
|
|
393004
|
+
const index2 = children2.findIndex((child) => isWordParagraphQName2(child.qname) && bodyParagraphIdOf(body.inner.slice(child.start, child.end)) === input.nodeId);
|
|
393005
|
+
if (index2 < 0) {
|
|
393006
|
+
return { ok: false, code: "INVALID_TARGET", message: "The target is not a body paragraph with a durable id; re-inspect and pass its nodeId." };
|
|
393007
|
+
}
|
|
393008
|
+
const boundary = body.start + (input.placement === "after" ? children2[index2].end : children2[index2].start);
|
|
393009
|
+
if (!findAllElements(documentXml, "sectPr").some((element) => element.start >= boundary)) {
|
|
393010
|
+
const bodyEnd = body.start + body.inner.length;
|
|
393011
|
+
documentXml = `${documentXml.slice(0, bodyEnd)}<w:sectPr/>${documentXml.slice(bodyEnd)}`;
|
|
393012
|
+
}
|
|
393013
|
+
const sectPrs = findAllElements(documentXml, "sectPr");
|
|
393014
|
+
const sectionIndex = sectPrs.findIndex((element) => element.start >= boundary);
|
|
393015
|
+
const governing = sectPrs[sectionIndex];
|
|
393016
|
+
if (!governing)
|
|
393017
|
+
return { ok: false, code: "PRECONDITION_FAILED", message: "The body has no section properties after the target." };
|
|
393018
|
+
const closingSectPr = setSectionBreakTypeXml(governing.xml, input.breakType);
|
|
393019
|
+
let trailingSectPr = governing.xml;
|
|
393020
|
+
if (input.pageMargins)
|
|
393021
|
+
trailingSectPr = setPageMarginsXml(trailingSectPr, input.pageMargins);
|
|
393022
|
+
if (input.headerFooterMargins)
|
|
393023
|
+
trailingSectPr = setPageMarginsXml(trailingSectPr, input.headerFooterMargins);
|
|
393024
|
+
let xml = `${documentXml.slice(0, governing.start)}${trailingSectPr}${documentXml.slice(governing.end)}`;
|
|
393025
|
+
if (input.representation === "attachToPreviousParagraph") {
|
|
393026
|
+
const carrier = children2[input.placement === "after" ? index2 : index2 - 1];
|
|
393027
|
+
if (!carrier || !isWordParagraphQName2(carrier.qname)) {
|
|
393028
|
+
return { ok: false, code: "INVALID_TARGET", message: 'No body paragraph ends the section at that boundary; use representation "asNewParagraph".' };
|
|
393029
|
+
}
|
|
393030
|
+
const carrierXml = body.inner.slice(carrier.start, carrier.end);
|
|
393031
|
+
if (findFirstElement(carrierXml, "sectPr")) {
|
|
393032
|
+
return { ok: false, code: "INVALID_TARGET", message: "That paragraph already carries a section break." };
|
|
393033
|
+
}
|
|
393034
|
+
const merged = mergeSectPrIntoParagraph(carrierXml, closingSectPr);
|
|
393035
|
+
if (!merged)
|
|
393036
|
+
return { ok: false, code: "INVALID_TARGET", message: "That paragraph cannot carry this section break." };
|
|
393037
|
+
xml = xml.slice(0, body.start + carrier.start) + merged + xml.slice(body.start + carrier.end);
|
|
393038
|
+
return { ok: true, xml, sectionIndex };
|
|
393039
|
+
}
|
|
393040
|
+
xml = `${xml.slice(0, boundary)}<w:p><w:pPr>${closingSectPr}</w:pPr></w:p>${xml.slice(boundary)}`;
|
|
393041
|
+
return { ok: true, xml, sectionIndex };
|
|
393042
|
+
}
|
|
393043
|
+
function bodyParagraphIdOf(paragraphXml) {
|
|
393044
|
+
const open2 = /^<w:p\b[^>]*>/.exec(paragraphXml)?.[0] ?? "";
|
|
393045
|
+
return /\sw14:paraId="([^"]+)"/.exec(open2)?.[1] ?? null;
|
|
393046
|
+
}
|
|
392804
393047
|
function readBodyInnerWithOffsets(documentXml) {
|
|
392805
393048
|
const bodyOpen = /<[\w.-]+:body\b[^>]*>/.exec(documentXml);
|
|
392806
393049
|
if (!bodyOpen)
|
|
@@ -406713,8 +406956,8 @@ function createHeaderFooterPart(context, input, options) {
|
|
|
406713
406956
|
const relType = input.kind === "header" ? HEADER_REL2 : FOOTER_REL2;
|
|
406714
406957
|
const nextRelsXml = addRelationship(relsXml, { id: refId, type: relType, target: partUri.replace(/^\/word\//, "") });
|
|
406715
406958
|
let nextContentTypesXml = addContentTypeOverride(contentTypesXml, partUri, contentType);
|
|
406716
|
-
if (Object.keys(clonedRelationships.perPart).length > 0 && parseContentTypes(contentTypesXml).defaults.get("rels") !==
|
|
406717
|
-
nextContentTypesXml = addContentTypeOverride(nextContentTypesXml, relsUriFor(partUri),
|
|
406959
|
+
if (Object.keys(clonedRelationships.perPart).length > 0 && parseContentTypes(contentTypesXml).defaults.get("rels") !== RELATIONSHIPS_CT2) {
|
|
406960
|
+
nextContentTypesXml = addContentTypeOverride(nextContentTypesXml, relsUriFor(partUri), RELATIONSHIPS_CT2);
|
|
406718
406961
|
}
|
|
406719
406962
|
const partPath = partUri.replace(/^\//, "");
|
|
406720
406963
|
if (options?.dryRun)
|
|
@@ -406871,8 +407114,8 @@ function prepareHeaderFooterSlotMaterialization(context, target, additionalTarge
|
|
|
406871
407114
|
const relType = input.kind === "header" ? HEADER_REL2 : FOOTER_REL2;
|
|
406872
407115
|
const nextRelsXml = addRelationship(relsXml, { id: refId, type: relType, target: partUri.replace(/^\/word\//, "") });
|
|
406873
407116
|
let nextContentTypesXml = addContentTypeOverride(contentTypesXml, partUri, contentType);
|
|
406874
|
-
if (Object.keys(clonedRelationships.perPart).length > 0 && parseContentTypes(contentTypesXml).defaults.get("rels") !==
|
|
406875
|
-
nextContentTypesXml = addContentTypeOverride(nextContentTypesXml, relsUriFor(partUri),
|
|
407117
|
+
if (Object.keys(clonedRelationships.perPart).length > 0 && parseContentTypes(contentTypesXml).defaults.get("rels") !== RELATIONSHIPS_CT2) {
|
|
407118
|
+
nextContentTypesXml = addContentTypeOverride(nextContentTypesXml, relsUriFor(partUri), RELATIONSHIPS_CT2);
|
|
406876
407119
|
}
|
|
406877
407120
|
const prepared = prepareHeaderFooterRefTargetsSectionXmlMutationsUnchecked(context, [normalizedTarget, ...normalizedAdditionalTargets], refId);
|
|
406878
407121
|
if (!prepared.ok)
|
|
@@ -406945,15 +407188,15 @@ function prepareClonedPartRelationships(context, sourcePartUri, destinationPartU
|
|
|
406945
407188
|
[relsUriFor(destinationPartUri)]: {
|
|
406946
407189
|
kind: "create",
|
|
406947
407190
|
bytes: cloned.value === sourceXml ? new Uint8Array(sourceBytes) : encodeXml(cloned.value),
|
|
406948
|
-
contentType:
|
|
407191
|
+
contentType: RELATIONSHIPS_CT2
|
|
406949
407192
|
}
|
|
406950
407193
|
} };
|
|
406951
407194
|
}
|
|
406952
407195
|
function prepareDocumentRelationshipsPart(context) {
|
|
406953
407196
|
const existingBytes = readPartBytes2(context, DOCUMENT_RELS_PART_URI12);
|
|
406954
407197
|
return {
|
|
406955
|
-
xml: existingBytes ? readPartXml(context, DOCUMENT_RELS_PART_URI12) ?? "" :
|
|
406956
|
-
buildPatch: (nextXml) => existingBytes ? replaceWholePartEntry(existingBytes, encodeXml(nextXml)) : { kind: "create", bytes: encodeXml(nextXml), contentType:
|
|
407198
|
+
xml: existingBytes ? readPartXml(context, DOCUMENT_RELS_PART_URI12) ?? "" : EMPTY_RELATIONSHIPS_XML4,
|
|
407199
|
+
buildPatch: (nextXml) => existingBytes ? replaceWholePartEntry(existingBytes, encodeXml(nextXml)) : { kind: "create", bytes: encodeXml(nextXml), contentType: RELATIONSHIPS_CT2 }
|
|
406957
407200
|
};
|
|
406958
407201
|
}
|
|
406959
407202
|
function resolveTrailingFinalSectionInheritedRefTarget(context, target) {
|
|
@@ -407198,7 +407441,7 @@ function structuredError3(code2, message) {
|
|
|
407198
407441
|
error48.code = code2;
|
|
407199
407442
|
return error48;
|
|
407200
407443
|
}
|
|
407201
|
-
var HEADER_CT2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", FOOTER_CT2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", HEADER_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",
|
|
407444
|
+
var HEADER_CT2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", FOOTER_CT2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", HEADER_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", RELATIONSHIPS_CT2 = "application/vnd.openxmlformats-package.relationships+xml", EMPTY_RELATIONSHIPS_XML4;
|
|
407202
407445
|
var init_adapter18 = __esm(() => {
|
|
407203
407446
|
init_src3();
|
|
407204
407447
|
init_sd_document_session_internal();
|
|
@@ -407207,7 +407450,7 @@ var init_adapter18 = __esm(() => {
|
|
|
407207
407450
|
init_xml();
|
|
407208
407451
|
init_xml3();
|
|
407209
407452
|
init_section_xml();
|
|
407210
|
-
|
|
407453
|
+
EMPTY_RELATIONSHIPS_XML4 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
407211
407454
|
});
|
|
407212
407455
|
|
|
407213
407456
|
// ../../../v2/document-api-v2-adapter/dist/address/materialize-slot.js
|
|
@@ -440750,6 +440993,7 @@ var init_engine3 = __esm(() => {
|
|
|
440750
440993
|
init_query_adapter();
|
|
440751
440994
|
init_within();
|
|
440752
440995
|
init_tracked_text_search();
|
|
440996
|
+
init_replacement_span();
|
|
440753
440997
|
init_structural_rewrite_span();
|
|
440754
440998
|
init_adapter7();
|
|
440755
440999
|
init_adapter17();
|
|
@@ -441843,7 +442087,7 @@ function preparePicturePlan(context, part, input, shapeId, contentTypesXml) {
|
|
|
441843
442087
|
return { ok: false, message: "Header relationships path could not be resolved." };
|
|
441844
442088
|
const preparedRels = part.perPart[relsUri];
|
|
441845
442089
|
const existingRelsBytes = resultingWholePartBytes(context, relsUri, preparedRels);
|
|
441846
|
-
const relsXml = existingRelsBytes ? TD133.decode(existingRelsBytes) :
|
|
442090
|
+
const relsXml = existingRelsBytes ? TD133.decode(existingRelsBytes) : EMPTY_RELATIONSHIPS_XML5;
|
|
441847
442091
|
const imageRefId = allocateRId2(relsXml);
|
|
441848
442092
|
const mediaPartUri = allocateMediaPartUri(context, decoded.format);
|
|
441849
442093
|
const mediaTarget = relativeTarget3(part.partUri, mediaPartUri);
|
|
@@ -441859,7 +442103,7 @@ function preparePicturePlan(context, part, input, shapeId, contentTypesXml) {
|
|
|
441859
442103
|
bytes: decoded.binary,
|
|
441860
442104
|
contentType: imageMimeType2(decoded.format)
|
|
441861
442105
|
},
|
|
441862
|
-
[relsUri]: preparedRels?.kind === "create" ? { kind: "create", bytes: encodeXml(nextRelsXml), contentType:
|
|
442106
|
+
[relsUri]: preparedRels?.kind === "create" ? { kind: "create", bytes: encodeXml(nextRelsXml), contentType: RELATIONSHIPS_CT3 } : readPartBytes2(context, relsUri) ? replaceWholePartEntry(readPartBytes2(context, relsUri), encodeXml(nextRelsXml)) : { kind: "create", bytes: encodeXml(nextRelsXml), contentType: RELATIONSHIPS_CT3 }
|
|
441863
442107
|
};
|
|
441864
442108
|
return {
|
|
441865
442109
|
ok: true,
|
|
@@ -441875,7 +442119,7 @@ function removePictureResources(context, entry, perPart, contentTypesXml) {
|
|
|
441875
442119
|
if (!relsUri || !entry.imageRefId || !entry.mediaPartUri)
|
|
441876
442120
|
return { contentTypesXml };
|
|
441877
442121
|
const relsBytes = readPartBytes2(context, relsUri);
|
|
441878
|
-
const relsXml = relsBytes ? TD133.decode(relsBytes) :
|
|
442122
|
+
const relsXml = relsBytes ? TD133.decode(relsBytes) : EMPTY_RELATIONSHIPS_XML5;
|
|
441879
442123
|
const remainingPartXml = replaceExactlyOnce4(entry.partXml, entry.pictXml, "");
|
|
441880
442124
|
if (remainingPartXml && [...remainingPartXml.matchAll(/<[A-Za-z_][^>]*>/g)].some((match) => ["r:id", "r:embed", "r:link"].some((attribute3) => xmlAttribute3(match[0], attribute3) === entry.imageRefId))) {
|
|
441881
442125
|
return { contentTypesXml };
|
|
@@ -442169,7 +442413,7 @@ function readAspectLock(pictXml) {
|
|
|
442169
442413
|
return /^(?:t|true|1)$/.test(instanceLock[1] ?? instanceLock[2] ?? "");
|
|
442170
442414
|
return /<o:lock\b[^>]*\baspectratio=["'](?:t|true|1)["']/.test(pictXml);
|
|
442171
442415
|
}
|
|
442172
|
-
var IMAGE_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
|
|
442416
|
+
var IMAGE_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", RELATIONSHIPS_CT3 = "application/vnd.openxmlformats-package.relationships+xml", EMPTY_RELATIONSHIPS_XML5, TD133;
|
|
442173
442417
|
var init_parts = __esm(() => {
|
|
442174
442418
|
init_sd_document_session_internal();
|
|
442175
442419
|
init_adapter18();
|
|
@@ -442179,7 +442423,7 @@ var init_parts = __esm(() => {
|
|
|
442179
442423
|
init_xml();
|
|
442180
442424
|
init_xml3();
|
|
442181
442425
|
init_serialization();
|
|
442182
|
-
|
|
442426
|
+
EMPTY_RELATIONSHIPS_XML5 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
442183
442427
|
TD133 = new TextDecoder;
|
|
442184
442428
|
});
|
|
442185
442429
|
|
|
@@ -442401,7 +442645,7 @@ function applyWatermarks(context, input, options) {
|
|
|
442401
442645
|
perPart[header.partUri] = partPatch(context, header.partUri, encodeXml(header.xml), HEADER_CT3);
|
|
442402
442646
|
const relsUri = relsPartUriForPart2(header.partUri);
|
|
442403
442647
|
if (header.relsXml !== EMPTY_RELS || readPartBytes2(context, relsUri) || perPart[relsUri])
|
|
442404
|
-
perPart[relsUri] = partPatch(context, relsUri, encodeXml(header.relsXml),
|
|
442648
|
+
perPart[relsUri] = partPatch(context, relsUri, encodeXml(header.relsXml), RELATIONSHIPS_CT4);
|
|
442405
442649
|
}
|
|
442406
442650
|
for (const mediaPartUri of new Set(removedImages.map((entry) => entry.mediaPartUri))) {
|
|
442407
442651
|
if (isReferencedInFinalRelationships(context, perPart, mediaPartUri))
|
|
@@ -442410,7 +442654,7 @@ function applyWatermarks(context, input, options) {
|
|
|
442410
442654
|
contentTypesXml = removeContentTypeOverride(contentTypesXml, mediaPartUri);
|
|
442411
442655
|
}
|
|
442412
442656
|
if (documentRelsXml !== (readPartXml(context, DOCUMENT_RELS_PART_URI12) ?? EMPTY_RELS))
|
|
442413
|
-
perPart[DOCUMENT_RELS_PART_URI12] = partPatch(context, DOCUMENT_RELS_PART_URI12, encodeXml(documentRelsXml),
|
|
442657
|
+
perPart[DOCUMENT_RELS_PART_URI12] = partPatch(context, DOCUMENT_RELS_PART_URI12, encodeXml(documentRelsXml), RELATIONSHIPS_CT4);
|
|
442414
442658
|
if (contentTypesXml !== readPartXml(context, CONTENT_TYPES_PART_URI14))
|
|
442415
442659
|
perPart[CONTENT_TYPES_PART_URI14] = partPatch(context, CONTENT_TYPES_PART_URI14, encodeXml(contentTypesXml), "application/xml");
|
|
442416
442660
|
const impact = { affectedSlots: affected.map((slot2) => slot2.address), preservedSlots };
|
|
@@ -442572,7 +442816,7 @@ function isReferencedInFinalRelationships(context, perPart, mediaPartUri) {
|
|
|
442572
442816
|
}
|
|
442573
442817
|
return false;
|
|
442574
442818
|
}
|
|
442575
|
-
var HEADER_CT3 = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", HEADER_REL3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", IMAGE_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
|
|
442819
|
+
var HEADER_CT3 = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", HEADER_REL3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", IMAGE_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", RELATIONSHIPS_CT4 = "application/vnd.openxmlformats-package.relationships+xml", EMPTY_RELS = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>', VARIANTS;
|
|
442576
442820
|
var init_scoped_apply = __esm(() => {
|
|
442577
442821
|
init_sd_document_session_internal();
|
|
442578
442822
|
init_document_reader();
|
|
@@ -443463,19 +443707,16 @@ class V2FootnotesAdapter {
|
|
|
443463
443707
|
message: "section-scoped note configuration is not supported by v2 yet."
|
|
443464
443708
|
});
|
|
443465
443709
|
}
|
|
443466
|
-
const
|
|
443467
|
-
if (!
|
|
443468
|
-
return failure24(
|
|
443469
|
-
|
|
443470
|
-
message: "settings.xml bytes are unavailable."
|
|
443471
|
-
});
|
|
443472
|
-
const nextXml = configureSettings(readPartXml(this.context, SETTINGS_PART_URI5) ?? "", input);
|
|
443710
|
+
const settings = prepareSettingsPart(this.context);
|
|
443711
|
+
if (!settings.ok)
|
|
443712
|
+
return failure24(settings.failure);
|
|
443713
|
+
const nextXml = configureSettings(settings.xml, input);
|
|
443473
443714
|
if (options?.dryRun)
|
|
443474
443715
|
return { success: true };
|
|
443475
443716
|
const committed = commitKernelStorySurfacePatch({
|
|
443476
443717
|
context: this.context,
|
|
443477
443718
|
txIdPrefix: "footnotes-configure",
|
|
443478
|
-
perPart:
|
|
443719
|
+
perPart: settings.perPart(nextXml),
|
|
443479
443720
|
signalLanesToRebuild: ["sections"]
|
|
443480
443721
|
});
|
|
443481
443722
|
if (!committed.ok)
|
|
@@ -444015,6 +444256,7 @@ var W14_NS4 = "http://schemas.microsoft.com/office/word/2010/wordml", FOOTNOTES_
|
|
|
444015
444256
|
var init_adapter36 = __esm(() => {
|
|
444016
444257
|
init_src3();
|
|
444017
444258
|
init_document_styles();
|
|
444259
|
+
init_section_xml();
|
|
444018
444260
|
init_tracked_pr_change();
|
|
444019
444261
|
init_tracked_structural_wrapper();
|
|
444020
444262
|
init_common();
|
|
@@ -448603,7 +448845,7 @@ function planPackageCompanion(input) {
|
|
|
448603
448845
|
}
|
|
448604
448846
|
};
|
|
448605
448847
|
}
|
|
448606
|
-
let documentRelsXml = input.documentRelsXml ??
|
|
448848
|
+
let documentRelsXml = input.documentRelsXml ?? EMPTY_RELATIONSHIPS_XML6;
|
|
448607
448849
|
const relationshipTarget = relativeRelationshipTarget(input.relationshipOwnerPartName, input.def.partName);
|
|
448608
448850
|
const relationshipElements = findEmptyXmlElements(documentRelsXml, "Relationship");
|
|
448609
448851
|
if (input.def.scope === "styles") {
|
|
@@ -448774,7 +449016,7 @@ function importHeaderFooterAssets(input) {
|
|
|
448774
449016
|
}
|
|
448775
449017
|
let nextContentTypesXml = input.contentTypesXml;
|
|
448776
449018
|
let contentTypesChanged = false;
|
|
448777
|
-
let nextDocumentRelsXml = input.documentRelsXml ??
|
|
449019
|
+
let nextDocumentRelsXml = input.documentRelsXml ?? EMPTY_RELATIONSHIPS_XML6;
|
|
448778
449020
|
let documentRelsChanged = false;
|
|
448779
449021
|
let changed = false;
|
|
448780
449022
|
const idMappings = [];
|
|
@@ -449651,7 +449893,7 @@ function replaceChildValAttr(defXml, tag, value3) {
|
|
|
449651
449893
|
const escaped = escapeTag(tag);
|
|
449652
449894
|
return defXml.replace(new RegExp(`(<${escaped}\\b[^>]*\\bw:val=")[^"]*(")`), `$1${value3}$2`);
|
|
449653
449895
|
}
|
|
449654
|
-
var CONTENT_TYPES_NAME = "[Content_Types].xml", CONTENT_TYPES_PART_URI16 = "/[Content_Types].xml", DOCUMENT_PART_URI7 = "/word/document.xml", STYLES_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", STRICT_WORDPROCESSINGML_NAMESPACE3 = "http://purl.oclc.org/ooxml/wordprocessingml/main", THEME_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", FONT_TABLE_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", WEB_SETTINGS_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings", HEADER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", IMAGE_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", SINGLE_SCOPE_DEFS, STYLES_PART_NAME = "word/styles.xml", STYLES_SCOPE_DEF, NUMBERING_PART_NAME = "word/numbering.xml", WORDPROCESSINGML_NAMESPACE9 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", SETTINGS_ADOPTION_LOCAL_NAMES, UNSUPPORTED_CATEGORIES,
|
|
449896
|
+
var CONTENT_TYPES_NAME = "[Content_Types].xml", CONTENT_TYPES_PART_URI16 = "/[Content_Types].xml", DOCUMENT_PART_URI7 = "/word/document.xml", STYLES_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", STRICT_WORDPROCESSINGML_NAMESPACE3 = "http://purl.oclc.org/ooxml/wordprocessingml/main", THEME_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", FONT_TABLE_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", WEB_SETTINGS_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings", HEADER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", IMAGE_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", SINGLE_SCOPE_DEFS, STYLES_PART_NAME = "word/styles.xml", STYLES_SCOPE_DEF, NUMBERING_PART_NAME = "word/numbering.xml", WORDPROCESSINGML_NAMESPACE9 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", SETTINGS_ADOPTION_LOCAL_NAMES, UNSUPPORTED_CATEGORIES, EMPTY_RELATIONSHIPS_XML6;
|
|
449655
449897
|
var init_adapter40 = __esm(() => {
|
|
449656
449898
|
init_src3();
|
|
449657
449899
|
init_esm2();
|
|
@@ -449722,7 +449964,7 @@ var init_adapter40 = __esm(() => {
|
|
|
449722
449964
|
{ test: (n) => n === "word/footnotes.xml" || n === "word/endnotes.xml", category: "notes" },
|
|
449723
449965
|
{ test: (n) => n === "word/people.xml", category: "people" }
|
|
449724
449966
|
];
|
|
449725
|
-
|
|
449967
|
+
EMPTY_RELATIONSHIPS_XML6 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
449726
449968
|
});
|
|
449727
449969
|
|
|
449728
449970
|
// ../../../v2/document-api-v2-adapter/dist/atomic-plan.js
|
|
@@ -493588,6 +493830,9 @@ var init_dist9 = __esm(() => {
|
|
|
493588
493830
|
});
|
|
493589
493831
|
|
|
493590
493832
|
// ../../../v2/collaboration-v2/dist/backend/story-surface-execution-backend.js
|
|
493833
|
+
function isCollapsedDirectTextInsertion(source) {
|
|
493834
|
+
return source.kind === "editText" && source.changeMode === "direct" && source.newText.length > 0 && source.on.startBlockId === source.on.endBlockId && source.on.startOffset === source.on.endOffset;
|
|
493835
|
+
}
|
|
493591
493836
|
function storyTextRequiresMergedCarrierSync(validation) {
|
|
493592
493837
|
if (!validation)
|
|
493593
493838
|
return false;
|
|
@@ -494856,6 +495101,9 @@ function admitPreparedStorySurfaceMutation(prepared, options) {
|
|
|
494856
495101
|
}
|
|
494857
495102
|
if (extension2.family === "storyText") {
|
|
494858
495103
|
if (extension2.historyReplay || extension2.resyncFromSession || extension2.sessionSync || isNoteTextEdit(prepared)) {
|
|
495104
|
+
if (extension2.sessionSync && extension2.targetBlockIds.length === 1 && options.isSessionProjectionCurrent?.() === false && isCollapsedDirectTextInsertion(prepared.source)) {
|
|
495105
|
+
return { ok: false, message: "text insertion session sync requires a current session projection" };
|
|
495106
|
+
}
|
|
494859
495107
|
return validateStoryTextSessionSync(prepared, extension2, options);
|
|
494860
495108
|
}
|
|
494861
495109
|
const direct = validateDirectStoryText(prepared, extension2, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/mcp",
|
|
3
|
-
"version": "1.10.0-next.
|
|
3
|
+
"version": "1.10.0-next.12",
|
|
4
4
|
"description": "Model Context Protocol server for SuperDoc, giving an AI agent tools to read and edit .docx files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
27
|
-
"@superdoc/sdk": "2.23.0-next.
|
|
27
|
+
"@superdoc/sdk": "2.23.0-next.12",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"superdoc": "2.26.0-next.
|
|
33
|
-
"@superdoc/docx-engine": "0.25.0-next.
|
|
32
|
+
"superdoc": "2.26.0-next.12",
|
|
33
|
+
"@superdoc/docx-engine": "0.25.0-next.12",
|
|
34
34
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
35
35
|
"@types/bun": "^1.3.8",
|
|
36
36
|
"@types/node": "22.19.2",
|