@betteroffice/docx 0.0.4 → 0.2.0

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 (70) hide show
  1. package/README.md +4 -7
  2. package/dist/chunk-47Q2FMFF.mjs +1 -0
  3. package/dist/chunk-5F6DLQZP.mjs +1 -0
  4. package/dist/chunk-6LQJAKOC.mjs +1 -0
  5. package/dist/chunk-ACGKK7IB.mjs +1 -0
  6. package/dist/{chunk-NTSSE5QK.mjs → chunk-AFMVSI4Z.mjs} +2 -2
  7. package/dist/chunk-GD4VNJ64.mjs +1 -0
  8. package/dist/{chunk-NJHOPXZW.mjs → chunk-HLDJMU3R.mjs} +1 -1
  9. package/dist/{chunk-YTILOUAA.mjs → chunk-JHJLG4I6.mjs} +1 -1
  10. package/dist/chunk-PGMXWI5X.mjs +1 -0
  11. package/dist/{chunk-NBSLB77E.mjs → chunk-WTFRNX5K.mjs} +1 -1
  12. package/dist/collaboration/index.d.mts +6 -6
  13. package/dist/{content-C3sTRz-u.d.mts → content-CvEtPl0c.d.mts} +124 -22
  14. package/dist/core.d.mts +8 -8
  15. package/dist/core.mjs +1 -1
  16. package/dist/{displayListQueries-DLzpvJV6.d.mts → displayListQueries-DF8F6fMl.d.mts} +87 -50
  17. package/dist/docx/index.d.mts +5 -5
  18. package/dist/docx/index.mjs +1 -1
  19. package/dist/editor/index.d.mts +21 -12
  20. package/dist/editor/index.mjs +1 -1
  21. package/dist/{fontLoader-CMH3bZ2Z.d.mts → fontLoader-b8eicJKV.d.mts} +1 -1
  22. package/dist/{formatting-BEkIBePP.d.mts → formatting-7zKCTu5a.d.mts} +11 -2
  23. package/dist/{frameDelta-B2kC6XiP.d.mts → frameDelta-pA4jrQ1G.d.mts} +16 -10
  24. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  25. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  26. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  27. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  28. package/dist/{index-2piKi4gO.d.mts → index-CHl2zLJ7.d.mts} +146 -77
  29. package/dist/layout/index.d.mts +40 -13
  30. package/dist/layout/index.mjs +1 -1
  31. package/dist/layout/pagination/index.d.mts +4 -4
  32. package/dist/layout/pagination/index.mjs +1 -1
  33. package/dist/layout/render/index.d.mts +33 -77
  34. package/dist/layout/render/index.mjs +1 -1
  35. package/dist/plugin-api/RenderedDomContext.d.mts +7 -7
  36. package/dist/plugin-api/index.d.mts +3 -3
  37. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  38. package/dist/{rustDisplayList-B0M2eBkU.d.mts → rustDisplayList-BJqaN9tt.d.mts} +74 -50
  39. package/dist/{rustMeasureSource-D1KsQvVC.d.mts → rustMeasureSource-C0EZB055.d.mts} +5 -2
  40. package/dist/{selectiveSave-CVoajSKE.d.mts → selectiveSave-CRh-_Y_C.d.mts} +3 -3
  41. package/dist/styles/index.d.mts +6 -10
  42. package/dist/styles/index.mjs +1 -1
  43. package/dist/{styles-BK3Jecxs.d.mts → styles-7e-mq3c-.d.mts} +1 -1
  44. package/dist/types/content.d.mts +2 -2
  45. package/dist/types/document.d.mts +8 -7
  46. package/dist/{types-C1rv3KM-.d.mts → types-C4A8mWjU.d.mts} +44 -24
  47. package/dist/utils/comments.d.mts +2 -2
  48. package/dist/utils/index.d.mts +11 -13
  49. package/dist/utils/index.mjs +1 -1
  50. package/dist/utils/stylePreview.d.mts +2 -2
  51. package/dist/wasm-7SOSHNGP.mjs +1 -0
  52. package/dist/{wasm-JE7B3ROD.mjs → wasm-ZQAVP7P2.mjs} +1 -1
  53. package/dist/wasm-edit.d.mts +525 -185
  54. package/dist/wasm-edit.mjs +1 -1
  55. package/dist/wasm-layout.d.mts +31 -28
  56. package/dist/wasm-layout.mjs +1 -1
  57. package/dist/wasm-opc.mjs +1 -1
  58. package/dist/wasm-parse.d.mts +2 -1
  59. package/dist/wasm-parse.mjs +1 -1
  60. package/dist/yrs/index.d.mts +5 -5
  61. package/dist/yrs/index.mjs +1 -1
  62. package/dist/yrs/residentEngineWorker.mjs +1 -1
  63. package/package.json +19 -2
  64. package/dist/chunk-4V6MDZIK.mjs +0 -1
  65. package/dist/chunk-6KDV6AIL.mjs +0 -1
  66. package/dist/chunk-B4IR6YP4.mjs +0 -1
  67. package/dist/chunk-GGEGIQRK.mjs +0 -1
  68. package/dist/chunk-T4EZMUXM.mjs +0 -1
  69. package/dist/chunk-WBH3SXI6.mjs +0 -1
  70. package/dist/wasm-F2ETFAYL.mjs +0 -1
@@ -1,14 +1,14 @@
1
- import { a as SdtControlState, b as SdtProperties, R as RevisionInfo, C as CellMarker, D as DrawingScene, c as ShapeEffect, d as ShapeTextBodyProperties, e as Chart, W as Watermark, F as FootnoteProperties, E as EndnoteProperties } from './content-C3sTRz-u.mjs';
2
- import { T as TextModernEffects, P as PresetGeometryPathCommand, B as BorderSpec } from './formatting-BEkIBePP.mjs';
1
+ import { S as SdtControlState, a as SdtProperties, R as RevisionInfo, C as CellMarker, D as DrawingScene, b as ShapeEffect, c as ShapeTextBodyProperties, d as Chart, W as Watermark, F as FootnoteProperties, E as EndnoteProperties } from './content-CvEtPl0c.mjs';
2
+ import { T as TextModernEffects, P as PresetGeometryPathCommand, B as BorderSpec } from './formatting-7zKCTu5a.mjs';
3
3
 
4
4
  /**
5
5
  * Inline SDT widget metadata carried by a painted text run.
6
6
  */
