oasis-editor 0.0.115 → 0.0.116

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.
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageContentWidth, b as getPageBodyTop, c as getPageBodyBottom, l as listReferencedEndnotes, f as getFootnoteDisplayMarker, s as setActiveHyphenation, h as getDocumentSections, i as buildFootnoteReservations, M as MAX_FOOTNOTE_LAYOUT_ITERATIONS, r as reservationSignature, j as applyFootnotesToPages, k as getRunField, m as projectBlocksLayout, v as visitRun, n as assertNever, o as createSignal, q as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getParagraphText, C as getActiveZone, D as getActiveSectionIndex, E as getParagraphs, F as normalizeSelection, G as positionToParagraphOffset, H as paragraphOffsetToPosition, I as clampPosition, J as findParagraphIndex, K as createCollapsedSelection, L as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as getBlockParagraphs, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as underlineStyleToCssDecorationStyle, Z as resolveImageSrc, _ as listKindForTag, $ as isParagraphTag, a0 as collectInlineRuns, a1 as parseParagraphStyle, a2 as getRunImage, a3 as InlineShell, a4 as BalloonShell, a5 as DocumentShell, a6 as createMemo, a7 as getCaretRectFromSnapshot, a8 as getParagraphRectFromSnapshot, a9 as createComponent, aa as CaretOverlay, ab as Show, ac as createRenderEffect, ad as style, ae as setAttribute, af as setStyleProperty, ag as memo, ah as template, ai as addEventListener, aj as insert, ak as delegateEvents, al as useI18n, am as createEffect, an as use, ao as Dialog, ap as className, aq as For, ar as UNDERLINE_STYLE_OPTIONS, as as Tabs, at as createStore, au as reconcile, av as onMount, aw as onCleanup, ax as PluginUiHost, ay as OasisEditorEditor, az as OasisBrandMark, aA as setPreciseFontPreference, aB as setWelcomeSeen, aC as enablePreciseFontMode, aD as TWIPS_PER_POINT, aE as PX_PER_INCH, aF as TWIPS_PER_INCH, aG as normalizeHex6, aH as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, aI as TABLE_BORDER_EDGE_KEYS, aJ as resolveEffectiveParagraphStyle, aK as resolveEffectiveTextStyleForParagraph, aL as EMU_PER_PT, aM as OOXML_ROTATION_UNITS, aN as OOXML_PERCENT_DENOMINATOR, aO as parseHexColorToRgb255, aP as EMU_PER_PX, aQ as getRunFootnoteReference, aR as getRunEndnoteReference, aS as iterateFootnoteReferenceRuns, aT as iterateEndnoteReferenceRuns, aU as imageContentTypeDefaults, aV as getRunFieldChar, aW as getRunFieldInstruction, aX as createEditorRun, aY as JSZip, aZ as imageExtensionFromMime, a_ as pxToPt$1, a$ as resolveFloatingObjectRect, b0 as getTextBoxFloatingGeometry, b1 as getPresetPathSegments, b2 as buildListLabels, b3 as PX_PER_POINT, b4 as DEFAULT_FONT_SIZE_PX, b5 as resolveGradientAxis, b6 as isDoubleUnderlineStyle, b7 as isWavyUnderlineStyle, b8 as underlineStyleLineWidthPx, b9 as WAVY_UNDERLINE_WAVELENGTH_PX, ba as WAVY_UNDERLINE_AMPLITUDE_PX, bb as DOUBLE_UNDERLINE_OFFSET_PX, bc as underlineStyleDashArray, bd as EMPHASIS_GLYPH, be as rgb255ToHex, bf as getImageFloatingGeometry, bg as textStyleToFontSizePt, bh as resolveOpenTypeFeatureTags, bi as resolveDecorationLineY, bj as DOUBLE_STRIKE_OFFSET_PX, bk as resolveListLabel, bl as getListLabelInset, bm as getAlignedListLabelInset, bn as getParagraphBorderInsets, bo as buildSegmentTable, bp as buildCanvasTableLayout, bq as resolveCanvasTableWidth, br as resolveFloatingTableRect, bs as normalizeFamily, bt as ROBOTO_FONT_FILES, bu as loadFontAsset, bv as OFFICE_COMPAT_FONT_FAMILIES, bw as BinaryReader, bx as buildSfnt, by as defaultFontDecoderRegistry, bz as SfntFontProgram, bA as collectPdfFontFamilies, bB as outlineFrom, bC as getPageHeaderZoneTop, bD as getPageColumnRects, bE as findFootnoteReference, bF as FOOTNOTE_MARKER_GUTTER_PX, bG as resolveImporterForFile, bH as getDocumentSectionsCanonical, bI as getDocumentParagraphsCanonical, bJ as getDocumentParagraphs, bK as getDocumentPageSettings, bL as getTableCellContentWidthForParagraph, bM as layoutMetricsEpoch, bN as bumpLayoutMetricsEpoch, bO as createCanvasLayoutSnapshotProvider, bP as on, bQ as debounce, bR as unwrap, bS as perfTimer, bT as getRunTextBox, bU as createEditorDocument, bV as resolveResizedDimensions, bW as resolveTextBoxRenderHeight, bX as getToolbarStyleState, bY as getCachedCanvasImage, bZ as measureParagraphMinContentWidthPx, b_ as getEditableBlocksForZone, b$ as findParagraphLocation, c0 as createSectionBoundaryParagraph, c1 as normalizePageSettings, c2 as DEFAULT_EDITOR_PAGE_SETTINGS, c3 as markStart, c4 as markEnd, c5 as getParagraphEntries, c6 as getParagraphById, c7 as createEditorFootnote, c8 as createFootnoteReferenceRun, c9 as renumberFootnotes, ca as getHeadingLevel, cb as preciseFontModeVersion, cc as isPreciseFontModeEnabled, cd as resolveNamedTextStyle, ce as togglePreciseFontMode, cf as nextFontSizePt, cg as previousFontSizePt, ch as fontSizePtToPx, ci as createDefaultToolbarPreset, cj as MenuRegistry, ck as createToolbarRegistry, cl as Editor, cm as resolveCommandRef, cn as commandRefName, co as createOasisEditorClient, cp as createEditorZoom, cq as startLongTaskObserver, cr as installGlobalReport, cs as applyStoredPreciseFontPreference, ct as getWelcomeSeen, cu as isLocalFontAccessSupported, cv as EDITOR_SCROLL_PADDING_PX, cw as Toolbar, cx as OasisEditorLoading, cy as I18nProvider, cz as createTranslator, cA as createEditorLogger, cB as registerDomStatsSurface } from "./index-Cq3YFYX2.js";
4
+ import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageContentWidth, b as getPageBodyTop, c as getPageBodyBottom, l as listReferencedEndnotes, f as getFootnoteDisplayMarker, h as createProjectionContext, i as getDocumentSections, j as buildFootnoteReservations, M as MAX_FOOTNOTE_LAYOUT_ITERATIONS, r as reservationSignature, k as applyFootnotesToPages, m as getRunField, n as projectBlocksLayout, v as visitRun, o as assertNever, q as createSignal, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getParagraphText, C as getActiveZone, D as getActiveSectionIndex, F as getParagraphs, G as normalizeSelection, H as positionToParagraphOffset, I as paragraphOffsetToPosition, J as clampPosition, K as findParagraphIndex, L as createCollapsedSelection, N as isSelectionCollapsed, O as parseFontSizePtToPx, P as formatFontSizePt, Q as createEditorParagraph, R as getBlockParagraphs, T as findParagraphTableLocation, U as buildTableCellLayout, V as PT_PER_PX, W as createEditorTableCell, X as createEditorTableRow, Y as createEditorTable, Z as PX_PER_POINT, _ as underlineStyleToCssDecorationStyle, $ as resolveImageSrc, a0 as listKindForTag, a1 as isParagraphTag, a2 as collectInlineRuns, a3 as parseParagraphStyle, a4 as getRunImage, a5 as InlineShell, a6 as BalloonShell, a7 as DocumentShell, a8 as createMemo, a9 as getCaretRectFromSnapshot, aa as getParagraphRectFromSnapshot, ab as createComponent, ac as CaretOverlay, ad as Show, ae as createRenderEffect, af as style, ag as setAttribute, ah as setStyleProperty, ai as memo, aj as template, ak as addEventListener, al as insert, am as delegateEvents, an as useI18n, ao as createEffect, ap as use, aq as Dialog, ar as className, as as For, at as UNDERLINE_STYLE_OPTIONS, au as Tabs, av as createStore, aw as reconcile, ax as onMount, ay as onCleanup, az as PluginUiHost, aA as OasisEditorEditor, aB as OasisBrandMark, aC as setPreciseFontPreference, aD as setWelcomeSeen, aE as enablePreciseFontMode, aF as TWIPS_PER_POINT, aG as PX_PER_INCH, aH as TWIPS_PER_INCH, aI as normalizeHex6, aJ as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, aK as TABLE_BORDER_EDGE_KEYS, aL as resolveEffectiveParagraphStyle, aM as resolveEffectiveTextStyleForParagraph, aN as EMU_PER_PT, aO as OOXML_ROTATION_UNITS, aP as OOXML_PERCENT_DENOMINATOR, aQ as parseHexColorToRgb255, aR as EMU_PER_PX, aS as getRunFootnoteReference, aT as getRunEndnoteReference, aU as iterateFootnoteReferenceRuns, aV as iterateEndnoteReferenceRuns, aW as imageContentTypeDefaults, aX as getRunFieldChar, aY as getRunFieldInstruction, aZ as createEditorRun, a_ as JSZip, a$ as imageExtensionFromMime, b0 as pxToPt$1, b1 as resolveFloatingObjectRect, b2 as getTextBoxFloatingGeometry, b3 as getPresetPathSegments, b4 as buildListLabels, b5 as DEFAULT_FONT_SIZE_PX, b6 as resolveGradientAxis, b7 as isDoubleUnderlineStyle, b8 as isWavyUnderlineStyle, b9 as underlineStyleLineWidthPx, ba as WAVY_UNDERLINE_WAVELENGTH_PX, bb as WAVY_UNDERLINE_AMPLITUDE_PX, bc as DOUBLE_UNDERLINE_OFFSET_PX, bd as underlineStyleDashArray, be as EMPHASIS_GLYPH, bf as rgb255ToHex, bg as getImageFloatingGeometry, bh as textStyleToFontSizePt, bi as TEXT_BASELINE_RATIO, bj as resolveOpenTypeFeatureTags, bk as resolveDecorationLineY, bl as DOUBLE_STRIKE_OFFSET_PX, bm as resolveListLabel, bn as getListLabelInset, bo as getAlignedListLabelInset, bp as getParagraphBorderInsets, bq as buildSegmentTable, br as buildCanvasTableLayout, bs as resolveCanvasTableWidth, bt as resolveFloatingTableRect, bu as normalizeFamily, bv as ROBOTO_FONT_FILES, bw as loadFontAsset, bx as OFFICE_COMPAT_FONT_FAMILIES, by as BinaryReader, bz as buildSfnt, bA as defaultFontDecoderRegistry, bB as SfntFontProgram, bC as collectPdfFontFamilies, bD as outlineFrom, bE as getPageHeaderZoneTop, bF as getPageColumnRects, bG as findFootnoteReference, bH as FOOTNOTE_MARKER_GUTTER_PX, bI as resolveImporterForFile, bJ as roundTo, bK as getDocumentSectionsCanonical, bL as getDocumentParagraphsCanonical, bM as getDocumentParagraphs, bN as getDocumentPageSettings, bO as getTableCellContentWidthForParagraph, bP as layoutMetricsEpoch, bQ as bumpLayoutMetricsEpoch, bR as createCanvasLayoutSnapshotProvider, bS as on, bT as debounce, bU as unwrap, bV as perfTimer, bW as getRunTextBox, bX as createEditorDocument, bY as resolveResizedDimensions, bZ as resolveTextBoxRenderHeight, b_ as getToolbarStyleState, b$ as VERTICAL_HIT_WEIGHT, c0 as getCachedCanvasImage, c1 as measureParagraphMinContentWidthPx, c2 as getEditableBlocksForZone, c3 as findParagraphLocation, c4 as createSectionBoundaryParagraph, c5 as normalizePageSettings, c6 as DEFAULT_EDITOR_PAGE_SETTINGS, c7 as markStart, c8 as markEnd, c9 as getParagraphEntries, ca as getParagraphById, cb as createEditorFootnote, cc as createFootnoteReferenceRun, cd as renumberFootnotes, ce as getHeadingLevel, cf as preciseFontModeVersion, cg as isPreciseFontModeEnabled, ch as resolveNamedTextStyle, ci as togglePreciseFontMode, cj as nextFontSizePt, ck as previousFontSizePt, cl as fontSizePtToPx, cm as createDefaultToolbarPreset, cn as MenuRegistry, co as createToolbarRegistry, cp as Editor, cq as resolveCommandRef, cr as commandRefName, cs as createOasisEditorClient, ct as createEditorZoom, cu as startLongTaskObserver, cv as installGlobalReport, cw as applyStoredPreciseFontPreference, cx as getWelcomeSeen, cy as isLocalFontAccessSupported, cz as EDITOR_SCROLL_PADDING_PX, cA as Toolbar, cB as OasisEditorLoading, cC as I18nProvider, cD as createTranslator, cE as createEditorLogger, cF as registerDomStatsSurface } from "./index-DLKF27_V.js";
5
5
  function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
