@superdoc-dev/mcp 0.11.0-next.13 → 0.11.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 +2631 -1381
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -52211,7 +52211,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
52211
52211
|
emptyOptions2 = {};
|
|
52212
52212
|
});
|
|
52213
52213
|
|
|
52214
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
52214
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-DOoAJ6Zk.es.js
|
|
52215
52215
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
52216
52216
|
const fieldValue = extension$1.config[field];
|
|
52217
52217
|
if (typeof fieldValue === "function")
|
|
@@ -86325,6 +86325,315 @@ function translateMark(mark) {
|
|
|
86325
86325
|
}
|
|
86326
86326
|
return markElement;
|
|
86327
86327
|
}
|
|
86328
|
+
function isSettled(status) {
|
|
86329
|
+
return SETTLED_STATUSES.includes(status);
|
|
86330
|
+
}
|
|
86331
|
+
function normalizeFamilyKey$1(family$1) {
|
|
86332
|
+
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
86333
|
+
}
|
|
86334
|
+
function sortPairs(pairs) {
|
|
86335
|
+
return pairs.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
86336
|
+
}
|
|
86337
|
+
function deriveBundledSubstitutes() {
|
|
86338
|
+
const substitutes = {};
|
|
86339
|
+
for (const row of SUBSTITUTION_EVIDENCE)
|
|
86340
|
+
if (row.policyAction === "substitute" && row.physicalFamily)
|
|
86341
|
+
substitutes[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
|
|
86342
|
+
return Object.freeze(substitutes);
|
|
86343
|
+
}
|
|
86344
|
+
function deriveCategoryFallbacks() {
|
|
86345
|
+
const fallbacks = {};
|
|
86346
|
+
for (const row of SUBSTITUTION_EVIDENCE)
|
|
86347
|
+
if (row.policyAction === "category_fallback" && row.physicalFamily)
|
|
86348
|
+
fallbacks[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
|
|
86349
|
+
return Object.freeze(fallbacks);
|
|
86350
|
+
}
|
|
86351
|
+
function stripFamilyQuotes(family$1) {
|
|
86352
|
+
return family$1.trim().replace(/^["']|["']$/g, "");
|
|
86353
|
+
}
|
|
86354
|
+
function splitStack(cssFontFamily) {
|
|
86355
|
+
return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
|
|
86356
|
+
}
|
|
86357
|
+
function createFontResolver() {
|
|
86358
|
+
return new FontResolver;
|
|
86359
|
+
}
|
|
86360
|
+
function resolveFontFamily(logicalFamily) {
|
|
86361
|
+
return defaultResolver.resolveFontFamily(logicalFamily);
|
|
86362
|
+
}
|
|
86363
|
+
function resolvePhysicalFamily(cssFontFamily) {
|
|
86364
|
+
return defaultResolver.resolvePhysicalFamily(cssFontFamily);
|
|
86365
|
+
}
|
|
86366
|
+
function resolveFace(logicalFamily, face, hasFace) {
|
|
86367
|
+
return defaultResolver.resolveFace(logicalFamily, face, hasFace);
|
|
86368
|
+
}
|
|
86369
|
+
function getFontConfigVersion() {
|
|
86370
|
+
return fontConfigVersion;
|
|
86371
|
+
}
|
|
86372
|
+
function bumpFontConfigVersion() {
|
|
86373
|
+
return fontConfigVersion += 1;
|
|
86374
|
+
}
|
|
86375
|
+
function fourFaces(filePrefix) {
|
|
86376
|
+
return [
|
|
86377
|
+
{
|
|
86378
|
+
weight: "normal",
|
|
86379
|
+
style: "normal",
|
|
86380
|
+
file: `${filePrefix}-Regular.woff2`
|
|
86381
|
+
},
|
|
86382
|
+
{
|
|
86383
|
+
weight: "bold",
|
|
86384
|
+
style: "normal",
|
|
86385
|
+
file: `${filePrefix}-Bold.woff2`
|
|
86386
|
+
},
|
|
86387
|
+
{
|
|
86388
|
+
weight: "normal",
|
|
86389
|
+
style: "italic",
|
|
86390
|
+
file: `${filePrefix}-Italic.woff2`
|
|
86391
|
+
},
|
|
86392
|
+
{
|
|
86393
|
+
weight: "bold",
|
|
86394
|
+
style: "italic",
|
|
86395
|
+
file: `${filePrefix}-BoldItalic.woff2`
|
|
86396
|
+
}
|
|
86397
|
+
];
|
|
86398
|
+
}
|
|
86399
|
+
function family(name, filePrefix, license) {
|
|
86400
|
+
return {
|
|
86401
|
+
family: name,
|
|
86402
|
+
license,
|
|
86403
|
+
faces: fourFaces(filePrefix)
|
|
86404
|
+
};
|
|
86405
|
+
}
|
|
86406
|
+
function withTrailingSlash(base$1) {
|
|
86407
|
+
return base$1.endsWith("/") ? base$1 : `${base$1}/`;
|
|
86408
|
+
}
|
|
86409
|
+
function joinUrl(base$1, file2) {
|
|
86410
|
+
return `${withTrailingSlash(base$1)}${file2}`;
|
|
86411
|
+
}
|
|
86412
|
+
function weightToken(weight) {
|
|
86413
|
+
return weight === "bold" ? "700" : "400";
|
|
86414
|
+
}
|
|
86415
|
+
function bundledAssetSignature(resolve) {
|
|
86416
|
+
const family$1 = BUNDLED_MANIFEST[0];
|
|
86417
|
+
const face = family$1?.faces[0];
|
|
86418
|
+
if (!family$1 || !face)
|
|
86419
|
+
return "";
|
|
86420
|
+
return resolve({
|
|
86421
|
+
file: face.file,
|
|
86422
|
+
family: family$1.family,
|
|
86423
|
+
weight: weightToken(face.weight),
|
|
86424
|
+
style: face.style,
|
|
86425
|
+
source: "bundled-substitute"
|
|
86426
|
+
});
|
|
86427
|
+
}
|
|
86428
|
+
function installBundledSubstitutes(registry2, options = {}) {
|
|
86429
|
+
const resolve = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
|
|
86430
|
+
const signature = bundledAssetSignature(resolve);
|
|
86431
|
+
const installed = installedRegistries.get(registry2);
|
|
86432
|
+
if (installed !== undefined) {
|
|
86433
|
+
if (installed !== signature)
|
|
86434
|
+
console.warn(`[superdoc] bundled fonts are already registered for this document from "${installed}"; a later fonts config resolving to "${signature}" is ignored. Use one fonts.assetBaseUrl / fonts.resolveAssetUrl per document.`);
|
|
86435
|
+
return;
|
|
86436
|
+
}
|
|
86437
|
+
installedRegistries.set(registry2, signature);
|
|
86438
|
+
for (const family$1 of BUNDLED_MANIFEST)
|
|
86439
|
+
for (const face of family$1.faces) {
|
|
86440
|
+
const context = {
|
|
86441
|
+
file: face.file,
|
|
86442
|
+
family: family$1.family,
|
|
86443
|
+
weight: weightToken(face.weight),
|
|
86444
|
+
style: face.style,
|
|
86445
|
+
source: "bundled-substitute"
|
|
86446
|
+
};
|
|
86447
|
+
registry2.register({
|
|
86448
|
+
family: family$1.family,
|
|
86449
|
+
source: `url(${resolve(context)})`,
|
|
86450
|
+
descriptors: {
|
|
86451
|
+
weight: face.weight,
|
|
86452
|
+
style: face.style
|
|
86453
|
+
}
|
|
86454
|
+
});
|
|
86455
|
+
}
|
|
86456
|
+
}
|
|
86457
|
+
function buildFontReport(logicalFamilies, registry2, resolver$1) {
|
|
86458
|
+
const seen = /* @__PURE__ */ new Set;
|
|
86459
|
+
const report = [];
|
|
86460
|
+
for (const logical of logicalFamilies) {
|
|
86461
|
+
if (!logical || seen.has(logical))
|
|
86462
|
+
continue;
|
|
86463
|
+
seen.add(logical);
|
|
86464
|
+
const { physicalFamily, reason } = resolver$1 ? resolver$1.resolveFontFamily(logical) : resolveFontFamily(logical);
|
|
86465
|
+
const loadStatus = registry2.getStatus(physicalFamily);
|
|
86466
|
+
report.push({
|
|
86467
|
+
logicalFamily: logical,
|
|
86468
|
+
physicalFamily,
|
|
86469
|
+
reason,
|
|
86470
|
+
loadStatus,
|
|
86471
|
+
exportFamily: logical,
|
|
86472
|
+
missing: reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded"
|
|
86473
|
+
});
|
|
86474
|
+
}
|
|
86475
|
+
return report;
|
|
86476
|
+
}
|
|
86477
|
+
function buildFaceReport(usedFaces, registry2, resolver$1) {
|
|
86478
|
+
const hasFace = (family$1, weight, style) => registry2.hasFace(family$1, weight, style);
|
|
86479
|
+
const seen = /* @__PURE__ */ new Set;
|
|
86480
|
+
const report = [];
|
|
86481
|
+
for (const { logicalFamily, weight, style } of usedFaces) {
|
|
86482
|
+
if (!logicalFamily)
|
|
86483
|
+
continue;
|
|
86484
|
+
const key = `${logicalFamily.toLowerCase()}|${weight}|${style}`;
|
|
86485
|
+
if (seen.has(key))
|
|
86486
|
+
continue;
|
|
86487
|
+
seen.add(key);
|
|
86488
|
+
const face = {
|
|
86489
|
+
weight,
|
|
86490
|
+
style
|
|
86491
|
+
};
|
|
86492
|
+
const { physicalFamily, reason } = resolver$1 ? resolver$1.resolveFace(logicalFamily, face, hasFace) : resolveFace(logicalFamily, face, hasFace);
|
|
86493
|
+
const loadStatus = registry2.getFaceStatus({
|
|
86494
|
+
family: physicalFamily,
|
|
86495
|
+
weight,
|
|
86496
|
+
style
|
|
86497
|
+
});
|
|
86498
|
+
const missing = reason === "fallback_face_absent" || reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded";
|
|
86499
|
+
report.push({
|
|
86500
|
+
logicalFamily,
|
|
86501
|
+
physicalFamily: reason === "registered_face" ? logicalFamily : physicalFamily,
|
|
86502
|
+
reason,
|
|
86503
|
+
loadStatus,
|
|
86504
|
+
exportFamily: logicalFamily,
|
|
86505
|
+
missing,
|
|
86506
|
+
face
|
|
86507
|
+
});
|
|
86508
|
+
}
|
|
86509
|
+
return report;
|
|
86510
|
+
}
|
|
86511
|
+
function parseEmbeddingPolicy(bytes) {
|
|
86512
|
+
const view = bytes instanceof ArrayBuffer ? new DataView(bytes) : new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
86513
|
+
if (view.byteLength < SFNT_TABLE_DIR_OFFSET)
|
|
86514
|
+
return null;
|
|
86515
|
+
const numTables = view.getUint16(4);
|
|
86516
|
+
let os2Offset = -1;
|
|
86517
|
+
for (let i$1 = 0;i$1 < numTables; i$1 += 1) {
|
|
86518
|
+
const record3 = SFNT_TABLE_DIR_OFFSET + i$1 * SFNT_TABLE_RECORD_SIZE;
|
|
86519
|
+
if (record3 + SFNT_TABLE_RECORD_SIZE > view.byteLength)
|
|
86520
|
+
return null;
|
|
86521
|
+
if (String.fromCharCode(view.getUint8(record3), view.getUint8(record3 + 1), view.getUint8(record3 + 2), view.getUint8(record3 + 3)) === "OS/2") {
|
|
86522
|
+
os2Offset = view.getUint32(record3 + 8);
|
|
86523
|
+
break;
|
|
86524
|
+
}
|
|
86525
|
+
}
|
|
86526
|
+
if (os2Offset < 0 || os2Offset + OS2_MIN_LENGTH > view.byteLength)
|
|
86527
|
+
return null;
|
|
86528
|
+
const usWeightClass = view.getUint16(os2Offset + OS2_USWEIGHTCLASS);
|
|
86529
|
+
const fsType = view.getUint16(os2Offset + OS2_FSTYPE);
|
|
86530
|
+
const fsSelection = view.getUint16(os2Offset + OS2_FSSELECTION);
|
|
86531
|
+
return {
|
|
86532
|
+
fsType,
|
|
86533
|
+
face: {
|
|
86534
|
+
weight: usWeightClass >= BOLD_WEIGHT_THRESHOLD ? "700" : "400",
|
|
86535
|
+
style: (fsSelection & FS_SELECTION_ITALIC) !== 0 ? "italic" : "normal"
|
|
86536
|
+
},
|
|
86537
|
+
embeddable: (fsType & FS_TYPE_RESTRICTED) === 0
|
|
86538
|
+
};
|
|
86539
|
+
}
|
|
86540
|
+
function quoteFamily(family$1) {
|
|
86541
|
+
return `"${family$1.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
86542
|
+
}
|
|
86543
|
+
function canonicalizeFontSource(source) {
|
|
86544
|
+
const match = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
|
|
86545
|
+
if (!match)
|
|
86546
|
+
return source;
|
|
86547
|
+
let inner = match[1].trim();
|
|
86548
|
+
if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'"))
|
|
86549
|
+
inner = inner.slice(1, -1);
|
|
86550
|
+
return `url(${JSON.stringify(inner)})`;
|
|
86551
|
+
}
|
|
86552
|
+
function normalizeFamilyKey(family$1) {
|
|
86553
|
+
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
86554
|
+
}
|
|
86555
|
+
function normalizeWeight(weight) {
|
|
86556
|
+
if (weight === undefined)
|
|
86557
|
+
return "400";
|
|
86558
|
+
const w = String(weight).trim().toLowerCase();
|
|
86559
|
+
if (w === "bold" || w === "bolder")
|
|
86560
|
+
return "700";
|
|
86561
|
+
const n = Number(w);
|
|
86562
|
+
return Number.isFinite(n) && n >= 600 ? "700" : "400";
|
|
86563
|
+
}
|
|
86564
|
+
function normalizeStyle(style) {
|
|
86565
|
+
if (!style)
|
|
86566
|
+
return "normal";
|
|
86567
|
+
const s = style.trim().toLowerCase();
|
|
86568
|
+
return s.startsWith("italic") || s.startsWith("oblique") ? "italic" : "normal";
|
|
86569
|
+
}
|
|
86570
|
+
function faceKeyOf(family$1, weight, style) {
|
|
86571
|
+
return `${normalizeFamilyKey(family$1)}|${weight}|${style}`;
|
|
86572
|
+
}
|
|
86573
|
+
function faceProbe(family$1, weight, style, size) {
|
|
86574
|
+
return `${style === "italic" ? "italic " : ""}${weight} ${size} ${quoteFamily(family$1)}`;
|
|
86575
|
+
}
|
|
86576
|
+
function getFontRegistryFor(fontSet, FontFaceCtor) {
|
|
86577
|
+
if (!fontSet) {
|
|
86578
|
+
if (!domlessRegistry)
|
|
86579
|
+
domlessRegistry = new FontRegistry({});
|
|
86580
|
+
return domlessRegistry;
|
|
86581
|
+
}
|
|
86582
|
+
let registry2 = registriesByFontSet.get(fontSet);
|
|
86583
|
+
if (!registry2) {
|
|
86584
|
+
registry2 = new FontRegistry({
|
|
86585
|
+
fontSet,
|
|
86586
|
+
FontFaceCtor
|
|
86587
|
+
});
|
|
86588
|
+
registriesByFontSet.set(fontSet, registry2);
|
|
86589
|
+
}
|
|
86590
|
+
return registry2;
|
|
86591
|
+
}
|
|
86592
|
+
function classifyOffering(policyAction, verdict, physicalFamily, bundled) {
|
|
86593
|
+
if (policyAction === "preserve_only")
|
|
86594
|
+
return "preserve_only";
|
|
86595
|
+
if (policyAction === "customer_supplied" || physicalFamily == null)
|
|
86596
|
+
return "customer_supplied";
|
|
86597
|
+
if (policyAction === "category_fallback")
|
|
86598
|
+
return "category_fallback";
|
|
86599
|
+
if (!bundled)
|
|
86600
|
+
return "requires_asset";
|
|
86601
|
+
return verdict === "metric_safe" ? "default" : "qualified";
|
|
86602
|
+
}
|
|
86603
|
+
function deriveOfferings() {
|
|
86604
|
+
const offerings = SUBSTITUTION_EVIDENCE.map((row) => {
|
|
86605
|
+
const bundled = row.physicalFamily != null && BUNDLED_FAMILIES.has(row.physicalFamily);
|
|
86606
|
+
return {
|
|
86607
|
+
logicalFamily: row.logicalFamily,
|
|
86608
|
+
physicalFamily: row.physicalFamily,
|
|
86609
|
+
generic: row.physicalFamily && PHYSICAL_GENERIC[row.physicalFamily] || "sans-serif",
|
|
86610
|
+
offering: classifyOffering(row.policyAction, row.verdict, row.physicalFamily, bundled),
|
|
86611
|
+
bundled,
|
|
86612
|
+
verdict: row.verdict,
|
|
86613
|
+
evidenceId: row.evidenceId
|
|
86614
|
+
};
|
|
86615
|
+
});
|
|
86616
|
+
return Object.freeze(offerings);
|
|
86617
|
+
}
|
|
86618
|
+
function getDefaultFontOfferings() {
|
|
86619
|
+
const rank$1 = (name) => {
|
|
86620
|
+
const i$1 = DEFAULT_FONT_ORDER.indexOf(name);
|
|
86621
|
+
return i$1 === -1 ? DEFAULT_FONT_ORDER.length : i$1;
|
|
86622
|
+
};
|
|
86623
|
+
return FONT_OFFERINGS.filter((o) => o.offering === "default").sort((a, b) => rank$1(a.logicalFamily) - rank$1(b.logicalFamily));
|
|
86624
|
+
}
|
|
86625
|
+
function fontOfferingStack(offering) {
|
|
86626
|
+
return `${offering.logicalFamily}, ${offering.generic}`;
|
|
86627
|
+
}
|
|
86628
|
+
function fontOfferingRenderStack(offering) {
|
|
86629
|
+
return offering.physicalFamily ? `${offering.physicalFamily}, ${offering.generic}` : fontOfferingStack(offering);
|
|
86630
|
+
}
|
|
86631
|
+
function getDefaultFontFamilyOptions() {
|
|
86632
|
+
return getDefaultFontOfferings().map((offering) => ({
|
|
86633
|
+
label: offering.logicalFamily,
|
|
86634
|
+
value: fontOfferingStack(offering)
|
|
86635
|
+
}));
|
|
86636
|
+
}
|
|
86328
86637
|
function writeAppStatistics(convertedXml, stats) {
|
|
86329
86638
|
const elements = ensureElements$1(ensureAppPropertiesRoot(convertedXml));
|
|
86330
86639
|
upsertSimpleElement(elements, "Words", String(stats.words));
|
|
@@ -92111,6 +92420,9 @@ function writeSectPrPageNumbering(sectPr, numbering) {
|
|
|
92111
92420
|
if (numbering.chapterSeparator !== undefined)
|
|
92112
92421
|
setStringAttr(pgNumType, "w:chapSep", numbering.chapterSeparator);
|
|
92113
92422
|
}
|
|
92423
|
+
function readSectPrTitlePage(sectPr) {
|
|
92424
|
+
return Boolean(findChild(sectPr, "w:titlePg"));
|
|
92425
|
+
}
|
|
92114
92426
|
function writeSectPrTitlePage(sectPr, enabled) {
|
|
92115
92427
|
if (enabled) {
|
|
92116
92428
|
ensureChild(sectPr, "w:titlePg");
|
|
@@ -94792,6 +95104,13 @@ function getTextAdapter(editor, input) {
|
|
|
94792
95104
|
`, `
|
|
94793
95105
|
`, { textModel: "visible" });
|
|
94794
95106
|
}
|
|
95107
|
+
function projectInternalTrackChangeType(type, structural) {
|
|
95108
|
+
if (type !== "structural")
|
|
95109
|
+
return type;
|
|
95110
|
+
if (structural?.subtype === "table-delete" || structural?.side === "deletion")
|
|
95111
|
+
return "delete";
|
|
95112
|
+
return "insert";
|
|
95113
|
+
}
|
|
94795
95114
|
function rangesOverlap(a, b) {
|
|
94796
95115
|
return a[0] < b[1] && b[0] < a[1];
|
|
94797
95116
|
}
|
|
@@ -94895,17 +95214,18 @@ function buildPublicTrackedChangeIdMap(grouped, replacements) {
|
|
|
94895
95214
|
return publicIdByChange;
|
|
94896
95215
|
}
|
|
94897
95216
|
function layerFromChange(change, relationship) {
|
|
95217
|
+
const type = resolveTrackedChangeType(change);
|
|
94898
95218
|
return {
|
|
94899
95219
|
id: change.id,
|
|
94900
95220
|
rawId: change.rawId,
|
|
94901
95221
|
commandRawId: change.commandRawId,
|
|
94902
|
-
type:
|
|
95222
|
+
type: projectInternalTrackChangeType(type, change.structural),
|
|
94903
95223
|
relationship
|
|
94904
95224
|
};
|
|
94905
95225
|
}
|
|
94906
95226
|
function compareOverlapChildren(a, b) {
|
|
94907
|
-
const aType = resolveTrackedChangeType(a);
|
|
94908
|
-
const bType = resolveTrackedChangeType(b);
|
|
95227
|
+
const aType = projectInternalTrackChangeType(resolveTrackedChangeType(a), a.structural);
|
|
95228
|
+
const bType = projectInternalTrackChangeType(resolveTrackedChangeType(b), b.structural);
|
|
94909
95229
|
if (aType !== bType) {
|
|
94910
95230
|
if (aType === "delete")
|
|
94911
95231
|
return -1;
|
|
@@ -98749,7 +99069,7 @@ var isRegExp = (value) => {
|
|
|
98749
99069
|
if (encodedAttrs && Object.keys(encodedAttrs).length > 0)
|
|
98750
99070
|
translated.attrs = { ...encodedAttrs };
|
|
98751
99071
|
return translated;
|
|
98752
|
-
}, config$35, translator$4, EAST_ASIAN_CHARACTER_REGEX, containsEastAsianCharacters = (text$2) => EAST_ASIAN_CHARACTER_REGEX.test(text$2), resolveFontFamily = (textStyleAttrs, text$2) => {
|
|
99072
|
+
}, config$35, translator$4, EAST_ASIAN_CHARACTER_REGEX, containsEastAsianCharacters = (text$2) => EAST_ASIAN_CHARACTER_REGEX.test(text$2), resolveFontFamily$1 = (textStyleAttrs, text$2) => {
|
|
98753
99073
|
if (!text$2)
|
|
98754
99074
|
return textStyleAttrs;
|
|
98755
99075
|
const eastAsiaFont = textStyleAttrs?.eastAsiaFontFamily;
|
|
@@ -99562,7 +99882,7 @@ var isRegExp = (value) => {
|
|
|
99562
99882
|
...textStyleMark.attrs || {},
|
|
99563
99883
|
...mark.attrs || {}
|
|
99564
99884
|
};
|
|
99565
|
-
textStyleMark.attrs = resolveFontFamily(textStyleMark.attrs, child?.text);
|
|
99885
|
+
textStyleMark.attrs = resolveFontFamily$1(textStyleMark.attrs, child?.text);
|
|
99566
99886
|
}
|
|
99567
99887
|
return false;
|
|
99568
99888
|
}
|
|
@@ -113056,7 +113376,537 @@ var isRegExp = (value) => {
|
|
|
113056
113376
|
tags.push(`</${name}>`);
|
|
113057
113377
|
return tags;
|
|
113058
113378
|
}
|
|
113059
|
-
},
|
|
113379
|
+
}, SETTLED_STATUSES, SUBSTITUTION_EVIDENCE, BUNDLED_SUBSTITUTES, CATEGORY_FALLBACKS, FontResolver = class {
|
|
113380
|
+
#overrides = /* @__PURE__ */ new Map;
|
|
113381
|
+
#embedded = /* @__PURE__ */ new Map;
|
|
113382
|
+
#version = 0;
|
|
113383
|
+
#cachedSignature = null;
|
|
113384
|
+
map(logicalFamily, physicalFamily) {
|
|
113385
|
+
const key = normalizeFamilyKey$1(logicalFamily);
|
|
113386
|
+
const physical = physicalFamily?.trim();
|
|
113387
|
+
if (!key || !physical)
|
|
113388
|
+
return;
|
|
113389
|
+
if (this.#overrides.get(key) === physical)
|
|
113390
|
+
return;
|
|
113391
|
+
if (key === normalizeFamilyKey$1(physical)) {
|
|
113392
|
+
if (this.#overrides.delete(key)) {
|
|
113393
|
+
this.#version += 1;
|
|
113394
|
+
this.#cachedSignature = null;
|
|
113395
|
+
}
|
|
113396
|
+
return;
|
|
113397
|
+
}
|
|
113398
|
+
this.#overrides.set(key, physical);
|
|
113399
|
+
this.#version += 1;
|
|
113400
|
+
this.#cachedSignature = null;
|
|
113401
|
+
}
|
|
113402
|
+
unmap(logicalFamily) {
|
|
113403
|
+
if (this.#overrides.delete(normalizeFamilyKey$1(logicalFamily))) {
|
|
113404
|
+
this.#version += 1;
|
|
113405
|
+
this.#cachedSignature = null;
|
|
113406
|
+
}
|
|
113407
|
+
}
|
|
113408
|
+
mapEmbedded(logicalFamily, physicalFamily) {
|
|
113409
|
+
const key = normalizeFamilyKey$1(logicalFamily);
|
|
113410
|
+
const physical = physicalFamily?.trim();
|
|
113411
|
+
if (!key || !physical)
|
|
113412
|
+
return;
|
|
113413
|
+
if (this.#embedded.get(key) === physical)
|
|
113414
|
+
return;
|
|
113415
|
+
this.#embedded.set(key, physical);
|
|
113416
|
+
this.#version += 1;
|
|
113417
|
+
this.#cachedSignature = null;
|
|
113418
|
+
}
|
|
113419
|
+
clearEmbedded() {
|
|
113420
|
+
if (this.#embedded.size === 0)
|
|
113421
|
+
return;
|
|
113422
|
+
this.#embedded.clear();
|
|
113423
|
+
this.#version += 1;
|
|
113424
|
+
this.#cachedSignature = null;
|
|
113425
|
+
}
|
|
113426
|
+
reset() {
|
|
113427
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0)
|
|
113428
|
+
return;
|
|
113429
|
+
this.#overrides.clear();
|
|
113430
|
+
this.#embedded.clear();
|
|
113431
|
+
this.#version += 1;
|
|
113432
|
+
this.#cachedSignature = null;
|
|
113433
|
+
}
|
|
113434
|
+
get version() {
|
|
113435
|
+
return this.#version;
|
|
113436
|
+
}
|
|
113437
|
+
get signature() {
|
|
113438
|
+
if (this.#cachedSignature !== null)
|
|
113439
|
+
return this.#cachedSignature;
|
|
113440
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0)
|
|
113441
|
+
this.#cachedSignature = "";
|
|
113442
|
+
else {
|
|
113443
|
+
const overridePairs = sortPairs([...this.#overrides.entries()]);
|
|
113444
|
+
this.#cachedSignature = this.#embedded.size === 0 ? JSON.stringify(overridePairs) : JSON.stringify({
|
|
113445
|
+
o: overridePairs,
|
|
113446
|
+
e: sortPairs([...this.#embedded.entries()])
|
|
113447
|
+
});
|
|
113448
|
+
}
|
|
113449
|
+
return this.#cachedSignature;
|
|
113450
|
+
}
|
|
113451
|
+
#physicalFor(bareFamily) {
|
|
113452
|
+
const key = normalizeFamilyKey$1(bareFamily);
|
|
113453
|
+
const override = this.#overrides.get(key);
|
|
113454
|
+
if (override)
|
|
113455
|
+
return {
|
|
113456
|
+
physical: override,
|
|
113457
|
+
reason: "custom_mapping"
|
|
113458
|
+
};
|
|
113459
|
+
const bundled = BUNDLED_SUBSTITUTES[key];
|
|
113460
|
+
if (bundled)
|
|
113461
|
+
return {
|
|
113462
|
+
physical: bundled,
|
|
113463
|
+
reason: "bundled_substitute"
|
|
113464
|
+
};
|
|
113465
|
+
const category = CATEGORY_FALLBACKS[key];
|
|
113466
|
+
if (category)
|
|
113467
|
+
return {
|
|
113468
|
+
physical: category,
|
|
113469
|
+
reason: "category_fallback"
|
|
113470
|
+
};
|
|
113471
|
+
return {
|
|
113472
|
+
physical: bareFamily,
|
|
113473
|
+
reason: "as_requested"
|
|
113474
|
+
};
|
|
113475
|
+
}
|
|
113476
|
+
#resolveFaceLadder(primary, face, hasFace) {
|
|
113477
|
+
const key = normalizeFamilyKey$1(primary);
|
|
113478
|
+
const override = this.#overrides.get(key);
|
|
113479
|
+
if (override && hasFace(override, face.weight, face.style))
|
|
113480
|
+
return {
|
|
113481
|
+
physical: override,
|
|
113482
|
+
reason: "custom_mapping"
|
|
113483
|
+
};
|
|
113484
|
+
const embedded = this.#embedded.get(key);
|
|
113485
|
+
if (embedded && hasFace(embedded, face.weight, face.style))
|
|
113486
|
+
return {
|
|
113487
|
+
physical: embedded,
|
|
113488
|
+
reason: "registered_face"
|
|
113489
|
+
};
|
|
113490
|
+
if (hasFace(primary, face.weight, face.style))
|
|
113491
|
+
return {
|
|
113492
|
+
physical: primary,
|
|
113493
|
+
reason: "registered_face"
|
|
113494
|
+
};
|
|
113495
|
+
const bundled = BUNDLED_SUBSTITUTES[key];
|
|
113496
|
+
if (bundled && hasFace(bundled, face.weight, face.style))
|
|
113497
|
+
return {
|
|
113498
|
+
physical: bundled,
|
|
113499
|
+
reason: "bundled_substitute"
|
|
113500
|
+
};
|
|
113501
|
+
const category = CATEGORY_FALLBACKS[key];
|
|
113502
|
+
if (category && hasFace(category, face.weight, face.style))
|
|
113503
|
+
return {
|
|
113504
|
+
physical: category,
|
|
113505
|
+
reason: "category_fallback"
|
|
113506
|
+
};
|
|
113507
|
+
if (override || bundled)
|
|
113508
|
+
return {
|
|
113509
|
+
physical: primary,
|
|
113510
|
+
reason: "fallback_face_absent"
|
|
113511
|
+
};
|
|
113512
|
+
return {
|
|
113513
|
+
physical: primary,
|
|
113514
|
+
reason: "as_requested"
|
|
113515
|
+
};
|
|
113516
|
+
}
|
|
113517
|
+
resolveFontFamily(logicalFamily) {
|
|
113518
|
+
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
113519
|
+
const { physical, reason } = this.#physicalFor(primary);
|
|
113520
|
+
return {
|
|
113521
|
+
logicalFamily,
|
|
113522
|
+
physicalFamily: stripFamilyQuotes(physical),
|
|
113523
|
+
reason
|
|
113524
|
+
};
|
|
113525
|
+
}
|
|
113526
|
+
resolvePhysicalFamily(cssFontFamily) {
|
|
113527
|
+
if (!cssFontFamily)
|
|
113528
|
+
return cssFontFamily;
|
|
113529
|
+
const parts = splitStack(cssFontFamily);
|
|
113530
|
+
if (parts.length === 0)
|
|
113531
|
+
return cssFontFamily;
|
|
113532
|
+
const { physical, reason } = this.#physicalFor(parts[0]);
|
|
113533
|
+
if (reason === "as_requested")
|
|
113534
|
+
return cssFontFamily;
|
|
113535
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
113536
|
+
}
|
|
113537
|
+
resolveFace(logicalFamily, face, hasFace) {
|
|
113538
|
+
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
113539
|
+
const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
|
|
113540
|
+
return {
|
|
113541
|
+
logicalFamily,
|
|
113542
|
+
physicalFamily: stripFamilyQuotes(physical),
|
|
113543
|
+
reason
|
|
113544
|
+
};
|
|
113545
|
+
}
|
|
113546
|
+
resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
|
|
113547
|
+
if (!cssFontFamily)
|
|
113548
|
+
return cssFontFamily;
|
|
113549
|
+
const parts = splitStack(cssFontFamily);
|
|
113550
|
+
if (parts.length === 0)
|
|
113551
|
+
return cssFontFamily;
|
|
113552
|
+
const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
|
|
113553
|
+
if (normalizeFamilyKey$1(physical) !== normalizeFamilyKey$1(parts[0]))
|
|
113554
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
113555
|
+
return cssFontFamily;
|
|
113556
|
+
}
|
|
113557
|
+
resolvePrimaryPhysicalFamily(family$1) {
|
|
113558
|
+
const primary = splitStack(family$1)[0] ?? family$1;
|
|
113559
|
+
return this.#physicalFor(primary).physical;
|
|
113560
|
+
}
|
|
113561
|
+
resolvePhysicalFamilies(families) {
|
|
113562
|
+
const out = /* @__PURE__ */ new Set;
|
|
113563
|
+
for (const family$1 of families)
|
|
113564
|
+
if (family$1)
|
|
113565
|
+
out.add(this.resolvePrimaryPhysicalFamily(family$1));
|
|
113566
|
+
return [...out];
|
|
113567
|
+
}
|
|
113568
|
+
}, defaultResolver, DEFAULT_FONT_MEASURE_CONTEXT, fontConfigVersion = 0, BUNDLED_MANIFEST, defaultAssetBase = "/fonts/", installedRegistries, FS_TYPE_RESTRICTED = 2, FS_SELECTION_ITALIC = 1, BOLD_WEIGHT_THRESHOLD = 600, SFNT_TABLE_DIR_OFFSET = 12, SFNT_TABLE_RECORD_SIZE = 16, OS2_USWEIGHTCLASS = 4, OS2_FSTYPE = 8, OS2_FSSELECTION = 62, OS2_MIN_LENGTH, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
|
|
113569
|
+
#fontSet;
|
|
113570
|
+
#FontFaceCtor;
|
|
113571
|
+
#probeSize;
|
|
113572
|
+
#scheduleTimeout;
|
|
113573
|
+
#cancelTimeout;
|
|
113574
|
+
#managed = /* @__PURE__ */ new Map;
|
|
113575
|
+
#facesByKey = /* @__PURE__ */ new Map;
|
|
113576
|
+
#status = /* @__PURE__ */ new Map;
|
|
113577
|
+
#sources = /* @__PURE__ */ new Map;
|
|
113578
|
+
#warnedFailures = /* @__PURE__ */ new Set;
|
|
113579
|
+
#inflight = /* @__PURE__ */ new Map;
|
|
113580
|
+
#faceStatus = /* @__PURE__ */ new Map;
|
|
113581
|
+
#faceInflight = /* @__PURE__ */ new Map;
|
|
113582
|
+
#faceSources = /* @__PURE__ */ new Map;
|
|
113583
|
+
#facesByFamily = /* @__PURE__ */ new Map;
|
|
113584
|
+
#providerFaceKeys = /* @__PURE__ */ new Set;
|
|
113585
|
+
#warnedFaceFailures = /* @__PURE__ */ new Set;
|
|
113586
|
+
constructor(options = {}) {
|
|
113587
|
+
this.#fontSet = options.fontSet ?? null;
|
|
113588
|
+
this.#FontFaceCtor = options.FontFaceCtor ?? null;
|
|
113589
|
+
this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
|
|
113590
|
+
this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
|
|
113591
|
+
this.#cancelTimeout = options.cancelTimeout ?? ((handle2) => globalThis.clearTimeout(handle2));
|
|
113592
|
+
}
|
|
113593
|
+
register(descriptor) {
|
|
113594
|
+
const { family: family$1, source, descriptors: descriptors$1 } = descriptor;
|
|
113595
|
+
const identitySource = typeof source === "string" ? canonicalizeFontSource(source) : source;
|
|
113596
|
+
const weight = normalizeWeight(descriptors$1?.weight);
|
|
113597
|
+
const style = normalizeStyle(descriptors$1?.style);
|
|
113598
|
+
const key = faceKeyOf(family$1, weight, style);
|
|
113599
|
+
if (typeof identitySource === "string") {
|
|
113600
|
+
const existingSource = this.#faceSources.get(key);
|
|
113601
|
+
if (existingSource === identitySource)
|
|
113602
|
+
return {
|
|
113603
|
+
family: family$1,
|
|
113604
|
+
status: this.getStatus(family$1),
|
|
113605
|
+
changed: false
|
|
113606
|
+
};
|
|
113607
|
+
if (existingSource !== undefined)
|
|
113608
|
+
throw new Error(`[superdoc] font face "${key}" is already registered from a different source ("${existingSource}"); a registered face's source cannot be replaced`);
|
|
113609
|
+
}
|
|
113610
|
+
if (this.#FontFaceCtor && this.#fontSet) {
|
|
113611
|
+
const face = new this.#FontFaceCtor(family$1, source, {
|
|
113612
|
+
...descriptors$1,
|
|
113613
|
+
weight,
|
|
113614
|
+
style
|
|
113615
|
+
});
|
|
113616
|
+
this.#fontSet.add(face);
|
|
113617
|
+
this.#addManagedFace(family$1, key, face);
|
|
113618
|
+
}
|
|
113619
|
+
if (typeof source === "string") {
|
|
113620
|
+
const list$1 = this.#sources.get(family$1) ?? [];
|
|
113621
|
+
if (!list$1.includes(source))
|
|
113622
|
+
list$1.push(source);
|
|
113623
|
+
this.#sources.set(family$1, list$1);
|
|
113624
|
+
}
|
|
113625
|
+
if (!this.#status.has(family$1))
|
|
113626
|
+
this.#status.set(family$1, "unloaded");
|
|
113627
|
+
this.#providerFaceKeys.add(key);
|
|
113628
|
+
this.#trackFace(family$1, key);
|
|
113629
|
+
if (!this.#faceStatus.has(key))
|
|
113630
|
+
this.#faceStatus.set(key, "unloaded");
|
|
113631
|
+
if (typeof identitySource === "string" && !this.#faceSources.has(key))
|
|
113632
|
+
this.#faceSources.set(key, identitySource);
|
|
113633
|
+
return {
|
|
113634
|
+
family: family$1,
|
|
113635
|
+
status: this.getStatus(family$1),
|
|
113636
|
+
changed: true
|
|
113637
|
+
};
|
|
113638
|
+
}
|
|
113639
|
+
#trackFace(family$1, key) {
|
|
113640
|
+
const fam = normalizeFamilyKey(family$1);
|
|
113641
|
+
const set3 = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
|
|
113642
|
+
set3.add(key);
|
|
113643
|
+
this.#facesByFamily.set(fam, set3);
|
|
113644
|
+
}
|
|
113645
|
+
isManaged(family$1) {
|
|
113646
|
+
return this.#managed.has(family$1);
|
|
113647
|
+
}
|
|
113648
|
+
registerOwnedFace(descriptor) {
|
|
113649
|
+
const { family: family$1, source, weight, style } = descriptor;
|
|
113650
|
+
if (!this.#FontFaceCtor || !this.#fontSet)
|
|
113651
|
+
return null;
|
|
113652
|
+
const key = faceKeyOf(family$1, weight, style);
|
|
113653
|
+
const face = new this.#FontFaceCtor(family$1, source, {
|
|
113654
|
+
weight,
|
|
113655
|
+
style
|
|
113656
|
+
});
|
|
113657
|
+
this.#fontSet.add(face);
|
|
113658
|
+
this.#addManagedFace(family$1, key, face);
|
|
113659
|
+
this.#providerFaceKeys.add(key);
|
|
113660
|
+
if (!this.#status.has(family$1))
|
|
113661
|
+
this.#status.set(family$1, "unloaded");
|
|
113662
|
+
this.#trackFace(family$1, key);
|
|
113663
|
+
if (!this.#faceStatus.has(key))
|
|
113664
|
+
this.#faceStatus.set(key, "unloaded");
|
|
113665
|
+
let released = false;
|
|
113666
|
+
return () => {
|
|
113667
|
+
if (released)
|
|
113668
|
+
return false;
|
|
113669
|
+
released = true;
|
|
113670
|
+
return this.#removeManagedFace(family$1, key, face);
|
|
113671
|
+
};
|
|
113672
|
+
}
|
|
113673
|
+
#addManagedFace(family$1, key, face) {
|
|
113674
|
+
this.#managed.set(family$1, face);
|
|
113675
|
+
let set3 = this.#facesByKey.get(key);
|
|
113676
|
+
if (!set3) {
|
|
113677
|
+
set3 = /* @__PURE__ */ new Set;
|
|
113678
|
+
this.#facesByKey.set(key, set3);
|
|
113679
|
+
}
|
|
113680
|
+
set3.add(face);
|
|
113681
|
+
}
|
|
113682
|
+
#removeManagedFace(family$1, key, face) {
|
|
113683
|
+
const set3 = this.#facesByKey.get(key);
|
|
113684
|
+
if (!set3 || !set3.delete(face))
|
|
113685
|
+
return false;
|
|
113686
|
+
if (typeof this.#fontSet?.delete === "function")
|
|
113687
|
+
this.#fontSet.delete(face);
|
|
113688
|
+
if (set3.size > 0)
|
|
113689
|
+
return true;
|
|
113690
|
+
this.#facesByKey.delete(key);
|
|
113691
|
+
this.#providerFaceKeys.delete(key);
|
|
113692
|
+
this.#faceStatus.delete(key);
|
|
113693
|
+
this.#faceSources.delete(key);
|
|
113694
|
+
const fam = normalizeFamilyKey(family$1);
|
|
113695
|
+
const keys$1 = this.#facesByFamily.get(fam);
|
|
113696
|
+
if (keys$1) {
|
|
113697
|
+
keys$1.delete(key);
|
|
113698
|
+
if (keys$1.size === 0) {
|
|
113699
|
+
this.#facesByFamily.delete(fam);
|
|
113700
|
+
this.#managed.delete(family$1);
|
|
113701
|
+
this.#status.delete(family$1);
|
|
113702
|
+
this.#sources.delete(family$1);
|
|
113703
|
+
}
|
|
113704
|
+
}
|
|
113705
|
+
return true;
|
|
113706
|
+
}
|
|
113707
|
+
getStatus(family$1) {
|
|
113708
|
+
const statuses = [];
|
|
113709
|
+
const faceKeys = this.#facesByFamily.get(normalizeFamilyKey(family$1));
|
|
113710
|
+
if (faceKeys)
|
|
113711
|
+
for (const k of faceKeys)
|
|
113712
|
+
statuses.push(this.#faceStatus.get(k) ?? "unloaded");
|
|
113713
|
+
const legacy = this.#status.get(family$1);
|
|
113714
|
+
if (legacy)
|
|
113715
|
+
statuses.push(legacy);
|
|
113716
|
+
if (statuses.length === 0)
|
|
113717
|
+
return "unloaded";
|
|
113718
|
+
for (const s of [
|
|
113719
|
+
"failed",
|
|
113720
|
+
"timed_out",
|
|
113721
|
+
"fallback_used",
|
|
113722
|
+
"loaded",
|
|
113723
|
+
"loading",
|
|
113724
|
+
"unloaded"
|
|
113725
|
+
])
|
|
113726
|
+
if (statuses.includes(s))
|
|
113727
|
+
return s;
|
|
113728
|
+
return "unloaded";
|
|
113729
|
+
}
|
|
113730
|
+
hasFace(family$1, weight, style) {
|
|
113731
|
+
const key = faceKeyOf(family$1, weight, style);
|
|
113732
|
+
return this.#providerFaceKeys.has(key) && this.#faceStatus.get(key) !== "failed";
|
|
113733
|
+
}
|
|
113734
|
+
isAvailable(family$1) {
|
|
113735
|
+
if (!this.#fontSet)
|
|
113736
|
+
return false;
|
|
113737
|
+
try {
|
|
113738
|
+
return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
|
|
113739
|
+
} catch {
|
|
113740
|
+
return false;
|
|
113741
|
+
}
|
|
113742
|
+
}
|
|
113743
|
+
awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
113744
|
+
if (this.#status.get(family$1) === "loaded")
|
|
113745
|
+
return Promise.resolve({
|
|
113746
|
+
family: family$1,
|
|
113747
|
+
status: "loaded"
|
|
113748
|
+
});
|
|
113749
|
+
const existing = this.#inflight.get(family$1);
|
|
113750
|
+
if (existing)
|
|
113751
|
+
return existing;
|
|
113752
|
+
const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
|
|
113753
|
+
this.#inflight.delete(family$1);
|
|
113754
|
+
});
|
|
113755
|
+
this.#inflight.set(family$1, probe);
|
|
113756
|
+
return probe;
|
|
113757
|
+
}
|
|
113758
|
+
async awaitFaces(families, options = {}) {
|
|
113759
|
+
const unique = [...new Set(families)];
|
|
113760
|
+
const timeoutMs = options.timeoutMs ?? 3000;
|
|
113761
|
+
return Promise.all(unique.map((family$1) => this.awaitFace(family$1, timeoutMs)));
|
|
113762
|
+
}
|
|
113763
|
+
getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
113764
|
+
return [...new Set(families)].map((family$1) => ({
|
|
113765
|
+
family: family$1,
|
|
113766
|
+
status: this.getStatus(family$1),
|
|
113767
|
+
ready: this.awaitFace(family$1, timeoutMs)
|
|
113768
|
+
}));
|
|
113769
|
+
}
|
|
113770
|
+
getStates() {
|
|
113771
|
+
return [...this.#status.entries()].map(([family$1, status]) => ({
|
|
113772
|
+
family: family$1,
|
|
113773
|
+
status
|
|
113774
|
+
}));
|
|
113775
|
+
}
|
|
113776
|
+
getFaceStatus(request) {
|
|
113777
|
+
return this.#faceStatus.get(faceKeyOf(request.family, request.weight, request.style)) ?? "unloaded";
|
|
113778
|
+
}
|
|
113779
|
+
awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
113780
|
+
const key = faceKeyOf(request.family, request.weight, request.style);
|
|
113781
|
+
if (this.#faceStatus.get(key) === "loaded")
|
|
113782
|
+
return Promise.resolve({
|
|
113783
|
+
request,
|
|
113784
|
+
status: "loaded"
|
|
113785
|
+
});
|
|
113786
|
+
const existing = this.#faceInflight.get(key);
|
|
113787
|
+
if (existing)
|
|
113788
|
+
return existing;
|
|
113789
|
+
const probe = this.#loadOneFace(request, key, timeoutMs).finally(() => {
|
|
113790
|
+
this.#faceInflight.delete(key);
|
|
113791
|
+
});
|
|
113792
|
+
this.#faceInflight.set(key, probe);
|
|
113793
|
+
return probe;
|
|
113794
|
+
}
|
|
113795
|
+
async awaitFaceRequests(requests, options = {}) {
|
|
113796
|
+
const timeoutMs = options.timeoutMs ?? 3000;
|
|
113797
|
+
const seen = /* @__PURE__ */ new Set;
|
|
113798
|
+
const unique = [];
|
|
113799
|
+
for (const r of requests) {
|
|
113800
|
+
const key = faceKeyOf(r.family, r.weight, r.style);
|
|
113801
|
+
if (seen.has(key))
|
|
113802
|
+
continue;
|
|
113803
|
+
seen.add(key);
|
|
113804
|
+
unique.push(r);
|
|
113805
|
+
}
|
|
113806
|
+
return Promise.all(unique.map((r) => this.awaitFaceRequest(r, timeoutMs)));
|
|
113807
|
+
}
|
|
113808
|
+
async#loadOneFace(request, key, timeoutMs) {
|
|
113809
|
+
this.#trackFace(request.family, key);
|
|
113810
|
+
const fontSet = this.#fontSet;
|
|
113811
|
+
if (!fontSet) {
|
|
113812
|
+
this.#faceStatus.set(key, "fallback_used");
|
|
113813
|
+
return {
|
|
113814
|
+
request,
|
|
113815
|
+
status: "fallback_used"
|
|
113816
|
+
};
|
|
113817
|
+
}
|
|
113818
|
+
this.#faceStatus.set(key, "loading");
|
|
113819
|
+
const probe = faceProbe(request.family, request.weight, request.style, this.#probeSize);
|
|
113820
|
+
const TIMEOUT = Symbol("timeout");
|
|
113821
|
+
let handle2;
|
|
113822
|
+
const timeout = new Promise((resolve) => {
|
|
113823
|
+
handle2 = this.#scheduleTimeout(() => resolve(TIMEOUT), timeoutMs);
|
|
113824
|
+
});
|
|
113825
|
+
try {
|
|
113826
|
+
const settled = await Promise.race([fontSet.load(probe), timeout]);
|
|
113827
|
+
if (settled === TIMEOUT) {
|
|
113828
|
+
this.#faceStatus.set(key, "timed_out");
|
|
113829
|
+
return {
|
|
113830
|
+
request,
|
|
113831
|
+
status: "timed_out"
|
|
113832
|
+
};
|
|
113833
|
+
}
|
|
113834
|
+
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
113835
|
+
this.#faceStatus.set(key, status);
|
|
113836
|
+
return {
|
|
113837
|
+
request,
|
|
113838
|
+
status
|
|
113839
|
+
};
|
|
113840
|
+
} catch {
|
|
113841
|
+
this.#faceStatus.set(key, "failed");
|
|
113842
|
+
this.#warnFaceFailureOnce(request, key);
|
|
113843
|
+
return {
|
|
113844
|
+
request,
|
|
113845
|
+
status: "failed"
|
|
113846
|
+
};
|
|
113847
|
+
} finally {
|
|
113848
|
+
this.#cancelTimeout(handle2);
|
|
113849
|
+
}
|
|
113850
|
+
}
|
|
113851
|
+
#warnFaceFailureOnce(request, key) {
|
|
113852
|
+
if (this.#warnedFaceFailures.has(key))
|
|
113853
|
+
return;
|
|
113854
|
+
this.#warnedFaceFailures.add(key);
|
|
113855
|
+
const src = this.#faceSources.get(key);
|
|
113856
|
+
const detail = src ? ` from ${src}` : "";
|
|
113857
|
+
console.warn(`[superdoc] font face failed to load: "${request.family}" ${request.weight} ${request.style}${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
113858
|
+
}
|
|
113859
|
+
async#loadOne(family$1, timeoutMs) {
|
|
113860
|
+
const fontSet = this.#fontSet;
|
|
113861
|
+
if (!fontSet) {
|
|
113862
|
+
this.#status.set(family$1, "fallback_used");
|
|
113863
|
+
return {
|
|
113864
|
+
family: family$1,
|
|
113865
|
+
status: "fallback_used"
|
|
113866
|
+
};
|
|
113867
|
+
}
|
|
113868
|
+
this.#status.set(family$1, "loading");
|
|
113869
|
+
const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
|
|
113870
|
+
const TIMEOUT = Symbol("timeout");
|
|
113871
|
+
let handle2;
|
|
113872
|
+
const timeout = new Promise((resolve) => {
|
|
113873
|
+
handle2 = this.#scheduleTimeout(() => resolve(TIMEOUT), timeoutMs);
|
|
113874
|
+
});
|
|
113875
|
+
try {
|
|
113876
|
+
const settled = await Promise.race([fontSet.load(probe), timeout]);
|
|
113877
|
+
if (settled === TIMEOUT) {
|
|
113878
|
+
this.#status.set(family$1, "timed_out");
|
|
113879
|
+
return {
|
|
113880
|
+
family: family$1,
|
|
113881
|
+
status: "timed_out"
|
|
113882
|
+
};
|
|
113883
|
+
}
|
|
113884
|
+
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
113885
|
+
this.#status.set(family$1, status);
|
|
113886
|
+
return {
|
|
113887
|
+
family: family$1,
|
|
113888
|
+
status
|
|
113889
|
+
};
|
|
113890
|
+
} catch {
|
|
113891
|
+
this.#status.set(family$1, "failed");
|
|
113892
|
+
this.#warnLoadFailureOnce(family$1);
|
|
113893
|
+
return {
|
|
113894
|
+
family: family$1,
|
|
113895
|
+
status: "failed"
|
|
113896
|
+
};
|
|
113897
|
+
} finally {
|
|
113898
|
+
this.#cancelTimeout(handle2);
|
|
113899
|
+
}
|
|
113900
|
+
}
|
|
113901
|
+
#warnLoadFailureOnce(family$1) {
|
|
113902
|
+
if (this.#warnedFailures.has(family$1))
|
|
113903
|
+
return;
|
|
113904
|
+
this.#warnedFailures.add(family$1);
|
|
113905
|
+
const sources = this.#sources.get(family$1);
|
|
113906
|
+
const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
|
|
113907
|
+
console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
113908
|
+
}
|
|
113909
|
+
}, registriesByFontSet, domlessRegistry = null, PHYSICAL_GENERIC, BUNDLED_FAMILIES, FONT_OFFERINGS, DEFAULT_FONT_ORDER, prepareCommentParaIds = (comment) => {
|
|
113060
113910
|
return {
|
|
113061
113911
|
...comment,
|
|
113062
113912
|
commentParaId: generateDocxRandomId()
|
|
@@ -117032,7 +117882,7 @@ var isRegExp = (value) => {
|
|
|
117032
117882
|
state.kern = kernNode.attributes["w:val"];
|
|
117033
117883
|
}
|
|
117034
117884
|
}, SuperConverter;
|
|
117035
|
-
var
|
|
117885
|
+
var init_SuperConverter_DOoAJ6Zk_es = __esm(() => {
|
|
117036
117886
|
init_rolldown_runtime_Bg48TavK_es();
|
|
117037
117887
|
init_jszip_C49i9kUs_es();
|
|
117038
117888
|
init_xml_js_CqGKpaft_es();
|
|
@@ -122048,7 +122898,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
122048
122898
|
"trackChanges.list": {
|
|
122049
122899
|
memberPath: "trackChanges.list",
|
|
122050
122900
|
description: "List all tracked changes in the document.",
|
|
122051
|
-
expectedResult: "Returns a TrackChangesListResult with tracked change entries (`insert`, `delete`, `replacement`, `format
|
|
122901
|
+
expectedResult: "Returns a TrackChangesListResult with tracked change entries (`insert`, `delete`, `replacement`, `format`), total count, and raw imported Word OOXML revision IDs (`w:id`) when available. Whole-table tracked insertions and deletions are surfaced through the legacy `insert` / `delete` types.",
|
|
122052
122902
|
requiresDocumentContext: true,
|
|
122053
122903
|
metadata: readOperation({
|
|
122054
122904
|
idempotency: "idempotent",
|
|
@@ -122062,7 +122912,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
122062
122912
|
"trackChanges.get": {
|
|
122063
122913
|
memberPath: "trackChanges.get",
|
|
122064
122914
|
description: "Retrieve a single tracked change by ID.",
|
|
122065
|
-
expectedResult: "Returns a TrackChangeInfo object with the change type (`insert`, `delete`, `replacement`, `format
|
|
122915
|
+
expectedResult: "Returns a TrackChangeInfo object with the change type (`insert`, `delete`, `replacement`, `format`), author, date, affected content, and raw imported Word OOXML revision IDs (`w:id`) when available. Whole-table tracked insertions and deletions are surfaced through the legacy `insert` / `delete` types.",
|
|
122066
122916
|
requiresDocumentContext: true,
|
|
122067
122917
|
metadata: readOperation({
|
|
122068
122918
|
idempotency: "idempotent",
|
|
@@ -122082,6 +122932,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
122082
122932
|
supportsTrackedMode: false,
|
|
122083
122933
|
possibleFailureCodes: [
|
|
122084
122934
|
"NO_OP",
|
|
122935
|
+
"INVALID_INPUT",
|
|
122085
122936
|
"INVALID_TARGET",
|
|
122086
122937
|
"TARGET_NOT_FOUND",
|
|
122087
122938
|
"CAPABILITY_UNAVAILABLE",
|
|
@@ -126561,8 +127412,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
126561
127412
|
"insert",
|
|
126562
127413
|
"delete",
|
|
126563
127414
|
"replacement",
|
|
126564
|
-
"format"
|
|
126565
|
-
"structural"
|
|
127415
|
+
"format"
|
|
126566
127416
|
];
|
|
126567
127417
|
nodeTypeValues = NODE_TYPES;
|
|
126568
127418
|
blockNodeTypeValues = BLOCK_NODE_TYPES;
|
|
@@ -127592,10 +128442,6 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
127592
128442
|
address: trackedChangeAddressSchema,
|
|
127593
128443
|
id: { type: "string" },
|
|
127594
128444
|
type: { enum: [...trackChangeTypeValues] },
|
|
127595
|
-
subtype: {
|
|
127596
|
-
enum: ["table-insert", "table-delete"],
|
|
127597
|
-
description: "Finer classification for structural changes (type === 'structural')."
|
|
127598
|
-
},
|
|
127599
128445
|
grouping: { enum: [
|
|
127600
128446
|
"standalone",
|
|
127601
128447
|
"replacement-pair",
|
|
@@ -127618,10 +128464,6 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
127618
128464
|
discoveryResultSchema(discoveryItemSchema({
|
|
127619
128465
|
address: trackedChangeAddressSchema,
|
|
127620
128466
|
type: { enum: [...trackChangeTypeValues] },
|
|
127621
|
-
subtype: {
|
|
127622
|
-
enum: ["table-insert", "table-delete"],
|
|
127623
|
-
description: "Finer classification for structural changes (type === 'structural')."
|
|
127624
|
-
},
|
|
127625
128467
|
grouping: { enum: [
|
|
127626
128468
|
"standalone",
|
|
127627
128469
|
"replacement-pair",
|
|
@@ -130116,7 +130958,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
130116
130958
|
},
|
|
130117
130959
|
type: {
|
|
130118
130960
|
enum: [...trackChangeTypeValues],
|
|
130119
|
-
description: "Filter by change type: 'insert', 'delete', 'replacement',
|
|
130961
|
+
description: "Filter by change type: 'insert', 'delete', 'replacement', or 'format'."
|
|
130120
130962
|
},
|
|
130121
130963
|
in: {
|
|
130122
130964
|
oneOf: [storyLocatorSchema, { const: "all" }],
|
|
@@ -154351,6 +155193,246 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
154351
155193
|
gutter: "0"
|
|
154352
155194
|
})
|
|
154353
155195
|
});
|
|
155196
|
+
SETTLED_STATUSES = [
|
|
155197
|
+
"loaded",
|
|
155198
|
+
"failed",
|
|
155199
|
+
"timed_out",
|
|
155200
|
+
"fallback_used"
|
|
155201
|
+
];
|
|
155202
|
+
SUBSTITUTION_EVIDENCE = Object.freeze([
|
|
155203
|
+
{
|
|
155204
|
+
evidenceId: "calibri",
|
|
155205
|
+
logicalFamily: "Calibri",
|
|
155206
|
+
physicalFamily: "Carlito",
|
|
155207
|
+
verdict: "metric_safe",
|
|
155208
|
+
faces: {
|
|
155209
|
+
regular: true,
|
|
155210
|
+
bold: true,
|
|
155211
|
+
italic: true,
|
|
155212
|
+
boldItalic: true
|
|
155213
|
+
},
|
|
155214
|
+
advance: {
|
|
155215
|
+
meanDelta: 0,
|
|
155216
|
+
maxDelta: 0
|
|
155217
|
+
},
|
|
155218
|
+
gates: {
|
|
155219
|
+
static: "pass",
|
|
155220
|
+
metric: "pass",
|
|
155221
|
+
layout: "pass",
|
|
155222
|
+
ship: "pass"
|
|
155223
|
+
},
|
|
155224
|
+
policyAction: "substitute",
|
|
155225
|
+
measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
|
|
155226
|
+
candidateLicense: "OFL-1.1",
|
|
155227
|
+
exportRule: "preserve_original_name"
|
|
155228
|
+
},
|
|
155229
|
+
{
|
|
155230
|
+
evidenceId: "cambria",
|
|
155231
|
+
logicalFamily: "Cambria",
|
|
155232
|
+
physicalFamily: "Caladea",
|
|
155233
|
+
verdict: "visual_only",
|
|
155234
|
+
faceVerdicts: {
|
|
155235
|
+
regular: "metric_safe",
|
|
155236
|
+
bold: "metric_safe",
|
|
155237
|
+
italic: "metric_safe",
|
|
155238
|
+
boldItalic: "visual_only"
|
|
155239
|
+
},
|
|
155240
|
+
glyphExceptions: [{
|
|
155241
|
+
slot: "boldItalic",
|
|
155242
|
+
codepoint: 96,
|
|
155243
|
+
advanceDelta: 0.231,
|
|
155244
|
+
note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
|
|
155245
|
+
}],
|
|
155246
|
+
faces: {
|
|
155247
|
+
regular: true,
|
|
155248
|
+
bold: true,
|
|
155249
|
+
italic: true,
|
|
155250
|
+
boldItalic: true
|
|
155251
|
+
},
|
|
155252
|
+
advance: {
|
|
155253
|
+
meanDelta: 0.0002378,
|
|
155254
|
+
maxDelta: 0.2310758
|
|
155255
|
+
},
|
|
155256
|
+
gates: {
|
|
155257
|
+
static: "pass",
|
|
155258
|
+
metric: "pass",
|
|
155259
|
+
layout: "not_run",
|
|
155260
|
+
ship: "pass"
|
|
155261
|
+
},
|
|
155262
|
+
policyAction: "substitute",
|
|
155263
|
+
measurementRefs: [
|
|
155264
|
+
"cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
|
|
155265
|
+
"cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
|
|
155266
|
+
"cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
|
|
155267
|
+
"cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
|
|
155268
|
+
],
|
|
155269
|
+
candidateLicense: "Apache-2.0",
|
|
155270
|
+
exportRule: "preserve_original_name"
|
|
155271
|
+
},
|
|
155272
|
+
{
|
|
155273
|
+
evidenceId: "arial",
|
|
155274
|
+
logicalFamily: "Arial",
|
|
155275
|
+
physicalFamily: "Liberation Sans",
|
|
155276
|
+
verdict: "metric_safe",
|
|
155277
|
+
faces: {
|
|
155278
|
+
regular: true,
|
|
155279
|
+
bold: true,
|
|
155280
|
+
italic: true,
|
|
155281
|
+
boldItalic: true
|
|
155282
|
+
},
|
|
155283
|
+
advance: {
|
|
155284
|
+
meanDelta: 0,
|
|
155285
|
+
maxDelta: 0
|
|
155286
|
+
},
|
|
155287
|
+
gates: {
|
|
155288
|
+
static: "pass",
|
|
155289
|
+
metric: "pass",
|
|
155290
|
+
layout: "not_run",
|
|
155291
|
+
ship: "pass"
|
|
155292
|
+
},
|
|
155293
|
+
policyAction: "substitute",
|
|
155294
|
+
measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
|
|
155295
|
+
candidateLicense: "OFL-1.1",
|
|
155296
|
+
exportRule: "preserve_original_name"
|
|
155297
|
+
},
|
|
155298
|
+
{
|
|
155299
|
+
evidenceId: "times-new-roman",
|
|
155300
|
+
logicalFamily: "Times New Roman",
|
|
155301
|
+
physicalFamily: "Liberation Serif",
|
|
155302
|
+
verdict: "metric_safe",
|
|
155303
|
+
faces: {
|
|
155304
|
+
regular: true,
|
|
155305
|
+
bold: true,
|
|
155306
|
+
italic: true,
|
|
155307
|
+
boldItalic: true
|
|
155308
|
+
},
|
|
155309
|
+
advance: {
|
|
155310
|
+
meanDelta: 0,
|
|
155311
|
+
maxDelta: 0
|
|
155312
|
+
},
|
|
155313
|
+
gates: {
|
|
155314
|
+
static: "pass",
|
|
155315
|
+
metric: "pass",
|
|
155316
|
+
layout: "not_run",
|
|
155317
|
+
ship: "pass"
|
|
155318
|
+
},
|
|
155319
|
+
policyAction: "substitute",
|
|
155320
|
+
measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
|
|
155321
|
+
candidateLicense: "OFL-1.1",
|
|
155322
|
+
exportRule: "preserve_original_name"
|
|
155323
|
+
},
|
|
155324
|
+
{
|
|
155325
|
+
evidenceId: "courier-new",
|
|
155326
|
+
logicalFamily: "Courier New",
|
|
155327
|
+
physicalFamily: "Liberation Mono",
|
|
155328
|
+
verdict: "metric_safe",
|
|
155329
|
+
faces: {
|
|
155330
|
+
regular: true,
|
|
155331
|
+
bold: true,
|
|
155332
|
+
italic: true,
|
|
155333
|
+
boldItalic: true
|
|
155334
|
+
},
|
|
155335
|
+
advance: {
|
|
155336
|
+
meanDelta: 0,
|
|
155337
|
+
maxDelta: 0
|
|
155338
|
+
},
|
|
155339
|
+
gates: {
|
|
155340
|
+
static: "pass",
|
|
155341
|
+
metric: "pass",
|
|
155342
|
+
layout: "not_run",
|
|
155343
|
+
ship: "pass"
|
|
155344
|
+
},
|
|
155345
|
+
policyAction: "substitute",
|
|
155346
|
+
measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
|
|
155347
|
+
candidateLicense: "OFL-1.1",
|
|
155348
|
+
exportRule: "preserve_original_name"
|
|
155349
|
+
},
|
|
155350
|
+
{
|
|
155351
|
+
evidenceId: "helvetica",
|
|
155352
|
+
logicalFamily: "Helvetica",
|
|
155353
|
+
physicalFamily: "Liberation Sans",
|
|
155354
|
+
verdict: "metric_safe",
|
|
155355
|
+
faces: {
|
|
155356
|
+
regular: true,
|
|
155357
|
+
bold: true,
|
|
155358
|
+
italic: true,
|
|
155359
|
+
boldItalic: true
|
|
155360
|
+
},
|
|
155361
|
+
advance: {
|
|
155362
|
+
meanDelta: 0,
|
|
155363
|
+
maxDelta: 0
|
|
155364
|
+
},
|
|
155365
|
+
gates: {
|
|
155366
|
+
static: "not_run",
|
|
155367
|
+
metric: "pass",
|
|
155368
|
+
layout: "not_run",
|
|
155369
|
+
ship: "fail"
|
|
155370
|
+
},
|
|
155371
|
+
policyAction: "substitute",
|
|
155372
|
+
measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
|
|
155373
|
+
candidateLicense: "OFL-1.1",
|
|
155374
|
+
exportRule: "preserve_original_name"
|
|
155375
|
+
},
|
|
155376
|
+
{
|
|
155377
|
+
evidenceId: "calibri-light",
|
|
155378
|
+
logicalFamily: "Calibri Light",
|
|
155379
|
+
physicalFamily: "Carlito",
|
|
155380
|
+
verdict: "visual_only",
|
|
155381
|
+
faces: {
|
|
155382
|
+
regular: false,
|
|
155383
|
+
bold: false,
|
|
155384
|
+
italic: false,
|
|
155385
|
+
boldItalic: false
|
|
155386
|
+
},
|
|
155387
|
+
advance: {
|
|
155388
|
+
meanDelta: 0.0148,
|
|
155389
|
+
maxDelta: 0.066
|
|
155390
|
+
},
|
|
155391
|
+
gates: {
|
|
155392
|
+
static: "not_run",
|
|
155393
|
+
metric: "fail",
|
|
155394
|
+
layout: "not_run",
|
|
155395
|
+
ship: "fail"
|
|
155396
|
+
},
|
|
155397
|
+
policyAction: "category_fallback",
|
|
155398
|
+
measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
|
|
155399
|
+
candidateLicense: "OFL-1.1",
|
|
155400
|
+
exportRule: "preserve_original_name"
|
|
155401
|
+
}
|
|
155402
|
+
]);
|
|
155403
|
+
BUNDLED_SUBSTITUTES = deriveBundledSubstitutes();
|
|
155404
|
+
CATEGORY_FALLBACKS = deriveCategoryFallbacks();
|
|
155405
|
+
defaultResolver = new FontResolver;
|
|
155406
|
+
DEFAULT_FONT_MEASURE_CONTEXT = Object.freeze({
|
|
155407
|
+
resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily(cssFontFamily),
|
|
155408
|
+
fontSignature: ""
|
|
155409
|
+
});
|
|
155410
|
+
BUNDLED_MANIFEST = Object.freeze([
|
|
155411
|
+
family("Carlito", "Carlito", "OFL-1.1"),
|
|
155412
|
+
family("Caladea", "Caladea", "Apache-2.0"),
|
|
155413
|
+
family("Liberation Sans", "LiberationSans", "OFL-1.1"),
|
|
155414
|
+
family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
|
|
155415
|
+
family("Liberation Mono", "LiberationMono", "OFL-1.1")
|
|
155416
|
+
]);
|
|
155417
|
+
installedRegistries = /* @__PURE__ */ new WeakMap;
|
|
155418
|
+
OS2_MIN_LENGTH = OS2_FSSELECTION + 2;
|
|
155419
|
+
registriesByFontSet = /* @__PURE__ */ new WeakMap;
|
|
155420
|
+
PHYSICAL_GENERIC = Object.freeze({
|
|
155421
|
+
Carlito: "sans-serif",
|
|
155422
|
+
Caladea: "serif",
|
|
155423
|
+
"Liberation Sans": "sans-serif",
|
|
155424
|
+
"Liberation Serif": "serif",
|
|
155425
|
+
"Liberation Mono": "monospace"
|
|
155426
|
+
});
|
|
155427
|
+
BUNDLED_FAMILIES = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
|
|
155428
|
+
FONT_OFFERINGS = deriveOfferings();
|
|
155429
|
+
DEFAULT_FONT_ORDER = [
|
|
155430
|
+
"Calibri",
|
|
155431
|
+
"Arial",
|
|
155432
|
+
"Courier New",
|
|
155433
|
+
"Times New Roman",
|
|
155434
|
+
"Helvetica"
|
|
155435
|
+
];
|
|
154354
155436
|
ALL_COMMENT_TARGETS = COMMENT_FILE_BASENAMES;
|
|
154355
155437
|
REL_ID_NUMERIC_PATTERN = /rId|mi/g;
|
|
154356
155438
|
FOOTNOTES_CONFIG$1 = {
|
|
@@ -155167,10 +156249,10 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
155167
156249
|
return fontsNode.elements.find((el) => el?.attributes?.["w:name"] === fontName) || null;
|
|
155168
156250
|
}
|
|
155169
156251
|
static getFallbackFromFontTable(docx, fontName) {
|
|
155170
|
-
const family = SuperConverter2.getFontTableEntry(docx, fontName)?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
|
|
155171
|
-
if (!family)
|
|
156252
|
+
const family$1 = SuperConverter2.getFontTableEntry(docx, fontName)?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
|
|
156253
|
+
if (!family$1)
|
|
155172
156254
|
return null;
|
|
155173
|
-
return FONT_FAMILY_FALLBACKS[family.toLowerCase()] || DEFAULT_GENERIC_FALLBACK;
|
|
156255
|
+
return FONT_FAMILY_FALLBACKS[family$1.toLowerCase()] || DEFAULT_GENERIC_FALLBACK;
|
|
155174
156256
|
}
|
|
155175
156257
|
static toCssFontFamily(fontName, docx) {
|
|
155176
156258
|
if (!fontName)
|
|
@@ -155600,13 +156682,16 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
155600
156682
|
for (const font of fontsToInclude) {
|
|
155601
156683
|
const filePath = elements.find((el) => el.attributes.Id === font.attributes["r:id"])?.attributes?.Target;
|
|
155602
156684
|
if (!filePath)
|
|
155603
|
-
|
|
155604
|
-
const
|
|
155605
|
-
if (!
|
|
155606
|
-
|
|
155607
|
-
const ttfBuffer = deobfuscateFont(
|
|
156685
|
+
continue;
|
|
156686
|
+
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
156687
|
+
if (!fontUint8Array?.buffer)
|
|
156688
|
+
continue;
|
|
156689
|
+
const ttfBuffer = deobfuscateFont(fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength), font.attributes["w:fontKey"]);
|
|
155608
156690
|
if (!ttfBuffer)
|
|
155609
|
-
|
|
156691
|
+
continue;
|
|
156692
|
+
const policy = parseEmbeddingPolicy(ttfBuffer);
|
|
156693
|
+
if (!(policy ? policy.embeddable : false))
|
|
156694
|
+
continue;
|
|
155610
156695
|
const blob = new Blob([ttfBuffer], { type: "font/ttf" });
|
|
155611
156696
|
const fontUrl = URL.createObjectURL(blob);
|
|
155612
156697
|
const isNormal = font.name.includes("Regular");
|
|
@@ -155631,6 +156716,48 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
155631
156716
|
fontsImported
|
|
155632
156717
|
};
|
|
155633
156718
|
}
|
|
156719
|
+
getEmbeddedFontFaces() {
|
|
156720
|
+
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
156721
|
+
if (!fontTable || !Object.keys(this.fonts).length)
|
|
156722
|
+
return [];
|
|
156723
|
+
const embedElements = (fontTable.elements?.find((el) => el.name === "w:fonts")?.elements?.filter((el) => el.elements?.some((nested) => nested?.attributes?.["r:id"] && nested?.attributes?.["w:fontKey"])) ?? []).flatMap((entry) => (entry.elements ?? []).filter((el) => el.name?.startsWith("w:embed")).map((el) => ({
|
|
156724
|
+
embed: el,
|
|
156725
|
+
family: entry.attributes?.["w:name"]
|
|
156726
|
+
})));
|
|
156727
|
+
const relElements = this.convertedXml["word/_rels/fontTable.xml.rels"]?.elements?.find((el) => el.name === "Relationships")?.elements ?? [];
|
|
156728
|
+
const faceFromEmbedName = (name = "") => ({
|
|
156729
|
+
weight: /bold/i.test(name) ? "700" : "400",
|
|
156730
|
+
style: /italic/i.test(name) ? "italic" : "normal"
|
|
156731
|
+
});
|
|
156732
|
+
const faces = [];
|
|
156733
|
+
for (const { embed, family: family$1 } of embedElements) {
|
|
156734
|
+
const relationshipId = embed.attributes?.["r:id"];
|
|
156735
|
+
const fontKey = embed.attributes?.["w:fontKey"];
|
|
156736
|
+
if (!family$1 || !relationshipId || !fontKey)
|
|
156737
|
+
continue;
|
|
156738
|
+
const filePath = relElements.find((el) => el.attributes?.Id === relationshipId)?.attributes?.Target;
|
|
156739
|
+
if (!filePath)
|
|
156740
|
+
continue;
|
|
156741
|
+
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
156742
|
+
if (!fontUint8Array?.buffer)
|
|
156743
|
+
continue;
|
|
156744
|
+
const ttf = deobfuscateFont(fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength), fontKey);
|
|
156745
|
+
if (!ttf)
|
|
156746
|
+
continue;
|
|
156747
|
+
const policy = parseEmbeddingPolicy(ttf);
|
|
156748
|
+
const fallback = faceFromEmbedName(embed.name);
|
|
156749
|
+
faces.push({
|
|
156750
|
+
family: family$1,
|
|
156751
|
+
source: ttf,
|
|
156752
|
+
weight: policy?.face.weight ?? fallback.weight,
|
|
156753
|
+
style: policy?.face.style ?? fallback.style,
|
|
156754
|
+
fsType: policy?.fsType ?? null,
|
|
156755
|
+
embeddable: policy ? policy.embeddable : false,
|
|
156756
|
+
relationshipId
|
|
156757
|
+
});
|
|
156758
|
+
}
|
|
156759
|
+
return faces;
|
|
156760
|
+
}
|
|
155634
156761
|
getDocumentInternalId() {
|
|
155635
156762
|
const settingsLocation = "word/settings.xml";
|
|
155636
156763
|
if (!this.convertedXml[settingsLocation])
|
|
@@ -156092,7 +157219,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
156092
157219
|
};
|
|
156093
157220
|
});
|
|
156094
157221
|
|
|
156095
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
157222
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-DUhzXJ4D.es.js
|
|
156096
157223
|
function parseSizeUnit(val = "0") {
|
|
156097
157224
|
const length = val.toString() || "0";
|
|
156098
157225
|
const value = Number.parseFloat(length);
|
|
@@ -166425,8 +167552,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
|
|
|
166425
167552
|
}
|
|
166426
167553
|
};
|
|
166427
167554
|
};
|
|
166428
|
-
var
|
|
166429
|
-
|
|
167555
|
+
var init_create_headless_toolbar_DUhzXJ4D_es = __esm(() => {
|
|
167556
|
+
init_SuperConverter_DOoAJ6Zk_es();
|
|
166430
167557
|
init_uuid_qzgm05fK_es();
|
|
166431
167558
|
init_constants_D9qj59G2_es();
|
|
166432
167559
|
init_dist_B8HfvhaK_es();
|
|
@@ -169073,1231 +170200,6 @@ var __plugin_vue_export_helper_default = (sfc, props) => {
|
|
|
169073
170200
|
};
|
|
169074
170201
|
var init__plugin_vue_export_helper_5t5P5NuM_es = () => {};
|
|
169075
170202
|
|
|
169076
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-tVaowTvG.es.js
|
|
169077
|
-
function isSettled(status) {
|
|
169078
|
-
return SETTLED_STATUSES.includes(status);
|
|
169079
|
-
}
|
|
169080
|
-
function normalizeFamilyKey$1(family$1) {
|
|
169081
|
-
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
169082
|
-
}
|
|
169083
|
-
function deriveBundledSubstitutes() {
|
|
169084
|
-
const substitutes = {};
|
|
169085
|
-
for (const row of SUBSTITUTION_EVIDENCE)
|
|
169086
|
-
if (row.policyAction === "substitute" && row.physicalFamily)
|
|
169087
|
-
substitutes[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
|
|
169088
|
-
return Object.freeze(substitutes);
|
|
169089
|
-
}
|
|
169090
|
-
function deriveCategoryFallbacks() {
|
|
169091
|
-
const fallbacks = {};
|
|
169092
|
-
for (const row of SUBSTITUTION_EVIDENCE)
|
|
169093
|
-
if (row.policyAction === "category_fallback" && row.physicalFamily)
|
|
169094
|
-
fallbacks[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
|
|
169095
|
-
return Object.freeze(fallbacks);
|
|
169096
|
-
}
|
|
169097
|
-
function stripFamilyQuotes(family$1) {
|
|
169098
|
-
return family$1.trim().replace(/^["']|["']$/g, "");
|
|
169099
|
-
}
|
|
169100
|
-
function splitStack(cssFontFamily) {
|
|
169101
|
-
return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
|
|
169102
|
-
}
|
|
169103
|
-
function createFontResolver() {
|
|
169104
|
-
return new FontResolver;
|
|
169105
|
-
}
|
|
169106
|
-
function resolveFontFamily2(logicalFamily) {
|
|
169107
|
-
return defaultResolver.resolveFontFamily(logicalFamily);
|
|
169108
|
-
}
|
|
169109
|
-
function resolvePhysicalFamily(cssFontFamily) {
|
|
169110
|
-
return defaultResolver.resolvePhysicalFamily(cssFontFamily);
|
|
169111
|
-
}
|
|
169112
|
-
function resolveFace(logicalFamily, face, hasFace) {
|
|
169113
|
-
return defaultResolver.resolveFace(logicalFamily, face, hasFace);
|
|
169114
|
-
}
|
|
169115
|
-
function getFontConfigVersion() {
|
|
169116
|
-
return fontConfigVersion;
|
|
169117
|
-
}
|
|
169118
|
-
function bumpFontConfigVersion() {
|
|
169119
|
-
return fontConfigVersion += 1;
|
|
169120
|
-
}
|
|
169121
|
-
function fourFaces(filePrefix) {
|
|
169122
|
-
return [
|
|
169123
|
-
{
|
|
169124
|
-
weight: "normal",
|
|
169125
|
-
style: "normal",
|
|
169126
|
-
file: `${filePrefix}-Regular.woff2`
|
|
169127
|
-
},
|
|
169128
|
-
{
|
|
169129
|
-
weight: "bold",
|
|
169130
|
-
style: "normal",
|
|
169131
|
-
file: `${filePrefix}-Bold.woff2`
|
|
169132
|
-
},
|
|
169133
|
-
{
|
|
169134
|
-
weight: "normal",
|
|
169135
|
-
style: "italic",
|
|
169136
|
-
file: `${filePrefix}-Italic.woff2`
|
|
169137
|
-
},
|
|
169138
|
-
{
|
|
169139
|
-
weight: "bold",
|
|
169140
|
-
style: "italic",
|
|
169141
|
-
file: `${filePrefix}-BoldItalic.woff2`
|
|
169142
|
-
}
|
|
169143
|
-
];
|
|
169144
|
-
}
|
|
169145
|
-
function family(name, filePrefix, license) {
|
|
169146
|
-
return {
|
|
169147
|
-
family: name,
|
|
169148
|
-
license,
|
|
169149
|
-
faces: fourFaces(filePrefix)
|
|
169150
|
-
};
|
|
169151
|
-
}
|
|
169152
|
-
function withTrailingSlash(base2) {
|
|
169153
|
-
return base2.endsWith("/") ? base2 : `${base2}/`;
|
|
169154
|
-
}
|
|
169155
|
-
function joinUrl(base2, file2) {
|
|
169156
|
-
return `${withTrailingSlash(base2)}${file2}`;
|
|
169157
|
-
}
|
|
169158
|
-
function weightToken(weight) {
|
|
169159
|
-
return weight === "bold" ? "700" : "400";
|
|
169160
|
-
}
|
|
169161
|
-
function bundledAssetSignature(resolve) {
|
|
169162
|
-
const family$1 = BUNDLED_MANIFEST[0];
|
|
169163
|
-
const face = family$1?.faces[0];
|
|
169164
|
-
if (!family$1 || !face)
|
|
169165
|
-
return "";
|
|
169166
|
-
return resolve({
|
|
169167
|
-
file: face.file,
|
|
169168
|
-
family: family$1.family,
|
|
169169
|
-
weight: weightToken(face.weight),
|
|
169170
|
-
style: face.style,
|
|
169171
|
-
source: "bundled-substitute"
|
|
169172
|
-
});
|
|
169173
|
-
}
|
|
169174
|
-
function installBundledSubstitutes(registry3, options = {}) {
|
|
169175
|
-
const resolve = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
|
|
169176
|
-
const signature = bundledAssetSignature(resolve);
|
|
169177
|
-
const installed = installedRegistries.get(registry3);
|
|
169178
|
-
if (installed !== undefined) {
|
|
169179
|
-
if (installed !== signature)
|
|
169180
|
-
console.warn(`[superdoc] bundled fonts are already registered for this document from "${installed}"; a later fonts config resolving to "${signature}" is ignored. Use one fonts.assetBaseUrl / fonts.resolveAssetUrl per document.`);
|
|
169181
|
-
return;
|
|
169182
|
-
}
|
|
169183
|
-
installedRegistries.set(registry3, signature);
|
|
169184
|
-
for (const family$1 of BUNDLED_MANIFEST)
|
|
169185
|
-
for (const face of family$1.faces) {
|
|
169186
|
-
const context = {
|
|
169187
|
-
file: face.file,
|
|
169188
|
-
family: family$1.family,
|
|
169189
|
-
weight: weightToken(face.weight),
|
|
169190
|
-
style: face.style,
|
|
169191
|
-
source: "bundled-substitute"
|
|
169192
|
-
};
|
|
169193
|
-
registry3.register({
|
|
169194
|
-
family: family$1.family,
|
|
169195
|
-
source: `url(${resolve(context)})`,
|
|
169196
|
-
descriptors: {
|
|
169197
|
-
weight: face.weight,
|
|
169198
|
-
style: face.style
|
|
169199
|
-
}
|
|
169200
|
-
});
|
|
169201
|
-
}
|
|
169202
|
-
}
|
|
169203
|
-
function buildFontReport(logicalFamilies, registry3, resolver2) {
|
|
169204
|
-
const seen = /* @__PURE__ */ new Set;
|
|
169205
|
-
const report = [];
|
|
169206
|
-
for (const logical of logicalFamilies) {
|
|
169207
|
-
if (!logical || seen.has(logical))
|
|
169208
|
-
continue;
|
|
169209
|
-
seen.add(logical);
|
|
169210
|
-
const { physicalFamily, reason } = resolver2 ? resolver2.resolveFontFamily(logical) : resolveFontFamily2(logical);
|
|
169211
|
-
const loadStatus = registry3.getStatus(physicalFamily);
|
|
169212
|
-
report.push({
|
|
169213
|
-
logicalFamily: logical,
|
|
169214
|
-
physicalFamily,
|
|
169215
|
-
reason,
|
|
169216
|
-
loadStatus,
|
|
169217
|
-
exportFamily: logical,
|
|
169218
|
-
missing: reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded"
|
|
169219
|
-
});
|
|
169220
|
-
}
|
|
169221
|
-
return report;
|
|
169222
|
-
}
|
|
169223
|
-
function buildFaceReport(usedFaces, registry3, resolver2) {
|
|
169224
|
-
const hasFace = (family$1, weight, style) => registry3.hasFace(family$1, weight, style);
|
|
169225
|
-
const seen = /* @__PURE__ */ new Set;
|
|
169226
|
-
const report = [];
|
|
169227
|
-
for (const { logicalFamily, weight, style } of usedFaces) {
|
|
169228
|
-
if (!logicalFamily)
|
|
169229
|
-
continue;
|
|
169230
|
-
const key2 = `${logicalFamily.toLowerCase()}|${weight}|${style}`;
|
|
169231
|
-
if (seen.has(key2))
|
|
169232
|
-
continue;
|
|
169233
|
-
seen.add(key2);
|
|
169234
|
-
const face = {
|
|
169235
|
-
weight,
|
|
169236
|
-
style
|
|
169237
|
-
};
|
|
169238
|
-
const { physicalFamily, reason } = resolver2 ? resolver2.resolveFace(logicalFamily, face, hasFace) : resolveFace(logicalFamily, face, hasFace);
|
|
169239
|
-
const loadStatus = registry3.getFaceStatus({
|
|
169240
|
-
family: physicalFamily,
|
|
169241
|
-
weight,
|
|
169242
|
-
style
|
|
169243
|
-
});
|
|
169244
|
-
const missing = reason === "fallback_face_absent" || reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded";
|
|
169245
|
-
report.push({
|
|
169246
|
-
logicalFamily,
|
|
169247
|
-
physicalFamily,
|
|
169248
|
-
reason,
|
|
169249
|
-
loadStatus,
|
|
169250
|
-
exportFamily: logicalFamily,
|
|
169251
|
-
missing,
|
|
169252
|
-
face
|
|
169253
|
-
});
|
|
169254
|
-
}
|
|
169255
|
-
return report;
|
|
169256
|
-
}
|
|
169257
|
-
function quoteFamily(family$1) {
|
|
169258
|
-
return `"${family$1.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
169259
|
-
}
|
|
169260
|
-
function canonicalizeFontSource(source) {
|
|
169261
|
-
const match = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
|
|
169262
|
-
if (!match)
|
|
169263
|
-
return source;
|
|
169264
|
-
let inner = match[1].trim();
|
|
169265
|
-
if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'"))
|
|
169266
|
-
inner = inner.slice(1, -1);
|
|
169267
|
-
return `url(${JSON.stringify(inner)})`;
|
|
169268
|
-
}
|
|
169269
|
-
function normalizeFamilyKey(family$1) {
|
|
169270
|
-
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
169271
|
-
}
|
|
169272
|
-
function normalizeWeight(weight) {
|
|
169273
|
-
if (weight === undefined)
|
|
169274
|
-
return "400";
|
|
169275
|
-
const w = String(weight).trim().toLowerCase();
|
|
169276
|
-
if (w === "bold" || w === "bolder")
|
|
169277
|
-
return "700";
|
|
169278
|
-
const n = Number(w);
|
|
169279
|
-
return Number.isFinite(n) && n >= 600 ? "700" : "400";
|
|
169280
|
-
}
|
|
169281
|
-
function normalizeStyle(style) {
|
|
169282
|
-
if (!style)
|
|
169283
|
-
return "normal";
|
|
169284
|
-
const s = style.trim().toLowerCase();
|
|
169285
|
-
return s.startsWith("italic") || s.startsWith("oblique") ? "italic" : "normal";
|
|
169286
|
-
}
|
|
169287
|
-
function faceKeyOf(family$1, weight, style) {
|
|
169288
|
-
return `${normalizeFamilyKey(family$1)}|${weight}|${style}`;
|
|
169289
|
-
}
|
|
169290
|
-
function faceProbe(family$1, weight, style, size) {
|
|
169291
|
-
return `${style === "italic" ? "italic " : ""}${weight} ${size} ${quoteFamily(family$1)}`;
|
|
169292
|
-
}
|
|
169293
|
-
function getFontRegistryFor(fontSet, FontFaceCtor) {
|
|
169294
|
-
if (!fontSet) {
|
|
169295
|
-
if (!domlessRegistry)
|
|
169296
|
-
domlessRegistry = new FontRegistry({});
|
|
169297
|
-
return domlessRegistry;
|
|
169298
|
-
}
|
|
169299
|
-
let registry3 = registriesByFontSet.get(fontSet);
|
|
169300
|
-
if (!registry3) {
|
|
169301
|
-
registry3 = new FontRegistry({
|
|
169302
|
-
fontSet,
|
|
169303
|
-
FontFaceCtor
|
|
169304
|
-
});
|
|
169305
|
-
registriesByFontSet.set(fontSet, registry3);
|
|
169306
|
-
}
|
|
169307
|
-
return registry3;
|
|
169308
|
-
}
|
|
169309
|
-
function classifyOffering(policyAction, verdict, physicalFamily, bundled) {
|
|
169310
|
-
if (policyAction === "preserve_only")
|
|
169311
|
-
return "preserve_only";
|
|
169312
|
-
if (policyAction === "customer_supplied" || physicalFamily == null)
|
|
169313
|
-
return "customer_supplied";
|
|
169314
|
-
if (policyAction === "category_fallback")
|
|
169315
|
-
return "category_fallback";
|
|
169316
|
-
if (!bundled)
|
|
169317
|
-
return "requires_asset";
|
|
169318
|
-
return verdict === "metric_safe" ? "default" : "qualified";
|
|
169319
|
-
}
|
|
169320
|
-
function deriveOfferings() {
|
|
169321
|
-
const offerings = SUBSTITUTION_EVIDENCE.map((row) => {
|
|
169322
|
-
const bundled = row.physicalFamily != null && BUNDLED_FAMILIES.has(row.physicalFamily);
|
|
169323
|
-
return {
|
|
169324
|
-
logicalFamily: row.logicalFamily,
|
|
169325
|
-
physicalFamily: row.physicalFamily,
|
|
169326
|
-
generic: row.physicalFamily && PHYSICAL_GENERIC[row.physicalFamily] || "sans-serif",
|
|
169327
|
-
offering: classifyOffering(row.policyAction, row.verdict, row.physicalFamily, bundled),
|
|
169328
|
-
bundled,
|
|
169329
|
-
verdict: row.verdict,
|
|
169330
|
-
evidenceId: row.evidenceId
|
|
169331
|
-
};
|
|
169332
|
-
});
|
|
169333
|
-
return Object.freeze(offerings);
|
|
169334
|
-
}
|
|
169335
|
-
function getDefaultFontOfferings() {
|
|
169336
|
-
const rank = (name) => {
|
|
169337
|
-
const i4 = DEFAULT_FONT_ORDER.indexOf(name);
|
|
169338
|
-
return i4 === -1 ? DEFAULT_FONT_ORDER.length : i4;
|
|
169339
|
-
};
|
|
169340
|
-
return FONT_OFFERINGS.filter((o) => o.offering === "default").sort((a, b) => rank(a.logicalFamily) - rank(b.logicalFamily));
|
|
169341
|
-
}
|
|
169342
|
-
function fontOfferingStack(offering) {
|
|
169343
|
-
return `${offering.logicalFamily}, ${offering.generic}`;
|
|
169344
|
-
}
|
|
169345
|
-
function fontOfferingRenderStack(offering) {
|
|
169346
|
-
return offering.physicalFamily ? `${offering.physicalFamily}, ${offering.generic}` : fontOfferingStack(offering);
|
|
169347
|
-
}
|
|
169348
|
-
function getDefaultFontFamilyOptions() {
|
|
169349
|
-
return getDefaultFontOfferings().map((offering) => ({
|
|
169350
|
-
label: offering.logicalFamily,
|
|
169351
|
-
value: fontOfferingStack(offering)
|
|
169352
|
-
}));
|
|
169353
|
-
}
|
|
169354
|
-
var SETTLED_STATUSES, SUBSTITUTION_EVIDENCE, BUNDLED_SUBSTITUTES, CATEGORY_FALLBACKS, FontResolver = class {
|
|
169355
|
-
#overrides = /* @__PURE__ */ new Map;
|
|
169356
|
-
#version = 0;
|
|
169357
|
-
#cachedSignature = null;
|
|
169358
|
-
map(logicalFamily, physicalFamily) {
|
|
169359
|
-
const key2 = normalizeFamilyKey$1(logicalFamily);
|
|
169360
|
-
const physical = physicalFamily?.trim();
|
|
169361
|
-
if (!key2 || !physical)
|
|
169362
|
-
return;
|
|
169363
|
-
if (this.#overrides.get(key2) === physical)
|
|
169364
|
-
return;
|
|
169365
|
-
if (key2 === normalizeFamilyKey$1(physical)) {
|
|
169366
|
-
if (this.#overrides.delete(key2)) {
|
|
169367
|
-
this.#version += 1;
|
|
169368
|
-
this.#cachedSignature = null;
|
|
169369
|
-
}
|
|
169370
|
-
return;
|
|
169371
|
-
}
|
|
169372
|
-
this.#overrides.set(key2, physical);
|
|
169373
|
-
this.#version += 1;
|
|
169374
|
-
this.#cachedSignature = null;
|
|
169375
|
-
}
|
|
169376
|
-
unmap(logicalFamily) {
|
|
169377
|
-
if (this.#overrides.delete(normalizeFamilyKey$1(logicalFamily))) {
|
|
169378
|
-
this.#version += 1;
|
|
169379
|
-
this.#cachedSignature = null;
|
|
169380
|
-
}
|
|
169381
|
-
}
|
|
169382
|
-
reset() {
|
|
169383
|
-
if (this.#overrides.size === 0)
|
|
169384
|
-
return;
|
|
169385
|
-
this.#overrides.clear();
|
|
169386
|
-
this.#version += 1;
|
|
169387
|
-
this.#cachedSignature = null;
|
|
169388
|
-
}
|
|
169389
|
-
get version() {
|
|
169390
|
-
return this.#version;
|
|
169391
|
-
}
|
|
169392
|
-
get signature() {
|
|
169393
|
-
if (this.#cachedSignature !== null)
|
|
169394
|
-
return this.#cachedSignature;
|
|
169395
|
-
this.#cachedSignature = this.#overrides.size === 0 ? "" : JSON.stringify([...this.#overrides.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
|
|
169396
|
-
return this.#cachedSignature;
|
|
169397
|
-
}
|
|
169398
|
-
#physicalFor(bareFamily) {
|
|
169399
|
-
const key2 = normalizeFamilyKey$1(bareFamily);
|
|
169400
|
-
const override = this.#overrides.get(key2);
|
|
169401
|
-
if (override)
|
|
169402
|
-
return {
|
|
169403
|
-
physical: override,
|
|
169404
|
-
reason: "custom_mapping"
|
|
169405
|
-
};
|
|
169406
|
-
const bundled = BUNDLED_SUBSTITUTES[key2];
|
|
169407
|
-
if (bundled)
|
|
169408
|
-
return {
|
|
169409
|
-
physical: bundled,
|
|
169410
|
-
reason: "bundled_substitute"
|
|
169411
|
-
};
|
|
169412
|
-
const category = CATEGORY_FALLBACKS[key2];
|
|
169413
|
-
if (category)
|
|
169414
|
-
return {
|
|
169415
|
-
physical: category,
|
|
169416
|
-
reason: "category_fallback"
|
|
169417
|
-
};
|
|
169418
|
-
return {
|
|
169419
|
-
physical: bareFamily,
|
|
169420
|
-
reason: "as_requested"
|
|
169421
|
-
};
|
|
169422
|
-
}
|
|
169423
|
-
#resolveFaceLadder(primary, face, hasFace) {
|
|
169424
|
-
const key2 = normalizeFamilyKey$1(primary);
|
|
169425
|
-
const override = this.#overrides.get(key2);
|
|
169426
|
-
if (override && hasFace(override, face.weight, face.style))
|
|
169427
|
-
return {
|
|
169428
|
-
physical: override,
|
|
169429
|
-
reason: "custom_mapping"
|
|
169430
|
-
};
|
|
169431
|
-
if (hasFace(primary, face.weight, face.style))
|
|
169432
|
-
return {
|
|
169433
|
-
physical: primary,
|
|
169434
|
-
reason: "registered_face"
|
|
169435
|
-
};
|
|
169436
|
-
const bundled = BUNDLED_SUBSTITUTES[key2];
|
|
169437
|
-
if (bundled && hasFace(bundled, face.weight, face.style))
|
|
169438
|
-
return {
|
|
169439
|
-
physical: bundled,
|
|
169440
|
-
reason: "bundled_substitute"
|
|
169441
|
-
};
|
|
169442
|
-
const category = CATEGORY_FALLBACKS[key2];
|
|
169443
|
-
if (category && hasFace(category, face.weight, face.style))
|
|
169444
|
-
return {
|
|
169445
|
-
physical: category,
|
|
169446
|
-
reason: "category_fallback"
|
|
169447
|
-
};
|
|
169448
|
-
if (override || bundled)
|
|
169449
|
-
return {
|
|
169450
|
-
physical: primary,
|
|
169451
|
-
reason: "fallback_face_absent"
|
|
169452
|
-
};
|
|
169453
|
-
return {
|
|
169454
|
-
physical: primary,
|
|
169455
|
-
reason: "as_requested"
|
|
169456
|
-
};
|
|
169457
|
-
}
|
|
169458
|
-
resolveFontFamily(logicalFamily) {
|
|
169459
|
-
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
169460
|
-
const { physical, reason } = this.#physicalFor(primary);
|
|
169461
|
-
return {
|
|
169462
|
-
logicalFamily,
|
|
169463
|
-
physicalFamily: stripFamilyQuotes(physical),
|
|
169464
|
-
reason
|
|
169465
|
-
};
|
|
169466
|
-
}
|
|
169467
|
-
resolvePhysicalFamily(cssFontFamily) {
|
|
169468
|
-
if (!cssFontFamily)
|
|
169469
|
-
return cssFontFamily;
|
|
169470
|
-
const parts = splitStack(cssFontFamily);
|
|
169471
|
-
if (parts.length === 0)
|
|
169472
|
-
return cssFontFamily;
|
|
169473
|
-
const { physical, reason } = this.#physicalFor(parts[0]);
|
|
169474
|
-
if (reason === "as_requested")
|
|
169475
|
-
return cssFontFamily;
|
|
169476
|
-
return [physical, ...parts.slice(1)].join(", ");
|
|
169477
|
-
}
|
|
169478
|
-
resolveFace(logicalFamily, face, hasFace) {
|
|
169479
|
-
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
169480
|
-
const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
|
|
169481
|
-
return {
|
|
169482
|
-
logicalFamily,
|
|
169483
|
-
physicalFamily: stripFamilyQuotes(physical),
|
|
169484
|
-
reason
|
|
169485
|
-
};
|
|
169486
|
-
}
|
|
169487
|
-
resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
|
|
169488
|
-
if (!cssFontFamily)
|
|
169489
|
-
return cssFontFamily;
|
|
169490
|
-
const parts = splitStack(cssFontFamily);
|
|
169491
|
-
if (parts.length === 0)
|
|
169492
|
-
return cssFontFamily;
|
|
169493
|
-
const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
|
|
169494
|
-
if (normalizeFamilyKey$1(physical) !== normalizeFamilyKey$1(parts[0]))
|
|
169495
|
-
return [physical, ...parts.slice(1)].join(", ");
|
|
169496
|
-
return cssFontFamily;
|
|
169497
|
-
}
|
|
169498
|
-
resolvePrimaryPhysicalFamily(family$1) {
|
|
169499
|
-
const primary = splitStack(family$1)[0] ?? family$1;
|
|
169500
|
-
return this.#physicalFor(primary).physical;
|
|
169501
|
-
}
|
|
169502
|
-
resolvePhysicalFamilies(families) {
|
|
169503
|
-
const out = /* @__PURE__ */ new Set;
|
|
169504
|
-
for (const family$1 of families)
|
|
169505
|
-
if (family$1)
|
|
169506
|
-
out.add(this.resolvePrimaryPhysicalFamily(family$1));
|
|
169507
|
-
return [...out];
|
|
169508
|
-
}
|
|
169509
|
-
}, defaultResolver, DEFAULT_FONT_MEASURE_CONTEXT, fontConfigVersion = 0, BUNDLED_MANIFEST, defaultAssetBase = "/fonts/", installedRegistries, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
|
|
169510
|
-
#fontSet;
|
|
169511
|
-
#FontFaceCtor;
|
|
169512
|
-
#probeSize;
|
|
169513
|
-
#scheduleTimeout;
|
|
169514
|
-
#cancelTimeout;
|
|
169515
|
-
#managed = /* @__PURE__ */ new Map;
|
|
169516
|
-
#status = /* @__PURE__ */ new Map;
|
|
169517
|
-
#sources = /* @__PURE__ */ new Map;
|
|
169518
|
-
#warnedFailures = /* @__PURE__ */ new Set;
|
|
169519
|
-
#inflight = /* @__PURE__ */ new Map;
|
|
169520
|
-
#faceStatus = /* @__PURE__ */ new Map;
|
|
169521
|
-
#faceInflight = /* @__PURE__ */ new Map;
|
|
169522
|
-
#faceSources = /* @__PURE__ */ new Map;
|
|
169523
|
-
#facesByFamily = /* @__PURE__ */ new Map;
|
|
169524
|
-
#providerFaceKeys = /* @__PURE__ */ new Set;
|
|
169525
|
-
#warnedFaceFailures = /* @__PURE__ */ new Set;
|
|
169526
|
-
constructor(options = {}) {
|
|
169527
|
-
this.#fontSet = options.fontSet ?? null;
|
|
169528
|
-
this.#FontFaceCtor = options.FontFaceCtor ?? null;
|
|
169529
|
-
this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
|
|
169530
|
-
this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
|
|
169531
|
-
this.#cancelTimeout = options.cancelTimeout ?? ((handle2) => globalThis.clearTimeout(handle2));
|
|
169532
|
-
}
|
|
169533
|
-
register(descriptor) {
|
|
169534
|
-
const { family: family$1, source, descriptors: descriptors2 } = descriptor;
|
|
169535
|
-
const identitySource = typeof source === "string" ? canonicalizeFontSource(source) : source;
|
|
169536
|
-
const weight = normalizeWeight(descriptors2?.weight);
|
|
169537
|
-
const style = normalizeStyle(descriptors2?.style);
|
|
169538
|
-
const key2 = faceKeyOf(family$1, weight, style);
|
|
169539
|
-
if (typeof identitySource === "string") {
|
|
169540
|
-
const existingSource = this.#faceSources.get(key2);
|
|
169541
|
-
if (existingSource === identitySource)
|
|
169542
|
-
return {
|
|
169543
|
-
family: family$1,
|
|
169544
|
-
status: this.getStatus(family$1),
|
|
169545
|
-
changed: false
|
|
169546
|
-
};
|
|
169547
|
-
if (existingSource !== undefined)
|
|
169548
|
-
throw new Error(`[superdoc] font face "${key2}" is already registered from a different source ("${existingSource}"); a registered face's source cannot be replaced`);
|
|
169549
|
-
}
|
|
169550
|
-
if (this.#FontFaceCtor && this.#fontSet) {
|
|
169551
|
-
const face = new this.#FontFaceCtor(family$1, source, {
|
|
169552
|
-
...descriptors2,
|
|
169553
|
-
weight,
|
|
169554
|
-
style
|
|
169555
|
-
});
|
|
169556
|
-
this.#fontSet.add(face);
|
|
169557
|
-
this.#managed.set(family$1, face);
|
|
169558
|
-
}
|
|
169559
|
-
if (typeof source === "string") {
|
|
169560
|
-
const list4 = this.#sources.get(family$1) ?? [];
|
|
169561
|
-
if (!list4.includes(source))
|
|
169562
|
-
list4.push(source);
|
|
169563
|
-
this.#sources.set(family$1, list4);
|
|
169564
|
-
}
|
|
169565
|
-
if (!this.#status.has(family$1))
|
|
169566
|
-
this.#status.set(family$1, "unloaded");
|
|
169567
|
-
this.#providerFaceKeys.add(key2);
|
|
169568
|
-
this.#trackFace(family$1, key2);
|
|
169569
|
-
if (!this.#faceStatus.has(key2))
|
|
169570
|
-
this.#faceStatus.set(key2, "unloaded");
|
|
169571
|
-
if (typeof identitySource === "string" && !this.#faceSources.has(key2))
|
|
169572
|
-
this.#faceSources.set(key2, identitySource);
|
|
169573
|
-
return {
|
|
169574
|
-
family: family$1,
|
|
169575
|
-
status: this.getStatus(family$1),
|
|
169576
|
-
changed: true
|
|
169577
|
-
};
|
|
169578
|
-
}
|
|
169579
|
-
#trackFace(family$1, key2) {
|
|
169580
|
-
const fam = normalizeFamilyKey(family$1);
|
|
169581
|
-
const set3 = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
|
|
169582
|
-
set3.add(key2);
|
|
169583
|
-
this.#facesByFamily.set(fam, set3);
|
|
169584
|
-
}
|
|
169585
|
-
isManaged(family$1) {
|
|
169586
|
-
return this.#managed.has(family$1);
|
|
169587
|
-
}
|
|
169588
|
-
getStatus(family$1) {
|
|
169589
|
-
const statuses = [];
|
|
169590
|
-
const faceKeys = this.#facesByFamily.get(normalizeFamilyKey(family$1));
|
|
169591
|
-
if (faceKeys)
|
|
169592
|
-
for (const k of faceKeys)
|
|
169593
|
-
statuses.push(this.#faceStatus.get(k) ?? "unloaded");
|
|
169594
|
-
const legacy = this.#status.get(family$1);
|
|
169595
|
-
if (legacy)
|
|
169596
|
-
statuses.push(legacy);
|
|
169597
|
-
if (statuses.length === 0)
|
|
169598
|
-
return "unloaded";
|
|
169599
|
-
for (const s of [
|
|
169600
|
-
"failed",
|
|
169601
|
-
"timed_out",
|
|
169602
|
-
"fallback_used",
|
|
169603
|
-
"loaded",
|
|
169604
|
-
"loading",
|
|
169605
|
-
"unloaded"
|
|
169606
|
-
])
|
|
169607
|
-
if (statuses.includes(s))
|
|
169608
|
-
return s;
|
|
169609
|
-
return "unloaded";
|
|
169610
|
-
}
|
|
169611
|
-
hasFace(family$1, weight, style) {
|
|
169612
|
-
const key2 = faceKeyOf(family$1, weight, style);
|
|
169613
|
-
return this.#providerFaceKeys.has(key2) && this.#faceStatus.get(key2) !== "failed";
|
|
169614
|
-
}
|
|
169615
|
-
isAvailable(family$1) {
|
|
169616
|
-
if (!this.#fontSet)
|
|
169617
|
-
return false;
|
|
169618
|
-
try {
|
|
169619
|
-
return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
|
|
169620
|
-
} catch {
|
|
169621
|
-
return false;
|
|
169622
|
-
}
|
|
169623
|
-
}
|
|
169624
|
-
awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
169625
|
-
if (this.#status.get(family$1) === "loaded")
|
|
169626
|
-
return Promise.resolve({
|
|
169627
|
-
family: family$1,
|
|
169628
|
-
status: "loaded"
|
|
169629
|
-
});
|
|
169630
|
-
const existing = this.#inflight.get(family$1);
|
|
169631
|
-
if (existing)
|
|
169632
|
-
return existing;
|
|
169633
|
-
const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
|
|
169634
|
-
this.#inflight.delete(family$1);
|
|
169635
|
-
});
|
|
169636
|
-
this.#inflight.set(family$1, probe);
|
|
169637
|
-
return probe;
|
|
169638
|
-
}
|
|
169639
|
-
async awaitFaces(families, options = {}) {
|
|
169640
|
-
const unique = [...new Set(families)];
|
|
169641
|
-
const timeoutMs = options.timeoutMs ?? 3000;
|
|
169642
|
-
return Promise.all(unique.map((family$1) => this.awaitFace(family$1, timeoutMs)));
|
|
169643
|
-
}
|
|
169644
|
-
getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
169645
|
-
return [...new Set(families)].map((family$1) => ({
|
|
169646
|
-
family: family$1,
|
|
169647
|
-
status: this.getStatus(family$1),
|
|
169648
|
-
ready: this.awaitFace(family$1, timeoutMs)
|
|
169649
|
-
}));
|
|
169650
|
-
}
|
|
169651
|
-
getStates() {
|
|
169652
|
-
return [...this.#status.entries()].map(([family$1, status]) => ({
|
|
169653
|
-
family: family$1,
|
|
169654
|
-
status
|
|
169655
|
-
}));
|
|
169656
|
-
}
|
|
169657
|
-
getFaceStatus(request) {
|
|
169658
|
-
return this.#faceStatus.get(faceKeyOf(request.family, request.weight, request.style)) ?? "unloaded";
|
|
169659
|
-
}
|
|
169660
|
-
awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
169661
|
-
const key2 = faceKeyOf(request.family, request.weight, request.style);
|
|
169662
|
-
if (this.#faceStatus.get(key2) === "loaded")
|
|
169663
|
-
return Promise.resolve({
|
|
169664
|
-
request,
|
|
169665
|
-
status: "loaded"
|
|
169666
|
-
});
|
|
169667
|
-
const existing = this.#faceInflight.get(key2);
|
|
169668
|
-
if (existing)
|
|
169669
|
-
return existing;
|
|
169670
|
-
const probe = this.#loadOneFace(request, key2, timeoutMs).finally(() => {
|
|
169671
|
-
this.#faceInflight.delete(key2);
|
|
169672
|
-
});
|
|
169673
|
-
this.#faceInflight.set(key2, probe);
|
|
169674
|
-
return probe;
|
|
169675
|
-
}
|
|
169676
|
-
async awaitFaceRequests(requests, options = {}) {
|
|
169677
|
-
const timeoutMs = options.timeoutMs ?? 3000;
|
|
169678
|
-
const seen = /* @__PURE__ */ new Set;
|
|
169679
|
-
const unique = [];
|
|
169680
|
-
for (const r of requests) {
|
|
169681
|
-
const key2 = faceKeyOf(r.family, r.weight, r.style);
|
|
169682
|
-
if (seen.has(key2))
|
|
169683
|
-
continue;
|
|
169684
|
-
seen.add(key2);
|
|
169685
|
-
unique.push(r);
|
|
169686
|
-
}
|
|
169687
|
-
return Promise.all(unique.map((r) => this.awaitFaceRequest(r, timeoutMs)));
|
|
169688
|
-
}
|
|
169689
|
-
async#loadOneFace(request, key2, timeoutMs) {
|
|
169690
|
-
this.#trackFace(request.family, key2);
|
|
169691
|
-
const fontSet = this.#fontSet;
|
|
169692
|
-
if (!fontSet) {
|
|
169693
|
-
this.#faceStatus.set(key2, "fallback_used");
|
|
169694
|
-
return {
|
|
169695
|
-
request,
|
|
169696
|
-
status: "fallback_used"
|
|
169697
|
-
};
|
|
169698
|
-
}
|
|
169699
|
-
this.#faceStatus.set(key2, "loading");
|
|
169700
|
-
const probe = faceProbe(request.family, request.weight, request.style, this.#probeSize);
|
|
169701
|
-
const TIMEOUT = Symbol("timeout");
|
|
169702
|
-
let handle2;
|
|
169703
|
-
const timeout = new Promise((resolve) => {
|
|
169704
|
-
handle2 = this.#scheduleTimeout(() => resolve(TIMEOUT), timeoutMs);
|
|
169705
|
-
});
|
|
169706
|
-
try {
|
|
169707
|
-
const settled = await Promise.race([fontSet.load(probe), timeout]);
|
|
169708
|
-
if (settled === TIMEOUT) {
|
|
169709
|
-
this.#faceStatus.set(key2, "timed_out");
|
|
169710
|
-
return {
|
|
169711
|
-
request,
|
|
169712
|
-
status: "timed_out"
|
|
169713
|
-
};
|
|
169714
|
-
}
|
|
169715
|
-
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
169716
|
-
this.#faceStatus.set(key2, status);
|
|
169717
|
-
return {
|
|
169718
|
-
request,
|
|
169719
|
-
status
|
|
169720
|
-
};
|
|
169721
|
-
} catch {
|
|
169722
|
-
this.#faceStatus.set(key2, "failed");
|
|
169723
|
-
this.#warnFaceFailureOnce(request, key2);
|
|
169724
|
-
return {
|
|
169725
|
-
request,
|
|
169726
|
-
status: "failed"
|
|
169727
|
-
};
|
|
169728
|
-
} finally {
|
|
169729
|
-
this.#cancelTimeout(handle2);
|
|
169730
|
-
}
|
|
169731
|
-
}
|
|
169732
|
-
#warnFaceFailureOnce(request, key2) {
|
|
169733
|
-
if (this.#warnedFaceFailures.has(key2))
|
|
169734
|
-
return;
|
|
169735
|
-
this.#warnedFaceFailures.add(key2);
|
|
169736
|
-
const src = this.#faceSources.get(key2);
|
|
169737
|
-
const detail = src ? ` from ${src}` : "";
|
|
169738
|
-
console.warn(`[superdoc] font face failed to load: "${request.family}" ${request.weight} ${request.style}${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
169739
|
-
}
|
|
169740
|
-
async#loadOne(family$1, timeoutMs) {
|
|
169741
|
-
const fontSet = this.#fontSet;
|
|
169742
|
-
if (!fontSet) {
|
|
169743
|
-
this.#status.set(family$1, "fallback_used");
|
|
169744
|
-
return {
|
|
169745
|
-
family: family$1,
|
|
169746
|
-
status: "fallback_used"
|
|
169747
|
-
};
|
|
169748
|
-
}
|
|
169749
|
-
this.#status.set(family$1, "loading");
|
|
169750
|
-
const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
|
|
169751
|
-
const TIMEOUT = Symbol("timeout");
|
|
169752
|
-
let handle2;
|
|
169753
|
-
const timeout = new Promise((resolve) => {
|
|
169754
|
-
handle2 = this.#scheduleTimeout(() => resolve(TIMEOUT), timeoutMs);
|
|
169755
|
-
});
|
|
169756
|
-
try {
|
|
169757
|
-
const settled = await Promise.race([fontSet.load(probe), timeout]);
|
|
169758
|
-
if (settled === TIMEOUT) {
|
|
169759
|
-
this.#status.set(family$1, "timed_out");
|
|
169760
|
-
return {
|
|
169761
|
-
family: family$1,
|
|
169762
|
-
status: "timed_out"
|
|
169763
|
-
};
|
|
169764
|
-
}
|
|
169765
|
-
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
169766
|
-
this.#status.set(family$1, status);
|
|
169767
|
-
return {
|
|
169768
|
-
family: family$1,
|
|
169769
|
-
status
|
|
169770
|
-
};
|
|
169771
|
-
} catch {
|
|
169772
|
-
this.#status.set(family$1, "failed");
|
|
169773
|
-
this.#warnLoadFailureOnce(family$1);
|
|
169774
|
-
return {
|
|
169775
|
-
family: family$1,
|
|
169776
|
-
status: "failed"
|
|
169777
|
-
};
|
|
169778
|
-
} finally {
|
|
169779
|
-
this.#cancelTimeout(handle2);
|
|
169780
|
-
}
|
|
169781
|
-
}
|
|
169782
|
-
#warnLoadFailureOnce(family$1) {
|
|
169783
|
-
if (this.#warnedFailures.has(family$1))
|
|
169784
|
-
return;
|
|
169785
|
-
this.#warnedFailures.add(family$1);
|
|
169786
|
-
const sources = this.#sources.get(family$1);
|
|
169787
|
-
const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
|
|
169788
|
-
console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
169789
|
-
}
|
|
169790
|
-
}, registriesByFontSet, domlessRegistry = null, PHYSICAL_GENERIC, BUNDLED_FAMILIES, FONT_OFFERINGS, DEFAULT_FONT_ORDER, headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
|
|
169791
|
-
var init_create_super_doc_ui_tVaowTvG_es = __esm(() => {
|
|
169792
|
-
init_SuperConverter_bEQ45IUD_es();
|
|
169793
|
-
init_create_headless_toolbar_BmFWtej0_es();
|
|
169794
|
-
SETTLED_STATUSES = [
|
|
169795
|
-
"loaded",
|
|
169796
|
-
"failed",
|
|
169797
|
-
"timed_out",
|
|
169798
|
-
"fallback_used"
|
|
169799
|
-
];
|
|
169800
|
-
SUBSTITUTION_EVIDENCE = Object.freeze([
|
|
169801
|
-
{
|
|
169802
|
-
evidenceId: "calibri",
|
|
169803
|
-
logicalFamily: "Calibri",
|
|
169804
|
-
physicalFamily: "Carlito",
|
|
169805
|
-
verdict: "metric_safe",
|
|
169806
|
-
faces: {
|
|
169807
|
-
regular: true,
|
|
169808
|
-
bold: true,
|
|
169809
|
-
italic: true,
|
|
169810
|
-
boldItalic: true
|
|
169811
|
-
},
|
|
169812
|
-
advance: {
|
|
169813
|
-
meanDelta: 0,
|
|
169814
|
-
maxDelta: 0
|
|
169815
|
-
},
|
|
169816
|
-
gates: {
|
|
169817
|
-
static: "pass",
|
|
169818
|
-
metric: "pass",
|
|
169819
|
-
layout: "pass",
|
|
169820
|
-
ship: "pass"
|
|
169821
|
-
},
|
|
169822
|
-
policyAction: "substitute",
|
|
169823
|
-
measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
|
|
169824
|
-
candidateLicense: "OFL-1.1",
|
|
169825
|
-
exportRule: "preserve_original_name"
|
|
169826
|
-
},
|
|
169827
|
-
{
|
|
169828
|
-
evidenceId: "cambria",
|
|
169829
|
-
logicalFamily: "Cambria",
|
|
169830
|
-
physicalFamily: "Caladea",
|
|
169831
|
-
verdict: "visual_only",
|
|
169832
|
-
faceVerdicts: {
|
|
169833
|
-
regular: "metric_safe",
|
|
169834
|
-
bold: "metric_safe",
|
|
169835
|
-
italic: "metric_safe",
|
|
169836
|
-
boldItalic: "visual_only"
|
|
169837
|
-
},
|
|
169838
|
-
glyphExceptions: [{
|
|
169839
|
-
slot: "boldItalic",
|
|
169840
|
-
codepoint: 96,
|
|
169841
|
-
advanceDelta: 0.231,
|
|
169842
|
-
note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
|
|
169843
|
-
}],
|
|
169844
|
-
faces: {
|
|
169845
|
-
regular: true,
|
|
169846
|
-
bold: true,
|
|
169847
|
-
italic: true,
|
|
169848
|
-
boldItalic: true
|
|
169849
|
-
},
|
|
169850
|
-
advance: {
|
|
169851
|
-
meanDelta: 0.0002378,
|
|
169852
|
-
maxDelta: 0.2310758
|
|
169853
|
-
},
|
|
169854
|
-
gates: {
|
|
169855
|
-
static: "pass",
|
|
169856
|
-
metric: "pass",
|
|
169857
|
-
layout: "not_run",
|
|
169858
|
-
ship: "pass"
|
|
169859
|
-
},
|
|
169860
|
-
policyAction: "substitute",
|
|
169861
|
-
measurementRefs: [
|
|
169862
|
-
"cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
|
|
169863
|
-
"cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
|
|
169864
|
-
"cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
|
|
169865
|
-
"cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
|
|
169866
|
-
],
|
|
169867
|
-
candidateLicense: "Apache-2.0",
|
|
169868
|
-
exportRule: "preserve_original_name"
|
|
169869
|
-
},
|
|
169870
|
-
{
|
|
169871
|
-
evidenceId: "arial",
|
|
169872
|
-
logicalFamily: "Arial",
|
|
169873
|
-
physicalFamily: "Liberation Sans",
|
|
169874
|
-
verdict: "metric_safe",
|
|
169875
|
-
faces: {
|
|
169876
|
-
regular: true,
|
|
169877
|
-
bold: true,
|
|
169878
|
-
italic: true,
|
|
169879
|
-
boldItalic: true
|
|
169880
|
-
},
|
|
169881
|
-
advance: {
|
|
169882
|
-
meanDelta: 0,
|
|
169883
|
-
maxDelta: 0
|
|
169884
|
-
},
|
|
169885
|
-
gates: {
|
|
169886
|
-
static: "pass",
|
|
169887
|
-
metric: "pass",
|
|
169888
|
-
layout: "not_run",
|
|
169889
|
-
ship: "pass"
|
|
169890
|
-
},
|
|
169891
|
-
policyAction: "substitute",
|
|
169892
|
-
measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
|
|
169893
|
-
candidateLicense: "OFL-1.1",
|
|
169894
|
-
exportRule: "preserve_original_name"
|
|
169895
|
-
},
|
|
169896
|
-
{
|
|
169897
|
-
evidenceId: "times-new-roman",
|
|
169898
|
-
logicalFamily: "Times New Roman",
|
|
169899
|
-
physicalFamily: "Liberation Serif",
|
|
169900
|
-
verdict: "metric_safe",
|
|
169901
|
-
faces: {
|
|
169902
|
-
regular: true,
|
|
169903
|
-
bold: true,
|
|
169904
|
-
italic: true,
|
|
169905
|
-
boldItalic: true
|
|
169906
|
-
},
|
|
169907
|
-
advance: {
|
|
169908
|
-
meanDelta: 0,
|
|
169909
|
-
maxDelta: 0
|
|
169910
|
-
},
|
|
169911
|
-
gates: {
|
|
169912
|
-
static: "pass",
|
|
169913
|
-
metric: "pass",
|
|
169914
|
-
layout: "not_run",
|
|
169915
|
-
ship: "pass"
|
|
169916
|
-
},
|
|
169917
|
-
policyAction: "substitute",
|
|
169918
|
-
measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
|
|
169919
|
-
candidateLicense: "OFL-1.1",
|
|
169920
|
-
exportRule: "preserve_original_name"
|
|
169921
|
-
},
|
|
169922
|
-
{
|
|
169923
|
-
evidenceId: "courier-new",
|
|
169924
|
-
logicalFamily: "Courier New",
|
|
169925
|
-
physicalFamily: "Liberation Mono",
|
|
169926
|
-
verdict: "metric_safe",
|
|
169927
|
-
faces: {
|
|
169928
|
-
regular: true,
|
|
169929
|
-
bold: true,
|
|
169930
|
-
italic: true,
|
|
169931
|
-
boldItalic: true
|
|
169932
|
-
},
|
|
169933
|
-
advance: {
|
|
169934
|
-
meanDelta: 0,
|
|
169935
|
-
maxDelta: 0
|
|
169936
|
-
},
|
|
169937
|
-
gates: {
|
|
169938
|
-
static: "pass",
|
|
169939
|
-
metric: "pass",
|
|
169940
|
-
layout: "not_run",
|
|
169941
|
-
ship: "pass"
|
|
169942
|
-
},
|
|
169943
|
-
policyAction: "substitute",
|
|
169944
|
-
measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
|
|
169945
|
-
candidateLicense: "OFL-1.1",
|
|
169946
|
-
exportRule: "preserve_original_name"
|
|
169947
|
-
},
|
|
169948
|
-
{
|
|
169949
|
-
evidenceId: "helvetica",
|
|
169950
|
-
logicalFamily: "Helvetica",
|
|
169951
|
-
physicalFamily: "Liberation Sans",
|
|
169952
|
-
verdict: "metric_safe",
|
|
169953
|
-
faces: {
|
|
169954
|
-
regular: true,
|
|
169955
|
-
bold: true,
|
|
169956
|
-
italic: true,
|
|
169957
|
-
boldItalic: true
|
|
169958
|
-
},
|
|
169959
|
-
advance: {
|
|
169960
|
-
meanDelta: 0,
|
|
169961
|
-
maxDelta: 0
|
|
169962
|
-
},
|
|
169963
|
-
gates: {
|
|
169964
|
-
static: "not_run",
|
|
169965
|
-
metric: "pass",
|
|
169966
|
-
layout: "not_run",
|
|
169967
|
-
ship: "fail"
|
|
169968
|
-
},
|
|
169969
|
-
policyAction: "substitute",
|
|
169970
|
-
measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
|
|
169971
|
-
candidateLicense: "OFL-1.1",
|
|
169972
|
-
exportRule: "preserve_original_name"
|
|
169973
|
-
},
|
|
169974
|
-
{
|
|
169975
|
-
evidenceId: "calibri-light",
|
|
169976
|
-
logicalFamily: "Calibri Light",
|
|
169977
|
-
physicalFamily: "Carlito",
|
|
169978
|
-
verdict: "visual_only",
|
|
169979
|
-
faces: {
|
|
169980
|
-
regular: false,
|
|
169981
|
-
bold: false,
|
|
169982
|
-
italic: false,
|
|
169983
|
-
boldItalic: false
|
|
169984
|
-
},
|
|
169985
|
-
advance: {
|
|
169986
|
-
meanDelta: 0.0148,
|
|
169987
|
-
maxDelta: 0.066
|
|
169988
|
-
},
|
|
169989
|
-
gates: {
|
|
169990
|
-
static: "not_run",
|
|
169991
|
-
metric: "fail",
|
|
169992
|
-
layout: "not_run",
|
|
169993
|
-
ship: "fail"
|
|
169994
|
-
},
|
|
169995
|
-
policyAction: "category_fallback",
|
|
169996
|
-
measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
|
|
169997
|
-
candidateLicense: "OFL-1.1",
|
|
169998
|
-
exportRule: "preserve_original_name"
|
|
169999
|
-
}
|
|
170000
|
-
]);
|
|
170001
|
-
BUNDLED_SUBSTITUTES = deriveBundledSubstitutes();
|
|
170002
|
-
CATEGORY_FALLBACKS = deriveCategoryFallbacks();
|
|
170003
|
-
defaultResolver = new FontResolver;
|
|
170004
|
-
DEFAULT_FONT_MEASURE_CONTEXT = Object.freeze({
|
|
170005
|
-
resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily(cssFontFamily),
|
|
170006
|
-
fontSignature: ""
|
|
170007
|
-
});
|
|
170008
|
-
BUNDLED_MANIFEST = Object.freeze([
|
|
170009
|
-
family("Carlito", "Carlito", "OFL-1.1"),
|
|
170010
|
-
family("Caladea", "Caladea", "Apache-2.0"),
|
|
170011
|
-
family("Liberation Sans", "LiberationSans", "OFL-1.1"),
|
|
170012
|
-
family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
|
|
170013
|
-
family("Liberation Mono", "LiberationMono", "OFL-1.1")
|
|
170014
|
-
]);
|
|
170015
|
-
installedRegistries = /* @__PURE__ */ new WeakMap;
|
|
170016
|
-
registriesByFontSet = /* @__PURE__ */ new WeakMap;
|
|
170017
|
-
PHYSICAL_GENERIC = Object.freeze({
|
|
170018
|
-
Carlito: "sans-serif",
|
|
170019
|
-
Caladea: "serif",
|
|
170020
|
-
"Liberation Sans": "sans-serif",
|
|
170021
|
-
"Liberation Serif": "serif",
|
|
170022
|
-
"Liberation Mono": "monospace"
|
|
170023
|
-
});
|
|
170024
|
-
BUNDLED_FAMILIES = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
|
|
170025
|
-
FONT_OFFERINGS = deriveOfferings();
|
|
170026
|
-
DEFAULT_FONT_ORDER = [
|
|
170027
|
-
"Calibri",
|
|
170028
|
-
"Arial",
|
|
170029
|
-
"Courier New",
|
|
170030
|
-
"Times New Roman",
|
|
170031
|
-
"Helvetica"
|
|
170032
|
-
];
|
|
170033
|
-
headlessToolbarConstants = {
|
|
170034
|
-
DEFAULT_TEXT_ALIGN_OPTIONS: [
|
|
170035
|
-
{
|
|
170036
|
-
label: "Left",
|
|
170037
|
-
value: "left"
|
|
170038
|
-
},
|
|
170039
|
-
{
|
|
170040
|
-
label: "Center",
|
|
170041
|
-
value: "center"
|
|
170042
|
-
},
|
|
170043
|
-
{
|
|
170044
|
-
label: "Right",
|
|
170045
|
-
value: "right"
|
|
170046
|
-
},
|
|
170047
|
-
{
|
|
170048
|
-
label: "Justify",
|
|
170049
|
-
value: "justify"
|
|
170050
|
-
}
|
|
170051
|
-
],
|
|
170052
|
-
DEFAULT_LINE_HEIGHT_OPTIONS: [
|
|
170053
|
-
{
|
|
170054
|
-
label: "1.00",
|
|
170055
|
-
value: 1
|
|
170056
|
-
},
|
|
170057
|
-
{
|
|
170058
|
-
label: "1.15",
|
|
170059
|
-
value: 1.15
|
|
170060
|
-
},
|
|
170061
|
-
{
|
|
170062
|
-
label: "1.50",
|
|
170063
|
-
value: 1.5
|
|
170064
|
-
},
|
|
170065
|
-
{
|
|
170066
|
-
label: "2.00",
|
|
170067
|
-
value: 2
|
|
170068
|
-
},
|
|
170069
|
-
{
|
|
170070
|
-
label: "2.50",
|
|
170071
|
-
value: 2.5
|
|
170072
|
-
},
|
|
170073
|
-
{
|
|
170074
|
-
label: "3.00",
|
|
170075
|
-
value: 3
|
|
170076
|
-
}
|
|
170077
|
-
],
|
|
170078
|
-
DEFAULT_ZOOM_OPTIONS: [
|
|
170079
|
-
{
|
|
170080
|
-
label: "50%",
|
|
170081
|
-
value: 50
|
|
170082
|
-
},
|
|
170083
|
-
{
|
|
170084
|
-
label: "75%",
|
|
170085
|
-
value: 75
|
|
170086
|
-
},
|
|
170087
|
-
{
|
|
170088
|
-
label: "90%",
|
|
170089
|
-
value: 90
|
|
170090
|
-
},
|
|
170091
|
-
{
|
|
170092
|
-
label: "100%",
|
|
170093
|
-
value: 100
|
|
170094
|
-
},
|
|
170095
|
-
{
|
|
170096
|
-
label: "125%",
|
|
170097
|
-
value: 125
|
|
170098
|
-
},
|
|
170099
|
-
{
|
|
170100
|
-
label: "150%",
|
|
170101
|
-
value: 150
|
|
170102
|
-
},
|
|
170103
|
-
{
|
|
170104
|
-
label: "200%",
|
|
170105
|
-
value: 200
|
|
170106
|
-
}
|
|
170107
|
-
],
|
|
170108
|
-
DEFAULT_DOCUMENT_MODE_OPTIONS: [
|
|
170109
|
-
{
|
|
170110
|
-
label: "Editing",
|
|
170111
|
-
value: "editing",
|
|
170112
|
-
description: "Edit document directly"
|
|
170113
|
-
},
|
|
170114
|
-
{
|
|
170115
|
-
label: "Suggesting",
|
|
170116
|
-
value: "suggesting",
|
|
170117
|
-
description: "Edits become suggestions"
|
|
170118
|
-
},
|
|
170119
|
-
{
|
|
170120
|
-
label: "Viewing",
|
|
170121
|
-
value: "viewing",
|
|
170122
|
-
description: "View clean version of document only"
|
|
170123
|
-
}
|
|
170124
|
-
],
|
|
170125
|
-
DEFAULT_FONT_SIZE_OPTIONS: [
|
|
170126
|
-
{
|
|
170127
|
-
label: "8",
|
|
170128
|
-
value: "8pt"
|
|
170129
|
-
},
|
|
170130
|
-
{
|
|
170131
|
-
label: "9",
|
|
170132
|
-
value: "9pt"
|
|
170133
|
-
},
|
|
170134
|
-
{
|
|
170135
|
-
label: "10",
|
|
170136
|
-
value: "10pt"
|
|
170137
|
-
},
|
|
170138
|
-
{
|
|
170139
|
-
label: "11",
|
|
170140
|
-
value: "11pt"
|
|
170141
|
-
},
|
|
170142
|
-
{
|
|
170143
|
-
label: "12",
|
|
170144
|
-
value: "12pt"
|
|
170145
|
-
},
|
|
170146
|
-
{
|
|
170147
|
-
label: "14",
|
|
170148
|
-
value: "14pt"
|
|
170149
|
-
},
|
|
170150
|
-
{
|
|
170151
|
-
label: "18",
|
|
170152
|
-
value: "18pt"
|
|
170153
|
-
},
|
|
170154
|
-
{
|
|
170155
|
-
label: "24",
|
|
170156
|
-
value: "24pt"
|
|
170157
|
-
},
|
|
170158
|
-
{
|
|
170159
|
-
label: "30",
|
|
170160
|
-
value: "30pt"
|
|
170161
|
-
},
|
|
170162
|
-
{
|
|
170163
|
-
label: "36",
|
|
170164
|
-
value: "36pt"
|
|
170165
|
-
},
|
|
170166
|
-
{
|
|
170167
|
-
label: "48",
|
|
170168
|
-
value: "48pt"
|
|
170169
|
-
},
|
|
170170
|
-
{
|
|
170171
|
-
label: "60",
|
|
170172
|
-
value: "60pt"
|
|
170173
|
-
},
|
|
170174
|
-
{
|
|
170175
|
-
label: "72",
|
|
170176
|
-
value: "72pt"
|
|
170177
|
-
},
|
|
170178
|
-
{
|
|
170179
|
-
label: "96",
|
|
170180
|
-
value: "96pt"
|
|
170181
|
-
}
|
|
170182
|
-
],
|
|
170183
|
-
DEFAULT_FONT_FAMILY_OPTIONS: getDefaultFontFamilyOptions(),
|
|
170184
|
-
DEFAULT_TEXT_COLOR_OPTIONS: [
|
|
170185
|
-
{
|
|
170186
|
-
label: "Black",
|
|
170187
|
-
value: "#000000"
|
|
170188
|
-
},
|
|
170189
|
-
{
|
|
170190
|
-
label: "Dark Gray",
|
|
170191
|
-
value: "#434343"
|
|
170192
|
-
},
|
|
170193
|
-
{
|
|
170194
|
-
label: "Gray",
|
|
170195
|
-
value: "#666666"
|
|
170196
|
-
},
|
|
170197
|
-
{
|
|
170198
|
-
label: "Light Gray",
|
|
170199
|
-
value: "#999999"
|
|
170200
|
-
},
|
|
170201
|
-
{
|
|
170202
|
-
label: "Red",
|
|
170203
|
-
value: "#ff0000"
|
|
170204
|
-
},
|
|
170205
|
-
{
|
|
170206
|
-
label: "Orange",
|
|
170207
|
-
value: "#ff9900"
|
|
170208
|
-
},
|
|
170209
|
-
{
|
|
170210
|
-
label: "Yellow",
|
|
170211
|
-
value: "#ffff00"
|
|
170212
|
-
},
|
|
170213
|
-
{
|
|
170214
|
-
label: "Green",
|
|
170215
|
-
value: "#00ff00"
|
|
170216
|
-
},
|
|
170217
|
-
{
|
|
170218
|
-
label: "Cyan",
|
|
170219
|
-
value: "#00ffff"
|
|
170220
|
-
},
|
|
170221
|
-
{
|
|
170222
|
-
label: "Blue",
|
|
170223
|
-
value: "#0000ff"
|
|
170224
|
-
},
|
|
170225
|
-
{
|
|
170226
|
-
label: "Purple",
|
|
170227
|
-
value: "#9900ff"
|
|
170228
|
-
},
|
|
170229
|
-
{
|
|
170230
|
-
label: "Magenta",
|
|
170231
|
-
value: "#ff00ff"
|
|
170232
|
-
},
|
|
170233
|
-
{
|
|
170234
|
-
label: "None",
|
|
170235
|
-
value: "none"
|
|
170236
|
-
}
|
|
170237
|
-
],
|
|
170238
|
-
DEFAULT_HIGHLIGHT_COLOR_OPTIONS: [
|
|
170239
|
-
{
|
|
170240
|
-
label: "Yellow",
|
|
170241
|
-
value: "#ffff00"
|
|
170242
|
-
},
|
|
170243
|
-
{
|
|
170244
|
-
label: "Green",
|
|
170245
|
-
value: "#00ff00"
|
|
170246
|
-
},
|
|
170247
|
-
{
|
|
170248
|
-
label: "Cyan",
|
|
170249
|
-
value: "#00ffff"
|
|
170250
|
-
},
|
|
170251
|
-
{
|
|
170252
|
-
label: "Pink",
|
|
170253
|
-
value: "#ff00ff"
|
|
170254
|
-
},
|
|
170255
|
-
{
|
|
170256
|
-
label: "Blue",
|
|
170257
|
-
value: "#0000ff"
|
|
170258
|
-
},
|
|
170259
|
-
{
|
|
170260
|
-
label: "Red",
|
|
170261
|
-
value: "#ff0000"
|
|
170262
|
-
},
|
|
170263
|
-
{
|
|
170264
|
-
label: "Orange",
|
|
170265
|
-
value: "#ff9900"
|
|
170266
|
-
},
|
|
170267
|
-
{
|
|
170268
|
-
label: "None",
|
|
170269
|
-
value: "none"
|
|
170270
|
-
}
|
|
170271
|
-
]
|
|
170272
|
-
};
|
|
170273
|
-
MOD_ALIASES = new Set([
|
|
170274
|
-
"Mod",
|
|
170275
|
-
"Meta",
|
|
170276
|
-
"Cmd",
|
|
170277
|
-
"Command"
|
|
170278
|
-
]);
|
|
170279
|
-
ALT_ALIASES = new Set(["Alt", "Option"]);
|
|
170280
|
-
CTRL_ALIASES = new Set(["Control", "Ctrl"]);
|
|
170281
|
-
SHIFT_ALIASES = new Set(["Shift"]);
|
|
170282
|
-
BUILTIN_CONTEXT_MENU_GROUPS = [
|
|
170283
|
-
"format",
|
|
170284
|
-
"clipboard",
|
|
170285
|
-
"review",
|
|
170286
|
-
"comment",
|
|
170287
|
-
"link"
|
|
170288
|
-
];
|
|
170289
|
-
BUILTIN_GROUP_ORDER = new Map(BUILTIN_CONTEXT_MENU_GROUPS.map((g, i4) => [g, i4]));
|
|
170290
|
-
RESERVED_PROXY_PROPERTY_NAMES = new Set([
|
|
170291
|
-
"register",
|
|
170292
|
-
"get",
|
|
170293
|
-
"has",
|
|
170294
|
-
"require",
|
|
170295
|
-
"getContextMenuItems"
|
|
170296
|
-
]);
|
|
170297
|
-
ALL_TOOLBAR_COMMAND_IDS = Object.keys(createToolbarRegistry());
|
|
170298
|
-
EMPTY_ACTIVE_IDS = Object.freeze([]);
|
|
170299
|
-
});
|
|
170300
|
-
|
|
170301
170203
|
// ../../packages/superdoc/dist/chunks/eventemitter3-BnGqBE-Q.es.js
|
|
170302
170204
|
var import_eventemitter3;
|
|
170303
170205
|
var init_eventemitter3_BnGqBE_Q_es = __esm(() => {
|
|
@@ -222335,7 +222237,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
222335
222237
|
init_remark_gfm_BhnWr3yf_es();
|
|
222336
222238
|
});
|
|
222337
222239
|
|
|
222338
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
222240
|
+
// ../../packages/superdoc/dist/chunks/src-DEnygTyz.es.js
|
|
222339
222241
|
function deleteProps(obj, propOrProps) {
|
|
222340
222242
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
222341
222243
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -238994,7 +238896,7 @@ function buildChangedTextFields(type, excerpt) {
|
|
|
238994
238896
|
}
|
|
238995
238897
|
function buildProjectedInfo(snapshot2, options = {}) {
|
|
238996
238898
|
const id2 = options.id ?? snapshot2.address.entityId;
|
|
238997
|
-
const type = options.type ?? snapshot2.type;
|
|
238899
|
+
const type = options.type ?? projectInternalTrackChangeType(snapshot2.type, { subtype: snapshot2.subtype });
|
|
238998
238900
|
return {
|
|
238999
238901
|
info: {
|
|
239000
238902
|
address: {
|
|
@@ -239003,7 +238905,6 @@ function buildProjectedInfo(snapshot2, options = {}) {
|
|
|
239003
238905
|
},
|
|
239004
238906
|
id: id2,
|
|
239005
238907
|
type,
|
|
239006
|
-
...type === "structural" && snapshot2.subtype ? { subtype: snapshot2.subtype } : {},
|
|
239007
238908
|
grouping: options.grouping,
|
|
239008
238909
|
pairedWithChangeId: options.pairedWithChangeId ?? undefined,
|
|
239009
238910
|
wordRevisionIds: normalizeWordRevisionIds(snapshot2.wordRevisionIds),
|
|
@@ -239034,7 +238935,7 @@ function replacementPairKey2(snapshot2) {
|
|
|
239034
238935
|
return null;
|
|
239035
238936
|
}
|
|
239036
238937
|
function projectedSnapshotType(snapshot2) {
|
|
239037
|
-
return isCombinedReplacementSnapshot(snapshot2) ? "replacement" : snapshot2.type;
|
|
238938
|
+
return isCombinedReplacementSnapshot(snapshot2) ? "replacement" : projectInternalTrackChangeType(snapshot2.type, { subtype: snapshot2.subtype });
|
|
239038
238939
|
}
|
|
239039
238940
|
function snapshotGrouping(snapshot2) {
|
|
239040
238941
|
return isCombinedReplacementSnapshot(snapshot2) ? "replacement-pair" : "standalone";
|
|
@@ -239259,11 +239160,10 @@ function trackChangesListWrapper(editor, input2) {
|
|
|
239259
239160
|
const items = paged.items.map((row2) => {
|
|
239260
239161
|
const info = row2.info;
|
|
239261
239162
|
const handle3 = buildResolvedHandle(row2.handleKey, "stable", "trackedChange");
|
|
239262
|
-
const { address, type,
|
|
239163
|
+
const { address, type, grouping, pairedWithChangeId, wordRevisionIds, overlap, author, authorEmail, authorImage, date: date6, excerpt, insertedText, deletedText, origin, imported } = info;
|
|
239263
239164
|
return buildDiscoveryItem(info.id, handle3, {
|
|
239264
239165
|
address,
|
|
239265
239166
|
type,
|
|
239266
|
-
...subtype ? { subtype } : {},
|
|
239267
239167
|
grouping,
|
|
239268
239168
|
pairedWithChangeId,
|
|
239269
239169
|
wordRevisionIds,
|
|
@@ -239314,7 +239214,7 @@ function trackChangesGetWrapper(editor, input2) {
|
|
|
239314
239214
|
const snapshot2 = snapshots.find((item) => item.anchorKey === anchorKey || item.address.entityId === baseId);
|
|
239315
239215
|
if (snapshot2)
|
|
239316
239216
|
return snapshotToInfo(snapshot2);
|
|
239317
|
-
const type = resolveTrackedChangeType(resolved.change);
|
|
239217
|
+
const type = projectInternalTrackChangeType(resolveTrackedChangeType(resolved.change), resolved.change.structural);
|
|
239318
239218
|
const excerpt = (resolved.change.excerpt !== undefined ? resolved.change.excerpt : undefined) ?? normalizeExcerpt(resolved.editor.state.doc.textBetween(resolved.change.from, resolved.change.to, " ", ""));
|
|
239319
239219
|
const grouping = resolved.change.hasInsert && resolved.change.hasDelete && !resolved.change.hasFormat ? "replacement-pair" : undefined;
|
|
239320
239220
|
return {
|
|
@@ -239326,7 +239226,6 @@ function trackChangesGetWrapper(editor, input2) {
|
|
|
239326
239226
|
},
|
|
239327
239227
|
id: resolved.change.id,
|
|
239328
239228
|
type,
|
|
239329
|
-
...type === "structural" && resolved.change.structural ? { subtype: resolved.change.structural.subtype } : {},
|
|
239330
239229
|
grouping,
|
|
239331
239230
|
wordRevisionIds: normalizeWordRevisionIds(resolved.change.wordRevisionIds),
|
|
239332
239231
|
overlap: resolved.change.overlap,
|
|
@@ -239565,12 +239464,20 @@ function isTrackedChangeCommentTargetShape(target) {
|
|
|
239565
239464
|
return false;
|
|
239566
239465
|
return typeof value.trackedChangeId === "string" && value.trackedChangeId.length > 0;
|
|
239567
239466
|
}
|
|
239467
|
+
function trackedChangeDisplayType(snapshot2) {
|
|
239468
|
+
if (snapshot2.type !== "structural")
|
|
239469
|
+
return null;
|
|
239470
|
+
return snapshot2.subtype === "table-delete" ? "tableDelete" : "tableInsert";
|
|
239471
|
+
}
|
|
239472
|
+
function publicTrackedChangeType(snapshot2) {
|
|
239473
|
+
return projectInternalTrackChangeType(snapshot2.type, { subtype: snapshot2.subtype });
|
|
239474
|
+
}
|
|
239568
239475
|
function buildTrackedChangeLink(snapshot2) {
|
|
239569
239476
|
const { trackedChangeText, deletedText } = trackedChangeTextFields(snapshot2);
|
|
239570
239477
|
return {
|
|
239571
239478
|
trackedChange: true,
|
|
239572
|
-
trackedChangeType: snapshot2
|
|
239573
|
-
trackedChangeDisplayType:
|
|
239479
|
+
trackedChangeType: publicTrackedChangeType(snapshot2),
|
|
239480
|
+
trackedChangeDisplayType: trackedChangeDisplayType(snapshot2),
|
|
239574
239481
|
trackedChangeStory: snapshot2.story,
|
|
239575
239482
|
trackedChangeAnchorKey: snapshot2.anchorKey,
|
|
239576
239483
|
trackedChangeText,
|
|
@@ -239614,7 +239521,7 @@ function choosePreferredTrackedChangeSnapshot(snapshots, preferredId) {
|
|
|
239614
239521
|
const rightLength = Math.max(0, right$1.range.to - right$1.range.from);
|
|
239615
239522
|
if (leftLength !== rightLength)
|
|
239616
239523
|
return leftLength - rightLength;
|
|
239617
|
-
const typeDelta = trackedChangeTypePriority(left$1
|
|
239524
|
+
const typeDelta = trackedChangeTypePriority(publicTrackedChangeType(left$1)) - trackedChangeTypePriority(publicTrackedChangeType(right$1));
|
|
239618
239525
|
if (typeDelta !== 0)
|
|
239619
239526
|
return typeDelta;
|
|
239620
239527
|
if (left$1.range.from !== right$1.range.from)
|
|
@@ -239831,7 +239738,7 @@ function parseCreatedTime(value) {
|
|
|
239831
239738
|
}
|
|
239832
239739
|
function trackedChangeTextFields(snapshot2) {
|
|
239833
239740
|
const excerpt = snapshot2.excerpt ?? "";
|
|
239834
|
-
if (snapshot2
|
|
239741
|
+
if (publicTrackedChangeType(snapshot2) === "delete")
|
|
239835
239742
|
return {
|
|
239836
239743
|
trackedChangeText: "",
|
|
239837
239744
|
deletedText: excerpt
|
|
@@ -239858,7 +239765,8 @@ function toTrackedChangeCommentInfo(snapshot2) {
|
|
|
239858
239765
|
anchoredText: snapshot2.excerpt,
|
|
239859
239766
|
story: snapshot2.story,
|
|
239860
239767
|
trackedChange: true,
|
|
239861
|
-
trackedChangeType: snapshot2
|
|
239768
|
+
trackedChangeType: publicTrackedChangeType(snapshot2),
|
|
239769
|
+
trackedChangeDisplayType: trackedChangeDisplayType(snapshot2),
|
|
239862
239770
|
trackedChangeStory: snapshot2.story,
|
|
239863
239771
|
trackedChangeAnchorKey: snapshot2.anchorKey,
|
|
239864
239772
|
trackedChangeText,
|
|
@@ -240725,7 +240633,7 @@ function listCommentsHandler(editor, query) {
|
|
|
240725
240633
|
const paged = paginate(filtered, query?.offset, query?.limit);
|
|
240726
240634
|
const items = paged.items.map((comment2) => {
|
|
240727
240635
|
const handle3 = buildResolvedHandle(`comment:${comment2.commentId}`, "stable", "comment");
|
|
240728
|
-
const { importedId, parentCommentId, text: text5, isInternal, status, target, anchoredText, createdTime, creatorName, creatorEmail, address, story, trackedChange, trackedChangeType, trackedChangeDisplayType, trackedChangeStory, trackedChangeAnchorKey, trackedChangeText, deletedText, trackedChangeLink } = comment2;
|
|
240636
|
+
const { importedId, parentCommentId, text: text5, isInternal, status, target, anchoredText, createdTime, creatorName, creatorEmail, address, story, trackedChange, trackedChangeType, trackedChangeDisplayType: trackedChangeDisplayType$1, trackedChangeStory, trackedChangeAnchorKey, trackedChangeText, deletedText, trackedChangeLink } = comment2;
|
|
240729
240637
|
return buildDiscoveryItem(comment2.commentId, handle3, {
|
|
240730
240638
|
address,
|
|
240731
240639
|
importedId,
|
|
@@ -240741,7 +240649,7 @@ function listCommentsHandler(editor, query) {
|
|
|
240741
240649
|
story,
|
|
240742
240650
|
trackedChange,
|
|
240743
240651
|
trackedChangeType,
|
|
240744
|
-
trackedChangeDisplayType,
|
|
240652
|
+
trackedChangeDisplayType: trackedChangeDisplayType$1,
|
|
240745
240653
|
trackedChangeStory,
|
|
240746
240654
|
trackedChangeAnchorKey,
|
|
240747
240655
|
trackedChangeText,
|
|
@@ -241678,6 +241586,27 @@ function rewriteImportedStyleNumbering(importedStyleEls, numRemap) {
|
|
|
241678
241586
|
function numAttr(el, attr) {
|
|
241679
241587
|
return el.attributes?.[attr];
|
|
241680
241588
|
}
|
|
241589
|
+
function reorderNumberingChildren(numberingEl) {
|
|
241590
|
+
if (!numberingEl.elements)
|
|
241591
|
+
return;
|
|
241592
|
+
const other = [];
|
|
241593
|
+
const abstracts = [];
|
|
241594
|
+
const nums = [];
|
|
241595
|
+
for (const el of numberingEl.elements) {
|
|
241596
|
+
const ln = localName$1(el);
|
|
241597
|
+
if (ln === "abstractNum")
|
|
241598
|
+
abstracts.push(el);
|
|
241599
|
+
else if (ln === "num")
|
|
241600
|
+
nums.push(el);
|
|
241601
|
+
else
|
|
241602
|
+
other.push(el);
|
|
241603
|
+
}
|
|
241604
|
+
numberingEl.elements = [
|
|
241605
|
+
...other,
|
|
241606
|
+
...abstracts,
|
|
241607
|
+
...nums
|
|
241608
|
+
];
|
|
241609
|
+
}
|
|
241681
241610
|
function mergeNumberingGraph(currentRoot, sourceRoot) {
|
|
241682
241611
|
const result = {
|
|
241683
241612
|
numRemap: /* @__PURE__ */ new Map,
|
|
@@ -241761,6 +241690,7 @@ function mergeNumberingGraph(currentRoot, sourceRoot) {
|
|
|
241761
241690
|
usedNum.add(id2);
|
|
241762
241691
|
cur.elements.push(next2);
|
|
241763
241692
|
}
|
|
241693
|
+
reorderNumberingChildren(cur);
|
|
241764
241694
|
return result;
|
|
241765
241695
|
}
|
|
241766
241696
|
function reconcileSettings(currentRoot, sourceRoot) {
|
|
@@ -241950,18 +241880,21 @@ function importHeaderFooterAssets(editor, converter, byName, dryRun) {
|
|
|
241950
241880
|
usedMedia.add(allocated);
|
|
241951
241881
|
return allocated;
|
|
241952
241882
|
};
|
|
241953
|
-
const
|
|
241883
|
+
const sourceRelIdsByTarget = /* @__PURE__ */ new Map;
|
|
241954
241884
|
for (const rel of srcRelEls) {
|
|
241955
241885
|
const type = rel.attributes?.Type;
|
|
241956
241886
|
const target = rel.attributes?.Target;
|
|
241957
241887
|
const id2 = rel.attributes?.Id;
|
|
241958
241888
|
if (!type || !target || !id2)
|
|
241959
241889
|
continue;
|
|
241960
|
-
if (type === HEADER_REL_TYPE2 || type === FOOTER_REL_TYPE2)
|
|
241961
|
-
|
|
241962
|
-
|
|
241963
|
-
|
|
241964
|
-
|
|
241890
|
+
if (type === HEADER_REL_TYPE2 || type === FOOTER_REL_TYPE2) {
|
|
241891
|
+
const sourceTarget = relTargetToWordPath(target).replace(/^word\//, "");
|
|
241892
|
+
const existing = sourceRelIdsByTarget.get(sourceTarget);
|
|
241893
|
+
if (existing)
|
|
241894
|
+
existing.push(id2);
|
|
241895
|
+
else
|
|
241896
|
+
sourceRelIdsByTarget.set(sourceTarget, [id2]);
|
|
241897
|
+
}
|
|
241965
241898
|
}
|
|
241966
241899
|
const setHeaderIdsArray = (idsHolder, relId) => {
|
|
241967
241900
|
if (!Array.isArray(idsHolder.ids))
|
|
@@ -242052,12 +241985,12 @@ function importHeaderFooterAssets(editor, converter, byName, dryRun) {
|
|
|
242052
241985
|
}
|
|
242053
241986
|
});
|
|
242054
241987
|
docRelsChanged = true;
|
|
242055
|
-
const
|
|
242056
|
-
|
|
242057
|
-
result.relIdRemap.set(
|
|
241988
|
+
const sourceRelIds = sourceRelIdsByTarget.get(sourceTarget) ?? [];
|
|
241989
|
+
for (const sourceRelId of sourceRelIds) {
|
|
241990
|
+
result.relIdRemap.set(sourceRelId, relId);
|
|
242058
241991
|
result.mappings.push({
|
|
242059
241992
|
kind: "relationship",
|
|
242060
|
-
from:
|
|
241993
|
+
from: sourceRelId,
|
|
242061
241994
|
to: relId
|
|
242062
241995
|
});
|
|
242063
241996
|
}
|
|
@@ -242107,6 +242040,29 @@ function ensureContentTypeOverride$1(converter, partPath, contentType) {
|
|
|
242107
242040
|
});
|
|
242108
242041
|
return true;
|
|
242109
242042
|
}
|
|
242043
|
+
function toSectionXmlElement(node2) {
|
|
242044
|
+
if (!node2.name)
|
|
242045
|
+
throw new Error("Expected named XML element.");
|
|
242046
|
+
return {
|
|
242047
|
+
type: node2.type,
|
|
242048
|
+
name: node2.name,
|
|
242049
|
+
attributes: node2.attributes ? { ...node2.attributes } : undefined,
|
|
242050
|
+
elements: node2.elements?.filter((child) => typeof child.name === "string").map((child) => toSectionXmlElement(child))
|
|
242051
|
+
};
|
|
242052
|
+
}
|
|
242053
|
+
function mergePageOneHeaderFooterModel(targetSectPr, sourceSectPr) {
|
|
242054
|
+
const mergedSectPr = ensureSectPrElement(targetSectPr);
|
|
242055
|
+
for (const kind of HEADER_FOOTER_KINDS2)
|
|
242056
|
+
for (const variant of HEADER_FOOTER_VARIANTS$2) {
|
|
242057
|
+
const sourceRef = getSectPrHeaderFooterRef(sourceSectPr, kind, variant);
|
|
242058
|
+
if (sourceRef)
|
|
242059
|
+
setSectPrHeaderFooterRef(mergedSectPr, kind, variant, sourceRef);
|
|
242060
|
+
else
|
|
242061
|
+
clearSectPrHeaderFooterRef(mergedSectPr, kind, variant);
|
|
242062
|
+
}
|
|
242063
|
+
writeSectPrTitlePage(mergedSectPr, readSectPrTitlePage(sourceSectPr));
|
|
242064
|
+
return mergedSectPr;
|
|
242065
|
+
}
|
|
242110
242066
|
function applyPageOneSectionDefaults(editor, sourceDocumentXml, relIdRemap, parseXml2, dryRun) {
|
|
242111
242067
|
const result = {
|
|
242112
242068
|
detected: false,
|
|
@@ -242125,8 +242081,18 @@ function applyPageOneSectionDefaults(editor, sourceDocumentXml, relIdRemap, pars
|
|
|
242125
242081
|
if (!sourceSectPr)
|
|
242126
242082
|
return result;
|
|
242127
242083
|
result.detected = true;
|
|
242128
|
-
|
|
242129
|
-
|
|
242084
|
+
let sectPr;
|
|
242085
|
+
try {
|
|
242086
|
+
const rewrittenSectPr = clone2(sourceSectPr);
|
|
242087
|
+
rewriteSectPrRefs(rewrittenSectPr, relIdRemap);
|
|
242088
|
+
sectPr = toSectionXmlElement(rewrittenSectPr);
|
|
242089
|
+
} catch {
|
|
242090
|
+
result.warnings.push({
|
|
242091
|
+
code: "SECTION_DEFAULTS_UNAVAILABLE",
|
|
242092
|
+
message: "Could not normalize the source page-1 sectPr."
|
|
242093
|
+
});
|
|
242094
|
+
return result;
|
|
242095
|
+
}
|
|
242130
242096
|
let projections;
|
|
242131
242097
|
try {
|
|
242132
242098
|
projections = resolveSectionProjections(editor);
|
|
@@ -242137,26 +242103,43 @@ function applyPageOneSectionDefaults(editor, sourceDocumentXml, relIdRemap, pars
|
|
|
242137
242103
|
});
|
|
242138
242104
|
return result;
|
|
242139
242105
|
}
|
|
242140
|
-
|
|
242141
|
-
if (!bodyProjection) {
|
|
242106
|
+
if (projections.length === 0) {
|
|
242142
242107
|
result.warnings.push({
|
|
242143
242108
|
code: "SECTION_DEFAULTS_UNAVAILABLE",
|
|
242144
|
-
message: "No
|
|
242109
|
+
message: "No section projections found for page-1 sectPr adoption."
|
|
242145
242110
|
});
|
|
242146
242111
|
return result;
|
|
242147
242112
|
}
|
|
242148
|
-
|
|
242113
|
+
const bodyProjection = [...projections].reverse().find((projection) => projection.target.kind === "body") ?? projections[projections.length - 1];
|
|
242114
|
+
const sectionUpdates = projections.map((projection) => {
|
|
242115
|
+
const currentSectPr = readTargetSectPr(editor, projection);
|
|
242116
|
+
const nextSectPr = projection.sectionId === bodyProjection.sectionId ? clone2(sectPr) : mergePageOneHeaderFooterModel(currentSectPr, sectPr);
|
|
242117
|
+
if (xmlDeepEqual(currentSectPr, nextSectPr))
|
|
242118
|
+
return null;
|
|
242119
|
+
return {
|
|
242120
|
+
sectionId: projection.sectionId,
|
|
242121
|
+
nextSectPr
|
|
242122
|
+
};
|
|
242123
|
+
}).filter((update) => Boolean(update));
|
|
242124
|
+
if (sectionUpdates.length === 0)
|
|
242149
242125
|
return result;
|
|
242150
242126
|
result.changed = true;
|
|
242151
242127
|
result.changedParts.push({
|
|
242152
242128
|
part: "word/document.xml",
|
|
242153
242129
|
scope: "sectionDefaults",
|
|
242154
|
-
change: "replaced"
|
|
242130
|
+
change: sectionUpdates.some((update) => update.sectionId !== bodyProjection.sectionId) ? "merged" : "replaced"
|
|
242155
242131
|
});
|
|
242156
242132
|
if (dryRun)
|
|
242157
242133
|
return result;
|
|
242158
242134
|
try {
|
|
242159
|
-
|
|
242135
|
+
for (let index2 = 0;index2 < sectionUpdates.length; index2 += 1) {
|
|
242136
|
+
const update = sectionUpdates[index2];
|
|
242137
|
+
const liveProjection = resolveSectionProjections(editor).find((projection) => projection.sectionId === update.sectionId);
|
|
242138
|
+
if (!liveProjection)
|
|
242139
|
+
throw new Error(`Section ${update.sectionId} disappeared during page-1 sectPr adoption.`);
|
|
242140
|
+
applySectPrToProjection(editor, liveProjection, clone2(update.nextSectPr), { addToHistory: index2 === sectionUpdates.length - 1 });
|
|
242141
|
+
}
|
|
242142
|
+
clearIndexCache(editor);
|
|
242160
242143
|
result.applied = true;
|
|
242161
242144
|
} catch (err) {
|
|
242162
242145
|
result.changed = false;
|
|
@@ -242624,7 +242607,7 @@ async function applyTemplateAsync(editor, converter, input2, options) {
|
|
|
242624
242607
|
});
|
|
242625
242608
|
} else if (sec.detected) {
|
|
242626
242609
|
warnings.push(...sec.warnings);
|
|
242627
|
-
pushNoChangeSkip(skippedScopes, "sectionDefaults", "word/document.xml", sec.warnings.length > 0 ? "Source page-1 section defaults could not be applied." : "Source page-1 section defaults already match the active section defaults.");
|
|
242610
|
+
pushNoChangeSkip(skippedScopes, "sectionDefaults", "word/document.xml", sec.warnings.length > 0 ? "Source page-1 section defaults could not be applied." : "Source page-1 section defaults already match the current document's active section defaults and section header/footer visibility model.");
|
|
242628
242611
|
}
|
|
242629
242612
|
}
|
|
242630
242613
|
if (styleMappings.length > 0)
|
|
@@ -281594,6 +281577,13 @@ function defaultInvalidate() {
|
|
|
281594
281577
|
function toCssFontSource(url2) {
|
|
281595
281578
|
return /^\s*url\(/i.test(url2) ? url2 : `url(${JSON.stringify(url2)})`;
|
|
281596
281579
|
}
|
|
281580
|
+
function nextEmbeddedNamespace() {
|
|
281581
|
+
embeddedDocumentCounter += 1;
|
|
281582
|
+
return `__superdoc_embedded_${embeddedDocumentCounter}__`;
|
|
281583
|
+
}
|
|
281584
|
+
function sanitizeFamilyToken(family2) {
|
|
281585
|
+
return family2.replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "font";
|
|
281586
|
+
}
|
|
281597
281587
|
function defaultScheduleMicrotask(callback) {
|
|
281598
281588
|
if (typeof queueMicrotask === "function") {
|
|
281599
281589
|
queueMicrotask(callback);
|
|
@@ -281623,7 +281613,7 @@ function makeResolveFace(resolver2, hasFace) {
|
|
|
281623
281613
|
};
|
|
281624
281614
|
};
|
|
281625
281615
|
return (logical) => {
|
|
281626
|
-
const r$1 =
|
|
281616
|
+
const r$1 = resolveFontFamily(logical);
|
|
281627
281617
|
return {
|
|
281628
281618
|
physicalFamily: r$1.physicalFamily,
|
|
281629
281619
|
reason: r$1.reason
|
|
@@ -285884,7 +285874,7 @@ var Node$13 = class Node$14 {
|
|
|
285884
285874
|
}, getTrackedChangeText = ({ nodes, mark: mark2, trackedChangeType, isReplacement }) => {
|
|
285885
285875
|
let trackedChangeText = "";
|
|
285886
285876
|
let deletionText = "";
|
|
285887
|
-
let trackedChangeDisplayType = null;
|
|
285877
|
+
let trackedChangeDisplayType$1 = null;
|
|
285888
285878
|
if (trackedChangeType === "trackDelete" || isReplacement)
|
|
285889
285879
|
deletionText = nodes.reduce((acc, node2) => {
|
|
285890
285880
|
if (!node2.marks.find((nodeMark) => nodeMark.type.name === "trackDelete"))
|
|
@@ -285909,14 +285899,14 @@ var Node$13 = class Node$14 {
|
|
|
285909
285899
|
});
|
|
285910
285900
|
if (trackedFormatDisplay) {
|
|
285911
285901
|
trackedChangeText = trackedFormatDisplay.trackedChangeText;
|
|
285912
|
-
trackedChangeDisplayType = trackedFormatDisplay.trackedChangeDisplayType;
|
|
285902
|
+
trackedChangeDisplayType$1 = trackedFormatDisplay.trackedChangeDisplayType;
|
|
285913
285903
|
} else
|
|
285914
285904
|
trackedChangeText = translateFormatChangesToEnglish(normalizedFormatAttrs);
|
|
285915
285905
|
}
|
|
285916
285906
|
return {
|
|
285917
285907
|
deletionText,
|
|
285918
285908
|
trackedChangeText,
|
|
285919
|
-
trackedChangeDisplayType
|
|
285909
|
+
trackedChangeDisplayType: trackedChangeDisplayType$1
|
|
285920
285910
|
};
|
|
285921
285911
|
}, createOrUpdateTrackedChangeComment = ({ event, marks, deletionNodes, nodes, newEditorState, documentId, trackedChangesForId }) => {
|
|
285922
285912
|
const node2 = nodes[0];
|
|
@@ -285960,7 +285950,7 @@ var Node$13 = class Node$14 {
|
|
|
285960
285950
|
nodesToUse = nodesWithMark.length ? nodesWithMark : node2 ? [node2] : [];
|
|
285961
285951
|
if (!nodesToUse.length)
|
|
285962
285952
|
return;
|
|
285963
|
-
const { deletionText, trackedChangeText, trackedChangeDisplayType } = getTrackedChangeText({
|
|
285953
|
+
const { deletionText, trackedChangeText, trackedChangeDisplayType: trackedChangeDisplayType$1 } = getTrackedChangeText({
|
|
285964
285954
|
nodes: nodesToUse,
|
|
285965
285955
|
mark: trackedMark,
|
|
285966
285956
|
trackedChangeType,
|
|
@@ -285976,7 +285966,7 @@ var Node$13 = class Node$14 {
|
|
|
285976
285966
|
changeId: id2,
|
|
285977
285967
|
trackedChangeType: isReplacement ? "both" : trackedChangeType,
|
|
285978
285968
|
trackedChangeText,
|
|
285979
|
-
trackedChangeDisplayType,
|
|
285969
|
+
trackedChangeDisplayType: trackedChangeDisplayType$1,
|
|
285980
285970
|
deletedText: isReplacement || marks.deletionMark ? deletionText : null,
|
|
285981
285971
|
author,
|
|
285982
285972
|
...authorId && { authorId },
|
|
@@ -299663,7 +299653,7 @@ var Node$13 = class Node$14 {
|
|
|
299663
299653
|
listener(snapshot2);
|
|
299664
299654
|
} catch {}
|
|
299665
299655
|
}
|
|
299666
|
-
}, projectedTrackedChangeCache, TRACK_MARK_TYPE_BY_NAME, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, import_jszip_min2, LAYOUT_AFFECTING_SETTING_NAMES, HEADER_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", IMAGE_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", HEADER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", FOOTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", CONTENT_TYPES_PART$1 = "[Content_Types].xml", DOCUMENT_RELS_PART$1 = "word/_rels/document.xml.rels", SUBSTRATE_SCOPE_ORDER, CONTENT_TYPE_BY_SCOPE, REL_TYPE_BY_PART, CONTENT_TYPES_PART = "[Content_Types].xml", DOCUMENT_RELS_PART = "word/_rels/document.xml.rels", SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, COMMENT_MARK_NAME2 = "commentMark", TRACK_CHANGE_MARK_NAMES, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", PRESET_GREY = "999999", PRESET_BLACK = "000000", STATIC_PRESETS, IDENTITY_BLOCK_ATTRS, WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, BatchHistoryAdapter = class {
|
|
299656
|
+
}, projectedTrackedChangeCache, TRACK_MARK_TYPE_BY_NAME, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, import_jszip_min2, LAYOUT_AFFECTING_SETTING_NAMES, HEADER_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", IMAGE_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", HEADER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", FOOTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", CONTENT_TYPES_PART$1 = "[Content_Types].xml", DOCUMENT_RELS_PART$1 = "word/_rels/document.xml.rels", HEADER_FOOTER_KINDS2, HEADER_FOOTER_VARIANTS$2, SUBSTRATE_SCOPE_ORDER, CONTENT_TYPE_BY_SCOPE, REL_TYPE_BY_PART, CONTENT_TYPES_PART = "[Content_Types].xml", DOCUMENT_RELS_PART = "word/_rels/document.xml.rels", SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, COMMENT_MARK_NAME2 = "commentMark", TRACK_CHANGE_MARK_NAMES, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", PRESET_GREY = "999999", PRESET_BLACK = "000000", STATIC_PRESETS, IDENTITY_BLOCK_ATTRS, WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, BatchHistoryAdapter = class {
|
|
299667
299657
|
#done = [];
|
|
299668
299658
|
#redone = [];
|
|
299669
299659
|
#listeners = /* @__PURE__ */ new Set;
|
|
@@ -319168,7 +319158,7 @@ menclose::after {
|
|
|
319168
319158
|
#flushLateFontLoads() {
|
|
319169
319159
|
this.#requestReflow();
|
|
319170
319160
|
}
|
|
319171
|
-
}, FACE_STATUS_PRIORITY, DocumentFontController = class {
|
|
319161
|
+
}, FACE_STATUS_PRIORITY, embeddedDocumentCounter = 0, DocumentFontController = class {
|
|
319172
319162
|
#resolver;
|
|
319173
319163
|
#getGate;
|
|
319174
319164
|
#onDocumentFontConfigApplied;
|
|
@@ -319176,6 +319166,10 @@ menclose::after {
|
|
|
319176
319166
|
#runtimeReflowQueued = false;
|
|
319177
319167
|
#runtimeReflowToken = 0;
|
|
319178
319168
|
#runtimeAvailabilityChanged = false;
|
|
319169
|
+
#embeddedDisposers = [];
|
|
319170
|
+
#embeddedNamespace = nextEmbeddedNamespace();
|
|
319171
|
+
#embeddedPhysical = /* @__PURE__ */ new Map;
|
|
319172
|
+
#embeddedGeneration = 0;
|
|
319179
319173
|
constructor(deps) {
|
|
319180
319174
|
this.#resolver = deps.resolver;
|
|
319181
319175
|
this.#getGate = deps.getGate;
|
|
@@ -319194,10 +319188,12 @@ menclose::after {
|
|
|
319194
319188
|
}
|
|
319195
319189
|
reset() {
|
|
319196
319190
|
this.#cancelPendingRuntimeReflow();
|
|
319191
|
+
this.#releaseEmbeddedFaces();
|
|
319197
319192
|
this.#resolver.reset();
|
|
319198
319193
|
}
|
|
319199
319194
|
dispose() {
|
|
319200
319195
|
this.#cancelPendingRuntimeReflow();
|
|
319196
|
+
this.#releaseEmbeddedFaces();
|
|
319201
319197
|
}
|
|
319202
319198
|
applyInitialConfig(config3) {
|
|
319203
319199
|
this.#cancelPendingRuntimeReflow();
|
|
@@ -319208,6 +319204,43 @@ menclose::after {
|
|
|
319208
319204
|
if (registered$1)
|
|
319209
319205
|
this.#getGate()?.invalidateCachesForConfigRegistration();
|
|
319210
319206
|
}
|
|
319207
|
+
applyEmbeddedFaces(faces) {
|
|
319208
|
+
this.#releaseEmbeddedFaces();
|
|
319209
|
+
if (!faces?.length)
|
|
319210
|
+
return;
|
|
319211
|
+
const registry3 = this.#getGate()?.resolveRegistry();
|
|
319212
|
+
if (!registry3)
|
|
319213
|
+
return;
|
|
319214
|
+
this.#embeddedGeneration += 1;
|
|
319215
|
+
let registered$1 = false;
|
|
319216
|
+
for (const face of faces) {
|
|
319217
|
+
if (!face?.embeddable)
|
|
319218
|
+
continue;
|
|
319219
|
+
const physicalFamily = this.#physicalFamilyFor(face.family);
|
|
319220
|
+
const release = registry3.registerOwnedFace({
|
|
319221
|
+
family: physicalFamily,
|
|
319222
|
+
source: face.source,
|
|
319223
|
+
weight: face.weight,
|
|
319224
|
+
style: face.style
|
|
319225
|
+
});
|
|
319226
|
+
if (release) {
|
|
319227
|
+
this.#embeddedDisposers.push(release);
|
|
319228
|
+
this.#resolver.mapEmbedded(face.family, physicalFamily);
|
|
319229
|
+
registered$1 = true;
|
|
319230
|
+
}
|
|
319231
|
+
}
|
|
319232
|
+
if (registered$1)
|
|
319233
|
+
this.#getGate()?.invalidateCachesForConfigRegistration();
|
|
319234
|
+
}
|
|
319235
|
+
#physicalFamilyFor(logicalFamily) {
|
|
319236
|
+
const key2 = logicalFamily.trim().toLowerCase();
|
|
319237
|
+
let physical = this.#embeddedPhysical.get(key2);
|
|
319238
|
+
if (!physical) {
|
|
319239
|
+
physical = `${this.#embeddedNamespace}${this.#embeddedGeneration}_${this.#embeddedPhysical.size}_${sanitizeFamilyToken(logicalFamily)}`;
|
|
319240
|
+
this.#embeddedPhysical.set(key2, physical);
|
|
319241
|
+
}
|
|
319242
|
+
return physical;
|
|
319243
|
+
}
|
|
319211
319244
|
add(families) {
|
|
319212
319245
|
let committed = false;
|
|
319213
319246
|
try {
|
|
@@ -319305,6 +319338,13 @@ menclose::after {
|
|
|
319305
319338
|
this.#runtimeReflowQueued = false;
|
|
319306
319339
|
this.#runtimeReflowToken += 1;
|
|
319307
319340
|
}
|
|
319341
|
+
#releaseEmbeddedFaces() {
|
|
319342
|
+
for (const release of this.#embeddedDisposers)
|
|
319343
|
+
release();
|
|
319344
|
+
this.#embeddedDisposers.length = 0;
|
|
319345
|
+
this.#embeddedPhysical.clear();
|
|
319346
|
+
this.#resolver.clearEmbedded();
|
|
319347
|
+
}
|
|
319308
319348
|
}, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, NATIVE_SELECTION_STYLES = `
|
|
319309
319349
|
/* Hide native browser selection on layout engine content.
|
|
319310
319350
|
* We render our own selection overlay via PresentationEditor's #localSelectionLayer
|
|
@@ -319382,13 +319422,13 @@ menclose::after {
|
|
|
319382
319422
|
return;
|
|
319383
319423
|
console.log(...args$1);
|
|
319384
319424
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
|
|
319385
|
-
var
|
|
319425
|
+
var init_src_DEnygTyz_es = __esm(() => {
|
|
319386
319426
|
init_rolldown_runtime_Bg48TavK_es();
|
|
319387
|
-
|
|
319427
|
+
init_SuperConverter_DOoAJ6Zk_es();
|
|
319388
319428
|
init_jszip_C49i9kUs_es();
|
|
319389
319429
|
init_xml_js_CqGKpaft_es();
|
|
319390
319430
|
init_uuid_qzgm05fK_es();
|
|
319391
|
-
|
|
319431
|
+
init_create_headless_toolbar_DUhzXJ4D_es();
|
|
319392
319432
|
init_constants_D9qj59G2_es();
|
|
319393
319433
|
init_dist_B8HfvhaK_es();
|
|
319394
319434
|
init_unified_Dsuw2be5_es();
|
|
@@ -319396,7 +319436,6 @@ var init_src_BjtupAUl_es = __esm(() => {
|
|
|
319396
319436
|
init_remark_stringify_6MMJfY0k_es();
|
|
319397
319437
|
init_DocxZipper_Bu2Fhqkw_es();
|
|
319398
319438
|
init__plugin_vue_export_helper_5t5P5NuM_es();
|
|
319399
|
-
init_create_super_doc_ui_tVaowTvG_es();
|
|
319400
319439
|
init_eventemitter3_BnGqBE_Q_es();
|
|
319401
319440
|
init_errors_CNaD6vcg_es();
|
|
319402
319441
|
init_blank_docx_1Y_uWgjm_es();
|
|
@@ -343058,6 +343097,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
343058
343097
|
"noPunctuationKerning",
|
|
343059
343098
|
"kerning"
|
|
343060
343099
|
]);
|
|
343100
|
+
HEADER_FOOTER_KINDS2 = ["header", "footer"];
|
|
343101
|
+
HEADER_FOOTER_VARIANTS$2 = [
|
|
343102
|
+
"default",
|
|
343103
|
+
"first",
|
|
343104
|
+
"even"
|
|
343105
|
+
];
|
|
343061
343106
|
SUBSTRATE_SCOPE_ORDER = [
|
|
343062
343107
|
"styles",
|
|
343063
343108
|
"numbering",
|
|
@@ -347948,6 +347993,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
347948
347993
|
}
|
|
347949
347994
|
});
|
|
347950
347995
|
this.#fontController.applyInitialConfig(this.#options.fontAssets);
|
|
347996
|
+
this.#applyEmbeddedDocumentFonts();
|
|
347951
347997
|
if (typeof this.#options.disableContextMenu === "boolean")
|
|
347952
347998
|
this.setContextMenuDisabled(this.#options.disableContextMenu);
|
|
347953
347999
|
this.#setupHeaderFooterSession();
|
|
@@ -348953,6 +348999,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
348953
348999
|
async preloadFonts(families) {
|
|
348954
349000
|
await this.#fontController.preload(families);
|
|
348955
349001
|
}
|
|
349002
|
+
#applyEmbeddedDocumentFonts() {
|
|
349003
|
+
const converter = this.#editor.converter;
|
|
349004
|
+
this.#fontController.applyEmbeddedFaces(converter?.getEmbeddedFontFaces?.());
|
|
349005
|
+
}
|
|
348956
349006
|
#requestFontReflow() {
|
|
348957
349007
|
this.#layoutState = {
|
|
348958
349008
|
...this.#layoutState,
|
|
@@ -350248,6 +350298,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
350248
350298
|
this.#fontController.reset();
|
|
350249
350299
|
this.#layoutFontSignature = "";
|
|
350250
350300
|
this.#fontController.applyInitialConfig(this.#options.fontAssets);
|
|
350301
|
+
this.#applyEmbeddedDocumentFonts();
|
|
350251
350302
|
this.#resetFontReportStateForDocumentChange();
|
|
350252
350303
|
this.#refreshHeaderFooterStructureThenRerender({ purgeCachedEditors: true });
|
|
350253
350304
|
};
|
|
@@ -354217,6 +354268,279 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
354217
354268
|
]);
|
|
354218
354269
|
});
|
|
354219
354270
|
|
|
354271
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-CmcU7hTR.es.js
|
|
354272
|
+
var headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
|
|
354273
|
+
var init_create_super_doc_ui_CmcU7hTR_es = __esm(() => {
|
|
354274
|
+
init_SuperConverter_DOoAJ6Zk_es();
|
|
354275
|
+
init_create_headless_toolbar_DUhzXJ4D_es();
|
|
354276
|
+
headlessToolbarConstants = {
|
|
354277
|
+
DEFAULT_TEXT_ALIGN_OPTIONS: [
|
|
354278
|
+
{
|
|
354279
|
+
label: "Left",
|
|
354280
|
+
value: "left"
|
|
354281
|
+
},
|
|
354282
|
+
{
|
|
354283
|
+
label: "Center",
|
|
354284
|
+
value: "center"
|
|
354285
|
+
},
|
|
354286
|
+
{
|
|
354287
|
+
label: "Right",
|
|
354288
|
+
value: "right"
|
|
354289
|
+
},
|
|
354290
|
+
{
|
|
354291
|
+
label: "Justify",
|
|
354292
|
+
value: "justify"
|
|
354293
|
+
}
|
|
354294
|
+
],
|
|
354295
|
+
DEFAULT_LINE_HEIGHT_OPTIONS: [
|
|
354296
|
+
{
|
|
354297
|
+
label: "1.00",
|
|
354298
|
+
value: 1
|
|
354299
|
+
},
|
|
354300
|
+
{
|
|
354301
|
+
label: "1.15",
|
|
354302
|
+
value: 1.15
|
|
354303
|
+
},
|
|
354304
|
+
{
|
|
354305
|
+
label: "1.50",
|
|
354306
|
+
value: 1.5
|
|
354307
|
+
},
|
|
354308
|
+
{
|
|
354309
|
+
label: "2.00",
|
|
354310
|
+
value: 2
|
|
354311
|
+
},
|
|
354312
|
+
{
|
|
354313
|
+
label: "2.50",
|
|
354314
|
+
value: 2.5
|
|
354315
|
+
},
|
|
354316
|
+
{
|
|
354317
|
+
label: "3.00",
|
|
354318
|
+
value: 3
|
|
354319
|
+
}
|
|
354320
|
+
],
|
|
354321
|
+
DEFAULT_ZOOM_OPTIONS: [
|
|
354322
|
+
{
|
|
354323
|
+
label: "50%",
|
|
354324
|
+
value: 50
|
|
354325
|
+
},
|
|
354326
|
+
{
|
|
354327
|
+
label: "75%",
|
|
354328
|
+
value: 75
|
|
354329
|
+
},
|
|
354330
|
+
{
|
|
354331
|
+
label: "90%",
|
|
354332
|
+
value: 90
|
|
354333
|
+
},
|
|
354334
|
+
{
|
|
354335
|
+
label: "100%",
|
|
354336
|
+
value: 100
|
|
354337
|
+
},
|
|
354338
|
+
{
|
|
354339
|
+
label: "125%",
|
|
354340
|
+
value: 125
|
|
354341
|
+
},
|
|
354342
|
+
{
|
|
354343
|
+
label: "150%",
|
|
354344
|
+
value: 150
|
|
354345
|
+
},
|
|
354346
|
+
{
|
|
354347
|
+
label: "200%",
|
|
354348
|
+
value: 200
|
|
354349
|
+
}
|
|
354350
|
+
],
|
|
354351
|
+
DEFAULT_DOCUMENT_MODE_OPTIONS: [
|
|
354352
|
+
{
|
|
354353
|
+
label: "Editing",
|
|
354354
|
+
value: "editing",
|
|
354355
|
+
description: "Edit document directly"
|
|
354356
|
+
},
|
|
354357
|
+
{
|
|
354358
|
+
label: "Suggesting",
|
|
354359
|
+
value: "suggesting",
|
|
354360
|
+
description: "Edits become suggestions"
|
|
354361
|
+
},
|
|
354362
|
+
{
|
|
354363
|
+
label: "Viewing",
|
|
354364
|
+
value: "viewing",
|
|
354365
|
+
description: "View clean version of document only"
|
|
354366
|
+
}
|
|
354367
|
+
],
|
|
354368
|
+
DEFAULT_FONT_SIZE_OPTIONS: [
|
|
354369
|
+
{
|
|
354370
|
+
label: "8",
|
|
354371
|
+
value: "8pt"
|
|
354372
|
+
},
|
|
354373
|
+
{
|
|
354374
|
+
label: "9",
|
|
354375
|
+
value: "9pt"
|
|
354376
|
+
},
|
|
354377
|
+
{
|
|
354378
|
+
label: "10",
|
|
354379
|
+
value: "10pt"
|
|
354380
|
+
},
|
|
354381
|
+
{
|
|
354382
|
+
label: "11",
|
|
354383
|
+
value: "11pt"
|
|
354384
|
+
},
|
|
354385
|
+
{
|
|
354386
|
+
label: "12",
|
|
354387
|
+
value: "12pt"
|
|
354388
|
+
},
|
|
354389
|
+
{
|
|
354390
|
+
label: "14",
|
|
354391
|
+
value: "14pt"
|
|
354392
|
+
},
|
|
354393
|
+
{
|
|
354394
|
+
label: "18",
|
|
354395
|
+
value: "18pt"
|
|
354396
|
+
},
|
|
354397
|
+
{
|
|
354398
|
+
label: "24",
|
|
354399
|
+
value: "24pt"
|
|
354400
|
+
},
|
|
354401
|
+
{
|
|
354402
|
+
label: "30",
|
|
354403
|
+
value: "30pt"
|
|
354404
|
+
},
|
|
354405
|
+
{
|
|
354406
|
+
label: "36",
|
|
354407
|
+
value: "36pt"
|
|
354408
|
+
},
|
|
354409
|
+
{
|
|
354410
|
+
label: "48",
|
|
354411
|
+
value: "48pt"
|
|
354412
|
+
},
|
|
354413
|
+
{
|
|
354414
|
+
label: "60",
|
|
354415
|
+
value: "60pt"
|
|
354416
|
+
},
|
|
354417
|
+
{
|
|
354418
|
+
label: "72",
|
|
354419
|
+
value: "72pt"
|
|
354420
|
+
},
|
|
354421
|
+
{
|
|
354422
|
+
label: "96",
|
|
354423
|
+
value: "96pt"
|
|
354424
|
+
}
|
|
354425
|
+
],
|
|
354426
|
+
DEFAULT_FONT_FAMILY_OPTIONS: getDefaultFontFamilyOptions(),
|
|
354427
|
+
DEFAULT_TEXT_COLOR_OPTIONS: [
|
|
354428
|
+
{
|
|
354429
|
+
label: "Black",
|
|
354430
|
+
value: "#000000"
|
|
354431
|
+
},
|
|
354432
|
+
{
|
|
354433
|
+
label: "Dark Gray",
|
|
354434
|
+
value: "#434343"
|
|
354435
|
+
},
|
|
354436
|
+
{
|
|
354437
|
+
label: "Gray",
|
|
354438
|
+
value: "#666666"
|
|
354439
|
+
},
|
|
354440
|
+
{
|
|
354441
|
+
label: "Light Gray",
|
|
354442
|
+
value: "#999999"
|
|
354443
|
+
},
|
|
354444
|
+
{
|
|
354445
|
+
label: "Red",
|
|
354446
|
+
value: "#ff0000"
|
|
354447
|
+
},
|
|
354448
|
+
{
|
|
354449
|
+
label: "Orange",
|
|
354450
|
+
value: "#ff9900"
|
|
354451
|
+
},
|
|
354452
|
+
{
|
|
354453
|
+
label: "Yellow",
|
|
354454
|
+
value: "#ffff00"
|
|
354455
|
+
},
|
|
354456
|
+
{
|
|
354457
|
+
label: "Green",
|
|
354458
|
+
value: "#00ff00"
|
|
354459
|
+
},
|
|
354460
|
+
{
|
|
354461
|
+
label: "Cyan",
|
|
354462
|
+
value: "#00ffff"
|
|
354463
|
+
},
|
|
354464
|
+
{
|
|
354465
|
+
label: "Blue",
|
|
354466
|
+
value: "#0000ff"
|
|
354467
|
+
},
|
|
354468
|
+
{
|
|
354469
|
+
label: "Purple",
|
|
354470
|
+
value: "#9900ff"
|
|
354471
|
+
},
|
|
354472
|
+
{
|
|
354473
|
+
label: "Magenta",
|
|
354474
|
+
value: "#ff00ff"
|
|
354475
|
+
},
|
|
354476
|
+
{
|
|
354477
|
+
label: "None",
|
|
354478
|
+
value: "none"
|
|
354479
|
+
}
|
|
354480
|
+
],
|
|
354481
|
+
DEFAULT_HIGHLIGHT_COLOR_OPTIONS: [
|
|
354482
|
+
{
|
|
354483
|
+
label: "Yellow",
|
|
354484
|
+
value: "#ffff00"
|
|
354485
|
+
},
|
|
354486
|
+
{
|
|
354487
|
+
label: "Green",
|
|
354488
|
+
value: "#00ff00"
|
|
354489
|
+
},
|
|
354490
|
+
{
|
|
354491
|
+
label: "Cyan",
|
|
354492
|
+
value: "#00ffff"
|
|
354493
|
+
},
|
|
354494
|
+
{
|
|
354495
|
+
label: "Pink",
|
|
354496
|
+
value: "#ff00ff"
|
|
354497
|
+
},
|
|
354498
|
+
{
|
|
354499
|
+
label: "Blue",
|
|
354500
|
+
value: "#0000ff"
|
|
354501
|
+
},
|
|
354502
|
+
{
|
|
354503
|
+
label: "Red",
|
|
354504
|
+
value: "#ff0000"
|
|
354505
|
+
},
|
|
354506
|
+
{
|
|
354507
|
+
label: "Orange",
|
|
354508
|
+
value: "#ff9900"
|
|
354509
|
+
},
|
|
354510
|
+
{
|
|
354511
|
+
label: "None",
|
|
354512
|
+
value: "none"
|
|
354513
|
+
}
|
|
354514
|
+
]
|
|
354515
|
+
};
|
|
354516
|
+
MOD_ALIASES = new Set([
|
|
354517
|
+
"Mod",
|
|
354518
|
+
"Meta",
|
|
354519
|
+
"Cmd",
|
|
354520
|
+
"Command"
|
|
354521
|
+
]);
|
|
354522
|
+
ALT_ALIASES = new Set(["Alt", "Option"]);
|
|
354523
|
+
CTRL_ALIASES = new Set(["Control", "Ctrl"]);
|
|
354524
|
+
SHIFT_ALIASES = new Set(["Shift"]);
|
|
354525
|
+
BUILTIN_CONTEXT_MENU_GROUPS = [
|
|
354526
|
+
"format",
|
|
354527
|
+
"clipboard",
|
|
354528
|
+
"review",
|
|
354529
|
+
"comment",
|
|
354530
|
+
"link"
|
|
354531
|
+
];
|
|
354532
|
+
BUILTIN_GROUP_ORDER = new Map(BUILTIN_CONTEXT_MENU_GROUPS.map((g2, i4) => [g2, i4]));
|
|
354533
|
+
RESERVED_PROXY_PROPERTY_NAMES = new Set([
|
|
354534
|
+
"register",
|
|
354535
|
+
"get",
|
|
354536
|
+
"has",
|
|
354537
|
+
"require",
|
|
354538
|
+
"getContextMenuItems"
|
|
354539
|
+
]);
|
|
354540
|
+
ALL_TOOLBAR_COMMAND_IDS = Object.keys(createToolbarRegistry());
|
|
354541
|
+
EMPTY_ACTIVE_IDS = Object.freeze([]);
|
|
354542
|
+
});
|
|
354543
|
+
|
|
354220
354544
|
// ../../packages/superdoc/dist/chunks/ui-C5PAS9hY.es.js
|
|
354221
354545
|
var init_ui_C5PAS9hY_es = () => {};
|
|
354222
354546
|
|
|
@@ -354230,16 +354554,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
354230
354554
|
|
|
354231
354555
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
354232
354556
|
var init_super_editor_es = __esm(() => {
|
|
354233
|
-
|
|
354234
|
-
|
|
354557
|
+
init_src_DEnygTyz_es();
|
|
354558
|
+
init_SuperConverter_DOoAJ6Zk_es();
|
|
354235
354559
|
init_jszip_C49i9kUs_es();
|
|
354236
354560
|
init_xml_js_CqGKpaft_es();
|
|
354237
|
-
|
|
354561
|
+
init_create_headless_toolbar_DUhzXJ4D_es();
|
|
354238
354562
|
init_constants_D9qj59G2_es();
|
|
354239
354563
|
init_dist_B8HfvhaK_es();
|
|
354240
354564
|
init_unified_Dsuw2be5_es();
|
|
354241
354565
|
init_DocxZipper_Bu2Fhqkw_es();
|
|
354242
|
-
|
|
354566
|
+
init_create_super_doc_ui_CmcU7hTR_es();
|
|
354243
354567
|
init_ui_C5PAS9hY_es();
|
|
354244
354568
|
init_eventemitter3_BnGqBE_Q_es();
|
|
354245
354569
|
init_errors_CNaD6vcg_es();
|
|
@@ -357851,7 +358175,7 @@ More content with **bold** and *italic*.`
|
|
|
357851
358175
|
"trackChanges.list": {
|
|
357852
358176
|
memberPath: "trackChanges.list",
|
|
357853
358177
|
description: "List all tracked changes in the document.",
|
|
357854
|
-
expectedResult: "Returns a TrackChangesListResult with tracked change entries (`insert`, `delete`, `replacement`, `format
|
|
358178
|
+
expectedResult: "Returns a TrackChangesListResult with tracked change entries (`insert`, `delete`, `replacement`, `format`), total count, and raw imported Word OOXML revision IDs (`w:id`) when available. Whole-table tracked insertions and deletions are surfaced through the legacy `insert` / `delete` types.",
|
|
357855
358179
|
requiresDocumentContext: true,
|
|
357856
358180
|
metadata: readOperation2({
|
|
357857
358181
|
idempotency: "idempotent",
|
|
@@ -357865,7 +358189,7 @@ More content with **bold** and *italic*.`
|
|
|
357865
358189
|
"trackChanges.get": {
|
|
357866
358190
|
memberPath: "trackChanges.get",
|
|
357867
358191
|
description: "Retrieve a single tracked change by ID.",
|
|
357868
|
-
expectedResult: "Returns a TrackChangeInfo object with the change type (`insert`, `delete`, `replacement`, `format
|
|
358192
|
+
expectedResult: "Returns a TrackChangeInfo object with the change type (`insert`, `delete`, `replacement`, `format`), author, date, affected content, and raw imported Word OOXML revision IDs (`w:id`) when available. Whole-table tracked insertions and deletions are surfaced through the legacy `insert` / `delete` types.",
|
|
357869
358193
|
requiresDocumentContext: true,
|
|
357870
358194
|
metadata: readOperation2({
|
|
357871
358195
|
idempotency: "idempotent",
|
|
@@ -357885,6 +358209,7 @@ More content with **bold** and *italic*.`
|
|
|
357885
358209
|
supportsTrackedMode: false,
|
|
357886
358210
|
possibleFailureCodes: [
|
|
357887
358211
|
"NO_OP",
|
|
358212
|
+
"INVALID_INPUT",
|
|
357888
358213
|
"INVALID_TARGET",
|
|
357889
358214
|
"TARGET_NOT_FOUND",
|
|
357890
358215
|
"CAPABILITY_UNAVAILABLE",
|
|
@@ -363226,7 +363551,7 @@ var init_schemas4 = __esm(() => {
|
|
|
363226
363551
|
init_style_policy_types();
|
|
363227
363552
|
init_paragraphs();
|
|
363228
363553
|
init_styles();
|
|
363229
|
-
trackChangeTypeValues2 = ["insert", "delete", "replacement", "format"
|
|
363554
|
+
trackChangeTypeValues2 = ["insert", "delete", "replacement", "format"];
|
|
363230
363555
|
nodeTypeValues2 = NODE_TYPES2;
|
|
363231
363556
|
blockNodeTypeValues2 = BLOCK_NODE_TYPES2;
|
|
363232
363557
|
deletableBlockNodeTypeValues2 = DELETABLE_BLOCK_NODE_TYPES2;
|
|
@@ -363996,10 +364321,6 @@ var init_schemas4 = __esm(() => {
|
|
|
363996
364321
|
address: trackedChangeAddressSchema2,
|
|
363997
364322
|
id: { type: "string" },
|
|
363998
364323
|
type: { enum: [...trackChangeTypeValues2] },
|
|
363999
|
-
subtype: {
|
|
364000
|
-
enum: ["table-insert", "table-delete"],
|
|
364001
|
-
description: "Finer classification for structural changes (type === 'structural')."
|
|
364002
|
-
},
|
|
364003
364324
|
grouping: { enum: ["standalone", "replacement-pair", "unknown"] },
|
|
364004
364325
|
pairedWithChangeId: { type: ["string", "null"] },
|
|
364005
364326
|
wordRevisionIds: trackChangeWordRevisionIdsSchema2,
|
|
@@ -364014,10 +364335,6 @@ var init_schemas4 = __esm(() => {
|
|
|
364014
364335
|
trackChangeDomainItemSchema = discoveryItemSchema2({
|
|
364015
364336
|
address: trackedChangeAddressSchema2,
|
|
364016
364337
|
type: { enum: [...trackChangeTypeValues2] },
|
|
364017
|
-
subtype: {
|
|
364018
|
-
enum: ["table-insert", "table-delete"],
|
|
364019
|
-
description: "Finer classification for structural changes (type === 'structural')."
|
|
364020
|
-
},
|
|
364021
364338
|
grouping: { enum: ["standalone", "replacement-pair", "unknown"] },
|
|
364022
364339
|
pairedWithChangeId: { type: ["string", "null"] },
|
|
364023
364340
|
wordRevisionIds: trackChangeWordRevisionIdsSchema2,
|
|
@@ -366331,7 +366648,7 @@ var init_schemas4 = __esm(() => {
|
|
|
366331
366648
|
offset: { type: "integer", description: "Number of tracked changes to skip for pagination." },
|
|
366332
366649
|
type: {
|
|
366333
366650
|
enum: [...trackChangeTypeValues2],
|
|
366334
|
-
description: "Filter by change type: 'insert', 'delete', 'replacement',
|
|
366651
|
+
description: "Filter by change type: 'insert', 'delete', 'replacement', or 'format'."
|
|
366335
366652
|
},
|
|
366336
366653
|
in: {
|
|
366337
366654
|
oneOf: [storyLocatorSchema2, { const: "all" }],
|
|
@@ -372036,7 +372353,7 @@ function assertHeaderFooterSlotTarget2(input2, operationName) {
|
|
|
372036
372353
|
throw new DocumentApiValidationError3("INVALID_TARGET", `${operationName}.target must be a headerFooterSlot address.`, { field: `${operationName}.target`, value: target });
|
|
372037
372354
|
}
|
|
372038
372355
|
assertSectionAddress2(target.section, `${operationName}.target.section`);
|
|
372039
|
-
assertOneOf3(target.headerFooterKind, `${operationName}.target.headerFooterKind`,
|
|
372356
|
+
assertOneOf3(target.headerFooterKind, `${operationName}.target.headerFooterKind`, HEADER_FOOTER_KINDS3);
|
|
372040
372357
|
assertOneOf3(target.variant, `${operationName}.target.variant`, HEADER_FOOTER_VARIANTS3);
|
|
372041
372358
|
}
|
|
372042
372359
|
function assertHeaderFooterPartTarget2(input2, operationName) {
|
|
@@ -372051,7 +372368,7 @@ function assertHeaderFooterPartTarget2(input2, operationName) {
|
|
|
372051
372368
|
}
|
|
372052
372369
|
function executeHeaderFootersList2(adapter, query2) {
|
|
372053
372370
|
if (query2?.kind !== undefined) {
|
|
372054
|
-
assertOneOf3(query2.kind, "headerFooters.list.kind",
|
|
372371
|
+
assertOneOf3(query2.kind, "headerFooters.list.kind", HEADER_FOOTER_KINDS3);
|
|
372055
372372
|
}
|
|
372056
372373
|
if (query2?.section !== undefined) {
|
|
372057
372374
|
assertSectionAddress2(query2.section, "headerFooters.list.section");
|
|
@@ -372082,12 +372399,12 @@ function executeHeaderFootersRefsSetLinkedToPrevious2(adapter, input2, options)
|
|
|
372082
372399
|
}
|
|
372083
372400
|
function executeHeaderFootersPartsList2(adapter, query2) {
|
|
372084
372401
|
if (query2?.kind !== undefined) {
|
|
372085
|
-
assertOneOf3(query2.kind, "headerFooters.parts.list.kind",
|
|
372402
|
+
assertOneOf3(query2.kind, "headerFooters.parts.list.kind", HEADER_FOOTER_KINDS3);
|
|
372086
372403
|
}
|
|
372087
372404
|
return adapter.parts.list(query2);
|
|
372088
372405
|
}
|
|
372089
372406
|
function executeHeaderFootersPartsCreate2(adapter, input2, options) {
|
|
372090
|
-
assertOneOf3(input2?.kind, "headerFooters.parts.create.kind",
|
|
372407
|
+
assertOneOf3(input2?.kind, "headerFooters.parts.create.kind", HEADER_FOOTER_KINDS3);
|
|
372091
372408
|
if (input2.sourceRefId !== undefined) {
|
|
372092
372409
|
assertNonEmptyString3(input2.sourceRefId, "headerFooters.parts.create.sourceRefId");
|
|
372093
372410
|
}
|
|
@@ -372097,11 +372414,11 @@ function executeHeaderFootersPartsDelete2(adapter, input2, options) {
|
|
|
372097
372414
|
assertHeaderFooterPartTarget2(input2, "headerFooters.parts.delete");
|
|
372098
372415
|
return adapter.parts.delete(input2, normalizeMutationOptions2(options));
|
|
372099
372416
|
}
|
|
372100
|
-
var
|
|
372417
|
+
var HEADER_FOOTER_KINDS3, HEADER_FOOTER_VARIANTS3;
|
|
372101
372418
|
var init_header_footers = __esm(() => {
|
|
372102
372419
|
init_errors5();
|
|
372103
372420
|
init_validation_primitives();
|
|
372104
|
-
|
|
372421
|
+
HEADER_FOOTER_KINDS3 = ["header", "footer"];
|
|
372105
372422
|
HEADER_FOOTER_VARIANTS3 = ["default", "first", "even"];
|
|
372106
372423
|
});
|
|
372107
372424
|
|
|
@@ -372241,7 +372558,7 @@ function normalizeSectionsListQuery2(query2) {
|
|
|
372241
372558
|
return { limit: Number(limit), offset: Number(offset2) };
|
|
372242
372559
|
}
|
|
372243
372560
|
function validateHeaderFooterRefParams2(operationName, kind, variant) {
|
|
372244
|
-
assertOneOf4(kind, `${operationName}.kind`,
|
|
372561
|
+
assertOneOf4(kind, `${operationName}.kind`, HEADER_FOOTER_KINDS4);
|
|
372245
372562
|
assertOneOf4(variant, `${operationName}.variant`, HEADER_FOOTER_VARIANTS4);
|
|
372246
372563
|
}
|
|
372247
372564
|
function executeSectionsList2(adapter, query2) {
|
|
@@ -372390,7 +372707,7 @@ function executeSectionsClearPageBorders2(adapter, input2, options) {
|
|
|
372390
372707
|
assertSectionTarget2(input2, "sections.clearPageBorders");
|
|
372391
372708
|
return adapter.clearPageBorders(input2, normalizeMutationOptions2(options));
|
|
372392
372709
|
}
|
|
372393
|
-
var DEFAULT_SECTIONS_LIST_LIMIT2 = 250, SECTION_BREAK_TYPES3, SECTION_ORIENTATIONS2, SECTION_VERTICAL_ALIGNS2, SECTION_DIRECTIONS2,
|
|
372710
|
+
var DEFAULT_SECTIONS_LIST_LIMIT2 = 250, SECTION_BREAK_TYPES3, SECTION_ORIENTATIONS2, SECTION_VERTICAL_ALIGNS2, SECTION_DIRECTIONS2, HEADER_FOOTER_KINDS4, HEADER_FOOTER_VARIANTS4, LINE_NUMBER_RESTARTS2, PAGE_NUMBER_FORMATS2, PAGE_NUMBER_CHAPTER_SEPARATORS2, PAGE_BORDER_DISPLAYS2, PAGE_BORDER_OFFSET_FROM_VALUES2, PAGE_BORDER_Z_ORDER_VALUES2;
|
|
372394
372711
|
var init_sections = __esm(() => {
|
|
372395
372712
|
init_errors5();
|
|
372396
372713
|
init_validation_primitives();
|
|
@@ -372398,7 +372715,7 @@ var init_sections = __esm(() => {
|
|
|
372398
372715
|
SECTION_ORIENTATIONS2 = ["portrait", "landscape"];
|
|
372399
372716
|
SECTION_VERTICAL_ALIGNS2 = ["top", "center", "bottom", "both"];
|
|
372400
372717
|
SECTION_DIRECTIONS2 = ["ltr", "rtl"];
|
|
372401
|
-
|
|
372718
|
+
HEADER_FOOTER_KINDS4 = ["header", "footer"];
|
|
372402
372719
|
HEADER_FOOTER_VARIANTS4 = ["default", "first", "even"];
|
|
372403
372720
|
LINE_NUMBER_RESTARTS2 = ["continuous", "newPage", "newSection"];
|
|
372404
372721
|
PAGE_NUMBER_FORMATS2 = [
|
|
@@ -388489,6 +388806,9 @@ function writeSectPrPageNumbering2(sectPr, numbering) {
|
|
|
388489
388806
|
if (numbering.chapterSeparator !== undefined)
|
|
388490
388807
|
setStringAttr2(pgNumType, "w:chapSep", numbering.chapterSeparator);
|
|
388491
388808
|
}
|
|
388809
|
+
function readSectPrTitlePage2(sectPr) {
|
|
388810
|
+
return Boolean(findChild2(sectPr, "w:titlePg"));
|
|
388811
|
+
}
|
|
388492
388812
|
function writeSectPrTitlePage2(sectPr, enabled) {
|
|
388493
388813
|
if (enabled) {
|
|
388494
388814
|
ensureChild2(sectPr, "w:titlePg");
|
|
@@ -422918,7 +423238,7 @@ var init_east_asian_regex = __esm(() => {
|
|
|
422918
423238
|
});
|
|
422919
423239
|
|
|
422920
423240
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/r/helpers/helpers.js
|
|
422921
|
-
var containsEastAsianCharacters2 = (text7) => EAST_ASIAN_CHARACTER_REGEX2.test(text7),
|
|
423241
|
+
var containsEastAsianCharacters2 = (text7) => EAST_ASIAN_CHARACTER_REGEX2.test(text7), resolveFontFamily2 = (textStyleAttrs, text7) => {
|
|
422922
423242
|
if (!text7)
|
|
422923
423243
|
return textStyleAttrs;
|
|
422924
423244
|
const eastAsiaFont = textStyleAttrs?.eastAsiaFontFamily;
|
|
@@ -424569,7 +424889,7 @@ var XML_NODE_NAME13 = "w:r", SD_KEY_NAME2 = "run", REFERENCE_RUN_STYLE_BY_XML_NA
|
|
|
424569
424889
|
if (seenTypes.has(mark2.type)) {
|
|
424570
424890
|
if (mark2.type === "textStyle") {
|
|
424571
424891
|
textStyleMark.attrs = { ...textStyleMark.attrs || {}, ...mark2.attrs || {} };
|
|
424572
|
-
textStyleMark.attrs =
|
|
424892
|
+
textStyleMark.attrs = resolveFontFamily2(textStyleMark.attrs, child?.text);
|
|
424573
424893
|
}
|
|
424574
424894
|
return false;
|
|
424575
424895
|
}
|
|
@@ -451467,7 +451787,7 @@ function importCommentData2({ docx, editor, converter }) {
|
|
|
451467
451787
|
const trackedChange = attributes["custom:trackedChange"] === "true";
|
|
451468
451788
|
const trackedChangeType = attributes["custom:trackedChangeType"];
|
|
451469
451789
|
const trackedChangeText = attributes["custom:trackedChangeText"] !== "null" ? attributes["custom:trackedChangeText"] : null;
|
|
451470
|
-
const
|
|
451790
|
+
const trackedChangeDisplayType2 = attributes["custom:trackedChangeDisplayType"] !== "null" ? attributes["custom:trackedChangeDisplayType"] : null;
|
|
451471
451791
|
const trackedDeletedText = attributes["custom:trackedDeletedText"] !== "null" ? attributes["custom:trackedDeletedText"] : null;
|
|
451472
451792
|
const date6 = new Date(createdDate);
|
|
451473
451793
|
const unixTimestampMs = date6.getTime();
|
|
@@ -451496,7 +451816,7 @@ function importCommentData2({ docx, editor, converter }) {
|
|
|
451496
451816
|
trackedChange,
|
|
451497
451817
|
trackedChangeText,
|
|
451498
451818
|
trackedChangeType,
|
|
451499
|
-
trackedChangeDisplayType,
|
|
451819
|
+
trackedChangeDisplayType: trackedChangeDisplayType2,
|
|
451500
451820
|
trackedDeletedText,
|
|
451501
451821
|
isDone: false,
|
|
451502
451822
|
origin: converter?.documentOrigin || "word",
|
|
@@ -455710,6 +456030,788 @@ var init_exporter = __esm(() => {
|
|
|
455710
456030
|
});
|
|
455711
456031
|
});
|
|
455712
456032
|
|
|
456033
|
+
// ../../shared/font-system/src/types.ts
|
|
456034
|
+
var init_types8 = () => {};
|
|
456035
|
+
|
|
456036
|
+
// ../../shared/font-system/src/substitution-evidence.ts
|
|
456037
|
+
var SUBSTITUTION_EVIDENCE2;
|
|
456038
|
+
var init_substitution_evidence = __esm(() => {
|
|
456039
|
+
SUBSTITUTION_EVIDENCE2 = Object.freeze([
|
|
456040
|
+
{
|
|
456041
|
+
evidenceId: "calibri",
|
|
456042
|
+
logicalFamily: "Calibri",
|
|
456043
|
+
physicalFamily: "Carlito",
|
|
456044
|
+
verdict: "metric_safe",
|
|
456045
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456046
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456047
|
+
gates: { static: "pass", metric: "pass", layout: "pass", ship: "pass" },
|
|
456048
|
+
policyAction: "substitute",
|
|
456049
|
+
measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
|
|
456050
|
+
candidateLicense: "OFL-1.1",
|
|
456051
|
+
exportRule: "preserve_original_name"
|
|
456052
|
+
},
|
|
456053
|
+
{
|
|
456054
|
+
evidenceId: "cambria",
|
|
456055
|
+
logicalFamily: "Cambria",
|
|
456056
|
+
physicalFamily: "Caladea",
|
|
456057
|
+
verdict: "visual_only",
|
|
456058
|
+
faceVerdicts: { regular: "metric_safe", bold: "metric_safe", italic: "metric_safe", boldItalic: "visual_only" },
|
|
456059
|
+
glyphExceptions: [
|
|
456060
|
+
{
|
|
456061
|
+
slot: "boldItalic",
|
|
456062
|
+
codepoint: 96,
|
|
456063
|
+
advanceDelta: 0.231,
|
|
456064
|
+
note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
|
|
456065
|
+
}
|
|
456066
|
+
],
|
|
456067
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456068
|
+
advance: { meanDelta: 0.0002378, maxDelta: 0.2310758 },
|
|
456069
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
456070
|
+
policyAction: "substitute",
|
|
456071
|
+
measurementRefs: [
|
|
456072
|
+
"cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
|
|
456073
|
+
"cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
|
|
456074
|
+
"cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
|
|
456075
|
+
"cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
|
|
456076
|
+
],
|
|
456077
|
+
candidateLicense: "Apache-2.0",
|
|
456078
|
+
exportRule: "preserve_original_name"
|
|
456079
|
+
},
|
|
456080
|
+
{
|
|
456081
|
+
evidenceId: "arial",
|
|
456082
|
+
logicalFamily: "Arial",
|
|
456083
|
+
physicalFamily: "Liberation Sans",
|
|
456084
|
+
verdict: "metric_safe",
|
|
456085
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456086
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456087
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
456088
|
+
policyAction: "substitute",
|
|
456089
|
+
measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
|
|
456090
|
+
candidateLicense: "OFL-1.1",
|
|
456091
|
+
exportRule: "preserve_original_name"
|
|
456092
|
+
},
|
|
456093
|
+
{
|
|
456094
|
+
evidenceId: "times-new-roman",
|
|
456095
|
+
logicalFamily: "Times New Roman",
|
|
456096
|
+
physicalFamily: "Liberation Serif",
|
|
456097
|
+
verdict: "metric_safe",
|
|
456098
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456099
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456100
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
456101
|
+
policyAction: "substitute",
|
|
456102
|
+
measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
|
|
456103
|
+
candidateLicense: "OFL-1.1",
|
|
456104
|
+
exportRule: "preserve_original_name"
|
|
456105
|
+
},
|
|
456106
|
+
{
|
|
456107
|
+
evidenceId: "courier-new",
|
|
456108
|
+
logicalFamily: "Courier New",
|
|
456109
|
+
physicalFamily: "Liberation Mono",
|
|
456110
|
+
verdict: "metric_safe",
|
|
456111
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456112
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456113
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
456114
|
+
policyAction: "substitute",
|
|
456115
|
+
measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
|
|
456116
|
+
candidateLicense: "OFL-1.1",
|
|
456117
|
+
exportRule: "preserve_original_name"
|
|
456118
|
+
},
|
|
456119
|
+
{
|
|
456120
|
+
evidenceId: "helvetica",
|
|
456121
|
+
logicalFamily: "Helvetica",
|
|
456122
|
+
physicalFamily: "Liberation Sans",
|
|
456123
|
+
verdict: "metric_safe",
|
|
456124
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456125
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456126
|
+
gates: { static: "not_run", metric: "pass", layout: "not_run", ship: "fail" },
|
|
456127
|
+
policyAction: "substitute",
|
|
456128
|
+
measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
|
|
456129
|
+
candidateLicense: "OFL-1.1",
|
|
456130
|
+
exportRule: "preserve_original_name"
|
|
456131
|
+
},
|
|
456132
|
+
{
|
|
456133
|
+
evidenceId: "calibri-light",
|
|
456134
|
+
logicalFamily: "Calibri Light",
|
|
456135
|
+
physicalFamily: "Carlito",
|
|
456136
|
+
verdict: "visual_only",
|
|
456137
|
+
faces: { regular: false, bold: false, italic: false, boldItalic: false },
|
|
456138
|
+
advance: { meanDelta: 0.0148, maxDelta: 0.066 },
|
|
456139
|
+
gates: { static: "not_run", metric: "fail", layout: "not_run", ship: "fail" },
|
|
456140
|
+
policyAction: "category_fallback",
|
|
456141
|
+
measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
|
|
456142
|
+
candidateLicense: "OFL-1.1",
|
|
456143
|
+
exportRule: "preserve_original_name"
|
|
456144
|
+
}
|
|
456145
|
+
]);
|
|
456146
|
+
});
|
|
456147
|
+
|
|
456148
|
+
// ../../shared/font-system/src/resolver.ts
|
|
456149
|
+
function normalizeFamilyKey3(family2) {
|
|
456150
|
+
return family2.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
456151
|
+
}
|
|
456152
|
+
function sortPairs2(pairs) {
|
|
456153
|
+
return pairs.sort(([a2], [b2]) => a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
|
|
456154
|
+
}
|
|
456155
|
+
function deriveBundledSubstitutes2() {
|
|
456156
|
+
const substitutes = {};
|
|
456157
|
+
for (const row2 of SUBSTITUTION_EVIDENCE2) {
|
|
456158
|
+
if (row2.policyAction === "substitute" && row2.physicalFamily) {
|
|
456159
|
+
substitutes[normalizeFamilyKey3(row2.logicalFamily)] = row2.physicalFamily;
|
|
456160
|
+
}
|
|
456161
|
+
}
|
|
456162
|
+
return Object.freeze(substitutes);
|
|
456163
|
+
}
|
|
456164
|
+
function deriveCategoryFallbacks2() {
|
|
456165
|
+
const fallbacks = {};
|
|
456166
|
+
for (const row2 of SUBSTITUTION_EVIDENCE2) {
|
|
456167
|
+
if (row2.policyAction === "category_fallback" && row2.physicalFamily) {
|
|
456168
|
+
fallbacks[normalizeFamilyKey3(row2.logicalFamily)] = row2.physicalFamily;
|
|
456169
|
+
}
|
|
456170
|
+
}
|
|
456171
|
+
return Object.freeze(fallbacks);
|
|
456172
|
+
}
|
|
456173
|
+
function stripFamilyQuotes2(family2) {
|
|
456174
|
+
return family2.trim().replace(/^["']|["']$/g, "");
|
|
456175
|
+
}
|
|
456176
|
+
function splitStack2(cssFontFamily) {
|
|
456177
|
+
return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
|
|
456178
|
+
}
|
|
456179
|
+
|
|
456180
|
+
class FontResolver2 {
|
|
456181
|
+
#overrides = new Map;
|
|
456182
|
+
#embedded = new Map;
|
|
456183
|
+
#version = 0;
|
|
456184
|
+
#cachedSignature = null;
|
|
456185
|
+
map(logicalFamily, physicalFamily) {
|
|
456186
|
+
const key2 = normalizeFamilyKey3(logicalFamily);
|
|
456187
|
+
const physical = physicalFamily?.trim();
|
|
456188
|
+
if (!key2 || !physical)
|
|
456189
|
+
return;
|
|
456190
|
+
if (this.#overrides.get(key2) === physical)
|
|
456191
|
+
return;
|
|
456192
|
+
if (key2 === normalizeFamilyKey3(physical)) {
|
|
456193
|
+
if (this.#overrides.delete(key2)) {
|
|
456194
|
+
this.#version += 1;
|
|
456195
|
+
this.#cachedSignature = null;
|
|
456196
|
+
}
|
|
456197
|
+
return;
|
|
456198
|
+
}
|
|
456199
|
+
this.#overrides.set(key2, physical);
|
|
456200
|
+
this.#version += 1;
|
|
456201
|
+
this.#cachedSignature = null;
|
|
456202
|
+
}
|
|
456203
|
+
unmap(logicalFamily) {
|
|
456204
|
+
if (this.#overrides.delete(normalizeFamilyKey3(logicalFamily))) {
|
|
456205
|
+
this.#version += 1;
|
|
456206
|
+
this.#cachedSignature = null;
|
|
456207
|
+
}
|
|
456208
|
+
}
|
|
456209
|
+
mapEmbedded(logicalFamily, physicalFamily) {
|
|
456210
|
+
const key2 = normalizeFamilyKey3(logicalFamily);
|
|
456211
|
+
const physical = physicalFamily?.trim();
|
|
456212
|
+
if (!key2 || !physical)
|
|
456213
|
+
return;
|
|
456214
|
+
if (this.#embedded.get(key2) === physical)
|
|
456215
|
+
return;
|
|
456216
|
+
this.#embedded.set(key2, physical);
|
|
456217
|
+
this.#version += 1;
|
|
456218
|
+
this.#cachedSignature = null;
|
|
456219
|
+
}
|
|
456220
|
+
clearEmbedded() {
|
|
456221
|
+
if (this.#embedded.size === 0)
|
|
456222
|
+
return;
|
|
456223
|
+
this.#embedded.clear();
|
|
456224
|
+
this.#version += 1;
|
|
456225
|
+
this.#cachedSignature = null;
|
|
456226
|
+
}
|
|
456227
|
+
reset() {
|
|
456228
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0)
|
|
456229
|
+
return;
|
|
456230
|
+
this.#overrides.clear();
|
|
456231
|
+
this.#embedded.clear();
|
|
456232
|
+
this.#version += 1;
|
|
456233
|
+
this.#cachedSignature = null;
|
|
456234
|
+
}
|
|
456235
|
+
get version() {
|
|
456236
|
+
return this.#version;
|
|
456237
|
+
}
|
|
456238
|
+
get signature() {
|
|
456239
|
+
if (this.#cachedSignature !== null)
|
|
456240
|
+
return this.#cachedSignature;
|
|
456241
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0) {
|
|
456242
|
+
this.#cachedSignature = "";
|
|
456243
|
+
} else {
|
|
456244
|
+
const overridePairs = sortPairs2([...this.#overrides.entries()]);
|
|
456245
|
+
this.#cachedSignature = this.#embedded.size === 0 ? JSON.stringify(overridePairs) : JSON.stringify({ o: overridePairs, e: sortPairs2([...this.#embedded.entries()]) });
|
|
456246
|
+
}
|
|
456247
|
+
return this.#cachedSignature;
|
|
456248
|
+
}
|
|
456249
|
+
#physicalFor(bareFamily) {
|
|
456250
|
+
const key2 = normalizeFamilyKey3(bareFamily);
|
|
456251
|
+
const override = this.#overrides.get(key2);
|
|
456252
|
+
if (override)
|
|
456253
|
+
return { physical: override, reason: "custom_mapping" };
|
|
456254
|
+
const bundled = BUNDLED_SUBSTITUTES2[key2];
|
|
456255
|
+
if (bundled)
|
|
456256
|
+
return { physical: bundled, reason: "bundled_substitute" };
|
|
456257
|
+
const category = CATEGORY_FALLBACKS2[key2];
|
|
456258
|
+
if (category)
|
|
456259
|
+
return { physical: category, reason: "category_fallback" };
|
|
456260
|
+
return { physical: bareFamily, reason: "as_requested" };
|
|
456261
|
+
}
|
|
456262
|
+
#resolveFaceLadder(primary, face, hasFace) {
|
|
456263
|
+
const key2 = normalizeFamilyKey3(primary);
|
|
456264
|
+
const override = this.#overrides.get(key2);
|
|
456265
|
+
if (override && hasFace(override, face.weight, face.style)) {
|
|
456266
|
+
return { physical: override, reason: "custom_mapping" };
|
|
456267
|
+
}
|
|
456268
|
+
const embedded2 = this.#embedded.get(key2);
|
|
456269
|
+
if (embedded2 && hasFace(embedded2, face.weight, face.style)) {
|
|
456270
|
+
return { physical: embedded2, reason: "registered_face" };
|
|
456271
|
+
}
|
|
456272
|
+
if (hasFace(primary, face.weight, face.style)) {
|
|
456273
|
+
return { physical: primary, reason: "registered_face" };
|
|
456274
|
+
}
|
|
456275
|
+
const bundled = BUNDLED_SUBSTITUTES2[key2];
|
|
456276
|
+
if (bundled && hasFace(bundled, face.weight, face.style)) {
|
|
456277
|
+
return { physical: bundled, reason: "bundled_substitute" };
|
|
456278
|
+
}
|
|
456279
|
+
const category = CATEGORY_FALLBACKS2[key2];
|
|
456280
|
+
if (category && hasFace(category, face.weight, face.style)) {
|
|
456281
|
+
return { physical: category, reason: "category_fallback" };
|
|
456282
|
+
}
|
|
456283
|
+
if (override || bundled) {
|
|
456284
|
+
return { physical: primary, reason: "fallback_face_absent" };
|
|
456285
|
+
}
|
|
456286
|
+
return { physical: primary, reason: "as_requested" };
|
|
456287
|
+
}
|
|
456288
|
+
resolveFontFamily(logicalFamily) {
|
|
456289
|
+
const parts = splitStack2(logicalFamily);
|
|
456290
|
+
const primary = parts[0] ?? logicalFamily;
|
|
456291
|
+
const { physical, reason } = this.#physicalFor(primary);
|
|
456292
|
+
return { logicalFamily, physicalFamily: stripFamilyQuotes2(physical), reason };
|
|
456293
|
+
}
|
|
456294
|
+
resolvePhysicalFamily(cssFontFamily) {
|
|
456295
|
+
if (!cssFontFamily)
|
|
456296
|
+
return cssFontFamily;
|
|
456297
|
+
const parts = splitStack2(cssFontFamily);
|
|
456298
|
+
if (parts.length === 0)
|
|
456299
|
+
return cssFontFamily;
|
|
456300
|
+
const { physical, reason } = this.#physicalFor(parts[0]);
|
|
456301
|
+
if (reason === "as_requested")
|
|
456302
|
+
return cssFontFamily;
|
|
456303
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
456304
|
+
}
|
|
456305
|
+
resolveFace(logicalFamily, face, hasFace) {
|
|
456306
|
+
const parts = splitStack2(logicalFamily);
|
|
456307
|
+
const primary = parts[0] ?? logicalFamily;
|
|
456308
|
+
const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
|
|
456309
|
+
return { logicalFamily, physicalFamily: stripFamilyQuotes2(physical), reason };
|
|
456310
|
+
}
|
|
456311
|
+
resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
|
|
456312
|
+
if (!cssFontFamily)
|
|
456313
|
+
return cssFontFamily;
|
|
456314
|
+
const parts = splitStack2(cssFontFamily);
|
|
456315
|
+
if (parts.length === 0)
|
|
456316
|
+
return cssFontFamily;
|
|
456317
|
+
const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
|
|
456318
|
+
if (normalizeFamilyKey3(physical) !== normalizeFamilyKey3(parts[0])) {
|
|
456319
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
456320
|
+
}
|
|
456321
|
+
return cssFontFamily;
|
|
456322
|
+
}
|
|
456323
|
+
resolvePrimaryPhysicalFamily(family2) {
|
|
456324
|
+
const parts = splitStack2(family2);
|
|
456325
|
+
const primary = parts[0] ?? family2;
|
|
456326
|
+
return this.#physicalFor(primary).physical;
|
|
456327
|
+
}
|
|
456328
|
+
resolvePhysicalFamilies(families) {
|
|
456329
|
+
const out = new Set;
|
|
456330
|
+
for (const family2 of families) {
|
|
456331
|
+
if (family2)
|
|
456332
|
+
out.add(this.resolvePrimaryPhysicalFamily(family2));
|
|
456333
|
+
}
|
|
456334
|
+
return [...out];
|
|
456335
|
+
}
|
|
456336
|
+
}
|
|
456337
|
+
function resolvePhysicalFamily2(cssFontFamily) {
|
|
456338
|
+
return defaultResolver2.resolvePhysicalFamily(cssFontFamily);
|
|
456339
|
+
}
|
|
456340
|
+
var BUNDLED_SUBSTITUTES2, CATEGORY_FALLBACKS2, defaultResolver2, DEFAULT_FONT_MEASURE_CONTEXT2;
|
|
456341
|
+
var init_resolver = __esm(() => {
|
|
456342
|
+
init_substitution_evidence();
|
|
456343
|
+
BUNDLED_SUBSTITUTES2 = deriveBundledSubstitutes2();
|
|
456344
|
+
CATEGORY_FALLBACKS2 = deriveCategoryFallbacks2();
|
|
456345
|
+
defaultResolver2 = new FontResolver2;
|
|
456346
|
+
DEFAULT_FONT_MEASURE_CONTEXT2 = Object.freeze({
|
|
456347
|
+
resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily2(cssFontFamily),
|
|
456348
|
+
fontSignature: ""
|
|
456349
|
+
});
|
|
456350
|
+
});
|
|
456351
|
+
// ../../shared/font-system/src/bundled-manifest.ts
|
|
456352
|
+
function fourFaces2(filePrefix) {
|
|
456353
|
+
return [
|
|
456354
|
+
{ weight: "normal", style: "normal", file: `${filePrefix}-Regular.woff2` },
|
|
456355
|
+
{ weight: "bold", style: "normal", file: `${filePrefix}-Bold.woff2` },
|
|
456356
|
+
{ weight: "normal", style: "italic", file: `${filePrefix}-Italic.woff2` },
|
|
456357
|
+
{ weight: "bold", style: "italic", file: `${filePrefix}-BoldItalic.woff2` }
|
|
456358
|
+
];
|
|
456359
|
+
}
|
|
456360
|
+
function family2(name, filePrefix, license) {
|
|
456361
|
+
return { family: name, license, faces: fourFaces2(filePrefix) };
|
|
456362
|
+
}
|
|
456363
|
+
var BUNDLED_MANIFEST2;
|
|
456364
|
+
var init_bundled_manifest = __esm(() => {
|
|
456365
|
+
BUNDLED_MANIFEST2 = Object.freeze([
|
|
456366
|
+
family2("Carlito", "Carlito", "OFL-1.1"),
|
|
456367
|
+
family2("Caladea", "Caladea", "Apache-2.0"),
|
|
456368
|
+
family2("Liberation Sans", "LiberationSans", "OFL-1.1"),
|
|
456369
|
+
family2("Liberation Serif", "LiberationSerif", "OFL-1.1"),
|
|
456370
|
+
family2("Liberation Mono", "LiberationMono", "OFL-1.1")
|
|
456371
|
+
]);
|
|
456372
|
+
});
|
|
456373
|
+
|
|
456374
|
+
// ../../shared/font-system/src/bundled.ts
|
|
456375
|
+
var installedRegistries2;
|
|
456376
|
+
var init_bundled = __esm(() => {
|
|
456377
|
+
init_bundled_manifest();
|
|
456378
|
+
init_bundled_manifest();
|
|
456379
|
+
installedRegistries2 = new WeakMap;
|
|
456380
|
+
});
|
|
456381
|
+
|
|
456382
|
+
// ../../shared/font-system/src/report.ts
|
|
456383
|
+
var init_report = __esm(() => {
|
|
456384
|
+
init_resolver();
|
|
456385
|
+
init_types8();
|
|
456386
|
+
});
|
|
456387
|
+
|
|
456388
|
+
// ../../shared/font-system/src/os2.ts
|
|
456389
|
+
function parseEmbeddingPolicy2(bytes) {
|
|
456390
|
+
const view = bytes instanceof ArrayBuffer ? new DataView(bytes) : new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
456391
|
+
if (view.byteLength < SFNT_TABLE_DIR_OFFSET2)
|
|
456392
|
+
return null;
|
|
456393
|
+
const numTables = view.getUint16(4);
|
|
456394
|
+
let os2Offset = -1;
|
|
456395
|
+
for (let i5 = 0;i5 < numTables; i5 += 1) {
|
|
456396
|
+
const record3 = SFNT_TABLE_DIR_OFFSET2 + i5 * SFNT_TABLE_RECORD_SIZE2;
|
|
456397
|
+
if (record3 + SFNT_TABLE_RECORD_SIZE2 > view.byteLength)
|
|
456398
|
+
return null;
|
|
456399
|
+
const tag = String.fromCharCode(view.getUint8(record3), view.getUint8(record3 + 1), view.getUint8(record3 + 2), view.getUint8(record3 + 3));
|
|
456400
|
+
if (tag === "OS/2") {
|
|
456401
|
+
os2Offset = view.getUint32(record3 + 8);
|
|
456402
|
+
break;
|
|
456403
|
+
}
|
|
456404
|
+
}
|
|
456405
|
+
if (os2Offset < 0 || os2Offset + OS2_MIN_LENGTH2 > view.byteLength)
|
|
456406
|
+
return null;
|
|
456407
|
+
const usWeightClass = view.getUint16(os2Offset + OS2_USWEIGHTCLASS2);
|
|
456408
|
+
const fsType = view.getUint16(os2Offset + OS2_FSTYPE2);
|
|
456409
|
+
const fsSelection = view.getUint16(os2Offset + OS2_FSSELECTION2);
|
|
456410
|
+
const weight = usWeightClass >= BOLD_WEIGHT_THRESHOLD2 ? "700" : "400";
|
|
456411
|
+
const style2 = (fsSelection & FS_SELECTION_ITALIC2) !== 0 ? "italic" : "normal";
|
|
456412
|
+
return {
|
|
456413
|
+
fsType,
|
|
456414
|
+
face: { weight, style: style2 },
|
|
456415
|
+
embeddable: (fsType & FS_TYPE_RESTRICTED2) === 0
|
|
456416
|
+
};
|
|
456417
|
+
}
|
|
456418
|
+
var FS_TYPE_RESTRICTED2 = 2, FS_SELECTION_ITALIC2 = 1, BOLD_WEIGHT_THRESHOLD2 = 600, SFNT_TABLE_DIR_OFFSET2 = 12, SFNT_TABLE_RECORD_SIZE2 = 16, OS2_USWEIGHTCLASS2 = 4, OS2_FSTYPE2 = 8, OS2_FSSELECTION2 = 62, OS2_MIN_LENGTH2;
|
|
456419
|
+
var init_os2 = __esm(() => {
|
|
456420
|
+
OS2_MIN_LENGTH2 = OS2_FSSELECTION2 + 2;
|
|
456421
|
+
});
|
|
456422
|
+
|
|
456423
|
+
// ../../shared/font-system/src/registry.ts
|
|
456424
|
+
function quoteFamily2(family3) {
|
|
456425
|
+
return `"${family3.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
456426
|
+
}
|
|
456427
|
+
function canonicalizeFontSource2(source) {
|
|
456428
|
+
const match2 = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
|
|
456429
|
+
if (!match2)
|
|
456430
|
+
return source;
|
|
456431
|
+
let inner = match2[1].trim();
|
|
456432
|
+
if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'")) {
|
|
456433
|
+
inner = inner.slice(1, -1);
|
|
456434
|
+
}
|
|
456435
|
+
return `url(${JSON.stringify(inner)})`;
|
|
456436
|
+
}
|
|
456437
|
+
function normalizeFamilyKey4(family3) {
|
|
456438
|
+
return family3.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
456439
|
+
}
|
|
456440
|
+
function normalizeWeight2(weight) {
|
|
456441
|
+
if (weight === undefined)
|
|
456442
|
+
return "400";
|
|
456443
|
+
const w = String(weight).trim().toLowerCase();
|
|
456444
|
+
if (w === "bold" || w === "bolder")
|
|
456445
|
+
return "700";
|
|
456446
|
+
const n = Number(w);
|
|
456447
|
+
return Number.isFinite(n) && n >= 600 ? "700" : "400";
|
|
456448
|
+
}
|
|
456449
|
+
function normalizeStyle3(style2) {
|
|
456450
|
+
if (!style2)
|
|
456451
|
+
return "normal";
|
|
456452
|
+
const s2 = style2.trim().toLowerCase();
|
|
456453
|
+
return s2.startsWith("italic") || s2.startsWith("oblique") ? "italic" : "normal";
|
|
456454
|
+
}
|
|
456455
|
+
function faceKeyOf3(family3, weight, style2) {
|
|
456456
|
+
return `${normalizeFamilyKey4(family3)}|${weight}|${style2}`;
|
|
456457
|
+
}
|
|
456458
|
+
function faceProbe2(family3, weight, style2, size3) {
|
|
456459
|
+
const stylePart = style2 === "italic" ? "italic " : "";
|
|
456460
|
+
return `${stylePart}${weight} ${size3} ${quoteFamily2(family3)}`;
|
|
456461
|
+
}
|
|
456462
|
+
|
|
456463
|
+
class FontRegistry2 {
|
|
456464
|
+
#fontSet;
|
|
456465
|
+
#FontFaceCtor;
|
|
456466
|
+
#probeSize;
|
|
456467
|
+
#scheduleTimeout;
|
|
456468
|
+
#cancelTimeout;
|
|
456469
|
+
#managed = new Map;
|
|
456470
|
+
#facesByKey = new Map;
|
|
456471
|
+
#status = new Map;
|
|
456472
|
+
#sources = new Map;
|
|
456473
|
+
#warnedFailures = new Set;
|
|
456474
|
+
#inflight = new Map;
|
|
456475
|
+
#faceStatus = new Map;
|
|
456476
|
+
#faceInflight = new Map;
|
|
456477
|
+
#faceSources = new Map;
|
|
456478
|
+
#facesByFamily = new Map;
|
|
456479
|
+
#providerFaceKeys = new Set;
|
|
456480
|
+
#warnedFaceFailures = new Set;
|
|
456481
|
+
constructor(options = {}) {
|
|
456482
|
+
this.#fontSet = options.fontSet ?? null;
|
|
456483
|
+
this.#FontFaceCtor = options.FontFaceCtor ?? null;
|
|
456484
|
+
this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE2;
|
|
456485
|
+
this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
|
|
456486
|
+
this.#cancelTimeout = options.cancelTimeout ?? ((handle4) => globalThis.clearTimeout(handle4));
|
|
456487
|
+
}
|
|
456488
|
+
register(descriptor) {
|
|
456489
|
+
const { family: family3, source, descriptors: descriptors3 } = descriptor;
|
|
456490
|
+
const identitySource = typeof source === "string" ? canonicalizeFontSource2(source) : source;
|
|
456491
|
+
const weight = normalizeWeight2(descriptors3?.weight);
|
|
456492
|
+
const style2 = normalizeStyle3(descriptors3?.style);
|
|
456493
|
+
const key2 = faceKeyOf3(family3, weight, style2);
|
|
456494
|
+
if (typeof identitySource === "string") {
|
|
456495
|
+
const existingSource = this.#faceSources.get(key2);
|
|
456496
|
+
if (existingSource === identitySource)
|
|
456497
|
+
return { family: family3, status: this.getStatus(family3), changed: false };
|
|
456498
|
+
if (existingSource !== undefined) {
|
|
456499
|
+
throw new Error(`[superdoc] font face "${key2}" is already registered from a different source ` + `("${existingSource}"); a registered face's source cannot be replaced`);
|
|
456500
|
+
}
|
|
456501
|
+
}
|
|
456502
|
+
if (this.#FontFaceCtor && this.#fontSet) {
|
|
456503
|
+
const face = new this.#FontFaceCtor(family3, source, { ...descriptors3, weight, style: style2 });
|
|
456504
|
+
this.#fontSet.add(face);
|
|
456505
|
+
this.#addManagedFace(family3, key2, face);
|
|
456506
|
+
}
|
|
456507
|
+
if (typeof source === "string") {
|
|
456508
|
+
const list8 = this.#sources.get(family3) ?? [];
|
|
456509
|
+
if (!list8.includes(source))
|
|
456510
|
+
list8.push(source);
|
|
456511
|
+
this.#sources.set(family3, list8);
|
|
456512
|
+
}
|
|
456513
|
+
if (!this.#status.has(family3))
|
|
456514
|
+
this.#status.set(family3, "unloaded");
|
|
456515
|
+
this.#providerFaceKeys.add(key2);
|
|
456516
|
+
this.#trackFace(family3, key2);
|
|
456517
|
+
if (!this.#faceStatus.has(key2))
|
|
456518
|
+
this.#faceStatus.set(key2, "unloaded");
|
|
456519
|
+
if (typeof identitySource === "string" && !this.#faceSources.has(key2))
|
|
456520
|
+
this.#faceSources.set(key2, identitySource);
|
|
456521
|
+
return { family: family3, status: this.getStatus(family3), changed: true };
|
|
456522
|
+
}
|
|
456523
|
+
#trackFace(family3, key2) {
|
|
456524
|
+
const fam = normalizeFamilyKey4(family3);
|
|
456525
|
+
const set3 = this.#facesByFamily.get(fam) ?? new Set;
|
|
456526
|
+
set3.add(key2);
|
|
456527
|
+
this.#facesByFamily.set(fam, set3);
|
|
456528
|
+
}
|
|
456529
|
+
isManaged(family3) {
|
|
456530
|
+
return this.#managed.has(family3);
|
|
456531
|
+
}
|
|
456532
|
+
registerOwnedFace(descriptor) {
|
|
456533
|
+
const { family: family3, source, weight, style: style2 } = descriptor;
|
|
456534
|
+
if (!this.#FontFaceCtor || !this.#fontSet)
|
|
456535
|
+
return null;
|
|
456536
|
+
const key2 = faceKeyOf3(family3, weight, style2);
|
|
456537
|
+
const face = new this.#FontFaceCtor(family3, source, { weight, style: style2 });
|
|
456538
|
+
this.#fontSet.add(face);
|
|
456539
|
+
this.#addManagedFace(family3, key2, face);
|
|
456540
|
+
this.#providerFaceKeys.add(key2);
|
|
456541
|
+
if (!this.#status.has(family3))
|
|
456542
|
+
this.#status.set(family3, "unloaded");
|
|
456543
|
+
this.#trackFace(family3, key2);
|
|
456544
|
+
if (!this.#faceStatus.has(key2))
|
|
456545
|
+
this.#faceStatus.set(key2, "unloaded");
|
|
456546
|
+
let released = false;
|
|
456547
|
+
return () => {
|
|
456548
|
+
if (released)
|
|
456549
|
+
return false;
|
|
456550
|
+
released = true;
|
|
456551
|
+
return this.#removeManagedFace(family3, key2, face);
|
|
456552
|
+
};
|
|
456553
|
+
}
|
|
456554
|
+
#addManagedFace(family3, key2, face) {
|
|
456555
|
+
this.#managed.set(family3, face);
|
|
456556
|
+
let set3 = this.#facesByKey.get(key2);
|
|
456557
|
+
if (!set3) {
|
|
456558
|
+
set3 = new Set;
|
|
456559
|
+
this.#facesByKey.set(key2, set3);
|
|
456560
|
+
}
|
|
456561
|
+
set3.add(face);
|
|
456562
|
+
}
|
|
456563
|
+
#removeManagedFace(family3, key2, face) {
|
|
456564
|
+
const set3 = this.#facesByKey.get(key2);
|
|
456565
|
+
if (!set3 || !set3.delete(face))
|
|
456566
|
+
return false;
|
|
456567
|
+
if (typeof this.#fontSet?.delete === "function")
|
|
456568
|
+
this.#fontSet.delete(face);
|
|
456569
|
+
if (set3.size > 0)
|
|
456570
|
+
return true;
|
|
456571
|
+
this.#facesByKey.delete(key2);
|
|
456572
|
+
this.#providerFaceKeys.delete(key2);
|
|
456573
|
+
this.#faceStatus.delete(key2);
|
|
456574
|
+
this.#faceSources.delete(key2);
|
|
456575
|
+
const fam = normalizeFamilyKey4(family3);
|
|
456576
|
+
const keys7 = this.#facesByFamily.get(fam);
|
|
456577
|
+
if (keys7) {
|
|
456578
|
+
keys7.delete(key2);
|
|
456579
|
+
if (keys7.size === 0) {
|
|
456580
|
+
this.#facesByFamily.delete(fam);
|
|
456581
|
+
this.#managed.delete(family3);
|
|
456582
|
+
this.#status.delete(family3);
|
|
456583
|
+
this.#sources.delete(family3);
|
|
456584
|
+
}
|
|
456585
|
+
}
|
|
456586
|
+
return true;
|
|
456587
|
+
}
|
|
456588
|
+
getStatus(family3) {
|
|
456589
|
+
const statuses = [];
|
|
456590
|
+
const faceKeys = this.#facesByFamily.get(normalizeFamilyKey4(family3));
|
|
456591
|
+
if (faceKeys)
|
|
456592
|
+
for (const k2 of faceKeys)
|
|
456593
|
+
statuses.push(this.#faceStatus.get(k2) ?? "unloaded");
|
|
456594
|
+
const legacy = this.#status.get(family3);
|
|
456595
|
+
if (legacy)
|
|
456596
|
+
statuses.push(legacy);
|
|
456597
|
+
if (statuses.length === 0)
|
|
456598
|
+
return "unloaded";
|
|
456599
|
+
const priority = ["failed", "timed_out", "fallback_used", "loaded", "loading", "unloaded"];
|
|
456600
|
+
for (const s2 of priority)
|
|
456601
|
+
if (statuses.includes(s2))
|
|
456602
|
+
return s2;
|
|
456603
|
+
return "unloaded";
|
|
456604
|
+
}
|
|
456605
|
+
hasFace(family3, weight, style2) {
|
|
456606
|
+
const key2 = faceKeyOf3(family3, weight, style2);
|
|
456607
|
+
return this.#providerFaceKeys.has(key2) && this.#faceStatus.get(key2) !== "failed";
|
|
456608
|
+
}
|
|
456609
|
+
isAvailable(family3) {
|
|
456610
|
+
if (!this.#fontSet)
|
|
456611
|
+
return false;
|
|
456612
|
+
try {
|
|
456613
|
+
return this.#fontSet.check(`${this.#probeSize} ${quoteFamily2(family3)}`);
|
|
456614
|
+
} catch {
|
|
456615
|
+
return false;
|
|
456616
|
+
}
|
|
456617
|
+
}
|
|
456618
|
+
awaitFace(family3, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS2) {
|
|
456619
|
+
if (this.#status.get(family3) === "loaded") {
|
|
456620
|
+
return Promise.resolve({ family: family3, status: "loaded" });
|
|
456621
|
+
}
|
|
456622
|
+
const existing = this.#inflight.get(family3);
|
|
456623
|
+
if (existing)
|
|
456624
|
+
return existing;
|
|
456625
|
+
const probe = this.#loadOne(family3, timeoutMs).finally(() => {
|
|
456626
|
+
this.#inflight.delete(family3);
|
|
456627
|
+
});
|
|
456628
|
+
this.#inflight.set(family3, probe);
|
|
456629
|
+
return probe;
|
|
456630
|
+
}
|
|
456631
|
+
async awaitFaces(families, options = {}) {
|
|
456632
|
+
const unique2 = [...new Set(families)];
|
|
456633
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_FONT_LOAD_TIMEOUT_MS2;
|
|
456634
|
+
return Promise.all(unique2.map((family3) => this.awaitFace(family3, timeoutMs)));
|
|
456635
|
+
}
|
|
456636
|
+
getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS2) {
|
|
456637
|
+
return [...new Set(families)].map((family3) => ({
|
|
456638
|
+
family: family3,
|
|
456639
|
+
status: this.getStatus(family3),
|
|
456640
|
+
ready: this.awaitFace(family3, timeoutMs)
|
|
456641
|
+
}));
|
|
456642
|
+
}
|
|
456643
|
+
getStates() {
|
|
456644
|
+
return [...this.#status.entries()].map(([family3, status]) => ({ family: family3, status }));
|
|
456645
|
+
}
|
|
456646
|
+
getFaceStatus(request) {
|
|
456647
|
+
return this.#faceStatus.get(faceKeyOf3(request.family, request.weight, request.style)) ?? "unloaded";
|
|
456648
|
+
}
|
|
456649
|
+
awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS2) {
|
|
456650
|
+
const key2 = faceKeyOf3(request.family, request.weight, request.style);
|
|
456651
|
+
if (this.#faceStatus.get(key2) === "loaded") {
|
|
456652
|
+
return Promise.resolve({ request, status: "loaded" });
|
|
456653
|
+
}
|
|
456654
|
+
const existing = this.#faceInflight.get(key2);
|
|
456655
|
+
if (existing)
|
|
456656
|
+
return existing;
|
|
456657
|
+
const probe = this.#loadOneFace(request, key2, timeoutMs).finally(() => {
|
|
456658
|
+
this.#faceInflight.delete(key2);
|
|
456659
|
+
});
|
|
456660
|
+
this.#faceInflight.set(key2, probe);
|
|
456661
|
+
return probe;
|
|
456662
|
+
}
|
|
456663
|
+
async awaitFaceRequests(requests, options = {}) {
|
|
456664
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_FONT_LOAD_TIMEOUT_MS2;
|
|
456665
|
+
const seen = new Set;
|
|
456666
|
+
const unique2 = [];
|
|
456667
|
+
for (const r2 of requests) {
|
|
456668
|
+
const key2 = faceKeyOf3(r2.family, r2.weight, r2.style);
|
|
456669
|
+
if (seen.has(key2))
|
|
456670
|
+
continue;
|
|
456671
|
+
seen.add(key2);
|
|
456672
|
+
unique2.push(r2);
|
|
456673
|
+
}
|
|
456674
|
+
return Promise.all(unique2.map((r2) => this.awaitFaceRequest(r2, timeoutMs)));
|
|
456675
|
+
}
|
|
456676
|
+
async#loadOneFace(request, key2, timeoutMs) {
|
|
456677
|
+
this.#trackFace(request.family, key2);
|
|
456678
|
+
const fontSet = this.#fontSet;
|
|
456679
|
+
if (!fontSet) {
|
|
456680
|
+
this.#faceStatus.set(key2, "fallback_used");
|
|
456681
|
+
return { request, status: "fallback_used" };
|
|
456682
|
+
}
|
|
456683
|
+
this.#faceStatus.set(key2, "loading");
|
|
456684
|
+
const probe = faceProbe2(request.family, request.weight, request.style, this.#probeSize);
|
|
456685
|
+
const TIMEOUT = Symbol("timeout");
|
|
456686
|
+
let handle4;
|
|
456687
|
+
const timeout2 = new Promise((resolve2) => {
|
|
456688
|
+
handle4 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
456689
|
+
});
|
|
456690
|
+
try {
|
|
456691
|
+
const settled = await Promise.race([fontSet.load(probe), timeout2]);
|
|
456692
|
+
if (settled === TIMEOUT) {
|
|
456693
|
+
this.#faceStatus.set(key2, "timed_out");
|
|
456694
|
+
return { request, status: "timed_out" };
|
|
456695
|
+
}
|
|
456696
|
+
const faces = settled;
|
|
456697
|
+
const status = faces.length > 0 ? "loaded" : "fallback_used";
|
|
456698
|
+
this.#faceStatus.set(key2, status);
|
|
456699
|
+
return { request, status };
|
|
456700
|
+
} catch {
|
|
456701
|
+
this.#faceStatus.set(key2, "failed");
|
|
456702
|
+
this.#warnFaceFailureOnce(request, key2);
|
|
456703
|
+
return { request, status: "failed" };
|
|
456704
|
+
} finally {
|
|
456705
|
+
this.#cancelTimeout(handle4);
|
|
456706
|
+
}
|
|
456707
|
+
}
|
|
456708
|
+
#warnFaceFailureOnce(request, key2) {
|
|
456709
|
+
if (this.#warnedFaceFailures.has(key2))
|
|
456710
|
+
return;
|
|
456711
|
+
this.#warnedFaceFailures.add(key2);
|
|
456712
|
+
const src = this.#faceSources.get(key2);
|
|
456713
|
+
const detail = src ? ` from ${src}` : "";
|
|
456714
|
+
console.warn(`[superdoc] font face failed to load: "${request.family}" ${request.weight} ${request.style}${detail}. ` + `Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
456715
|
+
}
|
|
456716
|
+
async#loadOne(family3, timeoutMs) {
|
|
456717
|
+
const fontSet = this.#fontSet;
|
|
456718
|
+
if (!fontSet) {
|
|
456719
|
+
this.#status.set(family3, "fallback_used");
|
|
456720
|
+
return { family: family3, status: "fallback_used" };
|
|
456721
|
+
}
|
|
456722
|
+
this.#status.set(family3, "loading");
|
|
456723
|
+
const probe = `${this.#probeSize} ${quoteFamily2(family3)}`;
|
|
456724
|
+
const TIMEOUT = Symbol("timeout");
|
|
456725
|
+
let handle4;
|
|
456726
|
+
const timeout2 = new Promise((resolve2) => {
|
|
456727
|
+
handle4 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
456728
|
+
});
|
|
456729
|
+
try {
|
|
456730
|
+
const settled = await Promise.race([fontSet.load(probe), timeout2]);
|
|
456731
|
+
if (settled === TIMEOUT) {
|
|
456732
|
+
this.#status.set(family3, "timed_out");
|
|
456733
|
+
return { family: family3, status: "timed_out" };
|
|
456734
|
+
}
|
|
456735
|
+
const faces = settled;
|
|
456736
|
+
const status = faces.length > 0 ? "loaded" : "fallback_used";
|
|
456737
|
+
this.#status.set(family3, status);
|
|
456738
|
+
return { family: family3, status };
|
|
456739
|
+
} catch {
|
|
456740
|
+
this.#status.set(family3, "failed");
|
|
456741
|
+
this.#warnLoadFailureOnce(family3);
|
|
456742
|
+
return { family: family3, status: "failed" };
|
|
456743
|
+
} finally {
|
|
456744
|
+
this.#cancelTimeout(handle4);
|
|
456745
|
+
}
|
|
456746
|
+
}
|
|
456747
|
+
#warnLoadFailureOnce(family3) {
|
|
456748
|
+
if (this.#warnedFailures.has(family3))
|
|
456749
|
+
return;
|
|
456750
|
+
this.#warnedFailures.add(family3);
|
|
456751
|
+
const sources = this.#sources.get(family3);
|
|
456752
|
+
const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
|
|
456753
|
+
console.warn(`[superdoc] font asset failed to load for "${family3}"${detail}. ` + `Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
456754
|
+
}
|
|
456755
|
+
}
|
|
456756
|
+
var DEFAULT_FONT_LOAD_TIMEOUT_MS2 = 3000, DEFAULT_PROBE_SIZE2 = "16px", registriesByFontSet2;
|
|
456757
|
+
var init_registry2 = __esm(() => {
|
|
456758
|
+
registriesByFontSet2 = new WeakMap;
|
|
456759
|
+
});
|
|
456760
|
+
|
|
456761
|
+
// ../../shared/font-system/src/font-offerings.ts
|
|
456762
|
+
function classifyOffering2(policyAction, verdict, physicalFamily, bundled) {
|
|
456763
|
+
if (policyAction === "preserve_only")
|
|
456764
|
+
return "preserve_only";
|
|
456765
|
+
if (policyAction === "customer_supplied" || physicalFamily == null)
|
|
456766
|
+
return "customer_supplied";
|
|
456767
|
+
if (policyAction === "category_fallback")
|
|
456768
|
+
return "category_fallback";
|
|
456769
|
+
if (!bundled)
|
|
456770
|
+
return "requires_asset";
|
|
456771
|
+
return verdict === "metric_safe" ? "default" : "qualified";
|
|
456772
|
+
}
|
|
456773
|
+
function deriveOfferings2() {
|
|
456774
|
+
const offerings = SUBSTITUTION_EVIDENCE2.map((row2) => {
|
|
456775
|
+
const bundled = row2.physicalFamily != null && BUNDLED_FAMILIES2.has(row2.physicalFamily);
|
|
456776
|
+
return {
|
|
456777
|
+
logicalFamily: row2.logicalFamily,
|
|
456778
|
+
physicalFamily: row2.physicalFamily,
|
|
456779
|
+
generic: row2.physicalFamily && PHYSICAL_GENERIC2[row2.physicalFamily] || "sans-serif",
|
|
456780
|
+
offering: classifyOffering2(row2.policyAction, row2.verdict, row2.physicalFamily, bundled),
|
|
456781
|
+
bundled,
|
|
456782
|
+
verdict: row2.verdict,
|
|
456783
|
+
evidenceId: row2.evidenceId
|
|
456784
|
+
};
|
|
456785
|
+
});
|
|
456786
|
+
return Object.freeze(offerings);
|
|
456787
|
+
}
|
|
456788
|
+
var PHYSICAL_GENERIC2, BUNDLED_FAMILIES2, FONT_OFFERINGS2;
|
|
456789
|
+
var init_font_offerings = __esm(() => {
|
|
456790
|
+
init_substitution_evidence();
|
|
456791
|
+
init_bundled_manifest();
|
|
456792
|
+
PHYSICAL_GENERIC2 = Object.freeze({
|
|
456793
|
+
Carlito: "sans-serif",
|
|
456794
|
+
Caladea: "serif",
|
|
456795
|
+
"Liberation Sans": "sans-serif",
|
|
456796
|
+
"Liberation Serif": "serif",
|
|
456797
|
+
"Liberation Mono": "monospace"
|
|
456798
|
+
});
|
|
456799
|
+
BUNDLED_FAMILIES2 = new Set(BUNDLED_MANIFEST2.map((f2) => f2.family));
|
|
456800
|
+
FONT_OFFERINGS2 = deriveOfferings2();
|
|
456801
|
+
});
|
|
456802
|
+
|
|
456803
|
+
// ../../shared/font-system/src/index.ts
|
|
456804
|
+
var init_src5 = __esm(() => {
|
|
456805
|
+
init_types8();
|
|
456806
|
+
init_resolver();
|
|
456807
|
+
init_resolver();
|
|
456808
|
+
init_bundled();
|
|
456809
|
+
init_report();
|
|
456810
|
+
init_os2();
|
|
456811
|
+
init_registry2();
|
|
456812
|
+
init_font_offerings();
|
|
456813
|
+
});
|
|
456814
|
+
|
|
455713
456815
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/v2/exporter/commentsExporter.js
|
|
455714
456816
|
var prepareCommentParaIds2 = (comment2) => {
|
|
455715
456817
|
const newComment = {
|
|
@@ -456531,6 +457633,15 @@ var enumerateStructuralRowChanges2 = (state) => {
|
|
|
456531
457633
|
});
|
|
456532
457634
|
}, stringOf2 = (value) => typeof value === "string" ? value : value == null ? "" : String(value);
|
|
456533
457635
|
|
|
457636
|
+
// ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/tracked-change-type-utils.ts
|
|
457637
|
+
function projectInternalTrackChangeType2(type, structural) {
|
|
457638
|
+
if (type !== "structural")
|
|
457639
|
+
return type;
|
|
457640
|
+
if (structural?.subtype === "table-delete" || structural?.side === "deletion")
|
|
457641
|
+
return "delete";
|
|
457642
|
+
return "insert";
|
|
457643
|
+
}
|
|
457644
|
+
|
|
456534
457645
|
// ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/tracked-change-resolver.ts
|
|
456535
457646
|
function rangesOverlap3(a2, b2) {
|
|
456536
457647
|
return a2[0] < b2[1] && b2[0] < a2[1];
|
|
@@ -456639,17 +457750,18 @@ function buildPublicTrackedChangeIdMap2(grouped, replacements) {
|
|
|
456639
457750
|
return publicIdByChange;
|
|
456640
457751
|
}
|
|
456641
457752
|
function layerFromChange2(change, relationship) {
|
|
457753
|
+
const type = resolveTrackedChangeType2(change);
|
|
456642
457754
|
return {
|
|
456643
457755
|
id: change.id,
|
|
456644
457756
|
rawId: change.rawId,
|
|
456645
457757
|
commandRawId: change.commandRawId,
|
|
456646
|
-
type:
|
|
457758
|
+
type: projectInternalTrackChangeType2(type, change.structural),
|
|
456647
457759
|
relationship
|
|
456648
457760
|
};
|
|
456649
457761
|
}
|
|
456650
457762
|
function compareOverlapChildren2(a2, b2) {
|
|
456651
|
-
const aType = resolveTrackedChangeType2(a2);
|
|
456652
|
-
const bType = resolveTrackedChangeType2(b2);
|
|
457763
|
+
const aType = projectInternalTrackChangeType2(resolveTrackedChangeType2(a2), a2.structural);
|
|
457764
|
+
const bType = projectInternalTrackChangeType2(resolveTrackedChangeType2(b2), b2.structural);
|
|
456653
457765
|
if (aType !== bType) {
|
|
456654
457766
|
if (aType === "delete")
|
|
456655
457767
|
return -1;
|
|
@@ -458174,6 +459286,7 @@ var init_SuperConverter = __esm(() => {
|
|
|
458174
459286
|
init_normalizeDuplicateBlockIdentitiesInContent();
|
|
458175
459287
|
init_preProcessPageFieldsOnly();
|
|
458176
459288
|
init_helpers();
|
|
459289
|
+
init_src5();
|
|
458177
459290
|
init_base_list_definitions();
|
|
458178
459291
|
init_exporter_docx_defs();
|
|
458179
459292
|
init_commentsExporter();
|
|
@@ -458257,10 +459370,10 @@ var init_SuperConverter = __esm(() => {
|
|
|
458257
459370
|
}
|
|
458258
459371
|
static getFallbackFromFontTable(docx, fontName) {
|
|
458259
459372
|
const fontEntry = SuperConverter3.getFontTableEntry(docx, fontName);
|
|
458260
|
-
const
|
|
458261
|
-
if (!
|
|
459373
|
+
const family3 = fontEntry?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
|
|
459374
|
+
if (!family3)
|
|
458262
459375
|
return null;
|
|
458263
|
-
const mapped = FONT_FAMILY_FALLBACKS3[
|
|
459376
|
+
const mapped = FONT_FAMILY_FALLBACKS3[family3.toLowerCase()];
|
|
458264
459377
|
return mapped || DEFAULT_GENERIC_FALLBACK3;
|
|
458265
459378
|
}
|
|
458266
459379
|
static toCssFontFamily(fontName, docx) {
|
|
@@ -458723,14 +459836,17 @@ var init_SuperConverter = __esm(() => {
|
|
|
458723
459836
|
for (const font of fontsToInclude) {
|
|
458724
459837
|
const filePath = elements.find((el) => el.attributes.Id === font.attributes["r:id"])?.attributes?.Target;
|
|
458725
459838
|
if (!filePath)
|
|
458726
|
-
|
|
459839
|
+
continue;
|
|
458727
459840
|
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
458728
|
-
|
|
458729
|
-
|
|
458730
|
-
|
|
459841
|
+
if (!fontUint8Array?.buffer)
|
|
459842
|
+
continue;
|
|
459843
|
+
const fontBuffer = fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength);
|
|
458731
459844
|
const ttfBuffer = deobfuscateFont2(fontBuffer, font.attributes["w:fontKey"]);
|
|
458732
459845
|
if (!ttfBuffer)
|
|
458733
|
-
|
|
459846
|
+
continue;
|
|
459847
|
+
const policy = parseEmbeddingPolicy2(ttfBuffer);
|
|
459848
|
+
if (!(policy ? policy.embeddable : false))
|
|
459849
|
+
continue;
|
|
458734
459850
|
const blob = new Blob([ttfBuffer], { type: "font/ttf" });
|
|
458735
459851
|
const fontUrl = URL.createObjectURL(blob);
|
|
458736
459852
|
const isNormal = font.name.includes("Regular");
|
|
@@ -458756,6 +459872,49 @@ var init_SuperConverter = __esm(() => {
|
|
|
458756
459872
|
fontsImported
|
|
458757
459873
|
};
|
|
458758
459874
|
}
|
|
459875
|
+
getEmbeddedFontFaces() {
|
|
459876
|
+
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
459877
|
+
if (!fontTable || !Object.keys(this.fonts).length)
|
|
459878
|
+
return [];
|
|
459879
|
+
const wFonts = fontTable.elements?.find((el) => el.name === "w:fonts");
|
|
459880
|
+
const embeddedEntries = wFonts?.elements?.filter((el) => el.elements?.some((nested) => nested?.attributes?.["r:id"] && nested?.attributes?.["w:fontKey"])) ?? [];
|
|
459881
|
+
const embedElements = embeddedEntries.flatMap((entry) => (entry.elements ?? []).filter((el) => el.name?.startsWith("w:embed")).map((el) => ({ embed: el, family: entry.attributes?.["w:name"] })));
|
|
459882
|
+
const rels = this.convertedXml["word/_rels/fontTable.xml.rels"];
|
|
459883
|
+
const relElements = rels?.elements?.find((el) => el.name === "Relationships")?.elements ?? [];
|
|
459884
|
+
const faceFromEmbedName = (name = "") => ({
|
|
459885
|
+
weight: /bold/i.test(name) ? "700" : "400",
|
|
459886
|
+
style: /italic/i.test(name) ? "italic" : "normal"
|
|
459887
|
+
});
|
|
459888
|
+
const faces = [];
|
|
459889
|
+
for (const { embed, family: family3 } of embedElements) {
|
|
459890
|
+
const relationshipId = embed.attributes?.["r:id"];
|
|
459891
|
+
const fontKey = embed.attributes?.["w:fontKey"];
|
|
459892
|
+
if (!family3 || !relationshipId || !fontKey)
|
|
459893
|
+
continue;
|
|
459894
|
+
const filePath = relElements.find((el) => el.attributes?.Id === relationshipId)?.attributes?.Target;
|
|
459895
|
+
if (!filePath)
|
|
459896
|
+
continue;
|
|
459897
|
+
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
459898
|
+
if (!fontUint8Array?.buffer)
|
|
459899
|
+
continue;
|
|
459900
|
+
const sourceBytes = fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength);
|
|
459901
|
+
const ttf = deobfuscateFont2(sourceBytes, fontKey);
|
|
459902
|
+
if (!ttf)
|
|
459903
|
+
continue;
|
|
459904
|
+
const policy = parseEmbeddingPolicy2(ttf);
|
|
459905
|
+
const fallback = faceFromEmbedName(embed.name);
|
|
459906
|
+
faces.push({
|
|
459907
|
+
family: family3,
|
|
459908
|
+
source: ttf,
|
|
459909
|
+
weight: policy?.face.weight ?? fallback.weight,
|
|
459910
|
+
style: policy?.face.style ?? fallback.style,
|
|
459911
|
+
fsType: policy?.fsType ?? null,
|
|
459912
|
+
embeddable: policy ? policy.embeddable : false,
|
|
459913
|
+
relationshipId
|
|
459914
|
+
});
|
|
459915
|
+
}
|
|
459916
|
+
return faces;
|
|
459917
|
+
}
|
|
458759
459918
|
getDocumentInternalId() {
|
|
458760
459919
|
const settingsLocation = "word/settings.xml";
|
|
458761
459920
|
if (!this.convertedXml[settingsLocation]) {
|
|
@@ -470993,7 +472152,7 @@ function buildChangedTextFields2(type, excerpt) {
|
|
|
470993
472152
|
}
|
|
470994
472153
|
function buildProjectedInfo2(snapshot2, options = {}) {
|
|
470995
472154
|
const id2 = options.id ?? snapshot2.address.entityId;
|
|
470996
|
-
const type = options.type ?? snapshot2.type;
|
|
472155
|
+
const type = options.type ?? projectInternalTrackChangeType2(snapshot2.type, { subtype: snapshot2.subtype });
|
|
470997
472156
|
return {
|
|
470998
472157
|
info: {
|
|
470999
472158
|
address: {
|
|
@@ -471002,7 +472161,6 @@ function buildProjectedInfo2(snapshot2, options = {}) {
|
|
|
471002
472161
|
},
|
|
471003
472162
|
id: id2,
|
|
471004
472163
|
type,
|
|
471005
|
-
...type === "structural" && snapshot2.subtype ? { subtype: snapshot2.subtype } : {},
|
|
471006
472164
|
grouping: options.grouping,
|
|
471007
472165
|
pairedWithChangeId: options.pairedWithChangeId ?? undefined,
|
|
471008
472166
|
wordRevisionIds: normalizeWordRevisionIds2(snapshot2.wordRevisionIds),
|
|
@@ -471035,7 +472193,7 @@ function replacementPairKey4(snapshot2) {
|
|
|
471035
472193
|
return null;
|
|
471036
472194
|
}
|
|
471037
472195
|
function projectedSnapshotType2(snapshot2) {
|
|
471038
|
-
return isCombinedReplacementSnapshot2(snapshot2) ? "replacement" : snapshot2.type;
|
|
472196
|
+
return isCombinedReplacementSnapshot2(snapshot2) ? "replacement" : projectInternalTrackChangeType2(snapshot2.type, { subtype: snapshot2.subtype });
|
|
471039
472197
|
}
|
|
471040
472198
|
function snapshotGrouping2(snapshot2) {
|
|
471041
472199
|
return isCombinedReplacementSnapshot2(snapshot2) ? "replacement-pair" : "standalone";
|
|
@@ -471266,7 +472424,6 @@ function trackChangesListWrapper2(editor, input2) {
|
|
|
471266
472424
|
const {
|
|
471267
472425
|
address: address2,
|
|
471268
472426
|
type,
|
|
471269
|
-
subtype,
|
|
471270
472427
|
grouping,
|
|
471271
472428
|
pairedWithChangeId,
|
|
471272
472429
|
wordRevisionIds,
|
|
@@ -471284,7 +472441,6 @@ function trackChangesListWrapper2(editor, input2) {
|
|
|
471284
472441
|
return buildDiscoveryItem2(info.id, handle4, {
|
|
471285
472442
|
address: address2,
|
|
471286
472443
|
type,
|
|
471287
|
-
...subtype ? { subtype } : {},
|
|
471288
472444
|
grouping,
|
|
471289
472445
|
pairedWithChangeId,
|
|
471290
472446
|
wordRevisionIds,
|
|
@@ -471330,7 +472486,8 @@ function trackChangesGetWrapper2(editor, input2) {
|
|
|
471330
472486
|
const snapshot2 = snapshots.find((item) => item.anchorKey === anchorKey || item.address.entityId === baseId);
|
|
471331
472487
|
if (snapshot2)
|
|
471332
472488
|
return snapshotToInfo2(snapshot2);
|
|
471333
|
-
const
|
|
472489
|
+
const internalType = resolveTrackedChangeType2(resolved.change);
|
|
472490
|
+
const type = projectInternalTrackChangeType2(internalType, resolved.change.structural);
|
|
471334
472491
|
const excerpt = (resolved.change.excerpt !== undefined ? resolved.change.excerpt : undefined) ?? normalizeExcerpt2(resolved.editor.state.doc.textBetween(resolved.change.from, resolved.change.to, " ", ""));
|
|
471335
472492
|
const grouping = resolved.change.hasInsert && resolved.change.hasDelete && !resolved.change.hasFormat ? "replacement-pair" : undefined;
|
|
471336
472493
|
return {
|
|
@@ -471342,7 +472499,6 @@ function trackChangesGetWrapper2(editor, input2) {
|
|
|
471342
472499
|
},
|
|
471343
472500
|
id: resolved.change.id,
|
|
471344
472501
|
type,
|
|
471345
|
-
...type === "structural" && resolved.change.structural ? { subtype: resolved.change.structural.subtype } : {},
|
|
471346
472502
|
grouping,
|
|
471347
472503
|
wordRevisionIds: normalizeWordRevisionIds2(resolved.change.wordRevisionIds),
|
|
471348
472504
|
overlap: resolved.change.overlap,
|
|
@@ -471605,12 +472761,20 @@ function isTrackedChangeCommentTargetShape2(target) {
|
|
|
471605
472761
|
return false;
|
|
471606
472762
|
return typeof value.trackedChangeId === "string" && value.trackedChangeId.length > 0;
|
|
471607
472763
|
}
|
|
472764
|
+
function trackedChangeDisplayType2(snapshot2) {
|
|
472765
|
+
if (snapshot2.type !== "structural")
|
|
472766
|
+
return null;
|
|
472767
|
+
return snapshot2.subtype === "table-delete" ? "tableDelete" : "tableInsert";
|
|
472768
|
+
}
|
|
472769
|
+
function publicTrackedChangeType2(snapshot2) {
|
|
472770
|
+
return projectInternalTrackChangeType2(snapshot2.type, { subtype: snapshot2.subtype });
|
|
472771
|
+
}
|
|
471608
472772
|
function buildTrackedChangeLink2(snapshot2) {
|
|
471609
472773
|
const { trackedChangeText, deletedText } = trackedChangeTextFields2(snapshot2);
|
|
471610
472774
|
return {
|
|
471611
472775
|
trackedChange: true,
|
|
471612
|
-
trackedChangeType: snapshot2
|
|
471613
|
-
trackedChangeDisplayType:
|
|
472776
|
+
trackedChangeType: publicTrackedChangeType2(snapshot2),
|
|
472777
|
+
trackedChangeDisplayType: trackedChangeDisplayType2(snapshot2),
|
|
471614
472778
|
trackedChangeStory: snapshot2.story,
|
|
471615
472779
|
trackedChangeAnchorKey: snapshot2.anchorKey,
|
|
471616
472780
|
trackedChangeText,
|
|
@@ -471657,7 +472821,7 @@ function choosePreferredTrackedChangeSnapshot2(snapshots, preferredId) {
|
|
|
471657
472821
|
const rightLength = Math.max(0, right2.range.to - right2.range.from);
|
|
471658
472822
|
if (leftLength !== rightLength)
|
|
471659
472823
|
return leftLength - rightLength;
|
|
471660
|
-
const typeDelta = trackedChangeTypePriority2(left2
|
|
472824
|
+
const typeDelta = trackedChangeTypePriority2(publicTrackedChangeType2(left2)) - trackedChangeTypePriority2(publicTrackedChangeType2(right2));
|
|
471661
472825
|
if (typeDelta !== 0)
|
|
471662
472826
|
return typeDelta;
|
|
471663
472827
|
if (left2.range.from !== right2.range.from)
|
|
@@ -471864,7 +473028,7 @@ function parseCreatedTime2(value) {
|
|
|
471864
473028
|
}
|
|
471865
473029
|
function trackedChangeTextFields2(snapshot2) {
|
|
471866
473030
|
const excerpt = snapshot2.excerpt ?? "";
|
|
471867
|
-
if (snapshot2
|
|
473031
|
+
if (publicTrackedChangeType2(snapshot2) === "delete") {
|
|
471868
473032
|
return { trackedChangeText: "", deletedText: excerpt };
|
|
471869
473033
|
}
|
|
471870
473034
|
return { trackedChangeText: excerpt, deletedText: null };
|
|
@@ -471886,7 +473050,8 @@ function toTrackedChangeCommentInfo2(snapshot2) {
|
|
|
471886
473050
|
anchoredText: snapshot2.excerpt,
|
|
471887
473051
|
story: snapshot2.story,
|
|
471888
473052
|
trackedChange: true,
|
|
471889
|
-
trackedChangeType: snapshot2
|
|
473053
|
+
trackedChangeType: publicTrackedChangeType2(snapshot2),
|
|
473054
|
+
trackedChangeDisplayType: trackedChangeDisplayType2(snapshot2),
|
|
471890
473055
|
trackedChangeStory: snapshot2.story,
|
|
471891
473056
|
trackedChangeAnchorKey: snapshot2.anchorKey,
|
|
471892
473057
|
trackedChangeText,
|
|
@@ -472754,7 +473919,7 @@ function listCommentsHandler2(editor, query2) {
|
|
|
472754
473919
|
story,
|
|
472755
473920
|
trackedChange,
|
|
472756
473921
|
trackedChangeType,
|
|
472757
|
-
trackedChangeDisplayType,
|
|
473922
|
+
trackedChangeDisplayType: trackedChangeDisplayType3,
|
|
472758
473923
|
trackedChangeStory,
|
|
472759
473924
|
trackedChangeAnchorKey,
|
|
472760
473925
|
trackedChangeText,
|
|
@@ -472776,7 +473941,7 @@ function listCommentsHandler2(editor, query2) {
|
|
|
472776
473941
|
story,
|
|
472777
473942
|
trackedChange,
|
|
472778
473943
|
trackedChangeType,
|
|
472779
|
-
trackedChangeDisplayType,
|
|
473944
|
+
trackedChangeDisplayType: trackedChangeDisplayType3,
|
|
472780
473945
|
trackedChangeStory,
|
|
472781
473946
|
trackedChangeAnchorKey,
|
|
472782
473947
|
trackedChangeText,
|
|
@@ -479123,6 +480288,23 @@ function rewriteImportedStyleNumbering2(importedStyleEls, numRemap) {
|
|
|
479123
480288
|
function numAttr2(el, attr) {
|
|
479124
480289
|
return el.attributes?.[attr];
|
|
479125
480290
|
}
|
|
480291
|
+
function reorderNumberingChildren2(numberingEl) {
|
|
480292
|
+
if (!numberingEl.elements)
|
|
480293
|
+
return;
|
|
480294
|
+
const other = [];
|
|
480295
|
+
const abstracts = [];
|
|
480296
|
+
const nums = [];
|
|
480297
|
+
for (const el of numberingEl.elements) {
|
|
480298
|
+
const ln = localName2(el);
|
|
480299
|
+
if (ln === "abstractNum")
|
|
480300
|
+
abstracts.push(el);
|
|
480301
|
+
else if (ln === "num")
|
|
480302
|
+
nums.push(el);
|
|
480303
|
+
else
|
|
480304
|
+
other.push(el);
|
|
480305
|
+
}
|
|
480306
|
+
numberingEl.elements = [...other, ...abstracts, ...nums];
|
|
480307
|
+
}
|
|
479126
480308
|
function mergeNumberingGraph2(currentRoot, sourceRoot) {
|
|
479127
480309
|
const result = { numRemap: new Map, abstractRemap: new Map, mappings: [] };
|
|
479128
480310
|
const cur = rootElement2(currentRoot, "numbering");
|
|
@@ -479196,6 +480378,7 @@ function mergeNumberingGraph2(currentRoot, sourceRoot) {
|
|
|
479196
480378
|
}
|
|
479197
480379
|
cur.elements.push(next2);
|
|
479198
480380
|
}
|
|
480381
|
+
reorderNumberingChildren2(cur);
|
|
479199
480382
|
return result;
|
|
479200
480383
|
}
|
|
479201
480384
|
function reconcileSettings2(currentRoot, sourceRoot) {
|
|
@@ -479417,7 +480600,7 @@ function importHeaderFooterAssets2(editor, converter, byName, dryRun) {
|
|
|
479417
480600
|
usedMedia.add(allocated);
|
|
479418
480601
|
return allocated;
|
|
479419
480602
|
};
|
|
479420
|
-
const
|
|
480603
|
+
const sourceRelIdsByTarget = new Map;
|
|
479421
480604
|
for (const rel of srcRelEls) {
|
|
479422
480605
|
const type = rel.attributes?.Type;
|
|
479423
480606
|
const target = rel.attributes?.Target;
|
|
@@ -479425,7 +480608,12 @@ function importHeaderFooterAssets2(editor, converter, byName, dryRun) {
|
|
|
479425
480608
|
if (!type || !target || !id2)
|
|
479426
480609
|
continue;
|
|
479427
480610
|
if (type === HEADER_REL_TYPE4 || type === FOOTER_REL_TYPE4) {
|
|
479428
|
-
|
|
480611
|
+
const sourceTarget = relTargetToWordPath2(target).replace(/^word\//, "");
|
|
480612
|
+
const existing = sourceRelIdsByTarget.get(sourceTarget);
|
|
480613
|
+
if (existing)
|
|
480614
|
+
existing.push(id2);
|
|
480615
|
+
else
|
|
480616
|
+
sourceRelIdsByTarget.set(sourceTarget, [id2]);
|
|
479429
480617
|
}
|
|
479430
480618
|
}
|
|
479431
480619
|
const setHeaderIdsArray = (idsHolder, relId) => {
|
|
@@ -479510,10 +480698,10 @@ function importHeaderFooterAssets2(editor, converter, byName, dryRun) {
|
|
|
479510
480698
|
}
|
|
479511
480699
|
});
|
|
479512
480700
|
docRelsChanged = true;
|
|
479513
|
-
const
|
|
479514
|
-
|
|
479515
|
-
result.relIdRemap.set(
|
|
479516
|
-
result.mappings.push({ kind: "relationship", from:
|
|
480701
|
+
const sourceRelIds = sourceRelIdsByTarget.get(sourceTarget) ?? [];
|
|
480702
|
+
for (const sourceRelId of sourceRelIds) {
|
|
480703
|
+
result.relIdRemap.set(sourceRelId, relId);
|
|
480704
|
+
result.mappings.push({ kind: "relationship", from: sourceRelId, to: relId });
|
|
479517
480705
|
}
|
|
479518
480706
|
if (ensureContentTypeOverride2(converter, targetPartName, kind === "header" ? HEADER_CONTENT_TYPE2 : FOOTER_CONTENT_TYPE2)) {
|
|
479519
480707
|
contentTypesChanged = true;
|
|
@@ -479555,6 +480743,32 @@ function ensureContentTypeOverride2(converter, partPath, contentType) {
|
|
|
479555
480743
|
});
|
|
479556
480744
|
return true;
|
|
479557
480745
|
}
|
|
480746
|
+
function toSectionXmlElement2(node4) {
|
|
480747
|
+
if (!node4.name) {
|
|
480748
|
+
throw new Error("Expected named XML element.");
|
|
480749
|
+
}
|
|
480750
|
+
return {
|
|
480751
|
+
type: node4.type,
|
|
480752
|
+
name: node4.name,
|
|
480753
|
+
attributes: node4.attributes ? { ...node4.attributes } : undefined,
|
|
480754
|
+
elements: node4.elements?.filter((child) => typeof child.name === "string").map((child) => toSectionXmlElement2(child))
|
|
480755
|
+
};
|
|
480756
|
+
}
|
|
480757
|
+
function mergePageOneHeaderFooterModel2(targetSectPr, sourceSectPr) {
|
|
480758
|
+
const mergedSectPr = ensureSectPrElement2(targetSectPr);
|
|
480759
|
+
for (const kind of HEADER_FOOTER_KINDS5) {
|
|
480760
|
+
for (const variant of HEADER_FOOTER_VARIANTS5) {
|
|
480761
|
+
const sourceRef = getSectPrHeaderFooterRef2(sourceSectPr, kind, variant);
|
|
480762
|
+
if (sourceRef) {
|
|
480763
|
+
setSectPrHeaderFooterRef2(mergedSectPr, kind, variant, sourceRef);
|
|
480764
|
+
} else {
|
|
480765
|
+
clearSectPrHeaderFooterRef2(mergedSectPr, kind, variant);
|
|
480766
|
+
}
|
|
480767
|
+
}
|
|
480768
|
+
}
|
|
480769
|
+
writeSectPrTitlePage2(mergedSectPr, readSectPrTitlePage2(sourceSectPr));
|
|
480770
|
+
return mergedSectPr;
|
|
480771
|
+
}
|
|
479558
480772
|
function applyPageOneSectionDefaults2(editor, sourceDocumentXml, relIdRemap, parseXml2, dryRun) {
|
|
479559
480773
|
const result = {
|
|
479560
480774
|
detected: false,
|
|
@@ -479573,8 +480787,18 @@ function applyPageOneSectionDefaults2(editor, sourceDocumentXml, relIdRemap, par
|
|
|
479573
480787
|
if (!sourceSectPr)
|
|
479574
480788
|
return result;
|
|
479575
480789
|
result.detected = true;
|
|
479576
|
-
|
|
479577
|
-
|
|
480790
|
+
let sectPr;
|
|
480791
|
+
try {
|
|
480792
|
+
const rewrittenSectPr = clone3(sourceSectPr);
|
|
480793
|
+
rewriteSectPrRefs2(rewrittenSectPr, relIdRemap);
|
|
480794
|
+
sectPr = toSectionXmlElement2(rewrittenSectPr);
|
|
480795
|
+
} catch {
|
|
480796
|
+
result.warnings.push({
|
|
480797
|
+
code: "SECTION_DEFAULTS_UNAVAILABLE",
|
|
480798
|
+
message: "Could not normalize the source page-1 sectPr."
|
|
480799
|
+
});
|
|
480800
|
+
return result;
|
|
480801
|
+
}
|
|
479578
480802
|
let projections;
|
|
479579
480803
|
try {
|
|
479580
480804
|
projections = resolveSectionProjections2(editor);
|
|
@@ -479585,24 +480809,47 @@ function applyPageOneSectionDefaults2(editor, sourceDocumentXml, relIdRemap, par
|
|
|
479585
480809
|
});
|
|
479586
480810
|
return result;
|
|
479587
480811
|
}
|
|
479588
|
-
|
|
479589
|
-
if (!bodyProjection) {
|
|
480812
|
+
if (projections.length === 0) {
|
|
479590
480813
|
result.warnings.push({
|
|
479591
480814
|
code: "SECTION_DEFAULTS_UNAVAILABLE",
|
|
479592
|
-
message: "No
|
|
480815
|
+
message: "No section projections found for page-1 sectPr adoption."
|
|
479593
480816
|
});
|
|
479594
480817
|
return result;
|
|
479595
480818
|
}
|
|
479596
|
-
const
|
|
479597
|
-
|
|
480819
|
+
const bodyProjection = [...projections].reverse().find((projection) => projection.target.kind === "body") ?? projections[projections.length - 1];
|
|
480820
|
+
const sectionUpdates = projections.map((projection) => {
|
|
480821
|
+
const currentSectPr = readTargetSectPr2(editor, projection);
|
|
480822
|
+
const nextSectPr = projection.sectionId === bodyProjection.sectionId ? clone3(sectPr) : mergePageOneHeaderFooterModel2(currentSectPr, sectPr);
|
|
480823
|
+
if (xmlDeepEqual2(currentSectPr, nextSectPr))
|
|
480824
|
+
return null;
|
|
480825
|
+
return {
|
|
480826
|
+
sectionId: projection.sectionId,
|
|
480827
|
+
nextSectPr
|
|
480828
|
+
};
|
|
480829
|
+
}).filter((update) => Boolean(update));
|
|
480830
|
+
if (sectionUpdates.length === 0) {
|
|
479598
480831
|
return result;
|
|
479599
480832
|
}
|
|
479600
480833
|
result.changed = true;
|
|
479601
|
-
result.changedParts.push({
|
|
480834
|
+
result.changedParts.push({
|
|
480835
|
+
part: "word/document.xml",
|
|
480836
|
+
scope: "sectionDefaults",
|
|
480837
|
+
change: sectionUpdates.some((update) => update.sectionId !== bodyProjection.sectionId) ? "merged" : "replaced"
|
|
480838
|
+
});
|
|
479602
480839
|
if (dryRun)
|
|
479603
480840
|
return result;
|
|
479604
480841
|
try {
|
|
479605
|
-
|
|
480842
|
+
for (let index3 = 0;index3 < sectionUpdates.length; index3 += 1) {
|
|
480843
|
+
const update = sectionUpdates[index3];
|
|
480844
|
+
const liveProjection = resolveSectionProjections2(editor).find((projection) => projection.sectionId === update.sectionId);
|
|
480845
|
+
if (!liveProjection) {
|
|
480846
|
+
throw new Error(`Section ${update.sectionId} disappeared during page-1 sectPr adoption.`);
|
|
480847
|
+
}
|
|
480848
|
+
applySectPrToProjection3(editor, liveProjection, clone3(update.nextSectPr), {
|
|
480849
|
+
addToHistory: index3 === sectionUpdates.length - 1
|
|
480850
|
+
});
|
|
480851
|
+
}
|
|
480852
|
+
clearIndexCache2(editor);
|
|
479606
480853
|
result.applied = true;
|
|
479607
480854
|
} catch (err) {
|
|
479608
480855
|
result.changed = false;
|
|
@@ -479614,13 +480861,17 @@ function applyPageOneSectionDefaults2(editor, sourceDocumentXml, relIdRemap, par
|
|
|
479614
480861
|
}
|
|
479615
480862
|
return result;
|
|
479616
480863
|
}
|
|
479617
|
-
var HEADER_REL_TYPE4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", IMAGE_REL_TYPE4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", HEADER_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", FOOTER_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", CONTENT_TYPES_PART2 = "[Content_Types].xml", DOCUMENT_RELS_PART2 = "word/_rels/document.xml.rels";
|
|
480864
|
+
var HEADER_REL_TYPE4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", IMAGE_REL_TYPE4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", HEADER_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", FOOTER_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", CONTENT_TYPES_PART2 = "[Content_Types].xml", DOCUMENT_RELS_PART2 = "word/_rels/document.xml.rels", HEADER_FOOTER_KINDS5, HEADER_FOOTER_VARIANTS5;
|
|
479618
480865
|
var init_template_assets = __esm(() => {
|
|
479619
480866
|
init_template_xml();
|
|
479620
480867
|
init_read_package();
|
|
479621
480868
|
init_sections_resolver();
|
|
479622
480869
|
init_section_mutation_wrapper();
|
|
479623
480870
|
init_section_projection_access();
|
|
480871
|
+
init_index_cache();
|
|
480872
|
+
init_sections_xml();
|
|
480873
|
+
HEADER_FOOTER_KINDS5 = ["header", "footer"];
|
|
480874
|
+
HEADER_FOOTER_VARIANTS5 = ["default", "first", "even"];
|
|
479624
480875
|
});
|
|
479625
480876
|
|
|
479626
480877
|
// ../../packages/super-editor/src/editors/v1/document-api-adapters/templates/templates-adapter.ts
|
|
@@ -480006,7 +481257,7 @@ async function applyTemplateAsync2(editor, converter, input2, options) {
|
|
|
480006
481257
|
appliedScopes.push({ scope: "sectionDefaults", part: "word/document.xml" });
|
|
480007
481258
|
} else if (sec.detected) {
|
|
480008
481259
|
warnings.push(...sec.warnings);
|
|
480009
|
-
pushNoChangeSkip2(skippedScopes, "sectionDefaults", "word/document.xml", sec.warnings.length > 0 ? "Source page-1 section defaults could not be applied." : "Source page-1 section defaults already match the active section defaults.");
|
|
481260
|
+
pushNoChangeSkip2(skippedScopes, "sectionDefaults", "word/document.xml", sec.warnings.length > 0 ? "Source page-1 section defaults could not be applied." : "Source page-1 section defaults already match the current document's active section defaults and section header/footer visibility model.");
|
|
480010
481261
|
}
|
|
480011
481262
|
}
|
|
480012
481263
|
if (styleMappings.length > 0)
|
|
@@ -480909,9 +482160,9 @@ function findDonorMarkerFont2(abstract) {
|
|
|
480909
482160
|
continue;
|
|
480910
482161
|
if (rFontsHasSymbolFont2(rFonts))
|
|
480911
482162
|
continue;
|
|
480912
|
-
const
|
|
480913
|
-
if (
|
|
480914
|
-
return
|
|
482163
|
+
const family3 = readRFontsFamily2(rFonts);
|
|
482164
|
+
if (family3)
|
|
482165
|
+
return family3;
|
|
480915
482166
|
}
|
|
480916
482167
|
return;
|
|
480917
482168
|
}
|
|
@@ -507793,10 +509044,9 @@ EXAMPLES:
|
|
|
507793
509044
|
"insert",
|
|
507794
509045
|
"delete",
|
|
507795
509046
|
"replacement",
|
|
507796
|
-
"format"
|
|
507797
|
-
"structural"
|
|
509047
|
+
"format"
|
|
507798
509048
|
],
|
|
507799
|
-
description: "Filter by change type: 'insert', 'delete', 'replacement',
|
|
509049
|
+
description: "Filter by change type: 'insert', 'delete', 'replacement', or 'format'. Only for action 'list'. Omit for other actions."
|
|
507800
509050
|
},
|
|
507801
509051
|
force: {
|
|
507802
509052
|
type: "boolean",
|