@superdoc-dev/cli 0.16.0-next.31 → 0.16.0-next.33

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 +1637 -1320
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -3382,7 +3382,7 @@ More content with **bold** and *italic*.`
3382
3382
  "trackChanges.list": {
3383
3383
  memberPath: "trackChanges.list",
3384
3384
  description: "List all tracked changes in the document.",
3385
- expectedResult: "Returns a TrackChangesListResult with tracked change entries (`insert`, `delete`, `replacement`, `format`, `structural`), total count, and raw imported Word OOXML revision IDs (`w:id`) when available. Structural changes (whole-table insert/delete) carry a `subtype` of `table-insert` or `table-delete`.",
3385
+ expectedResult: "Returns a TrackChangesListResult with tracked change entries (`insert`, `delete`, `replacement`, `format`), total count, and raw imported Word OOXML revision IDs (`w:id`) when available. Whole-table tracked insertions and deletions are surfaced through the legacy `insert` / `delete` types.",
3386
3386
  requiresDocumentContext: true,
3387
3387
  metadata: readOperation({
3388
3388
  idempotency: "idempotent",
@@ -3396,7 +3396,7 @@ More content with **bold** and *italic*.`
3396
3396
  "trackChanges.get": {
3397
3397
  memberPath: "trackChanges.get",
3398
3398
  description: "Retrieve a single tracked change by ID.",
3399
- expectedResult: "Returns a TrackChangeInfo object with the change type (`insert`, `delete`, `replacement`, `format`, `structural`), author, date, affected content, and raw imported Word OOXML revision IDs (`w:id`) when available. Structural changes (whole-table insert/delete) carry a `subtype` of `table-insert` or `table-delete`.",
3399
+ expectedResult: "Returns a TrackChangeInfo object with the change type (`insert`, `delete`, `replacement`, `format`), author, date, affected content, and raw imported Word OOXML revision IDs (`w:id`) when available. Whole-table tracked insertions and deletions are surfaced through the legacy `insert` / `delete` types.",
3400
3400
  requiresDocumentContext: true,
3401
3401
  metadata: readOperation({
3402
3402
  idempotency: "idempotent",
@@ -3416,6 +3416,7 @@ More content with **bold** and *italic*.`
3416
3416
  supportsTrackedMode: false,
3417
3417
  possibleFailureCodes: [
3418
3418
  "NO_OP",
3419
+ "INVALID_INPUT",
3419
3420
  "INVALID_TARGET",
3420
3421
  "TARGET_NOT_FOUND",
3421
3422
  "CAPABILITY_UNAVAILABLE",
@@ -8780,7 +8781,7 @@ var init_schemas = __esm(() => {
8780
8781
  init_style_policy_types();
8781
8782
  init_paragraphs();
8782
8783
  init_styles();
8783
- trackChangeTypeValues = ["insert", "delete", "replacement", "format", "structural"];
8784
+ trackChangeTypeValues = ["insert", "delete", "replacement", "format"];
8784
8785
  nodeTypeValues = NODE_TYPES;
8785
8786
  blockNodeTypeValues = BLOCK_NODE_TYPES;
8786
8787
  deletableBlockNodeTypeValues = DELETABLE_BLOCK_NODE_TYPES;
@@ -9550,10 +9551,6 @@ var init_schemas = __esm(() => {
9550
9551
  address: trackedChangeAddressSchema,
9551
9552
  id: { type: "string" },
9552
9553
  type: { enum: [...trackChangeTypeValues] },
9553
- subtype: {
9554
- enum: ["table-insert", "table-delete"],
9555
- description: "Finer classification for structural changes (type === 'structural')."
9556
- },
9557
9554
  grouping: { enum: ["standalone", "replacement-pair", "unknown"] },
9558
9555
  pairedWithChangeId: { type: ["string", "null"] },
9559
9556
  wordRevisionIds: trackChangeWordRevisionIdsSchema,
@@ -9568,10 +9565,6 @@ var init_schemas = __esm(() => {
9568
9565
  trackChangeDomainItemSchema = discoveryItemSchema({
9569
9566
  address: trackedChangeAddressSchema,
9570
9567
  type: { enum: [...trackChangeTypeValues] },
9571
- subtype: {
9572
- enum: ["table-insert", "table-delete"],
9573
- description: "Finer classification for structural changes (type === 'structural')."
9574
- },
9575
9568
  grouping: { enum: ["standalone", "replacement-pair", "unknown"] },
9576
9569
  pairedWithChangeId: { type: ["string", "null"] },
9577
9570
  wordRevisionIds: trackChangeWordRevisionIdsSchema,
@@ -11885,7 +11878,7 @@ var init_schemas = __esm(() => {
11885
11878
  offset: { type: "integer", description: "Number of tracked changes to skip for pagination." },
11886
11879
  type: {
11887
11880
  enum: [...trackChangeTypeValues],
11888
- description: "Filter by change type: 'insert', 'delete', 'replacement', 'format', or 'structural'."
11881
+ description: "Filter by change type: 'insert', 'delete', 'replacement', or 'format'."
11889
11882
  },
11890
11883
  in: {
11891
11884
  oneOf: [storyLocatorSchema, { const: "all" }],
@@ -68373,7 +68366,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
68373
68366
  emptyOptions2 = {};
68374
68367
  });
68375
68368
 
68376
- // ../../packages/superdoc/dist/chunks/SuperConverter-bEQ45IUD.es.js
68369
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DOoAJ6Zk.es.js
68377
68370
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68378
68371
  const fieldValue = extension$1.config[field];
68379
68372
  if (typeof fieldValue === "function")
@@ -102487,6 +102480,315 @@ function translateMark(mark) {
102487
102480
  }
102488
102481
  return markElement;
102489
102482
  }
102483
+ function isSettled(status) {
102484
+ return SETTLED_STATUSES.includes(status);
102485
+ }
102486
+ function normalizeFamilyKey$1(family$1) {
102487
+ return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
102488
+ }
102489
+ function sortPairs(pairs) {
102490
+ return pairs.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
102491
+ }
102492
+ function deriveBundledSubstitutes() {
102493
+ const substitutes = {};
102494
+ for (const row of SUBSTITUTION_EVIDENCE)
102495
+ if (row.policyAction === "substitute" && row.physicalFamily)
102496
+ substitutes[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
102497
+ return Object.freeze(substitutes);
102498
+ }
102499
+ function deriveCategoryFallbacks() {
102500
+ const fallbacks = {};
102501
+ for (const row of SUBSTITUTION_EVIDENCE)
102502
+ if (row.policyAction === "category_fallback" && row.physicalFamily)
102503
+ fallbacks[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
102504
+ return Object.freeze(fallbacks);
102505
+ }
102506
+ function stripFamilyQuotes(family$1) {
102507
+ return family$1.trim().replace(/^["']|["']$/g, "");
102508
+ }
102509
+ function splitStack(cssFontFamily) {
102510
+ return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
102511
+ }
102512
+ function createFontResolver() {
102513
+ return new FontResolver;
102514
+ }
102515
+ function resolveFontFamily(logicalFamily) {
102516
+ return defaultResolver.resolveFontFamily(logicalFamily);
102517
+ }
102518
+ function resolvePhysicalFamily(cssFontFamily) {
102519
+ return defaultResolver.resolvePhysicalFamily(cssFontFamily);
102520
+ }
102521
+ function resolveFace(logicalFamily, face, hasFace) {
102522
+ return defaultResolver.resolveFace(logicalFamily, face, hasFace);
102523
+ }
102524
+ function getFontConfigVersion() {
102525
+ return fontConfigVersion;
102526
+ }
102527
+ function bumpFontConfigVersion() {
102528
+ return fontConfigVersion += 1;
102529
+ }
102530
+ function fourFaces(filePrefix) {
102531
+ return [
102532
+ {
102533
+ weight: "normal",
102534
+ style: "normal",
102535
+ file: `${filePrefix}-Regular.woff2`
102536
+ },
102537
+ {
102538
+ weight: "bold",
102539
+ style: "normal",
102540
+ file: `${filePrefix}-Bold.woff2`
102541
+ },
102542
+ {
102543
+ weight: "normal",
102544
+ style: "italic",
102545
+ file: `${filePrefix}-Italic.woff2`
102546
+ },
102547
+ {
102548
+ weight: "bold",
102549
+ style: "italic",
102550
+ file: `${filePrefix}-BoldItalic.woff2`
102551
+ }
102552
+ ];
102553
+ }
102554
+ function family(name, filePrefix, license) {
102555
+ return {
102556
+ family: name,
102557
+ license,
102558
+ faces: fourFaces(filePrefix)
102559
+ };
102560
+ }
102561
+ function withTrailingSlash(base$1) {
102562
+ return base$1.endsWith("/") ? base$1 : `${base$1}/`;
102563
+ }
102564
+ function joinUrl(base$1, file) {
102565
+ return `${withTrailingSlash(base$1)}${file}`;
102566
+ }
102567
+ function weightToken(weight) {
102568
+ return weight === "bold" ? "700" : "400";
102569
+ }
102570
+ function bundledAssetSignature(resolve2) {
102571
+ const family$1 = BUNDLED_MANIFEST[0];
102572
+ const face = family$1?.faces[0];
102573
+ if (!family$1 || !face)
102574
+ return "";
102575
+ return resolve2({
102576
+ file: face.file,
102577
+ family: family$1.family,
102578
+ weight: weightToken(face.weight),
102579
+ style: face.style,
102580
+ source: "bundled-substitute"
102581
+ });
102582
+ }
102583
+ function installBundledSubstitutes(registry, options = {}) {
102584
+ const resolve2 = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
102585
+ const signature = bundledAssetSignature(resolve2);
102586
+ const installed = installedRegistries.get(registry);
102587
+ if (installed !== undefined) {
102588
+ if (installed !== signature)
102589
+ 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.`);
102590
+ return;
102591
+ }
102592
+ installedRegistries.set(registry, signature);
102593
+ for (const family$1 of BUNDLED_MANIFEST)
102594
+ for (const face of family$1.faces) {
102595
+ const context = {
102596
+ file: face.file,
102597
+ family: family$1.family,
102598
+ weight: weightToken(face.weight),
102599
+ style: face.style,
102600
+ source: "bundled-substitute"
102601
+ };
102602
+ registry.register({
102603
+ family: family$1.family,
102604
+ source: `url(${resolve2(context)})`,
102605
+ descriptors: {
102606
+ weight: face.weight,
102607
+ style: face.style
102608
+ }
102609
+ });
102610
+ }
102611
+ }
102612
+ function buildFontReport(logicalFamilies, registry, resolver$1) {
102613
+ const seen = /* @__PURE__ */ new Set;
102614
+ const report = [];
102615
+ for (const logical of logicalFamilies) {
102616
+ if (!logical || seen.has(logical))
102617
+ continue;
102618
+ seen.add(logical);
102619
+ const { physicalFamily, reason } = resolver$1 ? resolver$1.resolveFontFamily(logical) : resolveFontFamily(logical);
102620
+ const loadStatus = registry.getStatus(physicalFamily);
102621
+ report.push({
102622
+ logicalFamily: logical,
102623
+ physicalFamily,
102624
+ reason,
102625
+ loadStatus,
102626
+ exportFamily: logical,
102627
+ missing: reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded"
102628
+ });
102629
+ }
102630
+ return report;
102631
+ }
102632
+ function buildFaceReport(usedFaces, registry, resolver$1) {
102633
+ const hasFace = (family$1, weight, style) => registry.hasFace(family$1, weight, style);
102634
+ const seen = /* @__PURE__ */ new Set;
102635
+ const report = [];
102636
+ for (const { logicalFamily, weight, style } of usedFaces) {
102637
+ if (!logicalFamily)
102638
+ continue;
102639
+ const key = `${logicalFamily.toLowerCase()}|${weight}|${style}`;
102640
+ if (seen.has(key))
102641
+ continue;
102642
+ seen.add(key);
102643
+ const face = {
102644
+ weight,
102645
+ style
102646
+ };
102647
+ const { physicalFamily, reason } = resolver$1 ? resolver$1.resolveFace(logicalFamily, face, hasFace) : resolveFace(logicalFamily, face, hasFace);
102648
+ const loadStatus = registry.getFaceStatus({
102649
+ family: physicalFamily,
102650
+ weight,
102651
+ style
102652
+ });
102653
+ const missing = reason === "fallback_face_absent" || reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded";
102654
+ report.push({
102655
+ logicalFamily,
102656
+ physicalFamily: reason === "registered_face" ? logicalFamily : physicalFamily,
102657
+ reason,
102658
+ loadStatus,
102659
+ exportFamily: logicalFamily,
102660
+ missing,
102661
+ face
102662
+ });
102663
+ }
102664
+ return report;
102665
+ }
102666
+ function parseEmbeddingPolicy(bytes) {
102667
+ const view = bytes instanceof ArrayBuffer ? new DataView(bytes) : new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
102668
+ if (view.byteLength < SFNT_TABLE_DIR_OFFSET)
102669
+ return null;
102670
+ const numTables = view.getUint16(4);
102671
+ let os2Offset = -1;
102672
+ for (let i$1 = 0;i$1 < numTables; i$1 += 1) {
102673
+ const record = SFNT_TABLE_DIR_OFFSET + i$1 * SFNT_TABLE_RECORD_SIZE;
102674
+ if (record + SFNT_TABLE_RECORD_SIZE > view.byteLength)
102675
+ return null;
102676
+ if (String.fromCharCode(view.getUint8(record), view.getUint8(record + 1), view.getUint8(record + 2), view.getUint8(record + 3)) === "OS/2") {
102677
+ os2Offset = view.getUint32(record + 8);
102678
+ break;
102679
+ }
102680
+ }
102681
+ if (os2Offset < 0 || os2Offset + OS2_MIN_LENGTH > view.byteLength)
102682
+ return null;
102683
+ const usWeightClass = view.getUint16(os2Offset + OS2_USWEIGHTCLASS);
102684
+ const fsType = view.getUint16(os2Offset + OS2_FSTYPE);
102685
+ const fsSelection = view.getUint16(os2Offset + OS2_FSSELECTION);
102686
+ return {
102687
+ fsType,
102688
+ face: {
102689
+ weight: usWeightClass >= BOLD_WEIGHT_THRESHOLD ? "700" : "400",
102690
+ style: (fsSelection & FS_SELECTION_ITALIC) !== 0 ? "italic" : "normal"
102691
+ },
102692
+ embeddable: (fsType & FS_TYPE_RESTRICTED) === 0
102693
+ };
102694
+ }
102695
+ function quoteFamily(family$1) {
102696
+ return `"${family$1.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
102697
+ }
102698
+ function canonicalizeFontSource(source) {
102699
+ const match = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
102700
+ if (!match)
102701
+ return source;
102702
+ let inner = match[1].trim();
102703
+ if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'"))
102704
+ inner = inner.slice(1, -1);
102705
+ return `url(${JSON.stringify(inner)})`;
102706
+ }
102707
+ function normalizeFamilyKey(family$1) {
102708
+ return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
102709
+ }
102710
+ function normalizeWeight(weight) {
102711
+ if (weight === undefined)
102712
+ return "400";
102713
+ const w = String(weight).trim().toLowerCase();
102714
+ if (w === "bold" || w === "bolder")
102715
+ return "700";
102716
+ const n = Number(w);
102717
+ return Number.isFinite(n) && n >= 600 ? "700" : "400";
102718
+ }
102719
+ function normalizeStyle(style) {
102720
+ if (!style)
102721
+ return "normal";
102722
+ const s = style.trim().toLowerCase();
102723
+ return s.startsWith("italic") || s.startsWith("oblique") ? "italic" : "normal";
102724
+ }
102725
+ function faceKeyOf(family$1, weight, style) {
102726
+ return `${normalizeFamilyKey(family$1)}|${weight}|${style}`;
102727
+ }
102728
+ function faceProbe(family$1, weight, style, size2) {
102729
+ return `${style === "italic" ? "italic " : ""}${weight} ${size2} ${quoteFamily(family$1)}`;
102730
+ }
102731
+ function getFontRegistryFor(fontSet, FontFaceCtor) {
102732
+ if (!fontSet) {
102733
+ if (!domlessRegistry)
102734
+ domlessRegistry = new FontRegistry({});
102735
+ return domlessRegistry;
102736
+ }
102737
+ let registry = registriesByFontSet.get(fontSet);
102738
+ if (!registry) {
102739
+ registry = new FontRegistry({
102740
+ fontSet,
102741
+ FontFaceCtor
102742
+ });
102743
+ registriesByFontSet.set(fontSet, registry);
102744
+ }
102745
+ return registry;
102746
+ }
102747
+ function classifyOffering(policyAction, verdict, physicalFamily, bundled) {
102748
+ if (policyAction === "preserve_only")
102749
+ return "preserve_only";
102750
+ if (policyAction === "customer_supplied" || physicalFamily == null)
102751
+ return "customer_supplied";
102752
+ if (policyAction === "category_fallback")
102753
+ return "category_fallback";
102754
+ if (!bundled)
102755
+ return "requires_asset";
102756
+ return verdict === "metric_safe" ? "default" : "qualified";
102757
+ }
102758
+ function deriveOfferings() {
102759
+ const offerings = SUBSTITUTION_EVIDENCE.map((row) => {
102760
+ const bundled = row.physicalFamily != null && BUNDLED_FAMILIES.has(row.physicalFamily);
102761
+ return {
102762
+ logicalFamily: row.logicalFamily,
102763
+ physicalFamily: row.physicalFamily,
102764
+ generic: row.physicalFamily && PHYSICAL_GENERIC[row.physicalFamily] || "sans-serif",
102765
+ offering: classifyOffering(row.policyAction, row.verdict, row.physicalFamily, bundled),
102766
+ bundled,
102767
+ verdict: row.verdict,
102768
+ evidenceId: row.evidenceId
102769
+ };
102770
+ });
102771
+ return Object.freeze(offerings);
102772
+ }
102773
+ function getDefaultFontOfferings() {
102774
+ const rank$1 = (name) => {
102775
+ const i$1 = DEFAULT_FONT_ORDER.indexOf(name);
102776
+ return i$1 === -1 ? DEFAULT_FONT_ORDER.length : i$1;
102777
+ };
102778
+ return FONT_OFFERINGS.filter((o) => o.offering === "default").sort((a, b) => rank$1(a.logicalFamily) - rank$1(b.logicalFamily));
102779
+ }
102780
+ function fontOfferingStack(offering) {
102781
+ return `${offering.logicalFamily}, ${offering.generic}`;
102782
+ }
102783
+ function fontOfferingRenderStack(offering) {
102784
+ return offering.physicalFamily ? `${offering.physicalFamily}, ${offering.generic}` : fontOfferingStack(offering);
102785
+ }
102786
+ function getDefaultFontFamilyOptions() {
102787
+ return getDefaultFontOfferings().map((offering) => ({
102788
+ label: offering.logicalFamily,
102789
+ value: fontOfferingStack(offering)
102790
+ }));
102791
+ }
102490
102792
  function writeAppStatistics(convertedXml, stats) {
102491
102793
  const elements = ensureElements$1(ensureAppPropertiesRoot(convertedXml));
102492
102794
  upsertSimpleElement(elements, "Words", String(stats.words));
@@ -108273,6 +108575,9 @@ function writeSectPrPageNumbering(sectPr, numbering) {
108273
108575
  if (numbering.chapterSeparator !== undefined)
108274
108576
  setStringAttr(pgNumType, "w:chapSep", numbering.chapterSeparator);
108275
108577
  }
108578
+ function readSectPrTitlePage(sectPr) {
108579
+ return Boolean(findChild(sectPr, "w:titlePg"));
108580
+ }
108276
108581
  function writeSectPrTitlePage(sectPr, enabled) {
108277
108582
  if (enabled) {
108278
108583
  ensureChild(sectPr, "w:titlePg");
@@ -110954,6 +111259,13 @@ function getTextAdapter(editor, input) {
110954
111259
  `, `
110955
111260
  `, { textModel: "visible" });