6
6
  const {
7
7
  pageIndex,
@@ -54,10 +54,20 @@ function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
54
54
  });
55
55
  }
56
56
  function projectHeaderFooterBlocks(blocks, context = {}) {
57
+ const projectionCtx = context.projectionContext ?? EMPTY_PROJECTION_CONTEXT;
57
58
  return projectHeaderFooterBlocksWithDependencies(
58
59
  blocks,
59
60
  {
60
- projectParagraphLayout,
61
+ projectParagraphLayout: (paragraph, pageIndex, totalPages, styles, contentWidth, measurer, defaultTabStop) => projectParagraphLayout(
62
+ paragraph,
63
+ pageIndex,
64
+ totalPages,
65
+ styles,
66
+ contentWidth,
67
+ measurer,
68
+ defaultTabStop,
69
+ projectionCtx
70
+ ),
61
71
  estimateTableBlockHeight,
62
72
  getProjectedParagraphBlockHeight
63
73
  },
@@ -126,7 +136,8 @@ function createHeaderFooterVariantProjector(context) {
126
136
  styles: context.documentStyles,
127
137
  contentWidth,
128
138
  measurer: context.measurer,
129
- defaultTabStop: context.defaultTabStop
139
+ defaultTabStop: context.defaultTabStop,
140
+ projectionContext: context.projectionContext
130
141
  }) : void 0;
131
142
  }
