@superdoc/mcp 1.6.0-next.13 → 1.6.0-next.15
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 +1043 -656
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -30405,8 +30405,128 @@ var init_transport_common = __esm(() => {
|
|
|
30405
30405
|
TEMPLATES_APPLY_INPUT_FIELDS = ["source", "bodyPolicy"];
|
|
30406
30406
|
});
|
|
30407
30407
|
|
|
30408
|
-
// ../../packages/sdk/langs/node/src/runtime/
|
|
30408
|
+
// ../../packages/sdk/langs/node/src/runtime/state-directory.ts
|
|
30409
|
+
import { mkdir, mkdtemp, open, rm, stat } from "node:fs/promises";
|
|
30410
|
+
import { tmpdir, userInfo } from "node:os";
|
|
30411
|
+
import { join, resolve } from "node:path";
|
|
30409
30412
|
import { randomUUID } from "node:crypto";
|
|
30413
|
+
|
|
30414
|
+
class SdkStateDirectory {
|
|
30415
|
+
configured;
|
|
30416
|
+
selection;
|
|
30417
|
+
constructor(configured) {
|
|
30418
|
+
this.configured = configured;
|
|
30419
|
+
}
|
|
30420
|
+
get path() {
|
|
30421
|
+
return this.selection?.path;
|
|
30422
|
+
}
|
|
30423
|
+
get ownsRoot() {
|
|
30424
|
+
return this.selection?.owned === true;
|
|
30425
|
+
}
|
|
30426
|
+
async prepare(env) {
|
|
30427
|
+
if (this.configured !== undefined && (typeof this.configured !== "string" || !this.configured.trim())) {
|
|
30428
|
+
throw new SuperDocCliError("stateDir must be a non-empty path.", { code: "INVALID_ARGUMENT" });
|
|
30429
|
+
}
|
|
30430
|
+
if (this.selection) {
|
|
30431
|
+
await this.check(this.selection);
|
|
30432
|
+
return this.selection.path;
|
|
30433
|
+
}
|
|
30434
|
+
const explicit = this.configured ?? (env.SUPERDOC_CLI_STATE_DIR || undefined);
|
|
30435
|
+
if (explicit !== undefined) {
|
|
30436
|
+
const selection = {
|
|
30437
|
+
path: resolve(explicit),
|
|
30438
|
+
source: this.configured !== undefined ? "stateDir" : "SUPERDOC_CLI_STATE_DIR",
|
|
30439
|
+
owned: false
|
|
30440
|
+
};
|
|
30441
|
+
await this.check(selection);
|
|
30442
|
+
this.selection = selection;
|
|
30443
|
+
return selection.path;
|
|
30444
|
+
}
|
|
30445
|
+
let home = process.platform === "win32" ? env.USERPROFILE : env.HOME;
|
|
30446
|
+
if (!home) {
|
|
30447
|
+
try {
|
|
30448
|
+
home = userInfo().homedir;
|
|
30449
|
+
} catch {}
|
|
30450
|
+
}
|
|
30451
|
+
if (home) {
|
|
30452
|
+
const selection = { path: join(home, ".superdoc-cli", "state", "v1"), source: "home", owned: false };
|
|
30453
|
+
try {
|
|
30454
|
+
if ((await stat(home)).isDirectory()) {
|
|
30455
|
+
await this.probe(selection.path);
|
|
30456
|
+
this.selection = selection;
|
|
30457
|
+
return selection.path;
|
|
30458
|
+
}
|
|
30459
|
+
} catch {}
|
|
30460
|
+
}
|
|
30461
|
+
const temporary = process.platform === "win32" ? env.TEMP || env.TMP || (env.SystemRoot ? join(env.SystemRoot, "temp") : tmpdir()) : env.TMPDIR || env.TMP || env.TEMP || "/tmp";
|
|
30462
|
+
let allocated;
|
|
30463
|
+
try {
|
|
30464
|
+
allocated = await mkdtemp(join(resolve(temporary), "superdoc-sdk-state-"));
|
|
30465
|
+
const selection = { path: allocated, source: "temporary", owned: true };
|
|
30466
|
+
await this.probe(allocated);
|
|
30467
|
+
this.selection = selection;
|
|
30468
|
+
return allocated;
|
|
30469
|
+
} catch (error48) {
|
|
30470
|
+
if (allocated)
|
|
30471
|
+
await rm(allocated, { recursive: true, force: true });
|
|
30472
|
+
throw this.failure({ path: resolve(temporary), source: "temporary", owned: false }, error48);
|
|
30473
|
+
}
|
|
30474
|
+
}
|
|
30475
|
+
async dispose() {
|
|
30476
|
+
const selection = this.selection;
|
|
30477
|
+
if (!selection)
|
|
30478
|
+
return;
|
|
30479
|
+
if (selection.owned)
|
|
30480
|
+
await rm(selection.path, { recursive: true, force: true });
|
|
30481
|
+
this.selection = undefined;
|
|
30482
|
+
}
|
|
30483
|
+
mapOperationError(error48) {
|
|
30484
|
+
const selection = this.selection;
|
|
30485
|
+
const code = error48.message.match(/\b(E[A-Z]+)\b/)?.[1];
|
|
30486
|
+
if (!selection || !code || !FILESYSTEM_CODES.has(code) || !error48.message.includes(selection.path))
|
|
30487
|
+
return error48;
|
|
30488
|
+
return this.failure(selection, { code });
|
|
30489
|
+
}
|
|
30490
|
+
async check(selection) {
|
|
30491
|
+
try {
|
|
30492
|
+
await this.probe(selection.path);
|
|
30493
|
+
} catch (error48) {
|
|
30494
|
+
throw this.failure(selection, error48);
|
|
30495
|
+
}
|
|
30496
|
+
}
|
|
30497
|
+
async probe(path) {
|
|
30498
|
+
const contexts = join(path, "contexts");
|
|
30499
|
+
await mkdir(contexts, { recursive: true, mode: 448 });
|
|
30500
|
+
const probe = join(contexts, ".sdk-write-" + randomUUID());
|
|
30501
|
+
const handle = await open(probe, "wx", 384);
|
|
30502
|
+
try {
|
|
30503
|
+
await handle.writeFile("state");
|
|
30504
|
+
} finally {
|
|
30505
|
+
await handle.close();
|
|
30506
|
+
await rm(probe, { force: true });
|
|
30507
|
+
}
|
|
30508
|
+
}
|
|
30509
|
+
failure(selection, error48) {
|
|
30510
|
+
const fsCode = error48?.code;
|
|
30511
|
+
return new SuperDocCliError("SuperDoc state directory is not writable: " + selection.path + ". Configure stateDir or SUPERDOC_CLI_STATE_DIR with a writable directory.", {
|
|
30512
|
+
code: "STATE_DIRECTORY_UNWRITABLE",
|
|
30513
|
+
details: {
|
|
30514
|
+
path: selection.path,
|
|
30515
|
+
source: selection.source,
|
|
30516
|
+
fsCode,
|
|
30517
|
+
remediation: "Configure stateDir or SUPERDOC_CLI_STATE_DIR with a writable directory."
|
|
30518
|
+
}
|
|
30519
|
+
});
|
|
30520
|
+
}
|
|
30521
|
+
}
|
|
30522
|
+
var FILESYSTEM_CODES;
|
|
30523
|
+
var init_state_directory = __esm(() => {
|
|
30524
|
+
init_errors4();
|
|
30525
|
+
FILESYSTEM_CODES = new Set(["EACCES", "EPERM", "EROFS", "ENOSPC", "EDQUOT", "ENOTDIR", "ENOENT"]);
|
|
30526
|
+
});
|
|
30527
|
+
|
|
30528
|
+
// ../../packages/sdk/langs/node/src/runtime/document-rpc.ts
|
|
30529
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
30410
30530
|
function unsupported(message, operationId) {
|
|
30411
30531
|
return new SuperDocCliError(message, {
|
|
30412
30532
|
code: "DOCUMENT_RPC_INPUT_UNSUPPORTED",
|
|
@@ -30459,7 +30579,7 @@ function canOpenWithDocumentRpc(params, options) {
|
|
|
30459
30579
|
return Object.entries(params).every(([key, value]) => value === undefined || DOCUMENT_RPC_OPEN_FIELDS.has(key));
|
|
30460
30580
|
}
|
|
30461
30581
|
function buildDocumentOpenParams(params, user, defaultChangeMode) {
|
|
30462
|
-
const sessionId = typeof params.sessionId === "string" && params.sessionId.length > 0 ? params.sessionId :
|
|
30582
|
+
const sessionId = typeof params.sessionId === "string" && params.sessionId.length > 0 ? params.sessionId : randomUUID2();
|
|
30463
30583
|
const author = buildDocumentAuthor(user);
|
|
30464
30584
|
return {
|
|
30465
30585
|
sessionId,
|
|
@@ -30764,6 +30884,8 @@ function resolveJsWatchdogTimeout(watchdogTimeoutMs, requestTimeoutMs, timeoutMs
|
|
|
30764
30884
|
}
|
|
30765
30885
|
|
|
30766
30886
|
class HostTransport {
|
|
30887
|
+
stateDirectory;
|
|
30888
|
+
stoppedChildren = new Map;
|
|
30767
30889
|
hostBin;
|
|
30768
30890
|
processMode;
|
|
30769
30891
|
env;
|
|
@@ -30792,6 +30914,7 @@ class HostTransport {
|
|
|
30792
30914
|
documentRpcMutationStates = new Map;
|
|
30793
30915
|
indeterminateDiscardCloses = new Set;
|
|
30794
30916
|
constructor(options) {
|
|
30917
|
+
this.stateDirectory = new SdkStateDirectory(options.stateDir);
|
|
30795
30918
|
this.hostBin = options.hostBin;
|
|
30796
30919
|
this.processMode = options.processMode ?? "cli";
|
|
30797
30920
|
this.env = options.env;
|
|
@@ -30851,7 +30974,7 @@ class HostTransport {
|
|
|
30851
30974
|
return this.disposePromise;
|
|
30852
30975
|
if (this.terminalDisposalError)
|
|
30853
30976
|
throw this.terminalDisposalError;
|
|
30854
|
-
if (!this.child && !this.connecting && this.activeCalls.size === 0)
|
|
30977
|
+
if (!this.child && !this.connecting && this.activeCalls.size === 0 && !this.stateDirectory.ownsRoot && this.stoppedChildren.size === 0)
|
|
30855
30978
|
return;
|
|
30856
30979
|
this.stopping = true;
|
|
30857
30980
|
const disposal = this.disposeAfterActiveCalls();
|
|
@@ -30868,8 +30991,11 @@ class HostTransport {
|
|
|
30868
30991
|
await Promise.allSettled(Array.from(this.activeCalls));
|
|
30869
30992
|
if (this.terminalDisposalError)
|
|
30870
30993
|
throw this.terminalDisposalError;
|
|
30871
|
-
if (!this.child)
|
|
30994
|
+
if (!this.child) {
|
|
30995
|
+
await this.waitForStoppedChildren();
|
|
30996
|
+
await this.stateDirectory.dispose();
|
|
30872
30997
|
return;
|
|
30998
|
+
}
|
|
30873
30999
|
try {
|
|
30874
31000
|
await this.reconcileIndeterminateDiscardCloses();
|
|
30875
31001
|
await this.persistDirtyDocumentRpcSessions();
|
|
@@ -30883,17 +31009,16 @@ class HostTransport {
|
|
|
30883
31009
|
try {
|
|
30884
31010
|
await this.sendJsonRpcRequest("host.shutdown", {}, this.shutdownTimeoutMs);
|
|
30885
31011
|
} catch {}
|
|
30886
|
-
await
|
|
30887
|
-
|
|
30888
|
-
|
|
30889
|
-
|
|
30890
|
-
|
|
30891
|
-
child.once("close", () => {
|
|
30892
|
-
clearTimeout(timer);
|
|
30893
|
-
resolve();
|
|
31012
|
+
await this.waitForStoppedChildren(true);
|
|
31013
|
+
if (child.exitCode !== 0) {
|
|
31014
|
+
this.terminalDisposalError = new SuperDocCliError("Host shutdown failed; its state directory has been retained.", {
|
|
31015
|
+
code: "HOST_SHUTDOWN_FAILED",
|
|
31016
|
+
details: { path: this.stateDirectory.path, exitCode: child.exitCode, signal: child.signalCode }
|
|
30894
31017
|
});
|
|
30895
|
-
|
|
31018
|
+
throw this.terminalDisposalError;
|
|
31019
|
+
}
|
|
30896
31020
|
this.cleanupProcess(null);
|
|
31021
|
+
await this.stateDirectory.dispose();
|
|
30897
31022
|
}
|
|
30898
31023
|
async invoke(operation, params = {}, options = {}) {
|
|
30899
31024
|
return this.runWhileActive(() => this.invokeWhileActive(operation, params, options));
|
|
@@ -31086,14 +31211,15 @@ class HostTransport {
|
|
|
31086
31211
|
async startHostProcess() {
|
|
31087
31212
|
const { command, prefixArgs } = resolveInvocation(this.hostBin);
|
|
31088
31213
|
const args = this.processMode === "document" ? buildDocumentHostSpawnArgs(prefixArgs) : buildHostSpawnArgs(prefixArgs, { requestTimeoutMs: this.requestTimeoutMs });
|
|
31214
|
+
await this.waitForStoppedChildren();
|
|
31215
|
+
const env = { ...process.env, ...this.env };
|
|
31216
|
+
env.SUPERDOC_CLI_STATE_DIR = await this.stateDirectory.prepare(env);
|
|
31089
31217
|
const child = spawn(command, args, {
|
|
31090
|
-
env
|
|
31091
|
-
...process.env,
|
|
31092
|
-
...this.env
|
|
31093
|
-
},
|
|
31218
|
+
env,
|
|
31094
31219
|
stdio: ["pipe", "pipe", "pipe"]
|
|
31095
31220
|
});
|
|
31096
31221
|
this.child = child;
|
|
31222
|
+
this.stoppedChildren.set(child, new Promise((resolve2) => child.once("close", () => resolve2())));
|
|
31097
31223
|
child.stdout.setEncoding("utf8");
|
|
31098
31224
|
const stdoutDataListener = (chunk) => this.onStdoutChunk(chunk);
|
|
31099
31225
|
this.stdoutDataListener = stdoutDataListener;
|
|
@@ -31105,6 +31231,8 @@ class HostTransport {
|
|
|
31105
31231
|
process.stderr.write(`[superdoc-host] ${String(chunk)}`);
|
|
31106
31232
|
});
|
|
31107
31233
|
child.on("error", (error48) => {
|
|
31234
|
+
if (this.child !== child)
|
|
31235
|
+
return;
|
|
31108
31236
|
this.handleDisconnect(new SuperDocCliError("Host process failed.", {
|
|
31109
31237
|
code: "HOST_DISCONNECTED",
|
|
31110
31238
|
details: {
|
|
@@ -31113,6 +31241,8 @@ class HostTransport {
|
|
|
31113
31241
|
}));
|
|
31114
31242
|
});
|
|
31115
31243
|
child.on("close", (code, signal) => {
|
|
31244
|
+
if (this.child !== child)
|
|
31245
|
+
return;
|
|
31116
31246
|
if (this.stopping && this.dirtyDocumentRpcSessions.size === 0) {
|
|
31117
31247
|
this.cleanupProcess(null);
|
|
31118
31248
|
return;
|
|
@@ -31275,7 +31405,7 @@ class HostTransport {
|
|
|
31275
31405
|
params,
|
|
31276
31406
|
...metadata.requestTimeoutMs === undefined ? {} : { requestTimeoutMs: metadata.requestTimeoutMs }
|
|
31277
31407
|
});
|
|
31278
|
-
const promise3 = new Promise((
|
|
31408
|
+
const promise3 = new Promise((resolve2, reject) => {
|
|
31279
31409
|
const timer = setTimeout(() => {
|
|
31280
31410
|
this.pending.delete(id);
|
|
31281
31411
|
reject(new SuperDocCliError(`Host watchdog timed out waiting for ${method}.`, {
|
|
@@ -31287,7 +31417,7 @@ class HostTransport {
|
|
|
31287
31417
|
details: { method, timeoutMs: watchdogTimeoutMs }
|
|
31288
31418
|
}));
|
|
31289
31419
|
}, watchdogTimeoutMs);
|
|
31290
|
-
this.pending.set(id, { resolve, reject, timer });
|
|
31420
|
+
this.pending.set(id, { resolve: resolve2, reject, timer });
|
|
31291
31421
|
child.stdin.write(`${payload}
|
|
31292
31422
|
`, (error48) => {
|
|
31293
31423
|
if (!error48)
|
|
@@ -31366,11 +31496,11 @@ class HostTransport {
|
|
|
31366
31496
|
const cliMessage = typeof data?.message === "string" ? data.message : undefined;
|
|
31367
31497
|
const exitCode = typeof data?.exitCode === "number" ? data.exitCode : undefined;
|
|
31368
31498
|
if (cliCode) {
|
|
31369
|
-
return new SuperDocCliError(cliMessage ?? error48.message ?? "Command failed.", {
|
|
31499
|
+
return this.stateDirectory.mapOperationError(new SuperDocCliError(cliMessage ?? error48.message ?? "Command failed.", {
|
|
31370
31500
|
code: cliCode,
|
|
31371
31501
|
details: data?.details,
|
|
31372
31502
|
exitCode
|
|
31373
|
-
});
|
|
31503
|
+
}));
|
|
31374
31504
|
}
|
|
31375
31505
|
if (domainCode) {
|
|
31376
31506
|
return new SuperDocCliError(error48.message, {
|
|
@@ -31393,6 +31523,32 @@ class HostTransport {
|
|
|
31393
31523
|
details: data
|
|
31394
31524
|
});
|
|
31395
31525
|
}
|
|
31526
|
+
async waitForStoppedChildren(forceAfterTimeout = false) {
|
|
31527
|
+
for (const [child, stopped] of this.stoppedChildren) {
|
|
31528
|
+
let timer;
|
|
31529
|
+
try {
|
|
31530
|
+
await new Promise((resolve2, reject) => {
|
|
31531
|
+
const fail = () => reject(new SuperDocCliError("Host process did not stop; state has been retained.", {
|
|
31532
|
+
code: "HOST_DISCONNECTED",
|
|
31533
|
+
details: { pid: child.pid }
|
|
31534
|
+
}));
|
|
31535
|
+
timer = setTimeout(() => {
|
|
31536
|
+
if (!forceAfterTimeout) {
|
|
31537
|
+
fail();
|
|
31538
|
+
return;
|
|
31539
|
+
}
|
|
31540
|
+
child.kill("SIGKILL");
|
|
31541
|
+
timer = setTimeout(fail, this.shutdownTimeoutMs);
|
|
31542
|
+
}, this.shutdownTimeoutMs);
|
|
31543
|
+
stopped.then(resolve2, reject);
|
|
31544
|
+
});
|
|
31545
|
+
this.stoppedChildren.delete(child);
|
|
31546
|
+
} finally {
|
|
31547
|
+
if (timer)
|
|
31548
|
+
clearTimeout(timer);
|
|
31549
|
+
}
|
|
31550
|
+
}
|
|
31551
|
+
}
|
|
31396
31552
|
handleDisconnect(error48) {
|
|
31397
31553
|
this.cleanupProcess(error48);
|
|
31398
31554
|
}
|
|
@@ -31412,8 +31568,8 @@ class HostTransport {
|
|
|
31412
31568
|
if (child) {
|
|
31413
31569
|
if (this.stdoutDataListener)
|
|
31414
31570
|
child.stdout.off("data", this.stdoutDataListener);
|
|
31415
|
-
child.
|
|
31416
|
-
|
|
31571
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
31572
|
+
child.kill("SIGKILL");
|
|
31417
31573
|
}
|
|
31418
31574
|
this.child = null;
|
|
31419
31575
|
this.stdoutBuffer = "";
|
|
@@ -31433,6 +31589,7 @@ var HOST_PROTOCOL_VERSION = "1.0", CLI_HOST_REQUIRED_FEATURES, COLLABORATION_AUT
|
|
|
31433
31589
|
var init_host = __esm(() => {
|
|
31434
31590
|
init_transport_common();
|
|
31435
31591
|
init_errors4();
|
|
31592
|
+
init_state_directory();
|
|
31436
31593
|
init_document_evidence();
|
|
31437
31594
|
init_contract();
|
|
31438
31595
|
init_document_rpc();
|
|
@@ -31443,7 +31600,7 @@ var init_host = __esm(() => {
|
|
|
31443
31600
|
});
|
|
31444
31601
|
|
|
31445
31602
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31446
|
-
var SDK_VERSION = "2.19.0-next.
|
|
31603
|
+
var SDK_VERSION = "2.19.0-next.15";
|
|
31447
31604
|
|
|
31448
31605
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31449
31606
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -31591,7 +31748,7 @@ var init_embedded_document_host = __esm(() => {
|
|
|
31591
31748
|
});
|
|
31592
31749
|
|
|
31593
31750
|
// ../../packages/sdk/langs/node/src/runtime/debug-trace.ts
|
|
31594
|
-
import { appendFile, mkdir } from "node:fs/promises";
|
|
31751
|
+
import { appendFile, mkdir as mkdir2 } from "node:fs/promises";
|
|
31595
31752
|
import path2 from "node:path";
|
|
31596
31753
|
function isEnabled() {
|
|
31597
31754
|
return process.env.SUPERDOC_SDK_DEBUG_TRACE === "1";
|
|
@@ -31622,14 +31779,14 @@ function writeSdkDebugTrace(event) {
|
|
|
31622
31779
|
...event
|
|
31623
31780
|
}, jsonReplacer)}
|
|
31624
31781
|
`;
|
|
31625
|
-
|
|
31782
|
+
mkdir2(dir, { recursive: true }).then(() => appendFile(file2, payload, "utf8")).catch(() => {});
|
|
31626
31783
|
}
|
|
31627
31784
|
var init_debug_trace = () => {};
|
|
31628
31785
|
|
|
31629
31786
|
// ../../packages/sdk/langs/node/src/runtime/process.ts
|
|
31630
|
-
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
31631
|
-
import { tmpdir } from "node:os";
|
|
31632
|
-
import { join } from "node:path";
|
|
31787
|
+
import { mkdtemp as mkdtemp2, rm as rm2, writeFile } from "node:fs/promises";
|
|
31788
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
31789
|
+
import { join as join2 } from "node:path";
|
|
31633
31790
|
function resolveRuntimeProcess(options = {}, embedded = {
|
|
31634
31791
|
cli: resolveEmbeddedCliBinary,
|
|
31635
31792
|
documentHost: resolveEmbeddedDocumentHostBinary
|
|
@@ -31731,13 +31888,13 @@ class SuperDocRuntime {
|
|
|
31731
31888
|
code: "INVALID_ARGUMENT"
|
|
31732
31889
|
});
|
|
31733
31890
|
}
|
|
31734
|
-
const stagingDirectory = await
|
|
31735
|
-
const stagedPath =
|
|
31891
|
+
const stagingDirectory = await mkdtemp2(join2(tmpdir2(), "superdoc-sdk-replace-"));
|
|
31892
|
+
const stagedPath = join2(stagingDirectory, "replacement.docx");
|
|
31736
31893
|
try {
|
|
31737
31894
|
await writeFile(stagedPath, bytes, { mode: 384 });
|
|
31738
31895
|
return await this.transport.replaceFile(sessionId, stagedPath, options);
|
|
31739
31896
|
} finally {
|
|
31740
|
-
await
|
|
31897
|
+
await rm2(stagingDirectory, { recursive: true, force: true });
|
|
31741
31898
|
}
|
|
31742
31899
|
}
|
|
31743
31900
|
}
|
|
@@ -91219,8 +91376,8 @@ function normalizeItemSpec(raw) {
|
|
|
91219
91376
|
if (typeof r === "string") {
|
|
91220
91377
|
runs.push({ text: r });
|
|
91221
91378
|
} else if (isRecord2(r) && typeof r.text === "string") {
|
|
91222
|
-
const
|
|
91223
|
-
runs.push(
|
|
91379
|
+
const rm3 = normalizeMarks(r.marks);
|
|
91380
|
+
runs.push(rm3 ? { text: r.text, marks: rm3 } : { text: r.text });
|
|
91224
91381
|
}
|
|
91225
91382
|
}
|
|
91226
91383
|
if (runs.length > 0) {
|
|
@@ -122082,16 +122239,16 @@ function createNodeCooperativeScheduler(options = {}) {
|
|
|
122082
122239
|
kind: "macrotask-node-cooperative",
|
|
122083
122240
|
productComplete: true,
|
|
122084
122241
|
now: perfNow,
|
|
122085
|
-
yield: (_reason) => new Promise((
|
|
122242
|
+
yield: (_reason) => new Promise((resolve2) => {
|
|
122086
122243
|
const now = perfNow();
|
|
122087
122244
|
if (now - lastTimerPhaseMs >= timerPhaseEveryMs) {
|
|
122088
122245
|
setTimeout(() => {
|
|
122089
122246
|
lastTimerPhaseMs = perfNow();
|
|
122090
|
-
|
|
122247
|
+
resolve2();
|
|
122091
122248
|
}, 0);
|
|
122092
122249
|
return;
|
|
122093
122250
|
}
|
|
122094
|
-
setImmediateFn(() =>
|
|
122251
|
+
setImmediateFn(() => resolve2());
|
|
122095
122252
|
})
|
|
122096
122253
|
};
|
|
122097
122254
|
}
|
|
@@ -122111,8 +122268,8 @@ function createMessageChannelScheduler() {
|
|
|
122111
122268
|
kind: "macrotask-message-channel",
|
|
122112
122269
|
productComplete: true,
|
|
122113
122270
|
now: perfNow,
|
|
122114
|
-
yield: (_reason) => new Promise((
|
|
122115
|
-
pending.push(
|
|
122271
|
+
yield: (_reason) => new Promise((resolve2) => {
|
|
122272
|
+
pending.push(resolve2);
|
|
122116
122273
|
channel.port2.postMessage(1);
|
|
122117
122274
|
})
|
|
122118
122275
|
};
|
|
@@ -122126,8 +122283,8 @@ function createPostTaskScheduler() {
|
|
|
122126
122283
|
kind: "macrotask-post-task",
|
|
122127
122284
|
productComplete: true,
|
|
122128
122285
|
now: perfNow,
|
|
122129
|
-
yield: (_reason) => new Promise((
|
|
122130
|
-
sched.postTask(() =>
|
|
122286
|
+
yield: (_reason) => new Promise((resolve2) => {
|
|
122287
|
+
sched.postTask(() => resolve2(), { priority: "background" });
|
|
122131
122288
|
})
|
|
122132
122289
|
};
|
|
122133
122290
|
}
|
|
@@ -122136,8 +122293,8 @@ function createSetTimeoutScheduler() {
|
|
|
122136
122293
|
kind: "fake-set-timeout",
|
|
122137
122294
|
productComplete: false,
|
|
122138
122295
|
now: perfNow,
|
|
122139
|
-
yield: (_reason) => new Promise((
|
|
122140
|
-
setTimeout(() =>
|
|
122296
|
+
yield: (_reason) => new Promise((resolve2) => {
|
|
122297
|
+
setTimeout(() => resolve2(), 0);
|
|
122141
122298
|
})
|
|
122142
122299
|
};
|
|
122143
122300
|
}
|
|
@@ -124827,24 +124984,24 @@ function findRawXmlElementRangeAt(xml, start, namespaceUri, localName, initialNa
|
|
|
124827
124984
|
namespaceStack.push(bindings);
|
|
124828
124985
|
continue;
|
|
124829
124986
|
}
|
|
124830
|
-
const
|
|
124831
|
-
if (!
|
|
124987
|
+
const open2 = elementStack.pop();
|
|
124988
|
+
if (!open2 || open2.prefix !== tag.prefix || open2.localName !== tag.localName)
|
|
124832
124989
|
return null;
|
|
124833
124990
|
if (namespaceStack.length > 1)
|
|
124834
124991
|
namespaceStack.pop();
|
|
124835
|
-
if (
|
|
124992
|
+
if (open2.start !== start)
|
|
124836
124993
|
continue;
|
|
124837
|
-
if (
|
|
124994
|
+
if (open2.namespaceUri !== namespaceUri || open2.localName !== localName)
|
|
124838
124995
|
return null;
|
|
124839
124996
|
return {
|
|
124840
|
-
start:
|
|
124841
|
-
openEnd:
|
|
124997
|
+
start: open2.start,
|
|
124998
|
+
openEnd: open2.openEnd,
|
|
124842
124999
|
closeStart: tagStart,
|
|
124843
125000
|
end: tagEnd,
|
|
124844
|
-
prefix:
|
|
124845
|
-
localName:
|
|
124846
|
-
namespaceUri:
|
|
124847
|
-
namespaceBindings:
|
|
125001
|
+
prefix: open2.prefix,
|
|
125002
|
+
localName: open2.localName,
|
|
125003
|
+
namespaceUri: open2.namespaceUri,
|
|
125004
|
+
namespaceBindings: open2.namespaceBindings
|
|
124848
125005
|
};
|
|
124849
125006
|
}
|
|
124850
125007
|
return null;
|
|
@@ -124973,12 +125130,12 @@ function collectXmlElementRanges(xml, options = {}) {
|
|
|
124973
125130
|
onCloseTag(event) {
|
|
124974
125131
|
if (event.tag.isSelfClosing)
|
|
124975
125132
|
return;
|
|
124976
|
-
const
|
|
124977
|
-
if (!
|
|
125133
|
+
const open2 = stack.pop();
|
|
125134
|
+
if (!open2)
|
|
124978
125135
|
return;
|
|
124979
125136
|
ranges.push({
|
|
124980
|
-
...
|
|
124981
|
-
openEnd:
|
|
125137
|
+
...open2,
|
|
125138
|
+
openEnd: open2.end,
|
|
124982
125139
|
closeStart: event.start,
|
|
124983
125140
|
end: event.end
|
|
124984
125141
|
});
|
|
@@ -132660,12 +132817,12 @@ var activeProbe = null;
|
|
|
132660
132817
|
function matchLeadingElement(xml, localName2) {
|
|
132661
132818
|
const name = escapeRegExp2(localName2);
|
|
132662
132819
|
const openRe = new RegExp(`^<(${qnamePattern(name)})${ATTRS}(/?)>`);
|
|
132663
|
-
const
|
|
132664
|
-
if (!
|
|
132820
|
+
const open2 = openRe.exec(xml);
|
|
132821
|
+
if (!open2)
|
|
132665
132822
|
return "";
|
|
132666
|
-
if (
|
|
132667
|
-
return
|
|
132668
|
-
const qname = escapeRegExp2(
|
|
132823
|
+
if (open2[2] === "/")
|
|
132824
|
+
return open2[0];
|
|
132825
|
+
const qname = escapeRegExp2(open2[1]);
|
|
132669
132826
|
const tagRe = new RegExp(`<(/?)${qname}(?=[\\s/>])${ATTRS}(/?)>`, "g");
|
|
132670
132827
|
let depth = 0;
|
|
132671
132828
|
let m;
|
|
@@ -132685,13 +132842,13 @@ function matchLeadingElement(xml, localName2) {
|
|
|
132685
132842
|
function findFirstElement(xml, localName2) {
|
|
132686
132843
|
const name = escapeRegExp2(localName2);
|
|
132687
132844
|
const openRe = new RegExp(`<${qnamePattern(name)}${ATTRS}/?>`);
|
|
132688
|
-
const
|
|
132689
|
-
if (!
|
|
132845
|
+
const open2 = openRe.exec(xml);
|
|
132846
|
+
if (!open2)
|
|
132690
132847
|
return null;
|
|
132691
|
-
const slice = matchLeadingElement(xml.slice(
|
|
132848
|
+
const slice = matchLeadingElement(xml.slice(open2.index), localName2);
|
|
132692
132849
|
if (!slice)
|
|
132693
132850
|
return null;
|
|
132694
|
-
return { start:
|
|
132851
|
+
return { start: open2.index, end: open2.index + slice.length, xml: slice };
|
|
132695
132852
|
}
|
|
132696
132853
|
function findAllElements(xml, localName2) {
|
|
132697
132854
|
const spans = [];
|
|
@@ -135045,7 +135202,7 @@ function safeProofingBoundary(element) {
|
|
|
135045
135202
|
return is(element, "proofErr") && element.tag.isSelfClosing && element.children.length === 0 && ["spellStart", "spellEnd", "gramStart", "gramEnd"].includes(attr(element, "type") ?? "") && Object.values(element.tag.attributes).every((attribute) => attribute.uri === "http://www.w3.org/2000/xmlns/" || attribute.uri === W2 && attribute.local === "type");
|
|
135046
135203
|
}
|
|
135047
135204
|
function safeControlContent(children, isRun) {
|
|
135048
|
-
const
|
|
135205
|
+
const open2 = new Set;
|
|
135049
135206
|
for (const child of children) {
|
|
135050
135207
|
if (isRun(child))
|
|
135051
135208
|
continue;
|
|
@@ -135054,15 +135211,15 @@ function safeControlContent(children, isRun) {
|
|
|
135054
135211
|
const type = attr(child, "type");
|
|
135055
135212
|
const family = type.startsWith("spell") ? "spell" : "gram";
|
|
135056
135213
|
if (type.endsWith("Start")) {
|
|
135057
|
-
if (
|
|
135214
|
+
if (open2.has(family))
|
|
135058
135215
|
return false;
|
|
135059
|
-
|
|
135216
|
+
open2.add(family);
|
|
135060
135217
|
} else {
|
|
135061
|
-
if (!
|
|
135218
|
+
if (!open2.delete(family))
|
|
135062
135219
|
return false;
|
|
135063
135220
|
}
|
|
135064
135221
|
}
|
|
135065
|
-
return
|
|
135222
|
+
return open2.size === 0;
|
|
135066
135223
|
}
|
|
135067
135224
|
function control(xml, element) {
|
|
135068
135225
|
if (!is(element, "sdt"))
|
|
@@ -136218,16 +136375,16 @@ function findXmlTagEnd2(xml, start) {
|
|
|
136218
136375
|
return -1;
|
|
136219
136376
|
}
|
|
136220
136377
|
function parseXmlStartTag(rawTag) {
|
|
136221
|
-
const
|
|
136222
|
-
if (!
|
|
136378
|
+
const open2 = /^<([A-Za-z_][\w.-]*(?::[A-Za-z_][\w.-]*)?)/.exec(rawTag);
|
|
136379
|
+
if (!open2)
|
|
136223
136380
|
return null;
|
|
136224
|
-
const qname =
|
|
136381
|
+
const qname = open2[1];
|
|
136225
136382
|
const split = qname.indexOf(":");
|
|
136226
136383
|
const prefix = split < 0 ? "" : qname.slice(0, split);
|
|
136227
136384
|
const localName2 = split < 0 ? qname : qname.slice(split + 1);
|
|
136228
136385
|
const attributes = [];
|
|
136229
136386
|
const seen = new Set;
|
|
136230
|
-
let position =
|
|
136387
|
+
let position = open2[0].length;
|
|
136231
136388
|
while (position < rawTag.length) {
|
|
136232
136389
|
const whitespaceStart = position;
|
|
136233
136390
|
while (/\s/.test(rawTag[position] ?? ""))
|
|
@@ -136481,13 +136638,13 @@ function collectWordParagraphRanges(xml) {
|
|
|
136481
136638
|
openParagraphs.push({ start: pendingStart, depth, paraId, namespaceBindings });
|
|
136482
136639
|
});
|
|
136483
136640
|
parser.on("closetag", (tag) => {
|
|
136484
|
-
const
|
|
136485
|
-
if (
|
|
136641
|
+
const open2 = openParagraphs.at(-1);
|
|
136642
|
+
if (open2 && open2.depth === depth && tag.uri === W_NS2 && tag.local === "p") {
|
|
136486
136643
|
ranges.push({
|
|
136487
|
-
start:
|
|
136644
|
+
start: open2.start,
|
|
136488
136645
|
end: parser.position,
|
|
136489
|
-
paraId:
|
|
136490
|
-
namespaceBindings:
|
|
136646
|
+
paraId: open2.paraId,
|
|
136647
|
+
namespaceBindings: open2.namespaceBindings
|
|
136491
136648
|
});
|
|
136492
136649
|
openParagraphs.pop();
|
|
136493
136650
|
}
|
|
@@ -136559,9 +136716,9 @@ function escapeXmlAttribute2(value) {
|
|
|
136559
136716
|
}
|
|
136560
136717
|
function directParagraphParts(paragraphXml, namespaceBindings) {
|
|
136561
136718
|
XML_TAG_RE2.lastIndex = 0;
|
|
136562
|
-
const
|
|
136719
|
+
const open2 = XML_TAG_RE2.exec(paragraphXml);
|
|
136563
136720
|
const closeStart = paragraphXml.lastIndexOf("</");
|
|
136564
|
-
if (!
|
|
136721
|
+
if (!open2 || closeStart <= XML_TAG_RE2.lastIndex)
|
|
136565
136722
|
return { properties: "", runs: "" };
|
|
136566
136723
|
const inner = paragraphXml.slice(XML_TAG_RE2.lastIndex, closeStart);
|
|
136567
136724
|
const properties = topLevelElements(inner).find((element) => {
|
|
@@ -142063,28 +142220,28 @@ function buildElementRangeIndex(xml, initialNamespaceBindings = {}) {
|
|
|
142063
142220
|
continue;
|
|
142064
142221
|
}
|
|
142065
142222
|
for (let i = stack.length - 1;i >= 0; i -= 1) {
|
|
142066
|
-
const
|
|
142067
|
-
if (
|
|
142223
|
+
const open2 = stack[i];
|
|
142224
|
+
if (open2.localName !== localName2 || open2.prefix !== prefix)
|
|
142068
142225
|
continue;
|
|
142069
142226
|
stack.splice(i, 1);
|
|
142070
142227
|
const parent = stack[i - 1];
|
|
142071
142228
|
const row = stack[i - 2];
|
|
142072
|
-
if (
|
|
142073
|
-
emptyRowRevisionEnds.set(
|
|
142229
|
+
if (open2.wordTrackedMarkup && (localName2 === "ins" || localName2 === "del") && parent?.localName === "trPr" && parent.namespaceBindings[parent.prefix] === NS_W && row?.localName === "tr" && row.namespaceBindings[row.prefix] === NS_W && xml.slice(open2.openEnd, tag.start).trim() === "") {
|
|
142230
|
+
emptyRowRevisionEnds.set(open2.start, tag.end);
|
|
142074
142231
|
}
|
|
142075
|
-
if (
|
|
142232
|
+
if (open2.wordTrackedMarkup)
|
|
142076
142233
|
wordTrackedMarkupTagStarts.add(tag.start);
|
|
142077
142234
|
entries.push({
|
|
142078
142235
|
localName: localName2,
|
|
142079
|
-
namespaceUri:
|
|
142080
|
-
namespaceBindings:
|
|
142081
|
-
start:
|
|
142082
|
-
openEnd:
|
|
142236
|
+
namespaceUri: open2.namespaceBindings[open2.prefix],
|
|
142237
|
+
namespaceBindings: open2.namespaceBindings,
|
|
142238
|
+
start: open2.start,
|
|
142239
|
+
openEnd: open2.openEnd,
|
|
142083
142240
|
closeStart: tag.start,
|
|
142084
142241
|
end: tag.end
|
|
142085
142242
|
});
|
|
142086
|
-
if (
|
|
142087
|
-
recordMoveRangeMarker(
|
|
142243
|
+
if (open2.moveRangeMarker && isEmptyMoveMarkerContent(xml.slice(open2.moveRangeMarker.contentStart, tag.start))) {
|
|
142244
|
+
recordMoveRangeMarker(open2.moveRangeMarker, tag.end);
|
|
142088
142245
|
}
|
|
142089
142246
|
break;
|
|
142090
142247
|
}
|
|
@@ -144500,12 +144657,12 @@ function awaitSourceConsumer(producer, signal) {
|
|
|
144500
144657
|
observeProducer(producer, consumers);
|
|
144501
144658
|
}
|
|
144502
144659
|
const active = consumers;
|
|
144503
|
-
return new Promise((
|
|
144660
|
+
return new Promise((resolve2, reject) => {
|
|
144504
144661
|
const consume = (outcome) => {
|
|
144505
144662
|
active.delete(consume);
|
|
144506
144663
|
signal.removeEventListener("abort", abort);
|
|
144507
144664
|
if (outcome.ok)
|
|
144508
|
-
|
|
144665
|
+
resolve2(outcome.value);
|
|
144509
144666
|
else
|
|
144510
144667
|
reject(outcome.error);
|
|
144511
144668
|
};
|
|
@@ -145163,8 +145320,8 @@ function scanTextboxesFromXml(input) {
|
|
|
145163
145320
|
let tagsVisited = 0;
|
|
145164
145321
|
let peakHostDepth = 0;
|
|
145165
145322
|
let fallbackDepth = 0;
|
|
145166
|
-
const emit = (
|
|
145167
|
-
byOrdinal[
|
|
145323
|
+
const emit = (open2, endChar, endByte) => {
|
|
145324
|
+
byOrdinal[open2.ordinal] = { ...open2, endChar, endByte };
|
|
145168
145325
|
};
|
|
145169
145326
|
while (pos < xml.length) {
|
|
145170
145327
|
const openIdx = xml.indexOf("<", pos);
|
|
@@ -145210,9 +145367,9 @@ function scanTextboxesFromXml(input) {
|
|
|
145210
145367
|
continue;
|
|
145211
145368
|
}
|
|
145212
145369
|
if (parsedTag.localName === "txbxContent" && parsedTag.close) {
|
|
145213
|
-
const
|
|
145214
|
-
if (
|
|
145215
|
-
emit(
|
|
145370
|
+
const open3 = stack.pop();
|
|
145371
|
+
if (open3)
|
|
145372
|
+
emit(open3, gtIdx + 1, tagEndByte);
|
|
145216
145373
|
continue;
|
|
145217
145374
|
}
|
|
145218
145375
|
if (parsedTag.localName !== "txbxContent" || parsedTag.close)
|
|
@@ -145221,7 +145378,7 @@ function scanTextboxesFromXml(input) {
|
|
|
145221
145378
|
const ctxAfter = xml.slice(gtIdx + 1, Math.min(xml.length, gtIdx + 1 + 4096));
|
|
145222
145379
|
const family = stack.length > 0 ? "nested" : fallbackDepth > 0 ? "mce-fallback" : classifyTextboxFamily(ctxBefore, ctxAfter, input.hostKind);
|
|
145223
145380
|
const ordinal = nextOrdinal++;
|
|
145224
|
-
const
|
|
145381
|
+
const open2 = {
|
|
145225
145382
|
ordinal,
|
|
145226
145383
|
startChar: openIdx,
|
|
145227
145384
|
startByte: tagStartByte,
|
|
@@ -145231,9 +145388,9 @@ function scanTextboxesFromXml(input) {
|
|
|
145231
145388
|
alternateContentHost: alternateContentStack.at(-1) ?? null
|
|
145232
145389
|
};
|
|
145233
145390
|
if (parsedTag.selfClosing) {
|
|
145234
|
-
emit(
|
|
145391
|
+
emit(open2, gtIdx + 1, tagEndByte);
|
|
145235
145392
|
} else {
|
|
145236
|
-
stack.push(
|
|
145393
|
+
stack.push(open2);
|
|
145237
145394
|
}
|
|
145238
145395
|
}
|
|
145239
145396
|
while (stack.length > 0) {
|
|
@@ -147305,12 +147462,12 @@ var init_textbox_registry = __esm(() => {
|
|
|
147305
147462
|
EMPTY_TEXTBOX_STORY_RANGES = new Map;
|
|
147306
147463
|
EMPTY_TEXTBOX_AUXILIARY_STORY_EFFECTS = Object.freeze([]);
|
|
147307
147464
|
SDLazyReadonlyMap = class SDLazyReadonlyMap extends Map {
|
|
147308
|
-
constructor(source,
|
|
147465
|
+
constructor(source, resolve2) {
|
|
147309
147466
|
super();
|
|
147310
147467
|
_SDLazyReadonlyMap_source.set(this, undefined);
|
|
147311
147468
|
_SDLazyReadonlyMap_resolve.set(this, undefined);
|
|
147312
147469
|
__classPrivateFieldSet4(this, _SDLazyReadonlyMap_source, source, "f");
|
|
147313
|
-
__classPrivateFieldSet4(this, _SDLazyReadonlyMap_resolve,
|
|
147470
|
+
__classPrivateFieldSet4(this, _SDLazyReadonlyMap_resolve, resolve2, "f");
|
|
147314
147471
|
}
|
|
147315
147472
|
get size() {
|
|
147316
147473
|
return __classPrivateFieldGet4(this, _SDLazyReadonlyMap_source, "f").size;
|
|
@@ -147431,8 +147588,8 @@ function parseSectPrFragment(input) {
|
|
|
147431
147588
|
if (local === "sd-sectpr-wrap")
|
|
147432
147589
|
return;
|
|
147433
147590
|
const startByte = translate(wrapper.lastIndexOf("<", parser.position - 1));
|
|
147434
|
-
const
|
|
147435
|
-
stack.push(
|
|
147591
|
+
const open2 = { qkey: qnameKey(ns, local), namespaceUri: ns, localName: local, byteStart: startByte, byteEnd: -1 };
|
|
147592
|
+
stack.push(open2);
|
|
147436
147593
|
if (preimageBuf) {
|
|
147437
147594
|
preimageBuf.inSectPr = preimageBuf.inSectPr || ns === NS_W && local === "sectPr";
|
|
147438
147595
|
return;
|
|
@@ -154120,13 +154277,13 @@ function concatChunks(chunks, maxBytes) {
|
|
|
154120
154277
|
return out;
|
|
154121
154278
|
}
|
|
154122
154279
|
function yieldToMainThread() {
|
|
154123
|
-
return new Promise((
|
|
154280
|
+
return new Promise((resolve2) => {
|
|
154124
154281
|
const requestAnimationFrameFn = globalThis.requestAnimationFrame;
|
|
154125
154282
|
if (typeof requestAnimationFrameFn === "function") {
|
|
154126
|
-
requestAnimationFrameFn(() =>
|
|
154283
|
+
requestAnimationFrameFn(() => resolve2());
|
|
154127
154284
|
return;
|
|
154128
154285
|
}
|
|
154129
|
-
setTimeout(
|
|
154286
|
+
setTimeout(resolve2, 0);
|
|
154130
154287
|
});
|
|
154131
154288
|
}
|
|
154132
154289
|
function readU16(buf, p) {
|
|
@@ -154842,10 +154999,10 @@ function collectSoftInvariants(diagnostics, parts, relsParts, rootRelationships,
|
|
|
154842
154999
|
}
|
|
154843
155000
|
}
|
|
154844
155001
|
}
|
|
154845
|
-
function evaluatePackageInvariants(
|
|
155002
|
+
function evaluatePackageInvariants(open2) {
|
|
154846
155003
|
const hard = [];
|
|
154847
155004
|
const soft = [];
|
|
154848
|
-
const pkg =
|
|
155005
|
+
const pkg = open2.pkg;
|
|
154849
155006
|
if (!pkg.zip.isZip)
|
|
154850
155007
|
hard.push("package-not-zip");
|
|
154851
155008
|
if (pkg.contentTypes.parseError)
|
|
@@ -157895,8 +158052,8 @@ function createCancelToken() {
|
|
|
157895
158052
|
awaitCancelled() {
|
|
157896
158053
|
if (cancelled)
|
|
157897
158054
|
return Promise.resolve();
|
|
157898
|
-
return new Promise((
|
|
157899
|
-
waiters.push(
|
|
158055
|
+
return new Promise((resolve2) => {
|
|
158056
|
+
waiters.push(resolve2);
|
|
157900
158057
|
});
|
|
157901
158058
|
},
|
|
157902
158059
|
cancel(r) {
|
|
@@ -161244,8 +161401,8 @@ function canRunSourceLoader(openResult) {
|
|
|
161244
161401
|
return true;
|
|
161245
161402
|
}
|
|
161246
161403
|
function timeoutSignal() {
|
|
161247
|
-
return new Promise((
|
|
161248
|
-
const handle = globalThis.setTimeout(() =>
|
|
161404
|
+
return new Promise((resolve2) => {
|
|
161405
|
+
const handle = globalThis.setTimeout(() => resolve2("timeout"), DISPOSE_TIMEOUT_MS);
|
|
161249
161406
|
if (typeof handle.unref === "function") {
|
|
161250
161407
|
handle.unref();
|
|
161251
161408
|
}
|
|
@@ -161887,7 +162044,7 @@ function scanSecondaryStory(input) {
|
|
|
161887
162044
|
const byteStart = utf8ByteOffset(xml, openOffset);
|
|
161888
162045
|
const isWrapperRoot = stack.length === 0 && ns === NS_W && (local === "hdr" || local === "ftr");
|
|
161889
162046
|
const isStoryChild = stack.length === 1;
|
|
161890
|
-
const
|
|
162047
|
+
const open2 = {
|
|
161891
162048
|
ns,
|
|
161892
162049
|
local,
|
|
161893
162050
|
byteStart,
|
|
@@ -161895,13 +162052,13 @@ function scanSecondaryStory(input) {
|
|
|
161895
162052
|
storyChildOrdinal: isStoryChild ? nextStoryChildOrdinal++ : null,
|
|
161896
162053
|
isPPr: false
|
|
161897
162054
|
};
|
|
161898
|
-
stack.push(
|
|
162055
|
+
stack.push(open2);
|
|
161899
162056
|
if (isWrapperRoot)
|
|
161900
162057
|
return;
|
|
161901
162058
|
if (isStoryChild && ns === NS_W && local === "p") {
|
|
161902
162059
|
openParagraph = {
|
|
161903
162060
|
byteStart,
|
|
161904
|
-
bodyChildOrdinal:
|
|
162061
|
+
bodyChildOrdinal: open2.storyChildOrdinal,
|
|
161905
162062
|
styleId: null,
|
|
161906
162063
|
outlineLvl: null,
|
|
161907
162064
|
numId: null,
|
|
@@ -161916,7 +162073,7 @@ function scanSecondaryStory(input) {
|
|
|
161916
162073
|
if (ns === NS_W && local === "pPr") {
|
|
161917
162074
|
const parent = stack[stack.length - 2];
|
|
161918
162075
|
if (parent?.ns === NS_W && parent?.local === "p") {
|
|
161919
|
-
|
|
162076
|
+
open2.isPPr = true;
|
|
161920
162077
|
openParagraphInsidePPr = true;
|
|
161921
162078
|
}
|
|
161922
162079
|
}
|
|
@@ -164985,19 +165142,19 @@ function elementContainsDescendantRunProperties(xml, element) {
|
|
|
164985
165142
|
return false;
|
|
164986
165143
|
}
|
|
164987
165144
|
function stripParagraphPropertyChange(pPrXml) {
|
|
164988
|
-
const
|
|
164989
|
-
if (!
|
|
165145
|
+
const open2 = /<([\w.-]+):pPrChange\b[^>]*?(\/?)>/.exec(pPrXml);
|
|
165146
|
+
if (!open2)
|
|
164990
165147
|
return pPrXml;
|
|
164991
165148
|
let end;
|
|
164992
|
-
if (
|
|
164993
|
-
end =
|
|
165149
|
+
if (open2[2] === "/") {
|
|
165150
|
+
end = open2.index + open2[0].length;
|
|
164994
165151
|
} else {
|
|
164995
|
-
const close = pPrXml.indexOf(`</${
|
|
165152
|
+
const close = pPrXml.indexOf(`</${open2[1]}:pPrChange>`, open2.index + open2[0].length);
|
|
164996
165153
|
if (close === -1)
|
|
164997
165154
|
return pPrXml;
|
|
164998
|
-
end = close + `</${
|
|
165155
|
+
end = close + `</${open2[1]}:pPrChange>`.length;
|
|
164999
165156
|
}
|
|
165000
|
-
const stripped = pPrXml.slice(0,
|
|
165157
|
+
const stripped = pPrXml.slice(0, open2.index) + pPrXml.slice(end);
|
|
165001
165158
|
return /^<([\w.-]+):pPr\b[^>]*>\s*<\/\1:pPr>$/.test(stripped.trim()) ? "" : stripped;
|
|
165002
165159
|
}
|
|
165003
165160
|
function replaceDirectParagraphStyleId(pPrXml, newStyleId) {
|
|
@@ -168033,10 +168190,10 @@ function parseNumberingXml(xml) {
|
|
|
168033
168190
|
};
|
|
168034
168191
|
}
|
|
168035
168192
|
function hasNumberingRoot(xml) {
|
|
168036
|
-
const
|
|
168037
|
-
if (!
|
|
168193
|
+
const open2 = /<((?:[\w.-]+:)?numbering)\b[^>]*>/.exec(xml);
|
|
168194
|
+
if (!open2)
|
|
168038
168195
|
return false;
|
|
168039
|
-
const qname =
|
|
168196
|
+
const qname = open2[1].replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
168040
168197
|
return new RegExp(`</${qname}\\s*>`).test(xml);
|
|
168041
168198
|
}
|
|
168042
168199
|
function parseMultiLevelType(block) {
|
|
@@ -171667,10 +171824,10 @@ function isEligibleGroupParagraph(lookupContext, partXml, paragraph) {
|
|
|
171667
171824
|
return true;
|
|
171668
171825
|
}
|
|
171669
171826
|
function readLeadingParagraphPropertyBlock(paragraphXml) {
|
|
171670
|
-
const
|
|
171671
|
-
if (!
|
|
171827
|
+
const open2 = /^<[\w.-]+:p\b[^>]*>\s*/.exec(paragraphXml);
|
|
171828
|
+
if (!open2)
|
|
171672
171829
|
return null;
|
|
171673
|
-
const start =
|
|
171830
|
+
const start = open2[0].length;
|
|
171674
171831
|
const first = /^<[\w.-]+:pPr\b[^>]*?(\/?)>/.exec(paragraphXml.slice(start));
|
|
171675
171832
|
if (!first)
|
|
171676
171833
|
return null;
|
|
@@ -172745,8 +172902,8 @@ function parsePropertyChildElements(innerXml) {
|
|
|
172745
172902
|
const isClose = match[1] === "/";
|
|
172746
172903
|
const localName2 = match[3];
|
|
172747
172904
|
if (isClose) {
|
|
172748
|
-
const
|
|
172749
|
-
if (!
|
|
172905
|
+
const open2 = stack.pop();
|
|
172906
|
+
if (!open2 || open2.localName !== localName2)
|
|
172750
172907
|
return null;
|
|
172751
172908
|
continue;
|
|
172752
172909
|
}
|
|
@@ -175714,12 +175871,12 @@ function findEnclosingOverlapFragment(child, entries) {
|
|
|
175714
175871
|
}
|
|
175715
175872
|
function indexEnclosingOverlapFragments(entries) {
|
|
175716
175873
|
const result = new Map;
|
|
175717
|
-
const
|
|
175874
|
+
const open2 = [];
|
|
175718
175875
|
for (const entry of entries) {
|
|
175719
|
-
while (
|
|
175720
|
-
|
|
175876
|
+
while (open2.length > 0 && open2[open2.length - 1].fragment.byteEnd <= entry.fragment.byteStart) {
|
|
175877
|
+
open2.pop();
|
|
175721
175878
|
}
|
|
175722
|
-
const candidate2 =
|
|
175879
|
+
const candidate2 = open2[open2.length - 1] ?? null;
|
|
175723
175880
|
if (candidate2 && candidate2.fragment.byteStart < entry.fragment.byteStart && candidate2.fragment.byteEnd > entry.fragment.byteEnd) {
|
|
175724
175881
|
result.set(entry, candidate2);
|
|
175725
175882
|
} else if (candidate2) {
|
|
@@ -175727,7 +175884,7 @@ function indexEnclosingOverlapFragments(entries) {
|
|
|
175727
175884
|
} else {
|
|
175728
175885
|
result.set(entry, null);
|
|
175729
175886
|
}
|
|
175730
|
-
|
|
175887
|
+
open2.push(entry);
|
|
175731
175888
|
}
|
|
175732
175889
|
return result;
|
|
175733
175890
|
}
|
|
@@ -177707,10 +177864,10 @@ function stripNestedStructuralListWrappers(xml, kind, partNamespaces) {
|
|
|
177707
177864
|
onCloseTag(event) {
|
|
177708
177865
|
if (event.tag.namespaceUri !== NS_W || event.tag.localName !== kind || event.tag.isSelfClosing)
|
|
177709
177866
|
return;
|
|
177710
|
-
const
|
|
177711
|
-
if (!
|
|
177867
|
+
const open2 = stack.pop();
|
|
177868
|
+
if (!open2 || open2.start === 0 && event.end === xml.length)
|
|
177712
177869
|
return;
|
|
177713
|
-
ranges.push({ start:
|
|
177870
|
+
ranges.push({ start: open2.start, end: event.end });
|
|
177714
177871
|
}
|
|
177715
177872
|
});
|
|
177716
177873
|
if (ranges.length === 0)
|
|
@@ -178073,11 +178230,11 @@ function localParagraphOpenBefore(partXml, position) {
|
|
|
178073
178230
|
const found = partXml.lastIndexOf(":p", cursor);
|
|
178074
178231
|
if (found < 0)
|
|
178075
178232
|
return -1;
|
|
178076
|
-
const
|
|
178077
|
-
if (
|
|
178233
|
+
const open2 = partXml.lastIndexOf("<", found);
|
|
178234
|
+
if (open2 >= 0 && /^<[\w.-]+:p$/.test(partXml.slice(open2, found + 2))) {
|
|
178078
178235
|
const boundary = partXml.charAt(found + 2);
|
|
178079
178236
|
if (boundary === " " || boundary === ">" || boundary === "/")
|
|
178080
|
-
return
|
|
178237
|
+
return open2;
|
|
178081
178238
|
}
|
|
178082
178239
|
cursor = found - 1;
|
|
178083
178240
|
}
|
|
@@ -178539,12 +178696,12 @@ function collectNestedSameKindWrapperRanges(xml, kind) {
|
|
|
178539
178696
|
stack.push({ start: byteStart });
|
|
178540
178697
|
continue;
|
|
178541
178698
|
}
|
|
178542
|
-
const
|
|
178543
|
-
if (!
|
|
178699
|
+
const open2 = stack.pop();
|
|
178700
|
+
if (!open2)
|
|
178544
178701
|
continue;
|
|
178545
|
-
if (
|
|
178702
|
+
if (open2.start === 0 && byteEnd === xml.length)
|
|
178546
178703
|
continue;
|
|
178547
|
-
ranges.push({ start:
|
|
178704
|
+
ranges.push({ start: open2.start, end: byteEnd });
|
|
178548
178705
|
}
|
|
178549
178706
|
return coalesceRanges(ranges);
|
|
178550
178707
|
}
|
|
@@ -181276,11 +181433,11 @@ function withoutAnnotationGraphEntries(xml, partUri) {
|
|
|
181276
181433
|
if (parsed.errors.length)
|
|
181277
181434
|
return null;
|
|
181278
181435
|
const spans = parsed.ranges.filter((range) => {
|
|
181279
|
-
const
|
|
181436
|
+
const open2 = xml.slice(range.start, range.openEnd);
|
|
181280
181437
|
if (partUri === "/word/_rels/document.xml.rels") {
|
|
181281
|
-
return range.tag.namespaceUri === "http://schemas.openxmlformats.org/package/2006/relationships" && range.tag.localName === "Relationship" && ["comments", "commentsExtended", "commentsIds"].some((kind) => readXmlAttributeValueByLocalName(
|
|
181438
|
+
return range.tag.namespaceUri === "http://schemas.openxmlformats.org/package/2006/relationships" && range.tag.localName === "Relationship" && ["comments", "commentsExtended", "commentsIds"].some((kind) => readXmlAttributeValueByLocalName(open2, "Type") === RELATIONSHIP_TYPE_FOR_KIND[kind] && readXmlAttributeValueByLocalName(open2, "Target") === `${kind}.xml`) && !!readXmlAttributeValueByLocalName(open2, "Id") && readXmlAttributeValueByLocalName(open2, "TargetMode") == null;
|
|
181282
181439
|
}
|
|
181283
|
-
return range.tag.namespaceUri === "http://schemas.openxmlformats.org/package/2006/content-types" && range.tag.localName === "Override" && ["comments", "commentsExtended", "commentsIds"].some((kind) => readXmlAttributeValueByLocalName(
|
|
181440
|
+
return range.tag.namespaceUri === "http://schemas.openxmlformats.org/package/2006/content-types" && range.tag.localName === "Override" && ["comments", "commentsExtended", "commentsIds"].some((kind) => readXmlAttributeValueByLocalName(open2, "PartName") === `/word/${kind}.xml` && readXmlAttributeValueByLocalName(open2, "ContentType") === CONTENT_TYPE_FOR_KIND[kind]);
|
|
181284
181441
|
}).sort((a, b) => b.start - a.start);
|
|
181285
181442
|
let result = xml;
|
|
181286
181443
|
for (const span of spans)
|
|
@@ -181884,7 +182041,7 @@ function structuralReviewAnchorSignature(xml) {
|
|
|
181884
182041
|
}
|
|
181885
182042
|
function reviewRangesStayWithinSlices(slices) {
|
|
181886
182043
|
for (const slice of slices) {
|
|
181887
|
-
const
|
|
182044
|
+
const open2 = new Set;
|
|
181888
182045
|
STRUCTURAL_REVIEW_RANGE_TAG_RE.lastIndex = 0;
|
|
181889
182046
|
for (let match = STRUCTURAL_REVIEW_RANGE_TAG_RE.exec(slice);match; match = STRUCTURAL_REVIEW_RANGE_TAG_RE.exec(slice)) {
|
|
181890
182047
|
const tag = match[1];
|
|
@@ -181892,14 +182049,14 @@ function reviewRangesStayWithinSlices(slices) {
|
|
|
181892
182049
|
const family = tag.startsWith("comment") ? "comment" : "perm";
|
|
181893
182050
|
const key2 = `${family}:${id}`;
|
|
181894
182051
|
if (tag.endsWith("Start")) {
|
|
181895
|
-
if (
|
|
182052
|
+
if (open2.has(key2))
|
|
181896
182053
|
return false;
|
|
181897
|
-
|
|
181898
|
-
} else if (!
|
|
182054
|
+
open2.add(key2);
|
|
182055
|
+
} else if (!open2.delete(key2)) {
|
|
181899
182056
|
return false;
|
|
181900
182057
|
}
|
|
181901
182058
|
}
|
|
181902
|
-
if (
|
|
182059
|
+
if (open2.size > 0)
|
|
181903
182060
|
return false;
|
|
181904
182061
|
}
|
|
181905
182062
|
return true;
|
|
@@ -181913,10 +182070,10 @@ function retainOriginParagraphSliceXml(state, partUri, byteStart, byteEnd) {
|
|
|
181913
182070
|
function extractDrawingSegments(xml) {
|
|
181914
182071
|
const segments = [];
|
|
181915
182072
|
DRAWING_OPEN_RE.lastIndex = 0;
|
|
181916
|
-
let
|
|
181917
|
-
while (
|
|
182073
|
+
let open2 = DRAWING_OPEN_RE.exec(xml);
|
|
182074
|
+
while (open2) {
|
|
181918
182075
|
let depth = 1;
|
|
181919
|
-
let cursor =
|
|
182076
|
+
let cursor = open2.index + open2[0].length;
|
|
181920
182077
|
let end = -1;
|
|
181921
182078
|
while (depth > 0) {
|
|
181922
182079
|
DRAWING_OPEN_RE.lastIndex = cursor;
|
|
@@ -181935,9 +182092,9 @@ function extractDrawingSegments(xml) {
|
|
|
181935
182092
|
end = cursor;
|
|
181936
182093
|
}
|
|
181937
182094
|
}
|
|
181938
|
-
segments.push(xml.slice(
|
|
182095
|
+
segments.push(xml.slice(open2.index, end));
|
|
181939
182096
|
DRAWING_OPEN_RE.lastIndex = end;
|
|
181940
|
-
|
|
182097
|
+
open2 = DRAWING_OPEN_RE.exec(xml);
|
|
181941
182098
|
}
|
|
181942
182099
|
return segments;
|
|
181943
182100
|
}
|
|
@@ -193088,8 +193245,8 @@ function rebaseTextOnlyParagraphContexts(xml, previous) {
|
|
|
193088
193245
|
const nodeStart = prior.lastIndexOf("<", start - 1);
|
|
193089
193246
|
if (nodeStart < 0)
|
|
193090
193247
|
return null;
|
|
193091
|
-
for (const [
|
|
193092
|
-
if (prior.lastIndexOf(
|
|
193248
|
+
for (const [open2, close] of [["<!--", "-->"], ["<![CDATA[", "]]>"], ["<?", "?>"]]) {
|
|
193249
|
+
if (prior.lastIndexOf(open2, nodeStart) > prior.lastIndexOf(close, nodeStart))
|
|
193093
193250
|
return null;
|
|
193094
193251
|
}
|
|
193095
193252
|
const node2 = readXmlNodeAt(prior, nodeStart);
|
|
@@ -193827,10 +193984,10 @@ function renderTrackedParagraphMarkProperties(pPrXml, stamp, kind = "ins", marke
|
|
|
193827
193984
|
return pPrXml;
|
|
193828
193985
|
return pPrXml.replace(/\/>\s*$/, `><${pPrRPrName}>${marker(pPrPrefix)}</${pPrRPrName}></${pPrName}>`);
|
|
193829
193986
|
}
|
|
193830
|
-
const
|
|
193831
|
-
if (!
|
|
193987
|
+
const open2 = /^<(?:[\w.-]+:)?pPr\b[^>]*>/.exec(pPrXml)?.[0];
|
|
193988
|
+
if (!open2)
|
|
193832
193989
|
return pPrXml;
|
|
193833
|
-
const inner = pPrXml.slice(
|
|
193990
|
+
const inner = pPrXml.slice(open2.length);
|
|
193834
193991
|
const rPrOffset = inner.search(/<(?:[\w.-]+:)?rPr\b/);
|
|
193835
193992
|
const liveBoundary = inner.search(/<(?:[\w.-]+:)?(?:sectPr|pPrChange)\b/);
|
|
193836
193993
|
if (rPrOffset >= 0 && (liveBoundary < 0 || rPrOffset < liveBoundary)) {
|
|
@@ -193842,12 +193999,12 @@ function renderTrackedParagraphMarkProperties(pPrXml, stamp, kind = "ins", marke
|
|
|
193842
193999
|
return pPrXml;
|
|
193843
194000
|
const rPrPrefix = xmlPrefix(rPrName2) ?? pPrPrefix;
|
|
193844
194001
|
const expanded = rPr.replace(/\/>\s*$/, `>${marker(rPrPrefix)}</${rPrName2}>`);
|
|
193845
|
-
return
|
|
194002
|
+
return open2 + inner.slice(0, rPrOffset) + expanded + inner.slice(rPrOffset + rPr.length);
|
|
193846
194003
|
}
|
|
193847
194004
|
const rPrName = /^<([^\s/>]+)/.exec(rPr)?.[1];
|
|
193848
194005
|
const insertAt2 = markerPosition === "end" ? rPr.lastIndexOf("</") : rPr.indexOf(">") + 1;
|
|
193849
194006
|
if (insertAt2 > 0) {
|
|
193850
|
-
return
|
|
194007
|
+
return open2 + inner.slice(0, rPrOffset) + rPr.slice(0, insertAt2) + marker(xmlPrefix(rPrName) ?? pPrPrefix) + rPr.slice(insertAt2) + inner.slice(rPrOffset + rPr.length);
|
|
193851
194008
|
}
|
|
193852
194009
|
}
|
|
193853
194010
|
}
|
|
@@ -193855,7 +194012,7 @@ function renderTrackedParagraphMarkProperties(pPrXml, stamp, kind = "ins", marke
|
|
|
193855
194012
|
if (pPrClose < 0)
|
|
193856
194013
|
return pPrXml;
|
|
193857
194014
|
const insertAt = liveBoundary >= 0 ? liveBoundary : pPrClose;
|
|
193858
|
-
return
|
|
194015
|
+
return open2 + inner.slice(0, insertAt) + `<${pPrRPrName}>${marker(pPrPrefix)}</${pPrRPrName}>` + inner.slice(insertAt);
|
|
193859
194016
|
}
|
|
193860
194017
|
function xmlPrefix(qname) {
|
|
193861
194018
|
if (!qname)
|
|
@@ -202856,12 +203013,12 @@ function parsePlainRun(runXml, textStart, byteStart, byteEnd, options = {}) {
|
|
|
202856
203013
|
if (!closeMatch)
|
|
202857
203014
|
return fail4("invalid-range");
|
|
202858
203015
|
const inner = without.slice(childRe.lastIndex, closeMatch.index);
|
|
202859
|
-
const
|
|
203016
|
+
const open2 = without.slice(m.index, childRe.lastIndex);
|
|
202860
203017
|
const attrs = m[3];
|
|
202861
203018
|
tMatch = {
|
|
202862
|
-
open,
|
|
203019
|
+
open: open2,
|
|
202863
203020
|
close: closeMatch[0],
|
|
202864
|
-
xml:
|
|
203021
|
+
xml: open2 + inner + closeMatch[0],
|
|
202865
203022
|
attrs,
|
|
202866
203023
|
inner
|
|
202867
203024
|
};
|
|
@@ -203770,9 +203927,9 @@ function parseEmptyParagraphInsertionSite(paragraphXml, options = {}) {
|
|
|
203770
203927
|
const ns = openTagMatch[1];
|
|
203771
203928
|
if (closeTagMatch[1] !== ns)
|
|
203772
203929
|
return null;
|
|
203773
|
-
const
|
|
203930
|
+
const open2 = openTagMatch[0];
|
|
203774
203931
|
const close = closeTagMatch[0];
|
|
203775
|
-
const inner = paragraphXml.slice(
|
|
203932
|
+
const inner = paragraphXml.slice(open2.length, paragraphXml.length - close.length);
|
|
203776
203933
|
let insertionPoint = 0;
|
|
203777
203934
|
while (insertionPoint < inner.length && /\s/.test(inner[insertionPoint]))
|
|
203778
203935
|
insertionPoint += 1;
|
|
@@ -203789,7 +203946,7 @@ function parseEmptyParagraphInsertionSite(paragraphXml, options = {}) {
|
|
|
203789
203946
|
if (visibleTextLength(remaining) !== 0)
|
|
203790
203947
|
return null;
|
|
203791
203948
|
if (options.contentInsertionCharOffset != null) {
|
|
203792
|
-
const relativeOffset = options.contentInsertionCharOffset -
|
|
203949
|
+
const relativeOffset = options.contentInsertionCharOffset - open2.length;
|
|
203793
203950
|
if (relativeOffset < insertionPoint || relativeOffset > inner.length)
|
|
203794
203951
|
return null;
|
|
203795
203952
|
insertionPoint = relativeOffset;
|
|
@@ -203798,7 +203955,7 @@ function parseEmptyParagraphInsertionSite(paragraphXml, options = {}) {
|
|
|
203798
203955
|
}
|
|
203799
203956
|
}
|
|
203800
203957
|
return {
|
|
203801
|
-
open,
|
|
203958
|
+
open: open2,
|
|
203802
203959
|
prefix: inner.slice(0, insertionPoint),
|
|
203803
203960
|
suffix: inner.slice(insertionPoint),
|
|
203804
203961
|
close,
|
|
@@ -204695,21 +204852,21 @@ function inspectHyperlinkRange(pieces, rangeStart, rangeEnd) {
|
|
|
204695
204852
|
return { found, overlaps: false };
|
|
204696
204853
|
}
|
|
204697
204854
|
function parseSimpleTextRunForRange(runXml, xmlStart, textStart) {
|
|
204698
|
-
const
|
|
204699
|
-
if (!
|
|
204855
|
+
const open2 = /^<([\w.-]+):r\b[^>]*>/.exec(runXml);
|
|
204856
|
+
if (!open2)
|
|
204700
204857
|
return null;
|
|
204701
|
-
const runCloseTag = `</${
|
|
204858
|
+
const runCloseTag = `</${open2[1]}:r>`;
|
|
204702
204859
|
if (!runXml.endsWith(runCloseTag))
|
|
204703
204860
|
return null;
|
|
204704
|
-
const inner = runXml.slice(
|
|
204861
|
+
const inner = runXml.slice(open2[0].length, -runCloseTag.length);
|
|
204705
204862
|
const textOnly = /^\s*(<[\w.-]+:rPr\b[^>]*\/>|<[\w.-]+:rPr\b[\s\S]*?<\/[\w.-]+:rPr>)?\s*((?:<[\w.-]+:t\b[^>]*>[\s\S]*?<\/[\w.-]+:t>\s*)+)$/.exec(inner);
|
|
204706
204863
|
if (!textOnly)
|
|
204707
204864
|
return null;
|
|
204708
204865
|
const textElements = parseRawTextElements(textOnly[2] ?? "");
|
|
204709
204866
|
const length = textElements.reduce((total, element) => total + visibleLengthOfRawXmlText(element.rawText), 0);
|
|
204710
204867
|
return {
|
|
204711
|
-
prefix:
|
|
204712
|
-
runOpenTag:
|
|
204868
|
+
prefix: open2[1],
|
|
204869
|
+
runOpenTag: open2[0],
|
|
204713
204870
|
runCloseTag,
|
|
204714
204871
|
rPrXml: textOnly[1] ?? "",
|
|
204715
204872
|
textElements,
|
|
@@ -205883,9 +206040,9 @@ function restoreParagraphMarkFormattingSnapshot(beforeXml, liveXml, namespaceBin
|
|
|
205883
206040
|
inner = inner.slice(0, marker.start - before.root.openEnd) + inner.slice(marker.end - before.root.openEnd);
|
|
205884
206041
|
}
|
|
205885
206042
|
const liveMarkers = live.markers.map((marker) => liveXml.slice(marker.start, marker.end)).join("");
|
|
205886
|
-
const
|
|
206043
|
+
const open2 = beforeXml.slice(0, before.root.openEnd).replace(/\s*\/>$/, ">");
|
|
205887
206044
|
const prefix = before.root.tag.prefix ? `${before.root.tag.prefix}:` : "";
|
|
205888
|
-
return `${
|
|
206045
|
+
return `${open2}${liveMarkers}${inner}</${prefix}rPr>`;
|
|
205889
206046
|
}
|
|
205890
206047
|
var WORD = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", STRUCTURAL_MARKERS;
|
|
205891
206048
|
var init_paragraph_mark_format_history = __esm(() => {
|
|
@@ -206037,8 +206194,8 @@ function prepareTrackedParagraphProperties(input) {
|
|
|
206037
206194
|
if (!change)
|
|
206038
206195
|
return null;
|
|
206039
206196
|
if (!after.mark || after.mark.tag.isSelfClosing) {
|
|
206040
|
-
const
|
|
206041
|
-
mark =
|
|
206197
|
+
const open2 = after.mark ? after.markXml.replace(/\/>$/, ">") : `<${prefix}:rPr>`;
|
|
206198
|
+
mark = open2 + change + `</${after.mark?.tag.name ?? `${prefix}:rPr`}>`;
|
|
206042
206199
|
} else {
|
|
206043
206200
|
const at = after.mark.closeStart - after.mark.start;
|
|
206044
206201
|
mark = after.markXml.slice(0, at) + change + after.markXml.slice(at);
|
|
@@ -206225,12 +206382,12 @@ function validatePrevalidatedTrackedWrapperSpan(xml, fragment3, span, namespaceB
|
|
|
206225
206382
|
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(openEnd) || !Number.isSafeInteger(closeStart) || !Number.isSafeInteger(end) || start !== fragment3.byteStart || end !== fragment3.byteEnd || start < 0 || start >= openEnd || openEnd > closeStart || closeStart >= end || end > xml.length) {
|
|
206226
206383
|
return null;
|
|
206227
206384
|
}
|
|
206228
|
-
const
|
|
206385
|
+
const open2 = parseRawXmlElementTag(xml.slice(start, openEnd));
|
|
206229
206386
|
const close = parseRawXmlElementTag(xml.slice(closeStart, end));
|
|
206230
|
-
if (!
|
|
206387
|
+
if (!open2 || !close || open2.isClose || open2.selfClose || !close.isClose || close.selfClose || open2.prefix !== close.prefix || open2.localName !== fragment3.kind || close.localName !== fragment3.kind) {
|
|
206231
206388
|
return null;
|
|
206232
206389
|
}
|
|
206233
|
-
return { ...span, prefix:
|
|
206390
|
+
return { ...span, prefix: open2.prefix, namespaceBindings: { [open2.prefix]: NS_W4, ...namespaceBindings } };
|
|
206234
206391
|
}
|
|
206235
206392
|
function decodeXmlText7(escaped) {
|
|
206236
206393
|
return escaped.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
@@ -206770,12 +206927,12 @@ function findNextParagraphElement(xml, fromIndex, allowInsertionWrapper, namespa
|
|
|
206770
206927
|
while (cursor < xml.length && /\s/.test(xml[cursor] ?? ""))
|
|
206771
206928
|
cursor += 1;
|
|
206772
206929
|
}
|
|
206773
|
-
const
|
|
206774
|
-
if (!
|
|
206930
|
+
const open2 = /<([\w.-]+):p\b[^>]*>/.exec(xml.slice(cursor));
|
|
206931
|
+
if (!open2 || open2.index !== 0)
|
|
206775
206932
|
return null;
|
|
206776
|
-
const start = cursor +
|
|
206777
|
-
const prefix =
|
|
206778
|
-
const openTag =
|
|
206933
|
+
const start = cursor + open2.index;
|
|
206934
|
+
const prefix = open2[1];
|
|
206935
|
+
const openTag = open2[0];
|
|
206779
206936
|
if (/\/>$/.test(openTag)) {
|
|
206780
206937
|
return { start, end: start + openTag.length, xml: openTag, wrapper: null };
|
|
206781
206938
|
}
|
|
@@ -207901,11 +208058,11 @@ function setRowGridAfter(lookupContext, rowXml, gridAfter, widthAfter) {
|
|
|
207901
208058
|
if (!trPrRange) {
|
|
207902
208059
|
if (!gridAfterXml)
|
|
207903
208060
|
return rowXml;
|
|
207904
|
-
const
|
|
207905
|
-
if (!
|
|
208061
|
+
const open2 = /^<([\w.-]+):tr\b[^>]*>/.exec(rowXml);
|
|
208062
|
+
if (!open2)
|
|
207906
208063
|
return rowXml;
|
|
207907
|
-
const insertAt = findDirectChildRanges(rowXml, "tblPrEx", lookupContext)[0]?.end ??
|
|
207908
|
-
return rowXml.slice(0, insertAt) + `<${
|
|
208064
|
+
const insertAt = findDirectChildRanges(rowXml, "tblPrEx", lookupContext)[0]?.end ?? open2[0].length;
|
|
208065
|
+
return rowXml.slice(0, insertAt) + `<${open2[1]}:trPr>${gridAfterXml}</${open2[1]}:trPr>` + rowXml.slice(insertAt);
|
|
207909
208066
|
}
|
|
207910
208067
|
const trPrXml = rowXml.slice(trPrRange.start, trPrRange.end);
|
|
207911
208068
|
if (/^<[\w.-]+:trPr\b[^>]*\/>\s*$/.test(trPrXml)) {
|
|
@@ -208344,10 +208501,10 @@ function isCompleteParagraphWindow(paragraph) {
|
|
|
208344
208501
|
return Number.isSafeInteger(paragraph.byteStart) && Number.isSafeInteger(paragraph.byteEnd) && paragraph.byteStart >= 0 && paragraph.byteEnd > paragraph.byteStart;
|
|
208345
208502
|
}
|
|
208346
208503
|
function isOneCompleteParagraph(xml) {
|
|
208347
|
-
const
|
|
208348
|
-
if (!
|
|
208504
|
+
const open2 = /^<([\w.-]+):p\b[^>]*>/.exec(xml);
|
|
208505
|
+
if (!open2)
|
|
208349
208506
|
return false;
|
|
208350
|
-
const close = `</${
|
|
208507
|
+
const close = `</${open2[1]}:p>`;
|
|
208351
208508
|
return xml.endsWith(close) && xml.indexOf(close) === xml.length - close.length;
|
|
208352
208509
|
}
|
|
208353
208510
|
function resolveUniqueLocalFragment(xml, source) {
|
|
@@ -209067,10 +209224,10 @@ function normalizeShifts(candidates) {
|
|
|
209067
209224
|
return out;
|
|
209068
209225
|
}
|
|
209069
209226
|
function ownerContainsTrackedHyperlink(xml, start, end) {
|
|
209070
|
-
const
|
|
209071
|
-
if (
|
|
209227
|
+
const open2 = xml.lastIndexOf(":hyperlink", start);
|
|
209228
|
+
if (open2 < 0)
|
|
209072
209229
|
return false;
|
|
209073
|
-
const tagStart = xml.lastIndexOf("<",
|
|
209230
|
+
const tagStart = xml.lastIndexOf("<", open2);
|
|
209074
209231
|
const close = xml.indexOf(":hyperlink>", end);
|
|
209075
209232
|
return tagStart >= 0 && close >= end && xml[tagStart + 1] !== "/";
|
|
209076
209233
|
}
|
|
@@ -209319,7 +209476,7 @@ function applyBibliographyReviewResourceCleanup(input) {
|
|
|
209319
209476
|
styleName: readXmlAttribute(root.tag, "", "StyleName")?.value,
|
|
209320
209477
|
version: readXmlAttribute(root.tag, "", "Version")?.value
|
|
209321
209478
|
});
|
|
209322
|
-
let
|
|
209479
|
+
let open2 = xml.slice(root.start, root.openEnd);
|
|
209323
209480
|
for (const [name, value] of [
|
|
209324
209481
|
["SelectedStyle", metadata2.selectedStyle],
|
|
209325
209482
|
["StyleName", metadata2.styleName],
|
|
@@ -209328,11 +209485,11 @@ function applyBibliographyReviewResourceCleanup(input) {
|
|
|
209328
209485
|
const attribute = readXmlAttribute(root.tag, "", name);
|
|
209329
209486
|
if (attribute) {
|
|
209330
209487
|
const pattern = new RegExp(`(\\s${name}\\s*=\\s*)(["'])(.*?)\\2`, "s");
|
|
209331
|
-
|
|
209488
|
+
open2 = open2.replace(pattern, (_match, prefix, quote) => `${prefix}${quote}${escapeXmlAttribute(value)}${quote}`);
|
|
209332
209489
|
} else
|
|
209333
|
-
|
|
209490
|
+
open2 = open2.replace(/\s*(\/?)>$/, ` ${name}="${escapeXmlAttribute(value)}"$1>`);
|
|
209334
209491
|
}
|
|
209335
|
-
const next = xml.slice(0, root.start) +
|
|
209492
|
+
const next = xml.slice(0, root.start) + open2 + xml.slice(root.openEnd);
|
|
209336
209493
|
if (next !== xml)
|
|
209337
209494
|
stageXml(input, uri, next);
|
|
209338
209495
|
foundSources = true;
|
|
@@ -214211,21 +214368,21 @@ function scanParagraphPropertyMoveMarkers(workingXml, fragment3, rangeMarkerIds)
|
|
|
214211
214368
|
onCloseTag(event) {
|
|
214212
214369
|
if (event.tag.isSelfClosing)
|
|
214213
214370
|
return;
|
|
214214
|
-
const
|
|
214215
|
-
if (!
|
|
214371
|
+
const open2 = stack.pop();
|
|
214372
|
+
if (!open2)
|
|
214216
214373
|
return;
|
|
214217
|
-
if (
|
|
214218
|
-
|
|
214219
|
-
|
|
214374
|
+
if (open2.paragraphPropertyCandidate) {
|
|
214375
|
+
open2.paragraphPropertyCandidate.end = event.end;
|
|
214376
|
+
open2.paragraphPropertyCandidate.explicitCloseContentValid = isEmptyMoveMarkerContent2(workingXml.slice(open2.paragraphPropertyCandidate.contentStart, event.start));
|
|
214220
214377
|
}
|
|
214221
|
-
if (
|
|
214222
|
-
|
|
214223
|
-
if (
|
|
214224
|
-
|
|
214225
|
-
|
|
214378
|
+
if (open2.moveWrapperCandidate)
|
|
214379
|
+
open2.moveWrapperCandidate.end = event.end;
|
|
214380
|
+
if (open2.rangeMarker) {
|
|
214381
|
+
open2.rangeMarker.end = event.end;
|
|
214382
|
+
open2.rangeMarker.explicitCloseContentValid = isEmptyMoveMarkerContent2(workingXml.slice(open2.rangeMarker.contentStart, event.start));
|
|
214226
214383
|
}
|
|
214227
|
-
if (isWordElement2(
|
|
214228
|
-
paragraphs.push({ start:
|
|
214384
|
+
if (isWordElement2(open2, "p") && open2.start < fragment3.byteStart && event.end >= fragment3.byteEnd) {
|
|
214385
|
+
paragraphs.push({ start: open2.start, end: event.end });
|
|
214229
214386
|
}
|
|
214230
214387
|
}
|
|
214231
214388
|
});
|
|
@@ -214294,20 +214451,20 @@ function pairMoveRangeMarkers(positions) {
|
|
|
214294
214451
|
...positions.ends.map((range) => ({ kind: "end", range }))
|
|
214295
214452
|
].sort((left, right) => left.range.start - right.range.start);
|
|
214296
214453
|
const pairs = [];
|
|
214297
|
-
let
|
|
214454
|
+
let open2 = null;
|
|
214298
214455
|
for (const event of events) {
|
|
214299
214456
|
if (event.kind === "start") {
|
|
214300
|
-
if (
|
|
214457
|
+
if (open2)
|
|
214301
214458
|
return { ok: false, pairs };
|
|
214302
|
-
|
|
214459
|
+
open2 = event.range;
|
|
214303
214460
|
continue;
|
|
214304
214461
|
}
|
|
214305
|
-
if (!
|
|
214462
|
+
if (!open2 || event.range.start < open2.end)
|
|
214306
214463
|
return { ok: false, pairs };
|
|
214307
|
-
pairs.push({ startMarker:
|
|
214308
|
-
|
|
214464
|
+
pairs.push({ startMarker: open2, endMarker: event.range });
|
|
214465
|
+
open2 = null;
|
|
214309
214466
|
}
|
|
214310
|
-
return { ok:
|
|
214467
|
+
return { ok: open2 == null, pairs };
|
|
214311
214468
|
}
|
|
214312
214469
|
function isWordElement2(element, localName2) {
|
|
214313
214470
|
return element?.tag.namespaceUri === NS_W && element.tag.localName === localName2;
|
|
@@ -215667,10 +215824,10 @@ function requiredCellParagraphReplacement(partXml, paragraphStart) {
|
|
|
215667
215824
|
return null;
|
|
215668
215825
|
const firstChild = directChildren2(ranges, paragraph)[0];
|
|
215669
215826
|
const properties = firstChild?.tag.namespaceUri === NS_W && firstChild.tag.localName === "pPr" ? firstChild : undefined;
|
|
215670
|
-
const
|
|
215827
|
+
const open2 = partXml.slice(paragraph.start, paragraph.openEnd);
|
|
215671
215828
|
if (paragraph.tag.isSelfClosing)
|
|
215672
|
-
return
|
|
215673
|
-
return
|
|
215829
|
+
return open2;
|
|
215830
|
+
return open2 + (properties ? partXml.slice(paragraph.openEnd, properties.end) : "") + partXml.slice(paragraph.closeStart, paragraph.end);
|
|
215674
215831
|
}
|
|
215675
215832
|
function directChildren2(ranges, parent) {
|
|
215676
215833
|
const children = [];
|
|
@@ -216062,8 +216219,8 @@ function prepareTrackedBlockXmlReplacement(input) {
|
|
|
216062
216219
|
return null;
|
|
216063
216220
|
wordIds.push(...runs.wordIds);
|
|
216064
216221
|
nextId += runs.wordIds.length;
|
|
216065
|
-
const
|
|
216066
|
-
result += xml.slice(cursor, paragraph.start) +
|
|
216222
|
+
const open2 = xml.slice(paragraph.start, paragraph.openEnd).replace(/\/>$/, ">");
|
|
216223
|
+
result += xml.slice(cursor, paragraph.start) + open2 + (properties ? xml.slice(paragraph.openEnd, properties.start) : "") + nextProperties + runs.xml + `</${paragraph.tag.name}>`;
|
|
216067
216224
|
cursor = paragraph.end;
|
|
216068
216225
|
}
|
|
216069
216226
|
return xml.slice(cursor).trim() ? null : result + xml.slice(cursor);
|
|
@@ -216829,11 +216986,11 @@ function paragraphPropertiesChildrenXml(pPrXml) {
|
|
|
216829
216986
|
const selfClosing = /^<[\w.-]+:pPr\b[^>]*\/>$/.exec(trimmed);
|
|
216830
216987
|
if (selfClosing)
|
|
216831
216988
|
return "";
|
|
216832
|
-
const
|
|
216989
|
+
const open2 = /^<[\w.-]+:pPr\b[^>]*>/.exec(trimmed)?.[0];
|
|
216833
216990
|
const close = /<\/[\w.-]+:pPr>\s*$/.exec(trimmed)?.[0];
|
|
216834
|
-
if (!
|
|
216991
|
+
if (!open2 || !close)
|
|
216835
216992
|
return "";
|
|
216836
|
-
return trimmed.slice(
|
|
216993
|
+
return trimmed.slice(open2.length, trimmed.length - close.length);
|
|
216837
216994
|
}
|
|
216838
216995
|
function paragraphPropertiesNamespaceAttrs(pPrXml) {
|
|
216839
216996
|
if (!pPrXml)
|
|
@@ -234808,9 +234965,9 @@ function prepareTrackedTableCellTextReplacement(input) {
|
|
|
234808
234965
|
});
|
|
234809
234966
|
if (!runs)
|
|
234810
234967
|
return null;
|
|
234811
|
-
const
|
|
234968
|
+
const open2 = input.beforeXml.slice(first.range.start, first.range.openEnd).replace(/\/>$/, ">");
|
|
234812
234969
|
return {
|
|
234813
|
-
xml: input.beforeXml.slice(0, first.range.start) +
|
|
234970
|
+
xml: input.beforeXml.slice(0, first.range.start) + open2 + first.properties + runs.xml + `</${first.range.tag.name}>` + input.beforeXml.slice(first.range.end),
|
|
234814
234971
|
wordIds: runs.wordIds
|
|
234815
234972
|
};
|
|
234816
234973
|
}
|
|
@@ -235681,13 +235838,13 @@ function validateCellTextPayload(text) {
|
|
|
235681
235838
|
return null;
|
|
235682
235839
|
}
|
|
235683
235840
|
function blankClonedRowCells(xml) {
|
|
235684
|
-
return xml.replace(/(<([\w.-]+):tc\b[^>]*>)([\s\S]*?)(<\/\2:tc>)/g, (_full,
|
|
235841
|
+
return xml.replace(/(<([\w.-]+):tc\b[^>]*>)([\s\S]*?)(<\/\2:tc>)/g, (_full, open2, prefix, body, close) => {
|
|
235685
235842
|
const tcPr = body.match(new RegExp(`<${prefix}:tcPr\\b(?:[^>]*/>|[\\s\\S]*?</${prefix}:tcPr>)`))?.[0] ?? "";
|
|
235686
235843
|
const paraId = body.match(/(?:w14|w):paraId="([^"]*)"/)?.[1] ?? "";
|
|
235687
235844
|
const pPr = composePPrWithMarkRPr(extractFirstPPr(body), extractFirstRunRPr(body));
|
|
235688
235845
|
const attrs = paraId ? ` w14:paraId="${paraId}"` : "";
|
|
235689
235846
|
const paragraph = pPr ? `<${prefix}:p${attrs}>${pPr}</${prefix}:p>` : `<${prefix}:p${attrs}/>`;
|
|
235690
|
-
return `${
|
|
235847
|
+
return `${open2}${tcPr}${paragraph}${close}`;
|
|
235691
235848
|
});
|
|
235692
235849
|
}
|
|
235693
235850
|
function stripClonedTableHeaderProperty(xml) {
|
|
@@ -236748,10 +236905,10 @@ function readParaIdFromParagraphXml(xml, namespaceBindings) {
|
|
|
236748
236905
|
return null;
|
|
236749
236906
|
return parsed.ranges.find((range) => range.start === 0 && range.tag.localName === "p" && range.tag.namespaceUri === "http://schemas.openxmlformats.org/wordprocessingml/2006/main")?.tag.attributes.find((attribute) => attribute.localName === "paraId" && attribute.namespaceUri === "http://schemas.microsoft.com/office/word/2010/wordml")?.value ?? null;
|
|
236750
236907
|
}
|
|
236751
|
-
const
|
|
236752
|
-
if (!
|
|
236908
|
+
const open2 = /^<[\w.-]+:p\b([^>]*)>/i.exec(xml);
|
|
236909
|
+
if (!open2)
|
|
236753
236910
|
return null;
|
|
236754
|
-
return /(?:[\w.-]+:)?paraId=(["'])([^"']+)\1/.exec(
|
|
236911
|
+
return /(?:[\w.-]+:)?paraId=(["'])([^"']+)\1/.exec(open2[1] ?? "")?.[2] ?? null;
|
|
236755
236912
|
}
|
|
236756
236913
|
function trailingXmlAfterLastParagraph(xml, namespaceBindings) {
|
|
236757
236914
|
const spans = findElementSpans(xml, "p", namespaceBindings);
|
|
@@ -237713,9 +237870,9 @@ function parseParagraphEnvelope(anchorXml) {
|
|
|
237713
237870
|
const selfClosing = /^<([\w.-]+:)?p\b[^>]*\/>\s*$/.exec(anchorXml);
|
|
237714
237871
|
if (selfClosing) {
|
|
237715
237872
|
const prefix2 = selfClosing[1] ?? "";
|
|
237716
|
-
const
|
|
237873
|
+
const open2 = anchorXml.trim().replace(/\s*\/>$/, ">");
|
|
237717
237874
|
return {
|
|
237718
|
-
open,
|
|
237875
|
+
open: open2,
|
|
237719
237876
|
pPr: "",
|
|
237720
237877
|
close: `</${prefix2}p>`,
|
|
237721
237878
|
innerStart: anchorXml.length,
|
|
@@ -238065,10 +238222,10 @@ function rewritePastePPrNumbering(pPrXml, numbering) {
|
|
|
238065
238222
|
if (/<w:numPr\b/.test(pPrXml)) {
|
|
238066
238223
|
return pPrXml.replace(/<w:numPr\b(?:[^>]*\/>|[^>]*>[\s\S]*?<\/w:numPr\s*>)/, numPr);
|
|
238067
238224
|
}
|
|
238068
|
-
const
|
|
238069
|
-
if (!
|
|
238225
|
+
const open2 = /^<w:pPr\b[^>]*>/.exec(pPrXml)?.[0];
|
|
238226
|
+
if (!open2)
|
|
238070
238227
|
return pPrXml;
|
|
238071
|
-
let at =
|
|
238228
|
+
let at = open2.length;
|
|
238072
238229
|
while (true) {
|
|
238073
238230
|
const earlyChild = /^\s*<w:(pStyle|keepNext|keepLines|pageBreakBefore|framePr|widowControl)\b(?:[^>]*\/>|[^>]*>[\s\S]*?<\/w:\1\s*>)/.exec(pPrXml.slice(at));
|
|
238074
238231
|
if (!earlyChild)
|
|
@@ -239375,11 +239532,11 @@ function wrapCarrierWithAncestors(carrierXml, ancestors, paragraphXml) {
|
|
|
239375
239532
|
let wrapped = carrierXml;
|
|
239376
239533
|
for (let index = ancestors.length - 1;index >= 0; index -= 1) {
|
|
239377
239534
|
const ancestor = ancestors[index];
|
|
239378
|
-
const
|
|
239535
|
+
const open2 = /^<([\w.-]+):[\w.-]+\b[^>]*>/.exec(ancestor.rawXml);
|
|
239379
239536
|
const close = /<\/[\w.-]+:[\w.-]+>$/.exec(ancestor.rawXml);
|
|
239380
|
-
if (!
|
|
239537
|
+
if (!open2 || !close)
|
|
239381
239538
|
return null;
|
|
239382
|
-
const selfContainedOpen = makeOpeningTagNamespaceSelfContained(
|
|
239539
|
+
const selfContainedOpen = makeOpeningTagNamespaceSelfContained(open2[0], open2[1], paragraphXml);
|
|
239383
239540
|
wrapped = `${selfContainedOpen}${wrapped}${close[0]}`;
|
|
239384
239541
|
}
|
|
239385
239542
|
return wrapped;
|
|
@@ -239424,12 +239581,12 @@ function insertCarrierAtImageOffset(input) {
|
|
|
239424
239581
|
xml: `<${selfClosedParagraph[1]}${selfClosedParagraph[2]}>` + input.carrierXml + `</${selfClosedParagraph[1]}>`
|
|
239425
239582
|
};
|
|
239426
239583
|
}
|
|
239427
|
-
const
|
|
239584
|
+
const open2 = /^<[\w.-]+:p\b[^>]*>/.exec(input.paragraphXml);
|
|
239428
239585
|
const close = /<\/[\w.-]+:p>$/.exec(input.paragraphXml);
|
|
239429
|
-
if (!
|
|
239586
|
+
if (!open2 || !close) {
|
|
239430
239587
|
return { ok: false, reason: "image-move-destination-unsupported" };
|
|
239431
239588
|
}
|
|
239432
|
-
const inner = input.paragraphXml.slice(
|
|
239589
|
+
const inner = input.paragraphXml.slice(open2[0].length, close.index);
|
|
239433
239590
|
const pPrXml = matchLeadingElement(inner, "pPr");
|
|
239434
239591
|
const sliced = sliceParagraphContentAt({
|
|
239435
239592
|
paragraphXml: input.paragraphXml,
|
|
@@ -239443,7 +239600,7 @@ function insertCarrierAtImageOffset(input) {
|
|
|
239443
239600
|
}
|
|
239444
239601
|
return {
|
|
239445
239602
|
ok: true,
|
|
239446
|
-
xml: `${
|
|
239603
|
+
xml: `${open2[0]}${pPrXml}${sliced.head}${input.carrierXml}${sliced.tail}${close[0]}`
|
|
239447
239604
|
};
|
|
239448
239605
|
}
|
|
239449
239606
|
function validateImageBinary(binary, format) {
|
|
@@ -243214,14 +243371,14 @@ function xmlOffsetsForBytePositions(bytes, positions) {
|
|
|
243214
243371
|
return offsets;
|
|
243215
243372
|
}
|
|
243216
243373
|
function injectTrackedParagraphMarkIntoXml(paragraphXml, stamp, kind) {
|
|
243217
|
-
const
|
|
243374
|
+
const open2 = matchParagraphOpenTag(paragraphXml);
|
|
243218
243375
|
const close = paragraphXml.match(/<\/([\w.-]+):p>\s*$/)?.[0];
|
|
243219
|
-
if (!
|
|
243376
|
+
if (!open2 || !close)
|
|
243220
243377
|
return paragraphXml;
|
|
243221
|
-
const inner = paragraphXml.slice(
|
|
243378
|
+
const inner = paragraphXml.slice(open2.length, paragraphXml.length - close.length);
|
|
243222
243379
|
const pPr = matchLeadingElement(inner, "pPr");
|
|
243223
243380
|
const nextPPr = renderTrackedParagraphMarkProperties(pPr, stamp, kind);
|
|
243224
|
-
return
|
|
243381
|
+
return open2 + nextPPr + inner.slice(pPr.length) + close;
|
|
243225
243382
|
}
|
|
243226
243383
|
function injectTrackedMarkIntoLastParagraph(xml, stamp, kind) {
|
|
243227
243384
|
const matches = [...xml.matchAll(/<w:p\b[^>]*>[\s\S]*?<\/w:p>/g)];
|
|
@@ -251957,6 +252114,193 @@ var init_large_streaming_save = __esm(() => {
|
|
|
251957
252114
|
STREAM_PUSH_CHUNK = 64 * 1024;
|
|
251958
252115
|
});
|
|
251959
252116
|
|
|
252117
|
+
// ../../../v2/editor-core/dist/export/docx-package-sanitizer.js
|
|
252118
|
+
function partKey(uri) {
|
|
252119
|
+
const normalized = normalizePartUri(uri);
|
|
252120
|
+
try {
|
|
252121
|
+
return decodeURIComponent(normalized).normalize("NFC").toLowerCase();
|
|
252122
|
+
} catch {
|
|
252123
|
+
return normalized.normalize("NFC").toLowerCase();
|
|
252124
|
+
}
|
|
252125
|
+
}
|
|
252126
|
+
function relationshipOwnerUri(relsUri) {
|
|
252127
|
+
if (partKey(relsUri) === "/_rels/.rels")
|
|
252128
|
+
return "/";
|
|
252129
|
+
const match = /^(.*)\/_rels\/([^/]+)\.rels$/i.exec(relsUri);
|
|
252130
|
+
return match ? `${match[1]}/${match[2]}` : null;
|
|
252131
|
+
}
|
|
252132
|
+
function targetPartUris(ownerUri, target) {
|
|
252133
|
+
const path6 = target.split(/[?#]/, 1)[0] ?? "";
|
|
252134
|
+
if (!path6)
|
|
252135
|
+
return [];
|
|
252136
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(path6) || path6.startsWith("//"))
|
|
252137
|
+
return [];
|
|
252138
|
+
const normalized = path6.replace(/\\/g, "/");
|
|
252139
|
+
const resolved = resolveTargetUri(ownerUri, normalized, "Internal");
|
|
252140
|
+
try {
|
|
252141
|
+
return [resolved, resolveTargetUri(ownerUri, decodeURIComponent(normalized), "Internal")];
|
|
252142
|
+
} catch {
|
|
252143
|
+
return [resolved];
|
|
252144
|
+
}
|
|
252145
|
+
}
|
|
252146
|
+
function ownerReferencesRelationship(ownerBytes, id) {
|
|
252147
|
+
if (!ownerBytes)
|
|
252148
|
+
return false;
|
|
252149
|
+
const xml = TEXT_DECODER6.decode(ownerBytes);
|
|
252150
|
+
const collected = collectXmlElementRanges(xml);
|
|
252151
|
+
if (collected.errors.length) {
|
|
252152
|
+
return xml.includes(`="${id}"`) || xml.includes(`='${id}'`);
|
|
252153
|
+
}
|
|
252154
|
+
return collected.ranges.some((range) => range.tag.attributes.some((attribute) => attribute.namespaceUri === OFFICE_RELATIONSHIPS_NS && attribute.value === id));
|
|
252155
|
+
}
|
|
252156
|
+
function sanitizeRelationships(relsUri, bytes, finalPartKeys, ownerBytes) {
|
|
252157
|
+
const ownerUri = relationshipOwnerUri(relsUri);
|
|
252158
|
+
if (!ownerUri)
|
|
252159
|
+
return bytes;
|
|
252160
|
+
const xml = TEXT_DECODER6.decode(bytes);
|
|
252161
|
+
const collected = collectXmlElementRanges(xml);
|
|
252162
|
+
if (collected.errors.length)
|
|
252163
|
+
return bytes;
|
|
252164
|
+
const removals = collected.ranges.filter((range) => {
|
|
252165
|
+
if (range.tag.namespaceUri !== RELATIONSHIPS_NS2 || range.tag.localName !== "Relationship")
|
|
252166
|
+
return false;
|
|
252167
|
+
if (readXmlAttribute(range.tag, "", "Type")?.value !== STYLES_WITH_EFFECTS_RELATIONSHIP_NS)
|
|
252168
|
+
return false;
|
|
252169
|
+
if (readXmlAttribute(range.tag, "", "TargetMode")?.value === "External")
|
|
252170
|
+
return false;
|
|
252171
|
+
const target = readXmlAttribute(range.tag, "", "Target")?.value;
|
|
252172
|
+
if (!target)
|
|
252173
|
+
return false;
|
|
252174
|
+
const resolved = targetPartUris(ownerUri, target);
|
|
252175
|
+
if (!resolved.length || resolved.some((uri) => finalPartKeys.has(partKey(uri))))
|
|
252176
|
+
return false;
|
|
252177
|
+
const id = readXmlAttribute(range.tag, "", "Id")?.value;
|
|
252178
|
+
return !id || !ownerReferencesRelationship(ownerBytes, id);
|
|
252179
|
+
});
|
|
252180
|
+
if (!removals.length)
|
|
252181
|
+
return bytes;
|
|
252182
|
+
let sanitized = xml;
|
|
252183
|
+
for (const range of removals.reverse()) {
|
|
252184
|
+
sanitized = sanitized.slice(0, range.start) + sanitized.slice(range.end);
|
|
252185
|
+
}
|
|
252186
|
+
return TEXT_ENCODER.encode(sanitized);
|
|
252187
|
+
}
|
|
252188
|
+
function insertRootAttribute(tag, attribute) {
|
|
252189
|
+
return tag.replace(/\/?>(?=$)/, (ending) => ` ${attribute}${ending}`);
|
|
252190
|
+
}
|
|
252191
|
+
function sanitizeWordNamespaces(bytes) {
|
|
252192
|
+
const xml = TEXT_DECODER6.decode(bytes);
|
|
252193
|
+
const used = new Set;
|
|
252194
|
+
for (const match of xml.matchAll(/(?:<\/?|\s)(w14|w15|w16):[\w.-]+(?=[\s=/>])/g)) {
|
|
252195
|
+
used.add(match[1]);
|
|
252196
|
+
}
|
|
252197
|
+
if (!used.size)
|
|
252198
|
+
return bytes;
|
|
252199
|
+
const root = /<(?![!?/])(?:[A-Za-z_][\w.-]*:)?[A-Za-z_][\w.-]*(?:"[^"]*"|'[^']*'|[^>"'])*>/g.exec(xml);
|
|
252200
|
+
if (!root)
|
|
252201
|
+
return bytes;
|
|
252202
|
+
let tag = root[0];
|
|
252203
|
+
const declarations = new Map;
|
|
252204
|
+
for (const match of tag.matchAll(/\sxmlns:([A-Za-z_][\w.-]*)\s*=\s*(["'])(.*?)\2/g)) {
|
|
252205
|
+
declarations.set(match[1], match[3]);
|
|
252206
|
+
}
|
|
252207
|
+
const missing = [...used].filter((prefix) => !declarations.has(prefix));
|
|
252208
|
+
if (!missing.length || !collectXmlElementRanges(xml).errors.length)
|
|
252209
|
+
return bytes;
|
|
252210
|
+
for (const prefix of missing) {
|
|
252211
|
+
tag = insertRootAttribute(tag, `xmlns:${prefix}="${OFFICE_WORD_NAMESPACES[prefix]}"`);
|
|
252212
|
+
}
|
|
252213
|
+
const ignorableAttribute = [...tag.matchAll(/\s([A-Za-z_][\w.-]*):Ignorable\s*=\s*(["'])(.*?)\2/g)].find((match) => declarations.get(match[1]) === MC_NS2);
|
|
252214
|
+
let mcPrefix = ignorableAttribute?.[1] ?? [...declarations].find(([, uri]) => uri === MC_NS2)?.[0];
|
|
252215
|
+
if (!mcPrefix) {
|
|
252216
|
+
mcPrefix = "mc";
|
|
252217
|
+
for (let suffix = 1;declarations.has(mcPrefix); suffix++)
|
|
252218
|
+
mcPrefix = `mc${suffix}`;
|
|
252219
|
+
tag = insertRootAttribute(tag, `xmlns:${mcPrefix}="${MC_NS2}"`);
|
|
252220
|
+
}
|
|
252221
|
+
const ignorable = new RegExp(`\\s${mcPrefix}:Ignorable\\s*=\\s*(["'])(.*?)\\1`).exec(tag);
|
|
252222
|
+
if (ignorable) {
|
|
252223
|
+
const prefixes = ignorable[2].trim().split(/\s+/).filter(Boolean);
|
|
252224
|
+
const next = [...new Set([...prefixes, ...missing])];
|
|
252225
|
+
if (next.length !== prefixes.length) {
|
|
252226
|
+
tag = tag.replace(ignorable[0], ` ${mcPrefix}:Ignorable="${next.join(" ")}"`);
|
|
252227
|
+
}
|
|
252228
|
+
} else {
|
|
252229
|
+
tag = insertRootAttribute(tag, `${mcPrefix}:Ignorable="${missing.join(" ")}"`);
|
|
252230
|
+
}
|
|
252231
|
+
return TEXT_ENCODER.encode(xml.slice(0, root.index) + tag + xml.slice(root.index + root[0].length));
|
|
252232
|
+
}
|
|
252233
|
+
function removeOrphanContentTypeOverrides(bytes, removedRels) {
|
|
252234
|
+
if (!removedRels.size)
|
|
252235
|
+
return bytes;
|
|
252236
|
+
const xml = TEXT_DECODER6.decode(bytes);
|
|
252237
|
+
const collected = collectXmlElementRanges(xml);
|
|
252238
|
+
if (collected.errors.length)
|
|
252239
|
+
return bytes;
|
|
252240
|
+
const removals = collected.ranges.filter((range) => range.tag.namespaceUri === CONTENT_TYPES_NS5 && range.tag.localName === "Override" && removedRels.has(partKey(readXmlAttribute(range.tag, "", "PartName")?.value ?? "")));
|
|
252241
|
+
if (!removals.length)
|
|
252242
|
+
return bytes;
|
|
252243
|
+
let sanitized = xml;
|
|
252244
|
+
for (const range of removals.reverse()) {
|
|
252245
|
+
sanitized = sanitized.slice(0, range.start) + sanitized.slice(range.end);
|
|
252246
|
+
}
|
|
252247
|
+
return TEXT_ENCODER.encode(sanitized);
|
|
252248
|
+
}
|
|
252249
|
+
function sanitizeDocxPackageEntries(entries, options = {}) {
|
|
252250
|
+
const allKeys = new Set([...entries.keys()].map(partKey));
|
|
252251
|
+
const bytesByKey = new Map([...entries].map(([uri, bytes]) => [partKey(uri), bytes]));
|
|
252252
|
+
const typesBytes = bytesByKey.get("/[content_types].xml");
|
|
252253
|
+
const contentTypes = typesBytes ? parseContentTypes(TEXT_DECODER6.decode(typesBytes)) : null;
|
|
252254
|
+
const removedRels = new Set;
|
|
252255
|
+
const changes = new Map;
|
|
252256
|
+
for (const uri of entries.keys()) {
|
|
252257
|
+
if (!uri.toLowerCase().endsWith(".rels"))
|
|
252258
|
+
continue;
|
|
252259
|
+
const owner = relationshipOwnerUri(uri);
|
|
252260
|
+
if (owner && owner !== "/" && !allKeys.has(partKey(owner)) && (options.removeOrphan?.(uri, owner) ?? true)) {
|
|
252261
|
+
removedRels.add(partKey(uri));
|
|
252262
|
+
changes.set(uri, null);
|
|
252263
|
+
}
|
|
252264
|
+
}
|
|
252265
|
+
const finalKeys = new Set([...allKeys].filter((key2) => !removedRels.has(key2)));
|
|
252266
|
+
for (const [uri, bytes] of entries) {
|
|
252267
|
+
if (!bytes || changes.has(uri))
|
|
252268
|
+
continue;
|
|
252269
|
+
const owner = relationshipOwnerUri(uri);
|
|
252270
|
+
const ownerBytes = owner ? bytesByKey.get(partKey(owner)) : undefined;
|
|
252271
|
+
if (owner && owner !== "/" && !ownerBytes)
|
|
252272
|
+
continue;
|
|
252273
|
+
const contentType = contentTypes && !contentTypes.parseError ? resolveContentType(contentTypes, uri) : null;
|
|
252274
|
+
const isWordXml = /^\/word\/.+\.xml$/i.test(uri) || uri.toLowerCase().endsWith(".xml") && contentType?.includes("wordprocessingml.") === true;
|
|
252275
|
+
const sanitized = options.sanitizePart?.(uri) === false ? bytes : sanitizeDocxPartForExport(uri, bytes, finalKeys, ownerBytes, isWordXml);
|
|
252276
|
+
const finalBytes = partKey(uri) === "/[content_types].xml" ? removeOrphanContentTypeOverrides(sanitized, removedRels) : sanitized;
|
|
252277
|
+
if (finalBytes !== bytes)
|
|
252278
|
+
changes.set(uri, finalBytes);
|
|
252279
|
+
}
|
|
252280
|
+
return changes;
|
|
252281
|
+
}
|
|
252282
|
+
function sanitizeDocxPartForExport(partUri, bytes, finalPartUris, ownerBytes, isWordXml = /^\/word\/.+\.xml$/i.test(partUri)) {
|
|
252283
|
+
if (partUri.toLowerCase().endsWith(".rels")) {
|
|
252284
|
+
return sanitizeRelationships(partUri, bytes, new Set([...finalPartUris].map(partKey)), ownerBytes);
|
|
252285
|
+
}
|
|
252286
|
+
if (isWordXml) {
|
|
252287
|
+
return sanitizeWordNamespaces(bytes);
|
|
252288
|
+
}
|
|
252289
|
+
return bytes;
|
|
252290
|
+
}
|
|
252291
|
+
var TEXT_DECODER6, TEXT_ENCODER, 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_NS2 = "http://schemas.openxmlformats.org/markup-compatibility/2006", OFFICE_WORD_NAMESPACES;
|
|
252292
|
+
var init_docx_package_sanitizer = __esm(() => {
|
|
252293
|
+
init_xml_sax();
|
|
252294
|
+
init_content_types();
|
|
252295
|
+
TEXT_DECODER6 = new TextDecoder;
|
|
252296
|
+
TEXT_ENCODER = new TextEncoder;
|
|
252297
|
+
OFFICE_WORD_NAMESPACES = {
|
|
252298
|
+
w14: "http://schemas.microsoft.com/office/word/2010/wordml",
|
|
252299
|
+
w15: "http://schemas.microsoft.com/office/word/2012/wordml",
|
|
252300
|
+
w16: "http://schemas.microsoft.com/office/word/2018/wordml"
|
|
252301
|
+
};
|
|
252302
|
+
});
|
|
252303
|
+
|
|
251960
252304
|
// ../../../v2/editor-core/dist/document/transactions/comment-export-normalization.js
|
|
251961
252305
|
function normalizeCommentPackageForSave(state) {
|
|
251962
252306
|
const overrides = new Map;
|
|
@@ -252747,8 +253091,8 @@ function removeRedundantXmlNamespaceDeclarations(xml, inheritedNamespaces) {
|
|
|
252747
253091
|
ancestors.pop();
|
|
252748
253092
|
const inherited = ancestors[ancestors.length - 1]?.namespaceBindings ?? inheritedNamespaces;
|
|
252749
253093
|
if (inherited) {
|
|
252750
|
-
const
|
|
252751
|
-
for (const attribute of
|
|
253094
|
+
const open2 = xml.slice(range.start, range.openEnd);
|
|
253095
|
+
for (const attribute of open2.matchAll(/\s+([A-Za-z_][\w.:-]*)\s*=\s*(?:"[^"]*"|'[^']*')/g)) {
|
|
252752
253096
|
const name = attribute[1];
|
|
252753
253097
|
if (name !== "xmlns" && !name.startsWith("xmlns:"))
|
|
252754
253098
|
continue;
|
|
@@ -253906,6 +254250,15 @@ function serializeSDDocumentSessionInternalPackageWithDiagnostics(session, optio
|
|
|
253906
254250
|
continue;
|
|
253907
254251
|
finalizeEntry(partUri, bytes);
|
|
253908
254252
|
}
|
|
254253
|
+
if (!exactPackageSave) {
|
|
254254
|
+
const changes = sanitizeDocxPackageEntries(new Map(Object.entries(entries).map(([entryPath, bytes]) => [`/${entryPath}`, bytes])));
|
|
254255
|
+
for (const [partUri, bytes] of changes) {
|
|
254256
|
+
if (bytes === null)
|
|
254257
|
+
delete entries[partUri.slice(1)];
|
|
254258
|
+
else
|
|
254259
|
+
entries[partUri.slice(1)] = bytes;
|
|
254260
|
+
}
|
|
254261
|
+
}
|
|
253909
254262
|
const compressionLevel = options.compressionLevel ?? DEFAULT_SAVE_COMPRESSION_LEVEL;
|
|
253910
254263
|
const zippable = {};
|
|
253911
254264
|
for (const [entryPath, bytes] of Object.entries(entries)) {
|
|
@@ -254069,6 +254422,7 @@ function planSourceBackedStreamingSave(internal, mainPartUri, options) {
|
|
|
254069
254422
|
};
|
|
254070
254423
|
const entries = [];
|
|
254071
254424
|
const emitted = new Set;
|
|
254425
|
+
const changedPartUris = new Set;
|
|
254072
254426
|
const pushBytes = (partUri, bytes, originalMethod, normalizeChangedBytes = true) => {
|
|
254073
254427
|
const entryName = partUri.startsWith("/") ? partUri.slice(1) : partUri;
|
|
254074
254428
|
entries.push({
|
|
@@ -254080,6 +254434,8 @@ function planSourceBackedStreamingSave(internal, mainPartUri, options) {
|
|
|
254080
254434
|
compression: compressionFor(entryName, originalMethod)
|
|
254081
254435
|
});
|
|
254082
254436
|
emitted.add(partUri);
|
|
254437
|
+
if (normalizeChangedBytes)
|
|
254438
|
+
changedPartUris.add(partUri);
|
|
254083
254439
|
};
|
|
254084
254440
|
const pushStream = (partUri, entryName, chunks, originalMethod) => {
|
|
254085
254441
|
entries.push({
|
|
@@ -254154,6 +254510,26 @@ function planSourceBackedStreamingSave(internal, mainPartUri, options) {
|
|
|
254154
254510
|
continue;
|
|
254155
254511
|
pushBytes(partUri, bytes);
|
|
254156
254512
|
}
|
|
254513
|
+
const inspectable = new Map(entries.map((entry) => {
|
|
254514
|
+
const partUri = `/${entry.name}`;
|
|
254515
|
+
const contentType = state.parts.get(partUri)?.descriptor.contentType ?? "";
|
|
254516
|
+
const needsInspection = entry.name.endsWith(".rels") || entry.name === "[Content_Types].xml" || /^word\/.+\.xml$/i.test(entry.name) || contentType.includes("wordprocessingml.");
|
|
254517
|
+
const bytes = entry.source.kind === "bytes" ? entry.source.bytes : needsInspection && (partUri !== mainPartUri || hasResidentMain) ? state.packageBytes.get(partUri) ?? (partUri !== mainPartUri ? inventory.readPayload?.(entry.name) : undefined) : undefined;
|
|
254518
|
+
return [partUri, bytes];
|
|
254519
|
+
}));
|
|
254520
|
+
const sourcePartUris = new Set(inventory.entries.filter((entry) => !entry.isDirectory).map((entry) => partUriForEntry(entry.name)));
|
|
254521
|
+
const changes = sanitizeDocxPackageEntries(inspectable, {
|
|
254522
|
+
sanitizePart: (partUri) => changedPartUris.has(partUri),
|
|
254523
|
+
removeOrphan: (relsUri, ownerUri) => changedPartUris.has(relsUri) || sourcePartUris.has(ownerUri)
|
|
254524
|
+
});
|
|
254525
|
+
for (let index = entries.length - 1;index >= 0; index--) {
|
|
254526
|
+
const entry = entries[index];
|
|
254527
|
+
const change = changes.get(`/${entry.name}`);
|
|
254528
|
+
if (change === null)
|
|
254529
|
+
entries.splice(index, 1);
|
|
254530
|
+
else if (change)
|
|
254531
|
+
entry.source = { kind: "bytes", bytes: change };
|
|
254532
|
+
}
|
|
254157
254533
|
return {
|
|
254158
254534
|
entries,
|
|
254159
254535
|
warnings: [...commentWarnings, ...trackedChangesProjection.warnings],
|
|
@@ -254517,10 +254893,10 @@ function applySDDocumentSessionInternalProjection(session, input) {
|
|
|
254517
254893
|
});
|
|
254518
254894
|
}
|
|
254519
254895
|
function validateSDDocumentSessionInternalPackageBytes(bytes) {
|
|
254520
|
-
const
|
|
254521
|
-
const invariants = evaluatePackageInvariants(
|
|
254896
|
+
const open2 = openPackage(bytes);
|
|
254897
|
+
const invariants = evaluatePackageInvariants(open2);
|
|
254522
254898
|
const diagnostics = [];
|
|
254523
|
-
for (const diagnostic of
|
|
254899
|
+
for (const diagnostic of open2.pkg.diagnostics) {
|
|
254524
254900
|
diagnostics.push({
|
|
254525
254901
|
code: diagnostic.code,
|
|
254526
254902
|
severity: diagnostic.severity === "error" ? "hard" : "soft",
|
|
@@ -257362,13 +257738,13 @@ async function openSDDocumentSession(options) {
|
|
|
257362
257738
|
} else {
|
|
257363
257739
|
waitForSourceCompleteResult().then(() => settleCoverageRangeWaiters(currentCoverageSnapshot(), true)).catch(() => settleCoverageRangeWaiters(currentCoverageSnapshot(), true));
|
|
257364
257740
|
}
|
|
257365
|
-
return await new Promise((
|
|
257741
|
+
return await new Promise((resolve2) => {
|
|
257366
257742
|
const signal = request.signal;
|
|
257367
257743
|
let onAbort = null;
|
|
257368
257744
|
const waiter = {
|
|
257369
257745
|
startOrdinal,
|
|
257370
257746
|
endOrdinalExclusive,
|
|
257371
|
-
resolve,
|
|
257747
|
+
resolve: resolve2,
|
|
257372
257748
|
cleanup: () => {
|
|
257373
257749
|
if (signal && onAbort)
|
|
257374
257750
|
signal.removeEventListener("abort", onAbort);
|
|
@@ -257379,7 +257755,7 @@ async function openSDDocumentSession(options) {
|
|
|
257379
257755
|
return;
|
|
257380
257756
|
coverageRangeWaiters.delete(waiter);
|
|
257381
257757
|
waiter.cleanup();
|
|
257382
|
-
|
|
257758
|
+
resolve2({
|
|
257383
257759
|
status: "cancelled",
|
|
257384
257760
|
reason: "aborted",
|
|
257385
257761
|
snapshot: currentCoverageSnapshot()
|
|
@@ -257744,6 +258120,7 @@ var init_sd_document_session = __esm(() => {
|
|
|
257744
258120
|
init_source_coverage_chunks();
|
|
257745
258121
|
init_section_source_cache();
|
|
257746
258122
|
init_large_streaming_save();
|
|
258123
|
+
init_docx_package_sanitizer();
|
|
257747
258124
|
init_relationships();
|
|
257748
258125
|
init_esm2();
|
|
257749
258126
|
init_source_backed_main_overlay();
|
|
@@ -258527,17 +258904,17 @@ function prepareTrackedFieldMarkerRun(input) {
|
|
|
258527
258904
|
const namespaceBindings = new Map(input.namespaceBindings).set(prefix, NS_W);
|
|
258528
258905
|
const targetBindings = Object.fromEntries(namespaceBindings);
|
|
258529
258906
|
const properties = (xml, value) => value.properties ? copyParagraphPropertyChild(xml, value.properties, targetBindings) : "";
|
|
258530
|
-
const
|
|
258907
|
+
const open2 = `<${prefix}:pPr>`;
|
|
258531
258908
|
const close = `</${prefix}:pPr>`;
|
|
258532
258909
|
const prepared = prepareTrackedParagraphProperties({
|
|
258533
|
-
beforeXml:
|
|
258534
|
-
afterXml:
|
|
258910
|
+
beforeXml: open2 + properties(input.beforeXml, before) + close,
|
|
258911
|
+
afterXml: open2 + properties(input.afterXml, after) + close,
|
|
258535
258912
|
namespaceBindings,
|
|
258536
258913
|
stamp: input.stamp
|
|
258537
258914
|
});
|
|
258538
258915
|
if (!prepared)
|
|
258539
258916
|
return null;
|
|
258540
|
-
const nextProperties = prepared.xml.slice(
|
|
258917
|
+
const nextProperties = prepared.xml.slice(open2.length, -close.length);
|
|
258541
258918
|
return {
|
|
258542
258919
|
xml: input.beforeXml.slice(0, before.run.openEnd) + nextProperties + input.beforeXml.slice(before.properties?.end ?? before.run.openEnd),
|
|
258543
258920
|
wordIds: prepared.wordIds
|
|
@@ -258728,17 +259105,17 @@ function prepareTrackedTocReplacement(input) {
|
|
|
258728
259105
|
xml2 += deletedTerminal.xml;
|
|
258729
259106
|
}
|
|
258730
259107
|
if (after.length > retainedCount) {
|
|
258731
|
-
const
|
|
259108
|
+
const open2 = "<w:sdt><w:sdtContent>";
|
|
258732
259109
|
const close = "</w:sdtContent></w:sdt>";
|
|
258733
259110
|
const continuation = prepareTrackedTocInsertion({
|
|
258734
|
-
xml:
|
|
259111
|
+
xml: open2 + after.slice(retainedCount).map((paragraph) => paragraph.xml).join("") + close,
|
|
258735
259112
|
namespaceBindings: input.namespaceBindings,
|
|
258736
259113
|
stamp: stamp()
|
|
258737
259114
|
});
|
|
258738
259115
|
if (!continuation)
|
|
258739
259116
|
return null;
|
|
258740
259117
|
wordIds.push(...continuation.wordIds);
|
|
258741
|
-
xml2 += continuation.xml.slice(
|
|
259118
|
+
xml2 += continuation.xml.slice(open2.length, -close.length);
|
|
258742
259119
|
}
|
|
258743
259120
|
return { xml: xml2, wordIds };
|
|
258744
259121
|
}
|
|
@@ -258758,17 +259135,17 @@ function prepareTrackedTocReplacement(input) {
|
|
|
258758
259135
|
return null;
|
|
258759
259136
|
let xml = original.open + properties.xml + deleted + inserted + `</${original.range.tag.name}>`;
|
|
258760
259137
|
if (after.length > 1) {
|
|
258761
|
-
const
|
|
259138
|
+
const open2 = "<w:sdt><w:sdtContent>";
|
|
258762
259139
|
const close = "</w:sdtContent></w:sdt>";
|
|
258763
259140
|
const continuation = prepareTrackedTocInsertion({
|
|
258764
|
-
xml:
|
|
259141
|
+
xml: open2 + after.slice(1).map((paragraph) => paragraph.xml).join("") + close,
|
|
258765
259142
|
namespaceBindings: input.namespaceBindings,
|
|
258766
259143
|
stamp: stamp()
|
|
258767
259144
|
});
|
|
258768
259145
|
if (!continuation)
|
|
258769
259146
|
return null;
|
|
258770
259147
|
wordIds.push(...continuation.wordIds);
|
|
258771
|
-
xml += continuation.xml.slice(
|
|
259148
|
+
xml += continuation.xml.slice(open2.length, -close.length);
|
|
258772
259149
|
}
|
|
258773
259150
|
return { xml, wordIds };
|
|
258774
259151
|
}
|
|
@@ -259052,6 +259429,7 @@ var init_selection_text_replacement_preflight = __esm(() => {
|
|
|
259052
259429
|
// ../../../v2/editor-core/dist/document/sd-document-session-internal.js
|
|
259053
259430
|
var init_sd_document_session_internal = __esm(() => {
|
|
259054
259431
|
init_core_properties();
|
|
259432
|
+
init_docx_package_sanitizer();
|
|
259055
259433
|
init_scalar_properties();
|
|
259056
259434
|
init_sd_document_session();
|
|
259057
259435
|
init_review_projection_overlay();
|
|
@@ -288033,12 +288411,12 @@ function parseContainerXml(xml, localName2) {
|
|
|
288033
288411
|
const closeMatch = new RegExp(`</([\\w.-]+):${escapeForRegex(localName2)}>\\s*$`).exec(normalized);
|
|
288034
288412
|
if (!openMatch || !closeMatch || openMatch[1] !== closeMatch[1])
|
|
288035
288413
|
return null;
|
|
288036
|
-
const
|
|
288414
|
+
const open2 = openMatch[0];
|
|
288037
288415
|
const close = closeMatch[0];
|
|
288038
288416
|
return {
|
|
288039
288417
|
prefix: openMatch[1],
|
|
288040
|
-
open,
|
|
288041
|
-
inner: normalized.slice(
|
|
288418
|
+
open: open2,
|
|
288419
|
+
inner: normalized.slice(open2.length, normalized.length - close.length),
|
|
288042
288420
|
close
|
|
288043
288421
|
};
|
|
288044
288422
|
}
|
|
@@ -288881,11 +289259,11 @@ function bindRelationshipNamespaceOnSectPr(sectPrXml) {
|
|
|
288881
289259
|
return sectPrXml.replace(/^<w:sectPr\b/, `<w:sectPr xmlns:r="${RELATIONSHIPS_NAMESPACE}"`);
|
|
288882
289260
|
}
|
|
288883
289261
|
function bindRelationshipNamespaceOnReferences(sectPrXml) {
|
|
288884
|
-
return sectPrXml.replace(/<w:(headerReference|footerReference)\b/g, (
|
|
288885
|
-
const tagEnd = findXmlTagEnd3(sectPrXml, offset +
|
|
289262
|
+
return sectPrXml.replace(/<w:(headerReference|footerReference)\b/g, (open2, _kind, offset) => {
|
|
289263
|
+
const tagEnd = findXmlTagEnd3(sectPrXml, offset + open2.length);
|
|
288886
289264
|
if (tagEnd < 0 || readNamespaceDeclaration(sectPrXml.slice(offset, tagEnd), "r") != null)
|
|
288887
|
-
return
|
|
288888
|
-
return `${
|
|
289265
|
+
return open2;
|
|
289266
|
+
return `${open2} xmlns:r="${RELATIONSHIPS_NAMESPACE}"`;
|
|
288889
289267
|
});
|
|
288890
289268
|
}
|
|
288891
289269
|
function applyPreparedSectionXmlMutations(documentBytes, mutations) {
|
|
@@ -289263,9 +289641,9 @@ function expandSectPr(sectPrXml) {
|
|
|
289263
289641
|
const openEnd = findXmlTagEnd3(sectPrXml, openMatch.index + openMatch[0].length);
|
|
289264
289642
|
if (openEnd < 0)
|
|
289265
289643
|
return sectPrXml;
|
|
289266
|
-
const
|
|
289267
|
-
const expandedOpen =
|
|
289268
|
-
if (expandedOpen ===
|
|
289644
|
+
const open2 = sectPrXml.slice(openMatch.index, openEnd);
|
|
289645
|
+
const expandedOpen = open2.replace(/\/\s*>$/, ">");
|
|
289646
|
+
if (expandedOpen === open2)
|
|
289269
289647
|
return sectPrXml;
|
|
289270
289648
|
return `${sectPrXml.slice(0, openMatch.index)}${expandedOpen}</w:sectPr>${sectPrXml.slice(openEnd)}`;
|
|
289271
289649
|
}
|
|
@@ -290025,8 +290403,8 @@ function insertXmlAtCollapsedTopLevelWrapperBoundary(paragraphXml, offset, inser
|
|
|
290025
290403
|
function injectParagraphPrefixXml(paragraphXml, insertionXml) {
|
|
290026
290404
|
const selfClosing = paragraphXml.match(/^<w:p\b([^>]*)\/>$/s);
|
|
290027
290405
|
if (selfClosing) {
|
|
290028
|
-
const
|
|
290029
|
-
return { ok: true, xml: `${
|
|
290406
|
+
const open2 = `<w:p${selfClosing[1]}>`;
|
|
290407
|
+
return { ok: true, xml: `${open2}${insertionXml}</w:p>`, insertionStart: open2.length };
|
|
290030
290408
|
}
|
|
290031
290409
|
const pPrClose = paragraphXml.indexOf("</w:pPr>");
|
|
290032
290410
|
const insertionStart = pPrClose >= 0 ? pPrClose + "</w:pPr>".length : paragraphXml.indexOf(">") + 1;
|
|
@@ -293020,12 +293398,12 @@ function readDocumentTocParagraphTemplates(paragraphs) {
|
|
|
293020
293398
|
const level = readTocParagraphLevel(paragraph2.rawXml);
|
|
293021
293399
|
if (level == null)
|
|
293022
293400
|
continue;
|
|
293023
|
-
const
|
|
293401
|
+
const open2 = buildTocParagraphTemplateOpen(paragraph2.rawXml);
|
|
293024
293402
|
if (!templates.byLevel.has(level))
|
|
293025
|
-
templates.byLevel.set(level,
|
|
293403
|
+
templates.byLevel.set(level, open2);
|
|
293026
293404
|
const entryText = readTocParagraphTemplateText(paragraph2.rawXml);
|
|
293027
293405
|
if (entryText && !templates.byText.has(entryText))
|
|
293028
|
-
templates.byText.set(entryText,
|
|
293406
|
+
templates.byText.set(entryText, open2);
|
|
293029
293407
|
}
|
|
293030
293408
|
return templates;
|
|
293031
293409
|
}
|
|
@@ -293538,12 +293916,12 @@ function buildTocParagraphTemplatesFromParagraphXml(xml) {
|
|
|
293538
293916
|
const level = readTocParagraphLevel(paragraphXml);
|
|
293539
293917
|
if (level == null)
|
|
293540
293918
|
continue;
|
|
293541
|
-
const
|
|
293919
|
+
const open2 = buildTocParagraphTemplateOpen(paragraphXml);
|
|
293542
293920
|
if (!templates.byLevel.has(level))
|
|
293543
|
-
templates.byLevel.set(level,
|
|
293921
|
+
templates.byLevel.set(level, open2);
|
|
293544
293922
|
const entryText = readTocParagraphTemplateText(paragraphXml);
|
|
293545
293923
|
if (entryText && !templates.byText.has(entryText))
|
|
293546
|
-
templates.byText.set(entryText,
|
|
293924
|
+
templates.byText.set(entryText, open2);
|
|
293547
293925
|
}
|
|
293548
293926
|
return templates;
|
|
293549
293927
|
}
|
|
@@ -294509,7 +294887,7 @@ class V2AnchoredMetadataAdapter {
|
|
|
294509
294887
|
throw metadataWrapRejectError(wrapped.reason);
|
|
294510
294888
|
if (wrapped.contained) {
|
|
294511
294889
|
const ids = countBodyControlIds(documentXml);
|
|
294512
|
-
if (!ids || wrapped.parentId !== null && ids.get(wrapped.parentId) !== 1 || buildStructuralBoundaryMap(
|
|
294890
|
+
if (!ids || wrapped.parentId !== null && ids.get(wrapped.parentId) !== 1 || buildStructuralBoundaryMap(TEXT_ENCODER2.encode(documentXml)).byBlockId(segment.blockId)?.blockSdtPath.length) {
|
|
294513
294891
|
throw metadataWrapRejectError("text-range-in-sdt");
|
|
294514
294892
|
}
|
|
294515
294893
|
}
|
|
@@ -294941,7 +295319,7 @@ function countBodyControlIds(documentXml) {
|
|
|
294941
295319
|
function contiguousAnchorPrefix(documentXml, matches) {
|
|
294942
295320
|
if (matches.length <= 1)
|
|
294943
295321
|
return [...matches];
|
|
294944
|
-
const map3 = buildStructuralBoundaryMap(
|
|
295322
|
+
const map3 = buildStructuralBoundaryMap(TEXT_ENCODER2.encode(documentXml));
|
|
294945
295323
|
const first = map3.byBlockId(matches[0].blockId);
|
|
294946
295324
|
if (!first)
|
|
294947
295325
|
return [matches[0]];
|
|
@@ -295030,7 +295408,7 @@ function resolveMultiSegmentTarget(documentXml, target) {
|
|
|
295030
295408
|
function validateContiguousStructuralRun(documentXml, blockIds) {
|
|
295031
295409
|
if (blockIds.length <= 1)
|
|
295032
295410
|
return null;
|
|
295033
|
-
const map3 = buildStructuralBoundaryMap(
|
|
295411
|
+
const map3 = buildStructuralBoundaryMap(TEXT_ENCODER2.encode(documentXml));
|
|
295034
295412
|
const contexts = blockIds.map((blockId) => map3.byBlockId(blockId));
|
|
295035
295413
|
const first = contexts[0];
|
|
295036
295414
|
if (!first) {
|
|
@@ -295142,8 +295520,8 @@ function wrapTextRangeWithMetadataSdt(paragraphXml, start, end, id, sdtId, known
|
|
|
295142
295520
|
if (!wrapped.ok)
|
|
295143
295521
|
return wrapped;
|
|
295144
295522
|
const nextContent = parseContainerXml(wrapped.xml, "p").inner;
|
|
295145
|
-
const
|
|
295146
|
-
const contentStart =
|
|
295523
|
+
const open2 = /<w:sdtContent\b[^>]*>/.exec(parent.xml);
|
|
295524
|
+
const contentStart = open2.index + open2[0].length;
|
|
295147
295525
|
let nextParent = replaceRange(parent.xml, contentStart, contentStart + content.length, nextContent);
|
|
295148
295526
|
if (metadataParent && /<w:text\b/.test(pr)) {
|
|
295149
295527
|
let nextPr = pr.replace(/<w:text\b[^>]*(?:\/>|>[\s\S]*?<\/w:text>)/, "<w:richText/>");
|
|
@@ -295220,24 +295598,24 @@ function findParagraphContaining(documentXml, index) {
|
|
|
295220
295598
|
const paraRe = /<w:p\b[^>]*>[\s\S]*?<\/w:p>/g;
|
|
295221
295599
|
for (let match = paraRe.exec(documentXml);match; match = paraRe.exec(documentXml)) {
|
|
295222
295600
|
if (match.index <= index && paraRe.lastIndex >= index) {
|
|
295223
|
-
const
|
|
295601
|
+
const open2 = /^<w:p\b[^>]*>/.exec(match[0])?.[0] ?? "";
|
|
295224
295602
|
return {
|
|
295225
295603
|
start: match.index,
|
|
295226
295604
|
end: paraRe.lastIndex,
|
|
295227
295605
|
xml: match[0],
|
|
295228
|
-
blockId: attrValue(
|
|
295606
|
+
blockId: attrValue(open2, "paraId") ?? "unknown"
|
|
295229
295607
|
};
|
|
295230
295608
|
}
|
|
295231
295609
|
}
|
|
295232
295610
|
return null;
|
|
295233
295611
|
}
|
|
295234
295612
|
function unwrapSdt(sdtXml) {
|
|
295235
|
-
const
|
|
295236
|
-
if (!
|
|
295613
|
+
const open2 = /<w:sdtContent\b[^>]*>/.exec(sdtXml);
|
|
295614
|
+
if (!open2)
|
|
295237
295615
|
return null;
|
|
295238
|
-
if (/\/\s*>$/.test(
|
|
295616
|
+
if (/\/\s*>$/.test(open2[0]))
|
|
295239
295617
|
return "";
|
|
295240
|
-
const contentStart =
|
|
295618
|
+
const contentStart = open2.index + open2[0].length;
|
|
295241
295619
|
const tokenRe = /<w:sdtContent\b[^>]*>|<\/w:sdtContent>/g;
|
|
295242
295620
|
tokenRe.lastIndex = contentStart;
|
|
295243
295621
|
let depth = 0;
|
|
@@ -295280,7 +295658,7 @@ function overlaps(left, right) {
|
|
|
295280
295658
|
return false;
|
|
295281
295659
|
return leftSegments.some((leftSegment) => rightSegments.some((rightSegment) => leftSegment.blockId === rightSegment.blockId && rangesStrictlyOverlap(leftSegment.start, leftSegment.end, rightSegment.start, rightSegment.end)));
|
|
295282
295660
|
}
|
|
295283
|
-
var
|
|
295661
|
+
var TEXT_ENCODER2, 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;
|
|
295284
295662
|
var init_adapter3 = __esm(() => {
|
|
295285
295663
|
init_src3();
|
|
295286
295664
|
init_sd_document_session_internal();
|
|
@@ -295290,7 +295668,7 @@ var init_adapter3 = __esm(() => {
|
|
|
295290
295668
|
init_adapter2();
|
|
295291
295669
|
init_shared();
|
|
295292
295670
|
init_xml();
|
|
295293
|
-
|
|
295671
|
+
TEXT_ENCODER2 = new TextEncoder;
|
|
295294
295672
|
});
|
|
295295
295673
|
|
|
295296
295674
|
// ../../../v2/document-api-v2-adapter/dist/core/cooperative-slices.js
|
|
@@ -295622,20 +296000,20 @@ function normalizeStylesWordprocessingMlQNames(xml, options = {}) {
|
|
|
295622
296000
|
const replacements = [];
|
|
295623
296001
|
for (const range of parsed.ranges) {
|
|
295624
296002
|
const sourceOpen = xml.slice(range.start, range.openEnd);
|
|
295625
|
-
let
|
|
296003
|
+
let open2 = sourceOpen;
|
|
295626
296004
|
if (WORDPROCESSINGML_NAMESPACES2.has(range.tag.namespaceUri)) {
|
|
295627
|
-
|
|
296005
|
+
open2 = replaceXmlQName(open2, range.tag.name, `${prefix}:${range.tag.localName}`, "element");
|
|
295628
296006
|
}
|
|
295629
296007
|
for (const attribute of range.tag.attributes) {
|
|
295630
296008
|
if (!WORDPROCESSINGML_NAMESPACES2.has(attribute.namespaceUri))
|
|
295631
296009
|
continue;
|
|
295632
|
-
|
|
296010
|
+
open2 = replaceXmlQName(open2, attribute.name, `${prefix}:${attribute.localName}`, "attribute");
|
|
295633
296011
|
}
|
|
295634
296012
|
if (range === root && needsBinding) {
|
|
295635
|
-
|
|
296013
|
+
open2 = addNamespaceBinding(open2, prefix, namespaceUri);
|
|
295636
296014
|
}
|
|
295637
|
-
if (
|
|
295638
|
-
replacements.push({ start: range.start, end: range.openEnd, value:
|
|
296015
|
+
if (open2 !== sourceOpen) {
|
|
296016
|
+
replacements.push({ start: range.start, end: range.openEnd, value: open2 });
|
|
295639
296017
|
}
|
|
295640
296018
|
if (range.tag.isSelfClosing || !WORDPROCESSINGML_NAMESPACES2.has(range.tag.namespaceUri))
|
|
295641
296019
|
continue;
|
|
@@ -298329,7 +298707,7 @@ function applyParagraphAlignment(bodyXml, prefix, alignment) {
|
|
|
298329
298707
|
return child;
|
|
298330
298708
|
const paragraph2 = parseContainerXml(child.xml, "p");
|
|
298331
298709
|
const inner = paragraph2 ? paragraph2.inner : "";
|
|
298332
|
-
const
|
|
298710
|
+
const open2 = paragraph2 ? paragraph2.open : child.xml.replace(/\/>$/, ">");
|
|
298333
298711
|
const close = paragraph2 ? paragraph2.close : `</${prefix}:p>`;
|
|
298334
298712
|
const paragraphChildren = parseTopLevelChildren(inner);
|
|
298335
298713
|
const pPrXml = getChild(paragraphChildren, "pPr")?.xml ?? null;
|
|
@@ -298339,7 +298717,7 @@ function applyParagraphAlignment(bodyXml, prefix, alignment) {
|
|
|
298339
298717
|
changed = true;
|
|
298340
298718
|
return {
|
|
298341
298719
|
...child,
|
|
298342
|
-
xml: `${
|
|
298720
|
+
xml: `${open2}${serializeTopLevelChildren(nextParagraphChildren)}${close}`
|
|
298343
298721
|
};
|
|
298344
298722
|
});
|
|
298345
298723
|
return changed ? serializeTopLevelChildren(next) : bodyXml;
|
|
@@ -320721,10 +321099,10 @@ function resolveAll(constructs2, events, context) {
|
|
|
320721
321099
|
const called = [];
|
|
320722
321100
|
let index = -1;
|
|
320723
321101
|
while (++index < constructs2.length) {
|
|
320724
|
-
const
|
|
320725
|
-
if (
|
|
320726
|
-
events =
|
|
320727
|
-
called.push(
|
|
321102
|
+
const resolve2 = constructs2[index].resolveAll;
|
|
321103
|
+
if (resolve2 && !called.includes(resolve2)) {
|
|
321104
|
+
events = resolve2(events, context);
|
|
321105
|
+
called.push(resolve2);
|
|
320728
321106
|
}
|
|
320729
321107
|
}
|
|
320730
321108
|
return events;
|
|
@@ -320733,7 +321111,7 @@ function resolveAll(constructs2, events, context) {
|
|
|
320733
321111
|
// ../../../v2/node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/dev/lib/attention.js
|
|
320734
321112
|
function resolveAllAttention(events, context) {
|
|
320735
321113
|
let index = -1;
|
|
320736
|
-
let
|
|
321114
|
+
let open2;
|
|
320737
321115
|
let group;
|
|
320738
321116
|
let text;
|
|
320739
321117
|
let openingSequence;
|
|
@@ -320743,21 +321121,21 @@ function resolveAllAttention(events, context) {
|
|
|
320743
321121
|
let offset;
|
|
320744
321122
|
while (++index < events.length) {
|
|
320745
321123
|
if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) {
|
|
320746
|
-
|
|
320747
|
-
while (
|
|
320748
|
-
if (events[
|
|
320749
|
-
if ((events[
|
|
321124
|
+
open2 = index;
|
|
321125
|
+
while (open2--) {
|
|
321126
|
+
if (events[open2][0] === "exit" && events[open2][1].type === "attentionSequence" && events[open2][1]._open && context.sliceSerialize(events[open2][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {
|
|
321127
|
+
if ((events[open2][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open2][1].end.offset - events[open2][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) {
|
|
320750
321128
|
continue;
|
|
320751
321129
|
}
|
|
320752
|
-
use = events[
|
|
320753
|
-
const start = { ...events[
|
|
321130
|
+
use = events[open2][1].end.offset - events[open2][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
|
|
321131
|
+
const start = { ...events[open2][1].end };
|
|
320754
321132
|
const end = { ...events[index][1].start };
|
|
320755
321133
|
movePoint(start, -use);
|
|
320756
321134
|
movePoint(end, use);
|
|
320757
321135
|
openingSequence = {
|
|
320758
321136
|
type: use > 1 ? types9.strongSequence : types9.emphasisSequence,
|
|
320759
321137
|
start,
|
|
320760
|
-
end: { ...events[
|
|
321138
|
+
end: { ...events[open2][1].end }
|
|
320761
321139
|
};
|
|
320762
321140
|
closingSequence = {
|
|
320763
321141
|
type: use > 1 ? types9.strongSequence : types9.emphasisSequence,
|
|
@@ -320766,7 +321144,7 @@ function resolveAllAttention(events, context) {
|
|
|
320766
321144
|
};
|
|
320767
321145
|
text = {
|
|
320768
321146
|
type: use > 1 ? types9.strongText : types9.emphasisText,
|
|
320769
|
-
start: { ...events[
|
|
321147
|
+
start: { ...events[open2][1].end },
|
|
320770
321148
|
end: { ...events[index][1].start }
|
|
320771
321149
|
};
|
|
320772
321150
|
group = {
|
|
@@ -320774,13 +321152,13 @@ function resolveAllAttention(events, context) {
|
|
|
320774
321152
|
start: { ...openingSequence.start },
|
|
320775
321153
|
end: { ...closingSequence.end }
|
|
320776
321154
|
};
|
|
320777
|
-
events[
|
|
321155
|
+
events[open2][1].end = { ...openingSequence.start };
|
|
320778
321156
|
events[index][1].start = { ...closingSequence.end };
|
|
320779
321157
|
nextEvents = [];
|
|
320780
|
-
if (events[
|
|
321158
|
+
if (events[open2][1].end.offset - events[open2][1].start.offset) {
|
|
320781
321159
|
nextEvents = push(nextEvents, [
|
|
320782
|
-
["enter", events[
|
|
320783
|
-
["exit", events[
|
|
321160
|
+
["enter", events[open2][1], context],
|
|
321161
|
+
["exit", events[open2][1], context]
|
|
320784
321162
|
]);
|
|
320785
321163
|
}
|
|
320786
321164
|
nextEvents = push(nextEvents, [
|
|
@@ -320790,7 +321168,7 @@ function resolveAllAttention(events, context) {
|
|
|
320790
321168
|
["enter", text, context]
|
|
320791
321169
|
]);
|
|
320792
321170
|
ok2(context.parser.constructs.insideSpan.null, "expected `insideSpan` to be populated");
|
|
320793
|
-
nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(
|
|
321171
|
+
nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open2 + 1, index), context));
|
|
320794
321172
|
nextEvents = push(nextEvents, [
|
|
320795
321173
|
["exit", text, context],
|
|
320796
321174
|
["enter", closingSequence, context],
|
|
@@ -320806,8 +321184,8 @@ function resolveAllAttention(events, context) {
|
|
|
320806
321184
|
} else {
|
|
320807
321185
|
offset = 0;
|
|
320808
321186
|
}
|
|
320809
|
-
splice(events,
|
|
320810
|
-
index =
|
|
321187
|
+
splice(events, open2 - 1, index - open2 + 3, nextEvents);
|
|
321188
|
+
index = open2 + nextEvents.length - offset - 2;
|
|
320811
321189
|
break;
|
|
320812
321190
|
}
|
|
320813
321191
|
}
|
|
@@ -320841,10 +321219,10 @@ function tokenizeAttention(effects2, ok3) {
|
|
|
320841
321219
|
const token = effects2.exit("attentionSequence");
|
|
320842
321220
|
const after = classifyCharacter(code);
|
|
320843
321221
|
ok2(attentionMarkers, "expected `attentionMarkers` to be populated");
|
|
320844
|
-
const
|
|
321222
|
+
const open2 = !after || after === constants2.characterGroupPunctuation && before || attentionMarkers.includes(code);
|
|
320845
321223
|
const close = !before || before === constants2.characterGroupPunctuation && after || attentionMarkers.includes(previous);
|
|
320846
|
-
token._open = Boolean(marker === codes.asterisk ?
|
|
320847
|
-
token._close = Boolean(marker === codes.asterisk ? close : close && (after || !
|
|
321224
|
+
token._open = Boolean(marker === codes.asterisk ? open2 : open2 && (before || !close));
|
|
321225
|
+
token._close = Boolean(marker === codes.asterisk ? close : close && (after || !open2));
|
|
320848
321226
|
return ok3(code);
|
|
320849
321227
|
}
|
|
320850
321228
|
}
|
|
@@ -320877,9 +321255,9 @@ function tokenizeAutolink(effects2, ok3, nok) {
|
|
|
320877
321255
|
effects2.consume(code);
|
|
320878
321256
|
effects2.exit(types9.autolinkMarker);
|
|
320879
321257
|
effects2.enter(types9.autolinkProtocol);
|
|
320880
|
-
return
|
|
321258
|
+
return open2;
|
|
320881
321259
|
}
|
|
320882
|
-
function
|
|
321260
|
+
function open2(code) {
|
|
320883
321261
|
if (asciiAlpha(code)) {
|
|
320884
321262
|
effects2.consume(code);
|
|
320885
321263
|
return schemeOrEmailAtext;
|
|
@@ -321098,9 +321476,9 @@ function tokenizeCharacterReference(effects2, ok3, nok) {
|
|
|
321098
321476
|
effects2.enter(types9.characterReferenceMarker);
|
|
321099
321477
|
effects2.consume(code);
|
|
321100
321478
|
effects2.exit(types9.characterReferenceMarker);
|
|
321101
|
-
return
|
|
321479
|
+
return open2;
|
|
321102
321480
|
}
|
|
321103
|
-
function
|
|
321481
|
+
function open2(code) {
|
|
321104
321482
|
if (code === codes.numberSign) {
|
|
321105
321483
|
effects2.enter(types9.characterReferenceMarkerNumeric);
|
|
321106
321484
|
effects2.consume(code);
|
|
@@ -322412,9 +322790,9 @@ function tokenizeHtmlFlow(effects2, ok3, nok) {
|
|
|
322412
322790
|
effects2.enter(types9.htmlFlow);
|
|
322413
322791
|
effects2.enter(types9.htmlFlowData);
|
|
322414
322792
|
effects2.consume(code);
|
|
322415
|
-
return
|
|
322793
|
+
return open2;
|
|
322416
322794
|
}
|
|
322417
|
-
function
|
|
322795
|
+
function open2(code) {
|
|
322418
322796
|
if (code === codes.exclamationMark) {
|
|
322419
322797
|
effects2.consume(code);
|
|
322420
322798
|
return declarationOpen;
|
|
@@ -322783,9 +323161,9 @@ function tokenizeHtmlText(effects2, ok3, nok) {
|
|
|
322783
323161
|
effects2.enter(types9.htmlText);
|
|
322784
323162
|
effects2.enter(types9.htmlTextData);
|
|
322785
323163
|
effects2.consume(code);
|
|
322786
|
-
return
|
|
323164
|
+
return open2;
|
|
322787
323165
|
}
|
|
322788
|
-
function
|
|
323166
|
+
function open2(code) {
|
|
322789
323167
|
if (code === codes.exclamationMark) {
|
|
322790
323168
|
effects2.consume(code);
|
|
322791
323169
|
return declarationOpen;
|
|
@@ -323107,12 +323485,12 @@ function resolveToLabelEnd(events, context) {
|
|
|
323107
323485
|
let index = events.length;
|
|
323108
323486
|
let offset = 0;
|
|
323109
323487
|
let token;
|
|
323110
|
-
let
|
|
323488
|
+
let open2;
|
|
323111
323489
|
let close;
|
|
323112
323490
|
let media;
|
|
323113
323491
|
while (index--) {
|
|
323114
323492
|
token = events[index][1];
|
|
323115
|
-
if (
|
|
323493
|
+
if (open2) {
|
|
323116
323494
|
if (token.type === types9.link || token.type === types9.labelLink && token._inactive) {
|
|
323117
323495
|
break;
|
|
323118
323496
|
}
|
|
@@ -323121,7 +323499,7 @@ function resolveToLabelEnd(events, context) {
|
|
|
323121
323499
|
}
|
|
323122
323500
|
} else if (close) {
|
|
323123
323501
|
if (events[index][0] === "enter" && (token.type === types9.labelImage || token.type === types9.labelLink) && !token._balanced) {
|
|
323124
|
-
|
|
323502
|
+
open2 = index;
|
|
323125
323503
|
if (token.type !== types9.labelLink) {
|
|
323126
323504
|
offset = 2;
|
|
323127
323505
|
break;
|
|
@@ -323131,31 +323509,31 @@ function resolveToLabelEnd(events, context) {
|
|
|
323131
323509
|
close = index;
|
|
323132
323510
|
}
|
|
323133
323511
|
}
|
|
323134
|
-
ok2(
|
|
323512
|
+
ok2(open2 !== undefined, "`open` is supposed to be found");
|
|
323135
323513
|
ok2(close !== undefined, "`close` is supposed to be found");
|
|
323136
323514
|
const group = {
|
|
323137
|
-
type: events[
|
|
323138
|
-
start: { ...events[
|
|
323515
|
+
type: events[open2][1].type === types9.labelLink ? types9.link : types9.image,
|
|
323516
|
+
start: { ...events[open2][1].start },
|
|
323139
323517
|
end: { ...events[events.length - 1][1].end }
|
|
323140
323518
|
};
|
|
323141
323519
|
const label = {
|
|
323142
323520
|
type: types9.label,
|
|
323143
|
-
start: { ...events[
|
|
323521
|
+
start: { ...events[open2][1].start },
|
|
323144
323522
|
end: { ...events[close][1].end }
|
|
323145
323523
|
};
|
|
323146
323524
|
const text = {
|
|
323147
323525
|
type: types9.labelText,
|
|
323148
|
-
start: { ...events[
|
|
323526
|
+
start: { ...events[open2 + offset + 2][1].end },
|
|
323149
323527
|
end: { ...events[close - 2][1].start }
|
|
323150
323528
|
};
|
|
323151
323529
|
media = [
|
|
323152
323530
|
["enter", group, context],
|
|
323153
323531
|
["enter", label, context]
|
|
323154
323532
|
];
|
|
323155
|
-
media = push(media, events.slice(
|
|
323533
|
+
media = push(media, events.slice(open2 + 1, open2 + offset + 3));
|
|
323156
323534
|
media = push(media, [["enter", text, context]]);
|
|
323157
323535
|
ok2(context.parser.constructs.insideSpan.null, "expected `insideSpan.null` to be populated");
|
|
323158
|
-
media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(
|
|
323536
|
+
media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open2 + offset + 4, close - 3), context));
|
|
323159
323537
|
media = push(media, [
|
|
323160
323538
|
["exit", text, context],
|
|
323161
323539
|
events[close - 2],
|
|
@@ -323164,7 +323542,7 @@ function resolveToLabelEnd(events, context) {
|
|
|
323164
323542
|
]);
|
|
323165
323543
|
media = push(media, events.slice(close + 1));
|
|
323166
323544
|
media = push(media, [["exit", group, context]]);
|
|
323167
|
-
splice(events,
|
|
323545
|
+
splice(events, open2, events.length, media);
|
|
323168
323546
|
return events;
|
|
323169
323547
|
}
|
|
323170
323548
|
function tokenizeLabelEnd(effects2, ok3, nok) {
|
|
@@ -323327,9 +323705,9 @@ function tokenizeLabelStartImage(effects2, ok3, nok) {
|
|
|
323327
323705
|
effects2.enter(types9.labelImageMarker);
|
|
323328
323706
|
effects2.consume(code);
|
|
323329
323707
|
effects2.exit(types9.labelImageMarker);
|
|
323330
|
-
return
|
|
323708
|
+
return open2;
|
|
323331
323709
|
}
|
|
323332
|
-
function
|
|
323710
|
+
function open2(code) {
|
|
323333
323711
|
if (code === codes.leftSquareBracket) {
|
|
323334
323712
|
effects2.enter(types9.labelMarker);
|
|
323335
323713
|
effects2.consume(code);
|
|
@@ -325464,8 +325842,8 @@ function compiler(options) {
|
|
|
325464
325842
|
return length;
|
|
325465
325843
|
}
|
|
325466
325844
|
function opener(create, and) {
|
|
325467
|
-
return
|
|
325468
|
-
function
|
|
325845
|
+
return open2;
|
|
325846
|
+
function open2(token) {
|
|
325469
325847
|
enter.call(this, create(token), token);
|
|
325470
325848
|
if (and)
|
|
325471
325849
|
and.call(this, token);
|
|
@@ -325498,15 +325876,15 @@ function compiler(options) {
|
|
|
325498
325876
|
function exit2(token, onExitError) {
|
|
325499
325877
|
const node4 = this.stack.pop();
|
|
325500
325878
|
ok2(node4, "expected `node`");
|
|
325501
|
-
const
|
|
325502
|
-
if (!
|
|
325879
|
+
const open2 = this.tokenStack.pop();
|
|
325880
|
+
if (!open2) {
|
|
325503
325881
|
throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({ start: token.start, end: token.end }) + "): it’s not open");
|
|
325504
|
-
} else if (
|
|
325882
|
+
} else if (open2[0].type !== token.type) {
|
|
325505
325883
|
if (onExitError) {
|
|
325506
|
-
onExitError.call(this, token,
|
|
325884
|
+
onExitError.call(this, token, open2[0]);
|
|
325507
325885
|
} else {
|
|
325508
|
-
const handler =
|
|
325509
|
-
handler.call(this, token,
|
|
325886
|
+
const handler = open2[1] || defaultOnError;
|
|
325887
|
+
handler.call(this, token, open2[0]);
|
|
325510
325888
|
}
|
|
325511
325889
|
}
|
|
325512
325890
|
ok2(node4.type !== "fragment", "unexpected fragment `exit`ed");
|
|
@@ -327219,30 +327597,30 @@ function gfmStrikethrough(options) {
|
|
|
327219
327597
|
let index2 = -1;
|
|
327220
327598
|
while (++index2 < events.length) {
|
|
327221
327599
|
if (events[index2][0] === "enter" && events[index2][1].type === "strikethroughSequenceTemporary" && events[index2][1]._close) {
|
|
327222
|
-
let
|
|
327223
|
-
while (
|
|
327224
|
-
if (events[
|
|
327600
|
+
let open2 = index2;
|
|
327601
|
+
while (open2--) {
|
|
327602
|
+
if (events[open2][0] === "exit" && events[open2][1].type === "strikethroughSequenceTemporary" && events[open2][1]._open && events[index2][1].end.offset - events[index2][1].start.offset === events[open2][1].end.offset - events[open2][1].start.offset) {
|
|
327225
327603
|
events[index2][1].type = "strikethroughSequence";
|
|
327226
|
-
events[
|
|
327604
|
+
events[open2][1].type = "strikethroughSequence";
|
|
327227
327605
|
const strikethrough = {
|
|
327228
327606
|
type: "strikethrough",
|
|
327229
|
-
start: Object.assign({}, events[
|
|
327607
|
+
start: Object.assign({}, events[open2][1].start),
|
|
327230
327608
|
end: Object.assign({}, events[index2][1].end)
|
|
327231
327609
|
};
|
|
327232
327610
|
const text4 = {
|
|
327233
327611
|
type: "strikethroughText",
|
|
327234
|
-
start: Object.assign({}, events[
|
|
327612
|
+
start: Object.assign({}, events[open2][1].end),
|
|
327235
327613
|
end: Object.assign({}, events[index2][1].start)
|
|
327236
327614
|
};
|
|
327237
327615
|
const nextEvents = [
|
|
327238
327616
|
["enter", strikethrough, context],
|
|
327239
|
-
["enter", events[
|
|
327240
|
-
["exit", events[
|
|
327617
|
+
["enter", events[open2][1], context],
|
|
327618
|
+
["exit", events[open2][1], context],
|
|
327241
327619
|
["enter", text4, context]
|
|
327242
327620
|
];
|
|
327243
327621
|
const insideSpan2 = context.parser.constructs.insideSpan.null;
|
|
327244
327622
|
if (insideSpan2) {
|
|
327245
|
-
splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events.slice(
|
|
327623
|
+
splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan2, events.slice(open2 + 1, index2), context));
|
|
327246
327624
|
}
|
|
327247
327625
|
splice(nextEvents, nextEvents.length, 0, [
|
|
327248
327626
|
["exit", text4, context],
|
|
@@ -327250,8 +327628,8 @@ function gfmStrikethrough(options) {
|
|
|
327250
327628
|
["exit", events[index2][1], context],
|
|
327251
327629
|
["exit", strikethrough, context]
|
|
327252
327630
|
]);
|
|
327253
|
-
splice(events,
|
|
327254
|
-
index2 =
|
|
327631
|
+
splice(events, open2 - 1, index2 - open2 + 3, nextEvents);
|
|
327632
|
+
index2 = open2 + nextEvents.length - 2;
|
|
327255
327633
|
break;
|
|
327256
327634
|
}
|
|
327257
327635
|
}
|
|
@@ -327795,8 +328173,8 @@ function gfmTaskListItem() {
|
|
|
327795
328173
|
}
|
|
327796
328174
|
function tokenizeTasklistCheck(effects2, ok4, nok) {
|
|
327797
328175
|
const self = this;
|
|
327798
|
-
return
|
|
327799
|
-
function
|
|
328176
|
+
return open2;
|
|
328177
|
+
function open2(code2) {
|
|
327800
328178
|
ok2(code2 === codes.leftSquareBracket, "expected `[`");
|
|
327801
328179
|
if (self.previous !== codes.eof || !self._gfmTasklistFirstContentOfListItem) {
|
|
327802
328180
|
return nok(code2);
|
|
@@ -328993,9 +329371,9 @@ function splitSharedTextRun(source) {
|
|
|
328993
329371
|
}
|
|
328994
329372
|
if (content3.length <= 1)
|
|
328995
329373
|
return source;
|
|
328996
|
-
const
|
|
329374
|
+
const open2 = source.slice(root.start, root.openEnd);
|
|
328997
329375
|
const close = source.slice(root.closeStart, root.end);
|
|
328998
|
-
return content3.map((leaf) => `${
|
|
329376
|
+
return content3.map((leaf) => `${open2}${properties}${leaf}${close}`).join("");
|
|
328999
329377
|
}
|
|
329000
329378
|
var W11 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
329001
329379
|
var init_wrap_text_selection = __esm(() => {
|
|
@@ -331551,14 +331929,14 @@ function rewritePlainBody(bytes, index2, text4) {
|
|
|
331551
331929
|
return end;
|
|
331552
331930
|
if (splitExistingRevision)
|
|
331553
331931
|
return { ok: false, reason: "unsupported-context" };
|
|
331554
|
-
const
|
|
331932
|
+
const open2 = matchParagraphOpenTag(firstXml);
|
|
331555
331933
|
const close = firstXml.match(/<\/[\w.-]+:p>\s*$/)?.[0];
|
|
331556
|
-
if (!
|
|
331934
|
+
if (!open2 || !close)
|
|
331557
331935
|
return { ok: false, reason: "invalid-range" };
|
|
331558
|
-
const inner = firstXml.slice(
|
|
331936
|
+
const inner = firstXml.slice(open2.length, firstXml.length - close.length);
|
|
331559
331937
|
const properties = matchLeadingElement(inner, "pPr");
|
|
331560
331938
|
const rewritten = rewriteSDDirectParagraphText({
|
|
331561
|
-
paragraphXml:
|
|
331939
|
+
paragraphXml: open2 + properties + start.head + end.tail + close,
|
|
331562
331940
|
startOffset: 0,
|
|
331563
331941
|
endOffset: 0,
|
|
331564
331942
|
newText: text4
|
|
@@ -336804,8 +337182,8 @@ function firstRunProperties(contentXml) {
|
|
|
336804
337182
|
if (!properties)
|
|
336805
337183
|
return "";
|
|
336806
337184
|
const inheritedDeclarations = Object.entries(properties.namespaceBindings).filter(([prefix, uri]) => prefix !== "xml" && namespaces[prefix] !== uri && !properties.tag.attributes.some((attribute) => attribute.name === (prefix ? `xmlns:${prefix}` : "xmlns"))).map(([prefix, uri]) => ` xmlns${prefix ? `:${prefix}` : ""}="${xmlEscapeAttr(uri)}"`).join("");
|
|
336807
|
-
const
|
|
336808
|
-
return
|
|
337185
|
+
const open2 = contentXml.slice(properties.start, properties.openEnd).replace(/(\/?>)$/, (_match, close) => inheritedDeclarations + close);
|
|
337186
|
+
return open2 + contentXml.slice(properties.openEnd, properties.end);
|
|
336809
337187
|
}
|
|
336810
337188
|
function normalizeOoxml(content3, allocate) {
|
|
336811
337189
|
const prefixes = new Map([
|
|
@@ -337060,12 +337438,12 @@ function cloneContentControlXml(input) {
|
|
|
337060
337438
|
}
|
|
337061
337439
|
}
|
|
337062
337440
|
const replaceAttribute = (range, name, value2) => {
|
|
337063
|
-
const
|
|
337441
|
+
const open2 = input.xml.slice(range.start, range.openEnd);
|
|
337064
337442
|
const pattern = new RegExp(`(\\s${escapeRegExp14(name)}\\s*=\\s*)(["'])([\\s\\S]*?)\\2`);
|
|
337065
337443
|
edits.push({
|
|
337066
337444
|
start: range.start,
|
|
337067
337445
|
end: range.openEnd,
|
|
337068
|
-
xml:
|
|
337446
|
+
xml: open2.replace(pattern, (_match, prefix, quote) => prefix + quote + xmlEscapeAttr(value2) + quote)
|
|
337069
337447
|
});
|
|
337070
337448
|
};
|
|
337071
337449
|
let rootId;
|
|
@@ -337122,8 +337500,8 @@ function cloneContentControlXml(input) {
|
|
|
337122
337500
|
prefix += "_";
|
|
337123
337501
|
declaration = ` xmlns:${prefix}="${W145}"`;
|
|
337124
337502
|
}
|
|
337125
|
-
const
|
|
337126
|
-
edits.push({ start: range.start, end: range.openEnd, xml:
|
|
337503
|
+
const open2 = input.xml.slice(range.start, range.openEnd).replace(/(\/?>)$/, `${declaration} ${prefix}:paraId="${id}"$1`);
|
|
337504
|
+
edits.push({ start: range.start, end: range.openEnd, xml: open2 });
|
|
337127
337505
|
}
|
|
337128
337506
|
}
|
|
337129
337507
|
}
|
|
@@ -339978,7 +340356,7 @@ function buildResolvedStructuredBlocksXml(context, blocks, allocParaId) {
|
|
|
339978
340356
|
failure: { code: mapRejectionReason(compiled.reason), message: compiled.reason }
|
|
339979
340357
|
};
|
|
339980
340358
|
}
|
|
339981
|
-
const
|
|
340359
|
+
const resolve2 = (items) => items.map((block) => {
|
|
339982
340360
|
if (block.kind === "paragraph") {
|
|
339983
340361
|
if (!block.semanticStyleRole)
|
|
339984
340362
|
return block;
|
|
@@ -339988,12 +340366,12 @@ function buildResolvedStructuredBlocksXml(context, blocks, allocParaId) {
|
|
|
339988
340366
|
}
|
|
339989
340367
|
return {
|
|
339990
340368
|
...block,
|
|
339991
|
-
rows: block.rows.map((row) => row.map((cell) => ({ ...cell, blocks:
|
|
340369
|
+
rows: block.rows.map((row) => row.map((cell) => ({ ...cell, blocks: resolve2(cell.blocks) })))
|
|
339992
340370
|
};
|
|
339993
340371
|
});
|
|
339994
340372
|
return {
|
|
339995
340373
|
ok: true,
|
|
339996
|
-
contentXml: buildStructuredBlocksXml(
|
|
340374
|
+
contentXml: buildStructuredBlocksXml(resolve2(blocks), allocParaId),
|
|
339997
340375
|
perPart: compiled.value.perPart,
|
|
339998
340376
|
semanticStyleDependencies: [...roles].map((role) => ({
|
|
339999
340377
|
role,
|
|
@@ -341536,11 +341914,11 @@ function prepareTrackedCaptionPrecedingBoundary(input) {
|
|
|
341536
341914
|
const properties = ranges[1]?.tag.namespaceUri === W17 && ranges[1]?.tag.localName === "pPr" ? ranges[1] : undefined;
|
|
341537
341915
|
if (properties && ranges.some((range) => range.start > properties.start && range.end < properties.end && range.tag.namespaceUri === W17 && ["ins", "del", "moveFrom", "moveTo", "pPrChange", "rPrChange", "sectPr"].includes(range.tag.localName)))
|
|
341538
341916
|
return null;
|
|
341539
|
-
const
|
|
341917
|
+
const open2 = input.beforeXml.slice(0, paragraph4.openEnd).replace(/\/>$/, ">");
|
|
341540
341918
|
const close = `</${paragraph4.tag.name}>`;
|
|
341541
341919
|
const marked = prepareTrackedBlockXmlReplacement({
|
|
341542
341920
|
...input,
|
|
341543
|
-
beforeXml:
|
|
341921
|
+
beforeXml: open2 + (properties ? input.beforeXml.slice(properties.start, properties.end) : "") + close,
|
|
341544
341922
|
afterXml: ""
|
|
341545
341923
|
});
|
|
341546
341924
|
if (!marked)
|
|
@@ -341595,20 +341973,20 @@ function prepareTrackedCaptionParagraph(input) {
|
|
|
341595
341973
|
...input.stamp.revisionIds ? { revisionIds: input.stamp.revisionIds.slice(wordIds.length) } : {}
|
|
341596
341974
|
});
|
|
341597
341975
|
const namespaceBindings = new Map(Object.entries(before.paragraph.namespaceBindings));
|
|
341598
|
-
const
|
|
341976
|
+
const open2 = input.beforeXml.slice(0, before.paragraph.openEnd).replace(/\/>$/, ">");
|
|
341599
341977
|
const close = `</${before.paragraph.tag.name}>`;
|
|
341600
341978
|
let properties = after?.properties ?? before.properties;
|
|
341601
341979
|
if (!after) {
|
|
341602
341980
|
const mark = prepareTrackedBlockXmlReplacement({
|
|
341603
341981
|
...input,
|
|
341604
|
-
beforeXml:
|
|
341982
|
+
beforeXml: open2 + before.properties + close,
|
|
341605
341983
|
afterXml: "",
|
|
341606
341984
|
stamp: nextStamp()
|
|
341607
341985
|
});
|
|
341608
341986
|
if (!mark)
|
|
341609
341987
|
return null;
|
|
341610
341988
|
wordIds.push(...mark.wordIds);
|
|
341611
|
-
properties = mark.xml.slice(
|
|
341989
|
+
properties = mark.xml.slice(open2.length, -close.length);
|
|
341612
341990
|
}
|
|
341613
341991
|
let content3 = "";
|
|
341614
341992
|
let cursor = before.contentStart;
|
|
@@ -341668,7 +342046,7 @@ function prepareTrackedCaptionParagraph(input) {
|
|
|
341668
342046
|
properties = prepared.xml;
|
|
341669
342047
|
wordIds.push(...prepared.wordIds);
|
|
341670
342048
|
}
|
|
341671
|
-
return { xml:
|
|
342049
|
+
return { xml: open2 + properties + content3 + close, wordIds };
|
|
341672
342050
|
}
|
|
341673
342051
|
var W17 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
341674
342052
|
var init_tracked_paragraph = __esm(() => {
|
|
@@ -342185,8 +342563,8 @@ function nextCaptionFieldResult(entry, nextNumber) {
|
|
|
342185
342563
|
function replaceTextNodeValues(xml, text4) {
|
|
342186
342564
|
let replaced = false;
|
|
342187
342565
|
const nextXml = xml.replace(/<w:t\b([^>]*)>([\s\S]*?)<\/w:t>/g, (match, _attrs, _value, offset) => {
|
|
342188
|
-
const
|
|
342189
|
-
const start = offset +
|
|
342566
|
+
const open2 = match.indexOf(">") + 1;
|
|
342567
|
+
const start = offset + open2;
|
|
342190
342568
|
const end = start + _value.length;
|
|
342191
342569
|
const replacement = replaced ? "" : escapeText2(text4);
|
|
342192
342570
|
replaced = true;
|
|
@@ -343369,7 +343747,7 @@ function insertTrackedToc(context, input) {
|
|
|
343369
343747
|
tocBookmarkNames: names,
|
|
343370
343748
|
reservedParaIds: occupied
|
|
343371
343749
|
});
|
|
343372
|
-
tocXml = tocXml.replace(/<w:p\b[^>]*>/g, (
|
|
343750
|
+
tocXml = tocXml.replace(/<w:p\b[^>]*>/g, (open2) => /\sxmlns:w14\s*=/.test(open2) ? open2 : open2.replace("<w:p", '<w:p xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"'));
|
|
343373
343751
|
const tocRanges = collectXmlElementRanges(tocXml, {
|
|
343374
343752
|
fragment: true,
|
|
343375
343753
|
additionalNamespaces: Object.fromEntries(bindings)
|
|
@@ -343399,8 +343777,8 @@ function insertTrackedToc(context, input) {
|
|
|
343399
343777
|
});
|
|
343400
343778
|
for (let index2 = tocParagraphs.length - 1;index2 >= 0; index2--) {
|
|
343401
343779
|
const paragraph4 = tocParagraphs[index2];
|
|
343402
|
-
const
|
|
343403
|
-
const replaced = /\bw14:paraId="[^"]*"/.test(
|
|
343780
|
+
const open2 = tocXml.slice(paragraph4.start, paragraph4.openEnd);
|
|
343781
|
+
const replaced = /\bw14:paraId="[^"]*"/.test(open2) ? open2.replace(/\bw14:paraId="[^"]*"/, `w14:paraId="${xmlEscapeAttr(paragraphIds[index2])}"`) : open2.replace(/^<w:p\b/, `<w:p w14:paraId="${xmlEscapeAttr(paragraphIds[index2])}"`);
|
|
343404
343782
|
tocXml = tocXml.slice(0, paragraph4.start) + replaced + tocXml.slice(paragraph4.openEnd);
|
|
343405
343783
|
}
|
|
343406
343784
|
const author = readTrackedAuthor(context);
|
|
@@ -344055,12 +344433,12 @@ function prepareTrackedSectionBreak(input) {
|
|
|
344055
344433
|
const beforeParagraphXml = oldParagraph ? input.beforeXml.slice(oldParagraph.start, oldParagraph.end) : "";
|
|
344056
344434
|
const paragraphXml = input.afterXml.slice(paragraph4.start, paragraph4.end);
|
|
344057
344435
|
const prepare = (paragraphId3, revisionIds) => {
|
|
344058
|
-
let
|
|
344436
|
+
let open2 = input.afterXml.slice(paragraph4.start, paragraph4.openEnd);
|
|
344059
344437
|
for (const attribute of paragraph4.tag.attributes) {
|
|
344060
344438
|
if (attribute.namespaceUri !== WORD_2010_NS2 || attribute.localName !== "paraId")
|
|
344061
344439
|
continue;
|
|
344062
344440
|
const name = attribute.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
344063
|
-
|
|
344441
|
+
open2 = open2.replace(new RegExp(`\\s+${name}\\s*=\\s*(["'])[\\s\\S]*?\\1`), "");
|
|
344064
344442
|
}
|
|
344065
344443
|
let prefix = Object.entries(paragraph4.namespaceBindings).find(([name, uri]) => name && uri === WORD_2010_NS2)?.[0];
|
|
344066
344444
|
let namespace = "";
|
|
@@ -344070,10 +344448,10 @@ function prepareTrackedSectionBreak(input) {
|
|
|
344070
344448
|
prefix += "sd";
|
|
344071
344449
|
namespace = ` xmlns:${prefix}="${WORD_2010_NS2}"`;
|
|
344072
344450
|
}
|
|
344073
|
-
|
|
344451
|
+
open2 = open2.replace(/\/?>(?=$)/, (ending) => `${namespace} ${prefix}:paraId="${paragraphId3}"${ending}`);
|
|
344074
344452
|
return prepareTrackedBlockXmlReplacement({
|
|
344075
344453
|
beforeXml: beforeParagraphXml,
|
|
344076
|
-
afterXml:
|
|
344454
|
+
afterXml: open2 + paragraphXml.slice(paragraph4.openEnd - paragraph4.start),
|
|
344077
344455
|
namespaceBindings: new Map(Object.entries(after.body.namespaceBindings)),
|
|
344078
344456
|
stamp: { revisionId: revisionIds?.[0] ?? 0, revisionIds, author, date: date6 }
|
|
344079
344457
|
});
|
|
@@ -346858,15 +347236,15 @@ function removePageNumberBuildingBlocks(context, refId, options) {
|
|
|
346858
347236
|
}
|
|
346859
347237
|
function pageNumberGalleryBlocks(partXml) {
|
|
346860
347238
|
const blocks = [];
|
|
346861
|
-
const
|
|
347239
|
+
const open2 = [];
|
|
346862
347240
|
const tag = /<(\/?)w:sdt(?=[\s>/])[^>]*>/g;
|
|
346863
347241
|
for (let match = tag.exec(partXml);match; match = tag.exec(partXml)) {
|
|
346864
347242
|
if (!match[1]) {
|
|
346865
347243
|
if (!match[0].endsWith("/>"))
|
|
346866
|
-
|
|
347244
|
+
open2.push(match.index);
|
|
346867
347245
|
continue;
|
|
346868
347246
|
}
|
|
346869
|
-
const start =
|
|
347247
|
+
const start = open2.pop();
|
|
346870
347248
|
if (start === undefined)
|
|
346871
347249
|
continue;
|
|
346872
347250
|
const end = match.index + match[0].length;
|
|
@@ -348561,7 +348939,7 @@ function isHumanActorProof(value2) {
|
|
|
348561
348939
|
}
|
|
348562
348940
|
function createHumanActorScope() {
|
|
348563
348941
|
let depth = 0;
|
|
348564
|
-
const
|
|
348942
|
+
const open2 = (proof) => {
|
|
348565
348943
|
if (!isHumanActorProof(proof))
|
|
348566
348944
|
return () => {};
|
|
348567
348945
|
depth += 1;
|
|
@@ -348576,14 +348954,14 @@ function createHumanActorScope() {
|
|
|
348576
348954
|
return {
|
|
348577
348955
|
current: () => depth > 0 ? "human" : undefined,
|
|
348578
348956
|
run(proof, fn) {
|
|
348579
|
-
const release =
|
|
348957
|
+
const release = open2(proof);
|
|
348580
348958
|
try {
|
|
348581
348959
|
return fn();
|
|
348582
348960
|
} finally {
|
|
348583
348961
|
release();
|
|
348584
348962
|
}
|
|
348585
348963
|
},
|
|
348586
|
-
open
|
|
348964
|
+
open: open2
|
|
348587
348965
|
};
|
|
348588
348966
|
}
|
|
348589
348967
|
var HUMAN_ACTOR_PROOF;
|
|
@@ -352809,7 +353187,7 @@ async function yieldProjectionTask() {
|
|
|
352809
353187
|
await scheduler.yield();
|
|
352810
353188
|
return;
|
|
352811
353189
|
}
|
|
352812
|
-
await new Promise((
|
|
353190
|
+
await new Promise((resolve2) => setTimeout(resolve2, 0));
|
|
352813
353191
|
}
|
|
352814
353192
|
function projectionDependencyPartUris(context, storyPartUri2) {
|
|
352815
353193
|
const normalized = storyPartUri2.startsWith("/") ? storyPartUri2 : `/${storyPartUri2}`;
|
|
@@ -355766,17 +356144,17 @@ function isLowSurrogate2(value2) {
|
|
|
355766
356144
|
}
|
|
355767
356145
|
function openMarks(emitter, inline, suppressCodeMark) {
|
|
355768
356146
|
const tags = [];
|
|
355769
|
-
const
|
|
356147
|
+
const open2 = (enabled, tag) => {
|
|
355770
356148
|
if (!enabled)
|
|
355771
356149
|
return;
|
|
355772
356150
|
emitter.write(`<${tag}>`);
|
|
355773
356151
|
tags.push(tag);
|
|
355774
356152
|
};
|
|
355775
|
-
|
|
355776
|
-
|
|
355777
|
-
|
|
355778
|
-
|
|
355779
|
-
|
|
356153
|
+
open2(inline.marks.bold, "strong");
|
|
356154
|
+
open2(inline.marks.italic, "em");
|
|
356155
|
+
open2(inline.marks.underline, "u");
|
|
356156
|
+
open2(inline.marks.strike, "s");
|
|
356157
|
+
open2(!suppressCodeMark && inline.marks.code, "code");
|
|
355780
356158
|
return tags;
|
|
355781
356159
|
}
|
|
355782
356160
|
function closeMarks(emitter, tags) {
|
|
@@ -355876,7 +356254,7 @@ function createSerializationSliceGate() {
|
|
|
355876
356254
|
if (typeof scheduler?.yield === "function") {
|
|
355877
356255
|
await scheduler.yield();
|
|
355878
356256
|
} else {
|
|
355879
|
-
await new Promise((
|
|
356257
|
+
await new Promise((resolve2) => setTimeout(resolve2, 0));
|
|
355880
356258
|
}
|
|
355881
356259
|
sliceStart = performance.now();
|
|
355882
356260
|
};
|
|
@@ -356413,7 +356791,7 @@ function* resolveCodeMarkSteps(inline, suppressCodeMark, forceHtml) {
|
|
|
356413
356791
|
}
|
|
356414
356792
|
function openMarkdownMarks(emitter, inline, suppressCodeMark, codeMark, htmlFallbacks) {
|
|
356415
356793
|
const marks = [];
|
|
356416
|
-
const
|
|
356794
|
+
const open2 = (enabled, value2, close = value2, htmlTag) => {
|
|
356417
356795
|
if (!enabled)
|
|
356418
356796
|
return;
|
|
356419
356797
|
if (htmlTag) {
|
|
@@ -356424,10 +356802,10 @@ function openMarkdownMarks(emitter, inline, suppressCodeMark, codeMark, htmlFall
|
|
|
356424
356802
|
marks.push({ close });
|
|
356425
356803
|
}
|
|
356426
356804
|
};
|
|
356427
|
-
|
|
356428
|
-
|
|
356429
|
-
|
|
356430
|
-
|
|
356805
|
+
open2(inline.marks.bold, "**", "**", htmlFallbacks.bold ? "strong" : undefined);
|
|
356806
|
+
open2(inline.marks.italic, "*", "*", htmlFallbacks.italic ? "em" : undefined);
|
|
356807
|
+
open2(inline.marks.underline, "<u>", "</u>");
|
|
356808
|
+
open2(inline.marks.strike, "~~", "~~", htmlFallbacks.strike ? "s" : undefined);
|
|
356431
356809
|
if (!suppressCodeMark && codeMark) {
|
|
356432
356810
|
if (codeMark.kind === "html") {
|
|
356433
356811
|
emitter.write("<code>");
|
|
@@ -356632,7 +357010,7 @@ function createSerializationSliceGate2() {
|
|
|
356632
357010
|
if (typeof scheduler?.yield === "function") {
|
|
356633
357011
|
await scheduler.yield();
|
|
356634
357012
|
} else {
|
|
356635
|
-
await new Promise((
|
|
357013
|
+
await new Promise((resolve2) => setTimeout(resolve2, 0));
|
|
356636
357014
|
}
|
|
356637
357015
|
sliceStart = performance.now();
|
|
356638
357016
|
};
|
|
@@ -361864,12 +362242,12 @@ function bisectUnclosedRevisionWrappers(head, tail, allocateWId) {
|
|
|
361864
362242
|
return null;
|
|
361865
362243
|
const closes = [];
|
|
361866
362244
|
const reopens = [];
|
|
361867
|
-
for (const
|
|
361868
|
-
const kind = /^<w:(ins|del)\b/.exec(
|
|
362245
|
+
for (const open2 of opens) {
|
|
362246
|
+
const kind = /^<w:(ins|del)\b/.exec(open2)?.[1];
|
|
361869
362247
|
if (!kind)
|
|
361870
362248
|
return null;
|
|
361871
362249
|
closes.push(`</w:${kind}>`);
|
|
361872
|
-
reopens.push(refreshRevisionId2(
|
|
362250
|
+
reopens.push(refreshRevisionId2(open2, allocateWId));
|
|
361873
362251
|
}
|
|
361874
362252
|
return {
|
|
361875
362253
|
head: head + closes.reverse().join(""),
|
|
@@ -362040,10 +362418,10 @@ function findEnclosingElementRange(xml, localName2, start, end) {
|
|
|
362040
362418
|
stack.push({ start: match.index, openEnd: match.index + tag.length - 1 });
|
|
362041
362419
|
}
|
|
362042
362420
|
}
|
|
362043
|
-
const
|
|
362044
|
-
if (!
|
|
362421
|
+
const open2 = stack.at(-1);
|
|
362422
|
+
if (!open2)
|
|
362045
362423
|
return null;
|
|
362046
|
-
pattern.lastIndex =
|
|
362424
|
+
pattern.lastIndex = open2.openEnd + 1;
|
|
362047
362425
|
let depth = 1;
|
|
362048
362426
|
while (match = pattern.exec(xml)) {
|
|
362049
362427
|
const tag = match[0];
|
|
@@ -362054,8 +362432,8 @@ function findEnclosingElementRange(xml, localName2, start, end) {
|
|
|
362054
362432
|
if (depth === 0) {
|
|
362055
362433
|
const elementEnd = match.index + tag.length;
|
|
362056
362434
|
return elementEnd >= end ? {
|
|
362057
|
-
start:
|
|
362058
|
-
openEnd:
|
|
362435
|
+
start: open2.start,
|
|
362436
|
+
openEnd: open2.openEnd,
|
|
362059
362437
|
closeStart: match.index,
|
|
362060
362438
|
end: elementEnd
|
|
362061
362439
|
} : null;
|
|
@@ -366556,7 +366934,7 @@ function normalizeSettingsXml(xml) {
|
|
|
366556
366934
|
for (const match of normalized.matchAll(/<\/?([\w.-]+):[\w.-]+|\s(?!xmlns\b)([\w.-]+):[\w.-]+=/g)) {
|
|
366557
366935
|
usedPrefixes.add(match[1] ?? match[2]);
|
|
366558
366936
|
}
|
|
366559
|
-
normalized = normalized.replace(/(<w:settings\b)([^>]*)(>)/, (_match,
|
|
366937
|
+
normalized = normalized.replace(/(<w:settings\b)([^>]*)(>)/, (_match, open2, attrs, close) => {
|
|
366560
366938
|
const ns = [];
|
|
366561
366939
|
const rest = [];
|
|
366562
366940
|
for (const m of attrs.matchAll(XML_ATTR_RE)) {
|
|
@@ -366574,7 +366952,7 @@ function normalizeSettingsXml(xml) {
|
|
|
366574
366952
|
}
|
|
366575
366953
|
rest.push(attr3);
|
|
366576
366954
|
}
|
|
366577
|
-
return
|
|
366955
|
+
return open2 + [...ns.sort(), ...rest].join("") + close;
|
|
366578
366956
|
});
|
|
366579
366957
|
return normalized;
|
|
366580
366958
|
}
|
|
@@ -367369,7 +367747,7 @@ var init_run_signature2 = __esm(() => {
|
|
|
367369
367747
|
// ../../../v2/document-api-v2-adapter/dist/compare/opc-xml.js
|
|
367370
367748
|
function parseOpcRelationshipsXml(xml) {
|
|
367371
367749
|
return parseElementDocument(xml, {
|
|
367372
|
-
namespaceUri:
|
|
367750
|
+
namespaceUri: RELATIONSHIPS_NS3,
|
|
367373
367751
|
rootLocalName: "Relationships",
|
|
367374
367752
|
childLocalName: "Relationship",
|
|
367375
367753
|
mapElement: (tag, range) => {
|
|
@@ -367384,7 +367762,7 @@ function parseOpcRelationshipsXml(xml) {
|
|
|
367384
367762
|
}
|
|
367385
367763
|
function parseContentTypeOverridesXml(xml) {
|
|
367386
367764
|
return parseElementDocument(xml, {
|
|
367387
|
-
namespaceUri:
|
|
367765
|
+
namespaceUri: CONTENT_TYPES_NS6,
|
|
367388
367766
|
rootLocalName: "Types",
|
|
367389
367767
|
childLocalName: "Override",
|
|
367390
367768
|
mapElement: (tag, range) => {
|
|
@@ -367457,13 +367835,13 @@ function parseElementDocument(xml, options) {
|
|
|
367457
367835
|
root.closeEnd = closeEnd;
|
|
367458
367836
|
} else if (!tag.isSelfClosing) {
|
|
367459
367837
|
const stack = pending.get(tag.name);
|
|
367460
|
-
const
|
|
367461
|
-
if (
|
|
367462
|
-
const mapped = options.mapElement(
|
|
367463
|
-
raw: xml.slice(
|
|
367464
|
-
start:
|
|
367838
|
+
const open2 = stack?.pop();
|
|
367839
|
+
if (open2) {
|
|
367840
|
+
const mapped = options.mapElement(open2.tag, {
|
|
367841
|
+
raw: xml.slice(open2.start, closeEnd),
|
|
367842
|
+
start: open2.start,
|
|
367465
367843
|
end: closeEnd,
|
|
367466
|
-
qname:
|
|
367844
|
+
qname: open2.tag.name
|
|
367467
367845
|
});
|
|
367468
367846
|
if (mapped)
|
|
367469
367847
|
elements2.push(mapped);
|
|
@@ -367517,7 +367895,7 @@ function pendingHasEntries(pending) {
|
|
|
367517
367895
|
function arraysEqual(left, right) {
|
|
367518
367896
|
return left.length === right.length && left.every((value2, index2) => value2 === right[index2]);
|
|
367519
367897
|
}
|
|
367520
|
-
var
|
|
367898
|
+
var RELATIONSHIPS_NS3 = "http://schemas.openxmlformats.org/package/2006/relationships", CONTENT_TYPES_NS6 = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
367521
367899
|
var init_opc_xml = __esm(() => {
|
|
367522
367900
|
init_sd_document_session_internal();
|
|
367523
367901
|
});
|
|
@@ -370420,7 +370798,7 @@ function extractStructuralCellTexts(xml, side) {
|
|
|
370420
370798
|
}
|
|
370421
370799
|
function extractStructuralText(xml, side) {
|
|
370422
370800
|
const readText = side === "deleted" ? extractTrackedTextFromXml : extractVisibleTextFromXml;
|
|
370423
|
-
const paragraphs = scanParagraphXmlSpans({ bytes:
|
|
370801
|
+
const paragraphs = scanParagraphXmlSpans({ bytes: TEXT_ENCODER3.encode(xml) });
|
|
370424
370802
|
if (paragraphs.length === 0)
|
|
370425
370803
|
return readText(xml);
|
|
370426
370804
|
return paragraphs.map((paragraph4) => readText(paragraph4.xml).trim()).filter(Boolean).join(`
|
|
@@ -370995,8 +371373,8 @@ function structuralFieldSemanticSubtype(entry, context, resolveSession) {
|
|
|
370995
371373
|
if (!partBytes)
|
|
370996
371374
|
return null;
|
|
370997
371375
|
const partXml = decodeTrackedChangePartXml(partBytes, entry.partUri, resolveSession);
|
|
370998
|
-
const entryByteStart =
|
|
370999
|
-
const entryByteEnd =
|
|
371376
|
+
const entryByteStart = TEXT_ENCODER3.encode(partXml.slice(0, entry.documentOrderStart)).byteLength;
|
|
371377
|
+
const entryByteEnd = TEXT_ENCODER3.encode(partXml.slice(0, entry.documentOrderEnd)).byteLength;
|
|
371000
371378
|
const fields = catalog.fields.filter((candidate2) => candidate2.complete && candidate2.byteStart >= entryByteStart && candidate2.byteEnd <= entryByteEnd);
|
|
371001
371379
|
const field = fields.length === 1 ? fields[0] : undefined;
|
|
371002
371380
|
const subtype = field && field.classification !== "unknown" ? field.classification : null;
|
|
@@ -371331,7 +371709,7 @@ function createSuccessorRsidAllocator(raw) {
|
|
|
371331
371709
|
return counter.toString(16).toUpperCase().padStart(8, "0");
|
|
371332
371710
|
};
|
|
371333
371711
|
}
|
|
371334
|
-
var resolvedTrackedChangeIdsBySession,
|
|
371712
|
+
var resolvedTrackedChangeIdsBySession, TEXT_ENCODER3, EMUS_PER_CSS_PIXEL = 9525, BROWSER_RENDERABLE_IMAGE_CONTENT_TYPES, DocumentApiAdapterError, STRUCTURAL_DESCRIPTOR_OPERATIONS;
|
|
371335
371713
|
var init_adapter24 = __esm(() => {
|
|
371336
371714
|
init_review_read_model();
|
|
371337
371715
|
init_review_read_model();
|
|
@@ -371348,7 +371726,7 @@ var init_adapter24 = __esm(() => {
|
|
|
371348
371726
|
init_logical_view_cache();
|
|
371349
371727
|
init_local_text_projection();
|
|
371350
371728
|
resolvedTrackedChangeIdsBySession = new WeakMap;
|
|
371351
|
-
|
|
371729
|
+
TEXT_ENCODER3 = new TextEncoder;
|
|
371352
371730
|
BROWSER_RENDERABLE_IMAGE_CONTENT_TYPES = new Map([
|
|
371353
371731
|
["png", "image/png"],
|
|
371354
371732
|
["jpg", "image/jpeg"],
|
|
@@ -375113,11 +375491,11 @@ function contentTypeRecords(source) {
|
|
|
375113
375491
|
const parsed = parseXml(TD113.decode(decodePartBytes(source)), {
|
|
375114
375492
|
onOpenTag: (tag) => {
|
|
375115
375493
|
if (depth === 0) {
|
|
375116
|
-
if (rootSeen || tag.localName !== "Types" || tag.namespaceUri !==
|
|
375494
|
+
if (rootSeen || tag.localName !== "Types" || tag.namespaceUri !== CONTENT_TYPES_NS7)
|
|
375117
375495
|
invalid4 = true;
|
|
375118
375496
|
else
|
|
375119
375497
|
rootSeen = true;
|
|
375120
|
-
} else if (depth === 1 && tag.namespaceUri ===
|
|
375498
|
+
} else if (depth === 1 && tag.namespaceUri === CONTENT_TYPES_NS7 && (tag.localName === "Default" || tag.localName === "Override")) {
|
|
375121
375499
|
const contentType = unqualifiedAttribute(tag, "ContentType");
|
|
375122
375500
|
const identifier = tag.localName === "Default" ? unqualifiedAttribute(tag, "Extension")?.toLowerCase() : unqualifiedAttribute(tag, "PartName");
|
|
375123
375501
|
const key2 = identifier ? `${tag.localName === "Default" ? "default" : "override"}:${identifier}` : null;
|
|
@@ -375170,7 +375548,7 @@ function decodePartBytes(source) {
|
|
|
375170
375548
|
const length = base64DecodedLength(source.bytesBase64);
|
|
375171
375549
|
return length === null ? null : base64ToBytes(source.bytesBase64, length);
|
|
375172
375550
|
}
|
|
375173
|
-
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",
|
|
375551
|
+
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", TD113, PROTECTED_BODY_ELEMENTS;
|
|
375174
375552
|
var init_relationship_backed_body_replay = __esm(() => {
|
|
375175
375553
|
init_sd_document_session_internal();
|
|
375176
375554
|
init_part_fingerprint();
|
|
@@ -375963,8 +376341,8 @@ function replaceAttribute(element, localName2, value2) {
|
|
|
375963
376341
|
if (!attribute2)
|
|
375964
376342
|
return element.xml;
|
|
375965
376343
|
const openEnd = element.xml.indexOf(">") + 1;
|
|
375966
|
-
const
|
|
375967
|
-
const replaced =
|
|
376344
|
+
const open2 = element.xml.slice(0, openEnd);
|
|
376345
|
+
const replaced = open2.replace(new RegExp(`(\\b${escapeRegExp19(attribute2.name)}\\s*=\\s*)(['"])([\\s\\S]*?)\\2`), (_match, name, quote) => `${name}${quote}${value2}${quote}`);
|
|
375968
376346
|
return replaced + element.xml.slice(openEnd);
|
|
375969
376347
|
}
|
|
375970
376348
|
function replaceUnique(xml, before, after) {
|
|
@@ -391495,7 +391873,7 @@ function wrapExistingNoteReferenceXml(documentXml, type, noteId, stamp) {
|
|
|
391495
391873
|
const propertiesXml = properties ? documentXml.slice(properties.start, properties.end) : "";
|
|
391496
391874
|
const before = documentXml.slice(run.openEnd, reference.start);
|
|
391497
391875
|
const after = documentXml.slice(reference.end, run.closeStart);
|
|
391498
|
-
const
|
|
391876
|
+
const open2 = documentXml.slice(run.start, run.openEnd);
|
|
391499
391877
|
const close = documentXml.slice(run.closeStart, run.end);
|
|
391500
391878
|
const hasBefore = before.replace(propertiesXml, "").trim().length > 0;
|
|
391501
391879
|
const hasAfter = after.trim().length > 0;
|
|
@@ -391503,7 +391881,7 @@ function wrapExistingNoteReferenceXml(documentXml, type, noteId, stamp) {
|
|
|
391503
391881
|
if (!hasBefore && !hasAfter) {
|
|
391504
391882
|
referenceRun = documentXml.slice(run.start, run.end);
|
|
391505
391883
|
} else {
|
|
391506
|
-
referenceRun =
|
|
391884
|
+
referenceRun = open2 + propertiesXml + documentXml.slice(reference.start, reference.end) + close;
|
|
391507
391885
|
}
|
|
391508
391886
|
const replacement = prepareTrackedInlineXmlReplacement({
|
|
391509
391887
|
beforeXml: referenceRun,
|
|
@@ -391514,7 +391892,7 @@ function wrapExistingNoteReferenceXml(documentXml, type, noteId, stamp) {
|
|
|
391514
391892
|
if (!replacement)
|
|
391515
391893
|
return unresolved();
|
|
391516
391894
|
return {
|
|
391517
|
-
xml: documentXml.slice(0, run.start) + (hasBefore ?
|
|
391895
|
+
xml: documentXml.slice(0, run.start) + (hasBefore ? open2 + before + close : "") + replacement.xml + (hasAfter ? open2 + propertiesXml + after + close : "") + documentXml.slice(run.end),
|
|
391518
391896
|
wordIds: replacement.wordIds
|
|
391519
391897
|
};
|
|
391520
391898
|
}
|
|
@@ -394051,8 +394429,8 @@ function boundedAttribute(xml, tag, attribute2) {
|
|
|
394051
394429
|
return readXmlAttribute5(xml, tag, attribute2)?.slice(0, MAX_IMAGE_METADATA_CHARS) || undefined;
|
|
394052
394430
|
}
|
|
394053
394431
|
function readXmlAttribute5(xml, tag, attribute2, prefix) {
|
|
394054
|
-
const
|
|
394055
|
-
return
|
|
394432
|
+
const open2 = new RegExp(`<[\\w.-]+:${tag}\\b[^>]*>`).exec(xml)?.[0];
|
|
394433
|
+
return open2 ? readBareAttribute(open2, prefix ? `${prefix}:${attribute2}` : attribute2) : null;
|
|
394056
394434
|
}
|
|
394057
394435
|
function readBareAttribute(xml, attribute2) {
|
|
394058
394436
|
const escaped = attribute2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -394359,10 +394737,10 @@ function compileCopyParagraphPropertyXmlModel(context) {
|
|
|
394359
394737
|
let match;
|
|
394360
394738
|
while (match = stylePattern.exec(xml)) {
|
|
394361
394739
|
const styleXml = match[0];
|
|
394362
|
-
const
|
|
394363
|
-
if (readQualifiedXmlAttribute(
|
|
394740
|
+
const open2 = new RegExp(`^<${prefix}:style\\b[^>]*>`).exec(styleXml)?.[0] ?? "";
|
|
394741
|
+
if (readQualifiedXmlAttribute(open2, normalized.prefix, "type") !== "paragraph")
|
|
394364
394742
|
continue;
|
|
394365
|
-
const styleId = readQualifiedXmlAttribute(
|
|
394743
|
+
const styleId = readQualifiedXmlAttribute(open2, normalized.prefix, "styleId");
|
|
394366
394744
|
if (!styleId)
|
|
394367
394745
|
continue;
|
|
394368
394746
|
const basedOnOpen = new RegExp(`<${prefix}:basedOn\\b[^>]*>`).exec(styleXml)?.[0] ?? "";
|
|
@@ -396666,7 +397044,7 @@ function resolveBlockBoundarySelection(context, at) {
|
|
|
396666
397044
|
if (!bytes)
|
|
396667
397045
|
invalid4("PRECONDITION_FAILED", "Source story bytes are unavailable.");
|
|
396668
397046
|
const catalog = buildTableCatalog({ bytes, storyId: story.storyId });
|
|
396669
|
-
const
|
|
397047
|
+
const resolve2 = (point3, side) => {
|
|
396670
397048
|
if (point3.kind === "text")
|
|
396671
397049
|
return point3;
|
|
396672
397050
|
const { node: node4 } = point3;
|
|
@@ -396706,8 +397084,8 @@ function resolveBlockBoundarySelection(context, at) {
|
|
|
396706
397084
|
...storyLocator ? { story: storyLocator } : {}
|
|
396707
397085
|
};
|
|
396708
397086
|
};
|
|
396709
|
-
const start =
|
|
396710
|
-
const end =
|
|
397087
|
+
const start = resolve2(at.start, "start");
|
|
397088
|
+
const end = resolve2(at.end, "end");
|
|
396711
397089
|
return start && end ? { ...at, start, end } : null;
|
|
396712
397090
|
}
|
|
396713
397091
|
function captureSelectionOoxml(context, input) {
|
|
@@ -400310,7 +400688,7 @@ function readParagraphInlineMap(session, entry) {
|
|
|
400310
400688
|
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
400311
400689
|
if (!bytes)
|
|
400312
400690
|
return null;
|
|
400313
|
-
return parseParagraphInlineMap(
|
|
400691
|
+
return parseParagraphInlineMap(TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd)));
|
|
400314
400692
|
}
|
|
400315
400693
|
function resolveTrackedSelectionEndpoint(map3, point3, bias) {
|
|
400316
400694
|
if (point3.trackedOffset != null) {
|
|
@@ -400446,7 +400824,7 @@ function readSelectionText(session, entries, segments) {
|
|
|
400446
400824
|
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
400447
400825
|
if (!bytes)
|
|
400448
400826
|
return "";
|
|
400449
|
-
const xml =
|
|
400827
|
+
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
400450
400828
|
const paragraphText3 = visibleParagraphTextFromXml(xml);
|
|
400451
400829
|
const start = clampOffset(segment.range.start, paragraphText3.length);
|
|
400452
400830
|
const end = clampOffset(segment.range.end, paragraphText3.length);
|
|
@@ -400462,7 +400840,7 @@ function readActiveMarks(session, entries, segments) {
|
|
|
400462
400840
|
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
400463
400841
|
if (!bytes)
|
|
400464
400842
|
return [];
|
|
400465
|
-
const xml =
|
|
400843
|
+
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
400466
400844
|
const paragraphText3 = visibleParagraphTextFromXml(xml);
|
|
400467
400845
|
const start = clampOffset(segment.range.start, paragraphText3.length);
|
|
400468
400846
|
const end = clampOffset(segment.range.end, paragraphText3.length);
|
|
@@ -400520,7 +400898,7 @@ function readActiveChangeIds(session, entries, segments, options) {
|
|
|
400520
400898
|
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
400521
400899
|
if (!bytes)
|
|
400522
400900
|
return [];
|
|
400523
|
-
const xml =
|
|
400901
|
+
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
400524
400902
|
const paragraphText3 = visibleParagraphTextFromXml(xml);
|
|
400525
400903
|
const start = clampOffset(segment.range.start, paragraphText3.length);
|
|
400526
400904
|
const end = clampOffset(segment.range.end, paragraphText3.length);
|
|
@@ -400791,12 +401169,12 @@ function pushUnique(out, id) {
|
|
|
400791
401169
|
if (typeof id === "string" && id.length > 0 && !out.includes(id))
|
|
400792
401170
|
out.push(id);
|
|
400793
401171
|
}
|
|
400794
|
-
var
|
|
401172
|
+
var TEXT_DECODER7, ACTIVE_MARK_ORDER;
|
|
400795
401173
|
var init_live_selection = __esm(() => {
|
|
400796
401174
|
init_sd_document_session_internal();
|
|
400797
401175
|
init_sd_document_session_internal();
|
|
400798
401176
|
init_footnote_range();
|
|
400799
|
-
|
|
401177
|
+
TEXT_DECODER7 = new TextDecoder;
|
|
400800
401178
|
ACTIVE_MARK_ORDER = ["bold", "italic", "underline", "strikethrough"];
|
|
400801
401179
|
});
|
|
400802
401180
|
|
|
@@ -405215,17 +405593,17 @@ var init_yjs = __esm(() => {
|
|
|
405215
405593
|
this.isLoaded = false;
|
|
405216
405594
|
this.isSynced = false;
|
|
405217
405595
|
this.isDestroyed = false;
|
|
405218
|
-
this.whenLoaded = create4((
|
|
405596
|
+
this.whenLoaded = create4((resolve2) => {
|
|
405219
405597
|
this.on("load", () => {
|
|
405220
405598
|
this.isLoaded = true;
|
|
405221
|
-
|
|
405599
|
+
resolve2(this);
|
|
405222
405600
|
});
|
|
405223
405601
|
});
|
|
405224
|
-
const provideSyncedPromise = () => create4((
|
|
405602
|
+
const provideSyncedPromise = () => create4((resolve2) => {
|
|
405225
405603
|
const eventHandler = (isSynced) => {
|
|
405226
405604
|
if (isSynced === undefined || isSynced === true) {
|
|
405227
405605
|
this.off("sync", eventHandler);
|
|
405228
|
-
|
|
405606
|
+
resolve2();
|
|
405229
405607
|
}
|
|
405230
405608
|
};
|
|
405231
405609
|
this.on("sync", eventHandler);
|
|
@@ -407692,14 +408070,14 @@ function createSyncWaitQueue() {
|
|
|
407692
408070
|
let rejectWaiters = [];
|
|
407693
408071
|
return {
|
|
407694
408072
|
wait(timeoutMs, makeTimeoutError) {
|
|
407695
|
-
return new Promise((
|
|
408073
|
+
return new Promise((resolve2, reject2) => {
|
|
407696
408074
|
let settled = false;
|
|
407697
408075
|
const onResolve = () => {
|
|
407698
408076
|
if (settled)
|
|
407699
408077
|
return;
|
|
407700
408078
|
settled = true;
|
|
407701
408079
|
clearTimeout(timer);
|
|
407702
|
-
|
|
408080
|
+
resolve2();
|
|
407703
408081
|
};
|
|
407704
408082
|
const onReject = (error48) => {
|
|
407705
408083
|
if (settled)
|
|
@@ -407724,8 +408102,8 @@ function createSyncWaitQueue() {
|
|
|
407724
408102
|
const waiters = resolveWaiters;
|
|
407725
408103
|
resolveWaiters = [];
|
|
407726
408104
|
rejectWaiters = [];
|
|
407727
|
-
for (const
|
|
407728
|
-
|
|
408105
|
+
for (const resolve2 of waiters)
|
|
408106
|
+
resolve2();
|
|
407729
408107
|
},
|
|
407730
408108
|
rejectAll(error48) {
|
|
407731
408109
|
const waiters = rejectWaiters;
|
|
@@ -408323,7 +408701,7 @@ var require_src2 = __commonJS((exports) => {
|
|
|
408323
408701
|
};
|
|
408324
408702
|
}
|
|
408325
408703
|
async function sleep(delay) {
|
|
408326
|
-
return new Promise((
|
|
408704
|
+
return new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
408327
408705
|
}
|
|
408328
408706
|
exports.sleep = sleep;
|
|
408329
408707
|
function defaultCalculateDelay(context, options) {
|
|
@@ -408402,11 +408780,11 @@ var require_src2 = __commonJS((exports) => {
|
|
|
408402
408780
|
context.attemptsRemaining--;
|
|
408403
408781
|
}
|
|
408404
408782
|
if (options.timeout) {
|
|
408405
|
-
return new Promise((
|
|
408783
|
+
return new Promise((resolve2, reject2) => {
|
|
408406
408784
|
const timer = setTimeout(() => {
|
|
408407
408785
|
if (options.handleTimeout) {
|
|
408408
408786
|
try {
|
|
408409
|
-
|
|
408787
|
+
resolve2(options.handleTimeout(context, options));
|
|
408410
408788
|
} catch (e) {
|
|
408411
408789
|
reject2(e);
|
|
408412
408790
|
}
|
|
@@ -408418,10 +408796,10 @@ var require_src2 = __commonJS((exports) => {
|
|
|
408418
408796
|
}, options.timeout);
|
|
408419
408797
|
attemptFunc(context, options).then((result) => {
|
|
408420
408798
|
clearTimeout(timer);
|
|
408421
|
-
|
|
408799
|
+
resolve2(result);
|
|
408422
408800
|
}).catch((err2) => {
|
|
408423
408801
|
clearTimeout(timer);
|
|
408424
|
-
onError(err2).then(
|
|
408802
|
+
onError(err2).then(resolve2).catch(reject2);
|
|
408425
408803
|
});
|
|
408426
408804
|
});
|
|
408427
408805
|
} else {
|
|
@@ -409433,7 +409811,7 @@ var init_hocuspocus_provider_esm = __esm(() => {
|
|
|
409433
409811
|
this.webSocket = null;
|
|
409434
409812
|
}
|
|
409435
409813
|
createWebSocketConnection() {
|
|
409436
|
-
return new Promise((
|
|
409814
|
+
return new Promise((resolve2, reject2) => {
|
|
409437
409815
|
if (this.webSocket) {
|
|
409438
409816
|
this.messageQueue = [];
|
|
409439
409817
|
this.cleanupWebSocket();
|
|
@@ -409448,7 +409826,7 @@ var init_hocuspocus_provider_esm = __esm(() => {
|
|
|
409448
409826
|
this.status = WebSocketStatus.Connecting;
|
|
409449
409827
|
this.emit("status", { status: WebSocketStatus.Connecting });
|
|
409450
409828
|
this.connectionAttempt = {
|
|
409451
|
-
resolve,
|
|
409829
|
+
resolve: resolve2,
|
|
409452
409830
|
reject: reject2
|
|
409453
409831
|
};
|
|
409454
409832
|
});
|
|
@@ -410650,17 +411028,17 @@ async function autoRetry(promiseFn, maxTries, backoff, shouldStopRetrying = DONT
|
|
|
410650
411028
|
}
|
|
410651
411029
|
}
|
|
410652
411030
|
function controlledPromise() {
|
|
410653
|
-
let
|
|
411031
|
+
let resolve2;
|
|
410654
411032
|
let reject2;
|
|
410655
411033
|
const promise3 = new Promise((res, rej) => {
|
|
410656
|
-
|
|
411034
|
+
resolve2 = res;
|
|
410657
411035
|
reject2 = rej;
|
|
410658
411036
|
});
|
|
410659
|
-
return [promise3,
|
|
411037
|
+
return [promise3, resolve2, reject2];
|
|
410660
411038
|
}
|
|
410661
411039
|
function Promise_withResolvers() {
|
|
410662
|
-
const [promise3,
|
|
410663
|
-
return { promise: promise3, resolve, reject: reject2 };
|
|
411040
|
+
const [promise3, resolve2, reject2] = controlledPromise();
|
|
411041
|
+
return { promise: promise3, resolve: resolve2, reject: reject2 };
|
|
410664
411042
|
}
|
|
410665
411043
|
function replacer(_key, value2) {
|
|
410666
411044
|
return value2 !== null && typeof value2 === "object" && !Array.isArray(value2) ? Object.keys(value2).sort().reduce((sorted, key2) => {
|
|
@@ -411773,7 +412151,7 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
411773
412151
|
let socketOpenAt = null;
|
|
411774
412152
|
let capturedPrematureEvent = null;
|
|
411775
412153
|
let unconfirmedSocket = null;
|
|
411776
|
-
const connect$ = new Promise((
|
|
412154
|
+
const connect$ = new Promise((resolve2, rej) => {
|
|
411777
412155
|
if (ctx.authValue === null) {
|
|
411778
412156
|
throw new Error("No auth authValue");
|
|
411779
412157
|
}
|
|
@@ -411818,7 +412196,7 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
411818
412196
|
socket.removeEventListener("message", waitForActorId);
|
|
411819
412197
|
};
|
|
411820
412198
|
actor$.then(() => {
|
|
411821
|
-
|
|
412199
|
+
resolve2([socket, unsub]);
|
|
411822
412200
|
});
|
|
411823
412201
|
});
|
|
411824
412202
|
});
|
|
@@ -412615,13 +412993,13 @@ function createAi(config2) {
|
|
|
412615
412993
|
if (managedSocket.getStatus() !== "connected") {
|
|
412616
412994
|
await managedSocket.events.didConnect.waitUntil();
|
|
412617
412995
|
}
|
|
412618
|
-
const { promise: promise3, resolve, reject: reject2 } = Promise_withResolvers();
|
|
412996
|
+
const { promise: promise3, resolve: resolve2, reject: reject2 } = Promise_withResolvers();
|
|
412619
412997
|
const abortSignal = AbortSignal.timeout(DEFAULT_REQUEST_TIMEOUT);
|
|
412620
412998
|
abortSignal.addEventListener("abort", () => reject2(abortSignal.reason), {
|
|
412621
412999
|
once: true
|
|
412622
413000
|
});
|
|
412623
413001
|
const cmdId = nanoid3(7);
|
|
412624
|
-
context.pendingCmds.set(cmdId, { resolve, reject: reject2 });
|
|
413002
|
+
context.pendingCmds.set(cmdId, { resolve: resolve2, reject: reject2 });
|
|
412625
413003
|
sendClientMsg({ ...msg, cmdId });
|
|
412626
413004
|
return promise3.finally(() => {
|
|
412627
413005
|
context.pendingCmds.delete(cmdId);
|
|
@@ -414685,8 +415063,8 @@ function createRoom(options, config2) {
|
|
|
414685
415063
|
function startLoadingStorage() {
|
|
414686
415064
|
if (_getStorage$ === null) {
|
|
414687
415065
|
refreshStorage({ flush: true });
|
|
414688
|
-
_getStorage$ = new Promise((
|
|
414689
|
-
_resolveStoragePromise =
|
|
415066
|
+
_getStorage$ = new Promise((resolve2) => {
|
|
415067
|
+
_resolveStoragePromise = resolve2;
|
|
414690
415068
|
});
|
|
414691
415069
|
notifyStorageStatus();
|
|
414692
415070
|
}
|
|
@@ -414832,9 +415210,9 @@ function createRoom(options, config2) {
|
|
|
414832
415210
|
}
|
|
414833
415211
|
async function waitUntilPresenceReady() {
|
|
414834
415212
|
while (!isPresenceReady()) {
|
|
414835
|
-
const { promise: promise3, resolve } = Promise_withResolvers();
|
|
414836
|
-
const unsub1 = events.self.subscribeOnce(
|
|
414837
|
-
const unsub2 = events.status.subscribeOnce(
|
|
415213
|
+
const { promise: promise3, resolve: resolve2 } = Promise_withResolvers();
|
|
415214
|
+
const unsub1 = events.self.subscribeOnce(resolve2);
|
|
415215
|
+
const unsub2 = events.status.subscribeOnce(resolve2);
|
|
414838
415216
|
await promise3;
|
|
414839
415217
|
unsub1();
|
|
414840
415218
|
unsub2();
|
|
@@ -415625,9 +416003,9 @@ var __defProp2, __export2 = (target, all3) => {
|
|
|
415625
416003
|
promise;
|
|
415626
416004
|
constructor(input) {
|
|
415627
416005
|
this.input = input;
|
|
415628
|
-
const { promise: promise3, resolve, reject: reject2 } = Promise_withResolvers();
|
|
416006
|
+
const { promise: promise3, resolve: resolve2, reject: reject2 } = Promise_withResolvers();
|
|
415629
416007
|
this.promise = promise3;
|
|
415630
|
-
this.resolve =
|
|
416008
|
+
this.resolve = resolve2;
|
|
415631
416009
|
this.reject = reject2;
|
|
415632
416010
|
}
|
|
415633
416011
|
}, Batch = class {
|
|
@@ -419351,10 +419729,10 @@ var init_base64 = __esm(() => {
|
|
|
419351
419729
|
});
|
|
419352
419730
|
|
|
419353
419731
|
// ../../../v2/node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/indexeddb.js
|
|
419354
|
-
var rtop = (request) => create4((
|
|
419732
|
+
var rtop = (request) => create4((resolve2, reject2) => {
|
|
419355
419733
|
request.onerror = (event) => reject2(new Error(event.target.error));
|
|
419356
|
-
request.onsuccess = (event) =>
|
|
419357
|
-
}), openDB = (name, initDB) => create4((
|
|
419734
|
+
request.onsuccess = (event) => resolve2(event.target.result);
|
|
419735
|
+
}), openDB = (name, initDB) => create4((resolve2, reject2) => {
|
|
419358
419736
|
const request = indexedDB.open(name);
|
|
419359
419737
|
request.onupgradeneeded = (event) => initDB(event.target.result);
|
|
419360
419738
|
request.onerror = (event) => reject2(create3(event.target.error));
|
|
@@ -419363,7 +419741,7 @@ var rtop = (request) => create4((resolve, reject2) => {
|
|
|
419363
419741
|
db.onversionchange = () => {
|
|
419364
419742
|
db.close();
|
|
419365
419743
|
};
|
|
419366
|
-
|
|
419744
|
+
resolve2(db);
|
|
419367
419745
|
};
|
|
419368
419746
|
}), deleteDB = (name) => rtop(indexedDB.deleteDatabase(name)), createStores = (db, definitions) => definitions.forEach((d) => db.createObjectStore.apply(db, d)), transact2 = (db, stores, access = "readwrite") => {
|
|
419369
419747
|
const transaction = db.transaction(stores, access);
|
|
@@ -419374,12 +419752,12 @@ var rtop = (request) => create4((resolve, reject2) => {
|
|
|
419374
419752
|
first = key2;
|
|
419375
419753
|
return false;
|
|
419376
419754
|
}, direction).then(() => first);
|
|
419377
|
-
}, getLastKey = (store, range = null) => queryFirst(store, range, "prev"), iterateOnRequest = (request, f) => create4((
|
|
419755
|
+
}, getLastKey = (store, range = null) => queryFirst(store, range, "prev"), iterateOnRequest = (request, f) => create4((resolve2, reject2) => {
|
|
419378
419756
|
request.onerror = reject2;
|
|
419379
419757
|
request.onsuccess = async (event) => {
|
|
419380
419758
|
const cursor = event.target.result;
|
|
419381
419759
|
if (cursor === null || await f(cursor) === false) {
|
|
419382
|
-
return
|
|
419760
|
+
return resolve2();
|
|
419383
419761
|
}
|
|
419384
419762
|
cursor.continue();
|
|
419385
419763
|
};
|
|
@@ -419430,7 +419808,7 @@ var init_y_indexeddb = __esm(() => {
|
|
|
419430
419808
|
["updates", { autoIncrement: true }],
|
|
419431
419809
|
["custom"]
|
|
419432
419810
|
]));
|
|
419433
|
-
this.whenSynced = create4((
|
|
419811
|
+
this.whenSynced = create4((resolve2) => this.on("synced", () => resolve2(this)));
|
|
419434
419812
|
this._db.then((db) => {
|
|
419435
419813
|
this.db = db;
|
|
419436
419814
|
const beforeApplyUpdatesCallback = (updatesStore) => addAutoKey(updatesStore, encodeStateAsUpdate(doc2));
|
|
@@ -422538,8 +422916,8 @@ function pickLeader(claims, selfClaimerId, selfSha256, diagnostics) {
|
|
|
422538
422916
|
}
|
|
422539
422917
|
return activeClaims[0].claimerId;
|
|
422540
422918
|
}
|
|
422541
|
-
var DEFAULT_SETTLING_RESOLVER = () => new Promise((
|
|
422542
|
-
queueMicrotask(
|
|
422919
|
+
var DEFAULT_SETTLING_RESOLVER = () => new Promise((resolve2) => {
|
|
422920
|
+
queueMicrotask(resolve2);
|
|
422543
422921
|
});
|
|
422544
422922
|
var init_bootstrap = __esm(() => {
|
|
422545
422923
|
init_yjs();
|
|
@@ -422867,20 +423245,20 @@ function collectExpectedRequiredShards(snapshot3, readiness, diagnostics) {
|
|
|
422867
423245
|
}
|
|
422868
423246
|
return [...required2.values()].sort((a, b) => a.shardId < b.shardId ? -1 : a.shardId > b.shardId ? 1 : 0);
|
|
422869
423247
|
}
|
|
422870
|
-
function expectIndexedPart(snapshot3, partByKey,
|
|
422871
|
-
if (!
|
|
423248
|
+
function expectIndexedPart(snapshot3, partByKey, partKey2, fieldName, diagnostics) {
|
|
423249
|
+
if (!partKey2) {
|
|
422872
423250
|
diagnostics.push({
|
|
422873
423251
|
code: COLLAB_V2_DIAGNOSTICS.COLLAB_V2_ROOM_MANIFEST_CORRUPT,
|
|
422874
423252
|
message: `${fieldName} is missing`
|
|
422875
423253
|
});
|
|
422876
423254
|
return null;
|
|
422877
423255
|
}
|
|
422878
|
-
const part = partByKey.get(
|
|
423256
|
+
const part = partByKey.get(partKey2) ?? null;
|
|
422879
423257
|
if (part)
|
|
422880
423258
|
return part;
|
|
422881
423259
|
diagnostics.push({
|
|
422882
423260
|
code: COLLAB_V2_DIAGNOSTICS.COLLAB_V2_ROOM_MANIFEST_CORRUPT,
|
|
422883
|
-
message: `${fieldName} points at missing package part "${
|
|
423261
|
+
message: `${fieldName} points at missing package part "${partKey2}"`
|
|
422884
423262
|
});
|
|
422885
423263
|
return null;
|
|
422886
423264
|
}
|
|
@@ -423675,24 +424053,24 @@ function readDirectPPrChildren(pPrXml) {
|
|
|
423675
424053
|
function scanNextElement(body, cursor) {
|
|
423676
424054
|
let scanCursor = cursor;
|
|
423677
424055
|
while (scanCursor < body.length) {
|
|
423678
|
-
const
|
|
423679
|
-
if (
|
|
424056
|
+
const open2 = body.indexOf("<", scanCursor);
|
|
424057
|
+
if (open2 < 0)
|
|
423680
424058
|
return null;
|
|
423681
|
-
const node4 = readXmlNodeAt(body,
|
|
424059
|
+
const node4 = readXmlNodeAt(body, open2);
|
|
423682
424060
|
if (!node4)
|
|
423683
424061
|
return null;
|
|
423684
424062
|
if (node4.kind === "markup") {
|
|
423685
424063
|
scanCursor = node4.end;
|
|
423686
424064
|
continue;
|
|
423687
424065
|
}
|
|
423688
|
-
const openTag = body.slice(
|
|
424066
|
+
const openTag = body.slice(open2, node4.openEnd);
|
|
423689
424067
|
const openTagInner = openTag.slice(1, openTag.endsWith("/>") ? -2 : -1).trimEnd();
|
|
423690
424068
|
return {
|
|
423691
|
-
start:
|
|
424069
|
+
start: open2,
|
|
423692
424070
|
end: node4.end,
|
|
423693
424071
|
openTag,
|
|
423694
424072
|
openTagInner,
|
|
423695
|
-
xml: body.slice(
|
|
424073
|
+
xml: body.slice(open2, node4.end)
|
|
423696
424074
|
};
|
|
423697
424075
|
}
|
|
423698
424076
|
return null;
|
|
@@ -423989,18 +424367,18 @@ function namespaceBindingsForElement(openTagInner, inheritedNamespaceBindings) {
|
|
|
423989
424367
|
return bindings;
|
|
423990
424368
|
}
|
|
423991
424369
|
function stripTextTag(text4) {
|
|
423992
|
-
const
|
|
424370
|
+
const open2 = text4.indexOf(">");
|
|
423993
424371
|
const close = text4.lastIndexOf("<");
|
|
423994
|
-
if (
|
|
424372
|
+
if (open2 < 0 || close < 0 || close <= open2)
|
|
423995
424373
|
return "";
|
|
423996
|
-
return text4.slice(
|
|
424374
|
+
return text4.slice(open2 + 1, close);
|
|
423997
424375
|
}
|
|
423998
424376
|
function stripOuterTag(xml) {
|
|
423999
|
-
const
|
|
424377
|
+
const open2 = xml.indexOf(">");
|
|
424000
424378
|
const close = xml.lastIndexOf("<");
|
|
424001
|
-
if (
|
|
424379
|
+
if (open2 < 0 || close < 0 || close <= open2)
|
|
424002
424380
|
return "";
|
|
424003
|
-
return xml.slice(
|
|
424381
|
+
return xml.slice(open2 + 1, close);
|
|
424004
424382
|
}
|
|
424005
424383
|
function hasNonNamespaceAttributes(openTagInner) {
|
|
424006
424384
|
const attrSource = openTagInner.replace(/^[^\s/>]+/, "");
|
|
@@ -425274,6 +425652,7 @@ function insertBlock(input) {
|
|
|
425274
425652
|
if (input.text) {
|
|
425275
425653
|
created.text.insert(0, input.text);
|
|
425276
425654
|
}
|
|
425655
|
+
invalidateStoryBlockIndex(scope);
|
|
425277
425656
|
scope.blocks.push([created.block]);
|
|
425278
425657
|
scope.order.set(blockId, assignOrderWindow(scope, ordered, targetIndex, 1, blockId)[0]);
|
|
425279
425658
|
}, input.origin ?? STORY_MUTATION_ORIGIN.blockInsert);
|
|
@@ -425290,6 +425669,7 @@ function deleteBlock(input) {
|
|
|
425290
425669
|
order.delete(target.blockId);
|
|
425291
425670
|
}
|
|
425292
425671
|
const physicalIndices = [...new Set(targets.map((target) => target.physicalIndex))].sort((a, b) => b - a);
|
|
425672
|
+
invalidateStoryBlockIndex(scope);
|
|
425293
425673
|
for (const physicalIndex of physicalIndices) {
|
|
425294
425674
|
blocks.delete(physicalIndex, 1);
|
|
425295
425675
|
}
|
|
@@ -427430,13 +427810,13 @@ function registerMediaAsset(input) {
|
|
|
427430
427810
|
}).id;
|
|
427431
427811
|
partUri = `/word/media/image${ordinal}.${ext}`;
|
|
427432
427812
|
}
|
|
427433
|
-
const
|
|
427434
|
-
if (byPart.has(
|
|
427435
|
-
throw new CollabV2DiagnosticError(COLLAB_V2_DIAGNOSTICS.COLLAB_V2_PACKAGE_PART_IDENTITY_CONFLICT, `media part ${
|
|
427813
|
+
const partKey2 = input.partKey ?? encodePartKey(partUri);
|
|
427814
|
+
if (byPart.has(partKey2)) {
|
|
427815
|
+
throw new CollabV2DiagnosticError(COLLAB_V2_DIAGNOSTICS.COLLAB_V2_PACKAGE_PART_IDENTITY_CONFLICT, `media part ${partKey2} already exists`, { partKey: partKey2, partUri });
|
|
427436
427816
|
}
|
|
427437
427817
|
snapshot3 = {
|
|
427438
427818
|
assetId,
|
|
427439
|
-
partKey,
|
|
427819
|
+
partKey: partKey2,
|
|
427440
427820
|
partUri,
|
|
427441
427821
|
contentType: input.contentType,
|
|
427442
427822
|
sha256: input.sha256,
|
|
@@ -427447,7 +427827,7 @@ function registerMediaAsset(input) {
|
|
|
427447
427827
|
hasBytes: false
|
|
427448
427828
|
};
|
|
427449
427829
|
assets.set(assetId, assetRecordToMap(snapshot3));
|
|
427450
|
-
byPart.set(
|
|
427830
|
+
byPart.set(partKey2, assetId);
|
|
427451
427831
|
}, "package-part:media-manifest:register");
|
|
427452
427832
|
return snapshot3;
|
|
427453
427833
|
}
|
|
@@ -427520,10 +427900,10 @@ function deleteMediaAsset(doc2, assetId) {
|
|
|
427520
427900
|
const record3 = readAssetRecord(assets, assetId);
|
|
427521
427901
|
if (!record3)
|
|
427522
427902
|
return;
|
|
427523
|
-
const
|
|
427903
|
+
const partKey2 = String(record3.get("partKey") ?? "");
|
|
427524
427904
|
assets.delete(assetId);
|
|
427525
|
-
if (
|
|
427526
|
-
byPart.delete(
|
|
427905
|
+
if (partKey2 && byPart.get(partKey2) === assetId) {
|
|
427906
|
+
byPart.delete(partKey2);
|
|
427527
427907
|
}
|
|
427528
427908
|
removed = true;
|
|
427529
427909
|
}, "package-part:media-manifest:delete");
|
|
@@ -431517,7 +431897,7 @@ async function waitForJournalSettled(rootDoc, options) {
|
|
|
431517
431897
|
if (lastState.settled)
|
|
431518
431898
|
return lastState;
|
|
431519
431899
|
while (now3() < deadline) {
|
|
431520
|
-
await new Promise((
|
|
431900
|
+
await new Promise((resolve2) => setTimeout(resolve2, poll));
|
|
431521
431901
|
lastState = getJournalBarrierState(rootDoc, options);
|
|
431522
431902
|
if (lastState.settled)
|
|
431523
431903
|
return lastState;
|
|
@@ -433891,10 +434271,10 @@ function serializeWebSettingsXml(settings, bootstrap) {
|
|
|
433891
434271
|
sb.push(bootstrap?.containerCloseTagXml ?? "</w:webSettings>");
|
|
433892
434272
|
return sb.join("");
|
|
433893
434273
|
}
|
|
433894
|
-
function partKeyToPartName(
|
|
433895
|
-
if (
|
|
433896
|
-
return
|
|
433897
|
-
return `/${
|
|
434274
|
+
function partKeyToPartName(partKey2) {
|
|
434275
|
+
if (partKey2.startsWith("/"))
|
|
434276
|
+
return partKey2;
|
|
434277
|
+
return `/${partKey2.replace(/_/g, "/")}`;
|
|
433898
434278
|
}
|
|
433899
434279
|
function renderCommentBodyParagraphXml(paraId, bodyText) {
|
|
433900
434280
|
const lines = bodyText.split(`
|
|
@@ -434797,10 +435177,10 @@ function filterContentTypesForProjectedParts(contentTypes, activePartUris) {
|
|
|
434797
435177
|
return {
|
|
434798
435178
|
defaults: contentTypes.defaults,
|
|
434799
435179
|
overrides: contentTypes.overrides.filter((override) => {
|
|
434800
|
-
const
|
|
434801
|
-
if (!isCustomXmlPartKey(
|
|
435180
|
+
const partKey2 = normalizePartKey(override.partKey);
|
|
435181
|
+
if (!isCustomXmlPartKey(partKey2))
|
|
434802
435182
|
return true;
|
|
434803
|
-
return activePartKeys.has(
|
|
435183
|
+
return activePartKeys.has(partKey2);
|
|
434804
435184
|
})
|
|
434805
435185
|
};
|
|
434806
435186
|
}
|
|
@@ -434820,8 +435200,8 @@ function replaceContentTypesProjection(parts, contentTypes) {
|
|
|
434820
435200
|
function isCustomXmlPartUri(partUri) {
|
|
434821
435201
|
return /^\/customXml\//i.test(partUri);
|
|
434822
435202
|
}
|
|
434823
|
-
function isCustomXmlPartKey(
|
|
434824
|
-
return /^customXml_/i.test(
|
|
435203
|
+
function isCustomXmlPartKey(partKey2) {
|
|
435204
|
+
return /^customXml_/i.test(partKey2);
|
|
434825
435205
|
}
|
|
434826
435206
|
function resolveRelationshipTarget5(ownerPartUri, target) {
|
|
434827
435207
|
if (target.startsWith("/"))
|
|
@@ -437421,16 +437801,16 @@ function collectLiveTrackedWrapperSpans(atoms) {
|
|
|
437421
437801
|
}
|
|
437422
437802
|
if (openIndex < 0)
|
|
437423
437803
|
continue;
|
|
437424
|
-
const [
|
|
437804
|
+
const [open2] = openStack.splice(openIndex, 1);
|
|
437425
437805
|
spans.push({
|
|
437426
|
-
key:
|
|
437806
|
+
key: open2.key,
|
|
437427
437807
|
kind: info.kind,
|
|
437428
|
-
rsid:
|
|
437429
|
-
openAtom:
|
|
437808
|
+
rsid: open2.rsid,
|
|
437809
|
+
openAtom: open2.atom,
|
|
437430
437810
|
closeAtom: atom,
|
|
437431
|
-
startOffset:
|
|
437811
|
+
startOffset: open2.startOffset,
|
|
437432
437812
|
endOffset: atom.visibleOffset,
|
|
437433
|
-
sameKindParentKey:
|
|
437813
|
+
sameKindParentKey: open2.sameKindParentKey
|
|
437434
437814
|
});
|
|
437435
437815
|
}
|
|
437436
437816
|
return spans;
|
|
@@ -437861,8 +438241,8 @@ function pairedPartKeysOf(handle) {
|
|
|
437861
438241
|
}
|
|
437862
438242
|
return normalized;
|
|
437863
438243
|
}
|
|
437864
|
-
function normalizePartKey(
|
|
437865
|
-
return
|
|
438244
|
+
function normalizePartKey(partKey2) {
|
|
438245
|
+
return partKey2.replace(/^\/+/, "").replace(/\//g, "_");
|
|
437866
438246
|
}
|
|
437867
438247
|
function shouldEmitCommentsFamilyPart(pairedPartKeys, canonicalPartKey, hasRows) {
|
|
437868
438248
|
return hasRows || pairedPartKeys.has(normalizePartKey(canonicalPartKey));
|
|
@@ -437944,7 +438324,7 @@ function collectPackageParts(registry2, options) {
|
|
|
437944
438324
|
out.push({
|
|
437945
438325
|
partUri: commentsPartUri,
|
|
437946
438326
|
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
|
|
437947
|
-
content: { kind: "xml", xml: commentsSource ?
|
|
438327
|
+
content: { kind: "xml", xml: commentsSource ? TEXT_DECODER8.decode(commentsSource) : serializeCommentsXml(comments) }
|
|
437948
438328
|
});
|
|
437949
438329
|
}
|
|
437950
438330
|
const commentsExtendedSource = readCommentsSourcePart(readTarget, "/word/commentsExtended.xml");
|
|
@@ -437954,7 +438334,7 @@ function collectPackageParts(registry2, options) {
|
|
|
437954
438334
|
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",
|
|
437955
438335
|
content: {
|
|
437956
438336
|
kind: "xml",
|
|
437957
|
-
xml: commentsExtendedSource ?
|
|
438337
|
+
xml: commentsExtendedSource ? TEXT_DECODER8.decode(commentsExtendedSource) : serializeCommentsExtendedXml(comments)
|
|
437958
438338
|
}
|
|
437959
438339
|
});
|
|
437960
438340
|
}
|
|
@@ -437965,7 +438345,7 @@ function collectPackageParts(registry2, options) {
|
|
|
437965
438345
|
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",
|
|
437966
438346
|
content: {
|
|
437967
438347
|
kind: "xml",
|
|
437968
|
-
xml: commentsIdsSource ?
|
|
438348
|
+
xml: commentsIdsSource ? TEXT_DECODER8.decode(commentsIdsSource) : serializeCommentsIdsXml(comments)
|
|
437969
438349
|
}
|
|
437970
438350
|
});
|
|
437971
438351
|
}
|
|
@@ -437974,7 +438354,7 @@ function collectPackageParts(registry2, options) {
|
|
|
437974
438354
|
out.push({
|
|
437975
438355
|
partUri: "/word/people.xml",
|
|
437976
438356
|
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml",
|
|
437977
|
-
content: { kind: "xml", xml: peopleSource ?
|
|
438357
|
+
content: { kind: "xml", xml: peopleSource ? TEXT_DECODER8.decode(peopleSource) : serializePeopleXml(people) }
|
|
437978
438358
|
});
|
|
437979
438359
|
}
|
|
437980
438360
|
}
|
|
@@ -438086,7 +438466,7 @@ function canonicalStoryDigestInputs(stories) {
|
|
|
438086
438466
|
tableStructuralOverlays: [...story.tableStructuralOverlays ?? []].sort((left, right) => left.tableNodeId < right.tableNodeId ? -1 : left.tableNodeId > right.tableNodeId ? 1 : 0)
|
|
438087
438467
|
}));
|
|
438088
438468
|
}
|
|
438089
|
-
var WORD_ML_NS2 = 'xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"', WORD_ML_2010_NS = 'xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"', STORY_ROOT_NS,
|
|
438469
|
+
var WORD_ML_NS2 = 'xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"', WORD_ML_2010_NS = 'xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"', STORY_ROOT_NS, TEXT_DECODER8, STORY_BLOCK_INDEX_CACHE, SYNTHETIC_PARAGRAPH_BLOCK_ID_PREFIX4 = "__sd:paragraph:", UTF8_ENCODER3, SOURCE_XML_BYTE_ALIGNED_CACHE, XML_EMISSION_CONTEXTS, CONTENT_CONTROL_TOPOLOGIES, PROJECTED_NAMESPACE_CONTEXTS, TEXT_LOCAL_STORY_SNAPSHOTS, PARAGRAPH_PROPERTY_ORDER, RUN_PROPERTY_CONTENT_LOCAL_NAMES;
|
|
438090
438470
|
var init_materialize = __esm(() => {
|
|
438091
438471
|
init_package_part();
|
|
438092
438472
|
init_anchors();
|
|
@@ -438107,7 +438487,7 @@ var init_materialize = __esm(() => {
|
|
|
438107
438487
|
init_table_revision_decisions();
|
|
438108
438488
|
init_xml_emission_context();
|
|
438109
438489
|
STORY_ROOT_NS = `${WORD_ML_NS2} ${WORD_ML_2010_NS}`;
|
|
438110
|
-
|
|
438490
|
+
TEXT_DECODER8 = new TextDecoder("utf-8", { fatal: false });
|
|
438111
438491
|
STORY_BLOCK_INDEX_CACHE = new WeakMap;
|
|
438112
438492
|
UTF8_ENCODER3 = new TextEncoder;
|
|
438113
438493
|
SOURCE_XML_BYTE_ALIGNED_CACHE = new WeakMap;
|
|
@@ -438306,10 +438686,10 @@ function extensionOf(partUri) {
|
|
|
438306
438686
|
return null;
|
|
438307
438687
|
return partUri.slice(dot + 1).toLowerCase();
|
|
438308
438688
|
}
|
|
438309
|
-
function partKeyToPartUri(
|
|
438310
|
-
if (
|
|
438311
|
-
return
|
|
438312
|
-
return `/${
|
|
438689
|
+
function partKeyToPartUri(partKey2) {
|
|
438690
|
+
if (partKey2.startsWith("/"))
|
|
438691
|
+
return partKey2;
|
|
438692
|
+
return `/${partKey2.replace(/_/g, "/")}`;
|
|
438313
438693
|
}
|
|
438314
438694
|
var init_validator = __esm(() => {
|
|
438315
438695
|
init_reducer();
|
|
@@ -439590,13 +439970,13 @@ function createParagraphNamespaceBindingResolver(bytes, rootBindings) {
|
|
|
439590
439970
|
};
|
|
439591
439971
|
}
|
|
439592
439972
|
function readParagraphNamespaceBindings(bytes) {
|
|
439593
|
-
const xml =
|
|
439973
|
+
const xml = TEXT_DECODER9.decode(bytes);
|
|
439594
439974
|
const paragraphs = scanWmlParagraphSpans(xml).paragraphs;
|
|
439595
439975
|
const bindingsByByteStart = new Map;
|
|
439596
439976
|
let charCursor = 0;
|
|
439597
439977
|
let byteCursor = leadingBomLength(bytes);
|
|
439598
439978
|
for (const paragraph4 of paragraphs) {
|
|
439599
|
-
byteCursor +=
|
|
439979
|
+
byteCursor += TEXT_ENCODER4.encode(xml.slice(charCursor, paragraph4.openStart)).byteLength;
|
|
439600
439980
|
bindingsByByteStart.set(byteCursor, paragraph4.namespaceBindings);
|
|
439601
439981
|
charCursor = paragraph4.openStart;
|
|
439602
439982
|
}
|
|
@@ -439619,7 +439999,7 @@ function hasLocalBinding(xml, prefix) {
|
|
|
439619
439999
|
}
|
|
439620
440000
|
function countNamespaceDeclarations(bytes) {
|
|
439621
440001
|
const counts = new Map;
|
|
439622
|
-
const xml =
|
|
440002
|
+
const xml = TEXT_DECODER9.decode(bytes);
|
|
439623
440003
|
const declaration = /\bxmlns:([\w.-]+)\s*=/g;
|
|
439624
440004
|
let match;
|
|
439625
440005
|
while (match = declaration.exec(xml)) {
|
|
@@ -439634,11 +440014,11 @@ function escapeRegex17(value2) {
|
|
|
439634
440014
|
function leadingBomLength(bytes) {
|
|
439635
440015
|
return bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191 ? 3 : 0;
|
|
439636
440016
|
}
|
|
439637
|
-
var
|
|
440017
|
+
var TEXT_DECODER9, TEXT_ENCODER4;
|
|
439638
440018
|
var init_paragraph_namespace_bindings = __esm(() => {
|
|
439639
440019
|
init_sd_document_session_internal();
|
|
439640
|
-
|
|
439641
|
-
|
|
440020
|
+
TEXT_DECODER9 = new TextDecoder("utf-8", { fatal: false });
|
|
440021
|
+
TEXT_ENCODER4 = new TextEncoder;
|
|
439642
440022
|
});
|
|
439643
440023
|
|
|
439644
440024
|
// ../../../v2/collaboration-v2/dist/story-shard/table-structural-refs.js
|
|
@@ -445497,6 +445877,13 @@ async function encodeProjectionRecordAsDocx(input) {
|
|
|
445497
445877
|
const bytes = await resolveProjectedPartBytes(part.partUri, input.projectionRegistry, input.blobAdapter);
|
|
445498
445878
|
entries2.set(zipKey(part.partUri), bytes);
|
|
445499
445879
|
}
|
|
445880
|
+
const changes = sanitizeDocxPackageEntries(new Map([...entries2].map(([key2, bytes]) => [`/${key2}`, bytes])));
|
|
445881
|
+
for (const [partUri, bytes] of changes) {
|
|
445882
|
+
if (bytes === null)
|
|
445883
|
+
entries2.delete(zipKey(partUri));
|
|
445884
|
+
else
|
|
445885
|
+
entries2.set(zipKey(partUri), bytes);
|
|
445886
|
+
}
|
|
445500
445887
|
const ordered = {};
|
|
445501
445888
|
for (const key2 of [...entries2.keys()].sort()) {
|
|
445502
445889
|
ordered[key2] = entries2.get(key2);
|
|
@@ -445850,11 +446237,11 @@ function storySeedForSource(input) {
|
|
|
445850
446237
|
const trailingStart = rawParagraphs.at(-1)?.byteEnd ?? window2.byteStart;
|
|
445851
446238
|
return {
|
|
445852
446239
|
paragraphs,
|
|
445853
|
-
trailingXml:
|
|
446240
|
+
trailingXml: TEXT_DECODER10.decode(input.bytes.slice(trailingStart, window2.byteEnd))
|
|
445854
446241
|
};
|
|
445855
446242
|
}
|
|
445856
446243
|
function scanWmlParagraphSeedSpans(bytes) {
|
|
445857
|
-
const xml =
|
|
446244
|
+
const xml = TEXT_DECODER10.decode(bytes);
|
|
445858
446245
|
const scan = scanWmlParagraphSpans(xml);
|
|
445859
446246
|
if (!scan.ok)
|
|
445860
446247
|
return [];
|
|
@@ -445866,10 +446253,10 @@ function scanWmlParagraphSeedSpans(bytes) {
|
|
|
445866
446253
|
if (paragraph4.openStart < containingParagraphEnd)
|
|
445867
446254
|
continue;
|
|
445868
446255
|
const ordinal = spans.length;
|
|
445869
|
-
byteCursor +=
|
|
446256
|
+
byteCursor += TEXT_ENCODER5.encode(xml.slice(charCursor, paragraph4.openStart)).length;
|
|
445870
446257
|
const paragraphXml = xml.slice(paragraph4.openStart, paragraph4.closeEnd);
|
|
445871
446258
|
const byteStart = byteCursor;
|
|
445872
|
-
const byteEnd = byteStart +
|
|
446259
|
+
const byteEnd = byteStart + TEXT_ENCODER5.encode(paragraphXml).length;
|
|
445873
446260
|
spans.push({
|
|
445874
446261
|
xml: paragraphXml,
|
|
445875
446262
|
byteStart,
|
|
@@ -445913,7 +446300,7 @@ function addLeadingXml(bytes, storyKind, spans) {
|
|
|
445913
446300
|
const window2 = resolveStoryContentWindow2(bytes, storyKind, spans);
|
|
445914
446301
|
let cursor = window2.byteStart;
|
|
445915
446302
|
return spans.map((span) => {
|
|
445916
|
-
const leadingXml =
|
|
446303
|
+
const leadingXml = TEXT_DECODER10.decode(bytes.slice(cursor, span.byteStart));
|
|
445917
446304
|
cursor = span.byteEnd;
|
|
445918
446305
|
return {
|
|
445919
446306
|
...span,
|
|
@@ -445922,7 +446309,7 @@ function addLeadingXml(bytes, storyKind, spans) {
|
|
|
445922
446309
|
});
|
|
445923
446310
|
}
|
|
445924
446311
|
function scanParagraphXmlSpansLocal(bytes, storyKind) {
|
|
445925
|
-
const xml =
|
|
446312
|
+
const xml = TEXT_DECODER10.decode(bytes);
|
|
445926
446313
|
const spans = [];
|
|
445927
446314
|
const re = new RegExp(PARAGRAPH_REGEX.source, "g");
|
|
445928
446315
|
let match;
|
|
@@ -445933,10 +446320,10 @@ function scanParagraphXmlSpansLocal(bytes, storyKind) {
|
|
|
445933
446320
|
const paragraphXml = match[0];
|
|
445934
446321
|
const matchIndex = match.index ?? 0;
|
|
445935
446322
|
if (matchIndex > charCursor) {
|
|
445936
|
-
byteCursor +=
|
|
446323
|
+
byteCursor += TEXT_ENCODER5.encode(xml.slice(charCursor, matchIndex)).length;
|
|
445937
446324
|
}
|
|
445938
446325
|
const byteStart = byteCursor;
|
|
445939
|
-
const byteEnd = byteStart +
|
|
446326
|
+
const byteEnd = byteStart + TEXT_ENCODER5.encode(paragraphXml).length;
|
|
445940
446327
|
const openTag = paragraphXml.match(/^<[\w.-]+:p\b[^>]*[/]?>/)?.[0] ?? "";
|
|
445941
446328
|
const paraId = attrLocal3(openTag, "paraId");
|
|
445942
446329
|
spans.push({
|
|
@@ -445956,7 +446343,7 @@ function scanParagraphXmlSpansLocal(bytes, storyKind) {
|
|
|
445956
446343
|
return addLeadingXml(bytes, storyKind, spans);
|
|
445957
446344
|
}
|
|
445958
446345
|
function resolveStoryContentWindow2(bytes, storyKind, entries2) {
|
|
445959
|
-
const xml =
|
|
446346
|
+
const xml = TEXT_DECODER10.decode(bytes);
|
|
445960
446347
|
const root = extractRootEnvelope2(xml);
|
|
445961
446348
|
if (!root) {
|
|
445962
446349
|
return deriveContentWindowFromEntrySpans2(bytes, entries2);
|
|
@@ -446030,7 +446417,7 @@ function xmlDeclarationPrefixLength2(xml) {
|
|
|
446030
446417
|
function utf8ByteLength9(xml, codeUnitIndex) {
|
|
446031
446418
|
if (codeUnitIndex <= 0)
|
|
446032
446419
|
return 0;
|
|
446033
|
-
return
|
|
446420
|
+
return TEXT_ENCODER5.encode(xml.slice(0, codeUnitIndex)).length;
|
|
446034
446421
|
}
|
|
446035
446422
|
function leadingBomLength2(bytes) {
|
|
446036
446423
|
return bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191 ? 3 : 0;
|
|
@@ -446039,14 +446426,14 @@ function attrLocal3(tag, localName3) {
|
|
|
446039
446426
|
const re = new RegExp(String.raw`(?:[\w.-]+:)?${localName3}="([^"]+)"`);
|
|
446040
446427
|
return tag.match(re)?.[1] ?? null;
|
|
446041
446428
|
}
|
|
446042
|
-
var
|
|
446429
|
+
var TEXT_DECODER10, TEXT_ENCODER5, PARAGRAPH_REGEX;
|
|
446043
446430
|
var init_story_paragraph_seed = __esm(() => {
|
|
446044
446431
|
init_sd_document_session_internal();
|
|
446045
446432
|
init_parse_paragraph();
|
|
446046
446433
|
init_paragraph_namespace_bindings();
|
|
446047
446434
|
init_table_structural_refs();
|
|
446048
|
-
|
|
446049
|
-
|
|
446435
|
+
TEXT_DECODER10 = new TextDecoder("utf-8", { fatal: false });
|
|
446436
|
+
TEXT_ENCODER5 = new TextEncoder;
|
|
446050
446437
|
PARAGRAPH_REGEX = /<[\w.-]+:p\b[^>]*\/>|<[\w.-]+:p\b[^>]*>[\s\S]*?<\/[\w.-]+:p>/g;
|
|
446051
446438
|
});
|
|
446052
446439
|
|
|
@@ -446310,8 +446697,8 @@ function pruneReplacedRoomOrphans(root) {
|
|
|
446310
446697
|
return;
|
|
446311
446698
|
const seededIds = new Set(snapshot3.meta.contentUnitIds);
|
|
446312
446699
|
const orphanIds = snapshot3.shards.flatMap((shard) => {
|
|
446313
|
-
const
|
|
446314
|
-
return
|
|
446700
|
+
const partKey2 = shard.story?.sourcePartKey ?? shard.part?.partKey;
|
|
446701
|
+
return partKey2 && !parts.has(partKey2) && !seededIds.has(shard.shardId) ? [shard.shardId] : [];
|
|
446315
446702
|
});
|
|
446316
446703
|
if (orphanIds.length === 0)
|
|
446317
446704
|
return;
|
|
@@ -446705,7 +447092,7 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
446705
447092
|
return;
|
|
446706
447093
|
const manifest2 = collabUnitTargetOrDoc(ensureMediaManifestShard().handle);
|
|
446707
447094
|
const contentTypesBytes = getSDDocumentSessionInternalPartBytes(options.session, CONTENT_TYPES_PART_URI17);
|
|
446708
|
-
const contentTypes = contentTypesBytes ? parseContentTypes(
|
|
447095
|
+
const contentTypes = contentTypesBytes ? parseContentTypes(TEXT_DECODER11.decode(contentTypesBytes)) : null;
|
|
446709
447096
|
for (const [partUri, entry] of entries2) {
|
|
446710
447097
|
const assetId = assetIdForPartUri(partUri);
|
|
446711
447098
|
if (entry.kind === "remove") {
|
|
@@ -446725,10 +447112,10 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
446725
447112
|
sha256: payload.sha256,
|
|
446726
447113
|
...payload.mode === BINARY_MODE.blob ? { blobRef: payload.blobRef, byteLength: payload.byteLength } : { bytes }
|
|
446727
447114
|
});
|
|
446728
|
-
const
|
|
447115
|
+
const partKey2 = encodeLogicalOwnerKey(partUri);
|
|
446729
447116
|
ensureChildMap(getPartRecordsMap(manifest2), "assets").set(assetId, createMediaAssetRecord({
|
|
446730
447117
|
assetId,
|
|
446731
|
-
partKey,
|
|
447118
|
+
partKey: partKey2,
|
|
446732
447119
|
partUri,
|
|
446733
447120
|
contentType,
|
|
446734
447121
|
sha256: payload.sha256,
|
|
@@ -446738,8 +447125,8 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
446738
447125
|
mode: payload.mode,
|
|
446739
447126
|
hasBytes: true
|
|
446740
447127
|
}));
|
|
446741
|
-
ensureChildMap(getPartIndexMap(manifest2), "byPartKey").set(
|
|
446742
|
-
recordManifestPart({ partKey, partUri, partKind: "image", contentType, binary: true, uncompressedSize: bytes.byteLength });
|
|
447128
|
+
ensureChildMap(getPartIndexMap(manifest2), "byPartKey").set(partKey2, assetId);
|
|
447129
|
+
recordManifestPart({ partKey: partKey2, partUri, partKind: "image", contentType, binary: true, uncompressedSize: bytes.byteLength });
|
|
446743
447130
|
}
|
|
446744
447131
|
}
|
|
446745
447132
|
function syncPreparedListSidecar(sidecar) {
|
|
@@ -447046,7 +447433,7 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447046
447433
|
if (!rels) {
|
|
447047
447434
|
throw new Error(`relationships shard for ${partUri} could not be created`);
|
|
447048
447435
|
}
|
|
447049
|
-
const parsed = parseRelationshipsXml(
|
|
447436
|
+
const parsed = parseRelationshipsXml(TEXT_DECODER11.decode(bytes), {
|
|
447050
447437
|
ownerPartUri: ownerPartUri2,
|
|
447051
447438
|
relsUri: partUri,
|
|
447052
447439
|
resolveTarget(target, targetMode) {
|
|
@@ -447097,7 +447484,7 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447097
447484
|
recordManifestPart(relationshipsPartDescriptor(partUri, bytes.byteLength));
|
|
447098
447485
|
}
|
|
447099
447486
|
function syncContentTypesPart(bytes) {
|
|
447100
|
-
const parsed = parseContentTypes(
|
|
447487
|
+
const parsed = parseContentTypes(TEXT_DECODER11.decode(bytes));
|
|
447101
447488
|
const handle = requireContentTypesHandle();
|
|
447102
447489
|
resetPackagePartPayload(collabUnitTargetOrDoc(handle));
|
|
447103
447490
|
for (const [extension2, contentType] of parsed.defaults.entries()) {
|
|
@@ -447149,7 +447536,7 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447149
447536
|
}
|
|
447150
447537
|
function syncStylesPart(bytes) {
|
|
447151
447538
|
const handle = ensureStylesShard();
|
|
447152
|
-
const parsed = parseStylesPart2(
|
|
447539
|
+
const parsed = parseStylesPart2(TEXT_DECODER11.decode(bytes));
|
|
447153
447540
|
resetPackagePartPayload(collabUnitTargetOrDoc(handle));
|
|
447154
447541
|
updateDocumentDefaults(collabUnitTargetOrDoc(handle), parsed.documentDefaults);
|
|
447155
447542
|
for (const style of parsed.styles) {
|
|
@@ -447276,8 +447663,8 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447276
447663
|
}
|
|
447277
447664
|
if (!additiveInsert) {
|
|
447278
447665
|
const stalePartUris = [];
|
|
447279
|
-
for (const [
|
|
447280
|
-
const descriptor = toManifestPartDescriptor(
|
|
447666
|
+
for (const [partKey2, rawValue] of getPackagePartsMap(options.rootDoc).entries()) {
|
|
447667
|
+
const descriptor = toManifestPartDescriptor(partKey2, rawValue);
|
|
447281
447668
|
if (!descriptor)
|
|
447282
447669
|
continue;
|
|
447283
447670
|
if (descriptor.partKind !== "image" && descriptor.partKind !== "media")
|
|
@@ -447358,10 +447745,10 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447358
447745
|
options.graph.commentsHandle = null;
|
|
447359
447746
|
}
|
|
447360
447747
|
const descriptors = [];
|
|
447361
|
-
for (const [
|
|
447748
|
+
for (const [partKey2, rawValue] of getPackagePartsMap(options.rootDoc).entries()) {
|
|
447362
447749
|
if (disposed)
|
|
447363
447750
|
return;
|
|
447364
|
-
const descriptor = toManifestPartDescriptor(
|
|
447751
|
+
const descriptor = toManifestPartDescriptor(partKey2, rawValue);
|
|
447365
447752
|
if (!descriptor)
|
|
447366
447753
|
continue;
|
|
447367
447754
|
descriptors.push(descriptor);
|
|
@@ -447548,7 +447935,7 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447548
447935
|
});
|
|
447549
447936
|
}
|
|
447550
447937
|
const handle = options.graph.storyHandles.get(shardId);
|
|
447551
|
-
const xml =
|
|
447938
|
+
const xml = TEXT_DECODER11.decode(bytes);
|
|
447552
447939
|
const parsed = collectXmlElementRanges(xml);
|
|
447553
447940
|
const root = parsed.ranges.find((range) => range.tag.localName === (kind === "header" ? "hdr" : "ftr"));
|
|
447554
447941
|
if (!parsed.errors.length && root) {
|
|
@@ -449010,14 +449397,14 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
449010
449397
|
const existing = meta4.get(PACKAGE_PART_META_KEY.pairedPartKeys);
|
|
449011
449398
|
const merged = new Set;
|
|
449012
449399
|
if (Array.isArray(existing)) {
|
|
449013
|
-
for (const
|
|
449014
|
-
if (typeof
|
|
449015
|
-
merged.add(
|
|
449400
|
+
for (const partKey2 of existing) {
|
|
449401
|
+
if (typeof partKey2 === "string" && partKey2.length > 0)
|
|
449402
|
+
merged.add(partKey2);
|
|
449016
449403
|
}
|
|
449017
449404
|
}
|
|
449018
|
-
for (const
|
|
449019
|
-
if (
|
|
449020
|
-
merged.add(
|
|
449405
|
+
for (const partKey2 of pairedPartKeys) {
|
|
449406
|
+
if (partKey2.length > 0)
|
|
449407
|
+
merged.add(partKey2);
|
|
449021
449408
|
}
|
|
449022
449409
|
meta4.set(PACKAGE_PART_META_KEY.pairedPartKeys, Array.from(merged).sort());
|
|
449023
449410
|
}
|
|
@@ -449194,16 +449581,16 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
449194
449581
|
const records = getPartRecordsMap(doc2);
|
|
449195
449582
|
ensureChildMap(records, "fields");
|
|
449196
449583
|
ensureChildMap(records, "webFields");
|
|
449197
|
-
records.set("opaqueXml", settingsBytes ? innerXmlOfRoot(
|
|
449198
|
-
records.set("webOpaqueXml", webSettingsBytes ? innerXmlOfRoot(
|
|
449584
|
+
records.set("opaqueXml", settingsBytes ? innerXmlOfRoot(TEXT_DECODER11.decode(settingsBytes)) : null);
|
|
449585
|
+
records.set("webOpaqueXml", webSettingsBytes ? innerXmlOfRoot(TEXT_DECODER11.decode(webSettingsBytes)) : null);
|
|
449199
449586
|
}, "headless:collab-v2:settings-sync");
|
|
449200
449587
|
}
|
|
449201
449588
|
function writeOpaquePartSnapshot(doc2, partUri, payload) {
|
|
449202
|
-
const
|
|
449589
|
+
const partKey2 = encodeLogicalOwnerKey(partUri);
|
|
449203
449590
|
const committedAt = new Date().toISOString();
|
|
449204
449591
|
targetDurableDoc(doc2).transact(() => {
|
|
449205
449592
|
const opaque = getPartOpaqueMap(doc2);
|
|
449206
|
-
opaque.set("partKey",
|
|
449593
|
+
opaque.set("partKey", partKey2);
|
|
449207
449594
|
opaque.set("partUri", partUri);
|
|
449208
449595
|
opaque.set(OPAQUE_PART_KEY.contentType, contentTypeForPackagePart(partUri));
|
|
449209
449596
|
if (payload.mode === BINARY_MODE.blob) {
|
|
@@ -449273,12 +449660,12 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
449273
449660
|
return record3;
|
|
449274
449661
|
}
|
|
449275
449662
|
function retireBinaryPart(partUri) {
|
|
449276
|
-
const
|
|
449663
|
+
const partKey2 = encodeLogicalOwnerKey(partUri);
|
|
449277
449664
|
const shardId = packageShardId(options.rootId, SHARD_KIND.binary, partUri);
|
|
449278
|
-
const staleMediaDescriptorId = packageShardId(options.rootId, SHARD_KIND.mediaManifest,
|
|
449665
|
+
const staleMediaDescriptorId = packageShardId(options.rootId, SHARD_KIND.mediaManifest, partKey2);
|
|
449279
449666
|
options.rootDoc.transact(() => {
|
|
449280
449667
|
const parts = getPackagePartsMap(options.rootDoc);
|
|
449281
|
-
parts.delete(
|
|
449668
|
+
parts.delete(partKey2);
|
|
449282
449669
|
deleteShardDescriptor(options.rootDoc, shardId);
|
|
449283
449670
|
deleteShardDescriptor(options.rootDoc, staleMediaDescriptorId);
|
|
449284
449671
|
}, "headless:collab-v2:manifest-retire-binary");
|
|
@@ -449287,12 +449674,12 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
449287
449674
|
options.onRegistryChanged();
|
|
449288
449675
|
}
|
|
449289
449676
|
function retirePackagePart(partUri) {
|
|
449290
|
-
const
|
|
449677
|
+
const partKey2 = encodeLogicalOwnerKey(partUri);
|
|
449291
449678
|
const shardKind = shardKindForPackagePartUri(partUri);
|
|
449292
449679
|
const shardOwner = shardKind === SHARD_KIND.settings ? SETTINGS_PART_URI6 : partUri;
|
|
449293
449680
|
const shardId = packageShardId(options.rootId, shardKind, shardOwner);
|
|
449294
449681
|
options.rootDoc.transact(() => {
|
|
449295
|
-
getPackagePartsMap(options.rootDoc).delete(
|
|
449682
|
+
getPackagePartsMap(options.rootDoc).delete(partKey2);
|
|
449296
449683
|
deleteShardDescriptor(options.rootDoc, shardId);
|
|
449297
449684
|
}, "headless:collab-v2:manifest-retire-package-part");
|
|
449298
449685
|
options.graph.projectionHandles.delete(shardId);
|
|
@@ -449300,16 +449687,16 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
449300
449687
|
options.onRegistryChanged();
|
|
449301
449688
|
}
|
|
449302
449689
|
function retireStoryPart(partUri) {
|
|
449303
|
-
const
|
|
449690
|
+
const partKey2 = encodeLogicalOwnerKey(partUri);
|
|
449304
449691
|
const shardIds = new Set([...storyInfos.values()].filter((info) => info.partUri === partUri).map((info) => info.shardId));
|
|
449305
449692
|
const snapshot3 = readRoomManifest(options.rootDoc).snapshot;
|
|
449306
449693
|
for (const descriptor of snapshot3?.shards ?? []) {
|
|
449307
|
-
if (descriptor.shardKind === SHARD_KIND.story && descriptor.story?.sourcePartKey ===
|
|
449694
|
+
if (descriptor.shardKind === SHARD_KIND.story && descriptor.story?.sourcePartKey === partKey2) {
|
|
449308
449695
|
shardIds.add(descriptor.shardId);
|
|
449309
449696
|
}
|
|
449310
449697
|
}
|
|
449311
449698
|
options.rootDoc.transact(() => {
|
|
449312
|
-
getPackagePartsMap(options.rootDoc).delete(
|
|
449699
|
+
getPackagePartsMap(options.rootDoc).delete(partKey2);
|
|
449313
449700
|
for (const shardId of shardIds)
|
|
449314
449701
|
deleteShardDescriptor(options.rootDoc, shardId);
|
|
449315
449702
|
}, "headless:collab-v2:manifest-retire-story");
|
|
@@ -449501,12 +449888,12 @@ function shardKindForPackagePartUri(partUri) {
|
|
|
449501
449888
|
function isOpaqueManifestPartKind(partKind) {
|
|
449502
449889
|
return partKind === "customXml" || partKind === "customXmlProps" || partKind === "docProps" || partKind === "docProps-core" || partKind === "docProps-app" || partKind === "docProps-custom" || partKind === "fontTable" || partKind === "theme" || partKind === "webExtension" || partKind === "chart" || partKind === "diagram" || partKind === "comments-extensible" || partKind === "threaded-comments" || partKind === "unknown";
|
|
449503
449890
|
}
|
|
449504
|
-
function toManifestPartDescriptor(
|
|
449891
|
+
function toManifestPartDescriptor(partKey2, value2) {
|
|
449505
449892
|
if (!value2 || typeof value2 !== "object" || value2 instanceof YMap)
|
|
449506
449893
|
return null;
|
|
449507
449894
|
const record3 = value2;
|
|
449508
449895
|
return {
|
|
449509
|
-
partKey,
|
|
449896
|
+
partKey: partKey2,
|
|
449510
449897
|
partUri: String(record3.partUri ?? ""),
|
|
449511
449898
|
partKind: String(record3.partKind ?? ""),
|
|
449512
449899
|
contentType: record3.contentType == null ? null : String(record3.contentType),
|
|
@@ -449569,11 +449956,11 @@ function contentTypeForPackagePart(partUri) {
|
|
|
449569
449956
|
}
|
|
449570
449957
|
function innerXmlOfRoot(xml) {
|
|
449571
449958
|
const withoutDecl = xml.replace(/^\s*<\?xml[^>]*>\s*/i, "");
|
|
449572
|
-
const
|
|
449959
|
+
const open2 = /^<[^>]+>/.exec(withoutDecl);
|
|
449573
449960
|
const close = /<\/[^>]+>\s*$/.exec(withoutDecl);
|
|
449574
|
-
if (!
|
|
449961
|
+
if (!open2 || !close || close.index <= open2[0].length)
|
|
449575
449962
|
return withoutDecl;
|
|
449576
|
-
return withoutDecl.slice(
|
|
449963
|
+
return withoutDecl.slice(open2[0].length, close.index);
|
|
449577
449964
|
}
|
|
449578
449965
|
function attrLocal4(tag, localName3) {
|
|
449579
449966
|
const re = new RegExp(String.raw`(?:[\w.-]+:)?${localName3}="([^"]+)"`);
|
|
@@ -450171,15 +450558,15 @@ function xmlEscape2(value2) {
|
|
|
450171
450558
|
}
|
|
450172
450559
|
function listManifestPartUris(rootDoc, partKinds) {
|
|
450173
450560
|
const out = [];
|
|
450174
|
-
for (const [
|
|
450175
|
-
const descriptor = toManifestPartDescriptor(
|
|
450561
|
+
for (const [partKey2, rawValue] of getPackagePartsMap(rootDoc).entries()) {
|
|
450562
|
+
const descriptor = toManifestPartDescriptor(partKey2, rawValue);
|
|
450176
450563
|
if (!descriptor || !partKinds.includes(descriptor.partKind))
|
|
450177
450564
|
continue;
|
|
450178
450565
|
out.push(descriptor.partUri);
|
|
450179
450566
|
}
|
|
450180
450567
|
return out;
|
|
450181
450568
|
}
|
|
450182
|
-
var
|
|
450569
|
+
var TEXT_DECODER11, CONTENT_TYPES_PART_URI17 = "/[Content_Types].xml", NUMBERING_PART_URI6 = "/word/numbering.xml", SETTINGS_PART_URI6 = "/word/settings.xml", WEB_SETTINGS_PART_URI = "/word/webSettings.xml", MAIN_DOCUMENT_PART_URI2 = "/word/document.xml", MAIN_DOCUMENT_RELS_PART_URI = "/word/_rels/document.xml.rels", ROOT_RELS_PART_URI = "/_rels/.rels", COMMENTS_PART_URI5 = "/word/comments.xml", COMMENTS_EXTENDED_PART_URI5 = "/word/commentsExtended.xml", COMMENTS_IDS_PART_URI5 = "/word/commentsIds.xml", PEOPLE_PART_URI = "/word/people.xml", NOTES_FOOTNOTES_URI = "/word/footnotes.xml", NOTES_ENDNOTES_URI = "/word/endnotes.xml", MEDIA_OWNER_URI = "/word/media", REL_CONTENT_TYPE = "application/vnd.openxmlformats-package.relationships+xml", COMMENTS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", COMMENTS_EXTENDED_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", COMMENTS_IDS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml", PEOPLE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", NUMBERING_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", IMAGE_REL_TYPE4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", HYPERLINK_REL_TYPE4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", NUMBERING_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", FIRST_LIST_LEVEL_OPAQUE_XML = '<w:lvlJc w:val="left"/><w:pPr><w:ind w:left="720" w:hanging="360"/></w:pPr>';
|
|
450183
450570
|
var init_collaboration_v2_room_coordinator = __esm(() => {
|
|
450184
450571
|
init_yjs();
|
|
450185
450572
|
init_dist9();
|
|
@@ -450187,7 +450574,7 @@ var init_collaboration_v2_room_coordinator = __esm(() => {
|
|
|
450187
450574
|
init_collaboration_v2_room_state();
|
|
450188
450575
|
init_sd_document_session_internal();
|
|
450189
450576
|
init_dist9();
|
|
450190
|
-
|
|
450577
|
+
TEXT_DECODER11 = new TextDecoder("utf-8", { fatal: false });
|
|
450191
450578
|
});
|
|
450192
450579
|
|
|
450193
450580
|
// ../../../v2/headless/dist/internal/collaboration-v2-runtime.js
|
|
@@ -450895,7 +451282,7 @@ async function applyPreparedRoomReplacement(input) {
|
|
|
450895
451282
|
while (replacementQueue(input.rootDoc, input.replacement.operationId)[0]?.operationId !== input.replacement.operationId) {
|
|
450896
451283
|
await Promise.all([waitForReplacementQueueChange(input.rootDoc), input.resync()]);
|
|
450897
451284
|
}
|
|
450898
|
-
await new Promise((
|
|
451285
|
+
await new Promise((resolve2) => setTimeout(resolve2, input.settlingMs));
|
|
450899
451286
|
await input.resync();
|
|
450900
451287
|
if (replacementQueue(input.rootDoc, input.replacement.operationId)[0]?.operationId !== input.replacement.operationId) {
|
|
450901
451288
|
return applyPreparedRoomReplacement(input);
|
|
@@ -451063,12 +451450,12 @@ function replacementRequestKey(operationId) {
|
|
|
451063
451450
|
}
|
|
451064
451451
|
async function waitForReplacementQueueChange(rootDoc) {
|
|
451065
451452
|
const requests = getReplacementRequests(rootDoc);
|
|
451066
|
-
await new Promise((
|
|
451453
|
+
await new Promise((resolve2) => {
|
|
451067
451454
|
const timeout = setTimeout(finish, POST_SYNC_QUIET_WINDOW_MS);
|
|
451068
451455
|
function finish() {
|
|
451069
451456
|
clearTimeout(timeout);
|
|
451070
451457
|
requests.unobserveDeep(finish);
|
|
451071
|
-
|
|
451458
|
+
resolve2();
|
|
451072
451459
|
}
|
|
451073
451460
|
requests.observeDeep(finish);
|
|
451074
451461
|
});
|
|
@@ -451095,8 +451482,8 @@ function createOpenTrace(rootId) {
|
|
|
451095
451482
|
const mainBytes = getSDDocumentSessionInternalPartBytes(session, "/word/document.xml");
|
|
451096
451483
|
const mainIndex = getSDDocumentSessionInternalParagraphIndex(session);
|
|
451097
451484
|
const first = mainIndex?.entries[0] ?? null;
|
|
451098
|
-
const firstXml = first && mainBytes ?
|
|
451099
|
-
const mainXml = mainBytes ?
|
|
451485
|
+
const firstXml = first && mainBytes ? TEXT_DECODER12.decode(mainBytes.subarray(first.byteStart, first.byteEnd)) : "";
|
|
451486
|
+
const mainXml = mainBytes ? TEXT_DECODER12.decode(mainBytes) : "";
|
|
451100
451487
|
writeTraceLine(`[v2:open-collab] ${rootId} ${label} ` + `mainBytes=${mainBytes?.byteLength ?? -1} ` + `paragraphs=${mainIndex?.entries.length ?? -1} ` + `firstRange=${first ? `${first.byteStart}-${first.byteEnd}` : "none"} ` + `firstText=${JSON.stringify(firstXml.replace(/<[^>]+>/g, "").slice(0, 80))} ` + `borrowerOffset=${mainXml.indexOf("Borrower:")}
|
|
451101
451488
|
`);
|
|
451102
451489
|
}
|
|
@@ -451138,7 +451525,7 @@ async function buildCanonicalShardGraph(input) {
|
|
|
451138
451525
|
await waitForStoryShardSeeded(rootDoc, shardId);
|
|
451139
451526
|
unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.story });
|
|
451140
451527
|
}
|
|
451141
|
-
const storyBootstrap = bytes ? bootstrapStoryProjection(
|
|
451528
|
+
const storyBootstrap = bytes ? bootstrapStoryProjection(TEXT_DECODER12.decode(bytes), story.storyKind, {
|
|
451142
451529
|
includeSourceXml: true
|
|
451143
451530
|
}) : undefined;
|
|
451144
451531
|
if (input.retainImportedStorySources && maySeedStoryShardsFromLocalSource && storyBootstrap) {
|
|
@@ -451343,7 +451730,7 @@ async function connectRelationshipsShard(rootDoc, shardId, part) {
|
|
|
451343
451730
|
const unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.relationships });
|
|
451344
451731
|
if (part.bytes) {
|
|
451345
451732
|
const ownerPartUri2 = ownerPartUriForRels3(part.partUri);
|
|
451346
|
-
const xml =
|
|
451733
|
+
const xml = TEXT_DECODER12.decode(part.bytes);
|
|
451347
451734
|
const parsed = parseRelationshipsXml(xml, {
|
|
451348
451735
|
ownerPartUri: ownerPartUri2,
|
|
451349
451736
|
relsUri: part.partUri,
|
|
@@ -451375,7 +451762,7 @@ async function connectRelationshipsShard(rootDoc, shardId, part) {
|
|
|
451375
451762
|
async function connectContentTypesShard(rootDoc, shardId, part) {
|
|
451376
451763
|
const unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.contentTypes });
|
|
451377
451764
|
if (part.bytes) {
|
|
451378
|
-
const parsed = parseContentTypes(
|
|
451765
|
+
const parsed = parseContentTypes(TEXT_DECODER12.decode(part.bytes));
|
|
451379
451766
|
try {
|
|
451380
451767
|
seedContentTypesShard({
|
|
451381
451768
|
doc: unit,
|
|
@@ -451386,8 +451773,8 @@ async function connectContentTypesShard(rootDoc, shardId, part) {
|
|
|
451386
451773
|
extension: extension2,
|
|
451387
451774
|
contentType
|
|
451388
451775
|
})),
|
|
451389
|
-
overrides: Array.from(parsed.overrides.entries()).map(([
|
|
451390
|
-
partKey,
|
|
451776
|
+
overrides: Array.from(parsed.overrides.entries()).map(([partKey2, contentType]) => ({
|
|
451777
|
+
partKey: partKey2,
|
|
451391
451778
|
contentType
|
|
451392
451779
|
}))
|
|
451393
451780
|
});
|
|
@@ -451402,7 +451789,7 @@ async function connectStylesShard(rootDoc, shardId, part) {
|
|
|
451402
451789
|
const unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.styles });
|
|
451403
451790
|
let bootstrap;
|
|
451404
451791
|
if (part.bytes) {
|
|
451405
|
-
const xml =
|
|
451792
|
+
const xml = TEXT_DECODER12.decode(part.bytes);
|
|
451406
451793
|
const parsed = parseStylesPart3(xml);
|
|
451407
451794
|
bootstrap = bootstrapPartProjection(xml);
|
|
451408
451795
|
try {
|
|
@@ -451425,7 +451812,7 @@ async function connectNumberingShard(rootDoc, shardId, part, numbering) {
|
|
|
451425
451812
|
const unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.numbering });
|
|
451426
451813
|
let bootstrap;
|
|
451427
451814
|
if (part.bytes) {
|
|
451428
|
-
bootstrap = bootstrapPartProjection(
|
|
451815
|
+
bootstrap = bootstrapPartProjection(TEXT_DECODER12.decode(part.bytes));
|
|
451429
451816
|
}
|
|
451430
451817
|
if (part.bytes && numbering.present) {
|
|
451431
451818
|
try {
|
|
@@ -451465,8 +451852,8 @@ async function connectNumberingShard(rootDoc, shardId, part, numbering) {
|
|
|
451465
451852
|
}
|
|
451466
451853
|
async function connectSettingsShard(rootDoc, shardId, settingsPart, webSettingsPart) {
|
|
451467
451854
|
const unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.settings });
|
|
451468
|
-
const settingsBootstrap = settingsPart?.bytes ? bootstrapPartProjection(
|
|
451469
|
-
const webSettingsBootstrap = webSettingsPart?.bytes ? bootstrapPartProjection(
|
|
451855
|
+
const settingsBootstrap = settingsPart?.bytes ? bootstrapPartProjection(TEXT_DECODER12.decode(settingsPart.bytes)) : null;
|
|
451856
|
+
const webSettingsBootstrap = webSettingsPart?.bytes ? bootstrapPartProjection(TEXT_DECODER12.decode(webSettingsPart.bytes)) : null;
|
|
451470
451857
|
if (settingsPart?.bytes || webSettingsPart?.bytes) {
|
|
451471
451858
|
try {
|
|
451472
451859
|
seedSettingsShard({
|
|
@@ -451478,8 +451865,8 @@ async function connectSettingsShard(rootDoc, shardId, settingsPart, webSettingsP
|
|
|
451478
451865
|
settings: {
|
|
451479
451866
|
fields: {},
|
|
451480
451867
|
webFields: {},
|
|
451481
|
-
opaqueXml: settingsPart?.bytes ? innerXmlOfRoot2(
|
|
451482
|
-
webOpaqueXml: webSettingsPart?.bytes ? innerXmlOfRoot2(
|
|
451868
|
+
opaqueXml: settingsPart?.bytes ? innerXmlOfRoot2(TEXT_DECODER12.decode(settingsPart.bytes)) : null,
|
|
451869
|
+
webOpaqueXml: webSettingsPart?.bytes ? innerXmlOfRoot2(TEXT_DECODER12.decode(webSettingsPart.bytes)) : null
|
|
451483
451870
|
}
|
|
451484
451871
|
});
|
|
451485
451872
|
} catch (error50) {
|
|
@@ -451597,13 +451984,13 @@ async function waitForStoryShardSeeded(rootDoc, shardId) {
|
|
|
451597
451984
|
await waitForDocUpdateSettling(rootDoc);
|
|
451598
451985
|
return;
|
|
451599
451986
|
}
|
|
451600
|
-
await new Promise((
|
|
451987
|
+
await new Promise((resolve2) => setTimeout(resolve2, 10));
|
|
451601
451988
|
}
|
|
451602
451989
|
throw new Error(`collaboration story shard ${shardId} was not seeded by the room authority`);
|
|
451603
451990
|
}
|
|
451604
451991
|
async function waitForDocUpdateSettling(doc2, maxWaitMs = POST_SYNC_SETTLE_MAX_MS) {
|
|
451605
451992
|
const boundedMaxWaitMs = normalizeBootstrapSettlingMs(maxWaitMs);
|
|
451606
|
-
await new Promise((
|
|
451993
|
+
await new Promise((resolve2) => {
|
|
451607
451994
|
let settled = false;
|
|
451608
451995
|
let quietTimer = null;
|
|
451609
451996
|
const hardTimeout = setTimeout(finish, boundedMaxWaitMs);
|
|
@@ -451615,7 +452002,7 @@ async function waitForDocUpdateSettling(doc2, maxWaitMs = POST_SYNC_SETTLE_MAX_M
|
|
|
451615
452002
|
if (quietTimer)
|
|
451616
452003
|
clearTimeout(quietTimer);
|
|
451617
452004
|
doc2.off("update", onUpdate);
|
|
451618
|
-
|
|
452005
|
+
resolve2();
|
|
451619
452006
|
}
|
|
451620
452007
|
function armQuietWindow() {
|
|
451621
452008
|
if (quietTimer)
|
|
@@ -451946,7 +452333,7 @@ function formatLateJoinValidationFailure(validation) {
|
|
|
451946
452333
|
const diagnostics = validation.diagnostics.length > 0 ? validation.diagnostics.map((diagnostic2) => `${diagnostic2.code}: ${diagnostic2.message}`).join("; ") : "no diagnostics reported";
|
|
451947
452334
|
return `v2 collaboration late-join validation failed (${validation.classification.classification}, ${readiness}): ${diagnostics}`;
|
|
451948
452335
|
}
|
|
451949
|
-
var
|
|
452336
|
+
var TEXT_DECODER12, REPLACEMENT_REQUEST_KEY_PREFIX = "replaceFile:", REPLACEMENT_HEARTBEAT_INTERVAL_MS = 5000, REPLACEMENT_LEASE_TIMEOUT_MS = 30000, BOOTSTRAP_HEARTBEAT_INTERVAL_MS = 5000, BOOTSTRAP_LEASE_TIMEOUT_MS = 30000, BOOTSTRAP_LEASE_KEY_PREFIX = "bootstrapSeed:", SETTINGS_PART_URI7 = "/word/settings.xml", WEB_SETTINGS_PART_URI2 = "/word/webSettings.xml", COMMENTS_PART_URI6 = "/word/comments.xml", COMMENTS_EXTENDED_PART_URI6 = "/word/commentsExtended.xml", COMMENTS_IDS_PART_URI6 = "/word/commentsIds.xml", PEOPLE_PART_URI2 = "/word/people.xml", MEDIA_OWNER_URI2 = "/word/media", INLINE_BINARY_FAMILIES, OPAQUE_PART_FAMILIES, DEFAULT_OPEN_INTENT, POST_SYNC_SETTLE_MAX_MS = 1000, POST_SYNC_QUIET_WINDOW_MS = 20, replacementSequence = 0, replacementHeartbeatObservations;
|
|
451950
452337
|
var init_collaboration_v2_open = __esm(() => {
|
|
451951
452338
|
init_dist9();
|
|
451952
452339
|
init_setup();
|
|
@@ -451957,7 +452344,7 @@ var init_collaboration_v2_open = __esm(() => {
|
|
|
451957
452344
|
init_yjs();
|
|
451958
452345
|
init_collaboration_v2_room_state();
|
|
451959
452346
|
init_collaboration_v2_runtime();
|
|
451960
|
-
|
|
452347
|
+
TEXT_DECODER12 = new TextDecoder("utf-8", { fatal: false });
|
|
451961
452348
|
INLINE_BINARY_FAMILIES = new Set(["image", "media", "embedded", "oleObject", "vbaProject", "vbaData"]);
|
|
451962
452349
|
OPAQUE_PART_FAMILIES = new Set([
|
|
451963
452350
|
"fontTable",
|
|
@@ -452779,7 +453166,7 @@ var init_dist10 = __esm(() => {
|
|
|
452779
453166
|
// src/session-manager.ts
|
|
452780
453167
|
import { access, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
|
|
452781
453168
|
import { randomBytes } from "node:crypto";
|
|
452782
|
-
import { dirname, resolve, basename } from "node:path";
|
|
453169
|
+
import { dirname, resolve as resolve2, basename } from "node:path";
|
|
452783
453170
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
452784
453171
|
|
|
452785
453172
|
class SessionManager {
|
|
@@ -452789,7 +453176,7 @@ class SessionManager {
|
|
|
452789
453176
|
this.author = author;
|
|
452790
453177
|
}
|
|
452791
453178
|
async open(filePath) {
|
|
452792
|
-
const absolutePath =
|
|
453179
|
+
const absolutePath = resolve2(filePath);
|
|
452793
453180
|
const bytes = await readDocumentBytesOrBlank(absolutePath);
|
|
452794
453181
|
const { openV2DocumentApiHost: openV2DocumentApiHost2 } = await loadV2HeadlessRuntime();
|
|
452795
453182
|
const host = await openV2DocumentApiHost2({
|
|
@@ -452819,7 +453206,7 @@ class SessionManager {
|
|
|
452819
453206
|
}
|
|
452820
453207
|
async save(sessionId, outputPath) {
|
|
452821
453208
|
const session = this.get(sessionId);
|
|
452822
|
-
const targetPath = outputPath ?
|
|
453209
|
+
const targetPath = outputPath ? resolve2(outputPath) : session.filePath;
|
|
452823
453210
|
const { saveDocumentSessionWithDiagnostics: saveDocumentSessionWithDiagnostics2 } = await loadV2HeadlessRuntime();
|
|
452824
453211
|
const exported = saveDocumentSessionWithDiagnostics2(session.host.session);
|
|
452825
453212
|
await writeFile2(targetPath, exported.bytes);
|
|
@@ -452852,7 +453239,7 @@ async function readDocumentBytesOrBlank(absolutePath) {
|
|
|
452852
453239
|
const bytes = await readFile3(absolutePath);
|
|
452853
453240
|
return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
452854
453241
|
} catch {
|
|
452855
|
-
const blankPath =
|
|
453242
|
+
const blankPath = resolve2(MODULE_DIR3, "../../../shared/common/data/blank.docx");
|
|
452856
453243
|
const bytes = await readFile3(blankPath);
|
|
452857
453244
|
return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
452858
453245
|
}
|