@superdoc-dev/cli 0.16.0-next.6 → 0.16.0-next.8

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 +655 -36
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -228922,7 +228922,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
228922
228922
  init_remark_gfm_BhnWr3yf_es();
228923
228923
  });
228924
228924
 
228925
- // ../../packages/superdoc/dist/chunks/src-DiNnkze-.es.js
228925
+ // ../../packages/superdoc/dist/chunks/src-ChnIPJVE.es.js
228926
228926
  function deleteProps(obj, propOrProps) {
228927
228927
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
228928
228928
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -248864,9 +248864,9 @@ function findDonorMarkerFont(abstract) {
248864
248864
  continue;
248865
248865
  if (rFontsHasSymbolFont(rFonts))
248866
248866
  continue;
248867
- const family = readRFontsFamily(rFonts);
248868
- if (family)
248869
- return family;
248867
+ const family$1 = readRFontsFamily(rFonts);
248868
+ if (family$1)
248869
+ return family$1;
248870
248870
  }
248871
248871
  }
248872
248872
  function normalizeLevelFontForNumFmt(lvlEl, newNumFmt) {
@@ -268105,6 +268105,181 @@ function renderPartialEmbeddedTable(params$1) {
268105
268105
  hasSdtContainerChrome: tableResult.hasSdtContainerChrome
268106
268106
  };
268107
268107
  }
