@superdoc-dev/cli 0.16.0-next.30 → 0.16.0-next.32

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.
Files changed (2) hide show
  1. package/dist/index.js +1525 -1018
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -68373,7 +68373,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
68373
68373
  emptyOptions2 = {};
68374
68374
  });
68375
68375
 
68376
- // ../../packages/superdoc/dist/chunks/SuperConverter-bEQ45IUD.es.js
68376
+ // ../../packages/superdoc/dist/chunks/SuperConverter-BVWG4qnQ.es.js
68377
68377
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68378
68378
  const fieldValue = extension$1.config[field];
68379
68379
  if (typeof fieldValue === "function")
@@ -102487,6 +102487,315 @@ function translateMark(mark) {
102487
102487
  }
102488
102488
  return markElement;
102489
102489
  }
102490
+ function isSettled(status) {
102491
+ return SETTLED_STATUSES.includes(status);
102492
+ }
102493
+ function normalizeFamilyKey$1(family$1) {
102494
+ return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
102495
+ }
102496
+ function sortPairs(pairs) {
102497
+ return pairs.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
102498
+ }
102499
+ function deriveBundledSubstitutes() {
102500
+ const substitutes = {};
102501
+ for (const row of SUBSTITUTION_EVIDENCE)
102502
+ if (row.policyAction === "substitute" && row.physicalFamily)
102503
+ substitutes[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
102504
+ return Object.freeze(substitutes);
102505
+ }
102506
+ function deriveCategoryFallbacks() {
102507
+ const fallbacks = {};
102508
+ for (const row of SUBSTITUTION_EVIDENCE)
102509
+ if (row.policyAction === "category_fallback" && row.physicalFamily)
102510
+ fallbacks[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
102511
+ return Object.freeze(fallbacks);
102512
+ }
102513
+ function stripFamilyQuotes(family$1) {
102514
+ return family$1.trim().replace(/^["']|["']$/g, "");
102515
+ }
102516
+ function splitStack(cssFontFamily) {
102517
+ return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
102518
+ }
102519
+ function createFontResolver() {
102520
+ return new FontResolver;
102521
+ }
102522
+ function resolveFontFamily(logicalFamily) {
102523
+ return defaultResolver.resolveFontFamily(logicalFamily);
102524
+ }
102525
+ function resolvePhysicalFamily(cssFontFamily) {
102526
+ return defaultResolver.resolvePhysicalFamily(cssFontFamily);
102527
+ }
102528
+ function resolveFace(logicalFamily, face, hasFace) {
102529
+ return defaultResolver.resolveFace(logicalFamily, face, hasFace);
102530
+ }
102531
+ function getFontConfigVersion() {
102532
+ return fontConfigVersion;
102533
+ }
102534
+ function bumpFontConfigVersion() {
102535
+ return fontConfigVersion += 1;
102536
+ }
102537
+ function fourFaces(filePrefix) {
102538
+ return [
102539
+ {
102540
+ weight: "normal",
102541
+ style: "normal",
102542
+ file: `${filePrefix}-Regular.woff2`
102543
+ },
102544
+ {
102545
+ weight: "bold",
102546
+ style: "normal",
102547
+ file: `${filePrefix}-Bold.woff2`
102548
+ },
102549
+ {
102550
+ weight: "normal",
102551
+ style: "italic",
102552
+ file: `${filePrefix}-Italic.woff2`
102553
+ },
102554
+ {
102555
+ weight: "bold",
102556
+ style: "italic",
102557
+ file: `${filePrefix}-BoldItalic.woff2`
102558
+ }
102559
+ ];
102560
+ }
102561
+ function family(name, filePrefix, license) {
102562
+ return {
102563
+ family: name,
102564
+ license,
102565
+ faces: fourFaces(filePrefix)
102566
+ };
102567
+ }
102568
+ function withTrailingSlash(base$1) {
102569
+ return base$1.endsWith("/") ? base$1 : `${base$1}/`;
102570
+ }
102571
+ function joinUrl(base$1, file) {
102572
+ return `${withTrailingSlash(base$1)}${file}`;
102573
+ }
102574
+ function weightToken(weight) {
102575
+ return weight === "bold" ? "700" : "400";
102576
+ }
102577
+ function bundledAssetSignature(resolve2) {
102578
+ const family$1 = BUNDLED_MANIFEST[0];
102579
+ const face = family$1?.faces[0];
102580
+ if (!family$1 || !face)
102581
+ return "";
102582
+ return resolve2({
102583
+ file: face.file,
102584
+ family: family$1.family,
102585
+ weight: weightToken(face.weight),
102586
+ style: face.style,
102587
+ source: "bundled-substitute"
102588
+ });
102589
+ }
102590
+ function installBundledSubstitutes(registry, options = {}) {
102591
+ const resolve2 = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
102592
+ const signature = bundledAssetSignature(resolve2);
102593
+ const installed = installedRegistries.get(registry);
102594
+ if (installed !== undefined) {
102595
+ if (installed !== signature)
102596
+ 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.`);
102597
+ return;
102598
+ }
102599
+ installedRegistries.set(registry, signature);
102600
+ for (const family$1 of BUNDLED_MANIFEST)
102601
+ for (const face of family$1.faces) {
102602
+ const context = {
102603
+ file: face.file,
102604
+ family: family$1.family,
102605
+ weight: weightToken(face.weight),
102606
+ style: face.style,
102607
+ source: "bundled-substitute"
102608
+ };
102609
+ registry.register({
102610
+ family: family$1.family,
102611
+ source: `url(${resolve2(context)})`,
102612
+ descriptors: {
102613
+ weight: face.weight,
102614
+ style: face.style
102615
+ }
102616
+ });
102617
+ }
102618
+ }
102619
+ function buildFontReport(logicalFamilies, registry, resolver$1) {
102620
+ const seen = /* @__PURE__ */ new Set;
102621
+ const report = [];
102622
+ for (const logical of logicalFamilies) {
102623
+ if (!logical || seen.has(logical))
102624
+ continue;
102625
+ seen.add(logical);
102626
+ const { physicalFamily, reason } = resolver$1 ? resolver$1.resolveFontFamily(logical) : resolveFontFamily(logical);
102627
+ const loadStatus = registry.getStatus(physicalFamily);
102628
+ report.push({
102629
+ logicalFamily: logical,
102630
+ physicalFamily,
102631
+ reason,
102632
+ loadStatus,
102633
+ exportFamily: logical,
102634
+ missing: reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded"
102635
+ });
102636
+ }
102637
+ return report;
102638
+ }
102639
+ function buildFaceReport(usedFaces, registry, resolver$1) {
102640
+ const hasFace = (family$1, weight, style) => registry.hasFace(family$1, weight, style);
102641
+ const seen = /* @__PURE__ */ new Set;
102642
+ const report = [];
102643
+ for (const { logicalFamily, weight, style } of usedFaces) {
102644
+ if (!logicalFamily)
102645
+ continue;
102646
+ const key = `${logicalFamily.toLowerCase()}|${weight}|${style}`;
102647
+ if (seen.has(key))
102648
+ continue;
102649
+ seen.add(key);
102650
+ const face = {
102651
+ weight,
102652
+ style
102653
+ };
102654
+ const { physicalFamily, reason } = resolver$1 ? resolver$1.resolveFace(logicalFamily, face, hasFace) : resolveFace(logicalFamily, face, hasFace);
102655
+ const loadStatus = registry.getFaceStatus({
102656
+ family: physicalFamily,
102657
+ weight,
102658
+ style
102659
+ });
102660
+ const missing = reason === "fallback_face_absent" || reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded";
102661
+ report.push({
102662
+ logicalFamily,
102663
+ physicalFamily: reason === "registered_face" ? logicalFamily : physicalFamily,
102664
+ reason,
102665
+ loadStatus,
102666
+ exportFamily: logicalFamily,
102667
+ missing,
102668
+ face
102669
+ });
102670
+ }
102671
+ return report;
102672
+ }
102673
+ function parseEmbeddingPolicy(bytes) {
102674
+ const view = bytes instanceof ArrayBuffer ? new DataView(bytes) : new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
102675
+ if (view.byteLength < SFNT_TABLE_DIR_OFFSET)
102676
+ return null;
102677
+ const numTables = view.getUint16(4);
102678
+ let os2Offset = -1;
102679
+ for (let i$1 = 0;i$1 < numTables; i$1 += 1) {
102680
+ const record = SFNT_TABLE_DIR_OFFSET + i$1 * SFNT_TABLE_RECORD_SIZE;
102681
+ if (record + SFNT_TABLE_RECORD_SIZE > view.byteLength)
102682
+ return null;
102683
+ if (String.fromCharCode(view.getUint8(record), view.getUint8(record + 1), view.getUint8(record + 2), view.getUint8(record + 3)) === "OS/2") {
102684
+ os2Offset = view.getUint32(record + 8);
102685
+ break;
102686
+ }
102687
+ }
102688
+ if (os2Offset < 0 || os2Offset + OS2_MIN_LENGTH > view.byteLength)
102689
+ return null;
102690
+ const usWeightClass = view.getUint16(os2Offset + OS2_USWEIGHTCLASS);
102691
+ const fsType = view.getUint16(os2Offset + OS2_FSTYPE);
102692
+ const fsSelection = view.getUint16(os2Offset + OS2_FSSELECTION);
102693
+ return {
102694
+ fsType,
102695
+ face: {
102696
+ weight: usWeightClass >= BOLD_WEIGHT_THRESHOLD ? "700" : "400",
102697
+ style: (fsSelection & FS_SELECTION_ITALIC) !== 0 ? "italic" : "normal"
102698
+ },
102699
+ embeddable: (fsType & FS_TYPE_RESTRICTED) === 0
102700
+ };
102701
+ }
102702
+ function quoteFamily(family$1) {
102703
+ return `"${family$1.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
102704
+ }
102705
+ function canonicalizeFontSource(source) {
102706
+ const match = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
102707
+ if (!match)
102708
+ return source;
102709
+ let inner = match[1].trim();
102710
+ if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'"))
102711
+ inner = inner.slice(1, -1);
102712
+ return `url(${JSON.stringify(inner)})`;
102713
+ }
102714
+ function normalizeFamilyKey(family$1) {
102715
+ return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
102716
+ }
102717
+ function normalizeWeight(weight) {
102718
+ if (weight === undefined)
102719
+ return "400";
102720
+ const w = String(weight).trim().toLowerCase();
102721
+ if (w === "bold" || w === "bolder")
102722
+ return "700";
102723
+ const n = Number(w);
102724
+ return Number.isFinite(n) && n >= 600 ? "700" : "400";
102725
+ }
102726
+ function normalizeStyle(style) {
102727
+ if (!style)
102728
+ return "normal";
102729
+ const s = style.trim().toLowerCase();
102730
+ return s.startsWith("italic") || s.startsWith("oblique") ? "italic" : "normal";
102731
+ }
102732
+ function faceKeyOf(family$1, weight, style) {
102733
+ return `${normalizeFamilyKey(family$1)}|${weight}|${style}`;
102734
+ }
102735
+ function faceProbe(family$1, weight, style, size2) {
102736
+ return `${style === "italic" ? "italic " : ""}${weight} ${size2} ${quoteFamily(family$1)}`;
102737
+ }
102738
+ function getFontRegistryFor(fontSet, FontFaceCtor) {
102739
+ if (!fontSet) {
102740
+ if (!domlessRegistry)
102741
+ domlessRegistry = new FontRegistry({});
102742
+ return domlessRegistry;
102743
+ }
102744
+ let registry = registriesByFontSet.get(fontSet);
102745
+ if (!registry) {
102746
+ registry = new FontRegistry({
102747
+ fontSet,
102748
+ FontFaceCtor
102749
+ });
102750
+ registriesByFontSet.set(fontSet, registry);
102751
+ }
102752
+ return registry;
102753
+ }
102754
+ function classifyOffering(policyAction, verdict, physicalFamily, bundled) {
102755
+ if (policyAction === "preserve_only")
102756
+ return "preserve_only";
102757
+ if (policyAction === "customer_supplied" || physicalFamily == null)
102758
+ return "customer_supplied";
102759
+ if (policyAction === "category_fallback")
102760
+ return "category_fallback";
102761
+ if (!bundled)
102762
+ return "requires_asset";
102763
+ return verdict === "metric_safe" ? "default" : "qualified";
102764
+ }
102765
+ function deriveOfferings() {
102766
+ const offerings = SUBSTITUTION_EVIDENCE.map((row) => {
102767
+ const bundled = row.physicalFamily != null && BUNDLED_FAMILIES.has(row.physicalFamily);
102768
+ return {
102769
+ logicalFamily: row.logicalFamily,
102770
+ physicalFamily: row.physicalFamily,
102771
+ generic: row.physicalFamily && PHYSICAL_GENERIC[row.physicalFamily] || "sans-serif",
102772
+ offering: classifyOffering(row.policyAction, row.verdict, row.physicalFamily, bundled),
102773
+ bundled,
102774
+ verdict: row.verdict,
102775
+ evidenceId: row.evidenceId
102776
+ };
102777
+ });
102778
+ return Object.freeze(offerings);
102779
+ }
102780
+ function getDefaultFontOfferings() {
102781
+ const rank$1 = (name) => {
102782
+ const i$1 = DEFAULT_FONT_ORDER.indexOf(name);
102783
+ return i$1 === -1 ? DEFAULT_FONT_ORDER.length : i$1;
102784
+ };
102785
+ return FONT_OFFERINGS.filter((o) => o.offering === "default").sort((a, b) => rank$1(a.logicalFamily) - rank$1(b.logicalFamily));
102786
+ }
102787
+ function fontOfferingStack(offering) {
102788
+ return `${offering.logicalFamily}, ${offering.generic}`;
102789
+ }
102790
+ function fontOfferingRenderStack(offering) {
102791
+ return offering.physicalFamily ? `${offering.physicalFamily}, ${offering.generic}` : fontOfferingStack(offering);
102792
+ }
102793
+ function getDefaultFontFamilyOptions() {
102794
+ return getDefaultFontOfferings().map((offering) => ({
102795
+ label: offering.logicalFamily,
102796
+ value: fontOfferingStack(offering)
102797
+ }));
102798
+ }
102490
102799
  function writeAppStatistics(convertedXml, stats) {
102491
102800
  const elements = ensureElements$1(ensureAppPropertiesRoot(convertedXml));
102492
102801
  upsertSimpleElement(elements, "Words", String(stats.words));
@@ -114911,7 +115220,7 @@ var isRegExp = (value) => {
114911
115220
  if (encodedAttrs && Object.keys(encodedAttrs).length > 0)
114912
115221
  translated.attrs = { ...encodedAttrs };
114913
115222
  return translated;
114914
- }, config$35, translator$4, EAST_ASIAN_CHARACTER_REGEX, containsEastAsianCharacters = (text$2) => EAST_ASIAN_CHARACTER_REGEX.test(text$2), resolveFontFamily = (textStyleAttrs, text$2) => {
115223
+ }, config$35, translator$4, EAST_ASIAN_CHARACTER_REGEX, containsEastAsianCharacters = (text$2) => EAST_ASIAN_CHARACTER_REGEX.test(text$2), resolveFontFamily$1 = (textStyleAttrs, text$2) => {
114915
115224
  if (!text$2)
114916
115225
  return textStyleAttrs;
114917
115226
  const eastAsiaFont = textStyleAttrs?.eastAsiaFontFamily;
@@ -115724,7 +116033,7 @@ var isRegExp = (value) => {
115724
116033
  ...textStyleMark.attrs || {},
115725
116034
  ...mark.attrs || {}
115726
116035
  };
115727
- textStyleMark.attrs = resolveFontFamily(textStyleMark.attrs, child?.text);
116036
+ textStyleMark.attrs = resolveFontFamily$1(textStyleMark.attrs, child?.text);
115728
116037
  }
115729
116038
  return false;
115730
116039
  }
@@ -129218,7 +129527,537 @@ var isRegExp = (value) => {
129218
129527
  tags.push(`</${name}>`);
129219
129528
  return tags;
129220
129529
  }
129221
- }, prepareCommentParaIds = (comment) => {
129530
+ }, SETTLED_STATUSES, SUBSTITUTION_EVIDENCE, BUNDLED_SUBSTITUTES, CATEGORY_FALLBACKS, FontResolver = class {
129531
+ #overrides = /* @__PURE__ */ new Map;
129532
+ #embedded = /* @__PURE__ */ new Map;
129533
+ #version = 0;
129534
+ #cachedSignature = null;
129535
+ map(logicalFamily, physicalFamily) {
129536
+ const key = normalizeFamilyKey$1(logicalFamily);
129537
+ const physical = physicalFamily?.trim();
129538
+ if (!key || !physical)
129539
+ return;
129540
+ if (this.#overrides.get(key) === physical)
129541
+ return;
129542
+ if (key === normalizeFamilyKey$1(physical)) {
129543
+ if (this.#overrides.delete(key)) {
129544
+ this.#version += 1;
129545
+ this.#cachedSignature = null;
129546
+ }
129547
+ return;
129548
+ }
129549
+ this.#overrides.set(key, physical);
129550
+ this.#version += 1;
129551
+ this.#cachedSignature = null;
129552
+ }
129553
+ unmap(logicalFamily) {
129554
+ if (this.#overrides.delete(normalizeFamilyKey$1(logicalFamily))) {
129555
+ this.#version += 1;
129556
+ this.#cachedSignature = null;
129557
+ }
129558
+ }
129559
+ mapEmbedded(logicalFamily, physicalFamily) {
129560
+ const key = normalizeFamilyKey$1(logicalFamily);
129561
+ const physical = physicalFamily?.trim();
129562
+ if (!key || !physical)
129563
+ return;
129564
+ if (this.#embedded.get(key) === physical)
129565
+ return;
129566
+ this.#embedded.set(key, physical);
129567
+ this.#version += 1;
129568
+ this.#cachedSignature = null;
129569
+ }
129570
+ clearEmbedded() {
129571
+ if (this.#embedded.size === 0)
129572
+ return;
129573
+ this.#embedded.clear();
129574
+ this.#version += 1;
129575
+ this.#cachedSignature = null;
129576
+ }
129577
+ reset() {
129578
+ if (this.#overrides.size === 0 && this.#embedded.size === 0)
129579
+ return;
129580
+ this.#overrides.clear();
129581
+ this.#embedded.clear();
129582
+ this.#version += 1;
129583
+ this.#cachedSignature = null;
129584
+ }
129585
+ get version() {
129586
+ return this.#version;
129587
+ }
129588
+ get signature() {
129589
+ if (this.#cachedSignature !== null)
129590
+ return this.#cachedSignature;
129591
+ if (this.#overrides.size === 0 && this.#embedded.size === 0)
129592
+ this.#cachedSignature = "";
129593
+ else {
129594
+ const overridePairs = sortPairs([...this.#overrides.entries()]);
129595
+ this.#cachedSignature = this.#embedded.size === 0 ? JSON.stringify(overridePairs) : JSON.stringify({
129596
+ o: overridePairs,
129597
+ e: sortPairs([...this.#embedded.entries()])
129598
+ });
129599
+ }
129600
+ return this.#cachedSignature;
129601
+ }
129602
+ #physicalFor(bareFamily) {
129603
+ const key = normalizeFamilyKey$1(bareFamily);
129604
+ const override = this.#overrides.get(key);
129605
+ if (override)
129606
+ return {
129607
+ physical: override,
129608
+ reason: "custom_mapping"
129609
+ };
129610
+ const bundled = BUNDLED_SUBSTITUTES[key];
129611
+ if (bundled)
129612
+ return {
129613
+ physical: bundled,
129614
+ reason: "bundled_substitute"
129615
+ };
129616
+ const category = CATEGORY_FALLBACKS[key];
129617
+ if (category)
129618
+ return {
129619
+ physical: category,
129620
+ reason: "category_fallback"
129621
+ };
129622
+ return {
129623
+ physical: bareFamily,
129624
+ reason: "as_requested"
129625
+ };
129626
+ }
129627
+ #resolveFaceLadder(primary, face, hasFace) {
129628
+ const key = normalizeFamilyKey$1(primary);
129629
+ const override = this.#overrides.get(key);
129630
+ if (override && hasFace(override, face.weight, face.style))
129631
+ return {
129632
+ physical: override,
129633
+ reason: "custom_mapping"
129634
+ };
129635
+ const embedded = this.#embedded.get(key);
129636
+ if (embedded && hasFace(embedded, face.weight, face.style))
129637
+ return {
129638
+ physical: embedded,
129639
+ reason: "registered_face"
129640
+ };
129641
+ if (hasFace(primary, face.weight, face.style))
129642
+ return {
129643
+ physical: primary,
129644
+ reason: "registered_face"
129645
+ };
129646
+ const bundled = BUNDLED_SUBSTITUTES[key];
129647
+ if (bundled && hasFace(bundled, face.weight, face.style))
129648
+ return {
129649
+ physical: bundled,
129650
+ reason: "bundled_substitute"
129651
+ };
129652
+ const category = CATEGORY_FALLBACKS[key];
129653
+ if (category && hasFace(category, face.weight, face.style))
129654
+ return {
129655
+ physical: category,
129656
+ reason: "category_fallback"
129657
+ };
129658
+ if (override || bundled)
129659
+ return {
129660
+ physical: primary,
129661
+ reason: "fallback_face_absent"
129662
+ };
129663
+ return {
129664
+ physical: primary,
129665
+ reason: "as_requested"
129666
+ };
129667
+ }
129668
+ resolveFontFamily(logicalFamily) {
129669
+ const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
129670
+ const { physical, reason } = this.#physicalFor(primary);
129671
+ return {
129672
+ logicalFamily,
129673
+ physicalFamily: stripFamilyQuotes(physical),
129674
+ reason
129675
+ };
129676
+ }
129677
+ resolvePhysicalFamily(cssFontFamily) {
129678
+ if (!cssFontFamily)
129679
+ return cssFontFamily;
129680
+ const parts = splitStack(cssFontFamily);
129681
+ if (parts.length === 0)
129682
+ return cssFontFamily;
129683
+ const { physical, reason } = this.#physicalFor(parts[0]);
129684
+ if (reason === "as_requested")
129685
+ return cssFontFamily;
129686
+ return [physical, ...parts.slice(1)].join(", ");
129687
+ }
129688
+ resolveFace(logicalFamily, face, hasFace) {
129689
+ const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
129690
+ const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
129691
+ return {
129692
+ logicalFamily,
129693
+ physicalFamily: stripFamilyQuotes(physical),
129694
+ reason
129695
+ };
129696
+ }
129697
+ resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
129698
+ if (!cssFontFamily)
129699
+ return cssFontFamily;
129700
+ const parts = splitStack(cssFontFamily);
129701
+ if (parts.length === 0)
129702
+ return cssFontFamily;
129703
+ const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
129704
+ if (normalizeFamilyKey$1(physical) !== normalizeFamilyKey$1(parts[0]))
129705
+ return [physical, ...parts.slice(1)].join(", ");
129706
+ return cssFontFamily;
129707
+ }
129708
+ resolvePrimaryPhysicalFamily(family$1) {
129709
+ const primary = splitStack(family$1)[0] ?? family$1;
129710
+ return this.#physicalFor(primary).physical;
129711
+ }
129712
+ resolvePhysicalFamilies(families) {
129713
+ const out = /* @__PURE__ */ new Set;
129714
+ for (const family$1 of families)
129715
+ if (family$1)
129716
+ out.add(this.resolvePrimaryPhysicalFamily(family$1));
129717
+ return [...out];
129718
+ }
129719
+ }, 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 {
129720
+ #fontSet;
129721
+ #FontFaceCtor;
129722
+ #probeSize;
129723
+ #scheduleTimeout;
129724
+ #cancelTimeout;
129725
+ #managed = /* @__PURE__ */ new Map;
129726
+ #facesByKey = /* @__PURE__ */ new Map;
129727
+ #status = /* @__PURE__ */ new Map;
129728
+ #sources = /* @__PURE__ */ new Map;
129729
+ #warnedFailures = /* @__PURE__ */ new Set;
129730
+ #inflight = /* @__PURE__ */ new Map;
129731
+ #faceStatus = /* @__PURE__ */ new Map;
129732
+ #faceInflight = /* @__PURE__ */ new Map;
129733
+ #faceSources = /* @__PURE__ */ new Map;
129734
+ #facesByFamily = /* @__PURE__ */ new Map;
129735
+ #providerFaceKeys = /* @__PURE__ */ new Set;
129736
+ #warnedFaceFailures = /* @__PURE__ */ new Set;
129737
+ constructor(options = {}) {
129738
+ this.#fontSet = options.fontSet ?? null;
129739
+ this.#FontFaceCtor = options.FontFaceCtor ?? null;
129740
+ this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
129741
+ this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
129742
+ this.#cancelTimeout = options.cancelTimeout ?? ((handle2) => globalThis.clearTimeout(handle2));
129743
+ }
129744
+ register(descriptor) {
129745
+ const { family: family$1, source, descriptors: descriptors$1 } = descriptor;
129746
+ const identitySource = typeof source === "string" ? canonicalizeFontSource(source) : source;
129747
+ const weight = normalizeWeight(descriptors$1?.weight);
129748
+ const style = normalizeStyle(descriptors$1?.style);
129749
+ const key = faceKeyOf(family$1, weight, style);
129750
+ if (typeof identitySource === "string") {
129751
+ const existingSource = this.#faceSources.get(key);
129752
+ if (existingSource === identitySource)
129753
+ return {
129754
+ family: family$1,
129755
+ status: this.getStatus(family$1),
129756
+ changed: false
129757
+ };
129758
+ if (existingSource !== undefined)
129759
+ throw new Error(`[superdoc] font face "${key}" is already registered from a different source ("${existingSource}"); a registered face's source cannot be replaced`);
129760
+ }
129761
+ if (this.#FontFaceCtor && this.#fontSet) {
129762
+ const face = new this.#FontFaceCtor(family$1, source, {
129763
+ ...descriptors$1,
129764
+ weight,
129765
+ style
129766
+ });
129767
+ this.#fontSet.add(face);
129768
+ this.#addManagedFace(family$1, key, face);
129769
+ }
129770
+ if (typeof source === "string") {
129771
+ const list$1 = this.#sources.get(family$1) ?? [];
129772
+ if (!list$1.includes(source))
129773
+ list$1.push(source);
129774
+ this.#sources.set(family$1, list$1);
129775
+ }
129776
+ if (!this.#status.has(family$1))
129777
+ this.#status.set(family$1, "unloaded");
129778
+ this.#providerFaceKeys.add(key);
129779
+ this.#trackFace(family$1, key);
129780
+ if (!this.#faceStatus.has(key))
129781
+ this.#faceStatus.set(key, "unloaded");
129782
+ if (typeof identitySource === "string" && !this.#faceSources.has(key))
129783
+ this.#faceSources.set(key, identitySource);
129784
+ return {
129785
+ family: family$1,
129786
+ status: this.getStatus(family$1),
129787
+ changed: true
129788
+ };
129789
+ }
129790
+ #trackFace(family$1, key) {
129791
+ const fam = normalizeFamilyKey(family$1);
129792
+ const set = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
129793
+ set.add(key);
129794
+ this.#facesByFamily.set(fam, set);
129795
+ }
129796
+ isManaged(family$1) {
129797
+ return this.#managed.has(family$1);
129798
+ }
129799
+ registerOwnedFace(descriptor) {
129800
+ const { family: family$1, source, weight, style } = descriptor;
129801
+ if (!this.#FontFaceCtor || !this.#fontSet)
129802
+ return null;
129803
+ const key = faceKeyOf(family$1, weight, style);
129804
+ const face = new this.#FontFaceCtor(family$1, source, {
129805
+ weight,
129806
+ style
129807
+ });
129808
+ this.#fontSet.add(face);
129809
+ this.#addManagedFace(family$1, key, face);
129810
+ this.#providerFaceKeys.add(key);
129811
+ if (!this.#status.has(family$1))
129812
+ this.#status.set(family$1, "unloaded");
129813
+ this.#trackFace(family$1, key);
129814
+ if (!this.#faceStatus.has(key))
129815
+ this.#faceStatus.set(key, "unloaded");
129816
+ let released = false;
129817
+ return () => {
129818
+ if (released)
129819
+ return false;
129820
+ released = true;
129821
+ return this.#removeManagedFace(family$1, key, face);
129822
+ };
129823
+ }
129824
+ #addManagedFace(family$1, key, face) {
129825
+ this.#managed.set(family$1, face);
129826
+ let set = this.#facesByKey.get(key);
129827
+ if (!set) {
129828
+ set = /* @__PURE__ */ new Set;
129829
+ this.#facesByKey.set(key, set);
129830
+ }
129831
+ set.add(face);
129832
+ }
129833
+ #removeManagedFace(family$1, key, face) {
129834
+ const set = this.#facesByKey.get(key);
129835
+ if (!set || !set.delete(face))
129836
+ return false;
129837
+ if (typeof this.#fontSet?.delete === "function")
129838
+ this.#fontSet.delete(face);
129839
+ if (set.size > 0)
129840
+ return true;
129841
+ this.#facesByKey.delete(key);
129842
+ this.#providerFaceKeys.delete(key);
129843
+ this.#faceStatus.delete(key);
129844
+ this.#faceSources.delete(key);
129845
+ const fam = normalizeFamilyKey(family$1);
129846
+ const keys$1 = this.#facesByFamily.get(fam);
129847
+ if (keys$1) {
129848
+ keys$1.delete(key);
129849
+ if (keys$1.size === 0) {
129850
+ this.#facesByFamily.delete(fam);
129851
+ this.#managed.delete(family$1);
129852
+ this.#status.delete(family$1);
129853
+ this.#sources.delete(family$1);
129854
+ }
129855
+ }
129856
+ return true;
129857
+ }
129858
+ getStatus(family$1) {
129859
+ const statuses = [];
129860
+ const faceKeys = this.#facesByFamily.get(normalizeFamilyKey(family$1));
129861
+ if (faceKeys)
129862
+ for (const k of faceKeys)
129863
+ statuses.push(this.#faceStatus.get(k) ?? "unloaded");
129864
+ const legacy = this.#status.get(family$1);
129865
+ if (legacy)
129866
+ statuses.push(legacy);
129867
+ if (statuses.length === 0)
129868
+ return "unloaded";
129869
+ for (const s of [
129870
+ "failed",
129871
+ "timed_out",
129872
+ "fallback_used",
129873
+ "loaded",
129874
+ "loading",
129875
+ "unloaded"
129876
+ ])
129877
+ if (statuses.includes(s))
129878
+ return s;
129879
+ return "unloaded";
129880
+ }
129881
+ hasFace(family$1, weight, style) {
129882
+ const key = faceKeyOf(family$1, weight, style);
129883
+ return this.#providerFaceKeys.has(key) && this.#faceStatus.get(key) !== "failed";
129884
+ }
129885
+ isAvailable(family$1) {
129886
+ if (!this.#fontSet)
129887
+ return false;
129888
+ try {
129889
+ return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
129890
+ } catch {
129891
+ return false;
129892
+ }
129893
+ }
129894
+ awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
129895
+ if (this.#status.get(family$1) === "loaded")
129896
+ return Promise.resolve({
129897
+ family: family$1,
129898
+ status: "loaded"
129899
+ });
129900
+ const existing = this.#inflight.get(family$1);
129901
+ if (existing)
129902
+ return existing;
129903
+ const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
129904
+ this.#inflight.delete(family$1);
129905
+ });
129906
+ this.#inflight.set(family$1, probe);
129907
+ return probe;
129908
+ }
129909
+ async awaitFaces(families, options = {}) {
129910
+ const unique = [...new Set(families)];
129911
+ const timeoutMs = options.timeoutMs ?? 3000;
129912
+ return Promise.all(unique.map((family$1) => this.awaitFace(family$1, timeoutMs)));
129913
+ }
129914
+ getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
129915
+ return [...new Set(families)].map((family$1) => ({
129916
+ family: family$1,
129917
+ status: this.getStatus(family$1),
129918
+ ready: this.awaitFace(family$1, timeoutMs)
129919
+ }));
129920
+ }
129921
+ getStates() {
129922
+ return [...this.#status.entries()].map(([family$1, status]) => ({
129923
+ family: family$1,
129924
+ status
129925
+ }));
129926
+ }
129927
+ getFaceStatus(request) {
129928
+ return this.#faceStatus.get(faceKeyOf(request.family, request.weight, request.style)) ?? "unloaded";
129929
+ }
129930
+ awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
129931
+ const key = faceKeyOf(request.family, request.weight, request.style);
129932
+ if (this.#faceStatus.get(key) === "loaded")
129933
+ return Promise.resolve({
129934
+ request,
129935
+ status: "loaded"
129936
+ });
129937
+ const existing = this.#faceInflight.get(key);
129938
+ if (existing)
129939
+ return existing;
129940
+ const probe = this.#loadOneFace(request, key, timeoutMs).finally(() => {
129941
+ this.#faceInflight.delete(key);
129942
+ });
129943
+ this.#faceInflight.set(key, probe);
129944
+ return probe;
129945
+ }
129946
+ async awaitFaceRequests(requests, options = {}) {
129947
+ const timeoutMs = options.timeoutMs ?? 3000;
129948
+ const seen = /* @__PURE__ */ new Set;
129949
+ const unique = [];
129950
+ for (const r of requests) {
129951
+ const key = faceKeyOf(r.family, r.weight, r.style);
129952
+ if (seen.has(key))
129953
+ continue;
129954
+ seen.add(key);
129955
+ unique.push(r);
129956
+ }
129957
+ return Promise.all(unique.map((r) => this.awaitFaceRequest(r, timeoutMs)));
129958
+ }
129959
+ async#loadOneFace(request, key, timeoutMs) {
129960
+ this.#trackFace(request.family, key);
129961
+ const fontSet = this.#fontSet;
129962
+ if (!fontSet) {
129963
+ this.#faceStatus.set(key, "fallback_used");
129964
+ return {
129965
+ request,
129966
+ status: "fallback_used"
129967
+ };
129968
+ }
129969
+ this.#faceStatus.set(key, "loading");
129970
+ const probe = faceProbe(request.family, request.weight, request.style, this.#probeSize);
129971
+ const TIMEOUT = Symbol("timeout");
129972
+ let handle2;
129973
+ const timeout = new Promise((resolve2) => {
129974
+ handle2 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
129975
+ });
129976
+ try {
129977
+ const settled = await Promise.race([fontSet.load(probe), timeout]);
129978
+ if (settled === TIMEOUT) {
129979
+ this.#faceStatus.set(key, "timed_out");
129980
+ return {
129981
+ request,
129982
+ status: "timed_out"
129983
+ };
129984
+ }
129985
+ const status = settled.length > 0 ? "loaded" : "fallback_used";
129986
+ this.#faceStatus.set(key, status);
129987
+ return {
129988
+ request,
129989
+ status
129990
+ };
129991
+ } catch {
129992
+ this.#faceStatus.set(key, "failed");
129993
+ this.#warnFaceFailureOnce(request, key);
129994
+ return {
129995
+ request,
129996
+ status: "failed"
129997
+ };
129998
+ } finally {
129999
+ this.#cancelTimeout(handle2);
130000
+ }
130001
+ }
130002
+ #warnFaceFailureOnce(request, key) {
130003
+ if (this.#warnedFaceFailures.has(key))
130004
+ return;
130005
+ this.#warnedFaceFailures.add(key);
130006
+ const src = this.#faceSources.get(key);
130007
+ const detail = src ? ` from ${src}` : "";
130008
+ 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.`);
130009
+ }
130010
+ async#loadOne(family$1, timeoutMs) {
130011
+ const fontSet = this.#fontSet;
130012
+ if (!fontSet) {
130013
+ this.#status.set(family$1, "fallback_used");
130014
+ return {
130015
+ family: family$1,
130016
+ status: "fallback_used"
130017
+ };
130018
+ }
130019
+ this.#status.set(family$1, "loading");
130020
+ const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
130021
+ const TIMEOUT = Symbol("timeout");
130022
+ let handle2;
130023
+ const timeout = new Promise((resolve2) => {
130024
+ handle2 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
130025
+ });
130026
+ try {
130027
+ const settled = await Promise.race([fontSet.load(probe), timeout]);
130028
+ if (settled === TIMEOUT) {
130029
+ this.#status.set(family$1, "timed_out");
130030
+ return {
130031
+ family: family$1,
130032
+ status: "timed_out"
130033
+ };
130034
+ }
130035
+ const status = settled.length > 0 ? "loaded" : "fallback_used";
130036
+ this.#status.set(family$1, status);
130037
+ return {
130038
+ family: family$1,
130039
+ status
130040
+ };
130041
+ } catch {
130042
+ this.#status.set(family$1, "failed");
130043
+ this.#warnLoadFailureOnce(family$1);
130044
+ return {
130045
+ family: family$1,
130046
+ status: "failed"
130047
+ };
130048
+ } finally {
130049
+ this.#cancelTimeout(handle2);
130050
+ }
130051
+ }
130052
+ #warnLoadFailureOnce(family$1) {
130053
+ if (this.#warnedFailures.has(family$1))
130054
+ return;
130055
+ this.#warnedFailures.add(family$1);
130056
+ const sources = this.#sources.get(family$1);
130057
+ const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
130058
+ console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
130059
+ }
130060
+ }, registriesByFontSet, domlessRegistry = null, PHYSICAL_GENERIC, BUNDLED_FAMILIES, FONT_OFFERINGS, DEFAULT_FONT_ORDER, prepareCommentParaIds = (comment) => {
129222
130061
  return {
129223
130062
  ...comment,
129224
130063
  commentParaId: generateDocxRandomId()
@@ -133194,7 +134033,7 @@ var isRegExp = (value) => {
133194
134033
  state.kern = kernNode.attributes["w:val"];
133195
134034
  }
133196
134035
  }, SuperConverter;
133197
- var init_SuperConverter_bEQ45IUD_es = __esm(() => {
134036
+ var init_SuperConverter_BVWG4qnQ_es = __esm(() => {
133198
134037
  init_rolldown_runtime_Bg48TavK_es();
133199
134038
  init_jszip_C49i9kUs_es();
133200
134039
  init_xml_js_CqGKpaft_es();
@@ -170513,6 +171352,246 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
170513
171352
  gutter: "0"
170514
171353
  })
170515
171354
  });
171355
+ SETTLED_STATUSES = [
171356
+ "loaded",
171357
+ "failed",
171358
+ "timed_out",
171359
+ "fallback_used"
171360
+ ];
171361
+ SUBSTITUTION_EVIDENCE = Object.freeze([
171362
+ {
171363
+ evidenceId: "calibri",
171364
+ logicalFamily: "Calibri",
171365
+ physicalFamily: "Carlito",
171366
+ verdict: "metric_safe",
171367
+ faces: {
171368
+ regular: true,
171369
+ bold: true,
171370
+ italic: true,
171371
+ boldItalic: true
171372
+ },
171373
+ advance: {
171374
+ meanDelta: 0,
171375
+ maxDelta: 0
171376
+ },
171377
+ gates: {
171378
+ static: "pass",
171379
+ metric: "pass",
171380
+ layout: "pass",
171381
+ ship: "pass"
171382
+ },
171383
+ policyAction: "substitute",
171384
+ measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
171385
+ candidateLicense: "OFL-1.1",
171386
+ exportRule: "preserve_original_name"
171387
+ },
171388
+ {
171389
+ evidenceId: "cambria",
171390
+ logicalFamily: "Cambria",
171391
+ physicalFamily: "Caladea",
171392
+ verdict: "visual_only",
171393
+ faceVerdicts: {
171394
+ regular: "metric_safe",
171395
+ bold: "metric_safe",
171396
+ italic: "metric_safe",
171397
+ boldItalic: "visual_only"
171398
+ },
171399
+ glyphExceptions: [{
171400
+ slot: "boldItalic",
171401
+ codepoint: 96,
171402
+ advanceDelta: 0.231,
171403
+ note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
171404
+ }],
171405
+ faces: {
171406
+ regular: true,
171407
+ bold: true,
171408
+ italic: true,
171409
+ boldItalic: true
171410
+ },
171411
+ advance: {
171412
+ meanDelta: 0.0002378,
171413
+ maxDelta: 0.2310758
171414
+ },
171415
+ gates: {
171416
+ static: "pass",
171417
+ metric: "pass",
171418
+ layout: "not_run",
171419
+ ship: "pass"
171420
+ },
171421
+ policyAction: "substitute",
171422
+ measurementRefs: [
171423
+ "cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
171424
+ "cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
171425
+ "cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
171426
+ "cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
171427
+ ],
171428
+ candidateLicense: "Apache-2.0",
171429
+ exportRule: "preserve_original_name"
171430
+ },
171431
+ {
171432
+ evidenceId: "arial",
171433
+ logicalFamily: "Arial",
171434
+ physicalFamily: "Liberation Sans",
171435
+ verdict: "metric_safe",
171436
+ faces: {
171437
+ regular: true,
171438
+ bold: true,
171439
+ italic: true,
171440
+ boldItalic: true
171441
+ },
171442
+ advance: {
171443
+ meanDelta: 0,
171444
+ maxDelta: 0
171445
+ },
171446
+ gates: {
171447
+ static: "pass",
171448
+ metric: "pass",
171449
+ layout: "not_run",
171450
+ ship: "pass"
171451
+ },
171452
+ policyAction: "substitute",
171453
+ measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
171454
+ candidateLicense: "OFL-1.1",
171455
+ exportRule: "preserve_original_name"
171456
+ },
171457
+ {
171458
+ evidenceId: "times-new-roman",
171459
+ logicalFamily: "Times New Roman",
171460
+ physicalFamily: "Liberation Serif",
171461
+ verdict: "metric_safe",
171462
+ faces: {
171463
+ regular: true,
171464
+ bold: true,
171465
+ italic: true,
171466
+ boldItalic: true
171467
+ },
171468
+ advance: {
171469
+ meanDelta: 0,
171470
+ maxDelta: 0
171471
+ },
171472
+ gates: {
171473
+ static: "pass",
171474
+ metric: "pass",
171475
+ layout: "not_run",
171476
+ ship: "pass"
171477
+ },
171478
+ policyAction: "substitute",
171479
+ measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
171480
+ candidateLicense: "OFL-1.1",
171481
+ exportRule: "preserve_original_name"
171482
+ },
171483
+ {
171484
+ evidenceId: "courier-new",
171485
+ logicalFamily: "Courier New",
171486
+ physicalFamily: "Liberation Mono",
171487
+ verdict: "metric_safe",
171488
+ faces: {
171489
+ regular: true,
171490
+ bold: true,
171491
+ italic: true,
171492
+ boldItalic: true
171493
+ },
171494
+ advance: {
171495
+ meanDelta: 0,
171496
+ maxDelta: 0
171497
+ },
171498
+ gates: {
171499
+ static: "pass",
171500
+ metric: "pass",
171501
+ layout: "not_run",
171502
+ ship: "pass"
171503
+ },
171504
+ policyAction: "substitute",
171505
+ measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
171506
+ candidateLicense: "OFL-1.1",
171507
+ exportRule: "preserve_original_name"
171508
+ },
171509
+ {
171510
+ evidenceId: "helvetica",
171511
+ logicalFamily: "Helvetica",
171512
+ physicalFamily: "Liberation Sans",
171513
+ verdict: "metric_safe",
171514
+ faces: {
171515
+ regular: true,
171516
+ bold: true,
171517
+ italic: true,
171518
+ boldItalic: true
171519
+ },
171520
+ advance: {
171521
+ meanDelta: 0,
171522
+ maxDelta: 0
171523
+ },
171524
+ gates: {
171525
+ static: "not_run",
171526
+ metric: "pass",
171527
+ layout: "not_run",
171528
+ ship: "fail"
171529
+ },
171530
+ policyAction: "substitute",
171531
+ measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
171532
+ candidateLicense: "OFL-1.1",
171533
+ exportRule: "preserve_original_name"
171534
+ },
171535
+ {
171536
+ evidenceId: "calibri-light",
171537
+ logicalFamily: "Calibri Light",
171538
+ physicalFamily: "Carlito",
171539
+ verdict: "visual_only",
171540
+ faces: {
171541
+ regular: false,
171542
+ bold: false,
171543
+ italic: false,
171544
+ boldItalic: false
171545
+ },
171546
+ advance: {
171547
+ meanDelta: 0.0148,
171548
+ maxDelta: 0.066
171549
+ },
171550
+ gates: {
171551
+ static: "not_run",
171552
+ metric: "fail",
171553
+ layout: "not_run",
171554
+ ship: "fail"
171555
+ },
171556
+ policyAction: "category_fallback",
171557
+ measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
171558
+ candidateLicense: "OFL-1.1",
171559
+ exportRule: "preserve_original_name"
171560
+ }
171561
+ ]);
171562
+ BUNDLED_SUBSTITUTES = deriveBundledSubstitutes();
171563
+ CATEGORY_FALLBACKS = deriveCategoryFallbacks();
171564
+ defaultResolver = new FontResolver;
171565
+ DEFAULT_FONT_MEASURE_CONTEXT = Object.freeze({
171566
+ resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily(cssFontFamily),
171567
+ fontSignature: ""
171568
+ });
171569
+ BUNDLED_MANIFEST = Object.freeze([
171570
+ family("Carlito", "Carlito", "OFL-1.1"),
171571
+ family("Caladea", "Caladea", "Apache-2.0"),
171572
+ family("Liberation Sans", "LiberationSans", "OFL-1.1"),
171573
+ family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
171574
+ family("Liberation Mono", "LiberationMono", "OFL-1.1")
171575
+ ]);
171576
+ installedRegistries = /* @__PURE__ */ new WeakMap;
171577
+ OS2_MIN_LENGTH = OS2_FSSELECTION + 2;
171578
+ registriesByFontSet = /* @__PURE__ */ new WeakMap;
171579
+ PHYSICAL_GENERIC = Object.freeze({
171580
+ Carlito: "sans-serif",
171581
+ Caladea: "serif",
171582
+ "Liberation Sans": "sans-serif",
171583
+ "Liberation Serif": "serif",
171584
+ "Liberation Mono": "monospace"
171585
+ });
171586
+ BUNDLED_FAMILIES = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
171587
+ FONT_OFFERINGS = deriveOfferings();
171588
+ DEFAULT_FONT_ORDER = [
171589
+ "Calibri",
171590
+ "Arial",
171591
+ "Courier New",
171592
+ "Times New Roman",
171593
+ "Helvetica"
171594
+ ];
170516
171595
  ALL_COMMENT_TARGETS = COMMENT_FILE_BASENAMES;
170517
171596
  REL_ID_NUMERIC_PATTERN = /rId|mi/g;
170518
171597
  FOOTNOTES_CONFIG$1 = {
@@ -171329,10 +172408,10 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
171329
172408
  return fontsNode.elements.find((el) => el?.attributes?.["w:name"] === fontName) || null;
171330
172409
  }
171331
172410
  static getFallbackFromFontTable(docx, fontName) {
171332
- const family = SuperConverter2.getFontTableEntry(docx, fontName)?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
171333
- if (!family)
172411
+ const family$1 = SuperConverter2.getFontTableEntry(docx, fontName)?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
172412
+ if (!family$1)
171334
172413
  return null;
171335
- return FONT_FAMILY_FALLBACKS[family.toLowerCase()] || DEFAULT_GENERIC_FALLBACK;
172414
+ return FONT_FAMILY_FALLBACKS[family$1.toLowerCase()] || DEFAULT_GENERIC_FALLBACK;
171336
172415
  }
171337
172416
  static toCssFontFamily(fontName, docx) {
171338
172417
  if (!fontName)
@@ -171762,13 +172841,16 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
171762
172841
  for (const font of fontsToInclude) {
171763
172842
  const filePath = elements.find((el) => el.attributes.Id === font.attributes["r:id"])?.attributes?.Target;
171764
172843
  if (!filePath)
171765
- return;
171766
- const fontBuffer = this.fonts[`word/${filePath}`]?.buffer;
171767
- if (!fontBuffer)
171768
- return;
171769
- const ttfBuffer = deobfuscateFont(fontBuffer, font.attributes["w:fontKey"]);
172844
+ continue;
172845
+ const fontUint8Array = this.fonts[`word/${filePath}`];
172846
+ if (!fontUint8Array?.buffer)
172847
+ continue;
172848
+ const ttfBuffer = deobfuscateFont(fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength), font.attributes["w:fontKey"]);
171770
172849
  if (!ttfBuffer)
171771
- return;
172850
+ continue;
172851
+ const policy = parseEmbeddingPolicy(ttfBuffer);
172852
+ if (!(policy ? policy.embeddable : false))
172853
+ continue;
171772
172854
  const blob = new Blob([ttfBuffer], { type: "font/ttf" });
171773
172855
  const fontUrl = URL.createObjectURL(blob);
171774
172856
  const isNormal = font.name.includes("Regular");
@@ -171793,6 +172875,48 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
171793
172875
  fontsImported
171794
172876
  };
171795
172877
  }
172878
+ getEmbeddedFontFaces() {
172879
+ const fontTable = this.convertedXml["word/fontTable.xml"];
172880
+ if (!fontTable || !Object.keys(this.fonts).length)
172881
+ return [];
172882
+ 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) => ({
172883
+ embed: el,
172884
+ family: entry.attributes?.["w:name"]
172885
+ })));
172886
+ const relElements = this.convertedXml["word/_rels/fontTable.xml.rels"]?.elements?.find((el) => el.name === "Relationships")?.elements ?? [];
172887
+ const faceFromEmbedName = (name = "") => ({
172888
+ weight: /bold/i.test(name) ? "700" : "400",
172889
+ style: /italic/i.test(name) ? "italic" : "normal"
172890
+ });
172891
+ const faces = [];
172892
+ for (const { embed, family: family$1 } of embedElements) {
172893
+ const relationshipId = embed.attributes?.["r:id"];
172894
+ const fontKey = embed.attributes?.["w:fontKey"];
172895
+ if (!family$1 || !relationshipId || !fontKey)
172896
+ continue;
172897
+ const filePath = relElements.find((el) => el.attributes?.Id === relationshipId)?.attributes?.Target;
172898
+ if (!filePath)
172899
+ continue;
172900
+ const fontUint8Array = this.fonts[`word/${filePath}`];
172901
+ if (!fontUint8Array?.buffer)
172902
+ continue;
172903
+ const ttf = deobfuscateFont(fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength), fontKey);
172904
+ if (!ttf)
172905
+ continue;
172906
+ const policy = parseEmbeddingPolicy(ttf);
172907
+ const fallback = faceFromEmbedName(embed.name);
172908
+ faces.push({
172909
+ family: family$1,
172910
+ source: ttf,
172911
+ weight: policy?.face.weight ?? fallback.weight,
172912
+ style: policy?.face.style ?? fallback.style,
172913
+ fsType: policy?.fsType ?? null,
172914
+ embeddable: policy ? policy.embeddable : false,
172915
+ relationshipId
172916
+ });
172917
+ }
172918
+ return faces;
172919
+ }
171796
172920
  getDocumentInternalId() {
171797
172921
  const settingsLocation = "word/settings.xml";
171798
172922
  if (!this.convertedXml[settingsLocation])
@@ -172254,7 +173378,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
172254
173378
  };
172255
173379
  });
172256
173380
 
172257
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BmFWtej0.es.js
173381
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-JvWvpCga.es.js
172258
173382
  function parseSizeUnit(val = "0") {
172259
173383
  const length3 = val.toString() || "0";
172260
173384
  const value = Number.parseFloat(length3);
@@ -182587,8 +183711,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
182587
183711
  }
182588
183712
  };
182589
183713
  };
182590
- var init_create_headless_toolbar_BmFWtej0_es = __esm(() => {
182591
- init_SuperConverter_bEQ45IUD_es();
183714
+ var init_create_headless_toolbar_JvWvpCga_es = __esm(() => {
183715
+ init_SuperConverter_BVWG4qnQ_es();
182592
183716
  init_uuid_qzgm05fK_es();
182593
183717
  init_constants_D9qj59G2_es();
182594
183718
  init_dist_B8HfvhaK_es();
@@ -185632,12 +186756,12 @@ var require_shared_cjs = __commonJS((exports) => {
185632
186756
  return res.join(`
185633
186757
  `);
185634
186758
  }
185635
- function normalizeStyle(value) {
186759
+ function normalizeStyle2(value) {
185636
186760
  if (isArray2(value)) {
185637
186761
  const res = {};
185638
186762
  for (let i4 = 0;i4 < value.length; i4++) {
185639
186763
  const item = value[i4];
185640
- const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
186764
+ const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle2(item);
185641
186765
  if (normalized) {
185642
186766
  for (const key2 in normalized) {
185643
186767
  res[key2] = normalized[key2];
@@ -185705,7 +186829,7 @@ var require_shared_cjs = __commonJS((exports) => {
185705
186829
  props.class = normalizeClass(klass);
185706
186830
  }
185707
186831
  if (style) {
185708
- props.style = normalizeStyle(style);
186832
+ props.style = normalizeStyle2(style);
185709
186833
  }
185710
186834
  return props;
185711
186835
  }
@@ -185955,7 +187079,7 @@ var require_shared_cjs = __commonJS((exports) => {
185955
187079
  exports.normalizeClass = normalizeClass;
185956
187080
  exports.normalizeCssVarValue = normalizeCssVarValue;
185957
187081
  exports.normalizeProps = normalizeProps;
185958
- exports.normalizeStyle = normalizeStyle;
187082
+ exports.normalizeStyle = normalizeStyle2;
185959
187083
  exports.objectToString = objectToString;
185960
187084
  exports.parseStringStyle = parseStringStyle;
185961
187085
  exports.propsToAttrMap = propsToAttrMap;
@@ -231751,7 +232875,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
231751
232875
  init_remark_gfm_BhnWr3yf_es();
231752
232876
  });
231753
232877
 
231754
- // ../../packages/superdoc/dist/chunks/src-BhZiOqOm.es.js
232878
+ // ../../packages/superdoc/dist/chunks/src-x_i3LADL.es.js
231755
232879
  function deleteProps(obj, propOrProps) {
231756
232880
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
231757
232881
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -253063,9 +254187,9 @@ function findDonorMarkerFont(abstract) {
253063
254187
  continue;
253064
254188
  if (rFontsHasSymbolFont(rFonts))
253065
254189
  continue;
253066
- const family$1 = readRFontsFamily(rFonts);
253067
- if (family$1)
253068
- return family$1;
254190
+ const family2 = readRFontsFamily(rFonts);
254191
+ if (family2)
254192
+ return family2;
253069
254193
  }
253070
254194
  }
253071
254195
  function normalizeLevelFontForNumFmt(lvlEl, newNumFmt) {
@@ -272214,238 +273338,6 @@ function computeTabWidth(currentPos, justification, tabs, hangingIndent, firstLi
272214
273338
  tabWidth = nextDefaultTabStop - currentPos;
272215
273339
  return tabWidth;
272216
273340
  }
272217
- function isSettled(status) {
272218
- return SETTLED_STATUSES.includes(status);
272219
- }
272220
- function normalizeFamilyKey$2(family$1) {
272221
- return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
272222
- }
272223
- function deriveBundledSubstitutes() {
272224
- const substitutes = {};
272225
- for (const row2 of SUBSTITUTION_EVIDENCE)
272226
- if (row2.policyAction === "substitute" && row2.physicalFamily)
272227
- substitutes[normalizeFamilyKey$2(row2.logicalFamily)] = row2.physicalFamily;
272228
- return Object.freeze(substitutes);
272229
- }
272230
- function deriveCategoryFallbacks() {
272231
- const fallbacks = {};
272232
- for (const row2 of SUBSTITUTION_EVIDENCE)
272233
- if (row2.policyAction === "category_fallback" && row2.physicalFamily)
272234
- fallbacks[normalizeFamilyKey$2(row2.logicalFamily)] = row2.physicalFamily;
272235
- return Object.freeze(fallbacks);
272236
- }
272237
- function stripFamilyQuotes(family$1) {
272238
- return family$1.trim().replace(/^["']|["']$/g, "");
272239
- }
272240
- function splitStack(cssFontFamily) {
272241
- return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
272242
- }
272243
- function createFontResolver() {
272244
- return new FontResolver;
272245
- }
272246
- function resolveFontFamily2(logicalFamily) {
272247
- return defaultResolver.resolveFontFamily(logicalFamily);
272248
- }
272249
- function resolvePhysicalFamily(cssFontFamily) {
272250
- return defaultResolver.resolvePhysicalFamily(cssFontFamily);
272251
- }
272252
- function resolveFace(logicalFamily, face, hasFace) {
272253
- return defaultResolver.resolveFace(logicalFamily, face, hasFace);
272254
- }
272255
- function getFontConfigVersion() {
272256
- return fontConfigVersion;
272257
- }
272258
- function bumpFontConfigVersion() {
272259
- return fontConfigVersion += 1;
272260
- }
272261
- function fourFaces(filePrefix) {
272262
- return [
272263
- {
272264
- weight: "normal",
272265
- style: "normal",
272266
- file: `${filePrefix}-Regular.woff2`
272267
- },
272268
- {
272269
- weight: "bold",
272270
- style: "normal",
272271
- file: `${filePrefix}-Bold.woff2`
272272
- },
272273
- {
272274
- weight: "normal",
272275
- style: "italic",
272276
- file: `${filePrefix}-Italic.woff2`
272277
- },
272278
- {
272279
- weight: "bold",
272280
- style: "italic",
272281
- file: `${filePrefix}-BoldItalic.woff2`
272282
- }
272283
- ];
272284
- }
272285
- function family(name, filePrefix, license) {
272286
- return {
272287
- family: name,
272288
- license,
272289
- faces: fourFaces(filePrefix)
272290
- };
272291
- }
272292
- function withTrailingSlash(base5) {
272293
- return base5.endsWith("/") ? base5 : `${base5}/`;
272294
- }
272295
- function joinUrl(base5, file) {
272296
- return `${withTrailingSlash(base5)}${file}`;
272297
- }
272298
- function weightToken(weight) {
272299
- return weight === "bold" ? "700" : "400";
272300
- }
272301
- function bundledAssetSignature(resolve3) {
272302
- const family$1 = BUNDLED_MANIFEST[0];
272303
- const face = family$1?.faces[0];
272304
- if (!family$1 || !face)
272305
- return "";
272306
- return resolve3({
272307
- file: face.file,
272308
- family: family$1.family,
272309
- weight: weightToken(face.weight),
272310
- style: face.style,
272311
- source: "bundled-substitute"
272312
- });
272313
- }
272314
- function installBundledSubstitutes(registry2, options = {}) {
272315
- const resolve3 = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
272316
- const signature = bundledAssetSignature(resolve3);
272317
- const installed = installedRegistries.get(registry2);
272318
- if (installed !== undefined) {
272319
- if (installed !== signature)
272320
- 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.`);
272321
- return;
272322
- }
272323
- installedRegistries.set(registry2, signature);
272324
- for (const family$1 of BUNDLED_MANIFEST)
272325
- for (const face of family$1.faces) {
272326
- const context = {
272327
- file: face.file,
272328
- family: family$1.family,
272329
- weight: weightToken(face.weight),
272330
- style: face.style,
272331
- source: "bundled-substitute"
272332
- };
272333
- registry2.register({
272334
- family: family$1.family,
272335
- source: `url(${resolve3(context)})`,
272336
- descriptors: {
272337
- weight: face.weight,
272338
- style: face.style
272339
- }
272340
- });
272341
- }
272342
- }
272343
- function buildFontReport(logicalFamilies, registry2, resolver2) {
272344
- const seen = /* @__PURE__ */ new Set;
272345
- const report = [];
272346
- for (const logical of logicalFamilies) {
272347
- if (!logical || seen.has(logical))
272348
- continue;
272349
- seen.add(logical);
272350
- const { physicalFamily, reason } = resolver2 ? resolver2.resolveFontFamily(logical) : resolveFontFamily2(logical);
272351
- const loadStatus = registry2.getStatus(physicalFamily);
272352
- report.push({
272353
- logicalFamily: logical,
272354
- physicalFamily,
272355
- reason,
272356
- loadStatus,
272357
- exportFamily: logical,
272358
- missing: reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded"
272359
- });
272360
- }
272361
- return report;
272362
- }
272363
- function buildFaceReport(usedFaces, registry2, resolver2) {
272364
- const hasFace = (family$1, weight, style2) => registry2.hasFace(family$1, weight, style2);
272365
- const seen = /* @__PURE__ */ new Set;
272366
- const report = [];
272367
- for (const { logicalFamily, weight, style: style2 } of usedFaces) {
272368
- if (!logicalFamily)
272369
- continue;
272370
- const key2 = `${logicalFamily.toLowerCase()}|${weight}|${style2}`;
272371
- if (seen.has(key2))
272372
- continue;
272373
- seen.add(key2);
272374
- const face = {
272375
- weight,
272376
- style: style2
272377
- };
272378
- const { physicalFamily, reason } = resolver2 ? resolver2.resolveFace(logicalFamily, face, hasFace) : resolveFace(logicalFamily, face, hasFace);
272379
- const loadStatus = registry2.getFaceStatus({
272380
- family: physicalFamily,
272381
- weight,
272382
- style: style2
272383
- });
272384
- const missing = reason === "fallback_face_absent" || reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded";
272385
- report.push({
272386
- logicalFamily,
272387
- physicalFamily,
272388
- reason,
272389
- loadStatus,
272390
- exportFamily: logicalFamily,
272391
- missing,
272392
- face
272393
- });
272394
- }
272395
- return report;
272396
- }
272397
- function quoteFamily(family$1) {
272398
- return `"${family$1.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
272399
- }
272400
- function canonicalizeFontSource(source) {
272401
- const match$1 = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
272402
- if (!match$1)
272403
- return source;
272404
- let inner = match$1[1].trim();
272405
- if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'"))
272406
- inner = inner.slice(1, -1);
272407
- return `url(${JSON.stringify(inner)})`;
272408
- }
272409
- function normalizeFamilyKey$1(family$1) {
272410
- return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
272411
- }
272412
- function normalizeWeight(weight) {
272413
- if (weight === undefined)
272414
- return "400";
272415
- const w = String(weight).trim().toLowerCase();
272416
- if (w === "bold" || w === "bolder")
272417
- return "700";
272418
- const n = Number(w);
272419
- return Number.isFinite(n) && n >= 600 ? "700" : "400";
272420
- }
272421
- function normalizeStyle$1(style2) {
272422
- if (!style2)
272423
- return "normal";
272424
- const s2 = style2.trim().toLowerCase();
272425
- return s2.startsWith("italic") || s2.startsWith("oblique") ? "italic" : "normal";
272426
- }
272427
- function faceKeyOf$1(family$1, weight, style2) {
272428
- return `${normalizeFamilyKey$1(family$1)}|${weight}|${style2}`;
272429
- }
272430
- function faceProbe(family$1, weight, style2, size$1) {
272431
- return `${style2 === "italic" ? "italic " : ""}${weight} ${size$1} ${quoteFamily(family$1)}`;
272432
- }
272433
- function getFontRegistryFor(fontSet, FontFaceCtor) {
272434
- if (!fontSet) {
272435
- if (!domlessRegistry)
272436
- domlessRegistry = new FontRegistry({});
272437
- return domlessRegistry;
272438
- }
272439
- let registry2 = registriesByFontSet.get(fontSet);
272440
- if (!registry2) {
272441
- registry2 = new FontRegistry({
272442
- fontSet,
272443
- FontFaceCtor
272444
- });
272445
- registriesByFontSet.set(fontSet, registry2);
272446
- }
272447
- return registry2;
272448
- }
272449
273341
  function isResolvedFragmentWithBorders(item) {
272450
273342
  return item !== undefined && item.kind === "fragment" && "paragraphBorders" in item && item.paragraphBorders !== undefined;
272451
273343
  }
@@ -280441,8 +281333,8 @@ function isTextRun$3(run2) {
280441
281333
  function fontString(run2) {
280442
281334
  const textRun = isTextRun$3(run2) ? run2 : null;
280443
281335
  const size$1 = textRun?.fontSize ?? 16;
280444
- const family$1 = textRun?.fontFamily ?? "Arial";
280445
- return `${textRun?.italic ? "italic " : ""}${textRun?.bold ? "bold " : ""}${size$1}px ${family$1}`.trim();
281336
+ const family2 = textRun?.fontFamily ?? "Arial";
281337
+ return `${textRun?.italic ? "italic " : ""}${textRun?.bold ? "bold " : ""}${size$1}px ${family2}`.trim();
280446
281338
  }
280447
281339
  function runText(run2) {
280448
281340
  if (isEmptySdtPlaceholderRun(run2))
@@ -291288,8 +292180,8 @@ function ensureEndnoteMarker(blocks2, id2, endnoteNumberById, endnoteNumberForma
291288
292180
  }
291289
292181
  runs2.unshift(markerRun);
291290
292182
  }
291291
- function normalizeFamilyKey(family$1) {
291292
- return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
292183
+ function normalizeFamilyKey2(family2) {
292184
+ return family2.trim().replace(/^["']|["']$/g, "").toLowerCase();
291293
292185
  }
291294
292186
  function normalizeWeightToken(weight) {
291295
292187
  if (!weight)
@@ -291306,8 +292198,8 @@ function normalizeStyleToken(style2) {
291306
292198
  const s2 = style2.trim().toLowerCase();
291307
292199
  return s2.startsWith("italic") || s2.startsWith("oblique") ? "italic" : "normal";
291308
292200
  }
291309
- function faceKeyOf(family$1, weight, style2) {
291310
- return `${normalizeFamilyKey(family$1)}|${weight}|${style2}`;
292201
+ function faceKeyOf2(family2, weight, style2) {
292202
+ return `${normalizeFamilyKey2(family2)}|${weight}|${style2}`;
291311
292203
  }
291312
292204
  function summarize(results) {
291313
292205
  const summary = emptySummary();
@@ -291331,9 +292223,9 @@ function summarizeFaces(results) {
291331
292223
  worstByFamily.set(request.family, status);
291332
292224
  }
291333
292225
  const summary = emptySummary();
291334
- for (const [family$1, status] of worstByFamily) {
292226
+ for (const [family2, status] of worstByFamily) {
291335
292227
  summary.results.push({
291336
- family: family$1,
292228
+ family: family2,
291337
292229
  status
291338
292230
  });
291339
292231
  if (status === "loaded")
@@ -291375,6 +292267,13 @@ function defaultInvalidate() {
291375
292267
  function toCssFontSource(url2) {
291376
292268
  return /^\s*url\(/i.test(url2) ? url2 : `url(${JSON.stringify(url2)})`;
291377
292269
  }
292270
+ function nextEmbeddedNamespace() {
292271
+ embeddedDocumentCounter += 1;
292272
+ return `__superdoc_embedded_${embeddedDocumentCounter}__`;
292273
+ }
292274
+ function sanitizeFamilyToken(family2) {
292275
+ return family2.replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "font";
292276
+ }
291378
292277
  function defaultScheduleMicrotask(callback) {
291379
292278
  if (typeof queueMicrotask === "function") {
291380
292279
  queueMicrotask(callback);
@@ -291404,14 +292303,14 @@ function makeResolveFace(resolver2, hasFace) {
291404
292303
  };
291405
292304
  };
291406
292305
  return (logical) => {
291407
- const r$1 = resolveFontFamily2(logical);
292306
+ const r$1 = resolveFontFamily(logical);
291408
292307
  return {
291409
292308
  physicalFamily: r$1.physicalFamily,
291410
292309
  reason: r$1.reason
291411
292310
  };
291412
292311
  };
291413
292312
  }
291414
- function collect(acc, node3, resolveFace$1) {
292313
+ function collect(acc, node3, resolveFace2) {
291415
292314
  if (!node3 || typeof node3.fontFamily !== "string" || !node3.fontFamily)
291416
292315
  return;
291417
292316
  const weight = node3.bold === true ? "700" : "400";
@@ -291422,7 +292321,7 @@ function collect(acc, node3, resolveFace$1) {
291422
292321
  const usedKey = `${logicalPrimary.toLowerCase()}|${weight}|${style2}`;
291423
292322
  if (acc.usedFaces.has(usedKey))
291424
292323
  return;
291425
- const { physicalFamily, reason } = resolveFace$1(node3.fontFamily, {
292324
+ const { physicalFamily, reason } = resolveFace2(node3.fontFamily, {
291426
292325
  weight,
291427
292326
  style: style2
291428
292327
  });
@@ -291448,7 +292347,7 @@ function collect(acc, node3, resolveFace$1) {
291448
292347
  });
291449
292348
  }
291450
292349
  }
291451
- function collectRuns(acc, runs2, resolveFace$1) {
292350
+ function collectRuns(acc, runs2, resolveFace2) {
291452
292351
  if (!runs2)
291453
292352
  return;
291454
292353
  for (const run2 of runs2) {
@@ -291457,48 +292356,48 @@ function collectRuns(acc, runs2, resolveFace$1) {
291457
292356
  collect(acc, {
291458
292357
  ...bearing,
291459
292358
  fontFamily: "Arial"
291460
- }, resolveFace$1);
292359
+ }, resolveFace2);
291461
292360
  else
291462
- collect(acc, bearing, resolveFace$1);
292361
+ collect(acc, bearing, resolveFace2);
291463
292362
  }
291464
292363
  }
291465
- function collectParagraph(acc, paragraph2, resolveFace$1) {
292364
+ function collectParagraph(acc, paragraph2, resolveFace2) {
291466
292365
  if (!paragraph2)
291467
292366
  return;
291468
- collectRuns(acc, paragraph2.runs, resolveFace$1);
291469
- collect(acc, paragraph2.attrs?.wordLayout?.marker?.run, resolveFace$1);
291470
- collect(acc, paragraph2.attrs?.dropCapDescriptor?.run, resolveFace$1);
292367
+ collectRuns(acc, paragraph2.runs, resolveFace2);
292368
+ collect(acc, paragraph2.attrs?.wordLayout?.marker?.run, resolveFace2);
292369
+ collect(acc, paragraph2.attrs?.dropCapDescriptor?.run, resolveFace2);
291471
292370
  }
291472
- function collectTable(acc, table2, resolveFace$1) {
292371
+ function collectTable(acc, table2, resolveFace2) {
291473
292372
  for (const row2 of table2.rows)
291474
292373
  for (const cell2 of row2.cells) {
291475
- collectParagraph(acc, cell2.paragraph, resolveFace$1);
292374
+ collectParagraph(acc, cell2.paragraph, resolveFace2);
291476
292375
  if (cell2.blocks)
291477
292376
  for (const b$1 of cell2.blocks)
291478
- collectBlock(acc, b$1, resolveFace$1);
292377
+ collectBlock(acc, b$1, resolveFace2);
291479
292378
  }
291480
292379
  }
291481
- function collectList(acc, list5, resolveFace$1) {
292380
+ function collectList(acc, list5, resolveFace2) {
291482
292381
  for (const item of list5.items)
291483
- collectParagraph(acc, item.paragraph, resolveFace$1);
292382
+ collectParagraph(acc, item.paragraph, resolveFace2);
291484
292383
  }
291485
- function collectBlock(acc, block, resolveFace$1) {
292384
+ function collectBlock(acc, block, resolveFace2) {
291486
292385
  switch (block.kind) {
291487
292386
  case "paragraph":
291488
- collectParagraph(acc, block, resolveFace$1);
292387
+ collectParagraph(acc, block, resolveFace2);
291489
292388
  break;
291490
292389
  case "table":
291491
- collectTable(acc, block, resolveFace$1);
292390
+ collectTable(acc, block, resolveFace2);
291492
292391
  break;
291493
292392
  case "list":
291494
- collectList(acc, block, resolveFace$1);
292393
+ collectList(acc, block, resolveFace2);
291495
292394
  break;
291496
292395
  default:
291497
292396
  break;
291498
292397
  }
291499
292398
  }
291500
292399
  function planFontFaces(blocks2, resolver2, hasFace) {
291501
- const resolveFace$1 = makeResolveFace(resolver2, hasFace);
292400
+ const resolveFace2 = makeResolveFace(resolver2, hasFace);
291502
292401
  const acc = {
291503
292402
  requiredFaces: /* @__PURE__ */ new Map,
291504
292403
  usedFaces: /* @__PURE__ */ new Map,
@@ -291506,7 +292405,7 @@ function planFontFaces(blocks2, resolver2, hasFace) {
291506
292405
  };
291507
292406
  if (blocks2)
291508
292407
  for (const block of blocks2)
291509
- collectBlock(acc, block, resolveFace$1);
292408
+ collectBlock(acc, block, resolveFace2);
291510
292409
  return {
291511
292410
  requiredFaces: [...acc.requiredFaces.values()],
291512
292411
  usedFaces: [...acc.usedFaces.values()],
@@ -313415,443 +314314,7 @@ menclose::after {
313415
314314
  const minReadablePx = getMinimumReadableTextStartPx(markerContentEndPx, gutterWidthPx);
313416
314315
  return Math.max(nextTabStopPx, minReadablePx);
313417
314316
  }
313418
- }, SETTLED_STATUSES, SUBSTITUTION_EVIDENCE, BUNDLED_SUBSTITUTES, CATEGORY_FALLBACKS, FontResolver = class {
313419
- #overrides = /* @__PURE__ */ new Map;
313420
- #version = 0;
313421
- #cachedSignature = null;
313422
- map(logicalFamily, physicalFamily) {
313423
- const key2 = normalizeFamilyKey$2(logicalFamily);
313424
- const physical = physicalFamily?.trim();
313425
- if (!key2 || !physical)
313426
- return;
313427
- if (this.#overrides.get(key2) === physical)
313428
- return;
313429
- if (key2 === normalizeFamilyKey$2(physical)) {
313430
- if (this.#overrides.delete(key2)) {
313431
- this.#version += 1;
313432
- this.#cachedSignature = null;
313433
- }
313434
- return;
313435
- }
313436
- this.#overrides.set(key2, physical);
313437
- this.#version += 1;
313438
- this.#cachedSignature = null;
313439
- }
313440
- unmap(logicalFamily) {
313441
- if (this.#overrides.delete(normalizeFamilyKey$2(logicalFamily))) {
313442
- this.#version += 1;
313443
- this.#cachedSignature = null;
313444
- }
313445
- }
313446
- reset() {
313447
- if (this.#overrides.size === 0)
313448
- return;
313449
- this.#overrides.clear();
313450
- this.#version += 1;
313451
- this.#cachedSignature = null;
313452
- }
313453
- get version() {
313454
- return this.#version;
313455
- }
313456
- get signature() {
313457
- if (this.#cachedSignature !== null)
313458
- return this.#cachedSignature;
313459
- this.#cachedSignature = this.#overrides.size === 0 ? "" : JSON.stringify([...this.#overrides.entries()].sort(([a2], [b$1]) => a2 < b$1 ? -1 : a2 > b$1 ? 1 : 0));
313460
- return this.#cachedSignature;
313461
- }
313462
- #physicalFor(bareFamily) {
313463
- const key2 = normalizeFamilyKey$2(bareFamily);
313464
- const override = this.#overrides.get(key2);
313465
- if (override)
313466
- return {
313467
- physical: override,
313468
- reason: "custom_mapping"
313469
- };
313470
- const bundled = BUNDLED_SUBSTITUTES[key2];
313471
- if (bundled)
313472
- return {
313473
- physical: bundled,
313474
- reason: "bundled_substitute"
313475
- };
313476
- const category = CATEGORY_FALLBACKS[key2];
313477
- if (category)
313478
- return {
313479
- physical: category,
313480
- reason: "category_fallback"
313481
- };
313482
- return {
313483
- physical: bareFamily,
313484
- reason: "as_requested"
313485
- };
313486
- }
313487
- #resolveFaceLadder(primary, face, hasFace) {
313488
- const key2 = normalizeFamilyKey$2(primary);
313489
- const override = this.#overrides.get(key2);
313490
- if (override && hasFace(override, face.weight, face.style))
313491
- return {
313492
- physical: override,
313493
- reason: "custom_mapping"
313494
- };
313495
- if (hasFace(primary, face.weight, face.style))
313496
- return {
313497
- physical: primary,
313498
- reason: "registered_face"
313499
- };
313500
- const bundled = BUNDLED_SUBSTITUTES[key2];
313501
- if (bundled && hasFace(bundled, face.weight, face.style))
313502
- return {
313503
- physical: bundled,
313504
- reason: "bundled_substitute"
313505
- };
313506
- const category = CATEGORY_FALLBACKS[key2];
313507
- if (category && hasFace(category, face.weight, face.style))
313508
- return {
313509
- physical: category,
313510
- reason: "category_fallback"
313511
- };
313512
- if (override || bundled)
313513
- return {
313514
- physical: primary,
313515
- reason: "fallback_face_absent"
313516
- };
313517
- return {
313518
- physical: primary,
313519
- reason: "as_requested"
313520
- };
313521
- }
313522
- resolveFontFamily(logicalFamily) {
313523
- const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
313524
- const { physical, reason } = this.#physicalFor(primary);
313525
- return {
313526
- logicalFamily,
313527
- physicalFamily: stripFamilyQuotes(physical),
313528
- reason
313529
- };
313530
- }
313531
- resolvePhysicalFamily(cssFontFamily) {
313532
- if (!cssFontFamily)
313533
- return cssFontFamily;
313534
- const parts = splitStack(cssFontFamily);
313535
- if (parts.length === 0)
313536
- return cssFontFamily;
313537
- const { physical, reason } = this.#physicalFor(parts[0]);
313538
- if (reason === "as_requested")
313539
- return cssFontFamily;
313540
- return [physical, ...parts.slice(1)].join(", ");
313541
- }
313542
- resolveFace(logicalFamily, face, hasFace) {
313543
- const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
313544
- const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
313545
- return {
313546
- logicalFamily,
313547
- physicalFamily: stripFamilyQuotes(physical),
313548
- reason
313549
- };
313550
- }
313551
- resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
313552
- if (!cssFontFamily)
313553
- return cssFontFamily;
313554
- const parts = splitStack(cssFontFamily);
313555
- if (parts.length === 0)
313556
- return cssFontFamily;
313557
- const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
313558
- if (normalizeFamilyKey$2(physical) !== normalizeFamilyKey$2(parts[0]))
313559
- return [physical, ...parts.slice(1)].join(", ");
313560
- return cssFontFamily;
313561
- }
313562
- resolvePrimaryPhysicalFamily(family$1) {
313563
- const primary = splitStack(family$1)[0] ?? family$1;
313564
- return this.#physicalFor(primary).physical;
313565
- }
313566
- resolvePhysicalFamilies(families) {
313567
- const out = /* @__PURE__ */ new Set;
313568
- for (const family$1 of families)
313569
- if (family$1)
313570
- out.add(this.resolvePrimaryPhysicalFamily(family$1));
313571
- return [...out];
313572
- }
313573
- }, defaultResolver, DEFAULT_FONT_MEASURE_CONTEXT, fontConfigVersion = 0, BUNDLED_MANIFEST, defaultAssetBase = "/fonts/", installedRegistries, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
313574
- #fontSet;
313575
- #FontFaceCtor;
313576
- #probeSize;
313577
- #scheduleTimeout;
313578
- #cancelTimeout;
313579
- #managed = /* @__PURE__ */ new Map;
313580
- #status = /* @__PURE__ */ new Map;
313581
- #sources = /* @__PURE__ */ new Map;
313582
- #warnedFailures = /* @__PURE__ */ new Set;
313583
- #inflight = /* @__PURE__ */ new Map;
313584
- #faceStatus = /* @__PURE__ */ new Map;
313585
- #faceInflight = /* @__PURE__ */ new Map;
313586
- #faceSources = /* @__PURE__ */ new Map;
313587
- #facesByFamily = /* @__PURE__ */ new Map;
313588
- #providerFaceKeys = /* @__PURE__ */ new Set;
313589
- #warnedFaceFailures = /* @__PURE__ */ new Set;
313590
- constructor(options = {}) {
313591
- this.#fontSet = options.fontSet ?? null;
313592
- this.#FontFaceCtor = options.FontFaceCtor ?? null;
313593
- this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
313594
- this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
313595
- this.#cancelTimeout = options.cancelTimeout ?? ((handle3) => globalThis.clearTimeout(handle3));
313596
- }
313597
- register(descriptor) {
313598
- const { family: family$1, source, descriptors: descriptors2 } = descriptor;
313599
- const identitySource = typeof source === "string" ? canonicalizeFontSource(source) : source;
313600
- const weight = normalizeWeight(descriptors2?.weight);
313601
- const style2 = normalizeStyle$1(descriptors2?.style);
313602
- const key2 = faceKeyOf$1(family$1, weight, style2);
313603
- if (typeof identitySource === "string") {
313604
- const existingSource = this.#faceSources.get(key2);
313605
- if (existingSource === identitySource)
313606
- return {
313607
- family: family$1,
313608
- status: this.getStatus(family$1),
313609
- changed: false
313610
- };
313611
- if (existingSource !== undefined)
313612
- throw new Error(`[superdoc] font face "${key2}" is already registered from a different source ("${existingSource}"); a registered face's source cannot be replaced`);
313613
- }
313614
- if (this.#FontFaceCtor && this.#fontSet) {
313615
- const face = new this.#FontFaceCtor(family$1, source, {
313616
- ...descriptors2,
313617
- weight,
313618
- style: style2
313619
- });
313620
- this.#fontSet.add(face);
313621
- this.#managed.set(family$1, face);
313622
- }
313623
- if (typeof source === "string") {
313624
- const list5 = this.#sources.get(family$1) ?? [];
313625
- if (!list5.includes(source))
313626
- list5.push(source);
313627
- this.#sources.set(family$1, list5);
313628
- }
313629
- if (!this.#status.has(family$1))
313630
- this.#status.set(family$1, "unloaded");
313631
- this.#providerFaceKeys.add(key2);
313632
- this.#trackFace(family$1, key2);
313633
- if (!this.#faceStatus.has(key2))
313634
- this.#faceStatus.set(key2, "unloaded");
313635
- if (typeof identitySource === "string" && !this.#faceSources.has(key2))
313636
- this.#faceSources.set(key2, identitySource);
313637
- return {
313638
- family: family$1,
313639
- status: this.getStatus(family$1),
313640
- changed: true
313641
- };
313642
- }
313643
- #trackFace(family$1, key2) {
313644
- const fam = normalizeFamilyKey$1(family$1);
313645
- const set = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
313646
- set.add(key2);
313647
- this.#facesByFamily.set(fam, set);
313648
- }
313649
- isManaged(family$1) {
313650
- return this.#managed.has(family$1);
313651
- }
313652
- getStatus(family$1) {
313653
- const statuses = [];
313654
- const faceKeys = this.#facesByFamily.get(normalizeFamilyKey$1(family$1));
313655
- if (faceKeys)
313656
- for (const k$1 of faceKeys)
313657
- statuses.push(this.#faceStatus.get(k$1) ?? "unloaded");
313658
- const legacy = this.#status.get(family$1);
313659
- if (legacy)
313660
- statuses.push(legacy);
313661
- if (statuses.length === 0)
313662
- return "unloaded";
313663
- for (const s2 of [
313664
- "failed",
313665
- "timed_out",
313666
- "fallback_used",
313667
- "loaded",
313668
- "loading",
313669
- "unloaded"
313670
- ])
313671
- if (statuses.includes(s2))
313672
- return s2;
313673
- return "unloaded";
313674
- }
313675
- hasFace(family$1, weight, style2) {
313676
- const key2 = faceKeyOf$1(family$1, weight, style2);
313677
- return this.#providerFaceKeys.has(key2) && this.#faceStatus.get(key2) !== "failed";
313678
- }
313679
- isAvailable(family$1) {
313680
- if (!this.#fontSet)
313681
- return false;
313682
- try {
313683
- return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
313684
- } catch {
313685
- return false;
313686
- }
313687
- }
313688
- awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
313689
- if (this.#status.get(family$1) === "loaded")
313690
- return Promise.resolve({
313691
- family: family$1,
313692
- status: "loaded"
313693
- });
313694
- const existing = this.#inflight.get(family$1);
313695
- if (existing)
313696
- return existing;
313697
- const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
313698
- this.#inflight.delete(family$1);
313699
- });
313700
- this.#inflight.set(family$1, probe);
313701
- return probe;
313702
- }
313703
- async awaitFaces(families, options = {}) {
313704
- const unique$2 = [...new Set(families)];
313705
- const timeoutMs = options.timeoutMs ?? 3000;
313706
- return Promise.all(unique$2.map((family$1) => this.awaitFace(family$1, timeoutMs)));
313707
- }
313708
- getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
313709
- return [...new Set(families)].map((family$1) => ({
313710
- family: family$1,
313711
- status: this.getStatus(family$1),
313712
- ready: this.awaitFace(family$1, timeoutMs)
313713
- }));
313714
- }
313715
- getStates() {
313716
- return [...this.#status.entries()].map(([family$1, status]) => ({
313717
- family: family$1,
313718
- status
313719
- }));
313720
- }
313721
- getFaceStatus(request) {
313722
- return this.#faceStatus.get(faceKeyOf$1(request.family, request.weight, request.style)) ?? "unloaded";
313723
- }
313724
- awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
313725
- const key2 = faceKeyOf$1(request.family, request.weight, request.style);
313726
- if (this.#faceStatus.get(key2) === "loaded")
313727
- return Promise.resolve({
313728
- request,
313729
- status: "loaded"
313730
- });
313731
- const existing = this.#faceInflight.get(key2);
313732
- if (existing)
313733
- return existing;
313734
- const probe = this.#loadOneFace(request, key2, timeoutMs).finally(() => {
313735
- this.#faceInflight.delete(key2);
313736
- });
313737
- this.#faceInflight.set(key2, probe);
313738
- return probe;
313739
- }
313740
- async awaitFaceRequests(requests, options = {}) {
313741
- const timeoutMs = options.timeoutMs ?? 3000;
313742
- const seen = /* @__PURE__ */ new Set;
313743
- const unique$2 = [];
313744
- for (const r$1 of requests) {
313745
- const key2 = faceKeyOf$1(r$1.family, r$1.weight, r$1.style);
313746
- if (seen.has(key2))
313747
- continue;
313748
- seen.add(key2);
313749
- unique$2.push(r$1);
313750
- }
313751
- return Promise.all(unique$2.map((r$1) => this.awaitFaceRequest(r$1, timeoutMs)));
313752
- }
313753
- async#loadOneFace(request, key2, timeoutMs) {
313754
- this.#trackFace(request.family, key2);
313755
- const fontSet = this.#fontSet;
313756
- if (!fontSet) {
313757
- this.#faceStatus.set(key2, "fallback_used");
313758
- return {
313759
- request,
313760
- status: "fallback_used"
313761
- };
313762
- }
313763
- this.#faceStatus.set(key2, "loading");
313764
- const probe = faceProbe(request.family, request.weight, request.style, this.#probeSize);
313765
- const TIMEOUT = Symbol("timeout");
313766
- let handle3;
313767
- const timeout$1 = new Promise((resolve3) => {
313768
- handle3 = this.#scheduleTimeout(() => resolve3(TIMEOUT), timeoutMs);
313769
- });
313770
- try {
313771
- const settled = await Promise.race([fontSet.load(probe), timeout$1]);
313772
- if (settled === TIMEOUT) {
313773
- this.#faceStatus.set(key2, "timed_out");
313774
- return {
313775
- request,
313776
- status: "timed_out"
313777
- };
313778
- }
313779
- const status = settled.length > 0 ? "loaded" : "fallback_used";
313780
- this.#faceStatus.set(key2, status);
313781
- return {
313782
- request,
313783
- status
313784
- };
313785
- } catch {
313786
- this.#faceStatus.set(key2, "failed");
313787
- this.#warnFaceFailureOnce(request, key2);
313788
- return {
313789
- request,
313790
- status: "failed"
313791
- };
313792
- } finally {
313793
- this.#cancelTimeout(handle3);
313794
- }
313795
- }
313796
- #warnFaceFailureOnce(request, key2) {
313797
- if (this.#warnedFaceFailures.has(key2))
313798
- return;
313799
- this.#warnedFaceFailures.add(key2);
313800
- const src = this.#faceSources.get(key2);
313801
- const detail = src ? ` from ${src}` : "";
313802
- 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.`);
313803
- }
313804
- async#loadOne(family$1, timeoutMs) {
313805
- const fontSet = this.#fontSet;
313806
- if (!fontSet) {
313807
- this.#status.set(family$1, "fallback_used");
313808
- return {
313809
- family: family$1,
313810
- status: "fallback_used"
313811
- };
313812
- }
313813
- this.#status.set(family$1, "loading");
313814
- const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
313815
- const TIMEOUT = Symbol("timeout");
313816
- let handle3;
313817
- const timeout$1 = new Promise((resolve3) => {
313818
- handle3 = this.#scheduleTimeout(() => resolve3(TIMEOUT), timeoutMs);
313819
- });
313820
- try {
313821
- const settled = await Promise.race([fontSet.load(probe), timeout$1]);
313822
- if (settled === TIMEOUT) {
313823
- this.#status.set(family$1, "timed_out");
313824
- return {
313825
- family: family$1,
313826
- status: "timed_out"
313827
- };
313828
- }
313829
- const status = settled.length > 0 ? "loaded" : "fallback_used";
313830
- this.#status.set(family$1, status);
313831
- return {
313832
- family: family$1,
313833
- status
313834
- };
313835
- } catch {
313836
- this.#status.set(family$1, "failed");
313837
- this.#warnLoadFailureOnce(family$1);
313838
- return {
313839
- family: family$1,
313840
- status: "failed"
313841
- };
313842
- } finally {
313843
- this.#cancelTimeout(handle3);
313844
- }
313845
- }
313846
- #warnLoadFailureOnce(family$1) {
313847
- if (this.#warnedFailures.has(family$1))
313848
- return;
313849
- this.#warnedFailures.add(family$1);
313850
- const sources = this.#sources.get(family$1);
313851
- const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
313852
- console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
313853
- }
313854
- }, registriesByFontSet, domlessRegistry = null, hashParagraphBorder$2 = (border) => {
314317
+ }, hashParagraphBorder$2 = (border) => {
313855
314318
  const parts = [];
313856
314319
  if (border.style !== undefined)
313857
314320
  parts.push(`s:${border.style}`);
@@ -321764,8 +322227,8 @@ menclose::after {
321764
322227
  return typeof width === "number" ? width : 0;
321765
322228
  }, isLineBreakRun$1 = (run2) => run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line", markerFontString = (run2) => {
321766
322229
  const size$1 = run2?.fontSize ?? 16;
321767
- const family$1 = run2?.fontFamily ?? "Arial";
321768
- return `${run2?.italic ? "italic " : ""}${run2?.bold ? "bold " : ""}${size$1}px ${family$1}`.trim();
322230
+ const family2 = run2?.fontFamily ?? "Arial";
322231
+ return `${run2?.italic ? "italic " : ""}${run2?.bold ? "bold " : ""}${size$1}px ${family2}`.trim();
321769
322232
  }, buildTabStopsPx$1 = (indent2, tabs, tabIntervalTwips) => {
321770
322233
  const paragraphIndentTwips = {
321771
322234
  left: pxToTwips$1(sanitizeIndent$1(indent2?.left)),
@@ -329207,7 +329670,7 @@ menclose::after {
329207
329670
  const usedFaces = this.#getUsedFaces?.() ?? [];
329208
329671
  const faceRows = buildFaceReport(usedFaces, registry2, resolver2);
329209
329672
  const usedFamilies = new Set(usedFaces.map((u) => u.logicalFamily.toLowerCase()));
329210
- const declaredRows = buildFontReport(declared.filter((family$1) => family$1 && !usedFamilies.has(family$1.toLowerCase())), registry2, resolver2);
329673
+ const declaredRows = buildFontReport(declared.filter((family2) => family2 && !usedFamilies.has(family2.toLowerCase())), registry2, resolver2);
329211
329674
  return [...faceRows, ...declaredRows];
329212
329675
  }
329213
329676
  async ensureReadyForMeasure() {
@@ -329225,7 +329688,7 @@ menclose::after {
329225
329688
  }
329226
329689
  const keyed = required.map((r$1) => ({
329227
329690
  request: r$1,
329228
- key: faceKeyOf(r$1.family, r$1.weight, r$1.style)
329691
+ key: faceKeyOf2(r$1.family, r$1.weight, r$1.style)
329229
329692
  }));
329230
329693
  const signature = keyed.map((k$1) => k$1.key).sort().join("|");
329231
329694
  if (signature === this.#requiredSignature && keyed.every((k$1) => registry2.getFaceStatus(k$1.request) === "loaded") && this.#lastSummary)
@@ -329242,7 +329705,7 @@ menclose::after {
329242
329705
  }
329243
329706
  const failedKeys = [];
329244
329707
  for (const result of results) {
329245
- const key2 = faceKeyOf(result.request.family, result.request.weight, result.request.style);
329708
+ const key2 = faceKeyOf2(result.request.family, result.request.weight, result.request.style);
329246
329709
  if (result.status === "loaded")
329247
329710
  this.#seenAvailableFaces.add(key2);
329248
329711
  else if (result.status === "failed" && !this.#seenFailedFaces.has(key2)) {
@@ -329264,7 +329727,7 @@ menclose::after {
329264
329727
  return this.#lastSummary ?? emptySummary();
329265
329728
  }
329266
329729
  const signature = required.slice().sort().join("|");
329267
- if (signature === this.#requiredSignature && required.every((family$1) => registry2.getStatus(family$1) === "loaded") && this.#lastSummary)
329730
+ if (signature === this.#requiredSignature && required.every((family2) => registry2.getStatus(family2) === "loaded") && this.#lastSummary)
329268
329731
  return this.#lastSummary;
329269
329732
  this.#requiredSignature = signature;
329270
329733
  this.#requiredFamilies = new Set(required);
@@ -329352,7 +329815,7 @@ menclose::after {
329352
329815
  return;
329353
329816
  const changedKeys = [];
329354
329817
  if (this.#requiredFaceKeys.size > 0) {
329355
- const loadedFaceKeys = new Set(faces.map((face) => faceKeyOf(face.family, normalizeWeightToken(face.weight), normalizeStyleToken(face.style))));
329818
+ const loadedFaceKeys = new Set(faces.map((face) => faceKeyOf2(face.family, normalizeWeightToken(face.weight), normalizeStyleToken(face.style))));
329356
329819
  for (const key2 of this.#requiredFaceKeys) {
329357
329820
  if (this.#seenAvailableFaces.has(key2))
329358
329821
  continue;
@@ -329362,13 +329825,13 @@ menclose::after {
329362
329825
  }
329363
329826
  }
329364
329827
  } else {
329365
- const loadedFamilies = new Set(faces.map((face) => normalizeFamilyKey(face.family)));
329366
- for (const family$1 of this.#requiredFamilies) {
329367
- if (this.#seenAvailable.has(family$1))
329828
+ const loadedFamilies = new Set(faces.map((face) => normalizeFamilyKey2(face.family)));
329829
+ for (const family2 of this.#requiredFamilies) {
329830
+ if (this.#seenAvailable.has(family2))
329368
329831
  continue;
329369
- if (loadedFamilies.has(normalizeFamilyKey(family$1))) {
329370
- this.#seenAvailable.add(family$1);
329371
- changedKeys.push(normalizeFamilyKey(family$1));
329832
+ if (loadedFamilies.has(normalizeFamilyKey2(family2))) {
329833
+ this.#seenAvailable.add(family2);
329834
+ changedKeys.push(normalizeFamilyKey2(family2));
329372
329835
  }
329373
329836
  }
329374
329837
  }
@@ -329385,7 +329848,7 @@ menclose::after {
329385
329848
  #flushLateFontLoads() {
329386
329849
  this.#requestReflow();
329387
329850
  }
329388
- }, FACE_STATUS_PRIORITY, DocumentFontController = class {
329851
+ }, FACE_STATUS_PRIORITY, embeddedDocumentCounter = 0, DocumentFontController = class {
329389
329852
  #resolver;
329390
329853
  #getGate;
329391
329854
  #onDocumentFontConfigApplied;
@@ -329393,6 +329856,10 @@ menclose::after {
329393
329856
  #runtimeReflowQueued = false;
329394
329857
  #runtimeReflowToken = 0;
329395
329858
  #runtimeAvailabilityChanged = false;
329859
+ #embeddedDisposers = [];
329860
+ #embeddedNamespace = nextEmbeddedNamespace();
329861
+ #embeddedPhysical = /* @__PURE__ */ new Map;
329862
+ #embeddedGeneration = 0;
329396
329863
  constructor(deps) {
329397
329864
  this.#resolver = deps.resolver;
329398
329865
  this.#getGate = deps.getGate;
@@ -329405,16 +329872,18 @@ menclose::after {
329405
329872
  }
329406
329873
  unmap(families) {
329407
329874
  const before2 = this.#resolver.signature;
329408
- for (const family$1 of Array.isArray(families) ? families : [families])
329409
- this.#resolver.unmap(family$1);
329875
+ for (const family2 of Array.isArray(families) ? families : [families])
329876
+ this.#resolver.unmap(family2);
329410
329877
  this.#reflowIfChanged(before2);
329411
329878
  }
329412
329879
  reset() {
329413
329880
  this.#cancelPendingRuntimeReflow();
329881
+ this.#releaseEmbeddedFaces();
329414
329882
  this.#resolver.reset();
329415
329883
  }
329416
329884
  dispose() {
329417
329885
  this.#cancelPendingRuntimeReflow();
329886
+ this.#releaseEmbeddedFaces();
329418
329887
  }
329419
329888
  applyInitialConfig(config2) {
329420
329889
  this.#cancelPendingRuntimeReflow();
@@ -329425,6 +329894,43 @@ menclose::after {
329425
329894
  if (registered$1)
329426
329895
  this.#getGate()?.invalidateCachesForConfigRegistration();
329427
329896
  }
329897
+ applyEmbeddedFaces(faces) {
329898
+ this.#releaseEmbeddedFaces();
329899
+ if (!faces?.length)
329900
+ return;
329901
+ const registry2 = this.#getGate()?.resolveRegistry();
329902
+ if (!registry2)
329903
+ return;
329904
+ this.#embeddedGeneration += 1;
329905
+ let registered$1 = false;
329906
+ for (const face of faces) {
329907
+ if (!face?.embeddable)
329908
+ continue;
329909
+ const physicalFamily = this.#physicalFamilyFor(face.family);
329910
+ const release = registry2.registerOwnedFace({
329911
+ family: physicalFamily,
329912
+ source: face.source,
329913
+ weight: face.weight,
329914
+ style: face.style
329915
+ });
329916
+ if (release) {
329917
+ this.#embeddedDisposers.push(release);
329918
+ this.#resolver.mapEmbedded(face.family, physicalFamily);
329919
+ registered$1 = true;
329920
+ }
329921
+ }
329922
+ if (registered$1)
329923
+ this.#getGate()?.invalidateCachesForConfigRegistration();
329924
+ }
329925
+ #physicalFamilyFor(logicalFamily) {
329926
+ const key2 = logicalFamily.trim().toLowerCase();
329927
+ let physical = this.#embeddedPhysical.get(key2);
329928
+ if (!physical) {
329929
+ physical = `${this.#embeddedNamespace}${this.#embeddedGeneration}_${this.#embeddedPhysical.size}_${sanitizeFamilyToken(logicalFamily)}`;
329930
+ this.#embeddedPhysical.set(key2, physical);
329931
+ }
329932
+ return physical;
329933
+ }
329428
329934
  add(families) {
329429
329935
  let committed = false;
329430
329936
  try {
@@ -329446,17 +329952,17 @@ menclose::after {
329446
329952
  throw new Error("[superdoc] fonts.add: the font registry is not ready yet");
329447
329953
  let changed = false;
329448
329954
  for (const entry of families) {
329449
- const family$1 = entry?.family;
329955
+ const family2 = entry?.family;
329450
329956
  const faces = entry?.faces;
329451
- if (typeof family$1 !== "string" || !family$1.trim())
329957
+ if (typeof family2 !== "string" || !family2.trim())
329452
329958
  throw new Error('[superdoc] fonts.add: each family needs a non-empty "family" name');
329453
329959
  if (!Array.isArray(faces) || faces.length === 0)
329454
- throw new Error(`[superdoc] fonts.add: family "${family$1}" needs at least one face in "faces"`);
329960
+ throw new Error(`[superdoc] fonts.add: family "${family2}" needs at least one face in "faces"`);
329455
329961
  for (const face of faces) {
329456
329962
  if (!face || typeof face.source !== "string" || !face.source.trim())
329457
- throw new Error(`[superdoc] fonts.add: family "${family$1}" has a face with no "source" URL`);
329963
+ throw new Error(`[superdoc] fonts.add: family "${family2}" has a face with no "source" URL`);
329458
329964
  if (registry2.register({
329459
- family: family$1,
329965
+ family: family2,
329460
329966
  source: toCssFontSource(face.source),
329461
329967
  descriptors: {
329462
329968
  weight: face.weight == null ? undefined : String(face.weight),
@@ -329476,7 +329982,7 @@ menclose::after {
329476
329982
  const registry2 = this.#getGate()?.resolveRegistry();
329477
329983
  if (!registry2)
329478
329984
  throw new Error("[superdoc] fonts.preload: the font registry is not ready yet");
329479
- const hasFace = (family$1, weight, style2) => registry2.hasFace(family$1, weight, style2);
329985
+ const hasFace = (family2, weight, style2) => registry2.hasFace(family2, weight, style2);
329480
329986
  const face = {
329481
329987
  weight: "400",
329482
329988
  style: "normal"
@@ -329522,6 +330028,13 @@ menclose::after {
329522
330028
  this.#runtimeReflowQueued = false;
329523
330029
  this.#runtimeReflowToken += 1;
329524
330030
  }
330031
+ #releaseEmbeddedFaces() {
330032
+ for (const release of this.#embeddedDisposers)
330033
+ release();
330034
+ this.#embeddedDisposers.length = 0;
330035
+ this.#embeddedPhysical.clear();
330036
+ this.#resolver.clearEmbedded();
330037
+ }
329525
330038
  }, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, NATIVE_SELECTION_STYLES = `
329526
330039
  /* Hide native browser selection on layout engine content.
329527
330040
  * We render our own selection overlay via PresentationEditor's #localSelectionLayer
@@ -329599,13 +330112,13 @@ menclose::after {
329599
330112
  return;
329600
330113
  console.log(...args$1);
329601
330114
  }, 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;
329602
- var init_src_BhZiOqOm_es = __esm(() => {
330115
+ var init_src_x_i3LADL_es = __esm(() => {
329603
330116
  init_rolldown_runtime_Bg48TavK_es();
329604
- init_SuperConverter_bEQ45IUD_es();
330117
+ init_SuperConverter_BVWG4qnQ_es();
329605
330118
  init_jszip_C49i9kUs_es();
329606
330119
  init_xml_js_CqGKpaft_es();
329607
330120
  init_uuid_qzgm05fK_es();
329608
- init_create_headless_toolbar_BmFWtej0_es();
330121
+ init_create_headless_toolbar_JvWvpCga_es();
329609
330122
  init_constants_D9qj59G2_es();
329610
330123
  init_dist_B8HfvhaK_es();
329611
330124
  init_unified_Dsuw2be5_es();
@@ -350251,44 +350764,15 @@ function print() { __p += __j.call(arguments, '') }
350251
350764
  };
350252
350765
  }
350253
350766
  }, [["__scopeId", "data-v-d25821a5"]]);
350254
- TOOLBAR_FONTS = [
350255
- {
350256
- label: "Georgia",
350257
- key: "Georgia, serif",
350258
- fontWeight: 400,
350259
- props: {
350260
- style: { fontFamily: "Georgia, serif" },
350261
- "data-item": "btn-fontFamily-option"
350262
- }
350263
- },
350264
- {
350265
- label: "Arial",
350266
- key: "Arial, sans-serif",
350267
- fontWeight: 400,
350268
- props: {
350269
- style: { fontFamily: "Arial, sans-serif" },
350270
- "data-item": "btn-fontFamily-option"
350271
- }
350272
- },
350273
- {
350274
- label: "Courier New",
350275
- key: "Courier New, monospace",
350276
- fontWeight: 400,
350277
- props: {
350278
- style: { fontFamily: "Courier New, monospace" },
350279
- "data-item": "btn-fontFamily-option"
350280
- }
350281
- },
350282
- {
350283
- label: "Times New Roman",
350284
- key: "Times New Roman, serif",
350285
- fontWeight: 400,
350286
- props: {
350287
- style: { fontFamily: "Times New Roman, serif" },
350288
- "data-item": "btn-fontFamily-option"
350289
- }
350767
+ TOOLBAR_FONTS = getDefaultFontOfferings().map((offering) => ({
350768
+ label: offering.logicalFamily,
350769
+ key: fontOfferingStack(offering),
350770
+ fontWeight: 400,
350771
+ props: {
350772
+ style: { fontFamily: fontOfferingRenderStack(offering) },
350773
+ "data-item": "btn-fontFamily-option"
350290
350774
  }
350291
- ];
350775
+ }));
350292
350776
  TOOLBAR_FONT_SIZES = [
350293
350777
  {
350294
350778
  label: "8",
@@ -356601,229 +357085,6 @@ function print() { __p += __j.call(arguments, '') }
356601
357085
  wave: 1,
356602
357086
  doubleWave: 2
356603
357087
  };
356604
- SETTLED_STATUSES = [
356605
- "loaded",
356606
- "failed",
356607
- "timed_out",
356608
- "fallback_used"
356609
- ];
356610
- SUBSTITUTION_EVIDENCE = Object.freeze([
356611
- {
356612
- evidenceId: "calibri",
356613
- logicalFamily: "Calibri",
356614
- physicalFamily: "Carlito",
356615
- verdict: "metric_safe",
356616
- faces: {
356617
- regular: true,
356618
- bold: true,
356619
- italic: true,
356620
- boldItalic: true
356621
- },
356622
- advance: {
356623
- meanDelta: 0,
356624
- maxDelta: 0
356625
- },
356626
- gates: {
356627
- static: "pass",
356628
- metric: "pass",
356629
- layout: "pass",
356630
- ship: "pass"
356631
- },
356632
- policyAction: "substitute",
356633
- measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
356634
- candidateLicense: "OFL-1.1",
356635
- exportRule: "preserve_original_name"
356636
- },
356637
- {
356638
- evidenceId: "cambria",
356639
- logicalFamily: "Cambria",
356640
- physicalFamily: "Caladea",
356641
- verdict: "visual_only",
356642
- faceVerdicts: {
356643
- regular: "metric_safe",
356644
- bold: "metric_safe",
356645
- italic: "metric_safe",
356646
- boldItalic: "visual_only"
356647
- },
356648
- glyphExceptions: [{
356649
- slot: "boldItalic",
356650
- codepoint: 96,
356651
- advanceDelta: 0.231,
356652
- note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
356653
- }],
356654
- faces: {
356655
- regular: true,
356656
- bold: true,
356657
- italic: true,
356658
- boldItalic: true
356659
- },
356660
- advance: {
356661
- meanDelta: 0.0002378,
356662
- maxDelta: 0.2310758
356663
- },
356664
- gates: {
356665
- static: "pass",
356666
- metric: "pass",
356667
- layout: "not_run",
356668
- ship: "pass"
356669
- },
356670
- policyAction: "substitute",
356671
- measurementRefs: [
356672
- "cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
356673
- "cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
356674
- "cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
356675
- "cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
356676
- ],
356677
- candidateLicense: "Apache-2.0",
356678
- exportRule: "preserve_original_name"
356679
- },
356680
- {
356681
- evidenceId: "arial",
356682
- logicalFamily: "Arial",
356683
- physicalFamily: "Liberation Sans",
356684
- verdict: "metric_safe",
356685
- faces: {
356686
- regular: true,
356687
- bold: true,
356688
- italic: true,
356689
- boldItalic: true
356690
- },
356691
- advance: {
356692
- meanDelta: 0,
356693
- maxDelta: 0
356694
- },
356695
- gates: {
356696
- static: "pass",
356697
- metric: "pass",
356698
- layout: "not_run",
356699
- ship: "pass"
356700
- },
356701
- policyAction: "substitute",
356702
- measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
356703
- candidateLicense: "OFL-1.1",
356704
- exportRule: "preserve_original_name"
356705
- },
356706
- {
356707
- evidenceId: "times-new-roman",
356708
- logicalFamily: "Times New Roman",
356709
- physicalFamily: "Liberation Serif",
356710
- verdict: "metric_safe",
356711
- faces: {
356712
- regular: true,
356713
- bold: true,
356714
- italic: true,
356715
- boldItalic: true
356716
- },
356717
- advance: {
356718
- meanDelta: 0,
356719
- maxDelta: 0
356720
- },
356721
- gates: {
356722
- static: "pass",
356723
- metric: "pass",
356724
- layout: "not_run",
356725
- ship: "pass"
356726
- },
356727
- policyAction: "substitute",
356728
- measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
356729
- candidateLicense: "OFL-1.1",
356730
- exportRule: "preserve_original_name"
356731
- },
356732
- {
356733
- evidenceId: "courier-new",
356734
- logicalFamily: "Courier New",
356735
- physicalFamily: "Liberation Mono",
356736
- verdict: "metric_safe",
356737
- faces: {
356738
- regular: true,
356739
- bold: true,
356740
- italic: true,
356741
- boldItalic: true
356742
- },
356743
- advance: {
356744
- meanDelta: 0,
356745
- maxDelta: 0
356746
- },
356747
- gates: {
356748
- static: "pass",
356749
- metric: "pass",
356750
- layout: "not_run",
356751
- ship: "pass"
356752
- },
356753
- policyAction: "substitute",
356754
- measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
356755
- candidateLicense: "OFL-1.1",
356756
- exportRule: "preserve_original_name"
356757
- },
356758
- {
356759
- evidenceId: "helvetica",
356760
- logicalFamily: "Helvetica",
356761
- physicalFamily: "Liberation Sans",
356762
- verdict: "metric_safe",
356763
- faces: {
356764
- regular: true,
356765
- bold: true,
356766
- italic: true,
356767
- boldItalic: true
356768
- },
356769
- advance: {
356770
- meanDelta: 0,
356771
- maxDelta: 0
356772
- },
356773
- gates: {
356774
- static: "not_run",
356775
- metric: "pass",
356776
- layout: "not_run",
356777
- ship: "fail"
356778
- },
356779
- policyAction: "substitute",
356780
- measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
356781
- candidateLicense: "OFL-1.1",
356782
- exportRule: "preserve_original_name"
356783
- },
356784
- {
356785
- evidenceId: "calibri-light",
356786
- logicalFamily: "Calibri Light",
356787
- physicalFamily: "Carlito",
356788
- verdict: "visual_only",
356789
- faces: {
356790
- regular: false,
356791
- bold: false,
356792
- italic: false,
356793
- boldItalic: false
356794
- },
356795
- advance: {
356796
- meanDelta: 0.0148,
356797
- maxDelta: 0.066
356798
- },
356799
- gates: {
356800
- static: "not_run",
356801
- metric: "fail",
356802
- layout: "not_run",
356803
- ship: "fail"
356804
- },
356805
- policyAction: "category_fallback",
356806
- measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
356807
- candidateLicense: "OFL-1.1",
356808
- exportRule: "preserve_original_name"
356809
- }
356810
- ]);
356811
- BUNDLED_SUBSTITUTES = deriveBundledSubstitutes();
356812
- CATEGORY_FALLBACKS = deriveCategoryFallbacks();
356813
- defaultResolver = new FontResolver;
356814
- DEFAULT_FONT_MEASURE_CONTEXT = Object.freeze({
356815
- resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily(cssFontFamily),
356816
- fontSignature: ""
356817
- });
356818
- BUNDLED_MANIFEST = Object.freeze([
356819
- family("Carlito", "Carlito", "OFL-1.1"),
356820
- family("Caladea", "Caladea", "Apache-2.0"),
356821
- family("Liberation Sans", "LiberationSans", "OFL-1.1"),
356822
- family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
356823
- family("Liberation Mono", "LiberationMono", "OFL-1.1")
356824
- ]);
356825
- installedRegistries = /* @__PURE__ */ new WeakMap;
356826
- registriesByFontSet = /* @__PURE__ */ new WeakMap;
356827
357088
  PX_PER_PT$12 = 96 / 72;
356828
357089
  BORDER_SIDES3 = [
356829
357090
  "top",
@@ -358109,7 +358370,7 @@ function print() { __p += __j.call(arguments, '') }
358109
358370
  });
358110
358371
  #fontPlanBlocks = null;
358111
358372
  #fontPlan = null;
358112
- #hasFace = (family$1, weight, style2) => this.#fontGate ? this.#fontGate.resolveRegistry().hasFace(family$1, weight, style2) : false;
358373
+ #hasFace = (family2, weight, style2) => this.#fontGate ? this.#fontGate.resolveRegistry().hasFace(family2, weight, style2) : false;
358113
358374
  #lastFontsChangedKey = null;
358114
358375
  #lastFontsChangedVersion = -1;
358115
358376
  #lastFontsChangedPayload = null;
@@ -358416,6 +358677,7 @@ function print() { __p += __j.call(arguments, '') }
358416
358677
  }
358417
358678
  });
358418
358679
  this.#fontController.applyInitialConfig(this.#options.fontAssets);
358680
+ this.#applyEmbeddedDocumentFonts();
358419
358681
  if (typeof this.#options.disableContextMenu === "boolean")
358420
358682
  this.setContextMenuDisabled(this.#options.disableContextMenu);
358421
358683
  this.#setupHeaderFooterSession();
@@ -359421,6 +359683,10 @@ function print() { __p += __j.call(arguments, '') }
359421
359683
  async preloadFonts(families) {
359422
359684
  await this.#fontController.preload(families);
359423
359685
  }
359686
+ #applyEmbeddedDocumentFonts() {
359687
+ const converter = this.#editor.converter;
359688
+ this.#fontController.applyEmbeddedFaces(converter?.getEmbeddedFontFaces?.());
359689
+ }
359424
359690
  #requestFontReflow() {
359425
359691
  this.#layoutState = {
359426
359692
  ...this.#layoutState,
@@ -360716,6 +360982,7 @@ function print() { __p += __j.call(arguments, '') }
360716
360982
  this.#fontController.reset();
360717
360983
  this.#layoutFontSignature = "";
360718
360984
  this.#fontController.applyInitialConfig(this.#options.fontAssets);
360985
+ this.#applyEmbeddedDocumentFonts();
360719
360986
  this.#resetFontReportStateForDocumentChange();
360720
360987
  this.#refreshHeaderFooterStructureThenRerender({ purgeCachedEditors: true });
360721
360988
  };
@@ -364685,11 +364952,251 @@ function print() { __p += __j.call(arguments, '') }
364685
364952
  ]);
364686
364953
  });
364687
364954
 
364688
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-C2hkLuct.es.js
364689
- var 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;
364690
- var init_create_super_doc_ui_C2hkLuct_es = __esm(() => {
364691
- init_SuperConverter_bEQ45IUD_es();
364692
- init_create_headless_toolbar_BmFWtej0_es();
364955
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-B66Edat2.es.js
364956
+ 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;
364957
+ var init_create_super_doc_ui_B66Edat2_es = __esm(() => {
364958
+ init_SuperConverter_BVWG4qnQ_es();
364959
+ init_create_headless_toolbar_JvWvpCga_es();
364960
+ headlessToolbarConstants = {
364961
+ DEFAULT_TEXT_ALIGN_OPTIONS: [
364962
+ {
364963
+ label: "Left",
364964
+ value: "left"
364965
+ },
364966
+ {
364967
+ label: "Center",
364968
+ value: "center"
364969
+ },
364970
+ {
364971
+ label: "Right",
364972
+ value: "right"
364973
+ },
364974
+ {
364975
+ label: "Justify",
364976
+ value: "justify"
364977
+ }
364978
+ ],
364979
+ DEFAULT_LINE_HEIGHT_OPTIONS: [
364980
+ {
364981
+ label: "1.00",
364982
+ value: 1
364983
+ },
364984
+ {
364985
+ label: "1.15",
364986
+ value: 1.15
364987
+ },
364988
+ {
364989
+ label: "1.50",
364990
+ value: 1.5
364991
+ },
364992
+ {
364993
+ label: "2.00",
364994
+ value: 2
364995
+ },
364996
+ {
364997
+ label: "2.50",
364998
+ value: 2.5
364999
+ },
365000
+ {
365001
+ label: "3.00",
365002
+ value: 3
365003
+ }
365004
+ ],
365005
+ DEFAULT_ZOOM_OPTIONS: [
365006
+ {
365007
+ label: "50%",
365008
+ value: 50
365009
+ },
365010
+ {
365011
+ label: "75%",
365012
+ value: 75
365013
+ },
365014
+ {
365015
+ label: "90%",
365016
+ value: 90
365017
+ },
365018
+ {
365019
+ label: "100%",
365020
+ value: 100
365021
+ },
365022
+ {
365023
+ label: "125%",
365024
+ value: 125
365025
+ },
365026
+ {
365027
+ label: "150%",
365028
+ value: 150
365029
+ },
365030
+ {
365031
+ label: "200%",
365032
+ value: 200
365033
+ }
365034
+ ],
365035
+ DEFAULT_DOCUMENT_MODE_OPTIONS: [
365036
+ {
365037
+ label: "Editing",
365038
+ value: "editing",
365039
+ description: "Edit document directly"
365040
+ },
365041
+ {
365042
+ label: "Suggesting",
365043
+ value: "suggesting",
365044
+ description: "Edits become suggestions"
365045
+ },
365046
+ {
365047
+ label: "Viewing",
365048
+ value: "viewing",
365049
+ description: "View clean version of document only"
365050
+ }
365051
+ ],
365052
+ DEFAULT_FONT_SIZE_OPTIONS: [
365053
+ {
365054
+ label: "8",
365055
+ value: "8pt"
365056
+ },
365057
+ {
365058
+ label: "9",
365059
+ value: "9pt"
365060
+ },
365061
+ {
365062
+ label: "10",
365063
+ value: "10pt"
365064
+ },
365065
+ {
365066
+ label: "11",
365067
+ value: "11pt"
365068
+ },
365069
+ {
365070
+ label: "12",
365071
+ value: "12pt"
365072
+ },
365073
+ {
365074
+ label: "14",
365075
+ value: "14pt"
365076
+ },
365077
+ {
365078
+ label: "18",
365079
+ value: "18pt"
365080
+ },
365081
+ {
365082
+ label: "24",
365083
+ value: "24pt"
365084
+ },
365085
+ {
365086
+ label: "30",
365087
+ value: "30pt"
365088
+ },
365089
+ {
365090
+ label: "36",
365091
+ value: "36pt"
365092
+ },
365093
+ {
365094
+ label: "48",
365095
+ value: "48pt"
365096
+ },
365097
+ {
365098
+ label: "60",
365099
+ value: "60pt"
365100
+ },
365101
+ {
365102
+ label: "72",
365103
+ value: "72pt"
365104
+ },
365105
+ {
365106
+ label: "96",
365107
+ value: "96pt"
365108
+ }
365109
+ ],
365110
+ DEFAULT_FONT_FAMILY_OPTIONS: getDefaultFontFamilyOptions(),
365111
+ DEFAULT_TEXT_COLOR_OPTIONS: [
365112
+ {
365113
+ label: "Black",
365114
+ value: "#000000"
365115
+ },
365116
+ {
365117
+ label: "Dark Gray",
365118
+ value: "#434343"
365119
+ },
365120
+ {
365121
+ label: "Gray",
365122
+ value: "#666666"
365123
+ },
365124
+ {
365125
+ label: "Light Gray",
365126
+ value: "#999999"
365127
+ },
365128
+ {
365129
+ label: "Red",
365130
+ value: "#ff0000"
365131
+ },
365132
+ {
365133
+ label: "Orange",
365134
+ value: "#ff9900"
365135
+ },
365136
+ {
365137
+ label: "Yellow",
365138
+ value: "#ffff00"
365139
+ },
365140
+ {
365141
+ label: "Green",
365142
+ value: "#00ff00"
365143
+ },
365144
+ {
365145
+ label: "Cyan",
365146
+ value: "#00ffff"
365147
+ },
365148
+ {
365149
+ label: "Blue",
365150
+ value: "#0000ff"
365151
+ },
365152
+ {
365153
+ label: "Purple",
365154
+ value: "#9900ff"
365155
+ },
365156
+ {
365157
+ label: "Magenta",
365158
+ value: "#ff00ff"
365159
+ },
365160
+ {
365161
+ label: "None",
365162
+ value: "none"
365163
+ }
365164
+ ],
365165
+ DEFAULT_HIGHLIGHT_COLOR_OPTIONS: [
365166
+ {
365167
+ label: "Yellow",
365168
+ value: "#ffff00"
365169
+ },
365170
+ {
365171
+ label: "Green",
365172
+ value: "#00ff00"
365173
+ },
365174
+ {
365175
+ label: "Cyan",
365176
+ value: "#00ffff"
365177
+ },
365178
+ {
365179
+ label: "Pink",
365180
+ value: "#ff00ff"
365181
+ },
365182
+ {
365183
+ label: "Blue",
365184
+ value: "#0000ff"
365185
+ },
365186
+ {
365187
+ label: "Red",
365188
+ value: "#ff0000"
365189
+ },
365190
+ {
365191
+ label: "Orange",
365192
+ value: "#ff9900"
365193
+ },
365194
+ {
365195
+ label: "None",
365196
+ value: "none"
365197
+ }
365198
+ ]
365199
+ };
364693
365200
  MOD_ALIASES = new Set([
364694
365201
  "Mod",
364695
365202
  "Meta",
@@ -364731,16 +365238,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
364731
365238
 
364732
365239
  // ../../packages/superdoc/dist/super-editor.es.js
364733
365240
  var init_super_editor_es = __esm(() => {
364734
- init_src_BhZiOqOm_es();
364735
- init_SuperConverter_bEQ45IUD_es();
365241
+ init_src_x_i3LADL_es();
365242
+ init_SuperConverter_BVWG4qnQ_es();
364736
365243
  init_jszip_C49i9kUs_es();
364737
365244
  init_xml_js_CqGKpaft_es();
364738
- init_create_headless_toolbar_BmFWtej0_es();
365245
+ init_create_headless_toolbar_JvWvpCga_es();
364739
365246
  init_constants_D9qj59G2_es();
364740
365247
  init_dist_B8HfvhaK_es();
364741
365248
  init_unified_Dsuw2be5_es();
364742
365249
  init_DocxZipper_Bu2Fhqkw_es();
364743
- init_create_super_doc_ui_C2hkLuct_es();
365250
+ init_create_super_doc_ui_B66Edat2_es();
364744
365251
  init_ui_C5PAS9hY_es();
364745
365252
  init_eventemitter3_BnGqBE_Q_es();
364746
365253
  init_errors_CNaD6vcg_es();