110956
111261
  }
111262
+ function projectInternalTrackChangeType(type, structural) {
111263
+ if (type !== "structural")
111264
+ return type;
111265
+ if (structural?.subtype === "table-delete" || structural?.side === "deletion")
111266
+ return "delete";
111267
+ return "insert";
111268
+ }
110957
111269
  function rangesOverlap(a, b) {
110958
111270
  return a[0] < b[1] && b[0] < a[1];
110959
111271
  }
@@ -111057,17 +111369,18 @@ function buildPublicTrackedChangeIdMap(grouped, replacements) {
111057
111369
  return publicIdByChange;
111058
111370
  }
111059
111371
  function layerFromChange(change, relationship) {
111372
+ const type = resolveTrackedChangeType(change);
111060
111373
  return {
111061
111374
  id: change.id,
111062
111375
  rawId: change.rawId,
111063
111376
  commandRawId: change.commandRawId,
111064
- type: resolveTrackedChangeType(change),
111377
+ type: projectInternalTrackChangeType(type, change.structural),
111065
111378
  relationship
111066
111379
  };
111067
111380
  }
111068
111381
  function compareOverlapChildren(a, b) {
111069
- const aType = resolveTrackedChangeType(a);
111070
- const bType = resolveTrackedChangeType(b);
111382
+ const aType = projectInternalTrackChangeType(resolveTrackedChangeType(a), a.structural);
111383
+ const bType = projectInternalTrackChangeType(resolveTrackedChangeType(b), b.structural);
111071
111384
  if (aType !== bType) {
111072
111385
  if (aType === "delete")
111073
111386
  return -1;
@@ -114911,7 +115224,7 @@ var isRegExp = (value) => {
114911
115224
  if (encodedAttrs && Object.keys(encodedAttrs).length > 0)
114912
115225
  translated.attrs = { ...encodedAttrs };
114913
115226
  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) => {
115227
+ }, config$35, translator$4, EAST_ASIAN_CHARACTER_REGEX, containsEastAsianCharacters = (text$2) => EAST_ASIAN_CHARACTER_REGEX.test(text$2), resolveFontFamily$1 = (textStyleAttrs, text$2) => {
114915
115228
  if (!text$2)
114916
115229
  return textStyleAttrs;
114917
115230
  const eastAsiaFont = textStyleAttrs?.eastAsiaFontFamily;
@@ -115724,7 +116037,7 @@ var isRegExp = (value) => {
115724
116037
  ...textStyleMark.attrs || {},
115725
116038
  ...mark.attrs || {}
115726
116039
  };
115727
- textStyleMark.attrs = resolveFontFamily(textStyleMark.attrs, child?.text);
116040
+ textStyleMark.attrs = resolveFontFamily$1(textStyleMark.attrs, child?.text);
115728
116041
  }
115729
116042
  return false;
115730
116043
  }
@@ -129218,7 +129531,537 @@ var isRegExp = (value) => {
129218
129531
  tags.push(`</${name}>`);
129219
129532
  return tags;
129220
129533
  }
129221
- }, prepareCommentParaIds = (comment) => {
129534
+ }, SETTLED_STATUSES, SUBSTITUTION_EVIDENCE, BUNDLED_SUBSTITUTES, CATEGORY_FALLBACKS, FontResolver = class {
129535
+ #overrides = /* @__PURE__ */ new Map;
129536
+ #embedded = /* @__PURE__ */ new Map;
129537
+ #version = 0;
129538
+ #cachedSignature = null;
129539
+ map(logicalFamily, physicalFamily) {
129540
+ const key = normalizeFamilyKey$1(logicalFamily);
129541
+ const physical = physicalFamily?.trim();
129542
+ if (!key || !physical)
129543
+ return;
129544
+ if (this.#overrides.get(key) === physical)
129545
+ return;
129546
+ if (key === normalizeFamilyKey$1(physical)) {
129547
+ if (this.#overrides.delete(key)) {
129548
+ this.#version += 1;
129549
+ this.#cachedSignature = null;
129550
+ }
129551
+ return;
129552
+ }
129553
+ this.#overrides.set(key, physical);
129554
+ this.#version += 1;
129555
+ this.#cachedSignature = null;
129556
+ }
129557
+ unmap(logicalFamily) {
129558
+ if (this.#overrides.delete(normalizeFamilyKey$1(logicalFamily))) {
129559
+ this.#version += 1;
129560
+ this.#cachedSignature = null;
129561
+ }
129562
+ }
129563
+ mapEmbedded(logicalFamily, physicalFamily) {
129564
+ const key = normalizeFamilyKey$1(logicalFamily);
129565
+ const physical = physicalFamily?.trim();
129566
+ if (!key || !physical)
129567
+ return;
129568
+ if (this.#embedded.get(key) === physical)
129569
+ return;
129570
+ this.#embedded.set(key, physical);
129571
+ this.#version += 1;
129572
+ this.#cachedSignature = null;
129573
+ }
129574
+ clearEmbedded() {
129575
+ if (this.#embedded.size === 0)
129576
+ return;
129577
+ this.#embedded.clear();
129578
+ this.#version += 1;
129579
+ this.#cachedSignature = null;
129580
+ }
129581
+ reset() {
129582
+ if (this.#overrides.size === 0 && this.#embedded.size === 0)
129583
+ return;
129584
+ this.#overrides.clear();
129585
+ this.#embedded.clear();
129586
+ this.#version += 1;
129587
+ this.#cachedSignature = null;
129588
+ }
129589
+ get version() {
129590
+ return this.#version;
129591
+ }
129592
+ get signature() {
129593
+ if (this.#cachedSignature !== null)
129594
+ return this.#cachedSignature;
129595
+ if (this.#overrides.size === 0 && this.#embedded.size === 0)
129596
+ this.#cachedSignature = "";
129597
+ else {
129598
+ const overridePairs = sortPairs([...this.#overrides.entries()]);
129599
+ this.#cachedSignature = this.#embedded.size === 0 ? JSON.stringify(overridePairs) : JSON.stringify({
129600
+ o: overridePairs,
129601
+ e: sortPairs([...this.#embedded.entries()])
129602
+ });
129603
+ }
129604
+ return this.#cachedSignature;
129605
+ }
129606
+ #physicalFor(bareFamily) {
129607
+ const key = normalizeFamilyKey$1(bareFamily);
129608
+ const override = this.#overrides.get(key);
129609
+ if (override)
129610
+ return {
129611
+ physical: override,
129612
+ reason: "custom_mapping"
129613
+ };
129614
+ const bundled = BUNDLED_SUBSTITUTES[key];
129615
+ if (bundled)
129616
+ return {
129617
+ physical: bundled,
129618
+ reason: "bundled_substitute"
129619
+ };
129620
+ const category = CATEGORY_FALLBACKS[key];
129621
+ if (category)
129622
+ return {
129623
+ physical: category,
129624
+ reason: "category_fallback"
129625
+ };
129626
+ return {
129627
+ physical: bareFamily,
129628
+ reason: "as_requested"
129629
+ };
129630
+ }
129631
+ #resolveFaceLadder(primary, face, hasFace) {
129632
+ const key = normalizeFamilyKey$1(primary);
129633
+ const override = this.#overrides.get(key);
129634
+ if (override && hasFace(override, face.weight, face.style))
129635
+ return {
129636
+ physical: override,
129637
+ reason: "custom_mapping"
129638
+ };
129639
+ const embedded = this.#embedded.get(key);
129640
+ if (embedded && hasFace(embedded, face.weight, face.style))
129641
+ return {
129642
+ physical: embedded,
129643
+ reason: "registered_face"
129644
+ };
129645
+ if (hasFace(primary, face.weight, face.style))
129646
+ return {
129647
+ physical: primary,
129648
+ reason: "registered_face"
129649
+ };
129650
+ const bundled = BUNDLED_SUBSTITUTES[key];
129651
+ if (bundled && hasFace(bundled, face.weight, face.style))
129652
+ return {
129653
+ physical: bundled,
129654
+ reason: "bundled_substitute"
129655
+ };
129656
+ const category = CATEGORY_FALLBACKS[key];
129657
+ if (category && hasFace(category, face.weight, face.style))
129658
+ return {
129659
+ physical: category,
129660
+ reason: "category_fallback"
129661
+ };
129662
+ if (override || bundled)
129663
+ return {
129664
+ physical: primary,
129665
+ reason: "fallback_face_absent"
129666
+ };
129667
+ return {
129668
+ physical: primary,
129669
+ reason: "as_requested"
129670
+ };
129671
+ }
129672
+ resolveFontFamily(logicalFamily) {
129673
+ const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
129674
+ const { physical, reason } = this.#physicalFor(primary);
129675
+ return {
129676
+ logicalFamily,
129677
+ physicalFamily: stripFamilyQuotes(physical),
129678
+ reason
129679
+ };
129680
+ }
129681
+ resolvePhysicalFamily(cssFontFamily) {
129682
+ if (!cssFontFamily)
129683
+ return cssFontFamily;
129684
+ const parts = splitStack(cssFontFamily);
129685
+ if (parts.length === 0)
129686
+ return cssFontFamily;
129687
+ const { physical, reason } = this.#physicalFor(parts[0]);
129688
+ if (reason === "as_requested")
129689
+ return cssFontFamily;
129690
+ return [physical, ...parts.slice(1)].join(", ");
129691
+ }
129692
+ resolveFace(logicalFamily, face, hasFace) {
129693
+ const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
129694
+ const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
129695
+ return {
129696
+ logicalFamily,
129697
+ physicalFamily: stripFamilyQuotes(physical),
129698
+ reason
129699
+ };
129700
+ }
129701
+ resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
129702
+ if (!cssFontFamily)
129703
+ return cssFontFamily;
129704
+ const parts = splitStack(cssFontFamily);
129705
+ if (parts.length === 0)
129706
+ return cssFontFamily;
129707
+ const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
129708
+ if (normalizeFamilyKey$1(physical) !== normalizeFamilyKey$1(parts[0]))
129709
+ return [physical, ...parts.slice(1)].join(", ");
129710
+ return cssFontFamily;
129711
+ }
129712
+ resolvePrimaryPhysicalFamily(family$1) {
129713
+ const primary = splitStack(family$1)[0] ?? family$1;
129714
+ return this.#physicalFor(primary).physical;
129715
+ }
129716
+ resolvePhysicalFamilies(families) {
129717
+ const out = /* @__PURE__ */ new Set;
129718
+ for (const family$1 of families)
129719
+ if (family$1)
129720
+ out.add(this.resolvePrimaryPhysicalFamily(family$1));
129721
+ return [...out];
129722
+ }
129723
+ }, 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 {
129724
+ #fontSet;
129725
+ #FontFaceCtor;
129726
+ #probeSize;
129727
+ #scheduleTimeout;
129728
+ #cancelTimeout;
129729
+ #managed = /* @__PURE__ */ new Map;
129730
+ #facesByKey = /* @__PURE__ */ new Map;
129731
+ #status = /* @__PURE__ */ new Map;
129732
+ #sources = /* @__PURE__ */ new Map;
129733
+ #warnedFailures = /* @__PURE__ */ new Set;
129734
+ #inflight = /* @__PURE__ */ new Map;
129735
+ #faceStatus = /* @__PURE__ */ new Map;
129736
+ #faceInflight = /* @__PURE__ */ new Map;
129737
+ #faceSources = /* @__PURE__ */ new Map;
129738
+ #facesByFamily = /* @__PURE__ */ new Map;
129739
+ #providerFaceKeys = /* @__PURE__ */ new Set;
129740
+ #warnedFaceFailures = /* @__PURE__ */ new Set;
129741
+ constructor(options = {}) {
129742
+ this.#fontSet = options.fontSet ?? null;
129743
+ this.#FontFaceCtor = options.FontFaceCtor ?? null;
129744
+ this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
129745
+ this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
129746
+ this.#cancelTimeout = options.cancelTimeout ?? ((handle2) => globalThis.clearTimeout(handle2));
129747
+ }
129748
+ register(descriptor) {
129749
+ const { family: family$1, source, descriptors: descriptors$1 } = descriptor;
129750
+ const identitySource = typeof source === "string" ? canonicalizeFontSource(source) : source;
129751
+ const weight = normalizeWeight(descriptors$1?.weight);
129752
+ const style = normalizeStyle(descriptors$1?.style);
129753
+ const key = faceKeyOf(family$1, weight, style);
129754
+ if (typeof identitySource === "string") {
129755
+ const existingSource = this.#faceSources.get(key);
129756
+ if (existingSource === identitySource)
129757
+ return {
129758
+ family: family$1,
129759
+ status: this.getStatus(family$1),
129760
+ changed: false
129761
+ };
129762
+ if (existingSource !== undefined)
129763
+ throw new Error(`[superdoc] font face "${key}" is already registered from a different source ("${existingSource}"); a registered face's source cannot be replaced`);
129764
+ }
129765
+ if (this.#FontFaceCtor && this.#fontSet) {
129766
+ const face = new this.#FontFaceCtor(family$1, source, {
129767
+ ...descriptors$1,
129768
+ weight,
129769
+ style
129770
+ });
129771
+ this.#fontSet.add(face);
129772
+ this.#addManagedFace(family$1, key, face);
129773
+ }
129774
+ if (typeof source === "string") {
129775
+ const list$1 = this.#sources.get(family$1) ?? [];
129776
+ if (!list$1.includes(source))
129777
+ list$1.push(source);
129778
+ this.#sources.set(family$1, list$1);
129779
+ }
129780
+ if (!this.#status.has(family$1))
129781
+ this.#status.set(family$1, "unloaded");
129782
+ this.#providerFaceKeys.add(key);
129783
+ this.#trackFace(family$1, key);
129784
+ if (!this.#faceStatus.has(key))
129785
+ this.#faceStatus.set(key, "unloaded");
129786
+ if (typeof identitySource === "string" && !this.#faceSources.has(key))
129787
+ this.#faceSources.set(key, identitySource);
129788
+ return {
129789
+ family: family$1,
129790
+ status: this.getStatus(family$1),
129791
+ changed: true
129792
+ };
129793
+ }
129794
+ #trackFace(family$1, key) {
129795
+ const fam = normalizeFamilyKey(family$1);
129796
+ const set = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
129797
+ set.add(key);
129798
+ this.#facesByFamily.set(fam, set);
129799
+ }
129800
+ isManaged(family$1) {
129801
+ return this.#managed.has(family$1);
129802
+ }
129803
+ registerOwnedFace(descriptor) {
129804
+ const { family: family$1, source, weight, style } = descriptor;
129805
+ if (!this.#FontFaceCtor || !this.#fontSet)
129806
+ return null;
129807
+ const key = faceKeyOf(family$1, weight, style);
129808
+ const face = new this.#FontFaceCtor(family$1, source, {
129809
+ weight,
129810
+ style
129811
+ });
129812
+ this.#fontSet.add(face);
129813
+ this.#addManagedFace(family$1, key, face);
129814
+ this.#providerFaceKeys.add(key);
129815
+ if (!this.#status.has(family$1))
129816
+ this.#status.set(family$1, "unloaded");
129817
+ this.#trackFace(family$1, key);
129818
+ if (!this.#faceStatus.has(key))
129819
+ this.#faceStatus.set(key, "unloaded");
129820
+ let released = false;
129821
+ return () => {
129822
+ if (released)
129823
+ return false;
129824
+ released = true;
129825
+ return this.#removeManagedFace(family$1, key, face);
129826
+ };
129827
+ }
129828
+ #addManagedFace(family$1, key, face) {
129829
+ this.#managed.set(family$1, face);
129830
+ let set = this.#facesByKey.get(key);
129831
+ if (!set) {
129832
+ set = /* @__PURE__ */ new Set;
129833
+ this.#facesByKey.set(key, set);
129834
+ }
129835
+ set.add(face);
129836
+ }
129837
+ #removeManagedFace(family$1, key, face) {
129838
+ const set = this.#facesByKey.get(key);
129839
+ if (!set || !set.delete(face))
129840
+ return false;
129841
+ if (typeof this.#fontSet?.delete === "function")
129842
+ this.#fontSet.delete(face);
129843
+ if (set.size > 0)
129844
+ return true;
129845
+ this.#facesByKey.delete(key);
129846
+ this.#providerFaceKeys.delete(key);
129847
+ this.#faceStatus.delete(key);
129848
+ this.#faceSources.delete(key);
129849
+ const fam = normalizeFamilyKey(family$1);
129850
+ const keys$1 = this.#facesByFamily.get(fam);
129851
+ if (keys$1) {
129852
+ keys$1.delete(key);
129853
+ if (keys$1.size === 0) {
129854
+ this.#facesByFamily.delete(fam);
129855
+ this.#managed.delete(family$1);
129856
+ this.#status.delete(family$1);
129857
+ this.#sources.delete(family$1);
129858
+ }
129859
+ }
129860
+ return true;
129861
+ }
129862
+ getStatus(family$1) {
129863
+ const statuses = [];
129864
+ const faceKeys = this.#facesByFamily.get(normalizeFamilyKey(family$1));
129865
+ if (faceKeys)
129866
+ for (const k of faceKeys)
129867
+ statuses.push(this.#faceStatus.get(k) ?? "unloaded");
129868
+ const legacy = this.#status.get(family$1);
129869
+ if (legacy)
129870
+ statuses.push(legacy);
129871
+ if (statuses.length === 0)
129872
+ return "unloaded";
129873
+ for (const s of [
129874
+ "failed",
129875
+ "timed_out",
129876
+ "fallback_used",
129877
+ "loaded",
129878
+ "loading",
129879
+ "unloaded"
129880
+ ])
129881
+ if (statuses.includes(s))
129882
+ return s;
129883
+ return "unloaded";
129884
+ }
129885
+ hasFace(family$1, weight, style) {
129886
+ const key = faceKeyOf(family$1, weight, style);
129887
+ return this.#providerFaceKeys.has(key) && this.#faceStatus.get(key) !== "failed";
129888
+ }
129889
+ isAvailable(family$1) {
129890
+ if (!this.#fontSet)
129891
+ return false;
129892
+ try {
129893
+ return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
129894
+ } catch {
129895
+ return false;
129896
+ }
129897
+ }
129898
+ awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
129899
+ if (this.#status.get(family$1) === "loaded")
129900
+ return Promise.resolve({
129901
+ family: family$1,
129902
+ status: "loaded"
129903
+ });
129904
+ const existing = this.#inflight.get(family$1);
129905
+ if (existing)
129906
+ return existing;
129907
+ const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
129908
+ this.#inflight.delete(family$1);
129909
+ });
129910
+ this.#inflight.set(family$1, probe);
129911
+ return probe;
129912
+ }
129913
+ async awaitFaces(families, options = {}) {
129914
+ const unique = [...new Set(families)];
129915
+ const timeoutMs = options.timeoutMs ?? 3000;
129916
+ return Promise.all(unique.map((family$1) => this.awaitFace(family$1, timeoutMs)));
129917
+ }
129918
+ getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
129919
+ return [...new Set(families)].map((family$1) => ({
129920
+ family: family$1,
129921
+ status: this.getStatus(family$1),
129922
+ ready: this.awaitFace(family$1, timeoutMs)
129923
+ }));
129924
+ }
129925
+ getStates() {
129926
+ return [...this.#status.entries()].map(([family$1, status]) => ({
129927
+ family: family$1,
129928
+ status
129929
+ }));
129930
+ }
129931
+ getFaceStatus(request) {
129932
+ return this.#faceStatus.get(faceKeyOf(request.family, request.weight, request.style)) ?? "unloaded";
129933
+ }
129934
+ awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
129935
+ const key = faceKeyOf(request.family, request.weight, request.style);
129936
+ if (this.#faceStatus.get(key) === "loaded")
129937
+ return Promise.resolve({
129938
+ request,
129939
+ status: "loaded"
129940
+ });
129941
+ const existing = this.#faceInflight.get(key);
129942
+ if (existing)
129943
+ return existing;
129944
+ const probe = this.#loadOneFace(request, key, timeoutMs).finally(() => {
129945
+ this.#faceInflight.delete(key);
129946
+ });
129947
+ this.#faceInflight.set(key, probe);
129948
+ return probe;
129949
+ }
129950
+ async awaitFaceRequests(requests, options = {}) {
129951
+ const timeoutMs = options.timeoutMs ?? 3000;
129952
+ const seen = /* @__PURE__ */ new Set;
129953
+ const unique = [];
129954
+ for (const r of requests) {
129955
+ const key = faceKeyOf(r.family, r.weight, r.style);
129956
+ if (seen.has(key))
129957
+ continue;
129958
+ seen.add(key);
129959
+ unique.push(r);
129960
+ }
129961
+ return Promise.all(unique.map((r) => this.awaitFaceRequest(r, timeoutMs)));
129962
+ }
129963
+ async#loadOneFace(request, key, timeoutMs) {
129964
+ this.#trackFace(request.family, key);
129965
+ const fontSet = this.#fontSet;
129966
+ if (!fontSet) {
129967
+ this.#faceStatus.set(key, "fallback_used");
129968
+ return {
129969
+ request,
129970
+ status: "fallback_used"
129971
+ };
129972
+ }
129973
+ this.#faceStatus.set(key, "loading");
129974
+ const probe = faceProbe(request.family, request.weight, request.style, this.#probeSize);
129975
+ const TIMEOUT = Symbol("timeout");
129976
+ let handle2;
129977
+ const timeout = new Promise((resolve2) => {
129978
+ handle2 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
129979
+ });
129980
+ try {
129981
+ const settled = await Promise.race([fontSet.load(probe), timeout]);
129982
+ if (settled === TIMEOUT) {
129983
+ this.#faceStatus.set(key, "timed_out");
129984
+ return {
129985
+ request,
129986
+ status: "timed_out"
129987
+ };
129988
+ }
129989
+ const status = settled.length > 0 ? "loaded" : "fallback_used";
129990
+ this.#faceStatus.set(key, status);
129991
+ return {
129992
+ request,
129993
+ status
129994
+ };
129995
+ } catch {
129996
+ this.#faceStatus.set(key, "failed");
129997
+ this.#warnFaceFailureOnce(request, key);
129998
+ return {
129999
+ request,
130000
+ status: "failed"
130001
+ };
130002
+ } finally {
130003
+ this.#cancelTimeout(handle2);
130004
+ }
130005
+ }
130006
+ #warnFaceFailureOnce(request, key) {
130007
+ if (this.#warnedFaceFailures.has(key))
130008
+ return;
130009
+ this.#warnedFaceFailures.add(key);
130010
+ const src = this.#faceSources.get(key);
130011
+ const detail = src ? ` from ${src}` : "";
130012
+ 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.`);
130013
+ }
130014
+ async#loadOne(family$1, timeoutMs) {
130015
+ const fontSet = this.#fontSet;
130016
+ if (!fontSet) {
130017
+ this.#status.set(family$1, "fallback_used");
130018
+ return {
130019
+ family: family$1,
130020
+ status: "fallback_used"
130021
+ };
130022
+ }
130023
+ this.#status.set(family$1, "loading");
130024
+ const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
130025
+ const TIMEOUT = Symbol("timeout");
130026
+ let handle2;
130027
+ const timeout = new Promise((resolve2) => {
130028
+ handle2 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
130029
+ });
130030
+ try {
130031
+ const settled = await Promise.race([fontSet.load(probe), timeout]);
130032
+ if (settled === TIMEOUT) {
130033
+ this.#status.set(family$1, "timed_out");
130034
+ return {
130035
+ family: family$1,
130036
+ status: "timed_out"
130037
+ };
130038
+ }
130039
+ const status = settled.length > 0 ? "loaded" : "fallback_used";
130040
+ this.#status.set(family$1, status);
130041
+ return {
130042
+ family: family$1,
130043
+ status
130044
+ };
130045
+ } catch {
130046
+ this.#status.set(family$1, "failed");
130047
+ this.#warnLoadFailureOnce(family$1);
130048
+ return {
130049
+ family: family$1,
130050
+ status: "failed"
130051
+ };
130052
+ } finally {
130053
+ this.#cancelTimeout(handle2);
130054
+ }
130055
+ }
130056
+ #warnLoadFailureOnce(family$1) {
130057
+ if (this.#warnedFailures.has(family$1))
130058
+ return;
130059
+ this.#warnedFailures.add(family$1);
130060
+ const sources = this.#sources.get(family$1);
130061
+ const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
130062
+ console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
130063
+ }
130064
+ }, registriesByFontSet, domlessRegistry = null, PHYSICAL_GENERIC, BUNDLED_FAMILIES, FONT_OFFERINGS, DEFAULT_FONT_ORDER, prepareCommentParaIds = (comment) => {
129222
130065
  return {
129223
130066
  ...comment,
129224
130067
  commentParaId: generateDocxRandomId()
@@ -133194,7 +134037,7 @@ var isRegExp = (value) => {
133194
134037
  state.kern = kernNode.attributes["w:val"];
133195
134038
  }
133196
134039
  }, SuperConverter;
133197
- var init_SuperConverter_bEQ45IUD_es = __esm(() => {
134040
+ var init_SuperConverter_DOoAJ6Zk_es = __esm(() => {
133198
134041
  init_rolldown_runtime_Bg48TavK_es();
133199
134042
  init_jszip_C49i9kUs_es();
133200
134043
  init_xml_js_CqGKpaft_es();
@@ -138210,7 +139053,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
138210
139053
  "trackChanges.list": {
138211
139054
  memberPath: "trackChanges.list",
138212
139055
  description: "List all tracked changes in the document.",
138213
- expectedResult: "Returns a TrackChangesListResult with tracked change entries (`insert`, `delete`, `replacement`, `format`, `structural`), total count, and raw imported Word OOXML revision IDs (`w:id`) when available. Structural changes (whole-table insert/delete) carry a `subtype` of `table-insert` or `table-delete`.",
139056
+ expectedResult: "Returns a TrackChangesListResult with tracked change entries (`insert`, `delete`, `replacement`, `format`), total count, and raw imported Word OOXML revision IDs (`w:id`) when available. Whole-table tracked insertions and deletions are surfaced through the legacy `insert` / `delete` types.",
138214
139057
  requiresDocumentContext: true,
138215
139058
  metadata: readOperation2({
138216
139059
  idempotency: "idempotent",
@@ -138224,7 +139067,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
138224
139067
  "trackChanges.get": {
138225
139068
  memberPath: "trackChanges.get",
138226
139069
  description: "Retrieve a single tracked change by ID.",
138227
- expectedResult: "Returns a TrackChangeInfo object with the change type (`insert`, `delete`, `replacement`, `format`, `structural`), author, date, affected content, and raw imported Word OOXML revision IDs (`w:id`) when available. Structural changes (whole-table insert/delete) carry a `subtype` of `table-insert` or `table-delete`.",
139070
+ expectedResult: "Returns a TrackChangeInfo object with the change type (`insert`, `delete`, `replacement`, `format`), author, date, affected content, and raw imported Word OOXML revision IDs (`w:id`) when available. Whole-table tracked insertions and deletions are surfaced through the legacy `insert` / `delete` types.",
138228
139071
  requiresDocumentContext: true,
138229
139072
  metadata: readOperation2({
138230
139073
  idempotency: "idempotent",
@@ -138244,6 +139087,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
138244
139087
  supportsTrackedMode: false,
138245
139088
  possibleFailureCodes: [
138246
139089
  "NO_OP",
139090
+ "INVALID_INPUT",
138247
139091
  "INVALID_TARGET",
138248
139092
  "TARGET_NOT_FOUND",
138249
139093
  "CAPABILITY_UNAVAILABLE",
@@ -142723,8 +143567,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
142723
143567
  "insert",
142724
143568
  "delete",
142725
143569
  "replacement",
142726
- "format",
142727
- "structural"
143570
+ "format"
142728
143571
  ];
142729
143572
  nodeTypeValues2 = NODE_TYPES2;
142730
143573
  blockNodeTypeValues2 = BLOCK_NODE_TYPES2;
@@ -143754,10 +144597,6 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
143754
144597
  address: trackedChangeAddressSchema2,
143755
144598
  id: { type: "string" },
143756
144599
  type: { enum: [...trackChangeTypeValues2] },
143757
- subtype: {
143758
- enum: ["table-insert", "table-delete"],
143759
- description: "Finer classification for structural changes (type === 'structural')."
143760
- },
143761
144600
  grouping: { enum: [
143762
144601
  "standalone",
143763
144602
  "replacement-pair",
@@ -143780,10 +144619,6 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
143780
144619
  discoveryResultSchema2(discoveryItemSchema2({
143781
144620
  address: trackedChangeAddressSchema2,
143782
144621
  type: { enum: [...trackChangeTypeValues2] },
143783
- subtype: {
143784
- enum: ["table-insert", "table-delete"],
143785
- description: "Finer classification for structural changes (type === 'structural')."
143786
- },
143787
144622
  grouping: { enum: [
143788
144623
  "standalone",
143789
144624
  "replacement-pair",
@@ -146278,7 +147113,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
146278
147113
  },
146279
147114
  type: {
146280
147115
  enum: [...trackChangeTypeValues2],
146281
- description: "Filter by change type: 'insert', 'delete', 'replacement', 'format', or 'structural'."
147116
+ description: "Filter by change type: 'insert', 'delete', 'replacement', or 'format'."
146282
147117
  },
146283
147118
  in: {
146284
147119
  oneOf: [storyLocatorSchema2, { const: "all" }],
@@ -170513,6 +171348,246 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
170513
171348
  gutter: "0"
170514
171349
  })
170515
171350
  });
171351
+ SETTLED_STATUSES = [
171352
+ "loaded",
171353
+ "failed",
171354
+ "timed_out",
171355
+ "fallback_used"
171356
+ ];
171357
+ SUBSTITUTION_EVIDENCE = Object.freeze([
171358
+ {
171359
+ evidenceId: "calibri",
171360
+ logicalFamily: "Calibri",
171361
+ physicalFamily: "Carlito",
171362
+ verdict: "metric_safe",
171363
+ faces: {
171364
+ regular: true,
171365
+ bold: true,
171366
+ italic: true,
171367
+ boldItalic: true
171368
+ },
171369
+ advance: {
171370
+ meanDelta: 0,
171371
+ maxDelta: 0
171372
+ },
171373
+ gates: {
171374
+ static: "pass",
171375
+ metric: "pass",
171376
+ layout: "pass",
171377
+ ship: "pass"
171378
+ },
171379
+ policyAction: "substitute",
171380
+ measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
171381
+ candidateLicense: "OFL-1.1",
171382
+ exportRule: "preserve_original_name"
171383
+ },
171384
+ {
171385
+ evidenceId: "cambria",
171386
+ logicalFamily: "Cambria",
171387
+ physicalFamily: "Caladea",
171388
+ verdict: "visual_only",
171389
+ faceVerdicts: {
171390
+ regular: "metric_safe",
171391
+ bold: "metric_safe",
171392
+ italic: "metric_safe",
171393
+ boldItalic: "visual_only"
171394
+ },
171395
+ glyphExceptions: [{
171396
+ slot: "boldItalic",
171397
+ codepoint: 96,
171398
+ advanceDelta: 0.231,
171399
+ note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
171400
+ }],
171401
+ faces: {
171402
+ regular: true,
171403
+ bold: true,
171404
+ italic: true,
171405
+ boldItalic: true
171406
+ },
171407
+ advance: {
171408
+ meanDelta: 0.0002378,
171409
+ maxDelta: 0.2310758
171410
+ },
171411
+ gates: {
171412
+ static: "pass",
171413
+ metric: "pass",
171414
+ layout: "not_run",
171415
+ ship: "pass"
171416
+ },
171417
+ policyAction: "substitute",
171418
+ measurementRefs: [
171419
+ "cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
171420
+ "cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
171421
+ "cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
171422
+ "cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
171423
+ ],
171424
+ candidateLicense: "Apache-2.0",
171425
+ exportRule: "preserve_original_name"
171426
+ },
171427
+ {
171428
+ evidenceId: "arial",
171429
+ logicalFamily: "Arial",
171430
+ physicalFamily: "Liberation Sans",
171431
+ verdict: "metric_safe",
171432
+ faces: {
171433
+ regular: true,
171434
+ bold: true,
171435
+ italic: true,
171436
+ boldItalic: true
171437
+ },
171438
+ advance: {
171439
+ meanDelta: 0,
171440
+ maxDelta: 0
171441
+ },
171442
+ gates: {
171443
+ static: "pass",
171444
+ metric: "pass",
171445
+ layout: "not_run",
171446
+ ship: "pass"
171447
+ },
171448
+ policyAction: "substitute",
171449
+ measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
171450
+ candidateLicense: "OFL-1.1",
171451
+ exportRule: "preserve_original_name"
171452
+ },
171453
+ {
171454
+ evidenceId: "times-new-roman",
171455
+ logicalFamily: "Times New Roman",
171456
+ physicalFamily: "Liberation Serif",
171457
+ verdict: "metric_safe",
171458
+ faces: {
171459
+ regular: true,
171460
+ bold: true,
171461
+ italic: true,
171462
+ boldItalic: true
171463
+ },
171464
+ advance: {
171465
+ meanDelta: 0,
171466
+ maxDelta: 0
171467
+ },
171468
+ gates: {
171469
+ static: "pass",
171470
+ metric: "pass",
171471
+ layout: "not_run",
171472
+ ship: "pass"
171473
+ },
171474
+ policyAction: "substitute",
171475
+ measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
171476
+ candidateLicense: "OFL-1.1",
171477
+ exportRule: "preserve_original_name"
171478
+ },
171479
+ {
171480
+ evidenceId: "courier-new",
171481
+ logicalFamily: "Courier New",
171482
+ physicalFamily: "Liberation Mono",
171483
+ verdict: "metric_safe",
171484
+ faces: {
171485
+ regular: true,
171486
+ bold: true,
171487
+ italic: true,
171488
+ boldItalic: true
171489
+ },
171490
+ advance: {
171491
+ meanDelta: 0,
171492
+ maxDelta: 0
171493
+ },
171494
+ gates: {
171495
+ static: "pass",
171496
+ metric: "pass",
171497
+ layout: "not_run",
171498
+ ship: "pass"
171499
+ },
171500
+ policyAction: "substitute",
171501
+ measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
171502
+ candidateLicense: "OFL-1.1",
171503
+ exportRule: "preserve_original_name"
171504
+ },
171505
+ {
171506
+ evidenceId: "helvetica",
171507
+ logicalFamily: "Helvetica",
171508
+ physicalFamily: "Liberation Sans",
171509
+ verdict: "metric_safe",
171510
+ faces: {
171511
+ regular: true,
171512
+ bold: true,
171513
+ italic: true,
171514
+ boldItalic: true
171515
+ },
171516
+ advance: {
171517
+ meanDelta: 0,
171518
+ maxDelta: 0
171519
+ },
171520
+ gates: {
171521
+ static: "not_run",
171522
+ metric: "pass",
171523
+ layout: "not_run",
171524
+ ship: "fail"
171525
+ },
171526
+ policyAction: "substitute",
171527
+ measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
171528
+ candidateLicense: "OFL-1.1",
171529
+ exportRule: "preserve_original_name"
171530
+ },
171531
+ {
171532
+ evidenceId: "calibri-light",
171533
+ logicalFamily: "Calibri Light",
171534
+ physicalFamily: "Carlito",
171535
+ verdict: "visual_only",
171536
+ faces: {
171537
+ regular: false,
171538
+ bold: false,
171539
+ italic: false,
171540
+ boldItalic: false
171541
+ },
171542
+ advance: {
171543
+ meanDelta: 0.0148,
171544
+ maxDelta: 0.066
171545
+ },
171546
+ gates: {
171547
+ static: "not_run",
171548
+ metric: "fail",
171549
+ layout: "not_run",
171550
+ ship: "fail"
171551
+ },
171552
+ policyAction: "category_fallback",
171553
+ measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
171554
+ candidateLicense: "OFL-1.1",
171555
+ exportRule: "preserve_original_name"
171556
+ }
171557
+ ]);
171558
+ BUNDLED_SUBSTITUTES = deriveBundledSubstitutes();
171559
+ CATEGORY_FALLBACKS = deriveCategoryFallbacks();
171560
+ defaultResolver = new FontResolver;
171561
+ DEFAULT_FONT_MEASURE_CONTEXT = Object.freeze({
171562
+ resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily(cssFontFamily),
171563
+ fontSignature: ""
171564
+ });
171565
+ BUNDLED_MANIFEST = Object.freeze([
171566
+ family("Carlito", "Carlito", "OFL-1.1"),
171567
+ family("Caladea", "Caladea", "Apache-2.0"),
171568
+ family("Liberation Sans", "LiberationSans", "OFL-1.1"),
171569
+ family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
171570
+ family("Liberation Mono", "LiberationMono", "OFL-1.1")
171571
+ ]);
171572
+ installedRegistries = /* @__PURE__ */ new WeakMap;
171573
+ OS2_MIN_LENGTH = OS2_FSSELECTION + 2;
171574
+ registriesByFontSet = /* @__PURE__ */ new WeakMap;
171575
+ PHYSICAL_GENERIC = Object.freeze({
171576
+ Carlito: "sans-serif",
171577
+ Caladea: "serif",
171578
+ "Liberation Sans": "sans-serif",
171579
+ "Liberation Serif": "serif",
171580
+ "Liberation Mono": "monospace"
171581
+ });
171582
+ BUNDLED_FAMILIES = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
171583
+ FONT_OFFERINGS = deriveOfferings();
171584
+ DEFAULT_FONT_ORDER = [
171585
+ "Calibri",
171586
+ "Arial",
171587
+ "Courier New",
171588
+ "Times New Roman",
171589
+ "Helvetica"
171590
+ ];
170516
171591
  ALL_COMMENT_TARGETS = COMMENT_FILE_BASENAMES;
170517
171592
  REL_ID_NUMERIC_PATTERN = /rId|mi/g;
170518
171593
  FOOTNOTES_CONFIG$1 = {
@@ -171329,10 +172404,10 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
171329
172404
  return fontsNode.elements.find((el) => el?.attributes?.["w:name"] === fontName) || null;
171330
172405
  }
171331
172406
  static getFallbackFromFontTable(docx, fontName) {
171332
- const family = SuperConverter2.getFontTableEntry(docx, fontName)?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
171333
- if (!family)
172407
+ const family$1 = SuperConverter2.getFontTableEntry(docx, fontName)?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
172408
+ if (!family$1)
171334
172409
  return null;
171335
- return FONT_FAMILY_FALLBACKS[family.toLowerCase()] || DEFAULT_GENERIC_FALLBACK;
172410
+ return FONT_FAMILY_FALLBACKS[family$1.toLowerCase()] || DEFAULT_GENERIC_FALLBACK;
171336
172411
  }
171337
172412
  static toCssFontFamily(fontName, docx) {
171338
172413
  if (!fontName)
@@ -171762,13 +172837,16 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
171762
172837
  for (const font of fontsToInclude) {
171763
172838
  const filePath = elements.find((el) => el.attributes.Id === font.attributes["r:id"])?.attributes?.Target;
171764
172839
  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"]);
172840
+ continue;
172841
+ const fontUint8Array = this.fonts[`word/${filePath}`];
172842
+ if (!fontUint8Array?.buffer)
172843
+ continue;
172844
+ const ttfBuffer = deobfuscateFont(fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength), font.attributes["w:fontKey"]);
171770
172845
  if (!ttfBuffer)
171771
- return;
172846
+ continue;
172847
+ const policy = parseEmbeddingPolicy(ttfBuffer);
172848
+ if (!(policy ? policy.embeddable : false))
172849
+ continue;
171772
172850
  const blob = new Blob([ttfBuffer], { type: "font/ttf" });
171773
172851
  const fontUrl = URL.createObjectURL(blob);
171774
172852
  const isNormal = font.name.includes("Regular");
@@ -171793,6 +172871,48 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
171793
172871
  fontsImported
171794
172872
  };
171795
172873
  }
172874
+ getEmbeddedFontFaces() {
172875
+ const fontTable = this.convertedXml["word/fontTable.xml"];
172876
+ if (!fontTable || !Object.keys(this.fonts).length)
172877
+ return [];
172878
+ 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) => ({
172879
+ embed: el,
172880
+ family: entry.attributes?.["w:name"]
172881
+ })));
172882
+ const relElements = this.convertedXml["word/_rels/fontTable.xml.rels"]?.elements?.find((el) => el.name === "Relationships")?.elements ?? [];
172883
+ const faceFromEmbedName = (name = "") => ({
172884
+ weight: /bold/i.test(name) ? "700" : "400",
172885
+ style: /italic/i.test(name) ? "italic" : "normal"
172886
+ });
172887
+ const faces = [];
172888
+ for (const { embed, family: family$1 } of embedElements) {
172889
+ const relationshipId = embed.attributes?.["r:id"];
172890
+ const fontKey = embed.attributes?.["w:fontKey"];
172891
+ if (!family$1 || !relationshipId || !fontKey)
172892
+ continue;
172893
+ const filePath = relElements.find((el) => el.attributes?.Id === relationshipId)?.attributes?.Target;
172894
+ if (!filePath)
172895
+ continue;
172896
+ const fontUint8Array = this.fonts[`word/${filePath}`];
172897
+ if (!fontUint8Array?.buffer)
172898
+ continue;
172899
+ const ttf = deobfuscateFont(fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength), fontKey);
172900
+ if (!ttf)
172901
+ continue;
172902
+ const policy = parseEmbeddingPolicy(ttf);
172903
+ const fallback = faceFromEmbedName(embed.name);
172904
+ faces.push({
172905
+ family: family$1,
172906
+ source: ttf,
172907
+ weight: policy?.face.weight ?? fallback.weight,
172908
+ style: policy?.face.style ?? fallback.style,
172909
+ fsType: policy?.fsType ?? null,
172910
+ embeddable: policy ? policy.embeddable : false,
172911
+ relationshipId
172912
+ });
172913
+ }
172914
+ return faces;
172915
+ }
171796
172916
  getDocumentInternalId() {
171797
172917
  const settingsLocation = "word/settings.xml";
171798
172918
  if (!this.convertedXml[settingsLocation])
@@ -172254,7 +173374,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
172254
173374
  };
172255
173375
  });
172256
173376
 
172257
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BmFWtej0.es.js
173377
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DUhzXJ4D.es.js
172258
173378
  function parseSizeUnit(val = "0") {
172259
173379
  const length3 = val.toString() || "0";
172260
173380
  const value = Number.parseFloat(length3);
@@ -182587,8 +183707,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
182587
183707
  }
182588
183708
  };
182589
183709
  };
182590
- var init_create_headless_toolbar_BmFWtej0_es = __esm(() => {
182591
- init_SuperConverter_bEQ45IUD_es();
183710
+ var init_create_headless_toolbar_DUhzXJ4D_es = __esm(() => {
183711
+ init_SuperConverter_DOoAJ6Zk_es();
182592
183712
  init_uuid_qzgm05fK_es();
182593
183713
  init_constants_D9qj59G2_es();
182594
183714
  init_dist_B8HfvhaK_es();
@@ -185235,1231 +186355,6 @@ var __plugin_vue_export_helper_default = (sfc, props) => {
185235
186355
  };
185236
186356
  var init__plugin_vue_export_helper_5t5P5NuM_es = () => {};
185237
186357
 
185238
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-tVaowTvG.es.js
185239
- function isSettled(status) {
185240
- return SETTLED_STATUSES.includes(status);
185241
- }
185242
- function normalizeFamilyKey$1(family$1) {
185243
- return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
185244
- }
185245
- function deriveBundledSubstitutes() {
185246
- const substitutes = {};
185247
- for (const row of SUBSTITUTION_EVIDENCE)
185248
- if (row.policyAction === "substitute" && row.physicalFamily)
185249
- substitutes[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
185250
- return Object.freeze(substitutes);
185251
- }
185252
- function deriveCategoryFallbacks() {
185253
- const fallbacks = {};
185254
- for (const row of SUBSTITUTION_EVIDENCE)
185255
- if (row.policyAction === "category_fallback" && row.physicalFamily)
185256
- fallbacks[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
185257
- return Object.freeze(fallbacks);
185258
- }
185259
- function stripFamilyQuotes(family$1) {
185260
- return family$1.trim().replace(/^["']|["']$/g, "");
185261
- }
185262
- function splitStack(cssFontFamily) {
185263
- return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
185264
- }
185265
- function createFontResolver() {
185266
- return new FontResolver;
185267
- }
185268
- function resolveFontFamily2(logicalFamily) {
185269
- return defaultResolver.resolveFontFamily(logicalFamily);
185270
- }
185271
- function resolvePhysicalFamily(cssFontFamily) {
185272
- return defaultResolver.resolvePhysicalFamily(cssFontFamily);
185273
- }
185274
- function resolveFace(logicalFamily, face, hasFace) {
185275
- return defaultResolver.resolveFace(logicalFamily, face, hasFace);
185276
- }
185277
- function getFontConfigVersion() {
185278
- return fontConfigVersion;
185279
- }
185280
- function bumpFontConfigVersion() {
185281
- return fontConfigVersion += 1;
185282
- }
185283
- function fourFaces(filePrefix) {
185284
- return [
185285
- {
185286
- weight: "normal",
185287
- style: "normal",
185288
- file: `${filePrefix}-Regular.woff2`
185289
- },
185290
- {
185291
- weight: "bold",
185292
- style: "normal",
185293
- file: `${filePrefix}-Bold.woff2`
185294
- },
185295
- {
185296
- weight: "normal",
185297
- style: "italic",
185298
- file: `${filePrefix}-Italic.woff2`
185299
- },
185300
- {
185301
- weight: "bold",
185302
- style: "italic",
185303
- file: `${filePrefix}-BoldItalic.woff2`
185304
- }
185305
- ];
185306
- }
185307
- function family(name, filePrefix, license) {
185308
- return {
185309
- family: name,
185310
- license,
185311
- faces: fourFaces(filePrefix)
185312
- };
185313
- }
185314
- function withTrailingSlash(base3) {
185315
- return base3.endsWith("/") ? base3 : `${base3}/`;
185316
- }
185317
- function joinUrl(base3, file) {
185318
- return `${withTrailingSlash(base3)}${file}`;
185319
- }
185320
- function weightToken(weight) {
185321
- return weight === "bold" ? "700" : "400";
185322
- }
185323
- function bundledAssetSignature(resolve2) {
185324
- const family$1 = BUNDLED_MANIFEST[0];
185325
- const face = family$1?.faces[0];
185326
- if (!family$1 || !face)
185327
- return "";
185328
- return resolve2({
185329
- file: face.file,
185330
- family: family$1.family,
185331
- weight: weightToken(face.weight),
185332
- style: face.style,
185333
- source: "bundled-substitute"
185334
- });
185335
- }
185336
- function installBundledSubstitutes(registry2, options = {}) {
185337
- const resolve2 = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
185338
- const signature = bundledAssetSignature(resolve2);
185339
- const installed = installedRegistries.get(registry2);
185340
- if (installed !== undefined) {
185341
- if (installed !== signature)
185342
- 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.`);
185343
- return;
185344
- }
185345
- installedRegistries.set(registry2, signature);
185346
- for (const family$1 of BUNDLED_MANIFEST)
185347
- for (const face of family$1.faces) {
185348
- const context = {
185349
- file: face.file,
185350
- family: family$1.family,
185351
- weight: weightToken(face.weight),
185352
- style: face.style,
185353
- source: "bundled-substitute"
185354
- };
185355
- registry2.register({
185356
- family: family$1.family,
185357
- source: `url(${resolve2(context)})`,
185358
- descriptors: {
185359
- weight: face.weight,
185360
- style: face.style
185361
- }
185362
- });
185363
- }
185364
- }
185365
- function buildFontReport(logicalFamilies, registry2, resolver2) {
185366
- const seen = /* @__PURE__ */ new Set;
185367
- const report = [];
185368
- for (const logical of logicalFamilies) {
185369
- if (!logical || seen.has(logical))
185370
- continue;
185371
- seen.add(logical);
185372
- const { physicalFamily, reason } = resolver2 ? resolver2.resolveFontFamily(logical) : resolveFontFamily2(logical);
185373
- const loadStatus = registry2.getStatus(physicalFamily);
185374
- report.push({
185375
- logicalFamily: logical,
185376
- physicalFamily,
185377
- reason,
185378
- loadStatus,
185379
- exportFamily: logical,
185380
- missing: reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded"
185381
- });
185382
- }
185383
- return report;
185384
- }
185385
- function buildFaceReport(usedFaces, registry2, resolver2) {
185386
- const hasFace = (family$1, weight, style) => registry2.hasFace(family$1, weight, style);
185387
- const seen = /* @__PURE__ */ new Set;
185388
- const report = [];
185389
- for (const { logicalFamily, weight, style } of usedFaces) {
185390
- if (!logicalFamily)
185391
- continue;
185392
- const key2 = `${logicalFamily.toLowerCase()}|${weight}|${style}`;
185393
- if (seen.has(key2))
185394
- continue;
185395
- seen.add(key2);
185396
- const face = {
185397
- weight,
185398
- style
185399
- };
185400
- const { physicalFamily, reason } = resolver2 ? resolver2.resolveFace(logicalFamily, face, hasFace) : resolveFace(logicalFamily, face, hasFace);
185401
- const loadStatus = registry2.getFaceStatus({
185402
- family: physicalFamily,
185403
- weight,
185404
- style
185405
- });
185406
- const missing = reason === "fallback_face_absent" || reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded";
185407
- report.push({
185408
- logicalFamily,
185409
- physicalFamily,
185410
- reason,
185411
- loadStatus,
185412
- exportFamily: logicalFamily,
185413
- missing,
185414
- face
185415
- });
185416
- }
185417
- return report;
185418
- }
185419
- function quoteFamily(family$1) {
185420
- return `"${family$1.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
185421
- }
185422
- function canonicalizeFontSource(source) {
185423
- const match = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
185424
- if (!match)
185425
- return source;
185426
- let inner = match[1].trim();
185427
- if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'"))
185428
- inner = inner.slice(1, -1);
185429
- return `url(${JSON.stringify(inner)})`;
185430
- }
185431
- function normalizeFamilyKey(family$1) {
185432
- return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
185433
- }
185434
- function normalizeWeight(weight) {
185435
- if (weight === undefined)
185436
- return "400";
185437
- const w = String(weight).trim().toLowerCase();
185438
- if (w === "bold" || w === "bolder")
185439
- return "700";
185440
- const n = Number(w);
185441
- return Number.isFinite(n) && n >= 600 ? "700" : "400";
185442
- }
185443
- function normalizeStyle(style) {
185444
- if (!style)
185445
- return "normal";
185446
- const s = style.trim().toLowerCase();
185447
- return s.startsWith("italic") || s.startsWith("oblique") ? "italic" : "normal";
185448
- }
185449
- function faceKeyOf(family$1, weight, style) {
185450
- return `${normalizeFamilyKey(family$1)}|${weight}|${style}`;
185451
- }
185452
- function faceProbe(family$1, weight, style, size2) {
185453
- return `${style === "italic" ? "italic " : ""}${weight} ${size2} ${quoteFamily(family$1)}`;
185454
- }
185455
- function getFontRegistryFor(fontSet, FontFaceCtor) {
185456
- if (!fontSet) {
185457
- if (!domlessRegistry)
185458
- domlessRegistry = new FontRegistry({});
185459
- return domlessRegistry;
185460
- }
185461
- let registry2 = registriesByFontSet.get(fontSet);
185462
- if (!registry2) {
185463
- registry2 = new FontRegistry({
185464
- fontSet,
185465
- FontFaceCtor
185466
- });
185467
- registriesByFontSet.set(fontSet, registry2);
185468
- }
185469
- return registry2;
185470
- }
185471
- function classifyOffering(policyAction, verdict, physicalFamily, bundled) {
185472
- if (policyAction === "preserve_only")
185473
- return "preserve_only";
185474
- if (policyAction === "customer_supplied" || physicalFamily == null)
185475
- return "customer_supplied";
185476
- if (policyAction === "category_fallback")
185477
- return "category_fallback";
185478
- if (!bundled)
185479
- return "requires_asset";
185480
- return verdict === "metric_safe" ? "default" : "qualified";
185481
- }
185482
- function deriveOfferings() {
185483
- const offerings = SUBSTITUTION_EVIDENCE.map((row) => {
185484
- const bundled = row.physicalFamily != null && BUNDLED_FAMILIES.has(row.physicalFamily);
185485
- return {
185486
- logicalFamily: row.logicalFamily,
185487
- physicalFamily: row.physicalFamily,
185488
- generic: row.physicalFamily && PHYSICAL_GENERIC[row.physicalFamily] || "sans-serif",
185489
- offering: classifyOffering(row.policyAction, row.verdict, row.physicalFamily, bundled),
185490
- bundled,
185491
- verdict: row.verdict,
185492
- evidenceId: row.evidenceId
185493
- };
185494
- });
185495
- return Object.freeze(offerings);
185496
- }
185497
- function getDefaultFontOfferings() {
185498
- const rank = (name) => {
185499
- const i4 = DEFAULT_FONT_ORDER.indexOf(name);
185500
- return i4 === -1 ? DEFAULT_FONT_ORDER.length : i4;
185501
- };
185502
- return FONT_OFFERINGS.filter((o) => o.offering === "default").sort((a, b) => rank(a.logicalFamily) - rank(b.logicalFamily));
185503
- }
185504
- function fontOfferingStack(offering) {
185505
- return `${offering.logicalFamily}, ${offering.generic}`;
185506
- }
185507
- function fontOfferingRenderStack(offering) {
185508
- return offering.physicalFamily ? `${offering.physicalFamily}, ${offering.generic}` : fontOfferingStack(offering);
185509
- }
185510
- function getDefaultFontFamilyOptions() {
185511
- return getDefaultFontOfferings().map((offering) => ({
185512
- label: offering.logicalFamily,
185513
- value: fontOfferingStack(offering)
185514
- }));
185515
- }
185516
- var SETTLED_STATUSES, SUBSTITUTION_EVIDENCE, BUNDLED_SUBSTITUTES, CATEGORY_FALLBACKS, FontResolver = class {
185517
- #overrides = /* @__PURE__ */ new Map;
185518
- #version = 0;
185519
- #cachedSignature = null;
185520
- map(logicalFamily, physicalFamily) {
185521
- const key2 = normalizeFamilyKey$1(logicalFamily);
185522
- const physical = physicalFamily?.trim();
185523
- if (!key2 || !physical)
185524
- return;
185525
- if (this.#overrides.get(key2) === physical)
185526
- return;
185527
- if (key2 === normalizeFamilyKey$1(physical)) {
185528
- if (this.#overrides.delete(key2)) {
185529
- this.#version += 1;
185530
- this.#cachedSignature = null;
185531
- }
185532
- return;
185533
- }
185534
- this.#overrides.set(key2, physical);
185535
- this.#version += 1;
185536
- this.#cachedSignature = null;
185537
- }
185538
- unmap(logicalFamily) {
185539
- if (this.#overrides.delete(normalizeFamilyKey$1(logicalFamily))) {
185540
- this.#version += 1;
185541
- this.#cachedSignature = null;
185542
- }
185543
- }
185544
- reset() {
185545
- if (this.#overrides.size === 0)
185546
- return;
185547
- this.#overrides.clear();
185548
- this.#version += 1;
185549
- this.#cachedSignature = null;
185550
- }
185551
- get version() {
185552
- return this.#version;
185553
- }
185554
- get signature() {
185555
- if (this.#cachedSignature !== null)
185556
- return this.#cachedSignature;
185557
- this.#cachedSignature = this.#overrides.size === 0 ? "" : JSON.stringify([...this.#overrides.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
185558
- return this.#cachedSignature;
185559
- }
185560
- #physicalFor(bareFamily) {
185561
- const key2 = normalizeFamilyKey$1(bareFamily);
185562
- const override = this.#overrides.get(key2);
185563
- if (override)
185564
- return {
185565
- physical: override,
185566
- reason: "custom_mapping"
185567
- };
185568
- const bundled = BUNDLED_SUBSTITUTES[key2];
185569
- if (bundled)
185570
- return {
185571
- physical: bundled,
185572
- reason: "bundled_substitute"
185573
- };
185574
- const category = CATEGORY_FALLBACKS[key2];
185575
- if (category)
185576
- return {
185577
- physical: category,
185578
- reason: "category_fallback"
185579
- };
185580
- return {
185581
- physical: bareFamily,
185582
- reason: "as_requested"
185583
- };
185584
- }
185585
- #resolveFaceLadder(primary, face, hasFace) {
185586
- const key2 = normalizeFamilyKey$1(primary);
185587
- const override = this.#overrides.get(key2);
185588
- if (override && hasFace(override, face.weight, face.style))
185589
- return {
185590
- physical: override,
185591
- reason: "custom_mapping"
185592
- };
185593
- if (hasFace(primary, face.weight, face.style))
185594
- return {
185595
- physical: primary,
185596
- reason: "registered_face"
185597
- };
185598
- const bundled = BUNDLED_SUBSTITUTES[key2];
185599
- if (bundled && hasFace(bundled, face.weight, face.style))
185600
- return {
185601
- physical: bundled,
185602
- reason: "bundled_substitute"
185603
- };
185604
- const category = CATEGORY_FALLBACKS[key2];
185605
- if (category && hasFace(category, face.weight, face.style))
185606
- return {
185607
- physical: category,
185608
- reason: "category_fallback"
185609
- };
185610
- if (override || bundled)
185611
- return {
185612
- physical: primary,
185613
- reason: "fallback_face_absent"
185614
- };
185615
- return {
185616
- physical: primary,
185617
- reason: "as_requested"
185618
- };
185619
- }
185620
- resolveFontFamily(logicalFamily) {
185621
- const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
185622
- const { physical, reason } = this.#physicalFor(primary);
185623
- return {
185624
- logicalFamily,
185625
- physicalFamily: stripFamilyQuotes(physical),
185626
- reason
185627
- };
185628
- }
185629
- resolvePhysicalFamily(cssFontFamily) {
185630
- if (!cssFontFamily)
185631
- return cssFontFamily;
185632
- const parts = splitStack(cssFontFamily);
185633
- if (parts.length === 0)
185634
- return cssFontFamily;
185635
- const { physical, reason } = this.#physicalFor(parts[0]);
185636
- if (reason === "as_requested")
185637
- return cssFontFamily;
185638
- return [physical, ...parts.slice(1)].join(", ");
185639
- }
185640
- resolveFace(logicalFamily, face, hasFace) {
185641
- const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
185642
- const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
185643
- return {
185644
- logicalFamily,
185645
- physicalFamily: stripFamilyQuotes(physical),
185646
- reason
185647
- };
185648
- }
185649
- resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
185650
- if (!cssFontFamily)
185651
- return cssFontFamily;
185652
- const parts = splitStack(cssFontFamily);
185653
- if (parts.length === 0)
185654
- return cssFontFamily;
185655
- const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
185656
- if (normalizeFamilyKey$1(physical) !== normalizeFamilyKey$1(parts[0]))
185657
- return [physical, ...parts.slice(1)].join(", ");
185658
- return cssFontFamily;
185659
- }
185660
- resolvePrimaryPhysicalFamily(family$1) {
185661
- const primary = splitStack(family$1)[0] ?? family$1;
185662
- return this.#physicalFor(primary).physical;
185663
- }
185664
- resolvePhysicalFamilies(families) {
185665
- const out = /* @__PURE__ */ new Set;
185666
- for (const family$1 of families)
185667
- if (family$1)
185668
- out.add(this.resolvePrimaryPhysicalFamily(family$1));
185669
- return [...out];
185670
- }
185671
- }, defaultResolver, DEFAULT_FONT_MEASURE_CONTEXT, fontConfigVersion = 0, BUNDLED_MANIFEST, defaultAssetBase = "/fonts/", installedRegistries, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
185672
- #fontSet;
185673
- #FontFaceCtor;
185674
- #probeSize;
185675
- #scheduleTimeout;
185676
- #cancelTimeout;
185677
- #managed = /* @__PURE__ */ new Map;
185678
- #status = /* @__PURE__ */ new Map;
185679
- #sources = /* @__PURE__ */ new Map;
185680
- #warnedFailures = /* @__PURE__ */ new Set;
185681
- #inflight = /* @__PURE__ */ new Map;
185682
- #faceStatus = /* @__PURE__ */ new Map;
185683
- #faceInflight = /* @__PURE__ */ new Map;
185684
- #faceSources = /* @__PURE__ */ new Map;
185685
- #facesByFamily = /* @__PURE__ */ new Map;
185686
- #providerFaceKeys = /* @__PURE__ */ new Set;
185687
- #warnedFaceFailures = /* @__PURE__ */ new Set;
185688
- constructor(options = {}) {
185689
- this.#fontSet = options.fontSet ?? null;
185690
- this.#FontFaceCtor = options.FontFaceCtor ?? null;
185691
- this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
185692
- this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
185693
- this.#cancelTimeout = options.cancelTimeout ?? ((handle2) => globalThis.clearTimeout(handle2));
185694
- }
185695
- register(descriptor) {
185696
- const { family: family$1, source, descriptors: descriptors2 } = descriptor;
185697
- const identitySource = typeof source === "string" ? canonicalizeFontSource(source) : source;
185698
- const weight = normalizeWeight(descriptors2?.weight);
185699
- const style = normalizeStyle(descriptors2?.style);
185700
- const key2 = faceKeyOf(family$1, weight, style);
185701
- if (typeof identitySource === "string") {
185702
- const existingSource = this.#faceSources.get(key2);
185703
- if (existingSource === identitySource)
185704
- return {
185705
- family: family$1,
185706
- status: this.getStatus(family$1),
185707
- changed: false
185708
- };
185709
- if (existingSource !== undefined)
185710
- throw new Error(`[superdoc] font face "${key2}" is already registered from a different source ("${existingSource}"); a registered face's source cannot be replaced`);
185711
- }
185712
- if (this.#FontFaceCtor && this.#fontSet) {
185713
- const face = new this.#FontFaceCtor(family$1, source, {
185714
- ...descriptors2,
185715
- weight,
185716
- style
185717
- });
185718
- this.#fontSet.add(face);
185719
- this.#managed.set(family$1, face);
185720
- }
185721
- if (typeof source === "string") {
185722
- const list4 = this.#sources.get(family$1) ?? [];
185723
- if (!list4.includes(source))
185724
- list4.push(source);
185725
- this.#sources.set(family$1, list4);
185726
- }
185727
- if (!this.#status.has(family$1))
185728
- this.#status.set(family$1, "unloaded");
185729
- this.#providerFaceKeys.add(key2);
185730
- this.#trackFace(family$1, key2);
185731
- if (!this.#faceStatus.has(key2))
185732
- this.#faceStatus.set(key2, "unloaded");
185733
- if (typeof identitySource === "string" && !this.#faceSources.has(key2))
185734
- this.#faceSources.set(key2, identitySource);
185735
- return {
185736
- family: family$1,
185737
- status: this.getStatus(family$1),
185738
- changed: true
185739
- };
185740
- }
185741
- #trackFace(family$1, key2) {
185742
- const fam = normalizeFamilyKey(family$1);
185743
- const set = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
185744
- set.add(key2);
185745
- this.#facesByFamily.set(fam, set);
185746
- }
185747
- isManaged(family$1) {
185748
- return this.#managed.has(family$1);
185749
- }
185750
- getStatus(family$1) {
185751
- const statuses = [];
185752
- const faceKeys = this.#facesByFamily.get(normalizeFamilyKey(family$1));
185753
- if (faceKeys)
185754
- for (const k of faceKeys)
185755
- statuses.push(this.#faceStatus.get(k) ?? "unloaded");
185756
- const legacy = this.#status.get(family$1);
185757
- if (legacy)
185758
- statuses.push(legacy);
185759
- if (statuses.length === 0)
185760
- return "unloaded";
185761
- for (const s of [
185762
- "failed",
185763
- "timed_out",
185764
- "fallback_used",
185765
- "loaded",
185766
- "loading",
185767
- "unloaded"
185768
- ])
185769
- if (statuses.includes(s))
185770
- return s;
185771
- return "unloaded";
185772
- }
185773
- hasFace(family$1, weight, style) {
185774
- const key2 = faceKeyOf(family$1, weight, style);
185775
- return this.#providerFaceKeys.has(key2) && this.#faceStatus.get(key2) !== "failed";
185776
- }
185777
- isAvailable(family$1) {
185778
- if (!this.#fontSet)
185779
- return false;
185780
- try {
185781
- return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
185782
- } catch {
185783
- return false;
185784
- }
185785
- }
185786
- awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
185787
- if (this.#status.get(family$1) === "loaded")
185788
- return Promise.resolve({
185789
- family: family$1,
185790
- status: "loaded"
185791
- });
185792
- const existing = this.#inflight.get(family$1);
185793
- if (existing)
185794
- return existing;
185795
- const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
185796
- this.#inflight.delete(family$1);
185797
- });
185798
- this.#inflight.set(family$1, probe);
185799
- return probe;
185800
- }
185801
- async awaitFaces(families, options = {}) {
185802
- const unique = [...new Set(families)];
185803
- const timeoutMs = options.timeoutMs ?? 3000;
185804
- return Promise.all(unique.map((family$1) => this.awaitFace(family$1, timeoutMs)));
185805
- }
185806
- getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
185807
- return [...new Set(families)].map((family$1) => ({
185808
- family: family$1,
185809
- status: this.getStatus(family$1),
185810
- ready: this.awaitFace(family$1, timeoutMs)
185811
- }));
185812
- }
185813
- getStates() {
185814
- return [...this.#status.entries()].map(([family$1, status]) => ({
185815
- family: family$1,
185816
- status
185817
- }));
185818
- }
185819
- getFaceStatus(request) {
185820
- return this.#faceStatus.get(faceKeyOf(request.family, request.weight, request.style)) ?? "unloaded";
185821
- }
185822
- awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
185823
- const key2 = faceKeyOf(request.family, request.weight, request.style);
185824
- if (this.#faceStatus.get(key2) === "loaded")
185825
- return Promise.resolve({
185826
- request,
185827
- status: "loaded"
185828
- });
185829
- const existing = this.#faceInflight.get(key2);
185830
- if (existing)
185831
- return existing;
185832
- const probe = this.#loadOneFace(request, key2, timeoutMs).finally(() => {
185833
- this.#faceInflight.delete(key2);
185834
- });
185835
- this.#faceInflight.set(key2, probe);
185836
- return probe;
185837
- }
185838
- async awaitFaceRequests(requests, options = {}) {
185839
- const timeoutMs = options.timeoutMs ?? 3000;
185840
- const seen = /* @__PURE__ */ new Set;
185841
- const unique = [];
185842
- for (const r of requests) {
185843
- const key2 = faceKeyOf(r.family, r.weight, r.style);
185844
- if (seen.has(key2))
185845
- continue;
185846
- seen.add(key2);
185847
- unique.push(r);
185848
- }
185849
- return Promise.all(unique.map((r) => this.awaitFaceRequest(r, timeoutMs)));
185850
- }
185851
- async#loadOneFace(request, key2, timeoutMs) {
185852
- this.#trackFace(request.family, key2);
185853
- const fontSet = this.#fontSet;
185854
- if (!fontSet) {
185855
- this.#faceStatus.set(key2, "fallback_used");
185856
- return {
185857
- request,
185858
- status: "fallback_used"
185859
- };
185860
- }
185861
- this.#faceStatus.set(key2, "loading");
185862
- const probe = faceProbe(request.family, request.weight, request.style, this.#probeSize);
185863
- const TIMEOUT = Symbol("timeout");
185864
- let handle2;
185865
- const timeout = new Promise((resolve2) => {
185866
- handle2 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
185867
- });
185868
- try {
185869
- const settled = await Promise.race([fontSet.load(probe), timeout]);
185870
- if (settled === TIMEOUT) {
185871
- this.#faceStatus.set(key2, "timed_out");
185872
- return {
185873
- request,
185874
- status: "timed_out"
185875
- };
185876
- }
185877
- const status = settled.length > 0 ? "loaded" : "fallback_used";
185878
- this.#faceStatus.set(key2, status);
185879
- return {
185880
- request,
185881
- status
185882
- };
185883
- } catch {
185884
- this.#faceStatus.set(key2, "failed");
185885
- this.#warnFaceFailureOnce(request, key2);
185886
- return {
185887
- request,
185888
- status: "failed"
185889
- };
185890
- } finally {
185891
- this.#cancelTimeout(handle2);
185892
- }
185893
- }
185894
- #warnFaceFailureOnce(request, key2) {
185895
- if (this.#warnedFaceFailures.has(key2))
185896
- return;
185897
- this.#warnedFaceFailures.add(key2);
185898
- const src = this.#faceSources.get(key2);
185899
- const detail = src ? ` from ${src}` : "";
185900
- 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.`);
185901
- }
185902
- async#loadOne(family$1, timeoutMs) {
185903
- const fontSet = this.#fontSet;
185904
- if (!fontSet) {
185905
- this.#status.set(family$1, "fallback_used");
185906
- return {
185907
- family: family$1,
185908
- status: "fallback_used"
185909
- };
185910
- }
185911
- this.#status.set(family$1, "loading");
185912
- const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
185913
- const TIMEOUT = Symbol("timeout");
185914
- let handle2;
185915
- const timeout = new Promise((resolve2) => {
185916
- handle2 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
185917
- });
185918
- try {
185919
- const settled = await Promise.race([fontSet.load(probe), timeout]);
185920
- if (settled === TIMEOUT) {
185921
- this.#status.set(family$1, "timed_out");
185922
- return {
185923
- family: family$1,
185924
- status: "timed_out"
185925
- };
185926
- }
185927
- const status = settled.length > 0 ? "loaded" : "fallback_used";
185928
- this.#status.set(family$1, status);
185929
- return {
185930
- family: family$1,
185931
- status
185932
- };
185933
- } catch {
185934
- this.#status.set(family$1, "failed");
185935
- this.#warnLoadFailureOnce(family$1);
185936
- return {
185937
- family: family$1,
185938
- status: "failed"
185939
- };
185940
- } finally {
185941
- this.#cancelTimeout(handle2);
185942
- }
185943
- }
185944
- #warnLoadFailureOnce(family$1) {
185945
- if (this.#warnedFailures.has(family$1))
185946
- return;
185947
- this.#warnedFailures.add(family$1);
185948
- const sources = this.#sources.get(family$1);
185949
- const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
185950
- console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
185951
- }
185952
- }, registriesByFontSet, domlessRegistry = null, PHYSICAL_GENERIC, BUNDLED_FAMILIES, FONT_OFFERINGS, DEFAULT_FONT_ORDER, headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
185953
- var init_create_super_doc_ui_tVaowTvG_es = __esm(() => {
185954
- init_SuperConverter_bEQ45IUD_es();
185955
- init_create_headless_toolbar_BmFWtej0_es();
185956
- SETTLED_STATUSES = [
185957
- "loaded",
185958
- "failed",
185959
- "timed_out",
185960
- "fallback_used"
185961
- ];
185962
- SUBSTITUTION_EVIDENCE = Object.freeze([
185963
- {
185964
- evidenceId: "calibri",
185965
- logicalFamily: "Calibri",
185966
- physicalFamily: "Carlito",
185967
- verdict: "metric_safe",
185968
- faces: {
185969
- regular: true,
185970
- bold: true,
185971
- italic: true,
185972
- boldItalic: true
185973
- },
185974
- advance: {
185975
- meanDelta: 0,
185976
- maxDelta: 0
185977
- },
185978
- gates: {
185979
- static: "pass",
185980
- metric: "pass",
185981
- layout: "pass",
185982
- ship: "pass"
185983
- },
185984
- policyAction: "substitute",
185985
- measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
185986
- candidateLicense: "OFL-1.1",
185987
- exportRule: "preserve_original_name"
185988
- },
185989
- {
185990
- evidenceId: "cambria",
185991
- logicalFamily: "Cambria",
185992
- physicalFamily: "Caladea",
185993
- verdict: "visual_only",
185994
- faceVerdicts: {
185995
- regular: "metric_safe",
185996
- bold: "metric_safe",
185997
- italic: "metric_safe",
185998
- boldItalic: "visual_only"
185999
- },
186000
- glyphExceptions: [{
186001
- slot: "boldItalic",
186002
- codepoint: 96,
186003
- advanceDelta: 0.231,
186004
- note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
186005
- }],
186006
- faces: {
186007
- regular: true,
186008
- bold: true,
186009
- italic: true,
186010
- boldItalic: true
186011
- },
186012
- advance: {
186013
- meanDelta: 0.0002378,
186014
- maxDelta: 0.2310758
186015
- },
186016
- gates: {
186017
- static: "pass",
186018
- metric: "pass",
186019
- layout: "not_run",
186020
- ship: "pass"
186021
- },
186022
- policyAction: "substitute",
186023
- measurementRefs: [
186024
- "cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
186025
- "cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
186026
- "cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
186027
- "cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
186028
- ],
186029
- candidateLicense: "Apache-2.0",
186030
- exportRule: "preserve_original_name"
186031
- },
186032
- {
186033
- evidenceId: "arial",
186034
- logicalFamily: "Arial",
186035
- physicalFamily: "Liberation Sans",
186036
- verdict: "metric_safe",
186037
- faces: {
186038
- regular: true,
186039
- bold: true,
186040
- italic: true,
186041
- boldItalic: true
186042
- },
186043
- advance: {
186044
- meanDelta: 0,
186045
- maxDelta: 0
186046
- },
186047
- gates: {
186048
- static: "pass",
186049
- metric: "pass",
186050
- layout: "not_run",
186051
- ship: "pass"
186052
- },
186053
- policyAction: "substitute",
186054
- measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
186055
- candidateLicense: "OFL-1.1",
186056
- exportRule: "preserve_original_name"
186057
- },
186058
- {
186059
- evidenceId: "times-new-roman",
186060
- logicalFamily: "Times New Roman",
186061
- physicalFamily: "Liberation Serif",
186062
- verdict: "metric_safe",
186063
- faces: {
186064
- regular: true,
186065
- bold: true,
186066
- italic: true,
186067
- boldItalic: true
186068
- },
186069
- advance: {
186070
- meanDelta: 0,
186071
- maxDelta: 0
186072
- },
186073
- gates: {
186074
- static: "pass",
186075
- metric: "pass",
186076
- layout: "not_run",
186077
- ship: "pass"
186078
- },
186079
- policyAction: "substitute",
186080
- measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
186081
- candidateLicense: "OFL-1.1",
186082
- exportRule: "preserve_original_name"
186083
- },
186084
- {
186085
- evidenceId: "courier-new",
186086
- logicalFamily: "Courier New",
186087
- physicalFamily: "Liberation Mono",
186088
- verdict: "metric_safe",
186089
- faces: {
186090
- regular: true,
186091
- bold: true,
186092
- italic: true,
186093
- boldItalic: true
186094
- },
186095
- advance: {
186096
- meanDelta: 0,
186097
- maxDelta: 0
186098
- },
186099
- gates: {
186100
- static: "pass",
186101
- metric: "pass",
186102
- layout: "not_run",
186103
- ship: "pass"
186104
- },
186105
- policyAction: "substitute",
186106
- measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
186107
- candidateLicense: "OFL-1.1",
186108
- exportRule: "preserve_original_name"
186109
- },
186110
- {
186111
- evidenceId: "helvetica",
186112
- logicalFamily: "Helvetica",
186113
- physicalFamily: "Liberation Sans",
186114
- verdict: "metric_safe",
186115
- faces: {
186116
- regular: true,
186117
- bold: true,
186118
- italic: true,
186119
- boldItalic: true
186120
- },
186121
- advance: {
186122
- meanDelta: 0,
186123
- maxDelta: 0
186124
- },
186125
- gates: {
186126
- static: "not_run",
186127
- metric: "pass",
186128
- layout: "not_run",
186129
- ship: "fail"
186130
- },
186131
- policyAction: "substitute",
186132
- measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
186133
- candidateLicense: "OFL-1.1",
186134
- exportRule: "preserve_original_name"
186135
- },
186136
- {
186137
- evidenceId: "calibri-light",
186138
- logicalFamily: "Calibri Light",
186139
- physicalFamily: "Carlito",
186140
- verdict: "visual_only",
186141
- faces: {
186142
- regular: false,
186143
- bold: false,
186144
- italic: false,
186145
- boldItalic: false
186146
- },
186147
- advance: {
186148
- meanDelta: 0.0148,
186149
- maxDelta: 0.066
186150
- },
186151
- gates: {
186152
- static: "not_run",
186153
- metric: "fail",
186154
- layout: "not_run",
186155
- ship: "fail"
186156
- },
186157
- policyAction: "category_fallback",
186158
- measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
186159
- candidateLicense: "OFL-1.1",
186160
- exportRule: "preserve_original_name"
186161
- }
186162
- ]);
186163
- BUNDLED_SUBSTITUTES = deriveBundledSubstitutes();
186164
- CATEGORY_FALLBACKS = deriveCategoryFallbacks();
186165
- defaultResolver = new FontResolver;
186166
- DEFAULT_FONT_MEASURE_CONTEXT = Object.freeze({
186167
- resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily(cssFontFamily),
186168
- fontSignature: ""
186169
- });
186170
- BUNDLED_MANIFEST = Object.freeze([
186171
- family("Carlito", "Carlito", "OFL-1.1"),
186172
- family("Caladea", "Caladea", "Apache-2.0"),
186173
- family("Liberation Sans", "LiberationSans", "OFL-1.1"),
186174
- family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
186175
- family("Liberation Mono", "LiberationMono", "OFL-1.1")
186176
- ]);
186177
- installedRegistries = /* @__PURE__ */ new WeakMap;
186178
- registriesByFontSet = /* @__PURE__ */ new WeakMap;
186179
- PHYSICAL_GENERIC = Object.freeze({
186180
- Carlito: "sans-serif",
186181
- Caladea: "serif",
186182
- "Liberation Sans": "sans-serif",
186183
- "Liberation Serif": "serif",
186184
- "Liberation Mono": "monospace"
186185
- });
186186
- BUNDLED_FAMILIES = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
186187
- FONT_OFFERINGS = deriveOfferings();
186188
- DEFAULT_FONT_ORDER = [
186189
- "Calibri",
186190
- "Arial",
186191
- "Courier New",
186192
- "Times New Roman",
186193
- "Helvetica"
186194
- ];
186195
- headlessToolbarConstants = {
186196
- DEFAULT_TEXT_ALIGN_OPTIONS: [
186197
- {
186198
- label: "Left",
186199
- value: "left"
186200
- },
186201
- {
186202
- label: "Center",
186203
- value: "center"
186204
- },
186205
- {
186206
- label: "Right",
186207
- value: "right"
186208
- },
186209
- {
186210
- label: "Justify",
186211
- value: "justify"
186212
- }
186213
- ],
186214
- DEFAULT_LINE_HEIGHT_OPTIONS: [
186215
- {
186216
- label: "1.00",
186217
- value: 1
186218
- },
186219
- {
186220
- label: "1.15",
186221
- value: 1.15
186222
- },
186223
- {
186224
- label: "1.50",
186225
- value: 1.5
186226
- },
186227
- {
186228
- label: "2.00",
186229
- value: 2
186230
- },
186231
- {
186232
- label: "2.50",
186233
- value: 2.5
186234
- },
186235
- {
186236
- label: "3.00",
186237
- value: 3
186238
- }
186239
- ],
186240
- DEFAULT_ZOOM_OPTIONS: [
186241
- {
186242
- label: "50%",
186243
- value: 50
186244
- },
186245
- {
186246
- label: "75%",
186247
- value: 75
186248
- },
186249
- {
186250
- label: "90%",
186251
- value: 90
186252
- },
186253
- {
186254
- label: "100%",
186255
- value: 100
186256
- },
186257
- {
186258
- label: "125%",
186259
- value: 125
186260
- },
186261
- {
186262
- label: "150%",
186263
- value: 150
186264
- },
186265
- {
186266
- label: "200%",
186267
- value: 200
186268
- }
186269
- ],
186270
- DEFAULT_DOCUMENT_MODE_OPTIONS: [
186271
- {
186272
- label: "Editing",
186273
- value: "editing",
186274
- description: "Edit document directly"
186275
- },
186276
- {
186277
- label: "Suggesting",
186278
- value: "suggesting",
186279
- description: "Edits become suggestions"
186280
- },
186281
- {
186282
- label: "Viewing",
186283
- value: "viewing",
186284
- description: "View clean version of document only"
186285
- }
186286
- ],
186287
- DEFAULT_FONT_SIZE_OPTIONS: [
186288
- {
186289
- label: "8",
186290
- value: "8pt"
186291
- },
186292
- {
186293
- label: "9",
186294
- value: "9pt"
186295
- },
186296
- {
186297
- label: "10",
186298
- value: "10pt"
186299
- },
186300
- {
186301
- label: "11",
186302
- value: "11pt"
186303
- },
186304
- {
186305
- label: "12",
186306
- value: "12pt"
186307
- },
186308
- {
186309
- label: "14",
186310
- value: "14pt"
186311
- },
186312
- {
186313
- label: "18",
186314
- value: "18pt"
186315
- },
186316
- {
186317
- label: "24",
186318
- value: "24pt"
186319
- },
186320
- {
186321
- label: "30",
186322
- value: "30pt"
186323
- },
186324
- {
186325
- label: "36",
186326
- value: "36pt"
186327
- },
186328
- {
186329
- label: "48",
186330
- value: "48pt"
186331
- },
186332
- {
186333
- label: "60",
186334
- value: "60pt"
186335
- },
186336
- {
186337
- label: "72",
186338
- value: "72pt"
186339
- },
186340
- {
186341
- label: "96",
186342
- value: "96pt"
186343
- }
186344
- ],
186345
- DEFAULT_FONT_FAMILY_OPTIONS: getDefaultFontFamilyOptions(),
186346
- DEFAULT_TEXT_COLOR_OPTIONS: [
186347
- {
186348
- label: "Black",
186349
- value: "#000000"
186350
- },
186351
- {
186352
- label: "Dark Gray",
186353
- value: "#434343"
186354
- },
186355
- {
186356
- label: "Gray",
186357
- value: "#666666"
186358
- },
186359
- {
186360
- label: "Light Gray",
186361
- value: "#999999"
186362
- },
186363
- {
186364
- label: "Red",
186365
- value: "#ff0000"
186366
- },
186367
- {
186368
- label: "Orange",
186369
- value: "#ff9900"
186370
- },
186371
- {
186372
- label: "Yellow",
186373
- value: "#ffff00"
186374
- },
186375
- {
186376
- label: "Green",
186377
- value: "#00ff00"
186378
- },
186379
- {
186380
- label: "Cyan",
186381
- value: "#00ffff"
186382
- },
186383
- {
186384
- label: "Blue",
186385
- value: "#0000ff"
186386
- },
186387
- {
186388
- label: "Purple",
186389
- value: "#9900ff"
186390
- },
186391
- {
186392
- label: "Magenta",
186393
- value: "#ff00ff"
186394
- },
186395
- {
186396
- label: "None",
186397
- value: "none"
186398
- }
186399
- ],
186400
- DEFAULT_HIGHLIGHT_COLOR_OPTIONS: [
186401
- {
186402
- label: "Yellow",
186403
- value: "#ffff00"
186404
- },
186405
- {
186406
- label: "Green",
186407
- value: "#00ff00"
186408
- },
186409
- {
186410
- label: "Cyan",
186411
- value: "#00ffff"
186412
- },
186413
- {
186414
- label: "Pink",
186415
- value: "#ff00ff"
186416
- },
186417
- {
186418
- label: "Blue",
186419
- value: "#0000ff"
186420
- },
186421
- {
186422
- label: "Red",
186423
- value: "#ff0000"
186424
- },
186425
- {
186426
- label: "Orange",
186427
- value: "#ff9900"
186428
- },
186429
- {
186430
- label: "None",
186431
- value: "none"
186432
- }
186433
- ]
186434
- };
186435
- MOD_ALIASES = new Set([
186436
- "Mod",
186437
- "Meta",
186438
- "Cmd",
186439
- "Command"
186440
- ]);
186441
- ALT_ALIASES = new Set(["Alt", "Option"]);
186442
- CTRL_ALIASES = new Set(["Control", "Ctrl"]);
186443
- SHIFT_ALIASES = new Set(["Shift"]);
186444
- BUILTIN_CONTEXT_MENU_GROUPS = [
186445
- "format",
186446
- "clipboard",
186447
- "review",
186448
- "comment",
186449
- "link"
186450
- ];
186451
- BUILTIN_GROUP_ORDER = new Map(BUILTIN_CONTEXT_MENU_GROUPS.map((g2, i4) => [g2, i4]));
186452
- RESERVED_PROXY_PROPERTY_NAMES = new Set([
186453
- "register",
186454
- "get",
186455
- "has",
186456
- "require",
186457
- "getContextMenuItems"
186458
- ]);
186459
- ALL_TOOLBAR_COMMAND_IDS = Object.keys(createToolbarRegistry());
186460
- EMPTY_ACTIVE_IDS = Object.freeze([]);
186461
- });
186462
-
186463
186358
  // ../../packages/superdoc/dist/chunks/eventemitter3-BnGqBE-Q.es.js
186464
186359
  var import_eventemitter3;
186465
186360
  var init_eventemitter3_BnGqBE_Q_es = __esm(() => {
@@ -232976,7 +232871,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
232976
232871
  init_remark_gfm_BhnWr3yf_es();
232977
232872
  });
232978
232873
 
232979
- // ../../packages/superdoc/dist/chunks/src-BjtupAUl.es.js
232874
+ // ../../packages/superdoc/dist/chunks/src-DEnygTyz.es.js
232980
232875
  function deleteProps(obj, propOrProps) {
232981
232876
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
232982
232877
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -249768,7 +249663,7 @@ function buildChangedTextFields(type, excerpt) {
249768
249663
  }
249769
249664
  function buildProjectedInfo(snapshot2, options = {}) {
249770
249665
  const id2 = options.id ?? snapshot2.address.entityId;
249771
- const type = options.type ?? snapshot2.type;
249666
+ const type = options.type ?? projectInternalTrackChangeType(snapshot2.type, { subtype: snapshot2.subtype });
249772
249667
  return {
249773
249668
  info: {
249774
249669
  address: {
@@ -249777,7 +249672,6 @@ function buildProjectedInfo(snapshot2, options = {}) {
249777
249672
  },
249778
249673
  id: id2,
249779
249674
  type,
249780
- ...type === "structural" && snapshot2.subtype ? { subtype: snapshot2.subtype } : {},
249781
249675
  grouping: options.grouping,
249782
249676
  pairedWithChangeId: options.pairedWithChangeId ?? undefined,
249783
249677
  wordRevisionIds: normalizeWordRevisionIds(snapshot2.wordRevisionIds),
@@ -249808,7 +249702,7 @@ function replacementPairKey2(snapshot2) {
249808
249702
  return null;
249809
249703
  }
249810
249704
  function projectedSnapshotType(snapshot2) {
249811
- return isCombinedReplacementSnapshot(snapshot2) ? "replacement" : snapshot2.type;
249705
+ return isCombinedReplacementSnapshot(snapshot2) ? "replacement" : projectInternalTrackChangeType(snapshot2.type, { subtype: snapshot2.subtype });
249812
249706
  }
249813
249707
  function snapshotGrouping(snapshot2) {
249814
249708
  return isCombinedReplacementSnapshot(snapshot2) ? "replacement-pair" : "standalone";
@@ -250033,11 +249927,10 @@ function trackChangesListWrapper(editor, input2) {
250033
249927
  const items = paged.items.map((row2) => {
250034
249928
  const info = row2.info;
250035
249929
  const handle3 = buildResolvedHandle(row2.handleKey, "stable", "trackedChange");
250036
- const { address: address2, type, subtype, grouping, pairedWithChangeId, wordRevisionIds, overlap, author, authorEmail, authorImage, date, excerpt, insertedText, deletedText, origin, imported } = info;
249930
+ const { address: address2, type, grouping, pairedWithChangeId, wordRevisionIds, overlap, author, authorEmail, authorImage, date, excerpt, insertedText, deletedText, origin, imported } = info;
250037
249931
  return buildDiscoveryItem(info.id, handle3, {
250038
249932
  address: address2,
250039
249933
  type,
250040
- ...subtype ? { subtype } : {},
250041
249934
  grouping,
250042
249935
  pairedWithChangeId,
250043
249936
  wordRevisionIds,
@@ -250088,7 +249981,7 @@ function trackChangesGetWrapper(editor, input2) {
250088
249981
  const snapshot2 = snapshots.find((item) => item.anchorKey === anchorKey || item.address.entityId === baseId);
250089
249982
  if (snapshot2)
250090
249983
  return snapshotToInfo(snapshot2);
250091
- const type = resolveTrackedChangeType(resolved.change);
249984
+ const type = projectInternalTrackChangeType(resolveTrackedChangeType(resolved.change), resolved.change.structural);
250092
249985
  const excerpt = (resolved.change.excerpt !== undefined ? resolved.change.excerpt : undefined) ?? normalizeExcerpt(resolved.editor.state.doc.textBetween(resolved.change.from, resolved.change.to, " ", ""));
250093
249986
  const grouping = resolved.change.hasInsert && resolved.change.hasDelete && !resolved.change.hasFormat ? "replacement-pair" : undefined;
250094
249987
  return {
@@ -250100,7 +249993,6 @@ function trackChangesGetWrapper(editor, input2) {
250100
249993
  },
250101
249994
  id: resolved.change.id,
250102
249995
  type,
250103
- ...type === "structural" && resolved.change.structural ? { subtype: resolved.change.structural.subtype } : {},
250104
249996
  grouping,
250105
249997
  wordRevisionIds: normalizeWordRevisionIds(resolved.change.wordRevisionIds),
250106
249998
  overlap: resolved.change.overlap,
@@ -250339,12 +250231,20 @@ function isTrackedChangeCommentTargetShape(target) {
250339
250231
  return false;
250340
250232
  return typeof value.trackedChangeId === "string" && value.trackedChangeId.length > 0;
250341
250233
  }
250234
+ function trackedChangeDisplayType(snapshot2) {
250235
+ if (snapshot2.type !== "structural")
250236
+ return null;
250237
+ return snapshot2.subtype === "table-delete" ? "tableDelete" : "tableInsert";
250238
+ }
250239
+ function publicTrackedChangeType(snapshot2) {
250240
+ return projectInternalTrackChangeType(snapshot2.type, { subtype: snapshot2.subtype });
250241
+ }
250342
250242
  function buildTrackedChangeLink(snapshot2) {
250343
250243
  const { trackedChangeText, deletedText } = trackedChangeTextFields(snapshot2);
250344
250244
  return {
250345
250245
  trackedChange: true,
250346
- trackedChangeType: snapshot2.type,
250347
- trackedChangeDisplayType: null,
250246
+ trackedChangeType: publicTrackedChangeType(snapshot2),
250247
+ trackedChangeDisplayType: trackedChangeDisplayType(snapshot2),
250348
250248
  trackedChangeStory: snapshot2.story,
250349
250249
  trackedChangeAnchorKey: snapshot2.anchorKey,
250350
250250
  trackedChangeText,
@@ -250388,7 +250288,7 @@ function choosePreferredTrackedChangeSnapshot(snapshots, preferredId) {
250388
250288
  const rightLength = Math.max(0, right$1.range.to - right$1.range.from);
250389
250289
  if (leftLength !== rightLength)
250390
250290
  return leftLength - rightLength;
250391
- const typeDelta = trackedChangeTypePriority(left$1.type) - trackedChangeTypePriority(right$1.type);
250291
+ const typeDelta = trackedChangeTypePriority(publicTrackedChangeType(left$1)) - trackedChangeTypePriority(publicTrackedChangeType(right$1));
250392
250292
  if (typeDelta !== 0)
250393
250293
  return typeDelta;
250394
250294
  if (left$1.range.from !== right$1.range.from)
@@ -250605,7 +250505,7 @@ function parseCreatedTime(value) {
250605
250505
  }
250606
250506
  function trackedChangeTextFields(snapshot2) {
250607
250507
  const excerpt = snapshot2.excerpt ?? "";
250608
- if (snapshot2.type === "delete")
250508
+ if (publicTrackedChangeType(snapshot2) === "delete")
250609
250509
  return {
250610
250510
  trackedChangeText: "",
250611
250511
  deletedText: excerpt
@@ -250632,7 +250532,8 @@ function toTrackedChangeCommentInfo(snapshot2) {
250632
250532
  anchoredText: snapshot2.excerpt,
250633
250533
  story: snapshot2.story,
250634
250534
  trackedChange: true,
250635
- trackedChangeType: snapshot2.type,
250535
+ trackedChangeType: publicTrackedChangeType(snapshot2),
250536
+ trackedChangeDisplayType: trackedChangeDisplayType(snapshot2),
250636
250537
  trackedChangeStory: snapshot2.story,
250637
250538
  trackedChangeAnchorKey: snapshot2.anchorKey,
250638
250539
  trackedChangeText,
@@ -251499,7 +251400,7 @@ function listCommentsHandler(editor, query2) {
251499
251400
  const paged = paginate(filtered, query2?.offset, query2?.limit);
251500
251401
  const items = paged.items.map((comment2) => {
251501
251402
  const handle3 = buildResolvedHandle(`comment:${comment2.commentId}`, "stable", "comment");
251502
- const { importedId, parentCommentId, text: text5, isInternal, status, target, anchoredText, createdTime, creatorName, creatorEmail, address: address2, story, trackedChange, trackedChangeType, trackedChangeDisplayType, trackedChangeStory, trackedChangeAnchorKey, trackedChangeText, deletedText, trackedChangeLink } = comment2;
251403
+ const { importedId, parentCommentId, text: text5, isInternal, status, target, anchoredText, createdTime, creatorName, creatorEmail, address: address2, story, trackedChange, trackedChangeType, trackedChangeDisplayType: trackedChangeDisplayType$1, trackedChangeStory, trackedChangeAnchorKey, trackedChangeText, deletedText, trackedChangeLink } = comment2;
251503
251404
  return buildDiscoveryItem(comment2.commentId, handle3, {
251504
251405
  address: address2,
251505
251406
  importedId,
@@ -251515,7 +251416,7 @@ function listCommentsHandler(editor, query2) {
251515
251416
  story,
251516
251417
  trackedChange,
251517
251418
  trackedChangeType,
251518
- trackedChangeDisplayType,
251419
+ trackedChangeDisplayType: trackedChangeDisplayType$1,
251519
251420
  trackedChangeStory,
251520
251421
  trackedChangeAnchorKey,
251521
251422
  trackedChangeText,
@@ -252452,6 +252353,27 @@ function rewriteImportedStyleNumbering(importedStyleEls, numRemap) {
252452
252353
  function numAttr(el, attr) {
252453
252354
  return el.attributes?.[attr];
252454
252355
  }
252356
+ function reorderNumberingChildren(numberingEl) {
252357
+ if (!numberingEl.elements)
252358
+ return;
252359
+ const other = [];
252360
+ const abstracts = [];
252361
+ const nums = [];
252362
+ for (const el of numberingEl.elements) {
252363
+ const ln = localName$1(el);
252364
+ if (ln === "abstractNum")
252365
+ abstracts.push(el);
252366
+ else if (ln === "num")
252367
+ nums.push(el);
252368
+ else
252369
+ other.push(el);
252370
+ }
252371
+ numberingEl.elements = [
252372
+ ...other,
252373
+ ...abstracts,
252374
+ ...nums
252375
+ ];
252376
+ }
252455
252377
  function mergeNumberingGraph(currentRoot, sourceRoot) {
252456
252378
  const result = {
252457
252379
  numRemap: /* @__PURE__ */ new Map,
@@ -252535,6 +252457,7 @@ function mergeNumberingGraph(currentRoot, sourceRoot) {
252535
252457
  usedNum.add(id2);
252536
252458
  cur.elements.push(next2);
252537
252459
  }
252460
+ reorderNumberingChildren(cur);
252538
252461
  return result;
252539
252462
  }
252540
252463
  function reconcileSettings(currentRoot, sourceRoot) {
@@ -252724,18 +252647,21 @@ function importHeaderFooterAssets(editor, converter, byName, dryRun) {
252724
252647
  usedMedia.add(allocated);
252725
252648
  return allocated;
252726
252649
  };
252727
- const sourceRelByTarget = /* @__PURE__ */ new Map;
252650
+ const sourceRelIdsByTarget = /* @__PURE__ */ new Map;
252728
252651
  for (const rel of srcRelEls) {
252729
252652
  const type = rel.attributes?.Type;
252730
252653
  const target = rel.attributes?.Target;
252731
252654
  const id2 = rel.attributes?.Id;
252732
252655
  if (!type || !target || !id2)
252733
252656
  continue;
252734
- if (type === HEADER_REL_TYPE2 || type === FOOTER_REL_TYPE2)
252735
- sourceRelByTarget.set(relTargetToWordPath(target).replace(/^word\//, ""), {
252736
- id: id2,
252737
- type
252738
- });
252657
+ if (type === HEADER_REL_TYPE2 || type === FOOTER_REL_TYPE2) {
252658
+ const sourceTarget = relTargetToWordPath(target).replace(/^word\//, "");
252659
+ const existing = sourceRelIdsByTarget.get(sourceTarget);
252660
+ if (existing)
252661
+ existing.push(id2);
252662
+ else
252663
+ sourceRelIdsByTarget.set(sourceTarget, [id2]);
252664
+ }
252739
252665
  }
252740
252666
  const setHeaderIdsArray = (idsHolder, relId) => {
252741
252667
  if (!Array.isArray(idsHolder.ids))
@@ -252826,12 +252752,12 @@ function importHeaderFooterAssets(editor, converter, byName, dryRun) {
252826
252752
  }
252827
252753
  });
252828
252754
  docRelsChanged = true;
252829
- const srcRel = sourceRelByTarget.get(sourceTarget);
252830
- if (srcRel) {
252831
- result.relIdRemap.set(srcRel.id, relId);
252755
+ const sourceRelIds = sourceRelIdsByTarget.get(sourceTarget) ?? [];
252756
+ for (const sourceRelId of sourceRelIds) {
252757
+ result.relIdRemap.set(sourceRelId, relId);
252832
252758
  result.mappings.push({
252833
252759
  kind: "relationship",
252834
- from: srcRel.id,
252760
+ from: sourceRelId,
252835
252761
  to: relId
252836
252762
  });
252837
252763
  }
@@ -252881,6 +252807,29 @@ function ensureContentTypeOverride$1(converter, partPath, contentType) {
252881
252807
  });
252882
252808
  return true;
252883
252809
  }
252810
+ function toSectionXmlElement(node3) {
252811
+ if (!node3.name)
252812
+ throw new Error("Expected named XML element.");
252813
+ return {
252814
+ type: node3.type,
252815
+ name: node3.name,
252816
+ attributes: node3.attributes ? { ...node3.attributes } : undefined,
252817
+ elements: node3.elements?.filter((child) => typeof child.name === "string").map((child) => toSectionXmlElement(child))
252818
+ };
252819
+ }
252820
+ function mergePageOneHeaderFooterModel(targetSectPr, sourceSectPr) {
252821
+ const mergedSectPr = ensureSectPrElement(targetSectPr);
252822
+ for (const kind of HEADER_FOOTER_KINDS4)
252823
+ for (const variant of HEADER_FOOTER_VARIANTS$2) {
252824
+ const sourceRef = getSectPrHeaderFooterRef(sourceSectPr, kind, variant);
252825
+ if (sourceRef)
252826
+ setSectPrHeaderFooterRef(mergedSectPr, kind, variant, sourceRef);
252827
+ else
252828
+ clearSectPrHeaderFooterRef(mergedSectPr, kind, variant);
252829
+ }
252830
+ writeSectPrTitlePage(mergedSectPr, readSectPrTitlePage(sourceSectPr));
252831
+ return mergedSectPr;
252832
+ }
252884
252833
  function applyPageOneSectionDefaults(editor, sourceDocumentXml, relIdRemap, parseXml2, dryRun) {
252885
252834
  const result = {
252886
252835
  detected: false,
@@ -252899,8 +252848,18 @@ function applyPageOneSectionDefaults(editor, sourceDocumentXml, relIdRemap, pars
252899
252848
  if (!sourceSectPr)
252900
252849
  return result;
252901
252850
  result.detected = true;
252902
- const sectPr = clone(sourceSectPr);
252903
- rewriteSectPrRefs(sectPr, relIdRemap);
252851
+ let sectPr;
252852
+ try {
252853
+ const rewrittenSectPr = clone(sourceSectPr);
252854
+ rewriteSectPrRefs(rewrittenSectPr, relIdRemap);
252855
+ sectPr = toSectionXmlElement(rewrittenSectPr);
252856
+ } catch {
252857
+ result.warnings.push({
252858
+ code: "SECTION_DEFAULTS_UNAVAILABLE",
252859
+ message: "Could not normalize the source page-1 sectPr."
252860
+ });
252861
+ return result;
252862
+ }
252904
252863
  let projections;
252905
252864
  try {
252906
252865
  projections = resolveSectionProjections(editor);
@@ -252911,26 +252870,43 @@ function applyPageOneSectionDefaults(editor, sourceDocumentXml, relIdRemap, pars
252911
252870
  });
252912
252871
  return result;
252913
252872
  }
252914
- const bodyProjection = [...projections].reverse().find((p$12) => p$12.target.kind === "body") ?? projections[projections.length - 1];
252915
- if (!bodyProjection) {
252873
+ if (projections.length === 0) {
252916
252874
  result.warnings.push({
252917
252875
  code: "SECTION_DEFAULTS_UNAVAILABLE",
252918
- message: "No body section projection found for page-1 sectPr adoption."
252876
+ message: "No section projections found for page-1 sectPr adoption."
252919
252877
  });
252920
252878
  return result;
252921
252879
  }
252922
- if (xmlDeepEqual(readTargetSectPr(editor, bodyProjection), sectPr))
252880
+ const bodyProjection = [...projections].reverse().find((projection) => projection.target.kind === "body") ?? projections[projections.length - 1];
252881
+ const sectionUpdates = projections.map((projection) => {
252882
+ const currentSectPr = readTargetSectPr(editor, projection);
252883
+ const nextSectPr = projection.sectionId === bodyProjection.sectionId ? clone(sectPr) : mergePageOneHeaderFooterModel(currentSectPr, sectPr);
252884
+ if (xmlDeepEqual(currentSectPr, nextSectPr))
252885
+ return null;
252886
+ return {
252887
+ sectionId: projection.sectionId,
252888
+ nextSectPr
252889
+ };
252890
+ }).filter((update) => Boolean(update));
252891
+ if (sectionUpdates.length === 0)
252923
252892
  return result;
252924
252893
  result.changed = true;
252925
252894
  result.changedParts.push({
252926
252895
  part: "word/document.xml",
252927
252896
  scope: "sectionDefaults",
252928
- change: "replaced"
252897
+ change: sectionUpdates.some((update) => update.sectionId !== bodyProjection.sectionId) ? "merged" : "replaced"
252929
252898
  });
252930
252899
  if (dryRun)
252931
252900
  return result;
252932
252901
  try {
252933
- applySectPrToProjection(editor, bodyProjection, sectPr);
252902
+ for (let index2 = 0;index2 < sectionUpdates.length; index2 += 1) {
252903
+ const update = sectionUpdates[index2];
252904
+ const liveProjection = resolveSectionProjections(editor).find((projection) => projection.sectionId === update.sectionId);
252905
+ if (!liveProjection)
252906
+ throw new Error(`Section ${update.sectionId} disappeared during page-1 sectPr adoption.`);
252907
+ applySectPrToProjection(editor, liveProjection, clone(update.nextSectPr), { addToHistory: index2 === sectionUpdates.length - 1 });
252908
+ }
252909
+ clearIndexCache(editor);
252934
252910
  result.applied = true;
252935
252911
  } catch (err) {
252936
252912
  result.changed = false;
@@ -253398,7 +253374,7 @@ async function applyTemplateAsync(editor, converter, input2, options) {
253398
253374
  });
253399
253375
  } else if (sec.detected) {
253400
253376
  warnings.push(...sec.warnings);
253401
- pushNoChangeSkip(skippedScopes, "sectionDefaults", "word/document.xml", sec.warnings.length > 0 ? "Source page-1 section defaults could not be applied." : "Source page-1 section defaults already match the active section defaults.");
253377
+ pushNoChangeSkip(skippedScopes, "sectionDefaults", "word/document.xml", sec.warnings.length > 0 ? "Source page-1 section defaults could not be applied." : "Source page-1 section defaults already match the current document's active section defaults and section header/footer visibility model.");
253402
253378
  }
253403
253379
  }
253404
253380
  if (styleMappings.length > 0)
@@ -292368,6 +292344,13 @@ function defaultInvalidate() {
292368
292344
  function toCssFontSource(url2) {
292369
292345
  return /^\s*url\(/i.test(url2) ? url2 : `url(${JSON.stringify(url2)})`;
292370
292346
  }
292347
+ function nextEmbeddedNamespace() {
292348
+ embeddedDocumentCounter += 1;
292349
+ return `__superdoc_embedded_${embeddedDocumentCounter}__`;
292350
+ }
292351
+ function sanitizeFamilyToken(family2) {
292352
+ return family2.replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "font";
292353
+ }
292371
292354
  function defaultScheduleMicrotask(callback) {
292372
292355
  if (typeof queueMicrotask === "function") {
292373
292356
  queueMicrotask(callback);
@@ -292397,7 +292380,7 @@ function makeResolveFace(resolver2, hasFace) {
292397
292380
  };
292398
292381
  };
292399
292382
  return (logical) => {
292400
- const r$1 = resolveFontFamily2(logical);
292383
+ const r$1 = resolveFontFamily(logical);
292401
292384
  return {
292402
292385
  physicalFamily: r$1.physicalFamily,
292403
292386
  reason: r$1.reason
@@ -296658,7 +296641,7 @@ var Node$13 = class Node$14 {
296658
296641
  }, getTrackedChangeText = ({ nodes, mark: mark2, trackedChangeType, isReplacement }) => {
296659
296642
  let trackedChangeText = "";
296660
296643
  let deletionText = "";
296661
- let trackedChangeDisplayType = null;
296644
+ let trackedChangeDisplayType$1 = null;
296662
296645
  if (trackedChangeType === "trackDelete" || isReplacement)
296663
296646
  deletionText = nodes.reduce((acc, node3) => {
296664
296647
  if (!node3.marks.find((nodeMark) => nodeMark.type.name === "trackDelete"))
@@ -296683,14 +296666,14 @@ var Node$13 = class Node$14 {
296683
296666
  });
296684
296667
  if (trackedFormatDisplay) {
296685
296668
  trackedChangeText = trackedFormatDisplay.trackedChangeText;
296686
- trackedChangeDisplayType = trackedFormatDisplay.trackedChangeDisplayType;
296669
+ trackedChangeDisplayType$1 = trackedFormatDisplay.trackedChangeDisplayType;
296687
296670
  } else
296688
296671
  trackedChangeText = translateFormatChangesToEnglish(normalizedFormatAttrs);
296689
296672
  }
296690
296673
  return {
296691
296674
  deletionText,
296692
296675
  trackedChangeText,
296693
- trackedChangeDisplayType
296676
+ trackedChangeDisplayType: trackedChangeDisplayType$1
296694
296677
  };
296695
296678
  }, createOrUpdateTrackedChangeComment = ({ event, marks, deletionNodes, nodes, newEditorState, documentId, trackedChangesForId }) => {
296696
296679
  const node3 = nodes[0];
@@ -296734,7 +296717,7 @@ var Node$13 = class Node$14 {
296734
296717
  nodesToUse = nodesWithMark.length ? nodesWithMark : node3 ? [node3] : [];
296735
296718
  if (!nodesToUse.length)
296736
296719
  return;
296737
- const { deletionText, trackedChangeText, trackedChangeDisplayType } = getTrackedChangeText({
296720
+ const { deletionText, trackedChangeText, trackedChangeDisplayType: trackedChangeDisplayType$1 } = getTrackedChangeText({
296738
296721
  nodes: nodesToUse,
296739
296722
  mark: trackedMark,
296740
296723
  trackedChangeType,
@@ -296750,7 +296733,7 @@ var Node$13 = class Node$14 {
296750
296733
  changeId: id2,
296751
296734
  trackedChangeType: isReplacement ? "both" : trackedChangeType,
296752
296735
  trackedChangeText,
296753
- trackedChangeDisplayType,
296736
+ trackedChangeDisplayType: trackedChangeDisplayType$1,
296754
296737
  deletedText: isReplacement || marks.deletionMark ? deletionText : null,
296755
296738
  author,
296756
296739
  ...authorId && { authorId },
@@ -310437,7 +310420,7 @@ var Node$13 = class Node$14 {
310437
310420
  listener(snapshot2);
310438
310421
  } catch {}
310439
310422
  }
310440
- }, projectedTrackedChangeCache, TRACK_MARK_TYPE_BY_NAME, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL2, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, import_jszip_min2, LAYOUT_AFFECTING_SETTING_NAMES, HEADER_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", IMAGE_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", HEADER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", FOOTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", CONTENT_TYPES_PART$1 = "[Content_Types].xml", DOCUMENT_RELS_PART$1 = "word/_rels/document.xml.rels", SUBSTRATE_SCOPE_ORDER, CONTENT_TYPE_BY_SCOPE, REL_TYPE_BY_PART, CONTENT_TYPES_PART = "[Content_Types].xml", DOCUMENT_RELS_PART = "word/_rels/document.xml.rels", SUPPORTED_DELETE_NODE_TYPES3, REJECTED_DELETE_NODE_TYPES3, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, COMMENT_MARK_NAME2 = "commentMark", TRACK_CHANGE_MARK_NAMES, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", PRESET_GREY = "999999", PRESET_BLACK = "000000", STATIC_PRESETS, IDENTITY_BLOCK_ATTRS, WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, BatchHistoryAdapter = class {
310423
+ }, projectedTrackedChangeCache, TRACK_MARK_TYPE_BY_NAME, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL2, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, import_jszip_min2, LAYOUT_AFFECTING_SETTING_NAMES, HEADER_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", IMAGE_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", HEADER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", FOOTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", CONTENT_TYPES_PART$1 = "[Content_Types].xml", DOCUMENT_RELS_PART$1 = "word/_rels/document.xml.rels", HEADER_FOOTER_KINDS4, HEADER_FOOTER_VARIANTS$2, SUBSTRATE_SCOPE_ORDER, CONTENT_TYPE_BY_SCOPE, REL_TYPE_BY_PART, CONTENT_TYPES_PART = "[Content_Types].xml", DOCUMENT_RELS_PART = "word/_rels/document.xml.rels", SUPPORTED_DELETE_NODE_TYPES3, REJECTED_DELETE_NODE_TYPES3, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, COMMENT_MARK_NAME2 = "commentMark", TRACK_CHANGE_MARK_NAMES, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", PRESET_GREY = "999999", PRESET_BLACK = "000000", STATIC_PRESETS, IDENTITY_BLOCK_ATTRS, WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, BatchHistoryAdapter = class {
310441
310424
  #done = [];
310442
310425
  #redone = [];
310443
310426
  #listeners = /* @__PURE__ */ new Set;
@@ -329942,7 +329925,7 @@ menclose::after {
329942
329925
  #flushLateFontLoads() {
329943
329926
  this.#requestReflow();
329944
329927
  }
329945
- }, FACE_STATUS_PRIORITY, DocumentFontController = class {
329928
+ }, FACE_STATUS_PRIORITY, embeddedDocumentCounter = 0, DocumentFontController = class {
329946
329929
  #resolver;
329947
329930
  #getGate;
329948
329931
  #onDocumentFontConfigApplied;
@@ -329950,6 +329933,10 @@ menclose::after {
329950
329933
  #runtimeReflowQueued = false;
329951
329934
  #runtimeReflowToken = 0;
329952
329935
  #runtimeAvailabilityChanged = false;
329936
+ #embeddedDisposers = [];
329937
+ #embeddedNamespace = nextEmbeddedNamespace();
329938
+ #embeddedPhysical = /* @__PURE__ */ new Map;
329939
+ #embeddedGeneration = 0;
329953
329940
  constructor(deps) {
329954
329941
  this.#resolver = deps.resolver;
329955
329942
  this.#getGate = deps.getGate;
@@ -329968,10 +329955,12 @@ menclose::after {
329968
329955
  }
329969
329956
  reset() {
329970
329957
  this.#cancelPendingRuntimeReflow();
329958
+ this.#releaseEmbeddedFaces();
329971
329959
  this.#resolver.reset();
329972
329960
  }
329973
329961
  dispose() {
329974
329962
  this.#cancelPendingRuntimeReflow();
329963
+ this.#releaseEmbeddedFaces();
329975
329964
  }
329976
329965
  applyInitialConfig(config2) {
329977
329966
  this.#cancelPendingRuntimeReflow();
@@ -329982,6 +329971,43 @@ menclose::after {
329982
329971
  if (registered$1)
329983
329972
  this.#getGate()?.invalidateCachesForConfigRegistration();
329984
329973
  }
329974
+ applyEmbeddedFaces(faces) {
329975
+ this.#releaseEmbeddedFaces();
329976
+ if (!faces?.length)
329977
+ return;
329978
+ const registry2 = this.#getGate()?.resolveRegistry();
329979
+ if (!registry2)
329980
+ return;
329981
+ this.#embeddedGeneration += 1;
329982
+ let registered$1 = false;
329983
+ for (const face of faces) {
329984
+ if (!face?.embeddable)
329985
+ continue;
329986
+ const physicalFamily = this.#physicalFamilyFor(face.family);
329987
+ const release = registry2.registerOwnedFace({
329988
+ family: physicalFamily,
329989
+ source: face.source,
329990
+ weight: face.weight,
329991
+ style: face.style
329992
+ });
329993
+ if (release) {
329994
+ this.#embeddedDisposers.push(release);
329995
+ this.#resolver.mapEmbedded(face.family, physicalFamily);
329996
+ registered$1 = true;
329997
+ }
329998
+ }
329999
+ if (registered$1)
330000
+ this.#getGate()?.invalidateCachesForConfigRegistration();
330001
+ }
330002
+ #physicalFamilyFor(logicalFamily) {
330003
+ const key2 = logicalFamily.trim().toLowerCase();
330004
+ let physical = this.#embeddedPhysical.get(key2);
330005
+ if (!physical) {
330006
+ physical = `${this.#embeddedNamespace}${this.#embeddedGeneration}_${this.#embeddedPhysical.size}_${sanitizeFamilyToken(logicalFamily)}`;
330007
+ this.#embeddedPhysical.set(key2, physical);
330008
+ }
330009
+ return physical;
330010
+ }
329985
330011
  add(families) {
329986
330012
  let committed = false;
329987
330013
  try {
@@ -330079,6 +330105,13 @@ menclose::after {
330079
330105
  this.#runtimeReflowQueued = false;
330080
330106
  this.#runtimeReflowToken += 1;
330081
330107
  }
330108
+ #releaseEmbeddedFaces() {
330109
+ for (const release of this.#embeddedDisposers)
330110
+ release();
330111
+ this.#embeddedDisposers.length = 0;
330112
+ this.#embeddedPhysical.clear();
330113
+ this.#resolver.clearEmbedded();
330114
+ }
330082
330115
  }, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, NATIVE_SELECTION_STYLES = `
330083
330116
  /* Hide native browser selection on layout engine content.
330084
330117
  * We render our own selection overlay via PresentationEditor's #localSelectionLayer
@@ -330156,13 +330189,13 @@ menclose::after {
330156
330189
  return;
330157
330190
  console.log(...args$1);
330158
330191
  }, 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;
330159
- var init_src_BjtupAUl_es = __esm(() => {
330192
+ var init_src_DEnygTyz_es = __esm(() => {
330160
330193
  init_rolldown_runtime_Bg48TavK_es();
330161
- init_SuperConverter_bEQ45IUD_es();
330194
+ init_SuperConverter_DOoAJ6Zk_es();
330162
330195
  init_jszip_C49i9kUs_es();
330163
330196
  init_xml_js_CqGKpaft_es();
330164
330197
  init_uuid_qzgm05fK_es();
330165
- init_create_headless_toolbar_BmFWtej0_es();
330198
+ init_create_headless_toolbar_DUhzXJ4D_es();
330166
330199
  init_constants_D9qj59G2_es();
330167
330200
  init_dist_B8HfvhaK_es();
330168
330201
  init_unified_Dsuw2be5_es();
@@ -330170,7 +330203,6 @@ var init_src_BjtupAUl_es = __esm(() => {
330170
330203
  init_remark_stringify_6MMJfY0k_es();
330171
330204
  init_DocxZipper_Bu2Fhqkw_es();
330172
330205
  init__plugin_vue_export_helper_5t5P5NuM_es();
330173
- init_create_super_doc_ui_tVaowTvG_es();
330174
330206
  init_eventemitter3_BnGqBE_Q_es();
330175
330207
  init_errors_CNaD6vcg_es();
330176
330208
  init_blank_docx_1Y_uWgjm_es();
@@ -353832,6 +353864,12 @@ function print() { __p += __j.call(arguments, '') }
353832
353864
  "noPunctuationKerning",
353833
353865
  "kerning"
353834
353866
  ]);
353867
+ HEADER_FOOTER_KINDS4 = ["header", "footer"];
353868
+ HEADER_FOOTER_VARIANTS$2 = [
353869
+ "default",
353870
+ "first",
353871
+ "even"
353872
+ ];
353835
353873
  SUBSTRATE_SCOPE_ORDER = [
353836
353874
  "styles",
353837
353875
  "numbering",
@@ -358722,6 +358760,7 @@ function print() { __p += __j.call(arguments, '') }
358722
358760
  }
358723
358761
  });
358724
358762
  this.#fontController.applyInitialConfig(this.#options.fontAssets);
358763
+ this.#applyEmbeddedDocumentFonts();
358725
358764
  if (typeof this.#options.disableContextMenu === "boolean")
358726
358765
  this.setContextMenuDisabled(this.#options.disableContextMenu);
358727
358766
  this.#setupHeaderFooterSession();
@@ -359727,6 +359766,10 @@ function print() { __p += __j.call(arguments, '') }
359727
359766
  async preloadFonts(families) {
359728
359767
  await this.#fontController.preload(families);
359729
359768
  }
359769
+ #applyEmbeddedDocumentFonts() {
359770
+ const converter = this.#editor.converter;
359771
+ this.#fontController.applyEmbeddedFaces(converter?.getEmbeddedFontFaces?.());
359772
+ }
359730
359773
  #requestFontReflow() {
359731
359774
  this.#layoutState = {
359732
359775
  ...this.#layoutState,
@@ -361022,6 +361065,7 @@ function print() { __p += __j.call(arguments, '') }
361022
361065
  this.#fontController.reset();
361023
361066
  this.#layoutFontSignature = "";
361024
361067
  this.#fontController.applyInitialConfig(this.#options.fontAssets);
361068
+ this.#applyEmbeddedDocumentFonts();
361025
361069
  this.#resetFontReportStateForDocumentChange();
361026
361070
  this.#refreshHeaderFooterStructureThenRerender({ purgeCachedEditors: true });
361027
361071
  };
@@ -364991,6 +365035,279 @@ function print() { __p += __j.call(arguments, '') }
364991
365035
  ]);
364992
365036
  });
364993
365037
 
365038
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CmcU7hTR.es.js
365039
+ 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;
365040
+ var init_create_super_doc_ui_CmcU7hTR_es = __esm(() => {
365041
+ init_SuperConverter_DOoAJ6Zk_es();
365042
+ init_create_headless_toolbar_DUhzXJ4D_es();
365043
+ headlessToolbarConstants = {
365044
+ DEFAULT_TEXT_ALIGN_OPTIONS: [
365045
+ {
365046
+ label: "Left",
365047
+ value: "left"
365048
+ },
365049
+ {
365050
+ label: "Center",
365051
+ value: "center"
365052
+ },
365053
+ {
365054
+ label: "Right",
365055
+ value: "right"
365056
+ },
365057
+ {
365058
+ label: "Justify",
365059
+ value: "justify"
365060
+ }
365061
+ ],
365062
+ DEFAULT_LINE_HEIGHT_OPTIONS: [
365063
+ {
365064
+ label: "1.00",
365065
+ value: 1
365066
+ },
365067
+ {
365068
+ label: "1.15",
365069
+ value: 1.15
365070
+ },
365071
+ {
365072
+ label: "1.50",
365073
+ value: 1.5
365074
+ },
365075
+ {
365076
+ label: "2.00",
365077
+ value: 2
365078
+ },
365079
+ {
365080
+ label: "2.50",
365081
+ value: 2.5
365082
+ },
365083
+ {
365084
+ label: "3.00",
365085
+ value: 3
365086
+ }
365087
+ ],
365088
+ DEFAULT_ZOOM_OPTIONS: [
365089
+ {
365090
+ label: "50%",
365091
+ value: 50
365092
+ },
365093
+ {
365094
+ label: "75%",
365095
+ value: 75
365096
+ },
365097
+ {
365098
+ label: "90%",
365099
+ value: 90
365100
+ },
365101
+ {
365102
+ label: "100%",
365103
+ value: 100
365104
+ },
365105
+ {
365106
+ label: "125%",
365107
+ value: 125
365108
+ },
365109
+ {
365110
+ label: "150%",
365111
+ value: 150
365112
+ },
365113
+ {
365114
+ label: "200%",
365115
+ value: 200
365116
+ }
365117
+ ],
365118
+ DEFAULT_DOCUMENT_MODE_OPTIONS: [
365119
+ {
365120
+ label: "Editing",
365121
+ value: "editing",
365122
+ description: "Edit document directly"
365123
+ },
365124
+ {
365125
+ label: "Suggesting",
365126
+ value: "suggesting",
365127
+ description: "Edits become suggestions"
365128
+ },
365129
+ {
365130
+ label: "Viewing",
365131
+ value: "viewing",
365132
+ description: "View clean version of document only"
365133
+ }
365134
+ ],
365135
+ DEFAULT_FONT_SIZE_OPTIONS: [
365136
+ {
365137
+ label: "8",
365138
+ value: "8pt"
365139
+ },
365140
+ {
365141
+ label: "9",
365142
+ value: "9pt"
365143
+ },
365144
+ {
365145
+ label: "10",
365146
+ value: "10pt"
365147
+ },
365148
+ {
365149
+ label: "11",
365150
+ value: "11pt"
365151
+ },
365152
+ {
365153
+ label: "12",
365154
+ value: "12pt"
365155
+ },
365156
+ {
365157
+ label: "14",
365158
+ value: "14pt"
365159
+ },
365160
+ {
365161
+ label: "18",
365162
+ value: "18pt"
365163
+ },
365164
+ {
365165
+ label: "24",
365166
+ value: "24pt"
365167
+ },
365168
+ {
365169
+ label: "30",
365170
+ value: "30pt"
365171
+ },
365172
+ {
365173
+ label: "36",
365174
+ value: "36pt"
365175
+ },
365176
+ {
365177
+ label: "48",
365178
+ value: "48pt"
365179
+ },
365180
+ {
365181
+ label: "60",
365182
+ value: "60pt"
365183
+ },
365184
+ {
365185
+ label: "72",
365186
+ value: "72pt"
365187
+ },
365188
+ {
365189
+ label: "96",
365190
+ value: "96pt"
365191
+ }
365192
+ ],
365193
+ DEFAULT_FONT_FAMILY_OPTIONS: getDefaultFontFamilyOptions(),
365194
+ DEFAULT_TEXT_COLOR_OPTIONS: [
365195
+ {
365196
+ label: "Black",
365197
+ value: "#000000"
365198
+ },
365199
+ {
365200
+ label: "Dark Gray",
365201
+ value: "#434343"
365202
+ },
365203
+ {
365204
+ label: "Gray",
365205
+ value: "#666666"
365206
+ },
365207
+ {
365208
+ label: "Light Gray",
365209
+ value: "#999999"
365210
+ },
365211
+ {
365212
+ label: "Red",
365213
+ value: "#ff0000"
365214
+ },
365215
+ {
365216
+ label: "Orange",
365217
+ value: "#ff9900"
365218
+ },
365219
+ {
365220
+ label: "Yellow",
365221
+ value: "#ffff00"
365222
+ },
365223
+ {
365224
+ label: "Green",
365225
+ value: "#00ff00"
365226
+ },
365227
+ {
365228
+ label: "Cyan",
365229
+ value: "#00ffff"
365230
+ },
365231
+ {
365232
+ label: "Blue",
365233
+ value: "#0000ff"
365234
+ },
365235
+ {
365236
+ label: "Purple",
365237
+ value: "#9900ff"
365238
+ },
365239
+ {
365240
+ label: "Magenta",
365241
+ value: "#ff00ff"
365242
+ },
365243
+ {
365244
+ label: "None",
365245
+ value: "none"
365246
+ }
365247
+ ],
365248
+ DEFAULT_HIGHLIGHT_COLOR_OPTIONS: [
365249
+ {
365250
+ label: "Yellow",
365251
+ value: "#ffff00"
365252
+ },
365253
+ {
365254
+ label: "Green",
365255
+ value: "#00ff00"
365256
+ },
365257
+ {
365258
+ label: "Cyan",
365259
+ value: "#00ffff"
365260
+ },
365261
+ {
365262
+ label: "Pink",
365263
+ value: "#ff00ff"
365264
+ },
365265
+ {
365266
+ label: "Blue",
365267
+ value: "#0000ff"
365268
+ },
365269
+ {
365270
+ label: "Red",
365271
+ value: "#ff0000"
365272
+ },
365273
+ {
365274
+ label: "Orange",
365275
+ value: "#ff9900"
365276
+ },
365277
+ {
365278
+ label: "None",
365279
+ value: "none"
365280
+ }
365281
+ ]
365282
+ };
365283
+ MOD_ALIASES = new Set([
365284
+ "Mod",
365285
+ "Meta",
365286
+ "Cmd",
365287
+ "Command"
365288
+ ]);
365289
+ ALT_ALIASES = new Set(["Alt", "Option"]);
365290
+ CTRL_ALIASES = new Set(["Control", "Ctrl"]);
365291
+ SHIFT_ALIASES = new Set(["Shift"]);
365292
+ BUILTIN_CONTEXT_MENU_GROUPS = [
365293
+ "format",
365294
+ "clipboard",
365295
+ "review",
365296
+ "comment",
365297
+ "link"
365298
+ ];
365299
+ BUILTIN_GROUP_ORDER = new Map(BUILTIN_CONTEXT_MENU_GROUPS.map((g3, i4) => [g3, i4]));
365300
+ RESERVED_PROXY_PROPERTY_NAMES = new Set([
365301
+ "register",
365302
+ "get",
365303
+ "has",
365304
+ "require",
365305
+ "getContextMenuItems"
365306
+ ]);
365307
+ ALL_TOOLBAR_COMMAND_IDS = Object.keys(createToolbarRegistry());
365308
+ EMPTY_ACTIVE_IDS = Object.freeze([]);
365309
+ });
365310
+
364994
365311
  // ../../packages/superdoc/dist/chunks/ui-C5PAS9hY.es.js
364995
365312
  var init_ui_C5PAS9hY_es = () => {};
364996
365313
 
@@ -365004,16 +365321,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
365004
365321
 
365005
365322
  // ../../packages/superdoc/dist/super-editor.es.js
365006
365323
  var init_super_editor_es = __esm(() => {
365007
- init_src_BjtupAUl_es();
365008
- init_SuperConverter_bEQ45IUD_es();
365324
+ init_src_DEnygTyz_es();
365325
+ init_SuperConverter_DOoAJ6Zk_es();
365009
365326
  init_jszip_C49i9kUs_es();
365010
365327
  init_xml_js_CqGKpaft_es();
365011
- init_create_headless_toolbar_BmFWtej0_es();
365328
+ init_create_headless_toolbar_DUhzXJ4D_es();
365012
365329
  init_constants_D9qj59G2_es();
365013
365330
  init_dist_B8HfvhaK_es();
365014
365331
  init_unified_Dsuw2be5_es();
365015
365332
  init_DocxZipper_Bu2Fhqkw_es();
365016
- init_create_super_doc_ui_tVaowTvG_es();
365333
+ init_create_super_doc_ui_CmcU7hTR_es();
365017
365334
  init_ui_C5PAS9hY_es();
365018
365335
  init_eventemitter3_BnGqBE_Q_es();
365019
365336
  init_errors_CNaD6vcg_es();