132
143
  function projectTallestHeaderVariant(section, contentWidth, projectHeaderFooterVariant) {
@@ -180,7 +191,8 @@ function calculateTotalPages(context, projectHeaderFooterVariant) {
180
191
  pageOffset: isContinuous ? currentTotal - 1 : currentTotal,
181
192
  existingPages: isContinuous ? [activePages[activePages.length - 1]] : [],
182
193
  measurer: context.measurer,
183
- defaultTabStop: context.defaultTabStop
194
+ defaultTabStop: context.defaultTabStop,
195
+ projectionContext: context.projectionContext
184
196
  });
185
197
  if (isContinuous) {
186
198
  activePages.pop();
@@ -227,7 +239,8 @@ function projectAllPages(context, totalPages, projectHeaderFooterVariant, reserv
227
239
  existingPages: isContinuous ? [allPages[allPages.length - 1]] : [],
228
240
  measurer: context.measurer,
229
241
  reservedHeightByPageIndex,
230
- defaultTabStop: context.defaultTabStop
242
+ defaultTabStop: context.defaultTabStop,
243
+ projectionContext: context.projectionContext
231
244
  });
232
245
  if (isContinuous) {
233
246
  allPages.pop();
@@ -398,7 +411,7 @@ function documentContainsNumPagesField(document2) {
398
411
  function projectDocumentLayout(document2, maxPageHeightOverride, measuredHeights, measuredParagraphLayouts, options = {}) {
399
412
  var _a2, _b2;
400
413
  const measurer = options.measurer ?? domTextMeasurer;
401
- setActiveHyphenation(
414
+ const projectionContext = createProjectionContext(
402
415
  ((_a2 = document2.settings) == null ? void 0 : _a2.autoHyphenation) ? {
403
416
  enabled: true,
404
417
  zone: document2.settings.hyphenationZone,
@@ -419,13 +432,13 @@ function projectDocumentLayout(document2, maxPageHeightOverride, measuredHeights
419
432
  defaultTabStop: (_b2 = document2.settings) == null ? void 0 : _b2.defaultTabStop,
420
433
  needsTotalPages,
421
434
  projectBlocks: projectBlocksLayout,
422
- projectHeaderFooterBlocks
435
+ projectHeaderFooterBlocks,
436
+ projectionContext
423
437
  };
424
438
  const projectedSections = projectDocumentSections(sectionContext);
425
439
  let pages = projectedSections.pages;
426
440
  const totalPages = projectedSections.totalPages;
427
441
  if (!document2.footnotes || Object.keys(document2.footnotes.items).length === 0) {
428
- setActiveHyphenation(void 0);
429
442
  return { pages };
430
443
  }
431
444
  const footnoteContext = {
@@ -447,11 +460,9 @@ function projectDocumentLayout(document2, maxPageHeightOverride, measuredHeights
447
460
  pages = projectDocumentSections(sectionContext, reservations).pages;
448
461
  reservations = buildFootnoteReservations(pages, footnoteContext);
449
462
  }
450
- const result = {
463
+ return {
451
464
  pages: applyFootnotesToPages(pages, footnoteContext)
452
465
  };
453
- setActiveHyphenation(void 0);
454
- return result;
455
466
  }
456
467
  function cloneStyle(style2) {
457
468
  return style2 ? { ...style2 } : void 0;
@@ -30038,19 +30049,15 @@ function textRunStylesToCss(style2) {
30038
30049
  }
30039
30050
  }
30040
30051
  if (style2.textOutline) {
30041
- const widthPx = style2.textOutline.widthPt * (96 / 72);
30052
+ const widthPx = style2.textOutline.widthPt * PX_PER_POINT;
30042
30053
  const color = style2.textOutline.color ?? "#000000";
30043
30054
  parts.push(`-webkit-text-stroke:${widthPx.toFixed(2)}px ${color}`);
30044
30055
  }
30045
30056
  if (style2.textShadow) {
30046
30057
  const dirRad = style2.textShadow.dirDeg * Math.PI / 180;
30047
- const px = (pt) => (pt * (96 / 72)).toFixed(2);
30048
- const ox = (Math.cos(dirRad) * style2.textShadow.distPt * (96 / 72)).toFixed(
30049
- 2
30050
- );
30051
- const oy = (Math.sin(dirRad) * style2.textShadow.distPt * (96 / 72)).toFixed(
30052
- 2
30053
- );
30058
+ const px = (pt) => (pt * PX_PER_POINT).toFixed(2);
30059
+ const ox = (Math.cos(dirRad) * style2.textShadow.distPt * PX_PER_POINT).toFixed(2);
30060
+ const oy = (Math.sin(dirRad) * style2.textShadow.distPt * PX_PER_POINT).toFixed(2);
30054
30061
  const blur = px(style2.textShadow.blurPt);
30055
30062
  const alpha = style2.textShadow.alpha ?? 1;
30056
30063
  const r = parseInt(style2.textShadow.color.slice(1, 3), 16);
@@ -30060,7 +30067,7 @@ function textRunStylesToCss(style2) {
30060
30067
  `text-shadow:${ox}px ${oy}px ${blur}px rgba(${r},${g},${b},${alpha})`
30061
30068
  );
30062
30069
  } else if (style2.glow) {
30063
- const blur = (style2.glow.radiusPt * (96 / 72)).toFixed(2);
30070
+ const blur = (style2.glow.radiusPt * PX_PER_POINT).toFixed(2);
30064
30071
  const alpha = style2.glow.alpha ?? 0.7;
30065
30072
  const r = parseInt(style2.glow.color.slice(1, 3), 16);
30066
30073
  const g = parseInt(style2.glow.color.slice(3, 5), 16);
@@ -34108,10 +34115,9 @@ function serializeFloatingTableProperties(floating) {
34108
34115
  function serializeTableBorders(style2) {
34109
34116
  const borders = style2 == null ? void 0 : style2.borders;
34110
34117
  if (!borders) return "";
34111
- const xml = TABLE_BORDER_EDGE_KEYS.map(([name, key]) => [
34112
- name,
34113
- borders[key]
34114
- ]).filter((entry) => !!entry[1]).map(([name, border]) => `<w:${name} ${serializeDocxBorderAttrs(border)}`).join("");
34118
+ const xml = TABLE_BORDER_EDGE_KEYS.map(
34119
+ ([name, key]) => [name, borders[key]]
34120
+ ).filter((entry) => !!entry[1]).map(([name, border]) => `<w:${name} ${serializeDocxBorderAttrs(border)}`).join("");
34115
34121
  return xml ? `<w:tblBorders>${xml}</w:tblBorders>` : "";
34116
34122
  }
34117
34123
  function serializeTableProperties(table) {
@@ -36236,7 +36242,10 @@ function writeNotePart(zip, partName, part) {
36236
36242
  if (part.partContext.images.length > 0 || part.partContext.hyperlinks.length > 0) {
36237
36243
  zip.file(
36238
36244
  `word/_rels/${partName}.xml.rels`,
36239
- buildPartRelationshipsXml(part.partContext.images, part.partContext.hyperlinks)
36245
+ buildPartRelationshipsXml(
36246
+ part.partContext.images,
36247
+ part.partContext.hyperlinks
36248
+ )
36240
36249
  );
36241
36250
  }
36242
36251
  }
@@ -36836,7 +36845,11 @@ function resolveFragmentBounds(line, fragment, fontSizePx) {
36836
36845
  };
36837
36846
  }
36838
36847
  function fragmentRectPt(line, fragment, styles, originX, originY, yOffset, heightShrink) {
36839
- const bounds = resolveFragmentBounds(line, fragment, styles.fontSize ?? DEFAULT_FONT_SIZE_PX);
36848
+ const bounds = resolveFragmentBounds(
36849
+ line,
36850
+ fragment,
36851
+ styles.fontSize ?? DEFAULT_FONT_SIZE_PX
36852
+ );
36840
36853
  if (!bounds) return null;
36841
36854
  return {
36842
36855
  x: pxToPt$1(originX + bounds.left),
@@ -36870,7 +36883,8 @@ function drawFragmentBorder(writer, pageIndex, line, fragment, originX, originY,
36870
36883
  }
36871
36884
  function resolveGradientShadingName(writer, pageIndex, line, fragment, originX, originY, styles) {
36872
36885
  const fill = styles.textFill;
36873
- if (!fill || fill.type !== "gradient" || fill.stops.length < 2) return void 0;
36886
+ if (!fill || fill.type !== "gradient" || fill.stops.length < 2)
36887
+ return void 0;
36874
36888
  const bounds = resolveFragmentBounds(
36875
36889
  line,
36876
36890
  fragment,
@@ -36963,7 +36977,10 @@ function drawTabLeaders(writer, pageIndex, paragraph, line, fragment, document2,
36963
36977
  const slotByOffset = new Map(
36964
36978
  line.slots.map((slot) => [slot.offset, slot])
36965
36979
  );
36966
- const paragraphStyle = resolveEffectiveParagraphStyle(paragraph.style, document2.styles);
36980
+ const paragraphStyle = resolveEffectiveParagraphStyle(
36981
+ paragraph.style,
36982
+ document2.styles
36983
+ );
36967
36984
  const tabs = paragraphStyle.tabs ?? [];
36968
36985
  for (const char of fragment.chars) {
36969
36986
  if (char.char !== " ") continue;
@@ -37082,7 +37099,11 @@ function emitTextChunk(ctx, leftPx, text) {
37082
37099
  y: pxToPt$1(baselineY),
37083
37100
  text,
37084
37101
  color: mainColor,
37085
- ...gradientShadingName ? { gradientShadingName } : textOutline ? { renderMode: 2, strokeColor: textOutline.color ?? mainColor, strokeWidth: textOutline.widthPt } : { renderMode: styles.outline ? 1 : 0 }
37102
+ ...gradientShadingName ? { gradientShadingName } : textOutline ? {
37103
+ renderMode: 2,
37104
+ strokeColor: textOutline.color ?? mainColor,
37105
+ strokeWidth: textOutline.widthPt
37106
+ } : { renderMode: styles.outline ? 1 : 0 }
37086
37107
  });
37087
37108
  }
37088
37109
  function groupSlotChunksByWhitespace(chars) {
@@ -37192,7 +37213,44 @@ function drawFragmentDecoration(writer, pageIndex, line, fragment, originX, orig
37192
37213
  });
37193
37214
  return;
37194
37215
  }
37195
- drawUnderlineWithStyle(writer, pageIndex, x1, x2, y, stroke, styles.underlineStyle);
37216
+ drawUnderlineWithStyle(
37217
+ writer,
37218
+ pageIndex,
37219
+ x1,
37220
+ x2,
37221
+ y,
37222
+ stroke,
37223
+ styles.underlineStyle
37224
+ );
37225
+ }
37226
+ function drawLinkAnnotation(writer, pageIndex, line, fragment, originX, originY, styles) {
37227
+ if (!styles.link) return;
37228
+ const linkBounds = resolveFragmentBounds(
37229
+ line,
37230
+ fragment,
37231
+ styles.fontSize ?? DEFAULT_FONT_SIZE_PX
37232
+ );
37233
+ if (!linkBounds || linkBounds.right <= linkBounds.left) return;
37234
+ const isInternal = styles.link.startsWith("#");
37235
+ writer.addLinkAnnotation(pageIndex, {
37236
+ x: pxToPt$1(originX + linkBounds.left),
37237
+ y: pxToPt$1(originY + line.top),
37238
+ width: pxToPt$1(linkBounds.right - linkBounds.left),
37239
+ height: pxToPt$1(line.height),
37240
+ ...isInternal ? { destName: styles.link.slice(1) } : { uri: styles.link }
37241
+ });
37242
+ }
37243
+ function emitFragmentGlyphs(chunkCtx, chars, originX, styles, line, fragment, paragraphAlign) {
37244
+ const chunks = paragraphAlign === "justify" ? groupSlotChunksByWhitespace(chars) : groupSlotChunksByOffsetGaps(chars);
37245
+ for (const chunk of chunks) {
37246
+ const chunkText = chunk.map((c) => styles.allCaps ? c.char.toUpperCase() : c.char).join("");
37247
+ if (chunkText.length === 0) continue;
37248
+ emitTextChunk(chunkCtx, originX + chunk[0].left, chunkText);
37249
+ }
37250
+ if (line.trailingHyphen && fragment.endOffset >= line.endOffset) {
37251
+ const endSlot = line.slots.find((slot) => slot.offset === line.endOffset) ?? line.slots[line.slots.length - 1];
37252
+ if (endSlot) emitTextChunk(chunkCtx, originX + endSlot.left, "-");
37253
+ }
37196
37254
  }
37197
37255
  async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, document2, originX, originY, fontRegistry, drawers) {
37198
37256
  var _a2, _b2, _c;
@@ -37200,7 +37258,11 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
37200
37258
  if (fragment.image.floating) return;
37201
37259
  const slot = line.slots.find((c) => c.offset === fragment.startOffset) ?? line.slots.find((c) => c.offset >= fragment.startOffset);
37202
37260
  if (!slot) return;
37203
- const resourceName = await registerPdfImageRun(writer, document2, fragment.image);
37261
+ const resourceName = await registerPdfImageRun(
37262
+ writer,
37263
+ document2,
37264
+ fragment.image
37265
+ );
37204
37266
  if (!resourceName) return;
37205
37267
  writer.drawImage(pageIndex, {
37206
37268
  resourceName,
@@ -37241,34 +37303,55 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
37241
37303
  });
37242
37304
  const fontSizePt = styles.smallCaps ? textStyleToFontSizePt(styles) * 0.8 : textStyleToFontSizePt(styles);
37243
37305
  const baselineShiftPx = (styles.baselineShift ?? 0) * PX_PER_POINT;
37244
- const baselineY = originY + line.top + line.height * 0.8 - baselineShiftPx;
37306
+ const baselineY = originY + line.top + line.height * TEXT_BASELINE_RATIO - baselineShiftPx;
37245
37307
  const chars = resolveFragmentSlots(line, fragment);
37246
37308
  const text = chars.map((char) => styles.allCaps ? char.char.toUpperCase() : char.char).join("");
37247
37309
  const firstChar = chars[0];
37248
37310
  if (!firstChar || text.length === 0) return;
37249
- if (styles.link) {
37250
- const linkBounds = resolveFragmentBounds(
37251
- line,
37252
- fragment,
37253
- styles.fontSize ?? DEFAULT_FONT_SIZE_PX
37254
- );
37255
- if (linkBounds && linkBounds.right > linkBounds.left) {
37256
- const isInternal = styles.link.startsWith("#");
37257
- writer.addLinkAnnotation(pageIndex, {
37258
- x: pxToPt$1(originX + linkBounds.left),
37259
- y: pxToPt$1(originY + line.top),
37260
- width: pxToPt$1(linkBounds.right - linkBounds.left),
37261
- height: pxToPt$1(line.height),
37262
- ...isInternal ? { destName: styles.link.slice(1) } : { uri: styles.link }
37263
- });
37264
- }
37265
- }
37266
- drawFragmentShading(writer, pageIndex, line, fragment, originX, originY, styles);
37267
- drawFragmentHighlight(writer, pageIndex, line, fragment, originX, originY, styles);
37268
- drawFragmentBorder(writer, pageIndex, line, fragment, originX, originY, styles);
37269
- drawTabLeaders(writer, pageIndex, paragraph, line, fragment, document2, originX, baselineY, styles.color ?? "#000000");
37311
+ drawLinkAnnotation(writer, pageIndex, line, fragment, originX, originY, styles);
37312
+ drawFragmentShading(
37313
+ writer,
37314
+ pageIndex,
37315
+ line,
37316
+ fragment,
37317
+ originX,
37318
+ originY,
37319
+ styles
37320
+ );
37321
+ drawFragmentHighlight(
37322
+ writer,
37323
+ pageIndex,
37324
+ line,
37325
+ fragment,
37326
+ originX,
37327
+ originY,
37328
+ styles
37329
+ );
37330
+ drawFragmentBorder(
37331
+ writer,
37332
+ pageIndex,
37333
+ line,
37334
+ fragment,
37335
+ originX,
37336
+ originY,
37337
+ styles
37338
+ );
37339
+ drawTabLeaders(
37340
+ writer,
37341
+ pageIndex,
37342
+ paragraph,
37343
+ line,
37344
+ fragment,
37345
+ document2,
37346
+ originX,
37347
+ baselineY,
37348
+ styles.color ?? "#000000"
37349
+ );
37270
37350
  const paragraphAlign = resolveEffectiveParagraphStyle(paragraph.style, document2.styles).align ?? "left";
37271
- const fontFeatures = resolveOpenTypeFeatureTags(styles, textStyleToFontSizePt(styles));
37351
+ const fontFeatures = resolveOpenTypeFeatureTags(
37352
+ styles,
37353
+ textStyleToFontSizePt(styles)
37354
+ );
37272
37355
  const baseTextOptions = {
37273
37356
  fontSize: fontSizePt,
37274
37357
  bold: styles.bold,
@@ -37298,27 +37381,53 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
37298
37381
  styles,
37299
37382
  baseTextOptions
37300
37383
  };
37301
- const chunks = paragraphAlign === "justify" ? groupSlotChunksByWhitespace(chars) : groupSlotChunksByOffsetGaps(chars);
37302
- for (const chunk of chunks) {
37303
- const chunkText = chunk.map((c) => styles.allCaps ? c.char.toUpperCase() : c.char).join("");
37304
- if (chunkText.length === 0) continue;
37305
- emitTextChunk(chunkCtx, originX + chunk[0].left, chunkText);
37306
- }
37307
- if (line.trailingHyphen && fragment.endOffset >= line.endOffset) {
37308
- const endSlot = line.slots.find((slot) => slot.offset === line.endOffset) ?? line.slots[line.slots.length - 1];
37309
- if (endSlot) emitTextChunk(chunkCtx, originX + endSlot.left, "-");
37310
- }
37384
+ emitFragmentGlyphs(chunkCtx, chars, originX, styles, line, fragment, paragraphAlign);
37311
37385
  if (styles.underline) {
37312
- drawFragmentDecoration(writer, pageIndex, line, fragment, originX, originY, styles, "underline");
37386
+ drawFragmentDecoration(
37387
+ writer,
37388
+ pageIndex,
37389
+ line,
37390
+ fragment,
37391
+ originX,
37392
+ originY,
37393
+ styles,
37394
+ "underline"
37395
+ );
37313
37396
  }
37314
37397
  if (styles.strike) {
37315
- drawFragmentDecoration(writer, pageIndex, line, fragment, originX, originY, styles, "strike");
37398
+ drawFragmentDecoration(
37399
+ writer,
37400
+ pageIndex,
37401
+ line,
37402
+ fragment,
37403
+ originX,
37404
+ originY,
37405
+ styles,
37406
+ "strike"
37407
+ );
37316
37408
  }
37317
37409
  if (styles.doubleStrike) {
37318
- drawFragmentDecoration(writer, pageIndex, line, fragment, originX, originY, styles, "doubleStrike");
37410
+ drawFragmentDecoration(
37411
+ writer,
37412
+ pageIndex,
37413
+ line,
37414
+ fragment,
37415
+ originX,
37416
+ originY,
37417
+ styles,
37418
+ "doubleStrike"
37419
+ );
37319
37420
  }
37320
37421
  if (styles.emphasisMark) {
37321
- drawFragmentEmphasis(writer, pageIndex, line, fragment, originX, originY, styles);
37422
+ drawFragmentEmphasis(
37423
+ writer,
37424
+ pageIndex,
37425
+ line,
37426
+ fragment,
37427
+ originX,
37428
+ originY,
37429
+ styles
37430
+ );
37322
37431
  }
37323
37432
  }
37324
37433
  function getListOrdinals(document2) {
@@ -37358,7 +37467,7 @@ function drawListPrefix(writer, pageIndex, paragraph, line, document2, originX,
37358
37467
  );
37359
37468
  writer.drawText(pageIndex, {
37360
37469
  x: pxToPt$1(originX + Math.max(0, alignedInset || labelInset)),
37361
- y: pxToPt$1(originY + line.top + line.height * 0.8),
37470
+ y: pxToPt$1(originY + line.top + line.height * TEXT_BASELINE_RATIO),
37362
37471
  text: prefix,
37363
37472
  fontSize: fontSizePt,
37364
37473
  color: styles.color ?? "#000000",
@@ -38522,12 +38631,20 @@ function parseLayoutTableHeader(reader) {
38522
38631
  function parseLookupList(reader, lookupListOffset, parseSubtable2) {
38523
38632
  reader.seek(lookupListOffset);
38524
38633
  const lookupCount = reader.u16();
38525
- const lookupOffsets = readU16OffsetArray(reader, lookupCount, lookupListOffset);
38634
+ const lookupOffsets = readU16OffsetArray(
38635
+ reader,
38636
+ lookupCount,
38637
+ lookupListOffset
38638
+ );
38526
38639
  return lookupOffsets.map((lookupOffset) => {
38527
38640
  reader.seek(lookupOffset);
38528
38641
  const lookupType = reader.u16();
38529
38642
  reader.skip(2);
38530
- const subtableOffsets = readU16OffsetArray(reader, reader.u16(), lookupOffset);
38643
+ const subtableOffsets = readU16OffsetArray(
38644
+ reader,
38645
+ reader.u16(),
38646
+ lookupOffset
38647
+ );
38531
38648
  const subtables = [];
38532
38649
  for (const subtableOffset of subtableOffsets) {
38533
38650
  try {
@@ -38705,9 +38822,21 @@ function parseChainContextSubst(reader, offset) {
38705
38822
  reader.seek(offset);
38706
38823
  const format = reader.u16();
38707
38824
  if (format === 3) {
38708
- const backtrackCoverageOffsets = readU16OffsetArray(reader, reader.u16(), offset);
38709
- const inputCoverageOffsets = readU16OffsetArray(reader, reader.u16(), offset);
38710
- const lookaheadCoverageOffsets = readU16OffsetArray(reader, reader.u16(), offset);
38825
+ const backtrackCoverageOffsets = readU16OffsetArray(
38826
+ reader,
38827
+ reader.u16(),
38828
+ offset
38829
+ );
38830
+ const inputCoverageOffsets = readU16OffsetArray(
38831
+ reader,
38832
+ reader.u16(),
38833
+ offset
38834
+ );
38835
+ const lookaheadCoverageOffsets = readU16OffsetArray(
38836
+ reader,
38837
+ reader.u16(),
38838
+ offset
38839
+ );
38711
38840
  const substCount = reader.u16();
38712
38841
  const records = readSubstLookupRecords(reader, substCount);
38713
38842
  const backtrack = backtrackCoverageOffsets.map(
@@ -41012,7 +41141,7 @@ function buildImportedDocumentDiagnostics(document2) {
41012
41141
  );
41013
41142
  return {
41014
41143
  index,
41015
- text: getParagraphText(paragraph).slice(0, 160),
41144
+ textLength: getParagraphText(paragraph).length,
41016
41145
  runCount: paragraph.runs.length,
41017
41146
  rawParagraphStyle: paragraph.style,
41018
41147
  align: paragraphStyle.align,
@@ -41053,7 +41182,7 @@ function createDocumentImporter(deps) {
41053
41182
  const arrayBuffer = await readFileBuffer(file);
41054
41183
  deps.logger.info("import:phase", {
41055
41184
  phase: "reading-file",
41056
- durationMs: Math.round((deps.now() - readingStartedAt) * 100) / 100
41185
+ durationMs: roundTo(deps.now() - readingStartedAt, 2)
41057
41186
  });
41058
41187
  let lastProgressStage = null;
41059
41188
  let lastProgressValue = -1;
@@ -41081,7 +41210,7 @@ function createDocumentImporter(deps) {
41081
41210
  }
41082
41211
  }
41083
41212
  );
41084
- deps.logger.info(
41213
+ deps.logger.debug(
41085
41214
  "import:document-diagnostics",
41086
41215
  buildImportedDocumentDiagnostics(document2)
41087
41216
  );
@@ -41093,7 +41222,7 @@ function createDocumentImporter(deps) {
41093
41222
  await deps.stabilizeLayoutAfterImport();
41094
41223
  deps.logger.info("import:phase", {
41095
41224
  phase: "stabilizing-layout",
41096
- durationMs: Math.round((deps.now() - stabilizationStartedAt) * 100) / 100
41225
+ durationMs: roundTo(deps.now() - stabilizationStartedAt, 2)
41097
41226
  });
41098
41227
  const sections = getDocumentSectionsCanonical(document2);
41099
41228
  const canonicalBlocks = sections.reduce(
@@ -41109,7 +41238,7 @@ function createDocumentImporter(deps) {
41109
41238
  format: importer.id,
41110
41239
  blocks: canonicalBlocks,
41111
41240
  paragraphs: canonicalParagraphs,
41112
- durationMs: Math.round((deps.now() - startedAt) * 100) / 100
41241
+ durationMs: roundTo(deps.now() - startedAt, 2)
41113
41242
  });
41114
41243
  deps.focusInput();
41115
41244
  } catch (error) {
@@ -41280,7 +41409,10 @@ function patchSelectedImage(state, updater) {
41280
41409
  return cloneStateWithParagraphs(
41281
41410
  state,
41282
41411
  nextParagraphs,
41283
- preserveSelectionByParagraphOffsets(nextParagraphs, normalizeSelection(state))
41412
+ preserveSelectionByParagraphOffsets(
41413
+ nextParagraphs,
41414
+ normalizeSelection(state)
41415
+ )
41284
41416
  );
41285
41417
  }
41286
41418
  function patchSelectedImageFloating(state, next) {
@@ -42516,9 +42648,17 @@ function putItem(db, storeName, key, value) {
42516
42648
  )
42517
42649
  );
42518
42650
  };
42519
- request.onsuccess = () => {
42651
+ transaction.oncomplete = () => {
42520
42652
  resolve();
42521
42653
  };
42654
+ transaction.onabort = transaction.onerror = () => {
42655
+ var _a2;
42656
+ reject(
42657
+ new Error(
42658
+ `Transaction failed putting item in ${storeName}: ${(_a2 = transaction.error) == null ? void 0 : _a2.message}`
42659
+ )
42660
+ );
42661
+ };
42522
42662
  } catch (err) {
42523
42663
  reject(err);
42524
42664
  }
@@ -42560,9 +42700,17 @@ function deleteItem(db, storeName, key) {
42560
42700
  )
42561
42701
  );
42562
42702
  };
42563
- request.onsuccess = () => {
42703
+ transaction.oncomplete = () => {
42564
42704
  resolve();
42565
42705
  };
42706
+ transaction.onabort = transaction.onerror = () => {
42707
+ var _a2;
42708
+ reject(
42709
+ new Error(
42710
+ `Transaction failed deleting item from ${storeName}: ${(_a2 = transaction.error) == null ? void 0 : _a2.message}`
42711
+ )
42712
+ );
42713
+ };
42566
42714
  } catch (err) {
42567
42715
  reject(err);
42568
42716
  }
@@ -43585,7 +43733,12 @@ function createTableCellSpanOperations(deps) {
43585
43733
  if (!nextParagraph) {
43586
43734
  return current;
43587
43735
  }
43588
- return commitTableMutation(current, targetBlocks, range.zone, nextParagraph);
43736
+ return commitTableMutation(
43737
+ current,
43738
+ targetBlocks,
43739
+ range.zone,
43740
+ nextParagraph
43741
+ );
43589
43742
  };
43590
43743
  const mergeSelectedTableRows = (current) => {
43591
43744
  const range = deps.resolveVerticalTableCellRange(current);
@@ -43658,7 +43811,12 @@ function createTableCellSpanOperations(deps) {
43658
43811
  if (!nextParagraph) {
43659
43812
  return current;
43660
43813
  }
43661
- return commitTableMutation(current, targetBlocks, range.zone, nextParagraph);
43814
+ return commitTableMutation(
43815
+ current,
43816
+ targetBlocks,
43817
+ range.zone,
43818
+ nextParagraph
43819
+ );
43662
43820
  };
43663
43821
  const mergeSelectedTable = (current) => {
43664
43822
  if (deps.canMergeSelectedTableCells(current)) {
@@ -43726,7 +43884,12 @@ function createTableCellSpanOperations(deps) {
43726
43884
  if (!nextParagraph) {
43727
43885
  return current;
43728
43886
  }
43729
- return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
43887
+ return commitTableMutation(
43888
+ current,
43889
+ targetBlocks,
43890
+ location.zone,
43891
+ nextParagraph
43892
+ );
43730
43893
  };
43731
43894
  const splitSelectedTableCell = (current) => {
43732
43895
  var _a2;
@@ -43779,7 +43942,12 @@ function createTableCellSpanOperations(deps) {
43779
43942
  if (!nextParagraph) {
43780
43943
  return current;
43781
43944
  }
43782
- return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
43945
+ return commitTableMutation(
43946
+ current,
43947
+ targetBlocks,
43948
+ location.zone,
43949
+ nextParagraph
43950
+ );
43783
43951
  };
43784
43952
  const splitSelectedTable = (current) => {
43785
43953
  if (deps.canSplitSelectedTableCellVertically(current)) {
@@ -43870,7 +44038,12 @@ function createTableRowColumnOperations(deps) {
43870
44038
  const nextParagraph2 = (targetCell2 == null ? void 0 : targetCell2.blocks[0]) ?? ((_a2 = blankRow.cells.find(
43871
44039
  (cell) => cell.vMerge !== "continue" && cell.blocks[0]
43872
44040
  )) == null ? void 0 : _a2.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
43873
- return commitTableMutation(current, targetBlocks, location.zone, nextParagraph2);
44041
+ return commitTableMutation(
44042
+ current,
44043
+ targetBlocks,
44044
+ location.zone,
44045
+ nextParagraph2
44046
+ );
43874
44047
  }
43875
44048
  blankRow = createEditorTableRow(
43876
44049
  sourceRow.cells.map(
@@ -43894,7 +44067,12 @@ function createTableRowColumnOperations(deps) {
43894
44067
  const nextParagraph = (targetCell == null ? void 0 : targetCell.blocks[0]) ?? ((_b2 = blankRow.cells.find(
43895
44068
  (cell) => cell.vMerge !== "continue" && cell.blocks[0]
43896
44069
  )) == null ? void 0 : _b2.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
43897
- return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
44070
+ return commitTableMutation(
44071
+ current,
44072
+ targetBlocks,
44073
+ location.zone,
44074
+ nextParagraph
44075
+ );
43898
44076
  };
43899
44077
  const deleteSelectedTableRow = (current) => {
43900
44078
  const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
@@ -43955,7 +44133,12 @@ function createTableRowColumnOperations(deps) {
43955
44133
  )
43956
44134
  ) : null;
43957
44135
  const nextParagraph = (targetCell == null ? void 0 : targetCell.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
43958
- return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
44136
+ return commitTableMutation(
44137
+ current,
44138
+ targetBlocks,
44139
+ location.zone,
44140
+ nextParagraph
44141
+ );
43959
44142
  };
43960
44143
  const insertSelectedTableColumn = (current, direction) => {
43961
44144
  var _a2;
@@ -44032,7 +44215,12 @@ function createTableRowColumnOperations(deps) {
44032
44215
  const targetRow2 = tableBlock.rows[location.rowIndex];
44033
44216
  const targetCell2 = targetRow2 ? findCellAtVisualColumn(targetRow2, insertVisualColumn) : null;
44034
44217
  const nextParagraph2 = (targetCell2 == null ? void 0 : targetCell2.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
44035
- return commitTableMutation(current, targetBlocks, location.zone, nextParagraph2);
44218
+ return commitTableMutation(
44219
+ current,
44220
+ targetBlocks,
44221
+ location.zone,
44222
+ nextParagraph2
44223
+ );
44036
44224
  }
44037
44225
  const insertIndex = Math.max(
44038
44226
  0,
@@ -44056,7 +44244,12 @@ function createTableRowColumnOperations(deps) {
44056
44244
  const targetRow = tableBlock.rows[location.rowIndex];
44057
44245
  const targetCell = targetRow == null ? void 0 : targetRow.cells[insertIndex];
44058
44246
  const nextParagraph = (targetCell == null ? void 0 : targetCell.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
44059
- return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
44247
+ return commitTableMutation(
44248
+ current,
44249
+ targetBlocks,
44250
+ location.zone,
44251
+ nextParagraph
44252
+ );
44060
44253
  };
44061
44254
  const deleteSelectedTableColumn = (current) => {
44062
44255
  var _a2;
@@ -44123,7 +44316,12 @@ function createTableRowColumnOperations(deps) {
44123
44316
  )
44124
44317
  );
44125
44318
  const nextParagraph2 = (targetCell2 == null ? void 0 : targetCell2.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
44126
- return commitTableMutation(current, targetBlocks, location.zone, nextParagraph2);
44319
+ return commitTableMutation(
44320
+ current,
44321
+ targetBlocks,
44322
+ location.zone,
44323
+ nextParagraph2
44324
+ );
44127
44325
  }
44128
44326
  if (((_a2 = tableBlock.rows[0]) == null ? void 0 : _a2.cells.length) <= 1) {
44129
44327
  return current;
@@ -44134,7 +44332,12 @@ function createTableRowColumnOperations(deps) {
44134
44332
  const targetRow = tableBlock.rows[location.rowIndex];
44135
44333
  const targetCell = targetRow == null ? void 0 : targetRow.cells[Math.min(location.cellIndex, targetRow.cells.length - 1)];
44136
44334
  const nextParagraph = (targetCell == null ? void 0 : targetCell.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
44137
- return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
44335
+ return commitTableMutation(
44336
+ current,
44337
+ targetBlocks,
44338
+ location.zone,
44339
+ nextParagraph
44340
+ );
44138
44341
  };
44139
44342
  return {
44140
44343
  insertSelectedTableRow,
@@ -45100,7 +45303,7 @@ function scoreRectDistance(left, top, width, height, clientX, clientY) {
45100
45303
  const bottom = top + height;
45101
45304
  const verticalDelta = clientY < top ? top - clientY : clientY > bottom ? clientY - bottom : 0;
45102
45305
  const horizontalDelta = clientX < left ? left - clientX : clientX > right ? clientX - right : 0;
45103
- return verticalDelta * 1e3 + horizontalDelta;
45306
+ return verticalDelta * VERTICAL_HIT_WEIGHT + horizontalDelta;
45104
45307
  }
45105
45308
  function resolveZoneFromPage(page, clientY) {
45106
45309
  const localY = clientY - page.top;
@@ -45143,7 +45346,7 @@ function resolveClosestOffsetInLine(line, clientX, clientY) {
45143
45346
  for (const slot of line.slots) {
45144
45347
  const verticalDelta = clientY < slot.top ? slot.top - clientY : clientY > slot.top + slot.height ? clientY - (slot.top + slot.height) : 0;
45145
45348
  const horizontalDelta = Math.abs(clientX - slot.left);
45146
- const score = verticalDelta * 1e3 + horizontalDelta;
45349
+ const score = verticalDelta * VERTICAL_HIT_WEIGHT + horizontalDelta;
45147
45350
  if (score < bestScore) {
45148
45351
  bestScore = score;
45149
45352
  bestOffset = slot.offset;
@@ -46556,11 +46759,10 @@ function createEditorTableDrag(deps) {
46556
46759
  const table = findTable();
46557
46760
  if ((table == null ? void 0 : table.type) === "table" && ((_a2 = table.style) == null ? void 0 : _a2.floating)) {
46558
46761
  const floating = table.style.floating;
46559
- const pointsPerPixel = 72 / 96;
46560
46762
  return setActiveTableStyleValue(current, tableId, "floating", {
46561
46763
  ...floating,
46562
- x: (floating.x ?? 0) + (event.clientX - startClientX()) * pointsPerPixel,
46563
- y: (floating.y ?? 0) + (event.clientY - startClientY()) * pointsPerPixel,
46764
+ x: (floating.x ?? 0) + (event.clientX - startClientX()) * PT_PER_PX,
46765
+ y: (floating.y ?? 0) + (event.clientY - startClientY()) * PT_PER_PX,
46564
46766
  xAlign: void 0,
46565
46767
  yAlign: void 0
46566
46768
  });
@@ -46865,7 +47067,10 @@ function createEditorSurfaceEvents(deps) {
46865
47067
  hit.zone,
46866
47068
  {
46867
47069
  ...state,
46868
- selection: { anchor: { ...hit.position }, focus: { ...hit.position } }
47070
+ selection: {
47071
+ anchor: { ...hit.position },
47072
+ focus: { ...hit.position }
47073
+ }
46869
47074
  },
46870
47075
  hit.position
46871
47076
  );
@@ -46885,9 +47090,20 @@ function createEditorSurfaceEvents(deps) {
46885
47090
  return;
46886
47091
  }
46887
47092
  dragAnchor = null;
46888
- const start = paragraphOffsetToPosition(textBoxParagraph, hit.textBox.startOffset);
46889
- const end = paragraphOffsetToPosition(textBoxParagraph, hit.textBox.endOffset);
46890
- applyWithZone(state, hit.zone, setSelection(state, { anchor: start, focus: end }), start);
47093
+ const start = paragraphOffsetToPosition(
47094
+ textBoxParagraph,
47095
+ hit.textBox.startOffset
47096
+ );
47097
+ const end = paragraphOffsetToPosition(
47098
+ textBoxParagraph,
47099
+ hit.textBox.endOffset
47100
+ );
47101
+ applyWithZone(
47102
+ state,
47103
+ hit.zone,
47104
+ setSelection(state, { anchor: start, focus: end }),
47105
+ start
47106
+ );
46891
47107
  stopDragging();
46892
47108
  deps.focusInputAfterPointerSelection();
46893
47109
  };
@@ -46901,9 +47117,17 @@ function createEditorSurfaceEvents(deps) {
46901
47117
  return;
46902
47118
  }
46903
47119
  dragAnchor = null;
46904
- const start = paragraphOffsetToPosition(imageParagraph, hit.image.startOffset);
47120
+ const start = paragraphOffsetToPosition(
47121
+ imageParagraph,
47122
+ hit.image.startOffset
47123
+ );
46905
47124
  const end = paragraphOffsetToPosition(imageParagraph, hit.image.endOffset);
46906
- applyWithZone(state, hit.zone, setSelection(state, { anchor: start, focus: end }), start);
47125
+ applyWithZone(
47126
+ state,
47127
+ hit.zone,
47128
+ setSelection(state, { anchor: start, focus: end }),
47129
+ start
47130
+ );
46907
47131
  stopDragging();
46908
47132
  deps.imageOps.startImageDrag(
46909
47133
  hit.image.paragraphId,
@@ -46923,7 +47147,10 @@ function createEditorSurfaceEvents(deps) {
46923
47147
  applyWithZone(
46924
47148
  state,
46925
47149
  hit.zone,
46926
- setSelection(state, { anchor: state.selection.anchor, focus: hit.position }),
47150
+ setSelection(state, {
47151
+ anchor: state.selection.anchor,
47152
+ focus: hit.position
47153
+ }),
46927
47154
  hit.position
46928
47155
  );
46929
47156
  window.addEventListener("mousemove", handleWindowMouseMove);
@@ -46944,7 +47171,10 @@ function createEditorSurfaceEvents(deps) {
46944
47171
  };
46945
47172
  const handleDoubleClickDown = (state, hit, paragraph) => {
46946
47173
  dragAnchor = null;
46947
- const word = resolveWordSelection(getParagraphText(paragraph), hit.paragraphOffset);
47174
+ const word = resolveWordSelection(
47175
+ getParagraphText(paragraph),
47176
+ hit.paragraphOffset
47177
+ );
46948
47178
  const startPos = paragraphOffsetToPosition(paragraph, word.start);
46949
47179
  const endPos = paragraphOffsetToPosition(paragraph, word.end);
46950
47180
  applyWithZone(
@@ -49699,7 +49929,7 @@ function buildEntryParagraph(heading, pageNumber, rightTabPositionPt) {
49699
49929
  function rightTabPositionForSection(section) {
49700
49930
  const { width, margins } = section.pageSettings;
49701
49931
  const contentWidthPx = Math.max(0, width - margins.left - margins.right);
49702
- return Math.round(contentWidthPx * PT_PER_PX * 100) / 100;
49932
+ return roundTo(contentWidthPx * PT_PER_PX, 2);
49703
49933
  }
49704
49934
  function buildStartMarkerParagraph() {
49705
49935
  return makeParagraph([
@@ -51612,11 +51842,8 @@ function OasisEditorApp(props = {}) {
51612
51842
  canvasSnapshotProvider
51613
51843
  });
51614
51844
  const {
51615
- selectedImageRun,
51616
51845
  layoutOptionsOverlay,
51617
51846
  fr,
51618
- resolveSurfaceHitAtPoint,
51619
- resolvePositionAtSurfacePoint,
51620
51847
  tableOps,
51621
51848
  imageOps,
51622
51849
  textBoxOps,
@@ -51628,7 +51855,6 @@ function OasisEditorApp(props = {}) {
51628
51855
  textDrag,
51629
51856
  surfaceEventsWithTextDrag,
51630
51857
  textInput,
51631
- navigation,
51632
51858
  handleCopy,
51633
51859
  handleCut,
51634
51860
  handlePaste,