@superdoc-dev/mcp 0.11.0-next.13 → 0.11.0-next.14
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 +2329 -1266
- package/package.json +1 -1
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-BVWG4qnQ.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));
|
|
@@ -98749,7 +99058,7 @@ var isRegExp = (value) => {
|
|
|
98749
99058
|
if (encodedAttrs && Object.keys(encodedAttrs).length > 0)
|
|
98750
99059
|
translated.attrs = { ...encodedAttrs };
|
|
98751
99060
|
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) => {
|
|
99061
|
+
}, config$35, translator$4, EAST_ASIAN_CHARACTER_REGEX, containsEastAsianCharacters = (text$2) => EAST_ASIAN_CHARACTER_REGEX.test(text$2), resolveFontFamily$1 = (textStyleAttrs, text$2) => {
|
|
98753
99062
|
if (!text$2)
|
|
98754
99063
|
return textStyleAttrs;
|
|
98755
99064
|
const eastAsiaFont = textStyleAttrs?.eastAsiaFontFamily;
|
|
@@ -99562,7 +99871,7 @@ var isRegExp = (value) => {
|
|
|
99562
99871
|
...textStyleMark.attrs || {},
|
|
99563
99872
|
...mark.attrs || {}
|
|
99564
99873
|
};
|
|
99565
|
-
textStyleMark.attrs = resolveFontFamily(textStyleMark.attrs, child?.text);
|
|
99874
|
+
textStyleMark.attrs = resolveFontFamily$1(textStyleMark.attrs, child?.text);
|
|
99566
99875
|
}
|
|
99567
99876
|
return false;
|
|
99568
99877
|
}
|
|
@@ -113056,7 +113365,537 @@ var isRegExp = (value) => {
|
|
|
113056
113365
|
tags.push(`</${name}>`);
|
|
113057
113366
|
return tags;
|
|
113058
113367
|
}
|
|
113059
|
-
},
|
|
113368
|
+
}, SETTLED_STATUSES, SUBSTITUTION_EVIDENCE, BUNDLED_SUBSTITUTES, CATEGORY_FALLBACKS, FontResolver = class {
|
|
113369
|
+
#overrides = /* @__PURE__ */ new Map;
|
|
113370
|
+
#embedded = /* @__PURE__ */ new Map;
|
|
113371
|
+
#version = 0;
|
|
113372
|
+
#cachedSignature = null;
|
|
113373
|
+
map(logicalFamily, physicalFamily) {
|
|
113374
|
+
const key = normalizeFamilyKey$1(logicalFamily);
|
|
113375
|
+
const physical = physicalFamily?.trim();
|
|
113376
|
+
if (!key || !physical)
|
|
113377
|
+
return;
|
|
113378
|
+
if (this.#overrides.get(key) === physical)
|
|
113379
|
+
return;
|
|
113380
|
+
if (key === normalizeFamilyKey$1(physical)) {
|
|
113381
|
+
if (this.#overrides.delete(key)) {
|
|
113382
|
+
this.#version += 1;
|
|
113383
|
+
this.#cachedSignature = null;
|
|
113384
|
+
}
|
|
113385
|
+
return;
|
|
113386
|
+
}
|
|
113387
|
+
this.#overrides.set(key, physical);
|
|
113388
|
+
this.#version += 1;
|
|
113389
|
+
this.#cachedSignature = null;
|
|
113390
|
+
}
|
|
113391
|
+
unmap(logicalFamily) {
|
|
113392
|
+
if (this.#overrides.delete(normalizeFamilyKey$1(logicalFamily))) {
|
|
113393
|
+
this.#version += 1;
|
|
113394
|
+
this.#cachedSignature = null;
|
|
113395
|
+
}
|
|
113396
|
+
}
|
|
113397
|
+
mapEmbedded(logicalFamily, physicalFamily) {
|
|
113398
|
+
const key = normalizeFamilyKey$1(logicalFamily);
|
|
113399
|
+
const physical = physicalFamily?.trim();
|
|
113400
|
+
if (!key || !physical)
|
|
113401
|
+
return;
|
|
113402
|
+
if (this.#embedded.get(key) === physical)
|
|
113403
|
+
return;
|
|
113404
|
+
this.#embedded.set(key, physical);
|
|
113405
|
+
this.#version += 1;
|
|
113406
|
+
this.#cachedSignature = null;
|
|
113407
|
+
}
|
|
113408
|
+
clearEmbedded() {
|
|
113409
|
+
if (this.#embedded.size === 0)
|
|
113410
|
+
return;
|
|
113411
|
+
this.#embedded.clear();
|
|
113412
|
+
this.#version += 1;
|
|
113413
|
+
this.#cachedSignature = null;
|
|
113414
|
+
}
|
|
113415
|
+
reset() {
|
|
113416
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0)
|
|
113417
|
+
return;
|
|
113418
|
+
this.#overrides.clear();
|
|
113419
|
+
this.#embedded.clear();
|
|
113420
|
+
this.#version += 1;
|
|
113421
|
+
this.#cachedSignature = null;
|
|
113422
|
+
}
|
|
113423
|
+
get version() {
|
|
113424
|
+
return this.#version;
|
|
113425
|
+
}
|
|
113426
|
+
get signature() {
|
|
113427
|
+
if (this.#cachedSignature !== null)
|
|
113428
|
+
return this.#cachedSignature;
|
|
113429
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0)
|
|
113430
|
+
this.#cachedSignature = "";
|
|
113431
|
+
else {
|
|
113432
|
+
const overridePairs = sortPairs([...this.#overrides.entries()]);
|
|
113433
|
+
this.#cachedSignature = this.#embedded.size === 0 ? JSON.stringify(overridePairs) : JSON.stringify({
|
|
113434
|
+
o: overridePairs,
|
|
113435
|
+
e: sortPairs([...this.#embedded.entries()])
|
|
113436
|
+
});
|
|
113437
|
+
}
|
|
113438
|
+
return this.#cachedSignature;
|
|
113439
|
+
}
|
|
113440
|
+
#physicalFor(bareFamily) {
|
|
113441
|
+
const key = normalizeFamilyKey$1(bareFamily);
|
|
113442
|
+
const override = this.#overrides.get(key);
|
|
113443
|
+
if (override)
|
|
113444
|
+
return {
|
|
113445
|
+
physical: override,
|
|
113446
|
+
reason: "custom_mapping"
|
|
113447
|
+
};
|
|
113448
|
+
const bundled = BUNDLED_SUBSTITUTES[key];
|
|
113449
|
+
if (bundled)
|
|
113450
|
+
return {
|
|
113451
|
+
physical: bundled,
|
|
113452
|
+
reason: "bundled_substitute"
|
|
113453
|
+
};
|
|
113454
|
+
const category = CATEGORY_FALLBACKS[key];
|
|
113455
|
+
if (category)
|
|
113456
|
+
return {
|
|
113457
|
+
physical: category,
|
|
113458
|
+
reason: "category_fallback"
|
|
113459
|
+
};
|
|
113460
|
+
return {
|
|
113461
|
+
physical: bareFamily,
|
|
113462
|
+
reason: "as_requested"
|
|
113463
|
+
};
|
|
113464
|
+
}
|
|
113465
|
+
#resolveFaceLadder(primary, face, hasFace) {
|
|
113466
|
+
const key = normalizeFamilyKey$1(primary);
|
|
113467
|
+
const override = this.#overrides.get(key);
|
|
113468
|
+
if (override && hasFace(override, face.weight, face.style))
|
|
113469
|
+
return {
|
|
113470
|
+
physical: override,
|
|
113471
|
+
reason: "custom_mapping"
|
|
113472
|
+
};
|
|
113473
|
+
const embedded = this.#embedded.get(key);
|
|
113474
|
+
if (embedded && hasFace(embedded, face.weight, face.style))
|
|
113475
|
+
return {
|
|
113476
|
+
physical: embedded,
|
|
113477
|
+
reason: "registered_face"
|
|
113478
|
+
};
|
|
113479
|
+
if (hasFace(primary, face.weight, face.style))
|
|
113480
|
+
return {
|
|
113481
|
+
physical: primary,
|
|
113482
|
+
reason: "registered_face"
|
|
113483
|
+
};
|
|
113484
|
+
const bundled = BUNDLED_SUBSTITUTES[key];
|
|
113485
|
+
if (bundled && hasFace(bundled, face.weight, face.style))
|
|
113486
|
+
return {
|
|
113487
|
+
physical: bundled,
|
|
113488
|
+
reason: "bundled_substitute"
|
|
113489
|
+
};
|
|
113490
|
+
const category = CATEGORY_FALLBACKS[key];
|
|
113491
|
+
if (category && hasFace(category, face.weight, face.style))
|
|
113492
|
+
return {
|
|
113493
|
+
physical: category,
|
|
113494
|
+
reason: "category_fallback"
|
|
113495
|
+
};
|
|
113496
|
+
if (override || bundled)
|
|
113497
|
+
return {
|
|
113498
|
+
physical: primary,
|
|
113499
|
+
reason: "fallback_face_absent"
|
|
113500
|
+
};
|
|
113501
|
+
return {
|
|
113502
|
+
physical: primary,
|
|
113503
|
+
reason: "as_requested"
|
|
113504
|
+
};
|
|
113505
|
+
}
|
|
113506
|
+
resolveFontFamily(logicalFamily) {
|
|
113507
|
+
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
113508
|
+
const { physical, reason } = this.#physicalFor(primary);
|
|
113509
|
+
return {
|
|
113510
|
+
logicalFamily,
|
|
113511
|
+
physicalFamily: stripFamilyQuotes(physical),
|
|
113512
|
+
reason
|
|
113513
|
+
};
|
|
113514
|
+
}
|
|
113515
|
+
resolvePhysicalFamily(cssFontFamily) {
|
|
113516
|
+
if (!cssFontFamily)
|
|
113517
|
+
return cssFontFamily;
|
|
113518
|
+
const parts = splitStack(cssFontFamily);
|
|
113519
|
+
if (parts.length === 0)
|
|
113520
|
+
return cssFontFamily;
|
|
113521
|
+
const { physical, reason } = this.#physicalFor(parts[0]);
|
|
113522
|
+
if (reason === "as_requested")
|
|
113523
|
+
return cssFontFamily;
|
|
113524
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
113525
|
+
}
|
|
113526
|
+
resolveFace(logicalFamily, face, hasFace) {
|
|
113527
|
+
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
113528
|
+
const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
|
|
113529
|
+
return {
|
|
113530
|
+
logicalFamily,
|
|
113531
|
+
physicalFamily: stripFamilyQuotes(physical),
|
|
113532
|
+
reason
|
|
113533
|
+
};
|
|
113534
|
+
}
|
|
113535
|
+
resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
|
|
113536
|
+
if (!cssFontFamily)
|
|
113537
|
+
return cssFontFamily;
|
|
113538
|
+
const parts = splitStack(cssFontFamily);
|
|
113539
|
+
if (parts.length === 0)
|
|
113540
|
+
return cssFontFamily;
|
|
113541
|
+
const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
|
|
113542
|
+
if (normalizeFamilyKey$1(physical) !== normalizeFamilyKey$1(parts[0]))
|
|
113543
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
113544
|
+
return cssFontFamily;
|
|
113545
|
+
}
|
|
113546
|
+
resolvePrimaryPhysicalFamily(family$1) {
|
|
113547
|
+
const primary = splitStack(family$1)[0] ?? family$1;
|
|
113548
|
+
return this.#physicalFor(primary).physical;
|
|
113549
|
+
}
|
|
113550
|
+
resolvePhysicalFamilies(families) {
|
|
113551
|
+
const out = /* @__PURE__ */ new Set;
|
|
113552
|
+
for (const family$1 of families)
|
|
113553
|
+
if (family$1)
|
|
113554
|
+
out.add(this.resolvePrimaryPhysicalFamily(family$1));
|
|
113555
|
+
return [...out];
|
|
113556
|
+
}
|
|
113557
|
+
}, 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 {
|
|
113558
|
+
#fontSet;
|
|
113559
|
+
#FontFaceCtor;
|
|
113560
|
+
#probeSize;
|
|
113561
|
+
#scheduleTimeout;
|
|
113562
|
+
#cancelTimeout;
|
|
113563
|
+
#managed = /* @__PURE__ */ new Map;
|
|
113564
|
+
#facesByKey = /* @__PURE__ */ new Map;
|
|
113565
|
+
#status = /* @__PURE__ */ new Map;
|
|
113566
|
+
#sources = /* @__PURE__ */ new Map;
|
|
113567
|
+
#warnedFailures = /* @__PURE__ */ new Set;
|
|
113568
|
+
#inflight = /* @__PURE__ */ new Map;
|
|
113569
|
+
#faceStatus = /* @__PURE__ */ new Map;
|
|
113570
|
+
#faceInflight = /* @__PURE__ */ new Map;
|
|
113571
|
+
#faceSources = /* @__PURE__ */ new Map;
|
|
113572
|
+
#facesByFamily = /* @__PURE__ */ new Map;
|
|
113573
|
+
#providerFaceKeys = /* @__PURE__ */ new Set;
|
|
113574
|
+
#warnedFaceFailures = /* @__PURE__ */ new Set;
|
|
113575
|
+
constructor(options = {}) {
|
|
113576
|
+
this.#fontSet = options.fontSet ?? null;
|
|
113577
|
+
this.#FontFaceCtor = options.FontFaceCtor ?? null;
|
|
113578
|
+
this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
|
|
113579
|
+
this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
|
|
113580
|
+
this.#cancelTimeout = options.cancelTimeout ?? ((handle2) => globalThis.clearTimeout(handle2));
|
|
113581
|
+
}
|
|
113582
|
+
register(descriptor) {
|
|
113583
|
+
const { family: family$1, source, descriptors: descriptors$1 } = descriptor;
|
|
113584
|
+
const identitySource = typeof source === "string" ? canonicalizeFontSource(source) : source;
|
|
113585
|
+
const weight = normalizeWeight(descriptors$1?.weight);
|
|
113586
|
+
const style = normalizeStyle(descriptors$1?.style);
|
|
113587
|
+
const key = faceKeyOf(family$1, weight, style);
|
|
113588
|
+
if (typeof identitySource === "string") {
|
|
113589
|
+
const existingSource = this.#faceSources.get(key);
|
|
113590
|
+
if (existingSource === identitySource)
|
|
113591
|
+
return {
|
|
113592
|
+
family: family$1,
|
|
113593
|
+
status: this.getStatus(family$1),
|
|
113594
|
+
changed: false
|
|
113595
|
+
};
|
|
113596
|
+
if (existingSource !== undefined)
|
|
113597
|
+
throw new Error(`[superdoc] font face "${key}" is already registered from a different source ("${existingSource}"); a registered face's source cannot be replaced`);
|
|
113598
|
+
}
|
|
113599
|
+
if (this.#FontFaceCtor && this.#fontSet) {
|
|
113600
|
+
const face = new this.#FontFaceCtor(family$1, source, {
|
|
113601
|
+
...descriptors$1,
|
|
113602
|
+
weight,
|
|
113603
|
+
style
|
|
113604
|
+
});
|
|
113605
|
+
this.#fontSet.add(face);
|
|
113606
|
+
this.#addManagedFace(family$1, key, face);
|
|
113607
|
+
}
|
|
113608
|
+
if (typeof source === "string") {
|
|
113609
|
+
const list$1 = this.#sources.get(family$1) ?? [];
|
|
113610
|
+
if (!list$1.includes(source))
|
|
113611
|
+
list$1.push(source);
|
|
113612
|
+
this.#sources.set(family$1, list$1);
|
|
113613
|
+
}
|
|
113614
|
+
if (!this.#status.has(family$1))
|
|
113615
|
+
this.#status.set(family$1, "unloaded");
|
|
113616
|
+
this.#providerFaceKeys.add(key);
|
|
113617
|
+
this.#trackFace(family$1, key);
|
|
113618
|
+
if (!this.#faceStatus.has(key))
|
|
113619
|
+
this.#faceStatus.set(key, "unloaded");
|
|
113620
|
+
if (typeof identitySource === "string" && !this.#faceSources.has(key))
|
|
113621
|
+
this.#faceSources.set(key, identitySource);
|
|
113622
|
+
return {
|
|
113623
|
+
family: family$1,
|
|
113624
|
+
status: this.getStatus(family$1),
|
|
113625
|
+
changed: true
|
|
113626
|
+
};
|
|
113627
|
+
}
|
|
113628
|
+
#trackFace(family$1, key) {
|
|
113629
|
+
const fam = normalizeFamilyKey(family$1);
|
|
113630
|
+
const set3 = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
|
|
113631
|
+
set3.add(key);
|
|
113632
|
+
this.#facesByFamily.set(fam, set3);
|
|
113633
|
+
}
|
|
113634
|
+
isManaged(family$1) {
|
|
113635
|
+
return this.#managed.has(family$1);
|
|
113636
|
+
}
|
|
113637
|
+
registerOwnedFace(descriptor) {
|
|
113638
|
+
const { family: family$1, source, weight, style } = descriptor;
|
|
113639
|
+
if (!this.#FontFaceCtor || !this.#fontSet)
|
|
113640
|
+
return null;
|
|
113641
|
+
const key = faceKeyOf(family$1, weight, style);
|
|
113642
|
+
const face = new this.#FontFaceCtor(family$1, source, {
|
|
113643
|
+
weight,
|
|
113644
|
+
style
|
|
113645
|
+
});
|
|
113646
|
+
this.#fontSet.add(face);
|
|
113647
|
+
this.#addManagedFace(family$1, key, face);
|
|
113648
|
+
this.#providerFaceKeys.add(key);
|
|
113649
|
+
if (!this.#status.has(family$1))
|
|
113650
|
+
this.#status.set(family$1, "unloaded");
|
|
113651
|
+
this.#trackFace(family$1, key);
|
|
113652
|
+
if (!this.#faceStatus.has(key))
|
|
113653
|
+
this.#faceStatus.set(key, "unloaded");
|
|
113654
|
+
let released = false;
|
|
113655
|
+
return () => {
|
|
113656
|
+
if (released)
|
|
113657
|
+
return false;
|
|
113658
|
+
released = true;
|
|
113659
|
+
return this.#removeManagedFace(family$1, key, face);
|
|
113660
|
+
};
|
|
113661
|
+
}
|
|
113662
|
+
#addManagedFace(family$1, key, face) {
|
|
113663
|
+
this.#managed.set(family$1, face);
|
|
113664
|
+
let set3 = this.#facesByKey.get(key);
|
|
113665
|
+
if (!set3) {
|
|
113666
|
+
set3 = /* @__PURE__ */ new Set;
|
|
113667
|
+
this.#facesByKey.set(key, set3);
|
|
113668
|
+
}
|
|
113669
|
+
set3.add(face);
|
|
113670
|
+
}
|
|
113671
|
+
#removeManagedFace(family$1, key, face) {
|
|
113672
|
+
const set3 = this.#facesByKey.get(key);
|
|
113673
|
+
if (!set3 || !set3.delete(face))
|
|
113674
|
+
return false;
|
|
113675
|
+
if (typeof this.#fontSet?.delete === "function")
|
|
113676
|
+
this.#fontSet.delete(face);
|
|
113677
|
+
if (set3.size > 0)
|
|
113678
|
+
return true;
|
|
113679
|
+
this.#facesByKey.delete(key);
|
|
113680
|
+
this.#providerFaceKeys.delete(key);
|
|
113681
|
+
this.#faceStatus.delete(key);
|
|
113682
|
+
this.#faceSources.delete(key);
|
|
113683
|
+
const fam = normalizeFamilyKey(family$1);
|
|
113684
|
+
const keys$1 = this.#facesByFamily.get(fam);
|
|
113685
|
+
if (keys$1) {
|
|
113686
|
+
keys$1.delete(key);
|
|
113687
|
+
if (keys$1.size === 0) {
|
|
113688
|
+
this.#facesByFamily.delete(fam);
|
|
113689
|
+
this.#managed.delete(family$1);
|
|
113690
|
+
this.#status.delete(family$1);
|
|
113691
|
+
this.#sources.delete(family$1);
|
|
113692
|
+
}
|
|
113693
|
+
}
|
|
113694
|
+
return true;
|
|
113695
|
+
}
|
|
113696
|
+
getStatus(family$1) {
|
|
113697
|
+
const statuses = [];
|
|
113698
|
+
const faceKeys = this.#facesByFamily.get(normalizeFamilyKey(family$1));
|
|
113699
|
+
if (faceKeys)
|
|
113700
|
+
for (const k of faceKeys)
|
|
113701
|
+
statuses.push(this.#faceStatus.get(k) ?? "unloaded");
|
|
113702
|
+
const legacy = this.#status.get(family$1);
|
|
113703
|
+
if (legacy)
|
|
113704
|
+
statuses.push(legacy);
|
|
113705
|
+
if (statuses.length === 0)
|
|
113706
|
+
return "unloaded";
|
|
113707
|
+
for (const s of [
|
|
113708
|
+
"failed",
|
|
113709
|
+
"timed_out",
|
|
113710
|
+
"fallback_used",
|
|
113711
|
+
"loaded",
|
|
113712
|
+
"loading",
|
|
113713
|
+
"unloaded"
|
|
113714
|
+
])
|
|
113715
|
+
if (statuses.includes(s))
|
|
113716
|
+
return s;
|
|
113717
|
+
return "unloaded";
|
|
113718
|
+
}
|
|
113719
|
+
hasFace(family$1, weight, style) {
|
|
113720
|
+
const key = faceKeyOf(family$1, weight, style);
|
|
113721
|
+
return this.#providerFaceKeys.has(key) && this.#faceStatus.get(key) !== "failed";
|
|
113722
|
+
}
|
|
113723
|
+
isAvailable(family$1) {
|
|
113724
|
+
if (!this.#fontSet)
|
|
113725
|
+
return false;
|
|
113726
|
+
try {
|
|
113727
|
+
return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
|
|
113728
|
+
} catch {
|
|
113729
|
+
return false;
|
|
113730
|
+
}
|
|
113731
|
+
}
|
|
113732
|
+
awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
113733
|
+
if (this.#status.get(family$1) === "loaded")
|
|
113734
|
+
return Promise.resolve({
|
|
113735
|
+
family: family$1,
|
|
113736
|
+
status: "loaded"
|
|
113737
|
+
});
|
|
113738
|
+
const existing = this.#inflight.get(family$1);
|
|
113739
|
+
if (existing)
|
|
113740
|
+
return existing;
|
|
113741
|
+
const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
|
|
113742
|
+
this.#inflight.delete(family$1);
|
|
113743
|
+
});
|
|
113744
|
+
this.#inflight.set(family$1, probe);
|
|
113745
|
+
return probe;
|
|
113746
|
+
}
|
|
113747
|
+
async awaitFaces(families, options = {}) {
|
|
113748
|
+
const unique = [...new Set(families)];
|
|
113749
|
+
const timeoutMs = options.timeoutMs ?? 3000;
|
|
113750
|
+
return Promise.all(unique.map((family$1) => this.awaitFace(family$1, timeoutMs)));
|
|
113751
|
+
}
|
|
113752
|
+
getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
113753
|
+
return [...new Set(families)].map((family$1) => ({
|
|
113754
|
+
family: family$1,
|
|
113755
|
+
status: this.getStatus(family$1),
|
|
113756
|
+
ready: this.awaitFace(family$1, timeoutMs)
|
|
113757
|
+
}));
|
|
113758
|
+
}
|
|
113759
|
+
getStates() {
|
|
113760
|
+
return [...this.#status.entries()].map(([family$1, status]) => ({
|
|
113761
|
+
family: family$1,
|
|
113762
|
+
status
|
|
113763
|
+
}));
|
|
113764
|
+
}
|
|
113765
|
+
getFaceStatus(request) {
|
|
113766
|
+
return this.#faceStatus.get(faceKeyOf(request.family, request.weight, request.style)) ?? "unloaded";
|
|
113767
|
+
}
|
|
113768
|
+
awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
113769
|
+
const key = faceKeyOf(request.family, request.weight, request.style);
|
|
113770
|
+
if (this.#faceStatus.get(key) === "loaded")
|
|
113771
|
+
return Promise.resolve({
|
|
113772
|
+
request,
|
|
113773
|
+
status: "loaded"
|
|
113774
|
+
});
|
|
113775
|
+
const existing = this.#faceInflight.get(key);
|
|
113776
|
+
if (existing)
|
|
113777
|
+
return existing;
|
|
113778
|
+
const probe = this.#loadOneFace(request, key, timeoutMs).finally(() => {
|
|
113779
|
+
this.#faceInflight.delete(key);
|
|
113780
|
+
});
|
|
113781
|
+
this.#faceInflight.set(key, probe);
|
|
113782
|
+
return probe;
|
|
113783
|
+
}
|
|
113784
|
+
async awaitFaceRequests(requests, options = {}) {
|
|
113785
|
+
const timeoutMs = options.timeoutMs ?? 3000;
|
|
113786
|
+
const seen = /* @__PURE__ */ new Set;
|
|
113787
|
+
const unique = [];
|
|
113788
|
+
for (const r of requests) {
|
|
113789
|
+
const key = faceKeyOf(r.family, r.weight, r.style);
|
|
113790
|
+
if (seen.has(key))
|
|
113791
|
+
continue;
|
|
113792
|
+
seen.add(key);
|
|
113793
|
+
unique.push(r);
|
|
113794
|
+
}
|
|
113795
|
+
return Promise.all(unique.map((r) => this.awaitFaceRequest(r, timeoutMs)));
|
|
113796
|
+
}
|
|
113797
|
+
async#loadOneFace(request, key, timeoutMs) {
|
|
113798
|
+
this.#trackFace(request.family, key);
|
|
113799
|
+
const fontSet = this.#fontSet;
|
|
113800
|
+
if (!fontSet) {
|
|
113801
|
+
this.#faceStatus.set(key, "fallback_used");
|
|
113802
|
+
return {
|
|
113803
|
+
request,
|
|
113804
|
+
status: "fallback_used"
|
|
113805
|
+
};
|
|
113806
|
+
}
|
|
113807
|
+
this.#faceStatus.set(key, "loading");
|
|
113808
|
+
const probe = faceProbe(request.family, request.weight, request.style, this.#probeSize);
|
|
113809
|
+
const TIMEOUT = Symbol("timeout");
|
|
113810
|
+
let handle2;
|
|
113811
|
+
const timeout = new Promise((resolve) => {
|
|
113812
|
+
handle2 = this.#scheduleTimeout(() => resolve(TIMEOUT), timeoutMs);
|
|
113813
|
+
});
|
|
113814
|
+
try {
|
|
113815
|
+
const settled = await Promise.race([fontSet.load(probe), timeout]);
|
|
113816
|
+
if (settled === TIMEOUT) {
|
|
113817
|
+
this.#faceStatus.set(key, "timed_out");
|
|
113818
|
+
return {
|
|
113819
|
+
request,
|
|
113820
|
+
status: "timed_out"
|
|
113821
|
+
};
|
|
113822
|
+
}
|
|
113823
|
+
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
113824
|
+
this.#faceStatus.set(key, status);
|
|
113825
|
+
return {
|
|
113826
|
+
request,
|
|
113827
|
+
status
|
|
113828
|
+
};
|
|
113829
|
+
} catch {
|
|
113830
|
+
this.#faceStatus.set(key, "failed");
|
|
113831
|
+
this.#warnFaceFailureOnce(request, key);
|
|
113832
|
+
return {
|
|
113833
|
+
request,
|
|
113834
|
+
status: "failed"
|
|
113835
|
+
};
|
|
113836
|
+
} finally {
|
|
113837
|
+
this.#cancelTimeout(handle2);
|
|
113838
|
+
}
|
|
113839
|
+
}
|
|
113840
|
+
#warnFaceFailureOnce(request, key) {
|
|
113841
|
+
if (this.#warnedFaceFailures.has(key))
|
|
113842
|
+
return;
|
|
113843
|
+
this.#warnedFaceFailures.add(key);
|
|
113844
|
+
const src = this.#faceSources.get(key);
|
|
113845
|
+
const detail = src ? ` from ${src}` : "";
|
|
113846
|
+
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.`);
|
|
113847
|
+
}
|
|
113848
|
+
async#loadOne(family$1, timeoutMs) {
|
|
113849
|
+
const fontSet = this.#fontSet;
|
|
113850
|
+
if (!fontSet) {
|
|
113851
|
+
this.#status.set(family$1, "fallback_used");
|
|
113852
|
+
return {
|
|
113853
|
+
family: family$1,
|
|
113854
|
+
status: "fallback_used"
|
|
113855
|
+
};
|
|
113856
|
+
}
|
|
113857
|
+
this.#status.set(family$1, "loading");
|
|
113858
|
+
const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
|
|
113859
|
+
const TIMEOUT = Symbol("timeout");
|
|
113860
|
+
let handle2;
|
|
113861
|
+
const timeout = new Promise((resolve) => {
|
|
113862
|
+
handle2 = this.#scheduleTimeout(() => resolve(TIMEOUT), timeoutMs);
|
|
113863
|
+
});
|
|
113864
|
+
try {
|
|
113865
|
+
const settled = await Promise.race([fontSet.load(probe), timeout]);
|
|
113866
|
+
if (settled === TIMEOUT) {
|
|
113867
|
+
this.#status.set(family$1, "timed_out");
|
|
113868
|
+
return {
|
|
113869
|
+
family: family$1,
|
|
113870
|
+
status: "timed_out"
|
|
113871
|
+
};
|
|
113872
|
+
}
|
|
113873
|
+
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
113874
|
+
this.#status.set(family$1, status);
|
|
113875
|
+
return {
|
|
113876
|
+
family: family$1,
|
|
113877
|
+
status
|
|
113878
|
+
};
|
|
113879
|
+
} catch {
|
|
113880
|
+
this.#status.set(family$1, "failed");
|
|
113881
|
+
this.#warnLoadFailureOnce(family$1);
|
|
113882
|
+
return {
|
|
113883
|
+
family: family$1,
|
|
113884
|
+
status: "failed"
|
|
113885
|
+
};
|
|
113886
|
+
} finally {
|
|
113887
|
+
this.#cancelTimeout(handle2);
|
|
113888
|
+
}
|
|
113889
|
+
}
|
|
113890
|
+
#warnLoadFailureOnce(family$1) {
|
|
113891
|
+
if (this.#warnedFailures.has(family$1))
|
|
113892
|
+
return;
|
|
113893
|
+
this.#warnedFailures.add(family$1);
|
|
113894
|
+
const sources = this.#sources.get(family$1);
|
|
113895
|
+
const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
|
|
113896
|
+
console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
113897
|
+
}
|
|
113898
|
+
}, registriesByFontSet, domlessRegistry = null, PHYSICAL_GENERIC, BUNDLED_FAMILIES, FONT_OFFERINGS, DEFAULT_FONT_ORDER, prepareCommentParaIds = (comment) => {
|
|
113060
113899
|
return {
|
|
113061
113900
|
...comment,
|
|
113062
113901
|
commentParaId: generateDocxRandomId()
|
|
@@ -117032,7 +117871,7 @@ var isRegExp = (value) => {
|
|
|
117032
117871
|
state.kern = kernNode.attributes["w:val"];
|
|
117033
117872
|
}
|
|
117034
117873
|
}, SuperConverter;
|
|
117035
|
-
var
|
|
117874
|
+
var init_SuperConverter_BVWG4qnQ_es = __esm(() => {
|
|
117036
117875
|
init_rolldown_runtime_Bg48TavK_es();
|
|
117037
117876
|
init_jszip_C49i9kUs_es();
|
|
117038
117877
|
init_xml_js_CqGKpaft_es();
|
|
@@ -154351,6 +155190,246 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
154351
155190
|
gutter: "0"
|
|
154352
155191
|
})
|
|
154353
155192
|
});
|
|
155193
|
+
SETTLED_STATUSES = [
|
|
155194
|
+
"loaded",
|
|
155195
|
+
"failed",
|
|
155196
|
+
"timed_out",
|
|
155197
|
+
"fallback_used"
|
|
155198
|
+
];
|
|
155199
|
+
SUBSTITUTION_EVIDENCE = Object.freeze([
|
|
155200
|
+
{
|
|
155201
|
+
evidenceId: "calibri",
|
|
155202
|
+
logicalFamily: "Calibri",
|
|
155203
|
+
physicalFamily: "Carlito",
|
|
155204
|
+
verdict: "metric_safe",
|
|
155205
|
+
faces: {
|
|
155206
|
+
regular: true,
|
|
155207
|
+
bold: true,
|
|
155208
|
+
italic: true,
|
|
155209
|
+
boldItalic: true
|
|
155210
|
+
},
|
|
155211
|
+
advance: {
|
|
155212
|
+
meanDelta: 0,
|
|
155213
|
+
maxDelta: 0
|
|
155214
|
+
},
|
|
155215
|
+
gates: {
|
|
155216
|
+
static: "pass",
|
|
155217
|
+
metric: "pass",
|
|
155218
|
+
layout: "pass",
|
|
155219
|
+
ship: "pass"
|
|
155220
|
+
},
|
|
155221
|
+
policyAction: "substitute",
|
|
155222
|
+
measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
|
|
155223
|
+
candidateLicense: "OFL-1.1",
|
|
155224
|
+
exportRule: "preserve_original_name"
|
|
155225
|
+
},
|
|
155226
|
+
{
|
|
155227
|
+
evidenceId: "cambria",
|
|
155228
|
+
logicalFamily: "Cambria",
|
|
155229
|
+
physicalFamily: "Caladea",
|
|
155230
|
+
verdict: "visual_only",
|
|
155231
|
+
faceVerdicts: {
|
|
155232
|
+
regular: "metric_safe",
|
|
155233
|
+
bold: "metric_safe",
|
|
155234
|
+
italic: "metric_safe",
|
|
155235
|
+
boldItalic: "visual_only"
|
|
155236
|
+
},
|
|
155237
|
+
glyphExceptions: [{
|
|
155238
|
+
slot: "boldItalic",
|
|
155239
|
+
codepoint: 96,
|
|
155240
|
+
advanceDelta: 0.231,
|
|
155241
|
+
note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
|
|
155242
|
+
}],
|
|
155243
|
+
faces: {
|
|
155244
|
+
regular: true,
|
|
155245
|
+
bold: true,
|
|
155246
|
+
italic: true,
|
|
155247
|
+
boldItalic: true
|
|
155248
|
+
},
|
|
155249
|
+
advance: {
|
|
155250
|
+
meanDelta: 0.0002378,
|
|
155251
|
+
maxDelta: 0.2310758
|
|
155252
|
+
},
|
|
155253
|
+
gates: {
|
|
155254
|
+
static: "pass",
|
|
155255
|
+
metric: "pass",
|
|
155256
|
+
layout: "not_run",
|
|
155257
|
+
ship: "pass"
|
|
155258
|
+
},
|
|
155259
|
+
policyAction: "substitute",
|
|
155260
|
+
measurementRefs: [
|
|
155261
|
+
"cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
|
|
155262
|
+
"cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
|
|
155263
|
+
"cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
|
|
155264
|
+
"cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
|
|
155265
|
+
],
|
|
155266
|
+
candidateLicense: "Apache-2.0",
|
|
155267
|
+
exportRule: "preserve_original_name"
|
|
155268
|
+
},
|
|
155269
|
+
{
|
|
155270
|
+
evidenceId: "arial",
|
|
155271
|
+
logicalFamily: "Arial",
|
|
155272
|
+
physicalFamily: "Liberation Sans",
|
|
155273
|
+
verdict: "metric_safe",
|
|
155274
|
+
faces: {
|
|
155275
|
+
regular: true,
|
|
155276
|
+
bold: true,
|
|
155277
|
+
italic: true,
|
|
155278
|
+
boldItalic: true
|
|
155279
|
+
},
|
|
155280
|
+
advance: {
|
|
155281
|
+
meanDelta: 0,
|
|
155282
|
+
maxDelta: 0
|
|
155283
|
+
},
|
|
155284
|
+
gates: {
|
|
155285
|
+
static: "pass",
|
|
155286
|
+
metric: "pass",
|
|
155287
|
+
layout: "not_run",
|
|
155288
|
+
ship: "pass"
|
|
155289
|
+
},
|
|
155290
|
+
policyAction: "substitute",
|
|
155291
|
+
measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
|
|
155292
|
+
candidateLicense: "OFL-1.1",
|
|
155293
|
+
exportRule: "preserve_original_name"
|
|
155294
|
+
},
|
|
155295
|
+
{
|
|
155296
|
+
evidenceId: "times-new-roman",
|
|
155297
|
+
logicalFamily: "Times New Roman",
|
|
155298
|
+
physicalFamily: "Liberation Serif",
|
|
155299
|
+
verdict: "metric_safe",
|
|
155300
|
+
faces: {
|
|
155301
|
+
regular: true,
|
|
155302
|
+
bold: true,
|
|
155303
|
+
italic: true,
|
|
155304
|
+
boldItalic: true
|
|
155305
|
+
},
|
|
155306
|
+
advance: {
|
|
155307
|
+
meanDelta: 0,
|
|
155308
|
+
maxDelta: 0
|
|
155309
|
+
},
|
|
155310
|
+
gates: {
|
|
155311
|
+
static: "pass",
|
|
155312
|
+
metric: "pass",
|
|
155313
|
+
layout: "not_run",
|
|
155314
|
+
ship: "pass"
|
|
155315
|
+
},
|
|
155316
|
+
policyAction: "substitute",
|
|
155317
|
+
measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
|
|
155318
|
+
candidateLicense: "OFL-1.1",
|
|
155319
|
+
exportRule: "preserve_original_name"
|
|
155320
|
+
},
|
|
155321
|
+
{
|
|
155322
|
+
evidenceId: "courier-new",
|
|
155323
|
+
logicalFamily: "Courier New",
|
|
155324
|
+
physicalFamily: "Liberation Mono",
|
|
155325
|
+
verdict: "metric_safe",
|
|
155326
|
+
faces: {
|
|
155327
|
+
regular: true,
|
|
155328
|
+
bold: true,
|
|
155329
|
+
italic: true,
|
|
155330
|
+
boldItalic: true
|
|
155331
|
+
},
|
|
155332
|
+
advance: {
|
|
155333
|
+
meanDelta: 0,
|
|
155334
|
+
maxDelta: 0
|
|
155335
|
+
},
|
|
155336
|
+
gates: {
|
|
155337
|
+
static: "pass",
|
|
155338
|
+
metric: "pass",
|
|
155339
|
+
layout: "not_run",
|
|
155340
|
+
ship: "pass"
|
|
155341
|
+
},
|
|
155342
|
+
policyAction: "substitute",
|
|
155343
|
+
measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
|
|
155344
|
+
candidateLicense: "OFL-1.1",
|
|
155345
|
+
exportRule: "preserve_original_name"
|
|
155346
|
+
},
|
|
155347
|
+
{
|
|
155348
|
+
evidenceId: "helvetica",
|
|
155349
|
+
logicalFamily: "Helvetica",
|
|
155350
|
+
physicalFamily: "Liberation Sans",
|
|
155351
|
+
verdict: "metric_safe",
|
|
155352
|
+
faces: {
|
|
155353
|
+
regular: true,
|
|
155354
|
+
bold: true,
|
|
155355
|
+
italic: true,
|
|
155356
|
+
boldItalic: true
|
|
155357
|
+
},
|
|
155358
|
+
advance: {
|
|
155359
|
+
meanDelta: 0,
|
|
155360
|
+
maxDelta: 0
|
|
155361
|
+
},
|
|
155362
|
+
gates: {
|
|
155363
|
+
static: "not_run",
|
|
155364
|
+
metric: "pass",
|
|
155365
|
+
layout: "not_run",
|
|
155366
|
+
ship: "fail"
|
|
155367
|
+
},
|
|
155368
|
+
policyAction: "substitute",
|
|
155369
|
+
measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
|
|
155370
|
+
candidateLicense: "OFL-1.1",
|
|
155371
|
+
exportRule: "preserve_original_name"
|
|
155372
|
+
},
|
|
155373
|
+
{
|
|
155374
|
+
evidenceId: "calibri-light",
|
|
155375
|
+
logicalFamily: "Calibri Light",
|
|
155376
|
+
physicalFamily: "Carlito",
|
|
155377
|
+
verdict: "visual_only",
|
|
155378
|
+
faces: {
|
|
155379
|
+
regular: false,
|
|
155380
|
+
bold: false,
|
|
155381
|
+
italic: false,
|
|
155382
|
+
boldItalic: false
|
|
155383
|
+
},
|
|
155384
|
+
advance: {
|
|
155385
|
+
meanDelta: 0.0148,
|
|
155386
|
+
maxDelta: 0.066
|
|
155387
|
+
},
|
|
155388
|
+
gates: {
|
|
155389
|
+
static: "not_run",
|
|
155390
|
+
metric: "fail",
|
|
155391
|
+
layout: "not_run",
|
|
155392
|
+
ship: "fail"
|
|
155393
|
+
},
|
|
155394
|
+
policyAction: "category_fallback",
|
|
155395
|
+
measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
|
|
155396
|
+
candidateLicense: "OFL-1.1",
|
|
155397
|
+
exportRule: "preserve_original_name"
|
|
155398
|
+
}
|
|
155399
|
+
]);
|
|
155400
|
+
BUNDLED_SUBSTITUTES = deriveBundledSubstitutes();
|
|
155401
|
+
CATEGORY_FALLBACKS = deriveCategoryFallbacks();
|
|
155402
|
+
defaultResolver = new FontResolver;
|
|
155403
|
+
DEFAULT_FONT_MEASURE_CONTEXT = Object.freeze({
|
|
155404
|
+
resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily(cssFontFamily),
|
|
155405
|
+
fontSignature: ""
|
|
155406
|
+
});
|
|
155407
|
+
BUNDLED_MANIFEST = Object.freeze([
|
|
155408
|
+
family("Carlito", "Carlito", "OFL-1.1"),
|
|
155409
|
+
family("Caladea", "Caladea", "Apache-2.0"),
|
|
155410
|
+
family("Liberation Sans", "LiberationSans", "OFL-1.1"),
|
|
155411
|
+
family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
|
|
155412
|
+
family("Liberation Mono", "LiberationMono", "OFL-1.1")
|
|
155413
|
+
]);
|
|
155414
|
+
installedRegistries = /* @__PURE__ */ new WeakMap;
|
|
155415
|
+
OS2_MIN_LENGTH = OS2_FSSELECTION + 2;
|
|
155416
|
+
registriesByFontSet = /* @__PURE__ */ new WeakMap;
|
|
155417
|
+
PHYSICAL_GENERIC = Object.freeze({
|
|
155418
|
+
Carlito: "sans-serif",
|
|
155419
|
+
Caladea: "serif",
|
|
155420
|
+
"Liberation Sans": "sans-serif",
|
|
155421
|
+
"Liberation Serif": "serif",
|
|
155422
|
+
"Liberation Mono": "monospace"
|
|
155423
|
+
});
|
|
155424
|
+
BUNDLED_FAMILIES = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
|
|
155425
|
+
FONT_OFFERINGS = deriveOfferings();
|
|
155426
|
+
DEFAULT_FONT_ORDER = [
|
|
155427
|
+
"Calibri",
|
|
155428
|
+
"Arial",
|
|
155429
|
+
"Courier New",
|
|
155430
|
+
"Times New Roman",
|
|
155431
|
+
"Helvetica"
|
|
155432
|
+
];
|
|
154354
155433
|
ALL_COMMENT_TARGETS = COMMENT_FILE_BASENAMES;
|
|
154355
155434
|
REL_ID_NUMERIC_PATTERN = /rId|mi/g;
|
|
154356
155435
|
FOOTNOTES_CONFIG$1 = {
|
|
@@ -155167,10 +156246,10 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
155167
156246
|
return fontsNode.elements.find((el) => el?.attributes?.["w:name"] === fontName) || null;
|
|
155168
156247
|
}
|
|
155169
156248
|
static getFallbackFromFontTable(docx, fontName) {
|
|
155170
|
-
const family = SuperConverter2.getFontTableEntry(docx, fontName)?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
|
|
155171
|
-
if (!family)
|
|
156249
|
+
const family$1 = SuperConverter2.getFontTableEntry(docx, fontName)?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
|
|
156250
|
+
if (!family$1)
|
|
155172
156251
|
return null;
|
|
155173
|
-
return FONT_FAMILY_FALLBACKS[family.toLowerCase()] || DEFAULT_GENERIC_FALLBACK;
|
|
156252
|
+
return FONT_FAMILY_FALLBACKS[family$1.toLowerCase()] || DEFAULT_GENERIC_FALLBACK;
|
|
155174
156253
|
}
|
|
155175
156254
|
static toCssFontFamily(fontName, docx) {
|
|
155176
156255
|
if (!fontName)
|
|
@@ -155600,13 +156679,16 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
155600
156679
|
for (const font of fontsToInclude) {
|
|
155601
156680
|
const filePath = elements.find((el) => el.attributes.Id === font.attributes["r:id"])?.attributes?.Target;
|
|
155602
156681
|
if (!filePath)
|
|
155603
|
-
|
|
155604
|
-
const
|
|
155605
|
-
if (!
|
|
155606
|
-
|
|
155607
|
-
const ttfBuffer = deobfuscateFont(
|
|
156682
|
+
continue;
|
|
156683
|
+
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
156684
|
+
if (!fontUint8Array?.buffer)
|
|
156685
|
+
continue;
|
|
156686
|
+
const ttfBuffer = deobfuscateFont(fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength), font.attributes["w:fontKey"]);
|
|
155608
156687
|
if (!ttfBuffer)
|
|
155609
|
-
|
|
156688
|
+
continue;
|
|
156689
|
+
const policy = parseEmbeddingPolicy(ttfBuffer);
|
|
156690
|
+
if (!(policy ? policy.embeddable : false))
|
|
156691
|
+
continue;
|
|
155610
156692
|
const blob = new Blob([ttfBuffer], { type: "font/ttf" });
|
|
155611
156693
|
const fontUrl = URL.createObjectURL(blob);
|
|
155612
156694
|
const isNormal = font.name.includes("Regular");
|
|
@@ -155631,6 +156713,48 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
155631
156713
|
fontsImported
|
|
155632
156714
|
};
|
|
155633
156715
|
}
|
|
156716
|
+
getEmbeddedFontFaces() {
|
|
156717
|
+
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
156718
|
+
if (!fontTable || !Object.keys(this.fonts).length)
|
|
156719
|
+
return [];
|
|
156720
|
+
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) => ({
|
|
156721
|
+
embed: el,
|
|
156722
|
+
family: entry.attributes?.["w:name"]
|
|
156723
|
+
})));
|
|
156724
|
+
const relElements = this.convertedXml["word/_rels/fontTable.xml.rels"]?.elements?.find((el) => el.name === "Relationships")?.elements ?? [];
|
|
156725
|
+
const faceFromEmbedName = (name = "") => ({
|
|
156726
|
+
weight: /bold/i.test(name) ? "700" : "400",
|
|
156727
|
+
style: /italic/i.test(name) ? "italic" : "normal"
|
|
156728
|
+
});
|
|
156729
|
+
const faces = [];
|
|
156730
|
+
for (const { embed, family: family$1 } of embedElements) {
|
|
156731
|
+
const relationshipId = embed.attributes?.["r:id"];
|
|
156732
|
+
const fontKey = embed.attributes?.["w:fontKey"];
|
|
156733
|
+
if (!family$1 || !relationshipId || !fontKey)
|
|
156734
|
+
continue;
|
|
156735
|
+
const filePath = relElements.find((el) => el.attributes?.Id === relationshipId)?.attributes?.Target;
|
|
156736
|
+
if (!filePath)
|
|
156737
|
+
continue;
|
|
156738
|
+
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
156739
|
+
if (!fontUint8Array?.buffer)
|
|
156740
|
+
continue;
|
|
156741
|
+
const ttf = deobfuscateFont(fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength), fontKey);
|
|
156742
|
+
if (!ttf)
|
|
156743
|
+
continue;
|
|
156744
|
+
const policy = parseEmbeddingPolicy(ttf);
|
|
156745
|
+
const fallback = faceFromEmbedName(embed.name);
|
|
156746
|
+
faces.push({
|
|
156747
|
+
family: family$1,
|
|
156748
|
+
source: ttf,
|
|
156749
|
+
weight: policy?.face.weight ?? fallback.weight,
|
|
156750
|
+
style: policy?.face.style ?? fallback.style,
|
|
156751
|
+
fsType: policy?.fsType ?? null,
|
|
156752
|
+
embeddable: policy ? policy.embeddable : false,
|
|
156753
|
+
relationshipId
|
|
156754
|
+
});
|
|
156755
|
+
}
|
|
156756
|
+
return faces;
|
|
156757
|
+
}
|
|
155634
156758
|
getDocumentInternalId() {
|
|
155635
156759
|
const settingsLocation = "word/settings.xml";
|
|
155636
156760
|
if (!this.convertedXml[settingsLocation])
|
|
@@ -156092,7 +157216,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
156092
157216
|
};
|
|
156093
157217
|
});
|
|
156094
157218
|
|
|
156095
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
157219
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-JvWvpCga.es.js
|
|
156096
157220
|
function parseSizeUnit(val = "0") {
|
|
156097
157221
|
const length = val.toString() || "0";
|
|
156098
157222
|
const value = Number.parseFloat(length);
|
|
@@ -166425,8 +167549,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
|
|
|
166425
167549
|
}
|
|
166426
167550
|
};
|
|
166427
167551
|
};
|
|
166428
|
-
var
|
|
166429
|
-
|
|
167552
|
+
var init_create_headless_toolbar_JvWvpCga_es = __esm(() => {
|
|
167553
|
+
init_SuperConverter_BVWG4qnQ_es();
|
|
166430
167554
|
init_uuid_qzgm05fK_es();
|
|
166431
167555
|
init_constants_D9qj59G2_es();
|
|
166432
167556
|
init_dist_B8HfvhaK_es();
|
|
@@ -169073,1231 +170197,6 @@ var __plugin_vue_export_helper_default = (sfc, props) => {
|
|
|
169073
170197
|
};
|
|
169074
170198
|
var init__plugin_vue_export_helper_5t5P5NuM_es = () => {};
|
|
169075
170199
|
|
|
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
170200
|
// ../../packages/superdoc/dist/chunks/eventemitter3-BnGqBE-Q.es.js
|
|
170302
170201
|
var import_eventemitter3;
|
|
170303
170202
|
var init_eventemitter3_BnGqBE_Q_es = __esm(() => {
|
|
@@ -222335,7 +222234,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
222335
222234
|
init_remark_gfm_BhnWr3yf_es();
|
|
222336
222235
|
});
|
|
222337
222236
|
|
|
222338
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
222237
|
+
// ../../packages/superdoc/dist/chunks/src-x_i3LADL.es.js
|
|
222339
222238
|
function deleteProps(obj, propOrProps) {
|
|
222340
222239
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
222341
222240
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -281594,6 +281493,13 @@ function defaultInvalidate() {
|
|
|
281594
281493
|
function toCssFontSource(url2) {
|
|
281595
281494
|
return /^\s*url\(/i.test(url2) ? url2 : `url(${JSON.stringify(url2)})`;
|
|
281596
281495
|
}
|
|
281496
|
+
function nextEmbeddedNamespace() {
|
|
281497
|
+
embeddedDocumentCounter += 1;
|
|
281498
|
+
return `__superdoc_embedded_${embeddedDocumentCounter}__`;
|
|
281499
|
+
}
|
|
281500
|
+
function sanitizeFamilyToken(family2) {
|
|
281501
|
+
return family2.replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "font";
|
|
281502
|
+
}
|
|
281597
281503
|
function defaultScheduleMicrotask(callback) {
|
|
281598
281504
|
if (typeof queueMicrotask === "function") {
|
|
281599
281505
|
queueMicrotask(callback);
|
|
@@ -281623,7 +281529,7 @@ function makeResolveFace(resolver2, hasFace) {
|
|
|
281623
281529
|
};
|
|
281624
281530
|
};
|
|
281625
281531
|
return (logical) => {
|
|
281626
|
-
const r$1 =
|
|
281532
|
+
const r$1 = resolveFontFamily(logical);
|
|
281627
281533
|
return {
|
|
281628
281534
|
physicalFamily: r$1.physicalFamily,
|
|
281629
281535
|
reason: r$1.reason
|
|
@@ -319168,7 +319074,7 @@ menclose::after {
|
|
|
319168
319074
|
#flushLateFontLoads() {
|
|
319169
319075
|
this.#requestReflow();
|
|
319170
319076
|
}
|
|
319171
|
-
}, FACE_STATUS_PRIORITY, DocumentFontController = class {
|
|
319077
|
+
}, FACE_STATUS_PRIORITY, embeddedDocumentCounter = 0, DocumentFontController = class {
|
|
319172
319078
|
#resolver;
|
|
319173
319079
|
#getGate;
|
|
319174
319080
|
#onDocumentFontConfigApplied;
|
|
@@ -319176,6 +319082,10 @@ menclose::after {
|
|
|
319176
319082
|
#runtimeReflowQueued = false;
|
|
319177
319083
|
#runtimeReflowToken = 0;
|
|
319178
319084
|
#runtimeAvailabilityChanged = false;
|
|
319085
|
+
#embeddedDisposers = [];
|
|
319086
|
+
#embeddedNamespace = nextEmbeddedNamespace();
|
|
319087
|
+
#embeddedPhysical = /* @__PURE__ */ new Map;
|
|
319088
|
+
#embeddedGeneration = 0;
|
|
319179
319089
|
constructor(deps) {
|
|
319180
319090
|
this.#resolver = deps.resolver;
|
|
319181
319091
|
this.#getGate = deps.getGate;
|
|
@@ -319194,10 +319104,12 @@ menclose::after {
|
|
|
319194
319104
|
}
|
|
319195
319105
|
reset() {
|
|
319196
319106
|
this.#cancelPendingRuntimeReflow();
|
|
319107
|
+
this.#releaseEmbeddedFaces();
|
|
319197
319108
|
this.#resolver.reset();
|
|
319198
319109
|
}
|
|
319199
319110
|
dispose() {
|
|
319200
319111
|
this.#cancelPendingRuntimeReflow();
|
|
319112
|
+
this.#releaseEmbeddedFaces();
|
|
319201
319113
|
}
|
|
319202
319114
|
applyInitialConfig(config3) {
|
|
319203
319115
|
this.#cancelPendingRuntimeReflow();
|
|
@@ -319208,6 +319120,43 @@ menclose::after {
|
|
|
319208
319120
|
if (registered$1)
|
|
319209
319121
|
this.#getGate()?.invalidateCachesForConfigRegistration();
|
|
319210
319122
|
}
|
|
319123
|
+
applyEmbeddedFaces(faces) {
|
|
319124
|
+
this.#releaseEmbeddedFaces();
|
|
319125
|
+
if (!faces?.length)
|
|
319126
|
+
return;
|
|
319127
|
+
const registry3 = this.#getGate()?.resolveRegistry();
|
|
319128
|
+
if (!registry3)
|
|
319129
|
+
return;
|
|
319130
|
+
this.#embeddedGeneration += 1;
|
|
319131
|
+
let registered$1 = false;
|
|
319132
|
+
for (const face of faces) {
|
|
319133
|
+
if (!face?.embeddable)
|
|
319134
|
+
continue;
|
|
319135
|
+
const physicalFamily = this.#physicalFamilyFor(face.family);
|
|
319136
|
+
const release = registry3.registerOwnedFace({
|
|
319137
|
+
family: physicalFamily,
|
|
319138
|
+
source: face.source,
|
|
319139
|
+
weight: face.weight,
|
|
319140
|
+
style: face.style
|
|
319141
|
+
});
|
|
319142
|
+
if (release) {
|
|
319143
|
+
this.#embeddedDisposers.push(release);
|
|
319144
|
+
this.#resolver.mapEmbedded(face.family, physicalFamily);
|
|
319145
|
+
registered$1 = true;
|
|
319146
|
+
}
|
|
319147
|
+
}
|
|
319148
|
+
if (registered$1)
|
|
319149
|
+
this.#getGate()?.invalidateCachesForConfigRegistration();
|
|
319150
|
+
}
|
|
319151
|
+
#physicalFamilyFor(logicalFamily) {
|
|
319152
|
+
const key2 = logicalFamily.trim().toLowerCase();
|
|
319153
|
+
let physical = this.#embeddedPhysical.get(key2);
|
|
319154
|
+
if (!physical) {
|
|
319155
|
+
physical = `${this.#embeddedNamespace}${this.#embeddedGeneration}_${this.#embeddedPhysical.size}_${sanitizeFamilyToken(logicalFamily)}`;
|
|
319156
|
+
this.#embeddedPhysical.set(key2, physical);
|
|
319157
|
+
}
|
|
319158
|
+
return physical;
|
|
319159
|
+
}
|
|
319211
319160
|
add(families) {
|
|
319212
319161
|
let committed = false;
|
|
319213
319162
|
try {
|
|
@@ -319305,6 +319254,13 @@ menclose::after {
|
|
|
319305
319254
|
this.#runtimeReflowQueued = false;
|
|
319306
319255
|
this.#runtimeReflowToken += 1;
|
|
319307
319256
|
}
|
|
319257
|
+
#releaseEmbeddedFaces() {
|
|
319258
|
+
for (const release of this.#embeddedDisposers)
|
|
319259
|
+
release();
|
|
319260
|
+
this.#embeddedDisposers.length = 0;
|
|
319261
|
+
this.#embeddedPhysical.clear();
|
|
319262
|
+
this.#resolver.clearEmbedded();
|
|
319263
|
+
}
|
|
319308
319264
|
}, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, NATIVE_SELECTION_STYLES = `
|
|
319309
319265
|
/* Hide native browser selection on layout engine content.
|
|
319310
319266
|
* We render our own selection overlay via PresentationEditor's #localSelectionLayer
|
|
@@ -319382,13 +319338,13 @@ menclose::after {
|
|
|
319382
319338
|
return;
|
|
319383
319339
|
console.log(...args$1);
|
|
319384
319340
|
}, 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
|
|
319341
|
+
var init_src_x_i3LADL_es = __esm(() => {
|
|
319386
319342
|
init_rolldown_runtime_Bg48TavK_es();
|
|
319387
|
-
|
|
319343
|
+
init_SuperConverter_BVWG4qnQ_es();
|
|
319388
319344
|
init_jszip_C49i9kUs_es();
|
|
319389
319345
|
init_xml_js_CqGKpaft_es();
|
|
319390
319346
|
init_uuid_qzgm05fK_es();
|
|
319391
|
-
|
|
319347
|
+
init_create_headless_toolbar_JvWvpCga_es();
|
|
319392
319348
|
init_constants_D9qj59G2_es();
|
|
319393
319349
|
init_dist_B8HfvhaK_es();
|
|
319394
319350
|
init_unified_Dsuw2be5_es();
|
|
@@ -319396,7 +319352,6 @@ var init_src_BjtupAUl_es = __esm(() => {
|
|
|
319396
319352
|
init_remark_stringify_6MMJfY0k_es();
|
|
319397
319353
|
init_DocxZipper_Bu2Fhqkw_es();
|
|
319398
319354
|
init__plugin_vue_export_helper_5t5P5NuM_es();
|
|
319399
|
-
init_create_super_doc_ui_tVaowTvG_es();
|
|
319400
319355
|
init_eventemitter3_BnGqBE_Q_es();
|
|
319401
319356
|
init_errors_CNaD6vcg_es();
|
|
319402
319357
|
init_blank_docx_1Y_uWgjm_es();
|
|
@@ -347948,6 +347903,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
347948
347903
|
}
|
|
347949
347904
|
});
|
|
347950
347905
|
this.#fontController.applyInitialConfig(this.#options.fontAssets);
|
|
347906
|
+
this.#applyEmbeddedDocumentFonts();
|
|
347951
347907
|
if (typeof this.#options.disableContextMenu === "boolean")
|
|
347952
347908
|
this.setContextMenuDisabled(this.#options.disableContextMenu);
|
|
347953
347909
|
this.#setupHeaderFooterSession();
|
|
@@ -348953,6 +348909,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
348953
348909
|
async preloadFonts(families) {
|
|
348954
348910
|
await this.#fontController.preload(families);
|
|
348955
348911
|
}
|
|
348912
|
+
#applyEmbeddedDocumentFonts() {
|
|
348913
|
+
const converter = this.#editor.converter;
|
|
348914
|
+
this.#fontController.applyEmbeddedFaces(converter?.getEmbeddedFontFaces?.());
|
|
348915
|
+
}
|
|
348956
348916
|
#requestFontReflow() {
|
|
348957
348917
|
this.#layoutState = {
|
|
348958
348918
|
...this.#layoutState,
|
|
@@ -350248,6 +350208,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
350248
350208
|
this.#fontController.reset();
|
|
350249
350209
|
this.#layoutFontSignature = "";
|
|
350250
350210
|
this.#fontController.applyInitialConfig(this.#options.fontAssets);
|
|
350211
|
+
this.#applyEmbeddedDocumentFonts();
|
|
350251
350212
|
this.#resetFontReportStateForDocumentChange();
|
|
350252
350213
|
this.#refreshHeaderFooterStructureThenRerender({ purgeCachedEditors: true });
|
|
350253
350214
|
};
|
|
@@ -354217,6 +354178,279 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
354217
354178
|
]);
|
|
354218
354179
|
});
|
|
354219
354180
|
|
|
354181
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-B66Edat2.es.js
|
|
354182
|
+
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;
|
|
354183
|
+
var init_create_super_doc_ui_B66Edat2_es = __esm(() => {
|
|
354184
|
+
init_SuperConverter_BVWG4qnQ_es();
|
|
354185
|
+
init_create_headless_toolbar_JvWvpCga_es();
|
|
354186
|
+
headlessToolbarConstants = {
|
|
354187
|
+
DEFAULT_TEXT_ALIGN_OPTIONS: [
|
|
354188
|
+
{
|
|
354189
|
+
label: "Left",
|
|
354190
|
+
value: "left"
|
|
354191
|
+
},
|
|
354192
|
+
{
|
|
354193
|
+
label: "Center",
|
|
354194
|
+
value: "center"
|
|
354195
|
+
},
|
|
354196
|
+
{
|
|
354197
|
+
label: "Right",
|
|
354198
|
+
value: "right"
|
|
354199
|
+
},
|
|
354200
|
+
{
|
|
354201
|
+
label: "Justify",
|
|
354202
|
+
value: "justify"
|
|
354203
|
+
}
|
|
354204
|
+
],
|
|
354205
|
+
DEFAULT_LINE_HEIGHT_OPTIONS: [
|
|
354206
|
+
{
|
|
354207
|
+
label: "1.00",
|
|
354208
|
+
value: 1
|
|
354209
|
+
},
|
|
354210
|
+
{
|
|
354211
|
+
label: "1.15",
|
|
354212
|
+
value: 1.15
|
|
354213
|
+
},
|
|
354214
|
+
{
|
|
354215
|
+
label: "1.50",
|
|
354216
|
+
value: 1.5
|
|
354217
|
+
},
|
|
354218
|
+
{
|
|
354219
|
+
label: "2.00",
|
|
354220
|
+
value: 2
|
|
354221
|
+
},
|
|
354222
|
+
{
|
|
354223
|
+
label: "2.50",
|
|
354224
|
+
value: 2.5
|
|
354225
|
+
},
|
|
354226
|
+
{
|
|
354227
|
+
label: "3.00",
|
|
354228
|
+
value: 3
|
|
354229
|
+
}
|
|
354230
|
+
],
|
|
354231
|
+
DEFAULT_ZOOM_OPTIONS: [
|
|
354232
|
+
{
|
|
354233
|
+
label: "50%",
|
|
354234
|
+
value: 50
|
|
354235
|
+
},
|
|
354236
|
+
{
|
|
354237
|
+
label: "75%",
|
|
354238
|
+
value: 75
|
|
354239
|
+
},
|
|
354240
|
+
{
|
|
354241
|
+
label: "90%",
|
|
354242
|
+
value: 90
|
|
354243
|
+
},
|
|
354244
|
+
{
|
|
354245
|
+
label: "100%",
|
|
354246
|
+
value: 100
|
|
354247
|
+
},
|
|
354248
|
+
{
|
|
354249
|
+
label: "125%",
|
|
354250
|
+
value: 125
|
|
354251
|
+
},
|
|
354252
|
+
{
|
|
354253
|
+
label: "150%",
|
|
354254
|
+
value: 150
|
|
354255
|
+
},
|
|
354256
|
+
{
|
|
354257
|
+
label: "200%",
|
|
354258
|
+
value: 200
|
|
354259
|
+
}
|
|
354260
|
+
],
|
|
354261
|
+
DEFAULT_DOCUMENT_MODE_OPTIONS: [
|
|
354262
|
+
{
|
|
354263
|
+
label: "Editing",
|
|
354264
|
+
value: "editing",
|
|
354265
|
+
description: "Edit document directly"
|
|
354266
|
+
},
|
|
354267
|
+
{
|
|
354268
|
+
label: "Suggesting",
|
|
354269
|
+
value: "suggesting",
|
|
354270
|
+
description: "Edits become suggestions"
|
|
354271
|
+
},
|
|
354272
|
+
{
|
|
354273
|
+
label: "Viewing",
|
|
354274
|
+
value: "viewing",
|
|
354275
|
+
description: "View clean version of document only"
|
|
354276
|
+
}
|
|
354277
|
+
],
|
|
354278
|
+
DEFAULT_FONT_SIZE_OPTIONS: [
|
|
354279
|
+
{
|
|
354280
|
+
label: "8",
|
|
354281
|
+
value: "8pt"
|
|
354282
|
+
},
|
|
354283
|
+
{
|
|
354284
|
+
label: "9",
|
|
354285
|
+
value: "9pt"
|
|
354286
|
+
},
|
|
354287
|
+
{
|
|
354288
|
+
label: "10",
|
|
354289
|
+
value: "10pt"
|
|
354290
|
+
},
|
|
354291
|
+
{
|
|
354292
|
+
label: "11",
|
|
354293
|
+
value: "11pt"
|
|
354294
|
+
},
|
|
354295
|
+
{
|
|
354296
|
+
label: "12",
|
|
354297
|
+
value: "12pt"
|
|
354298
|
+
},
|
|
354299
|
+
{
|
|
354300
|
+
label: "14",
|
|
354301
|
+
value: "14pt"
|
|
354302
|
+
},
|
|
354303
|
+
{
|
|
354304
|
+
label: "18",
|
|
354305
|
+
value: "18pt"
|
|
354306
|
+
},
|
|
354307
|
+
{
|
|
354308
|
+
label: "24",
|
|
354309
|
+
value: "24pt"
|
|
354310
|
+
},
|
|
354311
|
+
{
|
|
354312
|
+
label: "30",
|
|
354313
|
+
value: "30pt"
|
|
354314
|
+
},
|
|
354315
|
+
{
|
|
354316
|
+
label: "36",
|
|
354317
|
+
value: "36pt"
|
|
354318
|
+
},
|
|
354319
|
+
{
|
|
354320
|
+
label: "48",
|
|
354321
|
+
value: "48pt"
|
|
354322
|
+
},
|
|
354323
|
+
{
|
|
354324
|
+
label: "60",
|
|
354325
|
+
value: "60pt"
|
|
354326
|
+
},
|
|
354327
|
+
{
|
|
354328
|
+
label: "72",
|
|
354329
|
+
value: "72pt"
|
|
354330
|
+
},
|
|
354331
|
+
{
|
|
354332
|
+
label: "96",
|
|
354333
|
+
value: "96pt"
|
|
354334
|
+
}
|
|
354335
|
+
],
|
|
354336
|
+
DEFAULT_FONT_FAMILY_OPTIONS: getDefaultFontFamilyOptions(),
|
|
354337
|
+
DEFAULT_TEXT_COLOR_OPTIONS: [
|
|
354338
|
+
{
|
|
354339
|
+
label: "Black",
|
|
354340
|
+
value: "#000000"
|
|
354341
|
+
},
|
|
354342
|
+
{
|
|
354343
|
+
label: "Dark Gray",
|
|
354344
|
+
value: "#434343"
|
|
354345
|
+
},
|
|
354346
|
+
{
|
|
354347
|
+
label: "Gray",
|
|
354348
|
+
value: "#666666"
|
|
354349
|
+
},
|
|
354350
|
+
{
|
|
354351
|
+
label: "Light Gray",
|
|
354352
|
+
value: "#999999"
|
|
354353
|
+
},
|
|
354354
|
+
{
|
|
354355
|
+
label: "Red",
|
|
354356
|
+
value: "#ff0000"
|
|
354357
|
+
},
|
|
354358
|
+
{
|
|
354359
|
+
label: "Orange",
|
|
354360
|
+
value: "#ff9900"
|
|
354361
|
+
},
|
|
354362
|
+
{
|
|
354363
|
+
label: "Yellow",
|
|
354364
|
+
value: "#ffff00"
|
|
354365
|
+
},
|
|
354366
|
+
{
|
|
354367
|
+
label: "Green",
|
|
354368
|
+
value: "#00ff00"
|
|
354369
|
+
},
|
|
354370
|
+
{
|
|
354371
|
+
label: "Cyan",
|
|
354372
|
+
value: "#00ffff"
|
|
354373
|
+
},
|
|
354374
|
+
{
|
|
354375
|
+
label: "Blue",
|
|
354376
|
+
value: "#0000ff"
|
|
354377
|
+
},
|
|
354378
|
+
{
|
|
354379
|
+
label: "Purple",
|
|
354380
|
+
value: "#9900ff"
|
|
354381
|
+
},
|
|
354382
|
+
{
|
|
354383
|
+
label: "Magenta",
|
|
354384
|
+
value: "#ff00ff"
|
|
354385
|
+
},
|
|
354386
|
+
{
|
|
354387
|
+
label: "None",
|
|
354388
|
+
value: "none"
|
|
354389
|
+
}
|
|
354390
|
+
],
|
|
354391
|
+
DEFAULT_HIGHLIGHT_COLOR_OPTIONS: [
|
|
354392
|
+
{
|
|
354393
|
+
label: "Yellow",
|
|
354394
|
+
value: "#ffff00"
|
|
354395
|
+
},
|
|
354396
|
+
{
|
|
354397
|
+
label: "Green",
|
|
354398
|
+
value: "#00ff00"
|
|
354399
|
+
},
|
|
354400
|
+
{
|
|
354401
|
+
label: "Cyan",
|
|
354402
|
+
value: "#00ffff"
|
|
354403
|
+
},
|
|
354404
|
+
{
|
|
354405
|
+
label: "Pink",
|
|
354406
|
+
value: "#ff00ff"
|
|
354407
|
+
},
|
|
354408
|
+
{
|
|
354409
|
+
label: "Blue",
|
|
354410
|
+
value: "#0000ff"
|
|
354411
|
+
},
|
|
354412
|
+
{
|
|
354413
|
+
label: "Red",
|
|
354414
|
+
value: "#ff0000"
|
|
354415
|
+
},
|
|
354416
|
+
{
|
|
354417
|
+
label: "Orange",
|
|
354418
|
+
value: "#ff9900"
|
|
354419
|
+
},
|
|
354420
|
+
{
|
|
354421
|
+
label: "None",
|
|
354422
|
+
value: "none"
|
|
354423
|
+
}
|
|
354424
|
+
]
|
|
354425
|
+
};
|
|
354426
|
+
MOD_ALIASES = new Set([
|
|
354427
|
+
"Mod",
|
|
354428
|
+
"Meta",
|
|
354429
|
+
"Cmd",
|
|
354430
|
+
"Command"
|
|
354431
|
+
]);
|
|
354432
|
+
ALT_ALIASES = new Set(["Alt", "Option"]);
|
|
354433
|
+
CTRL_ALIASES = new Set(["Control", "Ctrl"]);
|
|
354434
|
+
SHIFT_ALIASES = new Set(["Shift"]);
|
|
354435
|
+
BUILTIN_CONTEXT_MENU_GROUPS = [
|
|
354436
|
+
"format",
|
|
354437
|
+
"clipboard",
|
|
354438
|
+
"review",
|
|
354439
|
+
"comment",
|
|
354440
|
+
"link"
|
|
354441
|
+
];
|
|
354442
|
+
BUILTIN_GROUP_ORDER = new Map(BUILTIN_CONTEXT_MENU_GROUPS.map((g2, i4) => [g2, i4]));
|
|
354443
|
+
RESERVED_PROXY_PROPERTY_NAMES = new Set([
|
|
354444
|
+
"register",
|
|
354445
|
+
"get",
|
|
354446
|
+
"has",
|
|
354447
|
+
"require",
|
|
354448
|
+
"getContextMenuItems"
|
|
354449
|
+
]);
|
|
354450
|
+
ALL_TOOLBAR_COMMAND_IDS = Object.keys(createToolbarRegistry());
|
|
354451
|
+
EMPTY_ACTIVE_IDS = Object.freeze([]);
|
|
354452
|
+
});
|
|
354453
|
+
|
|
354220
354454
|
// ../../packages/superdoc/dist/chunks/ui-C5PAS9hY.es.js
|
|
354221
354455
|
var init_ui_C5PAS9hY_es = () => {};
|
|
354222
354456
|
|
|
@@ -354230,16 +354464,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
354230
354464
|
|
|
354231
354465
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
354232
354466
|
var init_super_editor_es = __esm(() => {
|
|
354233
|
-
|
|
354234
|
-
|
|
354467
|
+
init_src_x_i3LADL_es();
|
|
354468
|
+
init_SuperConverter_BVWG4qnQ_es();
|
|
354235
354469
|
init_jszip_C49i9kUs_es();
|
|
354236
354470
|
init_xml_js_CqGKpaft_es();
|
|
354237
|
-
|
|
354471
|
+
init_create_headless_toolbar_JvWvpCga_es();
|
|
354238
354472
|
init_constants_D9qj59G2_es();
|
|
354239
354473
|
init_dist_B8HfvhaK_es();
|
|
354240
354474
|
init_unified_Dsuw2be5_es();
|
|
354241
354475
|
init_DocxZipper_Bu2Fhqkw_es();
|
|
354242
|
-
|
|
354476
|
+
init_create_super_doc_ui_B66Edat2_es();
|
|
354243
354477
|
init_ui_C5PAS9hY_es();
|
|
354244
354478
|
init_eventemitter3_BnGqBE_Q_es();
|
|
354245
354479
|
init_errors_CNaD6vcg_es();
|
|
@@ -422918,7 +423152,7 @@ var init_east_asian_regex = __esm(() => {
|
|
|
422918
423152
|
});
|
|
422919
423153
|
|
|
422920
423154
|
// ../../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),
|
|
423155
|
+
var containsEastAsianCharacters2 = (text7) => EAST_ASIAN_CHARACTER_REGEX2.test(text7), resolveFontFamily2 = (textStyleAttrs, text7) => {
|
|
422922
423156
|
if (!text7)
|
|
422923
423157
|
return textStyleAttrs;
|
|
422924
423158
|
const eastAsiaFont = textStyleAttrs?.eastAsiaFontFamily;
|
|
@@ -424569,7 +424803,7 @@ var XML_NODE_NAME13 = "w:r", SD_KEY_NAME2 = "run", REFERENCE_RUN_STYLE_BY_XML_NA
|
|
|
424569
424803
|
if (seenTypes.has(mark2.type)) {
|
|
424570
424804
|
if (mark2.type === "textStyle") {
|
|
424571
424805
|
textStyleMark.attrs = { ...textStyleMark.attrs || {}, ...mark2.attrs || {} };
|
|
424572
|
-
textStyleMark.attrs =
|
|
424806
|
+
textStyleMark.attrs = resolveFontFamily2(textStyleMark.attrs, child?.text);
|
|
424573
424807
|
}
|
|
424574
424808
|
return false;
|
|
424575
424809
|
}
|
|
@@ -455710,6 +455944,788 @@ var init_exporter = __esm(() => {
|
|
|
455710
455944
|
});
|
|
455711
455945
|
});
|
|
455712
455946
|
|
|
455947
|
+
// ../../shared/font-system/src/types.ts
|
|
455948
|
+
var init_types8 = () => {};
|
|
455949
|
+
|
|
455950
|
+
// ../../shared/font-system/src/substitution-evidence.ts
|
|
455951
|
+
var SUBSTITUTION_EVIDENCE2;
|
|
455952
|
+
var init_substitution_evidence = __esm(() => {
|
|
455953
|
+
SUBSTITUTION_EVIDENCE2 = Object.freeze([
|
|
455954
|
+
{
|
|
455955
|
+
evidenceId: "calibri",
|
|
455956
|
+
logicalFamily: "Calibri",
|
|
455957
|
+
physicalFamily: "Carlito",
|
|
455958
|
+
verdict: "metric_safe",
|
|
455959
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
455960
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
455961
|
+
gates: { static: "pass", metric: "pass", layout: "pass", ship: "pass" },
|
|
455962
|
+
policyAction: "substitute",
|
|
455963
|
+
measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
|
|
455964
|
+
candidateLicense: "OFL-1.1",
|
|
455965
|
+
exportRule: "preserve_original_name"
|
|
455966
|
+
},
|
|
455967
|
+
{
|
|
455968
|
+
evidenceId: "cambria",
|
|
455969
|
+
logicalFamily: "Cambria",
|
|
455970
|
+
physicalFamily: "Caladea",
|
|
455971
|
+
verdict: "visual_only",
|
|
455972
|
+
faceVerdicts: { regular: "metric_safe", bold: "metric_safe", italic: "metric_safe", boldItalic: "visual_only" },
|
|
455973
|
+
glyphExceptions: [
|
|
455974
|
+
{
|
|
455975
|
+
slot: "boldItalic",
|
|
455976
|
+
codepoint: 96,
|
|
455977
|
+
advanceDelta: 0.231,
|
|
455978
|
+
note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
|
|
455979
|
+
}
|
|
455980
|
+
],
|
|
455981
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
455982
|
+
advance: { meanDelta: 0.0002378, maxDelta: 0.2310758 },
|
|
455983
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
455984
|
+
policyAction: "substitute",
|
|
455985
|
+
measurementRefs: [
|
|
455986
|
+
"cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
|
|
455987
|
+
"cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
|
|
455988
|
+
"cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
|
|
455989
|
+
"cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
|
|
455990
|
+
],
|
|
455991
|
+
candidateLicense: "Apache-2.0",
|
|
455992
|
+
exportRule: "preserve_original_name"
|
|
455993
|
+
},
|
|
455994
|
+
{
|
|
455995
|
+
evidenceId: "arial",
|
|
455996
|
+
logicalFamily: "Arial",
|
|
455997
|
+
physicalFamily: "Liberation Sans",
|
|
455998
|
+
verdict: "metric_safe",
|
|
455999
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456000
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456001
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
456002
|
+
policyAction: "substitute",
|
|
456003
|
+
measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
|
|
456004
|
+
candidateLicense: "OFL-1.1",
|
|
456005
|
+
exportRule: "preserve_original_name"
|
|
456006
|
+
},
|
|
456007
|
+
{
|
|
456008
|
+
evidenceId: "times-new-roman",
|
|
456009
|
+
logicalFamily: "Times New Roman",
|
|
456010
|
+
physicalFamily: "Liberation Serif",
|
|
456011
|
+
verdict: "metric_safe",
|
|
456012
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456013
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456014
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
456015
|
+
policyAction: "substitute",
|
|
456016
|
+
measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
|
|
456017
|
+
candidateLicense: "OFL-1.1",
|
|
456018
|
+
exportRule: "preserve_original_name"
|
|
456019
|
+
},
|
|
456020
|
+
{
|
|
456021
|
+
evidenceId: "courier-new",
|
|
456022
|
+
logicalFamily: "Courier New",
|
|
456023
|
+
physicalFamily: "Liberation Mono",
|
|
456024
|
+
verdict: "metric_safe",
|
|
456025
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456026
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456027
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
456028
|
+
policyAction: "substitute",
|
|
456029
|
+
measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
|
|
456030
|
+
candidateLicense: "OFL-1.1",
|
|
456031
|
+
exportRule: "preserve_original_name"
|
|
456032
|
+
},
|
|
456033
|
+
{
|
|
456034
|
+
evidenceId: "helvetica",
|
|
456035
|
+
logicalFamily: "Helvetica",
|
|
456036
|
+
physicalFamily: "Liberation Sans",
|
|
456037
|
+
verdict: "metric_safe",
|
|
456038
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456039
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456040
|
+
gates: { static: "not_run", metric: "pass", layout: "not_run", ship: "fail" },
|
|
456041
|
+
policyAction: "substitute",
|
|
456042
|
+
measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
|
|
456043
|
+
candidateLicense: "OFL-1.1",
|
|
456044
|
+
exportRule: "preserve_original_name"
|
|
456045
|
+
},
|
|
456046
|
+
{
|
|
456047
|
+
evidenceId: "calibri-light",
|
|
456048
|
+
logicalFamily: "Calibri Light",
|
|
456049
|
+
physicalFamily: "Carlito",
|
|
456050
|
+
verdict: "visual_only",
|
|
456051
|
+
faces: { regular: false, bold: false, italic: false, boldItalic: false },
|
|
456052
|
+
advance: { meanDelta: 0.0148, maxDelta: 0.066 },
|
|
456053
|
+
gates: { static: "not_run", metric: "fail", layout: "not_run", ship: "fail" },
|
|
456054
|
+
policyAction: "category_fallback",
|
|
456055
|
+
measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
|
|
456056
|
+
candidateLicense: "OFL-1.1",
|
|
456057
|
+
exportRule: "preserve_original_name"
|
|
456058
|
+
}
|
|
456059
|
+
]);
|
|
456060
|
+
});
|
|
456061
|
+
|
|
456062
|
+
// ../../shared/font-system/src/resolver.ts
|
|
456063
|
+
function normalizeFamilyKey3(family2) {
|
|
456064
|
+
return family2.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
456065
|
+
}
|
|
456066
|
+
function sortPairs2(pairs) {
|
|
456067
|
+
return pairs.sort(([a2], [b2]) => a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
|
|
456068
|
+
}
|
|
456069
|
+
function deriveBundledSubstitutes2() {
|
|
456070
|
+
const substitutes = {};
|
|
456071
|
+
for (const row2 of SUBSTITUTION_EVIDENCE2) {
|
|
456072
|
+
if (row2.policyAction === "substitute" && row2.physicalFamily) {
|
|
456073
|
+
substitutes[normalizeFamilyKey3(row2.logicalFamily)] = row2.physicalFamily;
|
|
456074
|
+
}
|
|
456075
|
+
}
|
|
456076
|
+
return Object.freeze(substitutes);
|
|
456077
|
+
}
|
|
456078
|
+
function deriveCategoryFallbacks2() {
|
|
456079
|
+
const fallbacks = {};
|
|
456080
|
+
for (const row2 of SUBSTITUTION_EVIDENCE2) {
|
|
456081
|
+
if (row2.policyAction === "category_fallback" && row2.physicalFamily) {
|
|
456082
|
+
fallbacks[normalizeFamilyKey3(row2.logicalFamily)] = row2.physicalFamily;
|
|
456083
|
+
}
|
|
456084
|
+
}
|
|
456085
|
+
return Object.freeze(fallbacks);
|
|
456086
|
+
}
|
|
456087
|
+
function stripFamilyQuotes2(family2) {
|
|
456088
|
+
return family2.trim().replace(/^["']|["']$/g, "");
|
|
456089
|
+
}
|
|
456090
|
+
function splitStack2(cssFontFamily) {
|
|
456091
|
+
return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
|
|
456092
|
+
}
|
|
456093
|
+
|
|
456094
|
+
class FontResolver2 {
|
|
456095
|
+
#overrides = new Map;
|
|
456096
|
+
#embedded = new Map;
|
|
456097
|
+
#version = 0;
|
|
456098
|
+
#cachedSignature = null;
|
|
456099
|
+
map(logicalFamily, physicalFamily) {
|
|
456100
|
+
const key2 = normalizeFamilyKey3(logicalFamily);
|
|
456101
|
+
const physical = physicalFamily?.trim();
|
|
456102
|
+
if (!key2 || !physical)
|
|
456103
|
+
return;
|
|
456104
|
+
if (this.#overrides.get(key2) === physical)
|
|
456105
|
+
return;
|
|
456106
|
+
if (key2 === normalizeFamilyKey3(physical)) {
|
|
456107
|
+
if (this.#overrides.delete(key2)) {
|
|
456108
|
+
this.#version += 1;
|
|
456109
|
+
this.#cachedSignature = null;
|
|
456110
|
+
}
|
|
456111
|
+
return;
|
|
456112
|
+
}
|
|
456113
|
+
this.#overrides.set(key2, physical);
|
|
456114
|
+
this.#version += 1;
|
|
456115
|
+
this.#cachedSignature = null;
|
|
456116
|
+
}
|
|
456117
|
+
unmap(logicalFamily) {
|
|
456118
|
+
if (this.#overrides.delete(normalizeFamilyKey3(logicalFamily))) {
|
|
456119
|
+
this.#version += 1;
|
|
456120
|
+
this.#cachedSignature = null;
|
|
456121
|
+
}
|
|
456122
|
+
}
|
|
456123
|
+
mapEmbedded(logicalFamily, physicalFamily) {
|
|
456124
|
+
const key2 = normalizeFamilyKey3(logicalFamily);
|
|
456125
|
+
const physical = physicalFamily?.trim();
|
|
456126
|
+
if (!key2 || !physical)
|
|
456127
|
+
return;
|
|
456128
|
+
if (this.#embedded.get(key2) === physical)
|
|
456129
|
+
return;
|
|
456130
|
+
this.#embedded.set(key2, physical);
|
|
456131
|
+
this.#version += 1;
|
|
456132
|
+
this.#cachedSignature = null;
|
|
456133
|
+
}
|
|
456134
|
+
clearEmbedded() {
|
|
456135
|
+
if (this.#embedded.size === 0)
|
|
456136
|
+
return;
|
|
456137
|
+
this.#embedded.clear();
|
|
456138
|
+
this.#version += 1;
|
|
456139
|
+
this.#cachedSignature = null;
|
|
456140
|
+
}
|
|
456141
|
+
reset() {
|
|
456142
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0)
|
|
456143
|
+
return;
|
|
456144
|
+
this.#overrides.clear();
|
|
456145
|
+
this.#embedded.clear();
|
|
456146
|
+
this.#version += 1;
|
|
456147
|
+
this.#cachedSignature = null;
|
|
456148
|
+
}
|
|
456149
|
+
get version() {
|
|
456150
|
+
return this.#version;
|
|
456151
|
+
}
|
|
456152
|
+
get signature() {
|
|
456153
|
+
if (this.#cachedSignature !== null)
|
|
456154
|
+
return this.#cachedSignature;
|
|
456155
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0) {
|
|
456156
|
+
this.#cachedSignature = "";
|
|
456157
|
+
} else {
|
|
456158
|
+
const overridePairs = sortPairs2([...this.#overrides.entries()]);
|
|
456159
|
+
this.#cachedSignature = this.#embedded.size === 0 ? JSON.stringify(overridePairs) : JSON.stringify({ o: overridePairs, e: sortPairs2([...this.#embedded.entries()]) });
|
|
456160
|
+
}
|
|
456161
|
+
return this.#cachedSignature;
|
|
456162
|
+
}
|
|
456163
|
+
#physicalFor(bareFamily) {
|
|
456164
|
+
const key2 = normalizeFamilyKey3(bareFamily);
|
|
456165
|
+
const override = this.#overrides.get(key2);
|
|
456166
|
+
if (override)
|
|
456167
|
+
return { physical: override, reason: "custom_mapping" };
|
|
456168
|
+
const bundled = BUNDLED_SUBSTITUTES2[key2];
|
|
456169
|
+
if (bundled)
|
|
456170
|
+
return { physical: bundled, reason: "bundled_substitute" };
|
|
456171
|
+
const category = CATEGORY_FALLBACKS2[key2];
|
|
456172
|
+
if (category)
|
|
456173
|
+
return { physical: category, reason: "category_fallback" };
|
|
456174
|
+
return { physical: bareFamily, reason: "as_requested" };
|
|
456175
|
+
}
|
|
456176
|
+
#resolveFaceLadder(primary, face, hasFace) {
|
|
456177
|
+
const key2 = normalizeFamilyKey3(primary);
|
|
456178
|
+
const override = this.#overrides.get(key2);
|
|
456179
|
+
if (override && hasFace(override, face.weight, face.style)) {
|
|
456180
|
+
return { physical: override, reason: "custom_mapping" };
|
|
456181
|
+
}
|
|
456182
|
+
const embedded2 = this.#embedded.get(key2);
|
|
456183
|
+
if (embedded2 && hasFace(embedded2, face.weight, face.style)) {
|
|
456184
|
+
return { physical: embedded2, reason: "registered_face" };
|
|
456185
|
+
}
|
|
456186
|
+
if (hasFace(primary, face.weight, face.style)) {
|
|
456187
|
+
return { physical: primary, reason: "registered_face" };
|
|
456188
|
+
}
|
|
456189
|
+
const bundled = BUNDLED_SUBSTITUTES2[key2];
|
|
456190
|
+
if (bundled && hasFace(bundled, face.weight, face.style)) {
|
|
456191
|
+
return { physical: bundled, reason: "bundled_substitute" };
|
|
456192
|
+
}
|
|
456193
|
+
const category = CATEGORY_FALLBACKS2[key2];
|
|
456194
|
+
if (category && hasFace(category, face.weight, face.style)) {
|
|
456195
|
+
return { physical: category, reason: "category_fallback" };
|
|
456196
|
+
}
|
|
456197
|
+
if (override || bundled) {
|
|
456198
|
+
return { physical: primary, reason: "fallback_face_absent" };
|
|
456199
|
+
}
|
|
456200
|
+
return { physical: primary, reason: "as_requested" };
|
|
456201
|
+
}
|
|
456202
|
+
resolveFontFamily(logicalFamily) {
|
|
456203
|
+
const parts = splitStack2(logicalFamily);
|
|
456204
|
+
const primary = parts[0] ?? logicalFamily;
|
|
456205
|
+
const { physical, reason } = this.#physicalFor(primary);
|
|
456206
|
+
return { logicalFamily, physicalFamily: stripFamilyQuotes2(physical), reason };
|
|
456207
|
+
}
|
|
456208
|
+
resolvePhysicalFamily(cssFontFamily) {
|
|
456209
|
+
if (!cssFontFamily)
|
|
456210
|
+
return cssFontFamily;
|
|
456211
|
+
const parts = splitStack2(cssFontFamily);
|
|
456212
|
+
if (parts.length === 0)
|
|
456213
|
+
return cssFontFamily;
|
|
456214
|
+
const { physical, reason } = this.#physicalFor(parts[0]);
|
|
456215
|
+
if (reason === "as_requested")
|
|
456216
|
+
return cssFontFamily;
|
|
456217
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
456218
|
+
}
|
|
456219
|
+
resolveFace(logicalFamily, face, hasFace) {
|
|
456220
|
+
const parts = splitStack2(logicalFamily);
|
|
456221
|
+
const primary = parts[0] ?? logicalFamily;
|
|
456222
|
+
const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
|
|
456223
|
+
return { logicalFamily, physicalFamily: stripFamilyQuotes2(physical), reason };
|
|
456224
|
+
}
|
|
456225
|
+
resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
|
|
456226
|
+
if (!cssFontFamily)
|
|
456227
|
+
return cssFontFamily;
|
|
456228
|
+
const parts = splitStack2(cssFontFamily);
|
|
456229
|
+
if (parts.length === 0)
|
|
456230
|
+
return cssFontFamily;
|
|
456231
|
+
const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
|
|
456232
|
+
if (normalizeFamilyKey3(physical) !== normalizeFamilyKey3(parts[0])) {
|
|
456233
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
456234
|
+
}
|
|
456235
|
+
return cssFontFamily;
|
|
456236
|
+
}
|
|
456237
|
+
resolvePrimaryPhysicalFamily(family2) {
|
|
456238
|
+
const parts = splitStack2(family2);
|
|
456239
|
+
const primary = parts[0] ?? family2;
|
|
456240
|
+
return this.#physicalFor(primary).physical;
|
|
456241
|
+
}
|
|
456242
|
+
resolvePhysicalFamilies(families) {
|
|
456243
|
+
const out = new Set;
|
|
456244
|
+
for (const family2 of families) {
|
|
456245
|
+
if (family2)
|
|
456246
|
+
out.add(this.resolvePrimaryPhysicalFamily(family2));
|
|
456247
|
+
}
|
|
456248
|
+
return [...out];
|
|
456249
|
+
}
|
|
456250
|
+
}
|
|
456251
|
+
function resolvePhysicalFamily2(cssFontFamily) {
|
|
456252
|
+
return defaultResolver2.resolvePhysicalFamily(cssFontFamily);
|
|
456253
|
+
}
|
|
456254
|
+
var BUNDLED_SUBSTITUTES2, CATEGORY_FALLBACKS2, defaultResolver2, DEFAULT_FONT_MEASURE_CONTEXT2;
|
|
456255
|
+
var init_resolver = __esm(() => {
|
|
456256
|
+
init_substitution_evidence();
|
|
456257
|
+
BUNDLED_SUBSTITUTES2 = deriveBundledSubstitutes2();
|
|
456258
|
+
CATEGORY_FALLBACKS2 = deriveCategoryFallbacks2();
|
|
456259
|
+
defaultResolver2 = new FontResolver2;
|
|
456260
|
+
DEFAULT_FONT_MEASURE_CONTEXT2 = Object.freeze({
|
|
456261
|
+
resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily2(cssFontFamily),
|
|
456262
|
+
fontSignature: ""
|
|
456263
|
+
});
|
|
456264
|
+
});
|
|
456265
|
+
// ../../shared/font-system/src/bundled-manifest.ts
|
|
456266
|
+
function fourFaces2(filePrefix) {
|
|
456267
|
+
return [
|
|
456268
|
+
{ weight: "normal", style: "normal", file: `${filePrefix}-Regular.woff2` },
|
|
456269
|
+
{ weight: "bold", style: "normal", file: `${filePrefix}-Bold.woff2` },
|
|
456270
|
+
{ weight: "normal", style: "italic", file: `${filePrefix}-Italic.woff2` },
|
|
456271
|
+
{ weight: "bold", style: "italic", file: `${filePrefix}-BoldItalic.woff2` }
|
|
456272
|
+
];
|
|
456273
|
+
}
|
|
456274
|
+
function family2(name, filePrefix, license) {
|
|
456275
|
+
return { family: name, license, faces: fourFaces2(filePrefix) };
|
|
456276
|
+
}
|
|
456277
|
+
var BUNDLED_MANIFEST2;
|
|
456278
|
+
var init_bundled_manifest = __esm(() => {
|
|
456279
|
+
BUNDLED_MANIFEST2 = Object.freeze([
|
|
456280
|
+
family2("Carlito", "Carlito", "OFL-1.1"),
|
|
456281
|
+
family2("Caladea", "Caladea", "Apache-2.0"),
|
|
456282
|
+
family2("Liberation Sans", "LiberationSans", "OFL-1.1"),
|
|
456283
|
+
family2("Liberation Serif", "LiberationSerif", "OFL-1.1"),
|
|
456284
|
+
family2("Liberation Mono", "LiberationMono", "OFL-1.1")
|
|
456285
|
+
]);
|
|
456286
|
+
});
|
|
456287
|
+
|
|
456288
|
+
// ../../shared/font-system/src/bundled.ts
|
|
456289
|
+
var installedRegistries2;
|
|
456290
|
+
var init_bundled = __esm(() => {
|
|
456291
|
+
init_bundled_manifest();
|
|
456292
|
+
init_bundled_manifest();
|
|
456293
|
+
installedRegistries2 = new WeakMap;
|
|
456294
|
+
});
|
|
456295
|
+
|
|
456296
|
+
// ../../shared/font-system/src/report.ts
|
|
456297
|
+
var init_report = __esm(() => {
|
|
456298
|
+
init_resolver();
|
|
456299
|
+
init_types8();
|
|
456300
|
+
});
|
|
456301
|
+
|
|
456302
|
+
// ../../shared/font-system/src/os2.ts
|
|
456303
|
+
function parseEmbeddingPolicy2(bytes) {
|
|
456304
|
+
const view = bytes instanceof ArrayBuffer ? new DataView(bytes) : new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
456305
|
+
if (view.byteLength < SFNT_TABLE_DIR_OFFSET2)
|
|
456306
|
+
return null;
|
|
456307
|
+
const numTables = view.getUint16(4);
|
|
456308
|
+
let os2Offset = -1;
|
|
456309
|
+
for (let i5 = 0;i5 < numTables; i5 += 1) {
|
|
456310
|
+
const record3 = SFNT_TABLE_DIR_OFFSET2 + i5 * SFNT_TABLE_RECORD_SIZE2;
|
|
456311
|
+
if (record3 + SFNT_TABLE_RECORD_SIZE2 > view.byteLength)
|
|
456312
|
+
return null;
|
|
456313
|
+
const tag = String.fromCharCode(view.getUint8(record3), view.getUint8(record3 + 1), view.getUint8(record3 + 2), view.getUint8(record3 + 3));
|
|
456314
|
+
if (tag === "OS/2") {
|
|
456315
|
+
os2Offset = view.getUint32(record3 + 8);
|
|
456316
|
+
break;
|
|
456317
|
+
}
|
|
456318
|
+
}
|
|
456319
|
+
if (os2Offset < 0 || os2Offset + OS2_MIN_LENGTH2 > view.byteLength)
|
|
456320
|
+
return null;
|
|
456321
|
+
const usWeightClass = view.getUint16(os2Offset + OS2_USWEIGHTCLASS2);
|
|
456322
|
+
const fsType = view.getUint16(os2Offset + OS2_FSTYPE2);
|
|
456323
|
+
const fsSelection = view.getUint16(os2Offset + OS2_FSSELECTION2);
|
|
456324
|
+
const weight = usWeightClass >= BOLD_WEIGHT_THRESHOLD2 ? "700" : "400";
|
|
456325
|
+
const style2 = (fsSelection & FS_SELECTION_ITALIC2) !== 0 ? "italic" : "normal";
|
|
456326
|
+
return {
|
|
456327
|
+
fsType,
|
|
456328
|
+
face: { weight, style: style2 },
|
|
456329
|
+
embeddable: (fsType & FS_TYPE_RESTRICTED2) === 0
|
|
456330
|
+
};
|
|
456331
|
+
}
|
|
456332
|
+
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;
|
|
456333
|
+
var init_os2 = __esm(() => {
|
|
456334
|
+
OS2_MIN_LENGTH2 = OS2_FSSELECTION2 + 2;
|
|
456335
|
+
});
|
|
456336
|
+
|
|
456337
|
+
// ../../shared/font-system/src/registry.ts
|
|
456338
|
+
function quoteFamily2(family3) {
|
|
456339
|
+
return `"${family3.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
456340
|
+
}
|
|
456341
|
+
function canonicalizeFontSource2(source) {
|
|
456342
|
+
const match2 = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
|
|
456343
|
+
if (!match2)
|
|
456344
|
+
return source;
|
|
456345
|
+
let inner = match2[1].trim();
|
|
456346
|
+
if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'")) {
|
|
456347
|
+
inner = inner.slice(1, -1);
|
|
456348
|
+
}
|
|
456349
|
+
return `url(${JSON.stringify(inner)})`;
|
|
456350
|
+
}
|
|
456351
|
+
function normalizeFamilyKey4(family3) {
|
|
456352
|
+
return family3.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
456353
|
+
}
|
|
456354
|
+
function normalizeWeight2(weight) {
|
|
456355
|
+
if (weight === undefined)
|
|
456356
|
+
return "400";
|
|
456357
|
+
const w = String(weight).trim().toLowerCase();
|
|
456358
|
+
if (w === "bold" || w === "bolder")
|
|
456359
|
+
return "700";
|
|
456360
|
+
const n = Number(w);
|
|
456361
|
+
return Number.isFinite(n) && n >= 600 ? "700" : "400";
|
|
456362
|
+
}
|
|
456363
|
+
function normalizeStyle3(style2) {
|
|
456364
|
+
if (!style2)
|
|
456365
|
+
return "normal";
|
|
456366
|
+
const s2 = style2.trim().toLowerCase();
|
|
456367
|
+
return s2.startsWith("italic") || s2.startsWith("oblique") ? "italic" : "normal";
|
|
456368
|
+
}
|
|
456369
|
+
function faceKeyOf3(family3, weight, style2) {
|
|
456370
|
+
return `${normalizeFamilyKey4(family3)}|${weight}|${style2}`;
|
|
456371
|
+
}
|
|
456372
|
+
function faceProbe2(family3, weight, style2, size3) {
|
|
456373
|
+
const stylePart = style2 === "italic" ? "italic " : "";
|
|
456374
|
+
return `${stylePart}${weight} ${size3} ${quoteFamily2(family3)}`;
|
|
456375
|
+
}
|
|
456376
|
+
|
|
456377
|
+
class FontRegistry2 {
|
|
456378
|
+
#fontSet;
|
|
456379
|
+
#FontFaceCtor;
|
|
456380
|
+
#probeSize;
|
|
456381
|
+
#scheduleTimeout;
|
|
456382
|
+
#cancelTimeout;
|
|
456383
|
+
#managed = new Map;
|
|
456384
|
+
#facesByKey = new Map;
|
|
456385
|
+
#status = new Map;
|
|
456386
|
+
#sources = new Map;
|
|
456387
|
+
#warnedFailures = new Set;
|
|
456388
|
+
#inflight = new Map;
|
|
456389
|
+
#faceStatus = new Map;
|
|
456390
|
+
#faceInflight = new Map;
|
|
456391
|
+
#faceSources = new Map;
|
|
456392
|
+
#facesByFamily = new Map;
|
|
456393
|
+
#providerFaceKeys = new Set;
|
|
456394
|
+
#warnedFaceFailures = new Set;
|
|
456395
|
+
constructor(options = {}) {
|
|
456396
|
+
this.#fontSet = options.fontSet ?? null;
|
|
456397
|
+
this.#FontFaceCtor = options.FontFaceCtor ?? null;
|
|
456398
|
+
this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE2;
|
|
456399
|
+
this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
|
|
456400
|
+
this.#cancelTimeout = options.cancelTimeout ?? ((handle4) => globalThis.clearTimeout(handle4));
|
|
456401
|
+
}
|
|
456402
|
+
register(descriptor) {
|
|
456403
|
+
const { family: family3, source, descriptors: descriptors3 } = descriptor;
|
|
456404
|
+
const identitySource = typeof source === "string" ? canonicalizeFontSource2(source) : source;
|
|
456405
|
+
const weight = normalizeWeight2(descriptors3?.weight);
|
|
456406
|
+
const style2 = normalizeStyle3(descriptors3?.style);
|
|
456407
|
+
const key2 = faceKeyOf3(family3, weight, style2);
|
|
456408
|
+
if (typeof identitySource === "string") {
|
|
456409
|
+
const existingSource = this.#faceSources.get(key2);
|
|
456410
|
+
if (existingSource === identitySource)
|
|
456411
|
+
return { family: family3, status: this.getStatus(family3), changed: false };
|
|
456412
|
+
if (existingSource !== undefined) {
|
|
456413
|
+
throw new Error(`[superdoc] font face "${key2}" is already registered from a different source ` + `("${existingSource}"); a registered face's source cannot be replaced`);
|
|
456414
|
+
}
|
|
456415
|
+
}
|
|
456416
|
+
if (this.#FontFaceCtor && this.#fontSet) {
|
|
456417
|
+
const face = new this.#FontFaceCtor(family3, source, { ...descriptors3, weight, style: style2 });
|
|
456418
|
+
this.#fontSet.add(face);
|
|
456419
|
+
this.#addManagedFace(family3, key2, face);
|
|
456420
|
+
}
|
|
456421
|
+
if (typeof source === "string") {
|
|
456422
|
+
const list8 = this.#sources.get(family3) ?? [];
|
|
456423
|
+
if (!list8.includes(source))
|
|
456424
|
+
list8.push(source);
|
|
456425
|
+
this.#sources.set(family3, list8);
|
|
456426
|
+
}
|
|
456427
|
+
if (!this.#status.has(family3))
|
|
456428
|
+
this.#status.set(family3, "unloaded");
|
|
456429
|
+
this.#providerFaceKeys.add(key2);
|
|
456430
|
+
this.#trackFace(family3, key2);
|
|
456431
|
+
if (!this.#faceStatus.has(key2))
|
|
456432
|
+
this.#faceStatus.set(key2, "unloaded");
|
|
456433
|
+
if (typeof identitySource === "string" && !this.#faceSources.has(key2))
|
|
456434
|
+
this.#faceSources.set(key2, identitySource);
|
|
456435
|
+
return { family: family3, status: this.getStatus(family3), changed: true };
|
|
456436
|
+
}
|
|
456437
|
+
#trackFace(family3, key2) {
|
|
456438
|
+
const fam = normalizeFamilyKey4(family3);
|
|
456439
|
+
const set3 = this.#facesByFamily.get(fam) ?? new Set;
|
|
456440
|
+
set3.add(key2);
|
|
456441
|
+
this.#facesByFamily.set(fam, set3);
|
|
456442
|
+
}
|
|
456443
|
+
isManaged(family3) {
|
|
456444
|
+
return this.#managed.has(family3);
|
|
456445
|
+
}
|
|
456446
|
+
registerOwnedFace(descriptor) {
|
|
456447
|
+
const { family: family3, source, weight, style: style2 } = descriptor;
|
|
456448
|
+
if (!this.#FontFaceCtor || !this.#fontSet)
|
|
456449
|
+
return null;
|
|
456450
|
+
const key2 = faceKeyOf3(family3, weight, style2);
|
|
456451
|
+
const face = new this.#FontFaceCtor(family3, source, { weight, style: style2 });
|
|
456452
|
+
this.#fontSet.add(face);
|
|
456453
|
+
this.#addManagedFace(family3, key2, face);
|
|
456454
|
+
this.#providerFaceKeys.add(key2);
|
|
456455
|
+
if (!this.#status.has(family3))
|
|
456456
|
+
this.#status.set(family3, "unloaded");
|
|
456457
|
+
this.#trackFace(family3, key2);
|
|
456458
|
+
if (!this.#faceStatus.has(key2))
|
|
456459
|
+
this.#faceStatus.set(key2, "unloaded");
|
|
456460
|
+
let released = false;
|
|
456461
|
+
return () => {
|
|
456462
|
+
if (released)
|
|
456463
|
+
return false;
|
|
456464
|
+
released = true;
|
|
456465
|
+
return this.#removeManagedFace(family3, key2, face);
|
|
456466
|
+
};
|
|
456467
|
+
}
|
|
456468
|
+
#addManagedFace(family3, key2, face) {
|
|
456469
|
+
this.#managed.set(family3, face);
|
|
456470
|
+
let set3 = this.#facesByKey.get(key2);
|
|
456471
|
+
if (!set3) {
|
|
456472
|
+
set3 = new Set;
|
|
456473
|
+
this.#facesByKey.set(key2, set3);
|
|
456474
|
+
}
|
|
456475
|
+
set3.add(face);
|
|
456476
|
+
}
|
|
456477
|
+
#removeManagedFace(family3, key2, face) {
|
|
456478
|
+
const set3 = this.#facesByKey.get(key2);
|
|
456479
|
+
if (!set3 || !set3.delete(face))
|
|
456480
|
+
return false;
|
|
456481
|
+
if (typeof this.#fontSet?.delete === "function")
|
|
456482
|
+
this.#fontSet.delete(face);
|
|
456483
|
+
if (set3.size > 0)
|
|
456484
|
+
return true;
|
|
456485
|
+
this.#facesByKey.delete(key2);
|
|
456486
|
+
this.#providerFaceKeys.delete(key2);
|
|
456487
|
+
this.#faceStatus.delete(key2);
|
|
456488
|
+
this.#faceSources.delete(key2);
|
|
456489
|
+
const fam = normalizeFamilyKey4(family3);
|
|
456490
|
+
const keys7 = this.#facesByFamily.get(fam);
|
|
456491
|
+
if (keys7) {
|
|
456492
|
+
keys7.delete(key2);
|
|
456493
|
+
if (keys7.size === 0) {
|
|
456494
|
+
this.#facesByFamily.delete(fam);
|
|
456495
|
+
this.#managed.delete(family3);
|
|
456496
|
+
this.#status.delete(family3);
|
|
456497
|
+
this.#sources.delete(family3);
|
|
456498
|
+
}
|
|
456499
|
+
}
|
|
456500
|
+
return true;
|
|
456501
|
+
}
|
|
456502
|
+
getStatus(family3) {
|
|
456503
|
+
const statuses = [];
|
|
456504
|
+
const faceKeys = this.#facesByFamily.get(normalizeFamilyKey4(family3));
|
|
456505
|
+
if (faceKeys)
|
|
456506
|
+
for (const k2 of faceKeys)
|
|
456507
|
+
statuses.push(this.#faceStatus.get(k2) ?? "unloaded");
|
|
456508
|
+
const legacy = this.#status.get(family3);
|
|
456509
|
+
if (legacy)
|
|
456510
|
+
statuses.push(legacy);
|
|
456511
|
+
if (statuses.length === 0)
|
|
456512
|
+
return "unloaded";
|
|
456513
|
+
const priority = ["failed", "timed_out", "fallback_used", "loaded", "loading", "unloaded"];
|
|
456514
|
+
for (const s2 of priority)
|
|
456515
|
+
if (statuses.includes(s2))
|
|
456516
|
+
return s2;
|
|
456517
|
+
return "unloaded";
|
|
456518
|
+
}
|
|
456519
|
+
hasFace(family3, weight, style2) {
|
|
456520
|
+
const key2 = faceKeyOf3(family3, weight, style2);
|
|
456521
|
+
return this.#providerFaceKeys.has(key2) && this.#faceStatus.get(key2) !== "failed";
|
|
456522
|
+
}
|
|
456523
|
+
isAvailable(family3) {
|
|
456524
|
+
if (!this.#fontSet)
|
|
456525
|
+
return false;
|
|
456526
|
+
try {
|
|
456527
|
+
return this.#fontSet.check(`${this.#probeSize} ${quoteFamily2(family3)}`);
|
|
456528
|
+
} catch {
|
|
456529
|
+
return false;
|
|
456530
|
+
}
|
|
456531
|
+
}
|
|
456532
|
+
awaitFace(family3, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS2) {
|
|
456533
|
+
if (this.#status.get(family3) === "loaded") {
|
|
456534
|
+
return Promise.resolve({ family: family3, status: "loaded" });
|
|
456535
|
+
}
|
|
456536
|
+
const existing = this.#inflight.get(family3);
|
|
456537
|
+
if (existing)
|
|
456538
|
+
return existing;
|
|
456539
|
+
const probe = this.#loadOne(family3, timeoutMs).finally(() => {
|
|
456540
|
+
this.#inflight.delete(family3);
|
|
456541
|
+
});
|
|
456542
|
+
this.#inflight.set(family3, probe);
|
|
456543
|
+
return probe;
|
|
456544
|
+
}
|
|
456545
|
+
async awaitFaces(families, options = {}) {
|
|
456546
|
+
const unique2 = [...new Set(families)];
|
|
456547
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_FONT_LOAD_TIMEOUT_MS2;
|
|
456548
|
+
return Promise.all(unique2.map((family3) => this.awaitFace(family3, timeoutMs)));
|
|
456549
|
+
}
|
|
456550
|
+
getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS2) {
|
|
456551
|
+
return [...new Set(families)].map((family3) => ({
|
|
456552
|
+
family: family3,
|
|
456553
|
+
status: this.getStatus(family3),
|
|
456554
|
+
ready: this.awaitFace(family3, timeoutMs)
|
|
456555
|
+
}));
|
|
456556
|
+
}
|
|
456557
|
+
getStates() {
|
|
456558
|
+
return [...this.#status.entries()].map(([family3, status]) => ({ family: family3, status }));
|
|
456559
|
+
}
|
|
456560
|
+
getFaceStatus(request) {
|
|
456561
|
+
return this.#faceStatus.get(faceKeyOf3(request.family, request.weight, request.style)) ?? "unloaded";
|
|
456562
|
+
}
|
|
456563
|
+
awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS2) {
|
|
456564
|
+
const key2 = faceKeyOf3(request.family, request.weight, request.style);
|
|
456565
|
+
if (this.#faceStatus.get(key2) === "loaded") {
|
|
456566
|
+
return Promise.resolve({ request, status: "loaded" });
|
|
456567
|
+
}
|
|
456568
|
+
const existing = this.#faceInflight.get(key2);
|
|
456569
|
+
if (existing)
|
|
456570
|
+
return existing;
|
|
456571
|
+
const probe = this.#loadOneFace(request, key2, timeoutMs).finally(() => {
|
|
456572
|
+
this.#faceInflight.delete(key2);
|
|
456573
|
+
});
|
|
456574
|
+
this.#faceInflight.set(key2, probe);
|
|
456575
|
+
return probe;
|
|
456576
|
+
}
|
|
456577
|
+
async awaitFaceRequests(requests, options = {}) {
|
|
456578
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_FONT_LOAD_TIMEOUT_MS2;
|
|
456579
|
+
const seen = new Set;
|
|
456580
|
+
const unique2 = [];
|
|
456581
|
+
for (const r2 of requests) {
|
|
456582
|
+
const key2 = faceKeyOf3(r2.family, r2.weight, r2.style);
|
|
456583
|
+
if (seen.has(key2))
|
|
456584
|
+
continue;
|
|
456585
|
+
seen.add(key2);
|
|
456586
|
+
unique2.push(r2);
|
|
456587
|
+
}
|
|
456588
|
+
return Promise.all(unique2.map((r2) => this.awaitFaceRequest(r2, timeoutMs)));
|
|
456589
|
+
}
|
|
456590
|
+
async#loadOneFace(request, key2, timeoutMs) {
|
|
456591
|
+
this.#trackFace(request.family, key2);
|
|
456592
|
+
const fontSet = this.#fontSet;
|
|
456593
|
+
if (!fontSet) {
|
|
456594
|
+
this.#faceStatus.set(key2, "fallback_used");
|
|
456595
|
+
return { request, status: "fallback_used" };
|
|
456596
|
+
}
|
|
456597
|
+
this.#faceStatus.set(key2, "loading");
|
|
456598
|
+
const probe = faceProbe2(request.family, request.weight, request.style, this.#probeSize);
|
|
456599
|
+
const TIMEOUT = Symbol("timeout");
|
|
456600
|
+
let handle4;
|
|
456601
|
+
const timeout2 = new Promise((resolve2) => {
|
|
456602
|
+
handle4 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
456603
|
+
});
|
|
456604
|
+
try {
|
|
456605
|
+
const settled = await Promise.race([fontSet.load(probe), timeout2]);
|
|
456606
|
+
if (settled === TIMEOUT) {
|
|
456607
|
+
this.#faceStatus.set(key2, "timed_out");
|
|
456608
|
+
return { request, status: "timed_out" };
|
|
456609
|
+
}
|
|
456610
|
+
const faces = settled;
|
|
456611
|
+
const status = faces.length > 0 ? "loaded" : "fallback_used";
|
|
456612
|
+
this.#faceStatus.set(key2, status);
|
|
456613
|
+
return { request, status };
|
|
456614
|
+
} catch {
|
|
456615
|
+
this.#faceStatus.set(key2, "failed");
|
|
456616
|
+
this.#warnFaceFailureOnce(request, key2);
|
|
456617
|
+
return { request, status: "failed" };
|
|
456618
|
+
} finally {
|
|
456619
|
+
this.#cancelTimeout(handle4);
|
|
456620
|
+
}
|
|
456621
|
+
}
|
|
456622
|
+
#warnFaceFailureOnce(request, key2) {
|
|
456623
|
+
if (this.#warnedFaceFailures.has(key2))
|
|
456624
|
+
return;
|
|
456625
|
+
this.#warnedFaceFailures.add(key2);
|
|
456626
|
+
const src = this.#faceSources.get(key2);
|
|
456627
|
+
const detail = src ? ` from ${src}` : "";
|
|
456628
|
+
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.`);
|
|
456629
|
+
}
|
|
456630
|
+
async#loadOne(family3, timeoutMs) {
|
|
456631
|
+
const fontSet = this.#fontSet;
|
|
456632
|
+
if (!fontSet) {
|
|
456633
|
+
this.#status.set(family3, "fallback_used");
|
|
456634
|
+
return { family: family3, status: "fallback_used" };
|
|
456635
|
+
}
|
|
456636
|
+
this.#status.set(family3, "loading");
|
|
456637
|
+
const probe = `${this.#probeSize} ${quoteFamily2(family3)}`;
|
|
456638
|
+
const TIMEOUT = Symbol("timeout");
|
|
456639
|
+
let handle4;
|
|
456640
|
+
const timeout2 = new Promise((resolve2) => {
|
|
456641
|
+
handle4 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
456642
|
+
});
|
|
456643
|
+
try {
|
|
456644
|
+
const settled = await Promise.race([fontSet.load(probe), timeout2]);
|
|
456645
|
+
if (settled === TIMEOUT) {
|
|
456646
|
+
this.#status.set(family3, "timed_out");
|
|
456647
|
+
return { family: family3, status: "timed_out" };
|
|
456648
|
+
}
|
|
456649
|
+
const faces = settled;
|
|
456650
|
+
const status = faces.length > 0 ? "loaded" : "fallback_used";
|
|
456651
|
+
this.#status.set(family3, status);
|
|
456652
|
+
return { family: family3, status };
|
|
456653
|
+
} catch {
|
|
456654
|
+
this.#status.set(family3, "failed");
|
|
456655
|
+
this.#warnLoadFailureOnce(family3);
|
|
456656
|
+
return { family: family3, status: "failed" };
|
|
456657
|
+
} finally {
|
|
456658
|
+
this.#cancelTimeout(handle4);
|
|
456659
|
+
}
|
|
456660
|
+
}
|
|
456661
|
+
#warnLoadFailureOnce(family3) {
|
|
456662
|
+
if (this.#warnedFailures.has(family3))
|
|
456663
|
+
return;
|
|
456664
|
+
this.#warnedFailures.add(family3);
|
|
456665
|
+
const sources = this.#sources.get(family3);
|
|
456666
|
+
const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
|
|
456667
|
+
console.warn(`[superdoc] font asset failed to load for "${family3}"${detail}. ` + `Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
456668
|
+
}
|
|
456669
|
+
}
|
|
456670
|
+
var DEFAULT_FONT_LOAD_TIMEOUT_MS2 = 3000, DEFAULT_PROBE_SIZE2 = "16px", registriesByFontSet2;
|
|
456671
|
+
var init_registry2 = __esm(() => {
|
|
456672
|
+
registriesByFontSet2 = new WeakMap;
|
|
456673
|
+
});
|
|
456674
|
+
|
|
456675
|
+
// ../../shared/font-system/src/font-offerings.ts
|
|
456676
|
+
function classifyOffering2(policyAction, verdict, physicalFamily, bundled) {
|
|
456677
|
+
if (policyAction === "preserve_only")
|
|
456678
|
+
return "preserve_only";
|
|
456679
|
+
if (policyAction === "customer_supplied" || physicalFamily == null)
|
|
456680
|
+
return "customer_supplied";
|
|
456681
|
+
if (policyAction === "category_fallback")
|
|
456682
|
+
return "category_fallback";
|
|
456683
|
+
if (!bundled)
|
|
456684
|
+
return "requires_asset";
|
|
456685
|
+
return verdict === "metric_safe" ? "default" : "qualified";
|
|
456686
|
+
}
|
|
456687
|
+
function deriveOfferings2() {
|
|
456688
|
+
const offerings = SUBSTITUTION_EVIDENCE2.map((row2) => {
|
|
456689
|
+
const bundled = row2.physicalFamily != null && BUNDLED_FAMILIES2.has(row2.physicalFamily);
|
|
456690
|
+
return {
|
|
456691
|
+
logicalFamily: row2.logicalFamily,
|
|
456692
|
+
physicalFamily: row2.physicalFamily,
|
|
456693
|
+
generic: row2.physicalFamily && PHYSICAL_GENERIC2[row2.physicalFamily] || "sans-serif",
|
|
456694
|
+
offering: classifyOffering2(row2.policyAction, row2.verdict, row2.physicalFamily, bundled),
|
|
456695
|
+
bundled,
|
|
456696
|
+
verdict: row2.verdict,
|
|
456697
|
+
evidenceId: row2.evidenceId
|
|
456698
|
+
};
|
|
456699
|
+
});
|
|
456700
|
+
return Object.freeze(offerings);
|
|
456701
|
+
}
|
|
456702
|
+
var PHYSICAL_GENERIC2, BUNDLED_FAMILIES2, FONT_OFFERINGS2;
|
|
456703
|
+
var init_font_offerings = __esm(() => {
|
|
456704
|
+
init_substitution_evidence();
|
|
456705
|
+
init_bundled_manifest();
|
|
456706
|
+
PHYSICAL_GENERIC2 = Object.freeze({
|
|
456707
|
+
Carlito: "sans-serif",
|
|
456708
|
+
Caladea: "serif",
|
|
456709
|
+
"Liberation Sans": "sans-serif",
|
|
456710
|
+
"Liberation Serif": "serif",
|
|
456711
|
+
"Liberation Mono": "monospace"
|
|
456712
|
+
});
|
|
456713
|
+
BUNDLED_FAMILIES2 = new Set(BUNDLED_MANIFEST2.map((f2) => f2.family));
|
|
456714
|
+
FONT_OFFERINGS2 = deriveOfferings2();
|
|
456715
|
+
});
|
|
456716
|
+
|
|
456717
|
+
// ../../shared/font-system/src/index.ts
|
|
456718
|
+
var init_src5 = __esm(() => {
|
|
456719
|
+
init_types8();
|
|
456720
|
+
init_resolver();
|
|
456721
|
+
init_resolver();
|
|
456722
|
+
init_bundled();
|
|
456723
|
+
init_report();
|
|
456724
|
+
init_os2();
|
|
456725
|
+
init_registry2();
|
|
456726
|
+
init_font_offerings();
|
|
456727
|
+
});
|
|
456728
|
+
|
|
455713
456729
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/v2/exporter/commentsExporter.js
|
|
455714
456730
|
var prepareCommentParaIds2 = (comment2) => {
|
|
455715
456731
|
const newComment = {
|
|
@@ -458174,6 +459190,7 @@ var init_SuperConverter = __esm(() => {
|
|
|
458174
459190
|
init_normalizeDuplicateBlockIdentitiesInContent();
|
|
458175
459191
|
init_preProcessPageFieldsOnly();
|
|
458176
459192
|
init_helpers();
|
|
459193
|
+
init_src5();
|
|
458177
459194
|
init_base_list_definitions();
|
|
458178
459195
|
init_exporter_docx_defs();
|
|
458179
459196
|
init_commentsExporter();
|
|
@@ -458257,10 +459274,10 @@ var init_SuperConverter = __esm(() => {
|
|
|
458257
459274
|
}
|
|
458258
459275
|
static getFallbackFromFontTable(docx, fontName) {
|
|
458259
459276
|
const fontEntry = SuperConverter3.getFontTableEntry(docx, fontName);
|
|
458260
|
-
const
|
|
458261
|
-
if (!
|
|
459277
|
+
const family3 = fontEntry?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
|
|
459278
|
+
if (!family3)
|
|
458262
459279
|
return null;
|
|
458263
|
-
const mapped = FONT_FAMILY_FALLBACKS3[
|
|
459280
|
+
const mapped = FONT_FAMILY_FALLBACKS3[family3.toLowerCase()];
|
|
458264
459281
|
return mapped || DEFAULT_GENERIC_FALLBACK3;
|
|
458265
459282
|
}
|
|
458266
459283
|
static toCssFontFamily(fontName, docx) {
|
|
@@ -458723,14 +459740,17 @@ var init_SuperConverter = __esm(() => {
|
|
|
458723
459740
|
for (const font of fontsToInclude) {
|
|
458724
459741
|
const filePath = elements.find((el) => el.attributes.Id === font.attributes["r:id"])?.attributes?.Target;
|
|
458725
459742
|
if (!filePath)
|
|
458726
|
-
|
|
459743
|
+
continue;
|
|
458727
459744
|
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
458728
|
-
|
|
458729
|
-
|
|
458730
|
-
|
|
459745
|
+
if (!fontUint8Array?.buffer)
|
|
459746
|
+
continue;
|
|
459747
|
+
const fontBuffer = fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength);
|
|
458731
459748
|
const ttfBuffer = deobfuscateFont2(fontBuffer, font.attributes["w:fontKey"]);
|
|
458732
459749
|
if (!ttfBuffer)
|
|
458733
|
-
|
|
459750
|
+
continue;
|
|
459751
|
+
const policy = parseEmbeddingPolicy2(ttfBuffer);
|
|
459752
|
+
if (!(policy ? policy.embeddable : false))
|
|
459753
|
+
continue;
|
|
458734
459754
|
const blob = new Blob([ttfBuffer], { type: "font/ttf" });
|
|
458735
459755
|
const fontUrl = URL.createObjectURL(blob);
|
|
458736
459756
|
const isNormal = font.name.includes("Regular");
|
|
@@ -458756,6 +459776,49 @@ var init_SuperConverter = __esm(() => {
|
|
|
458756
459776
|
fontsImported
|
|
458757
459777
|
};
|
|
458758
459778
|
}
|
|
459779
|
+
getEmbeddedFontFaces() {
|
|
459780
|
+
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
459781
|
+
if (!fontTable || !Object.keys(this.fonts).length)
|
|
459782
|
+
return [];
|
|
459783
|
+
const wFonts = fontTable.elements?.find((el) => el.name === "w:fonts");
|
|
459784
|
+
const embeddedEntries = wFonts?.elements?.filter((el) => el.elements?.some((nested) => nested?.attributes?.["r:id"] && nested?.attributes?.["w:fontKey"])) ?? [];
|
|
459785
|
+
const embedElements = embeddedEntries.flatMap((entry) => (entry.elements ?? []).filter((el) => el.name?.startsWith("w:embed")).map((el) => ({ embed: el, family: entry.attributes?.["w:name"] })));
|
|
459786
|
+
const rels = this.convertedXml["word/_rels/fontTable.xml.rels"];
|
|
459787
|
+
const relElements = rels?.elements?.find((el) => el.name === "Relationships")?.elements ?? [];
|
|
459788
|
+
const faceFromEmbedName = (name = "") => ({
|
|
459789
|
+
weight: /bold/i.test(name) ? "700" : "400",
|
|
459790
|
+
style: /italic/i.test(name) ? "italic" : "normal"
|
|
459791
|
+
});
|
|
459792
|
+
const faces = [];
|
|
459793
|
+
for (const { embed, family: family3 } of embedElements) {
|
|
459794
|
+
const relationshipId = embed.attributes?.["r:id"];
|
|
459795
|
+
const fontKey = embed.attributes?.["w:fontKey"];
|
|
459796
|
+
if (!family3 || !relationshipId || !fontKey)
|
|
459797
|
+
continue;
|
|
459798
|
+
const filePath = relElements.find((el) => el.attributes?.Id === relationshipId)?.attributes?.Target;
|
|
459799
|
+
if (!filePath)
|
|
459800
|
+
continue;
|
|
459801
|
+
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
459802
|
+
if (!fontUint8Array?.buffer)
|
|
459803
|
+
continue;
|
|
459804
|
+
const sourceBytes = fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength);
|
|
459805
|
+
const ttf = deobfuscateFont2(sourceBytes, fontKey);
|
|
459806
|
+
if (!ttf)
|
|
459807
|
+
continue;
|
|
459808
|
+
const policy = parseEmbeddingPolicy2(ttf);
|
|
459809
|
+
const fallback = faceFromEmbedName(embed.name);
|
|
459810
|
+
faces.push({
|
|
459811
|
+
family: family3,
|
|
459812
|
+
source: ttf,
|
|
459813
|
+
weight: policy?.face.weight ?? fallback.weight,
|
|
459814
|
+
style: policy?.face.style ?? fallback.style,
|
|
459815
|
+
fsType: policy?.fsType ?? null,
|
|
459816
|
+
embeddable: policy ? policy.embeddable : false,
|
|
459817
|
+
relationshipId
|
|
459818
|
+
});
|
|
459819
|
+
}
|
|
459820
|
+
return faces;
|
|
459821
|
+
}
|
|
458759
459822
|
getDocumentInternalId() {
|
|
458760
459823
|
const settingsLocation = "word/settings.xml";
|
|
458761
459824
|
if (!this.convertedXml[settingsLocation]) {
|
|
@@ -480909,9 +481972,9 @@ function findDonorMarkerFont2(abstract) {
|
|
|
480909
481972
|
continue;
|
|
480910
481973
|
if (rFontsHasSymbolFont2(rFonts))
|
|
480911
481974
|
continue;
|
|
480912
|
-
const
|
|
480913
|
-
if (
|
|
480914
|
-
return
|
|
481975
|
+
const family3 = readRFontsFamily2(rFonts);
|
|
481976
|
+
if (family3)
|
|
481977
|
+
return family3;
|
|
480915
481978
|
}
|
|
480916
481979
|
return;
|
|
480917
481980
|
}
|