268108
+ function isSettled(status) {
268109
+ return SETTLED_STATUSES.includes(status);
268110
+ }
268111
+ function normalizeFamilyKey$1(family$1) {
268112
+ return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
268113
+ }
268114
+ function splitStack(cssFontFamily) {
268115
+ return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
268116
+ }
268117
+ function physicalFor(bareFamily) {
268118
+ const physical = BUNDLED_SUBSTITUTES[normalizeFamilyKey$1(bareFamily)];
268119
+ return physical ? {
268120
+ physical,
268121
+ mapped: true
268122
+ } : {
268123
+ physical: bareFamily,
268124
+ mapped: false
268125
+ };
268126
+ }
268127
+ function resolveFontFamily2(logicalFamily) {
268128
+ const { physical, mapped } = physicalFor(splitStack(logicalFamily)[0] ?? logicalFamily);
268129
+ return {
268130
+ logicalFamily,
268131
+ physicalFamily: physical,
268132
+ reason: mapped ? "bundled_substitute" : "as_requested"
268133
+ };
268134
+ }
268135
+ function resolvePhysicalFamily(cssFontFamily) {
268136
+ if (!cssFontFamily)
268137
+ return cssFontFamily;
268138
+ const parts = splitStack(cssFontFamily);
268139
+ if (parts.length === 0)
268140
+ return cssFontFamily;
268141
+ const { physical, mapped } = physicalFor(parts[0]);
268142
+ if (!mapped)
268143
+ return cssFontFamily;
268144
+ return [physical, ...parts.slice(1)].join(", ");
268145
+ }
268146
+ function resolvePrimaryPhysicalFamily(family$1) {
268147
+ return physicalFor(splitStack(family$1)[0] ?? family$1).physical;
268148
+ }
268149
+ function resolvePhysicalFamilies(families) {
268150
+ const out = /* @__PURE__ */ new Set;
268151
+ for (const family$1 of families)
268152
+ if (family$1)
268153
+ out.add(resolvePrimaryPhysicalFamily(family$1));
268154
+ return [...out];
268155
+ }
268156
+ function getFontConfigVersion() {
268157
+ return fontConfigVersion;
268158
+ }
268159
+ function bumpFontConfigVersion() {
268160
+ return fontConfigVersion += 1;
268161
+ }
268162
+ function fourFaces(filePrefix) {
268163
+ return [
268164
+ {
268165
+ weight: "normal",
268166
+ style: "normal",
268167
+ file: `${filePrefix}-Regular.woff2`
268168
+ },
268169
+ {
268170
+ weight: "bold",
268171
+ style: "normal",
268172
+ file: `${filePrefix}-Bold.woff2`
268173
+ },
268174
+ {
268175
+ weight: "normal",
268176
+ style: "italic",
268177
+ file: `${filePrefix}-Italic.woff2`
268178
+ },
268179
+ {
268180
+ weight: "bold",
268181
+ style: "italic",
268182
+ file: `${filePrefix}-BoldItalic.woff2`
268183
+ }
268184
+ ];
268185
+ }
268186
+ function family(name, filePrefix, license) {
268187
+ return {
268188
+ family: name,
268189
+ license,
268190
+ faces: fourFaces(filePrefix)
268191
+ };
268192
+ }
268193
+ function withTrailingSlash(base5) {
268194
+ return base5.endsWith("/") ? base5 : `${base5}/`;
268195
+ }
268196
+ function joinUrl(base5, file) {
268197
+ return `${withTrailingSlash(base5)}${file}`;
268198
+ }
268199
+ function weightToken(weight) {
268200
+ return weight === "bold" ? "700" : "400";
268201
+ }
268202
+ function bundledAssetSignature(resolve3) {
268203
+ const family$1 = BUNDLED_MANIFEST[0];
268204
+ const face = family$1?.faces[0];
268205
+ if (!family$1 || !face)
268206
+ return "";
268207
+ return resolve3({
268208
+ file: face.file,
268209
+ family: family$1.family,
268210
+ weight: weightToken(face.weight),
268211
+ style: face.style,
268212
+ source: "bundled-substitute"
268213
+ });
268214
+ }
268215
+ function installBundledSubstitutes(registry2, options = {}) {
268216
+ const resolve3 = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
268217
+ const signature = bundledAssetSignature(resolve3);
268218
+ const installed = installedRegistries.get(registry2);
268219
+ if (installed !== undefined) {
268220
+ if (installed !== signature)
268221
+ 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.`);
268222
+ return;
268223
+ }
268224
+ installedRegistries.set(registry2, signature);
268225
+ for (const family$1 of BUNDLED_MANIFEST)
268226
+ for (const face of family$1.faces) {
268227
+ const context = {
268228
+ file: face.file,
268229
+ family: family$1.family,
268230
+ weight: weightToken(face.weight),
268231
+ style: face.style,
268232
+ source: "bundled-substitute"
268233
+ };
268234
+ registry2.register({
268235
+ family: family$1.family,
268236
+ source: `url(${resolve3(context)})`,
268237
+ descriptors: {
268238
+ weight: face.weight,
268239
+ style: face.style
268240
+ }
268241
+ });
268242
+ }
268243
+ }
268244
+ function buildFontReport(logicalFamilies, registry2) {
268245
+ const seen = /* @__PURE__ */ new Set;
268246
+ const report = [];
268247
+ for (const logical of logicalFamilies) {
268248
+ if (!logical || seen.has(logical))
268249
+ continue;
268250
+ seen.add(logical);
268251
+ const { physicalFamily, reason } = resolveFontFamily2(logical);
268252
+ const loadStatus = registry2.getStatus(physicalFamily);
268253
+ report.push({
268254
+ logicalFamily: logical,
268255
+ physicalFamily,
268256
+ reason,
268257
+ loadStatus,
268258
+ exportFamily: logical,
268259
+ missing: isSettled(loadStatus) && loadStatus !== "loaded"
268260
+ });
268261
+ }
268262
+ return report;
268263
+ }
268264
+ function quoteFamily(family$1) {
268265
+ return `"${family$1.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
268266
+ }
268267
+ function getFontRegistryFor(fontSet, FontFaceCtor) {
268268
+ if (!fontSet) {
268269
+ if (!domlessRegistry)
268270
+ domlessRegistry = new FontRegistry({});
268271
+ return domlessRegistry;
268272
+ }
268273
+ let registry2 = registriesByFontSet.get(fontSet);
268274
+ if (!registry2) {
268275
+ registry2 = new FontRegistry({
268276
+ fontSet,
268277
+ FontFaceCtor
268278
+ });
268279
+ registriesByFontSet.set(fontSet, registry2);
268280
+ }
268281
+ return registry2;
268282
+ }
268108
268283
  function isDigit(ch) {
268109
268284
  return ch >= "0" && ch <= "9";
268110
268285
  }
@@ -269179,6 +269354,7 @@ function resolveLayout(input2) {
269179
269354
  items: page.fragments.map((fragment2, fragmentIndex) => resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap, blockVersionCache)),
269180
269355
  margins: page.margins,
269181
269356
  footnoteReserved: page.footnoteReserved,
269357
+ displayNumber: page.displayNumber,
269182
269358
  numberText: page.numberText,
269183
269359
  vAlign: page.vAlign,
269184
269360
  baseMargins: page.baseMargins,
@@ -269204,6 +269380,7 @@ function resolveHeaderFooterLayout(layout, blocks2, measures, story) {
269204
269380
  const blockVersionCache = /* @__PURE__ */ new Map;
269205
269381
  return {
269206
269382
  number: page.number,
269383
+ displayNumber: page.displayNumber,
269207
269384
  numberText: page.numberText,
269208
269385
  items: page.fragments.map((fragment2, fragmentIndex) => resolveFragmentItem(fragment2, fragmentIndex, page.number - 1, blockMap, blockVersionCache, story))
269209
269386
  };
@@ -272381,7 +272558,7 @@ function layoutDocument(blocks2, measures, options = {}) {
272381
272558
  if (args$1.sectionPageNumber === 1 && args$1.titlePgEnabled)
272382
272559
  return "first";
272383
272560
  if (args$1.alternateHeaders)
272384
- return args$1.documentPageNumber % 2 === 0 ? "even" : "odd";
272561
+ return args$1.parityPageNumber % 2 === 0 ? "even" : "odd";
272385
272562
  return "default";
272386
272563
  };
272387
272564
  const getHeaderHeightForPage = (variantType, headerRef, sectionIndex) => {
@@ -272986,7 +273163,7 @@ function layoutDocument(blocks2, measures, options = {}) {
272986
273163
  const alternateHeaders = options.alternateHeaders ?? false;
272987
273164
  const variantType = getVariantTypeForPage({
272988
273165
  sectionPageNumber,
272989
- documentPageNumber: newPageNumber,
273166
+ parityPageNumber: activePageCounter,
272990
273167
  titlePgEnabled,
272991
273168
  alternateHeaders
272992
273169
  });
@@ -273027,6 +273204,7 @@ function layoutDocument(blocks2, measures, options = {}) {
273027
273204
  return;
273028
273205
  }
273029
273206
  if (state?.page) {
273207
+ state.page.displayNumber = activePageCounter;
273030
273208
  state.page.numberText = formatPageNumber(activePageCounter, activeNumberFormat);
273031
273209
  state.page.sectionIndex = activeSectionIndex;
273032
273210
  layoutLog(`[Layout] Page ${state.page.number}: Stamped sectionIndex:`, activeSectionIndex);
@@ -274369,6 +274547,7 @@ function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, opt
274369
274547
  return null;
274370
274548
  const kind = options?.kind ?? "header";
274371
274549
  const sectionPageNumber = options?.sectionPageNumber ?? pageNumber;
274550
+ const parityPageNumber = options?.parityPageNumber ?? pageNumber;
274372
274551
  const ids = (kind === "header" ? identifier.sectionHeaderIds.get(sectionIndex) : identifier.sectionFooterIds.get(sectionIndex)) ?? (kind === "header" ? identifier.headerIds : identifier.footerIds);
274373
274552
  const hasFirst = Boolean(ids.first);
274374
274553
  const hasEven = Boolean(ids.even);
@@ -274395,7 +274574,7 @@ function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, opt
274395
274574
  if (identifier.alternateHeaders) {
274396
274575
  if (!hasAny)
274397
274576
  return null;
274398
- return pageNumber % 2 === 0 ? "even" : "odd";
274577
+ return parityPageNumber % 2 === 0 ? "even" : "odd";
274399
274578
  }
274400
274579
  if (hasDefault)
274401
274580
  return "default";
@@ -274903,8 +275082,8 @@ function isTextRun$3(run2) {
274903
275082
  function fontString(run2) {
274904
275083
  const textRun = isTextRun$3(run2) ? run2 : null;
274905
275084
  const size$1 = textRun?.fontSize ?? 16;
274906
- const family = textRun?.fontFamily ?? "Arial";
274907
- return `${textRun?.italic ? "italic " : ""}${textRun?.bold ? "bold " : ""}${size$1}px ${family}`.trim();
275085
+ const family$1 = textRun?.fontFamily ?? "Arial";
275086
+ return `${textRun?.italic ? "italic " : ""}${textRun?.bold ? "bold " : ""}${size$1}px ${family$1}`.trim();
274908
275087
  }
274909
275088
  function runText(run2) {
274910
275089
  if (isEmptySdtPlaceholderRun(run2))
@@ -281438,6 +281617,9 @@ function normalizeRotation(rotation) {
281438
281617
  function degToRad(degrees) {
281439
281618
  return degrees * Math.PI / 180;
281440
281619
  }
281620
+ function clearMeasurementCache() {
281621
+ cache.clear();
281622
+ }
281441
281623
  function getMeasuredTextWidth(text5, font, letterSpacing, ctx$1) {
281442
281624
  if (text5.length > 32000)
281443
281625
  text5 = text5.substring(0, 32000);
@@ -281518,6 +281700,9 @@ function getFontMetrics(ctx$1, fontInfo, mode, fonts) {
281518
281700
  fontMetricsCache.set(key2, result);
281519
281701
  return result;
281520
281702
  }
281703
+ function clearFontMetricsCache() {
281704
+ fontMetricsCache.clear();
281705
+ }
281521
281706
  function computeFixedTableColumnWidths(input2) {
281522
281707
  const gridColumnCount = Math.max(0, sanitizeColumnCount(input2.gridColumnCount), Array.isArray(input2.preferredColumnWidths) ? input2.preferredColumnWidths.length : 0);
281523
281708
  const preferredTableWidth = sanitizeOptionalWidth$1(input2.preferredTableWidth);
@@ -282583,6 +282768,10 @@ function isSlightlyUnderPreferredTableWidth(totalColumnWidth, preferredTableWidt
282583
282768
  return false;
282584
282769
  return preferredTableWidth - totalColumnWidth <= preferredTableWidth * 0.05;
282585
282770
  }
282771
+ function clearTableAutoFitMeasurementCaches() {
282772
+ tableCellMetricsCache.clear();
282773
+ autoFitTableResultCache.clear();
282774
+ }
282586
282775
  function buildTableCellContentMetricsCacheKey(cell2, options) {
282587
282776
  return stableSerialize({
282588
282777
  maxWidth: Math.max(1, Math.round(options.maxWidth)),
@@ -282920,6 +283109,12 @@ function stableSerialize(value) {
282920
283109
  function isWordCharacter(value) {
282921
283110
  return /[A-Za-z0-9]/.test(value);
282922
283111
  }
283112
+ function clearTextMeasurementCaches() {
283113
+ clearMeasurementCache();
283114
+ clearFontMetricsCache();
283115
+ clearTableAutoFitMeasurementCaches();
283116
+ canvasContext = null;
283117
+ }
282923
283118
  function getTableBorderWidthPx(value) {
282924
283119
  if (value == null)
282925
283120
  return 0;
@@ -282960,13 +283155,14 @@ function buildFontString(run2) {
282960
283155
  if (run2.bold)
282961
283156
  parts.push("bold");
282962
283157
  parts.push(`${run2.fontSize}px`);
283158
+ const physicalFamily = resolvePhysicalFamily(run2.fontFamily);
282963
283159
  if (measurementConfig.mode === "deterministic")
282964
283160
  parts.push(measurementConfig.fonts.fallbackStack.length > 0 ? measurementConfig.fonts.fallbackStack.join(", ") : measurementConfig.fonts.deterministicFamily);
282965
283161
  else
282966
- parts.push(run2.fontFamily);
283162
+ parts.push(physicalFamily);
282967
283163
  return {
282968
283164
  font: parts.join(" "),
282969
- fontFamily: run2.fontFamily
283165
+ fontFamily: physicalFamily
282970
283166
  };
282971
283167
  }
282972
283168
  function measureText(text5, font, ctx$1, _fontFamily, _letterSpacing) {
@@ -285290,6 +285486,48 @@ function ensureEndnoteMarker(blocks2, id2, endnoteNumberById, endnoteNumberForma
285290
285486
  }
285291
285487
  runs2.unshift(markerRun);
285292
285488
  }
285489
+ function normalizeFamilyKey(family$1) {
285490
+ return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
285491
+ }
285492
+ function summarize(results) {
285493
+ const summary = emptySummary();
285494
+ summary.results = results;
285495
+ for (const result of results)
285496
+ if (result.status === "loaded")
285497
+ summary.loaded += 1;
285498
+ else if (result.status === "failed")
285499
+ summary.failed += 1;
285500
+ else if (result.status === "timed_out")
285501
+ summary.timedOut += 1;
285502
+ else if (result.status === "fallback_used")
285503
+ summary.fallbackUsed += 1;
285504
+ return summary;
285505
+ }
285506
+ function emptySummary() {
285507
+ return {
285508
+ loaded: 0,
285509
+ failed: 0,
285510
+ timedOut: 0,
285511
+ fallbackUsed: 0,
285512
+ results: []
285513
+ };
285514
+ }
285515
+ function defaultFontEnvironment() {
285516
+ const doc$12 = globalThis.document ?? null;
285517
+ const view = doc$12?.defaultView ?? null;
285518
+ const fontSet = doc$12?.fonts ?? null;
285519
+ const ctor = view?.FontFace ?? (typeof FontFace !== "undefined" ? FontFace : null);
285520
+ if (!fontSet || !ctor)
285521
+ return null;
285522
+ return {
285523
+ fontSet,
285524
+ FontFaceCtor: ctor
285525
+ };
285526
+ }
285527
+ function defaultInvalidate() {
285528
+ clearTextMeasurementCaches();
285529
+ measureCache.clear();
285530
+ }
285293
285531
  function buildSemanticFootnoteBlocks(input2, footnotesMode) {
285294
285532
  if (!input2 || input2.refs.length === 0 || input2.blocksById.size === 0)
285295
285533
  return [];
@@ -308423,7 +308661,143 @@ menclose::after {
308423
308661
  const visualTextEndOffset = lineEl.dir === "rtl" || lineEl.style.direction === "rtl" ? alignmentOffset : alignmentOffset + lineWidth;
308424
308662
  mark2.style.left = `${Math.max(0, leftOffsetPx + visualTextEndOffset)}px`;
308425
308663
  lineEl.appendChild(mark2);
308426
- }, DEFAULT_SUPERSCRIPT_RAISE_RATIO = 0.33, DEFAULT_SUBSCRIPT_LOWER_RATIO = 0.14, hasVerticalPositioning = (run2) => normalizeBaselineShift(run2.baselineShift) != null || run2.vertAlign === "superscript" || run2.vertAlign === "subscript", applyRunVerticalPositioning = (element3, run2) => {
308664
+ }, SETTLED_STATUSES, BUNDLED_SUBSTITUTES, fontConfigVersion = 0, BUNDLED_MANIFEST, defaultAssetBase = "/fonts/", installedRegistries, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
308665
+ #fontSet;
308666
+ #FontFaceCtor;
308667
+ #probeSize;
308668
+ #scheduleTimeout;
308669
+ #cancelTimeout;
308670
+ #managed = /* @__PURE__ */ new Map;
308671
+ #status = /* @__PURE__ */ new Map;
308672
+ #sources = /* @__PURE__ */ new Map;
308673
+ #warnedFailures = /* @__PURE__ */ new Set;
308674
+ #inflight = /* @__PURE__ */ new Map;
308675
+ constructor(options = {}) {
308676
+ this.#fontSet = options.fontSet ?? null;
308677
+ this.#FontFaceCtor = options.FontFaceCtor ?? null;
308678
+ this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
308679
+ this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
308680
+ this.#cancelTimeout = options.cancelTimeout ?? ((handle3) => globalThis.clearTimeout(handle3));
308681
+ }
308682
+ register(descriptor) {
308683
+ const { family: family$1, source, descriptors: descriptors2 } = descriptor;
308684
+ if (this.#FontFaceCtor && this.#fontSet) {
308685
+ const face = new this.#FontFaceCtor(family$1, source, descriptors2);
308686
+ this.#fontSet.add(face);
308687
+ this.#managed.set(family$1, face);
308688
+ }
308689
+ if (typeof source === "string") {
308690
+ const list5 = this.#sources.get(family$1) ?? [];
308691
+ if (!list5.includes(source))
308692
+ list5.push(source);
308693
+ this.#sources.set(family$1, list5);
308694
+ }
308695
+ if (!this.#status.has(family$1))
308696
+ this.#status.set(family$1, "unloaded");
308697
+ return {
308698
+ family: family$1,
308699
+ status: this.#status.get(family$1) ?? "unloaded"
308700
+ };
308701
+ }
308702
+ isManaged(family$1) {
308703
+ return this.#managed.has(family$1);
308704
+ }
308705
+ getStatus(family$1) {
308706
+ return this.#status.get(family$1) ?? "unloaded";
308707
+ }
308708
+ isAvailable(family$1) {
308709
+ if (!this.#fontSet)
308710
+ return false;
308711
+ try {
308712
+ return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
308713
+ } catch {
308714
+ return false;
308715
+ }
308716
+ }
308717
+ awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
308718
+ if (this.#status.get(family$1) === "loaded")
308719
+ return Promise.resolve({
308720
+ family: family$1,
308721
+ status: "loaded"
308722
+ });
308723
+ const existing = this.#inflight.get(family$1);
308724
+ if (existing)
308725
+ return existing;
308726
+ const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
308727
+ this.#inflight.delete(family$1);
308728
+ });
308729
+ this.#inflight.set(family$1, probe);
308730
+ return probe;
308731
+ }
308732
+ async awaitFaces(families, options = {}) {
308733
+ const unique$2 = [...new Set(families)];
308734
+ const timeoutMs = options.timeoutMs ?? 3000;
308735
+ return Promise.all(unique$2.map((family$1) => this.awaitFace(family$1, timeoutMs)));
308736
+ }
308737
+ getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
308738
+ return [...new Set(families)].map((family$1) => ({
308739
+ family: family$1,
308740
+ status: this.getStatus(family$1),
308741
+ ready: this.awaitFace(family$1, timeoutMs)
308742
+ }));
308743
+ }
308744
+ getStates() {
308745
+ return [...this.#status.entries()].map(([family$1, status]) => ({
308746
+ family: family$1,
308747
+ status
308748
+ }));
308749
+ }
308750
+ async#loadOne(family$1, timeoutMs) {
308751
+ const fontSet = this.#fontSet;
308752
+ if (!fontSet) {
308753
+ this.#status.set(family$1, "fallback_used");
308754
+ return {
308755
+ family: family$1,
308756
+ status: "fallback_used"
308757
+ };
308758
+ }
308759
+ this.#status.set(family$1, "loading");
308760
+ const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
308761
+ const TIMEOUT = Symbol("timeout");
308762
+ let handle3;
308763
+ const timeout$1 = new Promise((resolve3) => {
308764
+ handle3 = this.#scheduleTimeout(() => resolve3(TIMEOUT), timeoutMs);
308765
+ });
308766
+ try {
308767
+ const settled = await Promise.race([fontSet.load(probe), timeout$1]);
308768
+ if (settled === TIMEOUT) {
308769
+ this.#status.set(family$1, "timed_out");
308770
+ return {
308771
+ family: family$1,
308772
+ status: "timed_out"
308773
+ };
308774
+ }
308775
+ const status = settled.length > 0 ? "loaded" : "fallback_used";
308776
+ this.#status.set(family$1, status);
308777
+ return {
308778
+ family: family$1,
308779
+ status
308780
+ };
308781
+ } catch {
308782
+ this.#status.set(family$1, "failed");
308783
+ this.#warnLoadFailureOnce(family$1);
308784
+ return {
308785
+ family: family$1,
308786
+ status: "failed"
308787
+ };
308788
+ } finally {
308789
+ this.#cancelTimeout(handle3);
308790
+ }
308791
+ }
308792
+ #warnLoadFailureOnce(family$1) {
308793
+ if (this.#warnedFailures.has(family$1))
308794
+ return;
308795
+ this.#warnedFailures.add(family$1);
308796
+ const sources = this.#sources.get(family$1);
308797
+ const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
308798
+ console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
308799
+ }
308800
+ }, registriesByFontSet, domlessRegistry = null, DEFAULT_SUPERSCRIPT_RAISE_RATIO = 0.33, DEFAULT_SUBSCRIPT_LOWER_RATIO = 0.14, hasVerticalPositioning = (run2) => normalizeBaselineShift(run2.baselineShift) != null || run2.vertAlign === "superscript" || run2.vertAlign === "subscript", applyRunVerticalPositioning = (element3, run2) => {
308427
308801
  if (hasVerticalPositioning(run2))
308428
308802
  element3.style.lineHeight = "1";
308429
308803
  const explicitBaselineShift = normalizeBaselineShift(run2.baselineShift);
@@ -308446,7 +308820,7 @@ menclose::after {
308446
308820
  }, applyRunStyles = (element3, run2, _isLink = false) => {
308447
308821
  if (run2.kind === "tab" || run2.kind === "image" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || run2.kind === "math")
308448
308822
  return;
308449
- element3.style.fontFamily = run2.fontFamily;
308823
+ element3.style.fontFamily = resolvePhysicalFamily(run2.fontFamily);
308450
308824
  element3.style.fontSize = `${run2.fontSize}px`;
308451
308825
  if (run2.bold)
308452
308826
  element3.style.fontWeight = "bold";
@@ -312612,6 +312986,7 @@ menclose::after {
312612
312986
  return [
312613
312987
  textRun.text ?? "",
312614
312988
  textRun.fontFamily,
312989
+ getFontConfigVersion(),
312615
312990
  textRun.fontSize,
312616
312991
  textRun.bold ? 1 : 0,
312617
312992
  textRun.italic ? 1 : 0,
@@ -313135,7 +313510,9 @@ menclose::after {
313135
313510
  }, getHeaderFooterType2 = (pageNumber, identifier, options) => {
313136
313511
  if (pageNumber <= 0)
313137
313512
  return null;
313138
- const ids = (options?.kind ?? "header") === "header" ? identifier.headerIds : identifier.footerIds;
313513
+ const kind = options?.kind ?? "header";
313514
+ const parityPageNumber = options?.parityPageNumber ?? pageNumber;
313515
+ const ids = kind === "header" ? identifier.headerIds : identifier.footerIds;
313139
313516
  const hasFirst = Boolean(ids.first);
313140
313517
  const hasEven = Boolean(ids.even);
313141
313518
  const hasOdd = Boolean(ids.odd);
@@ -313144,9 +313521,9 @@ menclose::after {
313144
313521
  if (pageNumber === 1 && titlePgEnabled)
313145
313522
  return "first";
313146
313523
  if (identifier.alternateHeaders) {
313147
- if (pageNumber % 2 === 0 && hasEven)
313524
+ if (parityPageNumber % 2 === 0 && hasEven)
313148
313525
  return "even";
313149
- if (pageNumber % 2 === 1 && (hasOdd || hasDefault))
313526
+ if (parityPageNumber % 2 !== 0 && (hasOdd || hasDefault))
313150
313527
  return hasOdd ? "odd" : "default";
313151
313528
  return null;
313152
313529
  }
@@ -313816,8 +314193,8 @@ menclose::after {
313816
314193
  return typeof width === "number" ? width : 0;
313817
314194
  }, isLineBreakRun$1 = (run2) => run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line", markerFontString = (run2) => {
313818
314195
  const size$1 = run2?.fontSize ?? 16;
313819
- const family = run2?.fontFamily ?? "Arial";
313820
- return `${run2?.italic ? "italic " : ""}${run2?.bold ? "bold " : ""}${size$1}px ${family}`.trim();
314196
+ const family$1 = run2?.fontFamily ?? "Arial";
314197
+ return `${run2?.italic ? "italic " : ""}${run2?.bold ? "bold " : ""}${size$1}px ${family$1}`.trim();
313821
314198
  }, buildTabStopsPx$1 = (indent2, tabs, tabIntervalTwips) => {
313822
314199
  const paragraphIndentTwips = {
313823
314200
  left: pxToTwips$1(sanitizeIndent$1(indent2?.left)),
@@ -320339,7 +320716,7 @@ menclose::after {
320339
320716
  if (isFirstPageOfSection && titlePgEnabled)
320340
320717
  return "first";
320341
320718
  if (hasAlternateHeaders)
320342
- return page.number % 2 === 0 ? "even" : "odd";
320719
+ return (page.displayNumber ?? page.number) % 2 === 0 ? "even" : "odd";
320343
320720
  return "default";
320344
320721
  }
320345
320722
  #stripFootnoteReserveFromBottomMargin(margins, page) {
@@ -320650,6 +321027,7 @@ menclose::after {
320650
321027
  },
320651
321028
  pages: activeLayoutResult.layout.pages.map((page) => ({
320652
321029
  number: page.number,
321030
+ displayNumber: page.displayNumber,
320653
321031
  numberText: page.numberText,
320654
321032
  fragments: page.fragments
320655
321033
  }))
@@ -320723,10 +321101,15 @@ menclose::after {
320723
321101
  const sectionIndex = page?.sectionIndex ?? 0;
320724
321102
  const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
320725
321103
  const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
321104
+ const parityPageNumber = page?.displayNumber ?? pageNumber;
320726
321105
  const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, {
320727
321106
  kind,
320728
- sectionPageNumber
320729
- }) : getHeaderFooterType2(pageNumber, legacyIdentifier, { kind });
321107
+ sectionPageNumber,
321108
+ parityPageNumber
321109
+ }) : getHeaderFooterType2(pageNumber, legacyIdentifier, {
321110
+ kind,
321111
+ parityPageNumber
321112
+ });
320730
321113
  let sectionRId;
320731
321114
  if (page?.sectionRefs && kind === "header") {
320732
321115
  sectionRId = page.sectionRefs.headerRefs?.[headerFooterType];
@@ -321048,7 +321431,134 @@ menclose::after {
321048
321431
  }
321049
321432
  }
321050
321433
  }
321051
- }, ENDNOTE_MARKER_DATA_ATTR = "data-sd-endnote-number", DEFAULT_MARKER_FONT_FAMILY = "Arial", DEFAULT_MARKER_FONT_SIZE = 12, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, NATIVE_SELECTION_STYLES = `
321434
+ }, ENDNOTE_MARKER_DATA_ATTR = "data-sd-endnote-number", DEFAULT_MARKER_FONT_FAMILY = "Arial", DEFAULT_MARKER_FONT_SIZE = 12, FontReadinessGate = class {
321435
+ #getDocumentFonts;
321436
+ #resolveFamilies;
321437
+ #requestReflow;
321438
+ #getFontEnvironment;
321439
+ #registryOverride;
321440
+ #onRegistryResolved;
321441
+ #timeoutMs;
321442
+ #invalidateCaches;
321443
+ #context = null;
321444
+ #fontConfigVersion = 0;
321445
+ #requiredSignature = "";
321446
+ #requiredFamilies = /* @__PURE__ */ new Set;
321447
+ #seenAvailable = /* @__PURE__ */ new Set;
321448
+ #lastSummary = null;
321449
+ #loadingDoneHandler = null;
321450
+ constructor(options) {
321451
+ this.#getDocumentFonts = options.getDocumentFonts;
321452
+ this.#resolveFamilies = options.resolveFamilies ?? ((families) => families);
321453
+ this.#requestReflow = options.requestReflow;
321454
+ this.#getFontEnvironment = options.getFontEnvironment ?? defaultFontEnvironment;
321455
+ this.#registryOverride = options.registry ?? null;
321456
+ this.#onRegistryResolved = options.onRegistryResolved ?? null;
321457
+ this.#timeoutMs = options.timeoutMs ?? 3000;
321458
+ this.#invalidateCaches = options.invalidateCaches ?? defaultInvalidate;
321459
+ }
321460
+ get fontConfigVersion() {
321461
+ return this.#fontConfigVersion;
321462
+ }
321463
+ getDiagnostics() {
321464
+ return this.#lastSummary;
321465
+ }
321466
+ getReport() {
321467
+ let logical = [];
321468
+ try {
321469
+ logical = this.#getDocumentFonts();
321470
+ } catch {
321471
+ return [];
321472
+ }
321473
+ return buildFontReport(logical, this.#resolveContext().registry);
321474
+ }
321475
+ async ensureReadyForMeasure() {
321476
+ const registry2 = this.#resolveContext().registry;
321477
+ let required;
321478
+ try {
321479
+ required = [...new Set(this.#resolveFamilies(this.#getDocumentFonts()).filter(Boolean))];
321480
+ } catch {
321481
+ return this.#lastSummary ?? emptySummary();
321482
+ }
321483
+ const signature = required.slice().sort().join("|");
321484
+ if (signature === this.#requiredSignature && required.every((family$1) => registry2.getStatus(family$1) === "loaded") && this.#lastSummary)
321485
+ return this.#lastSummary;
321486
+ this.#requiredSignature = signature;
321487
+ this.#requiredFamilies = new Set(required);
321488
+ this.#ensureSubscribed();
321489
+ let results = [];
321490
+ try {
321491
+ results = required.length ? await registry2.awaitFaces(required, { timeoutMs: this.#timeoutMs }) : [];
321492
+ } catch {
321493
+ results = [];
321494
+ }
321495
+ for (const result of results)
321496
+ if (result.status === "loaded")
321497
+ this.#seenAvailable.add(result.family);
321498
+ this.#lastSummary = summarize(results);
321499
+ return this.#lastSummary;
321500
+ }
321501
+ notifyFontConfigChanged() {
321502
+ this.#fontConfigVersion += 1;
321503
+ bumpFontConfigVersion();
321504
+ this.#seenAvailable.clear();
321505
+ this.#requiredSignature = "";
321506
+ this.#invalidateCaches();
321507
+ this.#requestReflow();
321508
+ }
321509
+ dispose() {
321510
+ const fontSet = this.#context?.fontSet ?? null;
321511
+ if (fontSet && this.#loadingDoneHandler && typeof fontSet.removeEventListener === "function")
321512
+ fontSet.removeEventListener("loadingdone", this.#loadingDoneHandler);
321513
+ this.#loadingDoneHandler = null;
321514
+ }
321515
+ #resolveContext() {
321516
+ if (this.#context && this.#context.fontSet)
321517
+ return this.#context;
321518
+ const env2 = this.#getFontEnvironment();
321519
+ const fontSet = env2?.fontSet ?? null;
321520
+ const registry2 = this.#registryOverride ?? getFontRegistryFor(fontSet, env2?.FontFaceCtor ?? null);
321521
+ this.#context = {
321522
+ fontSet,
321523
+ registry: registry2
321524
+ };
321525
+ if (fontSet && this.#onRegistryResolved)
321526
+ try {
321527
+ this.#onRegistryResolved(registry2);
321528
+ } catch {}
321529
+ return this.#context;
321530
+ }
321531
+ #ensureSubscribed() {
321532
+ if (this.#loadingDoneHandler)
321533
+ return;
321534
+ const fontSet = this.#resolveContext().fontSet;
321535
+ if (!fontSet || typeof fontSet.addEventListener !== "function")
321536
+ return;
321537
+ const handler2 = (event) => this.#onLoadingDone(event);
321538
+ fontSet.addEventListener("loadingdone", handler2);
321539
+ this.#loadingDoneHandler = handler2;
321540
+ }
321541
+ #onLoadingDone(event) {
321542
+ const loadedKeys = new Set((event?.fontfaces ?? []).map((face) => normalizeFamilyKey(face.family)));
321543
+ if (loadedKeys.size === 0)
321544
+ return;
321545
+ let changed = false;
321546
+ for (const family$1 of this.#requiredFamilies) {
321547
+ if (this.#seenAvailable.has(family$1))
321548
+ continue;
321549
+ if (loadedKeys.has(normalizeFamilyKey(family$1))) {
321550
+ this.#seenAvailable.add(family$1);
321551
+ changed = true;
321552
+ }
321553
+ }
321554
+ if (!changed)
321555
+ return;
321556
+ this.#fontConfigVersion += 1;
321557
+ bumpFontConfigVersion();
321558
+ this.#invalidateCaches();
321559
+ this.#requestReflow();
321560
+ }
321561
+ }, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, NATIVE_SELECTION_STYLES = `
321052
321562
  /* Hide native browser selection on layout engine content.
321053
321563
  * We render our own selection overlay via PresentationEditor's #localSelectionLayer
321054
321564
  * for precise control over selection geometry across pages and zoom levels. */
@@ -321125,7 +321635,7 @@ menclose::after {
321125
321635
  return;
321126
321636
  console.log(...args$1);
321127
321637
  }, 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;
321128
- var init_src_DiNnkze_es = __esm(() => {
321638
+ var init_src_ChnIPJVE_es = __esm(() => {
321129
321639
  init_rolldown_runtime_Bg48TavK_es();
321130
321640
  init_SuperConverter_b2GjELX4_es();
321131
321641
  init_jszip_C49i9kUs_es();
@@ -345591,6 +346101,8 @@ function print() { __p += __j.call(arguments, '') }
345591
346101
  this.on("comment-positions", this.options.onCommentLocationsUpdate);
345592
346102
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
345593
346103
  this.on("fonts-resolved", this.options.onFontsResolved);
346104
+ if (this.options.onFontsChanged)
346105
+ this.on("fonts-changed", this.options.onFontsChanged);
345594
346106
  this.on("exception", this.options.onException);
345595
346107
  this.on("pointerDown", this.options.onPointerDown);
345596
346108
  this.#trackContentControlPointer();
@@ -345811,6 +346323,8 @@ function print() { __p += __j.call(arguments, '') }
345811
346323
  this.on("comment-positions", this.options.onCommentLocationsUpdate);
345812
346324
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
345813
346325
  this.on("fonts-resolved", this.options.onFontsResolved);
346326
+ if (this.options.onFontsChanged)
346327
+ this.on("fonts-changed", this.options.onFontsChanged);
345814
346328
  this.on("exception", this.options.onException);
345815
346329
  this.on("pointerDown", this.options.onPointerDown);
345816
346330
  this.#trackContentControlPointer();
@@ -347844,6 +348358,28 @@ function print() { __p += __j.call(arguments, '') }
347844
348358
  "sdtDocpartId",
347845
348359
  "sdtDocpartInstruction"
347846
348360
  ];
348361
+ SETTLED_STATUSES = [
348362
+ "loaded",
348363
+ "failed",
348364
+ "timed_out",
348365
+ "fallback_used"
348366
+ ];
348367
+ BUNDLED_SUBSTITUTES = Object.freeze({
348368
+ calibri: "Carlito",
348369
+ cambria: "Caladea",
348370
+ arial: "Liberation Sans",
348371
+ "times new roman": "Liberation Serif",
348372
+ "courier new": "Liberation Mono"
348373
+ });
348374
+ BUNDLED_MANIFEST = Object.freeze([
348375
+ family("Carlito", "Carlito", "OFL-1.1"),
348376
+ family("Caladea", "Caladea", "Apache-2.0"),
348377
+ family("Liberation Sans", "LiberationSans", "OFL-1.1"),
348378
+ family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
348379
+ family("Liberation Mono", "LiberationMono", "OFL-1.1")
348380
+ ]);
348381
+ installedRegistries = /* @__PURE__ */ new WeakMap;
348382
+ registriesByFontSet = /* @__PURE__ */ new WeakMap;
347847
348383
  OPERATOR_CHARS = new Set([
347848
348384
  "+",
347849
348385
  "-",
@@ -349001,6 +349537,9 @@ function print() { __p += __j.call(arguments, '') }
349001
349537
  #pendingMapping = null;
349002
349538
  #isRerendering = false;
349003
349539
  #selectionSync = new SelectionSyncCoordinator;
349540
+ #fontGate = null;
349541
+ #lastFontsChangedKey = null;
349542
+ #lastFontsChangedPayload = null;
349004
349543
  #shouldScrollSelectionIntoView = false;
349005
349544
  #suppressSelectionScrollUntilRaf = false;
349006
349545
  #dragDropIndicatorPos = null;
@@ -349277,6 +349816,36 @@ function print() { __p += __j.call(arguments, '') }
349277
349816
  this.#editor.presentationEditor = this;
349278
349817
  this.#editor._presentationEditor = this;
349279
349818
  this.#syncHiddenEditorA11yAttributes();
349819
+ this.#fontGate = new FontReadinessGate({
349820
+ getDocumentFonts: () => {
349821
+ return this.#editor.converter?.getDocumentFonts?.() ?? [];
349822
+ },
349823
+ requestReflow: () => {
349824
+ this.#layoutState = {
349825
+ ...this.#layoutState,
349826
+ blocks: [],
349827
+ measures: [],
349828
+ layout: null
349829
+ };
349830
+ this.#pendingDocChange = true;
349831
+ this.#scheduleRerender();
349832
+ },
349833
+ resolveFamilies: resolvePhysicalFamilies,
349834
+ onRegistryResolved: (registry2) => installBundledSubstitutes(registry2, {
349835
+ assetBaseUrl: this.#options.fontAssets?.assetBaseUrl,
349836
+ resolveAssetUrl: this.#options.fontAssets?.resolveAssetUrl
349837
+ }),
349838
+ getFontEnvironment: () => {
349839
+ const ownerDoc = this.#visibleHost?.ownerDocument ?? (typeof document !== "undefined" ? document : null);
349840
+ const view = ownerDoc?.defaultView ?? (typeof window !== "undefined" ? window : null);
349841
+ const fontSet = ownerDoc?.fonts ?? null;
349842
+ const FontFaceCtor = view?.FontFace ?? (typeof FontFace !== "undefined" ? FontFace : null);
349843
+ return fontSet && FontFaceCtor ? {
349844
+ fontSet,
349845
+ FontFaceCtor
349846
+ } : null;
349847
+ }
349848
+ });
349280
349849
  if (typeof this.#options.disableContextMenu === "boolean")
349281
349850
  this.setContextMenuDisabled(this.#options.disableContextMenu);
349282
349851
  this.#setupHeaderFooterSession();
@@ -350211,6 +350780,50 @@ function print() { __p += __j.call(arguments, '') }
350211
350780
  sectionMetadata: this.#sectionMetadata
350212
350781
  };
350213
350782
  }
350783
+ getFontReport() {
350784
+ return this.#fontGate?.getReport() ?? [];
350785
+ }
350786
+ getMissingFonts() {
350787
+ return this.getFontReport().filter((record) => record.missing).map((record) => record.logicalFamily);
350788
+ }
350789
+ #emitFontsChangedIfChanged(summary) {
350790
+ const gate = this.#fontGate;
350791
+ if (!gate)
350792
+ return;
350793
+ const version$1 = gate.fontConfigVersion;
350794
+ const key2 = `${version$1}|${summary ? summary.results.map((result) => `${result.family}:${result.status}`).sort().join(",") : ""}`;
350795
+ if (key2 === this.#lastFontsChangedKey)
350796
+ return;
350797
+ const isInitial = this.#lastFontsChangedKey === null;
350798
+ this.#lastFontsChangedKey = key2;
350799
+ let resolutions;
350800
+ try {
350801
+ resolutions = gate.getReport();
350802
+ } catch {
350803
+ return;
350804
+ }
350805
+ const payload = {
350806
+ documentFonts: resolutions.map((record) => record.logicalFamily),
350807
+ resolutions,
350808
+ missingFonts: resolutions.filter((record) => record.missing).map((record) => record.logicalFamily),
350809
+ loadSummary: summary ?? {
350810
+ loaded: 0,
350811
+ failed: 0,
350812
+ timedOut: 0,
350813
+ fallbackUsed: 0,
350814
+ results: []
350815
+ },
350816
+ source: isInitial ? "initial" : "late-load",
350817
+ version: version$1
350818
+ };
350819
+ this.#lastFontsChangedPayload = payload;
350820
+ try {
350821
+ this.#editor.emit("fonts-changed", payload);
350822
+ } catch {}
350823
+ }
350824
+ getLastFontsChangedPayload() {
350825
+ return this.#lastFontsChangedPayload;
350826
+ }
350214
350827
  getLayoutOptions() {
350215
350828
  return { ...this.#layoutOptions };
350216
350829
  }
@@ -351078,6 +351691,8 @@ function print() { __p += __j.call(arguments, '') }
351078
351691
  this.#postPaintPipeline.destroy();
351079
351692
  this.#proofingManager?.dispose();
351080
351693
  this.#proofingManager = null;
351694
+ this.#fontGate?.dispose();
351695
+ this.#fontGate = null;
351081
351696
  if (this.#cursorUpdateTimer !== null) {
351082
351697
  clearTimeout(this.#cursorUpdateTimer);
351083
351698
  this.#cursorUpdateTimer = null;
@@ -352560,6 +353175,10 @@ function print() { __p += __j.call(arguments, '') }
352560
353175
  let extraMeasures;
352561
353176
  let resolveBlocks = blocksForLayout;
352562
353177
  let resolveMeasures = previousMeasures;
353178
+ try {
353179
+ const fontSummary = await this.#fontGate?.ensureReadyForMeasure() ?? null;
353180
+ this.#emitFontsChangedIfChanged(fontSummary);
353181
+ } catch {}
352563
353182
  const headerFooterInput = this.#buildHeaderFooterInput();
352564
353183
  try {
352565
353184
  const incrementalLayoutStart = perfNow();
@@ -355380,7 +355999,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
355380
355999
 
355381
356000
  // ../../packages/superdoc/dist/super-editor.es.js
355382
356001
  var init_super_editor_es = __esm(() => {
355383
- init_src_DiNnkze_es();
356002
+ init_src_ChnIPJVE_es();
355384
356003
  init_SuperConverter_b2GjELX4_es();
355385
356004
  init_jszip_C49i9kUs_es();
355386
356005
  init_xml_js_CqGKpaft_es();
@@ -404149,8 +404768,8 @@ function mapInvokeError(operationId, error4, context) {
404149
404768
  if (error4 instanceof CliError)
404150
404769
  return error4;
404151
404770
  const code7 = extractErrorCode(error4);
404152
- const family = resolveOperationFamily(operationId);
404153
- return FAMILY_MAPPERS[family](operationId, error4, code7, context);
404771
+ const family2 = resolveOperationFamily(operationId);
404772
+ return FAMILY_MAPPERS[family2](operationId, error4, code7, context);
404154
404773
  }
404155
404774
  function isReceiptLike(value2) {
404156
404775
  if (typeof value2 !== "object" || value2 == null)
@@ -404163,7 +404782,7 @@ function mapFailedReceipt(operationId, result2, context) {
404163
404782
  if (result2.success)
404164
404783
  return null;
404165
404784
  const failure2 = result2.failure;
404166
- const family = resolveOperationFamily(operationId);
404785
+ const family2 = resolveOperationFamily(operationId);
404167
404786
  if (!failure2) {
404168
404787
  return new CliError("COMMAND_FAILED", `${operationId}: operation failed.`, { operationId });
404169
404788
  }
@@ -404172,7 +404791,7 @@ function mapFailedReceipt(operationId, result2, context) {
404172
404791
  if (failureCode && PLAN_ENGINE_PASSTHROUGH_CODES.has(failureCode)) {
404173
404792
  return new CliError(failureCode, failureMessage, { operationId, failure: failure2 });
404174
404793
  }
404175
- if (family === "trackChanges") {
404794
+ if (family2 === "trackChanges") {
404176
404795
  if (operationId === "trackChanges.decide" && failureCode === "TARGET_NOT_FOUND") {
404177
404796
  if (isTrackChangesReviewHelper(operationId, context)) {
404178
404797
  return new CliError("TRACK_CHANGE_NOT_FOUND", failureMessage, { operationId, failure: failure2 });
@@ -404187,7 +404806,7 @@ function mapFailedReceipt(operationId, result2, context) {
404187
404806
  }
404188
404807
  return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure: failure2 });
404189
404808
  }
404190
- if (family === "comments") {
404809
+ if (family2 === "comments") {
404191
404810
  if (failureCode === "TARGET_NOT_FOUND") {
404192
404811
  return new CliError("TARGET_NOT_FOUND", failureMessage, { operationId, failure: failure2 });
404193
404812
  }
@@ -404196,7 +404815,7 @@ function mapFailedReceipt(operationId, result2, context) {
404196
404815
  }
404197
404816
  return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure: failure2 });
404198
404817
  }
404199
- if (family === "lists") {
404818
+ if (family2 === "lists") {
404200
404819
  if (failureCode === "INVALID_TARGET") {
404201
404820
  return new CliError("INVALID_TARGET", failureMessage, { operationId, failure: failure2 });
404202
404821
  }
@@ -404205,7 +404824,7 @@ function mapFailedReceipt(operationId, result2, context) {
404205
404824
  }
404206
404825
  return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure: failure2 });
404207
404826
  }
404208
- if (family === "textMutation") {
404827
+ if (family2 === "textMutation") {
404209
404828
  if (failureCode === "TRACK_CHANGE_COMMAND_UNAVAILABLE" || failureCode === "CAPABILITY_UNAVAILABLE") {
404210
404829
  return new CliError("TRACK_CHANGE_COMMAND_UNAVAILABLE", failureMessage, { operationId, failure: failure2 });
404211
404830
  }
@@ -404214,13 +404833,13 @@ function mapFailedReceipt(operationId, result2, context) {
404214
404833
  }
404215
404834
  return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure: failure2 });
404216
404835
  }
404217
- if (family === "blocks") {
404836
+ if (family2 === "blocks") {
404218
404837
  if (failureCode === "INVALID_TARGET") {
404219
404838
  return new CliError("INVALID_ARGUMENT", failureMessage, { operationId, failure: failure2 });
404220
404839
  }
404221
404840
  return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure: failure2 });
404222
404841
  }
404223
- if (family === "create") {
404842
+ if (family2 === "create") {
404224
404843
  if (failureCode === "TRACK_CHANGE_COMMAND_UNAVAILABLE") {
404225
404844
  return new CliError("TRACK_CHANGE_COMMAND_UNAVAILABLE", failureMessage, { operationId, failure: failure2 });
404226
404845
  }
@@ -404229,7 +404848,7 @@ function mapFailedReceipt(operationId, result2, context) {
404229
404848
  }
404230
404849
  return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure: failure2 });
404231
404850
  }
404232
- if (family === "toc") {
404851
+ if (family2 === "toc") {
404233
404852
  if (failureCode === "TARGET_NOT_FOUND") {
404234
404853
  return new CliError("TARGET_NOT_FOUND", failureMessage, { operationId, failure: failure2 });
404235
404854
  }
@@ -404244,7 +404863,7 @@ function mapFailedReceipt(operationId, result2, context) {
404244
404863
  }
404245
404864
  return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure: failure2 });
404246
404865
  }
404247
- if (family === "images") {
404866
+ if (family2 === "images") {
404248
404867
  if (failureCode === "TARGET_NOT_FOUND") {
404249
404868
  return new CliError("TARGET_NOT_FOUND", failureMessage, { operationId, failure: failure2 });
404250
404869
  }
@@ -404253,7 +404872,7 @@ function mapFailedReceipt(operationId, result2, context) {
404253
404872
  }
404254
404873
  return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure: failure2 });
404255
404874
  }
404256
- if (family === "tables") {
404875
+ if (family2 === "tables") {
404257
404876
  if (failureCode === "TARGET_NOT_FOUND") {
404258
404877
  return new CliError("TARGET_NOT_FOUND", failureMessage, { operationId, failure: failure2 });
404259
404878
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.16.0-next.6",
3
+ "version": "0.16.0-next.8",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,20 +24,20 @@
24
24
  "@types/node": "22.19.2",
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
- "@superdoc/super-editor": "0.0.1",
28
27
  "@superdoc/document-api": "0.0.1",
29
- "superdoc": "1.38.0"
28
+ "superdoc": "1.38.0",
29
+ "@superdoc/super-editor": "0.0.1"
30
30
  },
31
31
  "module": "src/index.ts",
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.6",
37
- "@superdoc-dev/cli-darwin-x64": "0.16.0-next.6",
38
- "@superdoc-dev/cli-linux-arm64": "0.16.0-next.6",
39
- "@superdoc-dev/cli-linux-x64": "0.16.0-next.6",
40
- "@superdoc-dev/cli-windows-x64": "0.16.0-next.6"
36
+ "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.8",
37
+ "@superdoc-dev/cli-darwin-x64": "0.16.0-next.8",
38
+ "@superdoc-dev/cli-linux-arm64": "0.16.0-next.8",
39
+ "@superdoc-dev/cli-windows-x64": "0.16.0-next.8",
40
+ "@superdoc-dev/cli-linux-x64": "0.16.0-next.8"
41
41
  },
42
42
  "scripts": {
43
43
  "predev": "node scripts/ensure-superdoc-build.js",