7
7
  interface InlineSdtWidget {
8
8
  kind: 'checkbox';
9
- /** Stable per-document id derived from the ProseMirror node position. */
9
+ /** Stable per-document id derived from the node position. */
10
10
  groupId: string;
11
- /** ProseMirror position of the inline SDT node. */
11
+ /** Document position of the inline SDT node. */
12
12
  pos: number;
13
13
  /** Word tag value (`w:tag`). */
14
14
  tag?: string;
@@ -20,7 +20,7 @@ interface InlineSdtWidget {
20
20
  /**
21
21
  * One run's visible slice on a laid-out line: the run to render/measure plus
22
22
  * its on-line text. For a boundary text run this is a shallow copy sliced to
23
- * the line's head/tail char (PM positions shifted to match); tabs, images,
23
+ * the line's head/tail char (document positions shifted to match); tabs, images,
24
24
  * line breaks, and fields pass through whole with an empty `text`. `text` is
25
25
  * the run's textual contribution to the line (empty for non-text runs), so
26
26
  * joining a line's segment texts reconstructs the line's visible characters.
@@ -195,9 +195,9 @@ type TextRun = RunFormatting & {
195
195
  text: string;
196
196
  /** Hyperlink information if this run is a link. */
197
197
  hyperlink?: HyperlinkInfo;
198
- /** PM doc offset where the run's text begins. */
198
+ /** Document offset where the run's text begins. */
199
199
  pmStart?: number;
200
- /** PM doc offset one past the run's final character. */
200
+ /** Document offset one past the run's final character. */
201
201
  pmEnd?: number;
202
202
  /** Inline content-control widget metadata when this run is the visible glyph. */
203
203
  inlineSdtWidget?: InlineSdtWidget;
@@ -252,6 +252,7 @@ type ImageRun = {
252
252
  width: number;
253
253
  height: number;
254
254
  alt?: string;
255
+ shapeType?: string;
255
256
  /** CSS transform string (rotation, flip) */
256
257
  transform?: string;
257
258
  /** Position for floating/anchored images */
@@ -364,6 +365,8 @@ type FieldRun = RunFormatting & {
364
365
  type Run = TextRun | TabRun | ImageRun | LineBreakRun | FieldRun;
365
366
  /** Paragraph spacing (w:spacing): above/below plus the w:lineRule line rule. */
366
367
  type ParagraphSpacing = {
368
+ beforeLines?: number;
369
+ afterLines?: number;
367
370
  before?: number;
368
371
  after?: number;
369
372
  line?: number;
@@ -432,8 +435,11 @@ type ParagraphAttrs = {
432
435
  indent?: ParagraphIndent;
433
436
  keepNext?: boolean;
434
437
  keepLines?: boolean;
438
+ /** w:widowControl, a toggle defaulting on: only an authored off is carried. */
439
+ widowControl?: boolean;
435
440
  pageBreakBefore?: boolean;
436
441
  styleId?: string;
442
+ effectiveStyleId?: string;
437
443
  contextualSpacing?: boolean;
438
444
  /** Right-to-left paragraph direction */
439
445
  bidi?: boolean;
@@ -446,6 +452,9 @@ type ParagraphAttrs = {
446
452
  listMarkerHidden?: boolean;
447
453
  listMarkerFontFamily?: string;
448
454
  listMarkerFontSize?: number;
455
+ listMarkerBold?: boolean;
456
+ listMarkerItalic?: boolean;
457
+ listMarkerColor?: string;
449
458
  listMarkerSuffix?: 'tab' | 'space' | 'nothing';
450
459
  /**
451
460
  * Tracked-change state of the list numbering itself. When a list is applied
@@ -484,13 +493,13 @@ type ParagraphBlock = {
484
493
  sdtGroups?: SdtGroup[];
485
494
  kind: 'paragraph';
486
495
  id: BlockId;
487
- /** Stable Word `w14:paraId` / PM `paraId`, when available. */
496
+ /** Stable Word `w14:paraId`, when available. */
488
497
  paraId?: string;
489
498
  runs: Run[];
490
499
  attrs?: ParagraphAttrs;
491
- /** ProseMirror start position for this block. */
500
+ /** Document start position for this block. */
492
501
  pmStart?: number;
493
- /** ProseMirror end position for this block. */
502
+ /** Document end position for this block. */
494
503
  pmEnd?: number;
495
504
  };
496
505
  /**
@@ -661,6 +670,7 @@ type ImageBlock = {
661
670
  width: number;
662
671
  height: number;
663
672
  alt?: string;
673
+ shapeType?: string;
664
674
  /** CSS transform string (rotation, flip) */
665
675
  transform?: string;
666
676
  opacity?: number;
@@ -818,6 +828,12 @@ type ShapeBlock = {
818
828
  effects?: ShapeEffect[];
819
829
  /** Full text-body/autofit settings. */
820
830
  textBodyProperties?: ShapeTextBodyProperties;
831
+ wrapDistances?: {
832
+ top: number;
833
+ right: number;
834
+ bottom: number;
835
+ left: number;
836
+ };
821
837
  /** Anchor/wrap metadata. Undefined = in-flow. */
822
838
  position?: ImageRunPosition;
823
839
  wrapType?: string;
@@ -827,7 +843,7 @@ type ShapeBlock = {
827
843
  decorative?: boolean;
828
844
  title?: string;
829
845
  description?: string;
830
- /** PM/doc positions for selection mapping. */
846
+ /** Document positions for selection mapping. */
831
847
  docStart?: number;
832
848
  docEnd?: number;
833
849
  pmStart?: number;
@@ -952,9 +968,9 @@ type TextBoxBlock = {
952
968
  };
953
969
  /** Paragraph blocks inside the text box */
954
970
  content: ParagraphBlock[];
955
- /** Display mode copied from the ProseMirror text box node */
971
+ /** Display mode copied from the text box node */
956
972
  displayMode?: 'inline' | 'float' | 'block';
957
- /** CSS float direction copied from the ProseMirror text box node */
973
+ /** CSS float direction copied from the text box node */
958
974
  cssFloat?: 'left' | 'right' | 'none';
959
975
  /** OOXML wrap type for anchored text boxes */
960
976
  wrapType?: string;
@@ -986,9 +1002,9 @@ interface SdtGroup {
986
1002
  checked?: boolean;
987
1003
  bound?: boolean;
988
1004
  repeatingItem?: boolean;
989
- /** Authored numeric `w:id`; undefined = address by `id`/PM position. */
1005
+ /** Authored numeric `w:id`; undefined = address by `id`/position. */
990
1006
  controlId?: number;
991
- /** Stable PM position for untagged controls. */
1007
+ /** Stable document position for untagged controls. */
992
1008
  pos?: number;
993
1009
  /** Typed overlay state. Undefined = derive from content. */
994
1010
  controlState?: SdtControlState;
@@ -1035,6 +1051,8 @@ type TypesetRow = {
1035
1051
  descent: number;
1036
1052
  /** Total line height in pixels. */
1037
1053
  lineHeight: number;
1054
+ /** Deterministic line geometry produced without a measurement face. */
1055
+ syntheticFallback?: boolean;
1038
1056
  /** Left offset from floating images (pixels from content left edge). */
1039
1057
  leftOffset?: number;
1040
1058
  /** Right offset from floating images (pixels from content right edge). */
@@ -1177,7 +1195,7 @@ type TextBoxExtent = {
1177
1195
  type BlockExtent = ParagraphExtent | ImageExtent | ShapeExtent | ChartExtent | TableExtent | TextBoxExtent | SectionBreakExtent | PageBreakExtent | ColumnBreakExtent;
1178
1196
  /**
1179
1197
  * Fields every fragment carries: which block it came from, where it sits on
1180
- * its page, and the PM span it maps to.
1198
+ * its page, and the document span it maps to.
1181
1199
  */
1182
1200
  type FragmentBase = {
1183
1201
  /** Block ID this fragment belongs to. */
@@ -1188,9 +1206,9 @@ type FragmentBase = {
1188
1206
  y: number;
1189
1207
  /** Width of the fragment. */
1190
1208
  width: number;
1191
- /** ProseMirror start position (for click mapping). */
1209
+ /** Document start position (for click mapping). */
1192
1210
  pmStart?: number;
1193
- /** ProseMirror end position (for click mapping). */
1211
+ /** Document end position (for click mapping). */
1194
1212
  pmEnd?: number;
1195
1213
  };
1196
1214
  /**
@@ -1274,7 +1292,7 @@ type ShapeFragment = FragmentBase & {
1274
1292
  kind: 'shape';
1275
1293
  /** Height of the shape bbox. */
1276
1294
  height: number;
1277
- /** PM/doc positions for display-list consumers that use docStart/docEnd names. */
1295
+ /** Document positions for display-list consumers that use docStart/docEnd names. */
1278
1296
  docStart?: number;
1279
1297
  docEnd?: number;
1280
1298
  /** True when positioned outside normal flow. */
@@ -1434,6 +1452,8 @@ type Page = {
1434
1452
  noteAreas?: NoteAreaContract[];
1435
1453
  /** Column layout for this page (if multi-column). */
1436
1454
  columns?: ColumnLayout;
1455
+ /** Automatic parity filler: suppress header/footer, keep physical page. */
1456
+ parityFiller?: boolean;
1437
1457
  };
1438
1458
  /**
1439
1459
  * Multi-column setup for a section (w:cols).
@@ -1547,7 +1567,7 @@ type LayoutOptions = {
1547
1567
  /** Per-page footnote reserved heights (pageNumber → height in pixels). */
1548
1568
  footnoteReservedHeights?: Map<number, number>;
1549
1569
  /** Section break type for the body-level (final) section (for section transition logic). */
1550
- bodyBreakType?: 'continuous' | 'nextPage' | 'evenPage' | 'oddPage';
1570
+ bodyBreakType?: 'continuous' | 'nextPage' | 'evenPage' | 'oddPage' | 'nextColumn';
1551
1571
  /** Effective section states, indexed by section. Undefined = legacy globals. */
1552
1572
  sections?: Array<{
1553
1573
  sectionId?: string;
@@ -1579,8 +1599,8 @@ type HitTestResult = {
1579
1599
  localY?: number;
1580
1600
  };
1581
1601
  /**
1582
- * A location expressed in block/run/character terms, with the matching PM
1583
- * position when known.
1602
+ * A location expressed in block/run/character terms, with the matching
1603
+ * document position when known.
1584
1604
  */
1585
1605
  type DocumentPosition = {
1586
1606
  /** Block index. */
@@ -1589,7 +1609,7 @@ type DocumentPosition = {
1589
1609
  runIndex?: number;
1590
1610
  /** Character offset within the run. */
1591
1611
  charOffset?: number;
1592
- /** ProseMirror position. */
1612
+ /** Document position. */
1593
1613
  pmPos?: number;
1594
1614
  };
1595
1615
  /**
@@ -1683,4 +1703,4 @@ interface FootnoteRenderItem {
1683
1703
  content?: FootnoteContent;
1684
1704
  }
1685
1705
 
1686
- export { type ParagraphExtent as $, type AnchoredObjectPositionInput as A, type BlockExtent as B, type CellBorderSpec as C, DEFAULT_TEXTBOX_MARGINS as D, type ImageRunPosition as E, type FootnoteContent as F, type InlineSdtWidget as G, type HeaderFooterContent as H, type ImageBlock as I, type LineBreakRun as J, type ListNumPr as K, type LayoutBlock as L, type NoteLayoutItem as M, type NoteAreaContract as N, type NoteSettingsContract as O, type Page as P, type PageBorderContract as Q, type ResolvedLine as R, type PageBreakBlock as S, type PageBreakExtent as T, type PageGeometry as U, type PageHeaderFooterRefs as V, type PageMargins as W, type PageNumberingContract as X, type ParagraphAttrs as Y, type ParagraphBlock as Z, type ParagraphBorders as _, type Layout as a, type ParagraphFragment as a0, type ParagraphIndent as a1, type ParagraphSpacing as a2, type Run as a3, type RunFontSlots as a4, type RunFormatting as a5, type RunLanguageSlots as a6, type SdtGroup as a7, type SectionBreakBlock as a8, type SectionBreakExtent as a9, assertExhaustiveLayoutBlock as aA, isTextWrappingFloatingImageRun as aB, pageGeometryFromPage as aC, resolveAnchoredObjectVerticalTop as aD, type ShapeBlock as aa, type ShapeBlockFill as ab, type ShapeBlockStroke as ac, type ShapeBlockTransform as ad, type ShapeExtent as ae, type ShapeFragment as af, type TabAlignment as ag, type TabRun as ah, type TabStop as ai, type TableBlock as aj, type TableCell as ak, type TableCellExtent as al, type TableExtent as am, type TableFragment as an, type TableRow as ao, type TableRowExtent as ap, type TextBoxBlock as aq, type TextBoxExtent as ar, type TextBoxFragment as as, type TextRun as at, type TypesetBidiSlice as au, type TypesetClusterAdvance as av, type TypesetRow as aw, type TypesetRowSegment as ax, type TypesetRunAdvance as ay, type WrapTextDirection as az, type LayoutOptions as b, type ResolvedSegment as c, type BlockId as d, type BorderStyle as e, type CellBorders as f, type ChartBlock as g, type ChartExtent as h, type ChartFragment as i, type ColumnBreakBlock as j, type ColumnBreakExtent as k, type ColumnLayout as l, DEFAULT_TEXTBOX_WIDTH as m, type DocumentPosition as n, type FieldRun as o, type FloatingTablePosition as p, type FootnoteRenderItem as q, type Fragment as r, type FragmentBase as s, type HeaderFooterContentHeights as t, type HeaderFooterLayout as u, type HitTestResult as v, type HyperlinkInfo as w, type ImageExtent as x, type ImageFragment as y, type ImageRun as z };
1706
+ export { type ParagraphExtent as $, type AnchoredObjectPositionInput as A, type BlockExtent as B, type CellBorderSpec as C, DEFAULT_TEXTBOX_MARGINS as D, type ImageRunPosition as E, type FootnoteContent as F, type InlineSdtWidget as G, type HeaderFooterContent as H, type ImageBlock as I, type LineBreakRun as J, type ListNumPr as K, type Layout as L, type NoteLayoutItem as M, type NoteAreaContract as N, type NoteSettingsContract as O, type Page as P, type PageBorderContract as Q, type ResolvedLine as R, type PageBreakBlock as S, type PageBreakExtent as T, type PageGeometry as U, type PageHeaderFooterRefs as V, type PageMargins as W, type PageNumberingContract as X, type ParagraphAttrs as Y, type ParagraphBlock as Z, type ParagraphBorders as _, type LayoutOptions as a, type ParagraphFragment as a0, type ParagraphIndent as a1, type ParagraphSpacing as a2, type Run as a3, type RunFontSlots as a4, type RunFormatting as a5, type RunLanguageSlots as a6, type SdtGroup as a7, type SectionBreakBlock as a8, type SectionBreakExtent as a9, assertExhaustiveLayoutBlock as aA, isTextWrappingFloatingImageRun as aB, pageGeometryFromPage as aC, resolveAnchoredObjectVerticalTop as aD, type ShapeBlock as aa, type ShapeBlockFill as ab, type ShapeBlockStroke as ac, type ShapeBlockTransform as ad, type ShapeExtent as ae, type ShapeFragment as af, type TabAlignment as ag, type TabRun as ah, type TabStop as ai, type TableBlock as aj, type TableCell as ak, type TableCellExtent as al, type TableExtent as am, type TableFragment as an, type TableRow as ao, type TableRowExtent as ap, type TextBoxBlock as aq, type TextBoxExtent as ar, type TextBoxFragment as as, type TextRun as at, type TypesetBidiSlice as au, type TypesetClusterAdvance as av, type TypesetRow as aw, type TypesetRowSegment as ax, type TypesetRunAdvance as ay, type WrapTextDirection as az, type LayoutBlock as b, type ResolvedSegment as c, type BlockId as d, type BorderStyle as e, type CellBorders as f, type ChartBlock as g, type ChartExtent as h, type ChartFragment as i, type ColumnBreakBlock as j, type ColumnBreakExtent as k, type ColumnLayout as l, DEFAULT_TEXTBOX_WIDTH as m, type DocumentPosition as n, type FieldRun as o, type FloatingTablePosition as p, type FootnoteRenderItem as q, type Fragment as r, type FragmentBase as s, type HeaderFooterContentHeights as t, type HeaderFooterLayout as u, type HitTestResult as v, type HyperlinkInfo as w, type ImageExtent as x, type ImageFragment as y, type ImageRun as z };
@@ -1,5 +1,5 @@
1
- import { P as Paragraph, B as BlockContent, f as Comment } from '../content-C3sTRz-u.mjs';
2
- import '../formatting-BEkIBePP.mjs';
1
+ import { P as Paragraph, B as BlockContent, e as Comment } from '../content-CvEtPl0c.mjs';
2
+ import '../formatting-7zKCTu5a.mjs';
3
3
  import '../docx/wrapTypes.mjs';
4
4
 
5
5
  /**
@@ -1,12 +1,12 @@
1
1
  export { PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels } from './units.mjs';
2
- export { F as FONT_MAPPING, C as FontDefinition, T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, D as extractFontsFromDocument, h as generateThemeTintShadeMatrix, i as getContrastingColor, E as getGoogleFontEquivalent, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, o as isGoogleFontsEnabled, n as isLoading, p as isWhite, q as lightenColor, G as loadDocumentFonts, r as loadFont, H as loadFontDefinitions, s as loadFontFromBuffer, I as loadFontFromUrl, J as loadFontWithMapping, t as loadFonts, K as loadFontsWithMapping, L as onFontError, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, M as resolveColorToHex, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from '../fontLoader-CMH3bZ2Z.mjs';
2
+ export { F as FONT_MAPPING, C as FontDefinition, T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, D as extractFontsFromDocument, h as generateThemeTintShadeMatrix, i as getContrastingColor, E as getGoogleFontEquivalent, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, o as isGoogleFontsEnabled, n as isLoading, p as isWhite, q as lightenColor, G as loadDocumentFonts, r as loadFont, H as loadFontDefinitions, s as loadFontFromBuffer, I as loadFontFromUrl, J as loadFontWithMapping, t as loadFonts, K as loadFontsWithMapping, L as onFontError, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, M as resolveColorToHex, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from '../fontLoader-b8eicJKV.mjs';
3
3
  export { D as DocxInput, t as toArrayBuffer } from '../docxInput-DTbCa48g.mjs';
4
- import { F as FontTable } from '../styles-BK3Jecxs.mjs';
4
+ import { F as FontTable } from '../styles-7e-mq3c-.mjs';
5
5
  import { Document } from '../types/document.mjs';
6
6
  import { FontOption } from './fontOptions.mjs';
7
7
  export { MIN_CARD_GAP, SIDEBAR_DOCUMENT_SHIFT, SIDEBAR_PAGE_GAP, SIDEBAR_WIDTH } from './sidebarConstants.mjs';
8
- import { f as Comment } from '../content-C3sTRz-u.mjs';
9
- import '../formatting-BEkIBePP.mjs';
8
+ import { e as Comment } from '../content-CvEtPl0c.mjs';
9
+ import '../formatting-7zKCTu5a.mjs';
10
10
  import '../docx/wrapTypes.mjs';
11
11
 
12
12
  /**
@@ -95,7 +95,7 @@ declare function getEmbeddedFontFaces(fontTable: FontTable | undefined, rawFonts
95
95
  * buffer, or the parts cannot be resolved. The zip pass goes through the
96
96
  * hardened `unzipDocx` container facade.
97
97
  *
98
- * Used by the experimental Rust measurement source, which needs the byte
98
+ * Used by measurement, which needs the byte
99
99
  * form of every embedded face for the wasm FontStore.
100
100
  *
101
101
  * @public
@@ -199,11 +199,11 @@ interface HeadingInfo {
199
199
  text: string;
200
200
  /** Outline level (0 = Heading 1, 1 = Heading 2, etc.) */
201
201
  level: number;
202
- /** ProseMirror document position of the paragraph node */
202
+ /** Document position of the paragraph node */
203
203
  pmPos: number;
204
204
  }
205
205
  /**
206
- * Collect all headings from a ProseMirror document.
206
+ * Collect all headings from a document.
207
207
  *
208
208
  * Detection logic:
209
209
  * 1. Check `outlineLevel` attr (set by OOXML parsing or style resolution)
@@ -276,12 +276,11 @@ declare function flashParagraphFragmentsByParaId(root: ParentNode, paraId: strin
276
276
  *
277
277
  * This module contains the pure layout computation for splitting a table cell:
278
278
  * column width redistribution, neighbor span adjustment, and new-cell placement.
279
- * Both the ProseMirror path (tableSplit.ts) and the Document-model path
280
- * (TableToolbar.tsx) delegate to these functions.
279
+ * The Document-model path (TableToolbar.tsx) delegates to these functions.
281
280
  */
282
281
  /** A cell's position and span within the logical grid. */
283
282
  interface CellAnchor<T> {
284
- /** Opaque payload — the caller's cell type (PMNode, TableCell, etc.) */
283
+ /** Opaque payload — the caller's cell type (TableCell, etc.) */
285
284
  data: T;
286
285
  row: number;
287
286
  col: number;
@@ -317,9 +316,8 @@ declare function redistributeColumnWidths(existing: number[], startCol: number,
317
316
  /**
318
317
  * Compute the new anchor layout after splitting a target cell.
319
318
  *
320
- * This is the core algorithm shared between ProseMirror and Document-model
321
- * paths. It adjusts neighbor spans, shifts positions for inserted rows/cols,
322
- * and creates placeholder anchors for the new split cells.
319
+ * This is the core algorithm. It adjusts neighbor spans, shifts positions for
320
+ * inserted rows/cols, and creates placeholder anchors for the new split cells.
323
321
  *
324
322
  * @param anchors All cell anchors in the current table.
325
323
  * @param target The anchor being split.
@@ -1 +1 @@
1
- export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,b as resolveColorToHex,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'../chunk-LTVVQMHB.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-CTBUQRYQ.mjs';import {n,d}from'../chunk-YTILOUAA.mjs';export{r as FONT_MAPPING,n as canRenderFont,c as deobfuscateFont,A as extractEmbeddedFontFaces,w as extractFontsFromDocument,z as getEmbeddedFontFaces,y as getEmbeddedFontFamilies,s as getGoogleFontEquivalent,k as getLoadedFonts,g as isFontLoaded,i as isGoogleFontsEnabled,j as isLoading,b as isValidFontKey,x as loadDocumentFonts,B as loadEmbeddedFonts,e as loadFont,q as loadFontDefinitions,o as loadFontFromBuffer,p as loadFontFromUrl,t as loadFontWithMapping,f as loadFonts,u as loadFontsWithMapping,m as onFontError,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-YTILOUAA.mjs';import'../chunk-6KDV6AIL.mjs';import'../chunk-NJHOPXZW.mjs';import'../chunk-B4IR6YP4.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';function H(e){let t=new Set,o=e.package;if(o.theme&&nt(o.theme,t),o.styles&&rt(o.styles,t),o.document)for(let n of o.document.content)T(n,t);if(o.headers)for(let n of o.headers.values())O(n,t);if(o.footers)for(let n of o.footers.values())O(n,t);if(o.footnotes)for(let n of o.footnotes)ut(n,t);if(o.endnotes)for(let n of o.endnotes)mt(n,t);return Array.from(t).sort()}function nt(e,t){let o=e.fontScheme;o&&(o.majorFont&&_(o.majorFont,t),o.minorFont&&_(o.minorFont,t));}function _(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function rt(e,t){e.docDefaults&&(e.docDefaults.rPr&&h(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&h(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&h(o.rPr,t),o.pPr?.runProperties&&h(o.pPr.runProperties,t);}function h(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function at(e,t){e.runProperties&&h(e.runProperties,t);}function T(e,t){e.type==="paragraph"?st(e,t):e.type==="table"&&ct(e,t);}function st(e,t){e.formatting&&at(e.formatting,t);for(let o of e.content)it(o,t);}function it(e,t){if(e.type==="run")b(e,t);else if(e.type==="hyperlink")lt(e,t);else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&b(o,t);if("fieldResult"in e)for(let o of e.fieldResult)b(o,t);}}function b(e,t){e.formatting&&h(e.formatting,t);}function lt(e,t){for(let o of e.children)o.type==="run"&&b(o,t);}function ct(e,t){for(let o of e.rows)ft(o,t);}function ft(e,t){for(let o of e.cells)dt(o,t);}function dt(e,t){for(let o of e.content)T(o,t);}function O(e,t){for(let o of e.content)T(o,t);}function ut(e,t){for(let o of e.content)T(o,t);}function mt(e,t){for(let o of e.content)T(o,t);}var pt=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function N(e,t={}){let o=t.canRender??n,n$1=new Set;for(let i of t.exclude??[])n$1.add(i.trim().toLowerCase());let r=new Set;for(let i of t.embeddedFamilies??[])r.add(i.trim().toLowerCase());let s=[],a=new Set;for(let i of e){let c=i.trim(),f=c.toLowerCase();!c||pt.has(f)||n$1.has(f)||a.has(f)||!r.has(f)&&!o(c)||(a.add(f),s.push({name:c,fontFamily:d(c).cssFallback,category:"other"}));}return s}function gt(e,t={}){return N(H(e),t)}function ht(e,t){if(!e||e.length===0)return [];let o=new Set;for(let s of t)o.add(s.trim().toLowerCase());let n=new Set,r=[];for(let s of e){let a=s.name.trim().toLowerCase();o.has(a)||n.has(a)||(n.add(a),r.push(s));}return r}function xt(e){let t=[];return e.descendants((o,n)=>{if(o.type.name==="paragraph"){let r=o.attrs.outlineLevel,s=o.attrs.styleId,a=r;if(a==null&&s){let i=s.match(/^[Hh]eading(\d)$/);i&&(a=parseInt(i[1],10)-1);}if(a!=null&&a>=0&&a<=8){let i="";o.forEach(c=>{c.isText&&(i+=c.text||"");}),i.trim()&&t.push({text:i.trim(),level:a,pmPos:n});}}}),t}var L="rgba(255, 235, 59, 0.55)",Ft=1200,y="docx-paragraph-flash",S=new WeakMap;function Tt(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function bt(e){return e?.color?.trim()||L}function yt(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function k(e,t){if(!t||!t.trim())return [];let o=Tt(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function W(e,t){let o=0,n=bt(t),r=yt(t);for(let s of e){o++;let a=S.get(s);a!==void 0&&clearTimeout(a),s.classList.remove(y),s.offsetWidth,s.style.setProperty("--docx-paragraph-flash-color",n),s.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),s.classList.add(y);let i=setTimeout(()=>{s.classList.remove(y),s.style.removeProperty("--docx-paragraph-flash-color"),s.style.removeProperty("--docx-paragraph-flash-duration"),S.delete(s);},r);S.set(s,i);}return o}function Ct(e,t,o){let n=k(e,t);return W(n,o)>0}function B(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function At(e,t,o,n){let r=B(e,t,o),s=Math.floor(r/Math.max(n,1)),a=r-s*n,i=Array.from({length:n},(c,f)=>s+(f<a?1:0));return [...e.slice(0,t),...i,...e.slice(t+o)]}function St(e,t,o,n,r,s){let a=o-t.rowspan,i=n-t.colspan,c=r+a,f=t.row+t.rowspan,F=t.col+t.colspan,p=[];for(let l of e){if(l===t)continue;let g=l.row+l.rowspan,C=l.col+l.colspan,I=l.row<f&&g>t.row,v=l.col<F&&C>t.col;p.push({data:l.data,row:l.row>=f?l.row+a:l.row,col:l.col>=F?l.col+i:l.col,rowspan:l.rowspan+(a>0&&I&&!v?a:0),colspan:l.colspan+(i>0&&v&&!I?i:0)});}for(let l=0;l<o;l++)for(let g=0;g<n;g++){let C=l===0&&g===0;p.push({data:s(C,l,g),row:t.row+l,col:t.col+g,rowspan:1,colspan:1});}return {anchors:p,deltaRows:a,deltaCols:i,newRowCount:c}}function wt(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let s=n.col;s<n.col+n.colspan;s++)o.set(`${r}-${s}`,n);}return {byStart:t,byCoveredSlot:o}}function Et(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}var Pt=/[\p{L}\p{N}\p{M}_''\-]/u,Rt=/\s/;function w(e){return !e||e.length===0?false:Pt.test(e)}function E(e){return !e||e.length===0?false:Rt.test(e)}function m(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(E(o)){let n=t,r=t;for(;n>0&&E(e[n-1]);)n--;for(;r<e.length&&E(e[r]);)r++;return [n,r]}if(w(o)){let n=t,r=t;for(;n>0&&w(e[n-1]);)n--;for(;r<e.length&&w(e[r]);)r++;return [n,r]}return [t,t+1]}function Dt(e,t){let[o,n]=m(e,t);return e.slice(o,n)}function It(e,t){let[o,n]=m(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function D(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[s,a]=m(n,r);if(a>s)return t.setStart(o,s),t.setEnd(o,a),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=G(n);if(r.length>0){let s=t.startOffset,a=null,i=s;if(s<n.childNodes.length){let c=n.childNodes[s];if(c.nodeType===Node.TEXT_NODE)a=c,i=0;else if(c instanceof Element){let f=G(c);f.length>0&&(a=f[0],i=0);}}if(!a&&r.length>0&&(a=r[0],i=0),a){let c=a.textContent||"",[f,F]=m(c,i);if(F>f){let p=document.createRange();return p.setStart(a,f),p.setEnd(a,F),e.removeAllRanges(),e.addRange(p),true}}}}return false}function vt(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,s]=m(n,t);if(s>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,s),o.removeAllRanges(),o.addRange(a),true}return false}function Mt(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return D();let o=t.startContainer,n=t.endContainer,r=t.startOffset,s=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",[i]=m(a,t.startOffset);r=i;}if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",i=Math.max(0,t.endOffset-1),[,c]=m(a,i);s=c;}try{return t.setStart(o,r),t.setEnd(n,s),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function X(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=_t(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function _t(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function G(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var P=0,x=null,R=null,Ot=500;function U(){P=0,R=null,x&&(clearTimeout(x),x=null);}function K(e){return e.target!==R&&U(),P++,R=e.target,x&&clearTimeout(x),x=setTimeout(U,Ot),Math.min(P,3)}function Ht(){return e=>{e.ctrlKey||e.metaKey||e.altKey||D();}}function Nt(){return e=>{if(K(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;X();}}}async function Lt(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var $="(prefers-color-scheme: dark)";function z(){return typeof window<"u"&&typeof window.matchMedia=="function"}function kt(){return z()?window.matchMedia($).matches:false}function Wt(e,t){return e==="dark"||e==="system"&&t}function Bt(e){if(!z())return ()=>{};let t=window.matchMedia($);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var Gt=-1;function Ut(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function Xt(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}var Kt=/^[a-z][a-z0-9+.-]*:/i,$t=/^(https?|mailto|tel|ftp):/i;function zt(e){if(!e)return;let t=e.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(t)return Kt.test(t)?$t.test(t)?e:void 0:e}export{L as DEFAULT_PARAGRAPH_FLASH_COLOR,Ft as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,y as PARAGRAPH_FLASH_CLASS_NAME,Gt as PENDING_COMMENT_ID,wt as buildAnchorMaps,xt as collectHeadings,Et as computeSplitDialogDefaults,St as computeSplitLayout,Xt as createComment,Ut as createCommentIdAllocator,Ht as createDoubleClickWordSelector,Nt as createTripleClickParagraphSelector,ht as excludeFontsByName,Mt as expandSelectionToWordBoundaries,k as findParagraphFragmentsByParaId,It as findWordAt,m as findWordBoundaries,W as flashParagraphElements,Ct as flashParagraphFragmentsByParaId,gt as getRenderableDocumentFonts,Dt as getWordAt,K as handleClickForMultiClick,kt as prefersColorSchemeDark,Lt as readDocxFileFromInput,At as redistributeColumnWidths,Wt as resolveIsDark,zt as sanitizeHref,X as selectParagraphAtCursor,N as selectRenderableFonts,D as selectWordAtCursor,vt as selectWordInTextNode,Bt as subscribeSystemDark,B as sumColumnWidths};
1
+ export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,b as resolveColorToHex,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'../chunk-LTVVQMHB.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-CTBUQRYQ.mjs';import {n,d}from'../chunk-JHJLG4I6.mjs';export{r as FONT_MAPPING,n as canRenderFont,c as deobfuscateFont,A as extractEmbeddedFontFaces,w as extractFontsFromDocument,z as getEmbeddedFontFaces,y as getEmbeddedFontFamilies,s as getGoogleFontEquivalent,k as getLoadedFonts,g as isFontLoaded,i as isGoogleFontsEnabled,j as isLoading,b as isValidFontKey,x as loadDocumentFonts,B as loadEmbeddedFonts,e as loadFont,q as loadFontDefinitions,o as loadFontFromBuffer,p as loadFontFromUrl,t as loadFontWithMapping,f as loadFonts,u as loadFontsWithMapping,m as onFontError,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-JHJLG4I6.mjs';import'../chunk-6LQJAKOC.mjs';import'../chunk-HLDJMU3R.mjs';import'../chunk-ACGKK7IB.mjs';import'../chunk-5F6DLQZP.mjs';import'../chunk-TTRUPDAB.mjs';function H(e){let t=new Set,o=e.package;if(o.theme&&nt(o.theme,t),o.styles&&rt(o.styles,t),o.document)for(let n of o.document.content)T(n,t);if(o.headers)for(let n of o.headers.values())O(n,t);if(o.footers)for(let n of o.footers.values())O(n,t);if(o.footnotes)for(let n of o.footnotes)ut(n,t);if(o.endnotes)for(let n of o.endnotes)mt(n,t);return Array.from(t).sort()}function nt(e,t){let o=e.fontScheme;o&&(o.majorFont&&_(o.majorFont,t),o.minorFont&&_(o.minorFont,t));}function _(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function rt(e,t){e.docDefaults&&(e.docDefaults.rPr&&h(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&h(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&h(o.rPr,t),o.pPr?.runProperties&&h(o.pPr.runProperties,t);}function h(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function at(e,t){e.runProperties&&h(e.runProperties,t);}function T(e,t){e.type==="paragraph"?st(e,t):e.type==="table"&&ct(e,t);}function st(e,t){e.formatting&&at(e.formatting,t);for(let o of e.content)it(o,t);}function it(e,t){if(e.type==="run")b(e,t);else if(e.type==="hyperlink")lt(e,t);else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&b(o,t);if("fieldResult"in e)for(let o of e.fieldResult)b(o,t);}}function b(e,t){e.formatting&&h(e.formatting,t);}function lt(e,t){for(let o of e.children)o.type==="run"&&b(o,t);}function ct(e,t){for(let o of e.rows)ft(o,t);}function ft(e,t){for(let o of e.cells)dt(o,t);}function dt(e,t){for(let o of e.content)T(o,t);}function O(e,t){for(let o of e.content)T(o,t);}function ut(e,t){for(let o of e.content)T(o,t);}function mt(e,t){for(let o of e.content)T(o,t);}var pt=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function N(e,t={}){let o=t.canRender??n,n$1=new Set;for(let i of t.exclude??[])n$1.add(i.trim().toLowerCase());let r=new Set;for(let i of t.embeddedFamilies??[])r.add(i.trim().toLowerCase());let s=[],a=new Set;for(let i of e){let c=i.trim(),f=c.toLowerCase();!c||pt.has(f)||n$1.has(f)||a.has(f)||!r.has(f)&&!o(c)||(a.add(f),s.push({name:c,fontFamily:d(c).cssFallback,category:"other"}));}return s}function gt(e,t={}){return N(H(e),t)}function ht(e,t){if(!e||e.length===0)return [];let o=new Set;for(let s of t)o.add(s.trim().toLowerCase());let n=new Set,r=[];for(let s of e){let a=s.name.trim().toLowerCase();o.has(a)||n.has(a)||(n.add(a),r.push(s));}return r}function xt(e){let t=[];return e.descendants((o,n)=>{if(o.type.name==="paragraph"){let r=o.attrs.outlineLevel,s=o.attrs.styleId,a=r;if(a==null&&s){let i=s.match(/^[Hh]eading(\d)$/);i&&(a=parseInt(i[1],10)-1);}if(a!=null&&a>=0&&a<=8){let i="";o.forEach(c=>{c.isText&&(i+=c.text||"");}),i.trim()&&t.push({text:i.trim(),level:a,pmPos:n});}}}),t}var L="rgba(255, 235, 59, 0.55)",Ft=1200,y="docx-paragraph-flash",S=new WeakMap;function Tt(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function bt(e){return e?.color?.trim()||L}function yt(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function k(e,t){if(!t||!t.trim())return [];let o=Tt(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function W(e,t){let o=0,n=bt(t),r=yt(t);for(let s of e){o++;let a=S.get(s);a!==void 0&&clearTimeout(a),s.classList.remove(y),s.offsetWidth,s.style.setProperty("--docx-paragraph-flash-color",n),s.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),s.classList.add(y);let i=setTimeout(()=>{s.classList.remove(y),s.style.removeProperty("--docx-paragraph-flash-color"),s.style.removeProperty("--docx-paragraph-flash-duration"),S.delete(s);},r);S.set(s,i);}return o}function Ct(e,t,o){let n=k(e,t);return W(n,o)>0}function B(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function At(e,t,o,n){let r=B(e,t,o),s=Math.floor(r/Math.max(n,1)),a=r-s*n,i=Array.from({length:n},(c,f)=>s+(f<a?1:0));return [...e.slice(0,t),...i,...e.slice(t+o)]}function St(e,t,o,n,r,s){let a=o-t.rowspan,i=n-t.colspan,c=r+a,f=t.row+t.rowspan,F=t.col+t.colspan,p=[];for(let l of e){if(l===t)continue;let g=l.row+l.rowspan,C=l.col+l.colspan,I=l.row<f&&g>t.row,v=l.col<F&&C>t.col;p.push({data:l.data,row:l.row>=f?l.row+a:l.row,col:l.col>=F?l.col+i:l.col,rowspan:l.rowspan+(a>0&&I&&!v?a:0),colspan:l.colspan+(i>0&&v&&!I?i:0)});}for(let l=0;l<o;l++)for(let g=0;g<n;g++){let C=l===0&&g===0;p.push({data:s(C,l,g),row:t.row+l,col:t.col+g,rowspan:1,colspan:1});}return {anchors:p,deltaRows:a,deltaCols:i,newRowCount:c}}function wt(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let s=n.col;s<n.col+n.colspan;s++)o.set(`${r}-${s}`,n);}return {byStart:t,byCoveredSlot:o}}function Et(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}var Pt=/[\p{L}\p{N}\p{M}_''\-]/u,Rt=/\s/;function w(e){return !e||e.length===0?false:Pt.test(e)}function E(e){return !e||e.length===0?false:Rt.test(e)}function m(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(E(o)){let n=t,r=t;for(;n>0&&E(e[n-1]);)n--;for(;r<e.length&&E(e[r]);)r++;return [n,r]}if(w(o)){let n=t,r=t;for(;n>0&&w(e[n-1]);)n--;for(;r<e.length&&w(e[r]);)r++;return [n,r]}return [t,t+1]}function Dt(e,t){let[o,n]=m(e,t);return e.slice(o,n)}function It(e,t){let[o,n]=m(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function D(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[s,a]=m(n,r);if(a>s)return t.setStart(o,s),t.setEnd(o,a),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=G(n);if(r.length>0){let s=t.startOffset,a=null,i=s;if(s<n.childNodes.length){let c=n.childNodes[s];if(c.nodeType===Node.TEXT_NODE)a=c,i=0;else if(c instanceof Element){let f=G(c);f.length>0&&(a=f[0],i=0);}}if(!a&&r.length>0&&(a=r[0],i=0),a){let c=a.textContent||"",[f,F]=m(c,i);if(F>f){let p=document.createRange();return p.setStart(a,f),p.setEnd(a,F),e.removeAllRanges(),e.addRange(p),true}}}}return false}function vt(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,s]=m(n,t);if(s>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,s),o.removeAllRanges(),o.addRange(a),true}return false}function Mt(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return D();let o=t.startContainer,n=t.endContainer,r=t.startOffset,s=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",[i]=m(a,t.startOffset);r=i;}if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",i=Math.max(0,t.endOffset-1),[,c]=m(a,i);s=c;}try{return t.setStart(o,r),t.setEnd(n,s),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function X(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=_t(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function _t(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function G(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var P=0,x=null,R=null,Ot=500;function U(){P=0,R=null,x&&(clearTimeout(x),x=null);}function K(e){return e.target!==R&&U(),P++,R=e.target,x&&clearTimeout(x),x=setTimeout(U,Ot),Math.min(P,3)}function Ht(){return e=>{e.ctrlKey||e.metaKey||e.altKey||D();}}function Nt(){return e=>{if(K(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;X();}}}async function Lt(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var $="(prefers-color-scheme: dark)";function z(){return typeof window<"u"&&typeof window.matchMedia=="function"}function kt(){return z()?window.matchMedia($).matches:false}function Wt(e,t){return e==="dark"||e==="system"&&t}function Bt(e){if(!z())return ()=>{};let t=window.matchMedia($);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var Gt=-1;function Ut(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function Xt(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}var Kt=/^[a-z][a-z0-9+.-]*:/i,$t=/^(https?|mailto|tel|ftp):/i;function zt(e){if(!e)return;let t=e.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(t)return Kt.test(t)?$t.test(t)?e:void 0:e}export{L as DEFAULT_PARAGRAPH_FLASH_COLOR,Ft as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,y as PARAGRAPH_FLASH_CLASS_NAME,Gt as PENDING_COMMENT_ID,wt as buildAnchorMaps,xt as collectHeadings,Et as computeSplitDialogDefaults,St as computeSplitLayout,Xt as createComment,Ut as createCommentIdAllocator,Ht as createDoubleClickWordSelector,Nt as createTripleClickParagraphSelector,ht as excludeFontsByName,Mt as expandSelectionToWordBoundaries,k as findParagraphFragmentsByParaId,It as findWordAt,m as findWordBoundaries,W as flashParagraphElements,Ct as flashParagraphFragmentsByParaId,gt as getRenderableDocumentFonts,Dt as getWordAt,K as handleClickForMultiClick,kt as prefersColorSchemeDark,Lt as readDocxFileFromInput,At as redistributeColumnWidths,Wt as resolveIsDark,zt as sanitizeHref,X as selectParagraphAtCursor,N as selectRenderableFonts,D as selectWordAtCursor,vt as selectWordInTextNode,Bt as subscribeSystemDark,B as sumColumnWidths};
@@ -1,5 +1,5 @@
1
- import { a as Style } from '../styles-BK3Jecxs.mjs';
2
- import '../formatting-BEkIBePP.mjs';
1
+ import { a as Style } from '../styles-7e-mq3c-.mjs';
2
+ import '../formatting-7zKCTu5a.mjs';
3
3
 
4
4
  /**
5
5
  * Paragraph-style preview + option resolution — shared between the React and
@@ -0,0 +1 @@
1
+ import'./chunk-EUUIJVM6.mjs';export{b as createEditSession,a as preloadEditWasm}from'./chunk-GD4VNJ64.mjs';import'./chunk-5F6DLQZP.mjs';import'./chunk-TTRUPDAB.mjs';
@@ -1 +1 @@
1
- export{p as buildDisplayListJson,s as clearMeasureFonts,g as closeDisplayList,d as hasDisplayListSession,i as hasDisplayListUpdate,e as hasRangeRectsRegion,j as hitTestRegionsByHandle,b as hitTestRegionsJson,q as layoutDocumentJson,t as measureParagraphJson,f as openDisplayList,u as outlineGlyphJson,a as preloadLayoutWasm,m as rangeRectsByHandle,c as rangeRectsJson,o as rangeRectsRegionByHandle,n as rangeRectsRegionJson,r as registerMeasureFont,h as updateDisplayList,l as verticalMoveByHandle,k as verticalMoveJson}from'./chunk-NBSLB77E.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
1
+ export{p as buildDisplayListJson,s as clearMeasureFonts,g as closeDisplayList,d as hasDisplayListSession,i as hasDisplayListUpdate,e as hasRangeRectsRegion,j as hitTestRegionsByHandle,b as hitTestRegionsJson,q as layoutDocumentJson,t as measureParagraphJson,f as openDisplayList,u as outlineGlyphJson,a as preloadLayoutWasm,m as rangeRectsByHandle,c as rangeRectsJson,o as rangeRectsRegionByHandle,n as rangeRectsRegionJson,r as registerMeasureFont,h as updateDisplayList,l as verticalMoveByHandle,k as verticalMoveJson}from'./chunk-WTFRNX5K.mjs';import'./chunk-5F6DLQZP.mjs';import'./chunk-TTRUPDAB.mjs';