@betteroffice/docx 0.0.3 → 0.0.4

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 (62) hide show
  1. package/README.md +20 -7
  2. package/dist/chunk-4V6MDZIK.mjs +1 -0
  3. package/dist/chunk-6KDV6AIL.mjs +1 -0
  4. package/dist/chunk-CTBUQRYQ.mjs +1 -0
  5. package/dist/{chunk-IFT6DUJX.mjs → chunk-LTVVQMHB.mjs} +1 -1
  6. package/dist/chunk-NBSLB77E.mjs +1 -0
  7. package/dist/chunk-NTSSE5QK.mjs +57 -0
  8. package/dist/chunk-YTILOUAA.mjs +16 -0
  9. package/dist/collaboration/index.d.mts +32 -8
  10. package/dist/collaboration/index.mjs +1 -1
  11. package/dist/{content-MOZ6hKP4.d.mts → content-C3sTRz-u.d.mts} +517 -650
  12. package/dist/core.d.mts +6 -6
  13. package/dist/core.mjs +1 -1
  14. package/dist/{displayListQueries-BJlo7Jkz.d.mts → displayListQueries-DLzpvJV6.d.mts} +14 -3
  15. package/dist/docx/index.d.mts +3 -3
  16. package/dist/docx/index.mjs +1 -1
  17. package/dist/editor/index.d.mts +7 -7
  18. package/dist/{fontLoader-aSewHMKF.d.mts → fontLoader-CMH3bZ2Z.d.mts} +127 -2
  19. package/dist/{formatting-D1EPSaJP.d.mts → formatting-BEkIBePP.d.mts} +77 -203
  20. package/dist/{frameDelta-D965X8yK.d.mts → frameDelta-B2kC6XiP.d.mts} +4 -2
  21. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  22. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  23. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  24. package/dist/{index-Dx4Z3lkz.d.mts → index-2piKi4gO.d.mts} +66 -3
  25. package/dist/layout/index.d.mts +8 -7
  26. package/dist/layout/index.mjs +1 -1
  27. package/dist/layout/pagination/index.d.mts +4 -4
  28. package/dist/layout/pagination/index.mjs +1 -1
  29. package/dist/layout/render/index.d.mts +10 -10
  30. package/dist/layout/render/index.mjs +1 -1
  31. package/dist/plugin-api/RenderedDomContext.d.mts +7 -7
  32. package/dist/plugin-api/index.d.mts +3 -3
  33. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  34. package/dist/{rustDisplayList-BRuZBqdL.d.mts → rustDisplayList-B0M2eBkU.d.mts} +7 -2
  35. package/dist/styles/index.d.mts +2 -2
  36. package/dist/{styles-Dn_o3Vo5.d.mts → styles-BK3Jecxs.d.mts} +1 -1
  37. package/dist/types/content.d.mts +2 -2
  38. package/dist/types/document.d.mts +6 -6
  39. package/dist/{types-BfqUl2h_.d.mts → types-C1rv3KM-.d.mts} +2 -2
  40. package/dist/utils/comments.d.mts +2 -2
  41. package/dist/utils/index.d.mts +4 -4
  42. package/dist/utils/index.mjs +1 -1
  43. package/dist/utils/stylePreview.d.mts +2 -2
  44. package/dist/utils/units.d.mts +4 -34
  45. package/dist/utils/units.mjs +1 -1
  46. package/dist/wasm-F2ETFAYL.mjs +1 -0
  47. package/dist/wasm-JE7B3ROD.mjs +1 -0
  48. package/dist/wasm-edit.d.mts +24 -0
  49. package/dist/wasm-edit.mjs +1 -1
  50. package/dist/wasm-layout.d.mts +5 -1
  51. package/dist/wasm-layout.mjs +1 -1
  52. package/dist/yrs/index.d.mts +6 -6
  53. package/dist/yrs/index.mjs +1 -1
  54. package/dist/yrs/residentEngineWorker.mjs +1 -1
  55. package/package.json +1 -2
  56. package/dist/chunk-3UBMCDME.mjs +0 -1
  57. package/dist/chunk-AEQOEQJ7.mjs +0 -57
  58. package/dist/chunk-AZ52IWB6.mjs +0 -16
  59. package/dist/chunk-WON6K4FY.mjs +0 -1
  60. package/dist/chunk-Y7RUNRU2.mjs +0 -1
  61. package/dist/wasm-DO3BUV7C.mjs +0 -1
  62. package/dist/wasm-NWXX4H5G.mjs +0 -1
@@ -1,239 +1,113 @@
1
- /**
2
- * Theme parsing — colors and fonts from a DrawingML theme part
3
- * (e.g. word/theme/theme1.xml, ppt/theme/theme1.xml).
4
- *
5
- * Extracts color scheme (dk1, lt1, dk2, lt2, accent1-6, hlink, folHlink)
6
- * and font scheme (majorFont, minorFont) from the theme.
7
- *
8
- * OOXML Reference:
9
- * - Uses DrawingML namespace (a:)
10
- * - Colors can be srgbClr, sysClr, or schemeClr
11
- */
12
-
13
- /**
14
- * Theme color scheme (a:clrScheme)
15
- *
16
- * @public
17
- */
1
+ /** DrawingML value contracts retained by the DOCX host. */
2
+ type ThemeColorSlot = 'dk1' | 'lt1' | 'dk2' | 'lt2' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6' | 'hlink' | 'folHlink' | 'background1' | 'text1' | 'background2' | 'text2';
3
+ interface ColorValue {
4
+ rgb?: string;
5
+ themeColor?: ThemeColorSlot;
6
+ themeTint?: string;
7
+ themeShade?: string;
8
+ auto?: boolean;
9
+ }
18
10
  interface ThemeColorScheme {
19
- /** Dark 1 color (usually black) */
20
11
  dk1?: string;
21
- /** Light 1 color (usually white) */
22
12
  lt1?: string;
23
- /** Dark 2 color */
24
13
  dk2?: string;
25
- /** Light 2 color */
26
14
  lt2?: string;
27
- /** Accent colors 1-6 */
28
15
  accent1?: string;
29
16
  accent2?: string;
30
17
  accent3?: string;
31
18
  accent4?: string;
32
19
  accent5?: string;
33
20
  accent6?: string;
34
- /** Hyperlink color */
35
21
  hlink?: string;
36
- /** Followed hyperlink color */
37
22
  folHlink?: string;
38
23
  }
39
- /**
40
- * Theme font (with script variants)
41
- *
42
- * @public
43
- */
44
24
  interface ThemeFont {
45
- /** Latin font */
46
25
  latin?: string;
47
- /** East Asian font */
48
26
  ea?: string;
49
- /** Complex script font */
50
27
  cs?: string;
51
- /** Script-specific fonts */
52
28
  fonts?: Record<string, string>;
53
29
  }
54
- /**
55
- * Theme font scheme (a:fontScheme)
56
- *
57
- * @public
58
- */
59
30
  interface ThemeFontScheme {
60
- /** Major font (headings) */
61
31
  majorFont?: ThemeFont;
62
- /** Minor font (body text) */
63
32
  minorFont?: ThemeFont;
64
33
  }
65
- /**
66
- * Theme (from a theme1.xml part)
67
- *
68
- * @public
69
- */
70
34
  interface Theme {
71
- /** Theme name */
72
35
  name?: string;
73
- /** Color scheme */
74
36
  colorScheme?: ThemeColorScheme;
75
- /** Font scheme */
76
37
  fontScheme?: ThemeFontScheme;
77
- /** Format scheme (fills, lines, effects) - simplified */
78
38
  formatScheme?: {
79
39
  name?: string;
80
40
  };
81
41
  }
82
-
83
- /**
84
- * Color primitives and math shared across OOXML formats.
85
- *
86
- * Handles theme color slot references (accent1, dk1, ...), RGB hex values,
87
- * tint/shade modifiers, and the derived color helpers (lighten/darken/blend/
88
- * contrast) built on top of them.
89
- *
90
- * Tint/Shade Calculations (ECMA-376 §17.3.2.41):
91
- * - Tint makes a color lighter (per-channel interpolation toward white)
92
- * - Shade makes a color darker (per-channel interpolation toward black)
93
- * - The wire value is a hex byte (00-FF) meaning "how much color to keep"
94
- */
95
-
96
- /**
97
- * Theme color slots from a theme's clrScheme (plus the WordprocessingML
98
- * alias slots background1/text1/background2/text2).
99
- *
100
- * @public
101
- */
102
- type ThemeColorSlot = 'dk1' | 'lt1' | 'dk2' | 'lt2' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6' | 'hlink' | 'folHlink' | 'background1' | 'text1' | 'background2' | 'text2';
103
- /**
104
- * ECMA-376 color reference — either a direct RGB hex, a theme slot
105
- * reference (with optional tint/shade), or `auto` for context-dependent
106
- * defaults (usually black for text on light backgrounds). When both
107
- * `rgb` and `themeColor` are set, the theme wins on Word import and the
108
- * `rgb` acts as a fallback for renderers without theme support.
109
- *
110
- * See ECMA-376 §17.18.39 (`ST_ThemeColor`).
111
- *
112
- * @public
113
- */
114
- interface ColorValue {
115
- /** RGB hex value without # (e.g., "FF0000") */
116
- rgb?: string;
117
- /** Theme color slot reference */
118
- themeColor?: ThemeColorSlot;
119
- /** Tint modifier (0-255 as hex string, e.g., "80") - makes color lighter */
120
- themeTint?: string;
121
- /** Shade modifier (0-255 as hex string) - makes color darker */
122
- themeShade?: string;
123
- /** Auto color - context-dependent (usually black for text) */
124
- auto?: boolean;
42
+ type ShapeType = 'rect' | 'roundRect' | 'ellipse' | 'triangle' | 'rtTriangle' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'hexagon' | 'heptagon' | 'octagon' | 'decagon' | 'dodecagon' | 'star4' | 'star5' | 'star6' | 'star7' | 'star8' | 'star10' | 'star12' | 'star16' | 'star24' | 'star32' | 'line' | 'straightConnector1' | 'bentConnector2' | 'bentConnector3' | 'bentConnector4' | 'bentConnector5' | 'curvedConnector2' | 'curvedConnector3' | 'curvedConnector4' | 'curvedConnector5' | 'rightArrow' | 'leftArrow' | 'upArrow' | 'downArrow' | 'leftRightArrow' | 'upDownArrow' | 'quadArrow' | 'leftRightUpArrow' | 'bentArrow' | 'uturnArrow' | 'leftUpArrow' | 'bentUpArrow' | 'curvedRightArrow' | 'curvedLeftArrow' | 'curvedUpArrow' | 'curvedDownArrow' | 'stripedRightArrow' | 'notchedRightArrow' | 'homePlate' | 'chevron' | 'rightArrowCallout' | 'downArrowCallout' | 'leftArrowCallout' | 'upArrowCallout' | 'leftRightArrowCallout' | 'quadArrowCallout' | 'circularArrow' | 'flowChartProcess' | 'flowChartAlternateProcess' | 'flowChartDecision' | 'flowChartInputOutput' | 'flowChartPredefinedProcess' | 'flowChartInternalStorage' | 'flowChartDocument' | 'flowChartMultidocument' | 'flowChartTerminator' | 'flowChartPreparation' | 'flowChartManualInput' | 'flowChartManualOperation' | 'flowChartConnector' | 'flowChartOffpageConnector' | 'flowChartPunchedCard' | 'flowChartPunchedTape' | 'flowChartSummingJunction' | 'flowChartOr' | 'flowChartCollate' | 'flowChartSort' | 'flowChartExtract' | 'flowChartMerge' | 'flowChartOnlineStorage' | 'flowChartDelay' | 'flowChartMagneticTape' | 'flowChartMagneticDisk' | 'flowChartMagneticDrum' | 'flowChartDisplay' | 'wedgeRectCallout' | 'wedgeRoundRectCallout' | 'wedgeEllipseCallout' | 'cloudCallout' | 'borderCallout1' | 'borderCallout2' | 'borderCallout3' | 'accentCallout1' | 'accentCallout2' | 'accentCallout3' | 'callout1' | 'callout2' | 'callout3' | 'accentBorderCallout1' | 'accentBorderCallout2' | 'accentBorderCallout3' | 'actionButtonBlank' | 'actionButtonHome' | 'actionButtonHelp' | 'actionButtonInformation' | 'actionButtonBackPrevious' | 'actionButtonForwardNext' | 'actionButtonBeginning' | 'actionButtonEnd' | 'actionButtonReturn' | 'actionButtonDocument' | 'actionButtonSound' | 'actionButtonMovie' | 'irregularSeal1' | 'irregularSeal2' | 'frame' | 'halfFrame' | 'corner' | 'diagStripe' | 'chord' | 'arc' | 'bracketPair' | 'bracePair' | 'leftBracket' | 'rightBracket' | 'leftBrace' | 'rightBrace' | 'can' | 'cube' | 'bevel' | 'donut' | 'noSmoking' | 'blockArc' | 'foldedCorner' | 'smileyFace' | 'heart' | 'lightningBolt' | 'sun' | 'moon' | 'cloud' | 'snip1Rect' | 'snip2SameRect' | 'snip2DiagRect' | 'snipRoundRect' | 'round1Rect' | 'round2SameRect' | 'round2DiagRect' | 'plaque' | 'teardrop' | 'mathPlus' | 'mathMinus' | 'mathMultiply' | 'mathDivide' | 'mathEqual' | 'mathNotEqual' | 'gear6' | 'gear9' | 'funnel' | 'pieWedge' | 'pie' | 'leftCircularArrow' | 'leftRightCircularArrow' | 'swooshArrow' | 'textBox';
43
+ interface ShapeFill {
44
+ type: 'none' | 'solid' | 'gradient' | 'pattern' | 'picture';
45
+ color?: ColorValue;
46
+ gradient?: {
47
+ type: 'linear' | 'radial' | 'rectangular' | 'path';
48
+ angle?: number;
49
+ stops: Array<{
50
+ position: number;
51
+ color: ColorValue;
52
+ }>;
53
+ };
125
54
  }
126
- /**
127
- * Resolve a ColorValue to a CSS color string
128
- *
129
- * @param color - ColorValue object with rgb, themeColor, tint/shade, or auto
130
- * @param theme - Theme for resolving theme colors
131
- * @param defaultColor - Default color if auto or undefined (default: black)
132
- * @returns CSS color string (e.g., "#FF0000" or "inherit")
133
- *
134
- * @public
135
- */
136
- declare function resolveColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, defaultColor?: string): string;
137
- /**
138
- * Resolve any ColorValue (text, fill/shading, border, underline) to a 6-char
139
- * uppercase hex string — or `undefined` if transparent/unset/unresolvable.
140
- *
141
- * Shared display-side resolver. Prefer this over reading `.rgb` directly so
142
- * that `themeColor` + `themeTint`/`themeShade` are honored consistently across
143
- * all render paths.
144
- *
145
- * When a themed color is present but `theme` is null/undefined, falls back to
146
- * `color.rgb` if Word wrote one for compat; otherwise returns `undefined`.
147
- *
148
- * @returns 6-char uppercase hex without `#`, or `undefined`.
149
- *
150
- * @public
151
- */
152
- declare function resolveColorToHex(color: ColorValue | undefined | null, theme: Theme | null | undefined): string | undefined;
153
- /**
154
- * Get contrasting text color for a background
155
- *
156
- * @param backgroundColor - Background ColorValue
157
- * @param theme - Theme for resolving theme colors
158
- * @returns Black or white hex color for best contrast
159
- *
160
- * @public
161
- */
162
- declare function getContrastingColor(backgroundColor: ColorValue | undefined | null, theme: Theme | null | undefined): string;
163
- /**
164
- * Darken a color by a percentage
165
- *
166
- * @param color - ColorValue to darken
167
- * @param theme - Theme for resolving
168
- * @param percent - Percentage to darken (0-100)
169
- * @returns CSS color string
170
- *
171
- * @public
172
- */
173
- declare function darkenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;
174
- /**
175
- * Lighten a color by a percentage
176
- *
177
- * @param color - ColorValue to lighten
178
- * @param theme - Theme for resolving
179
- * @param percent - Percentage to lighten (0-100)
180
- * @returns CSS color string
181
- *
182
- * @public
183
- */
184
- declare function lightenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;
185
- /**
186
- * Blend two colors together
187
- *
188
- * @param color1 - First color
189
- * @param color2 - Second color
190
- * @param ratio - Blend ratio (0 = all color1, 1 = all color2)
191
- * @param theme - Theme for resolving
192
- * @returns CSS color string
193
- *
194
- * @public
195
- */
196
- declare function blendColors(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, ratio: number, theme: Theme | null | undefined): string;
197
- /**
198
- * Theme color matrix cell
199
- *
200
- * @public
201
- */
202
- interface ThemeMatrixCell {
203
- /** Resolved hex color (6 chars, no #) */
204
- hex: string;
205
- /** Theme color slot */
206
- themeSlot: ThemeColorSlot;
207
- /** Tint hex modifier if applicable (e.g., "CC") */
208
- tint?: string;
209
- /** Shade hex modifier if applicable (e.g., "BF") */
210
- shade?: string;
211
- /** Human-readable label (e.g., "Accent 1, Lighter 60%") */
212
- label: string;
55
+ interface ShapeOutline {
56
+ width?: number;
57
+ color?: ColorValue;
58
+ style?: 'solid' | 'dot' | 'dash' | 'lgDash' | 'dashDot' | 'lgDashDot' | 'lgDashDotDot' | 'sysDot' | 'sysDash' | 'sysDashDot' | 'sysDashDotDot';
59
+ cap?: 'flat' | 'round' | 'square';
60
+ join?: 'bevel' | 'miter' | 'round';
61
+ headEnd?: {
62
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
63
+ width?: 'sm' | 'med' | 'lg';
64
+ length?: 'sm' | 'med' | 'lg';
65
+ };
66
+ tailEnd?: {
67
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
68
+ width?: 'sm' | 'med' | 'lg';
69
+ length?: 'sm' | 'med' | 'lg';
70
+ };
213
71
  }
214
- /**
215
- * Compute a single tinted or shaded hex color from a base color.
216
- *
217
- * @param baseHex - 6-character hex color (no #)
218
- * @param type - 'tint' to lighten, 'shade' to darken
219
- * @param fraction - Amount (0-1). For tint: 0=no change, 1=white. For shade: 0=black, 1=no change.
220
- * @returns 6-character hex color (no #)
221
- *
222
- * @public
223
- */
224
- declare function getThemeTintShadeHex(baseHex: string, type: 'tint' | 'shade', fraction: number): string;
225
- /**
226
- * Generate the 10×6 theme color matrix for an advanced color picker.
227
- *
228
- * Columns: lt1, dk1, lt2, dk2, accent1-6 (matches Word's order)
229
- * Rows: base, 80% tint, 60% tint, 40% tint, 25% shade, 50% shade
230
- *
231
- * @param colorScheme - Theme color scheme (falls back to Office 2016 defaults)
232
- * @returns 6 rows × 10 columns of ThemeMatrixCell
233
- *
234
- * @public
235
- */
236
- declare function generateThemeTintShadeMatrix(colorScheme?: ThemeColorScheme | null): ThemeMatrixCell[][];
72
+ interface ShapeTextBody<TContent = unknown> {
73
+ vertical?: boolean;
74
+ rotation?: number;
75
+ anchor?: 'top' | 'middle' | 'bottom' | 'distributed' | 'justified';
76
+ anchorCenter?: boolean;
77
+ autoFit?: 'none' | 'normal' | 'shape';
78
+ margins?: {
79
+ top?: number;
80
+ bottom?: number;
81
+ left?: number;
82
+ right?: number;
83
+ };
84
+ content: TContent[];
85
+ }
86
+ type PresetGeometryPathCommand = {
87
+ type: 'move';
88
+ x: number;
89
+ y: number;
90
+ } | {
91
+ type: 'line';
92
+ x: number;
93
+ y: number;
94
+ } | {
95
+ type: 'quad';
96
+ cpx: number;
97
+ cpy: number;
98
+ x: number;
99
+ y: number;
100
+ } | {
101
+ type: 'cubic';
102
+ cp1x: number;
103
+ cp1y: number;
104
+ cp2x: number;
105
+ cp2y: number;
106
+ x: number;
107
+ y: number;
108
+ } | {
109
+ type: 'close';
110
+ };
237
111
 
238
112
  /**
239
113
  * Color & Styling Primitives
@@ -820,4 +694,4 @@ interface TableCellFormatting {
820
694
  conditionalFormat?: ConditionalFormatStyle;
821
695
  }
822
696
 
823
- export { generateThemeTintShadeMatrix as A, type BorderSpec as B, type ColorValue as C, getContrastingColor as D, type EmphasisMark as E, type FloatingTableProperties as F, getThemeTintShadeHex as G, lightenColor as H, resolveColor as I, resolveColorToHex as J, type LineSpacingRule as L, type ParagraphFormatting as P, type RunFontHint as R, type ShadingProperties as S, type TextModernEffects as T, type UnderlineStyle as U, type TextFormatting as a, type TableFormatting as b, type TableRowFormatting as c, type TableCellFormatting as d, type Theme as e, type ThemeColorSlot as f, type CellMargins as g, type ConditionalFormatStyle as h, type ParagraphAlignment as i, type RunLanguage as j, type TabLeader as k, type TabStop as l, type TabStopAlignment as m, type TableBorders as n, type TableLook as o, type TableMeasurement as p, type TableStyleCascade as q, type TableStyleRegion as r, type TableWidthType as s, type TextEffect as t, type ThemeColorScheme as u, type ThemeFont as v, type ThemeFontScheme as w, type ThemeMatrixCell as x, blendColors as y, darkenColor as z };
697
+ export type { ThemeFontScheme as A, BorderSpec as B, ColorValue as C, ShapeTextBody as D, EmphasisMark as E, FloatingTableProperties as F, LineSpacingRule as L, PresetGeometryPathCommand as P, RunFontHint as R, ShadingProperties as S, TextModernEffects as T, UnderlineStyle as U, ParagraphFormatting as a, TextFormatting as b, TableFormatting as c, TableRowFormatting as d, TableCellFormatting as e, Theme as f, CellMargins as g, ConditionalFormatStyle as h, ParagraphAlignment as i, RunLanguage as j, ShapeFill as k, ShapeOutline as l, ShapeType as m, TabLeader as n, TabStop as o, TabStopAlignment as p, TableBorders as q, TableLook as r, TableMeasurement as s, TableStyleCascade as t, TableStyleRegion as u, TableWidthType as v, TextEffect as w, ThemeColorScheme as x, ThemeColorSlot as y, ThemeFont as z };
@@ -1,5 +1,5 @@
1
- import { D as DrawingScene, d as ShapeTextBodyProperties } from './content-MOZ6hKP4.mjs';
2
- import { T as TextModernEffects } from './formatting-D1EPSaJP.mjs';
1
+ import { T as TextModernEffects } from './formatting-BEkIBePP.mjs';
2
+ import { D as DrawingScene, d as ShapeTextBodyProperties } from './content-C3sTRz-u.mjs';
3
3
 
4
4
  interface DisplayList {
5
5
  /** Contract version. Undefined reads as legacy version 0. */
@@ -221,6 +221,8 @@ interface DocAttrs {
221
221
  paraId?: string;
222
222
  fromLine?: number;
223
223
  toLine?: number;
224
+ /** Resolved line index within the owning paragraph. */
225
+ lineIndex?: number;
224
226
  /**
225
227
  * Table cell the primitive paints inside, when any. The a11y mirror builds
226
228
  * real ARIA table semantics (role table/row/cell, aria-row/colindex) from
@@ -1,5 +1,5 @@
1
- import { R as RetainedFrame } from './frameDelta-D965X8yK.mjs';
2
1
  import { Document } from './types/document.mjs';
2
+ import { R as RetainedFrame } from './frameDelta-B2kC6XiP.mjs';
3
3
 
4
4
  type CollaborationUpdateOrigin = 'local' | 'remote';
5
5
  interface CollaborationReplica {
@@ -46,6 +46,43 @@ interface CollaborationProviderOptions {
46
46
  maxFrameBytes?: number;
47
47
  maxMessagesPerFrame?: number;
48
48
  maxPendingBytes?: number;
49
+ user?: CollaborationUser;
50
+ }
51
+ interface CollaborationUser {
52
+ name: string;
53
+ color?: string;
54
+ }
55
+ interface CollaborationResolvedUser {
56
+ name: string;
57
+ color: string;
58
+ }
59
+ interface CollaborationCursor {
60
+ story: string;
61
+ anchor: Uint8Array;
62
+ head: Uint8Array;
63
+ }
64
+ interface CollaborationTextInsertion {
65
+ clientId: number;
66
+ story: string;
67
+ paraId: string;
68
+ endOffset: number;
69
+ }
70
+ interface CollaborationAwarenessState {
71
+ clientId: number;
72
+ clock: number;
73
+ user: CollaborationResolvedUser;
74
+ cursor: CollaborationCursor | null;
75
+ }
76
+ interface CollaborationPeer extends CollaborationAwarenessState {
77
+ lastSeenAt: number;
78
+ cursorMovedAt: number;
79
+ inferredCursor: CollaborationTextInsertion | null;
80
+ }
81
+ type CollaborationPeerListener = (peers: readonly CollaborationPeer[]) => void;
82
+ interface CollaborationPresence {
83
+ readonly peers: readonly CollaborationPeer[];
84
+ setCursor(cursor: CollaborationCursor | null, broadcast?: boolean): void;
85
+ onPeers(listener: CollaborationPeerListener): () => void;
49
86
  }
50
87
  type CollaborationStatusListener = (change: CollaborationStatusChange) => void;
51
88
  type CollaborationErrorListener = (error: CollaborationError) => void;
@@ -217,6 +254,12 @@ declare function yrsToDocument(session: YrsSession, base: Document, options?: Yr
217
254
  * from its offset space). Story-global indices never cross this boundary.
218
255
  */
219
256
 
257
+ interface YrsDocxHost {
258
+ document: Document;
259
+ referencedFonts: string[];
260
+ embeddedFonts: Map<string, ArrayBuffer>;
261
+ fontTableRelationshipsXml?: string;
262
+ }
220
263
  /** Durable authorship metadata for one suggested (tracked-change) operation. */
221
264
  interface YrsAuthor {
222
265
  name: string;
@@ -229,6 +272,11 @@ interface YrsLoc {
229
272
  paraId: string;
230
273
  offset: number;
231
274
  }
275
+ /** One binary Yrs position that transforms with collaborative edits. */
276
+ interface YrsStickyPosition {
277
+ story: string;
278
+ encoded: Uint8Array;
279
+ }
232
280
  /** A paragraph-addressed position without the story (used inside {@link YrsStoryRange}). */
233
281
  interface YrsParaOffset {
234
282
  paraId: string;
@@ -810,12 +858,19 @@ interface YrsSession extends CollaborationReplica {
810
858
  } | null;
811
859
  /** Resident display-list hit/range queries; results are small JSON records. */
812
860
  displayHitTestRegionsJson(pageIndex: number, x: number, y: number): string;
861
+ displayVerticalMoveJson(position: number, direction: 'up' | 'down', goalX: number): string;
813
862
  displayRangeRectsJson(from: number, to: number): string;
814
863
  displayRangeRectsRegionJson(region: 'body' | 'header' | 'footer', rId: string, from: number, to: number): string;
815
864
  /** Read a glyph outline from the session's resident font store. */
816
865
  outlineGlyphJson(fontId: number, glyphId: number): string;
817
866
  /** Hydrates from an encoded yrs v1 update (typically a peer's {@link encodeState} output). */
818
867
  loadState(update: Uint8Array): void;
868
+ /** Parses a DOCX, seeds its stories, and returns thin host metadata. */
869
+ seedFromDocx(bytes: Uint8Array): YrsDocxHost;
870
+ /** Parses a DOCX and optionally seeds its stories. */
871
+ openDocx(bytes: Uint8Array, seedStories: boolean): YrsDocxHost;
872
+ /** Materializes the retained canonical package for compatibility APIs. */
873
+ materializeDocx(): Document | null;
819
874
  /**
820
875
  * Seeds stories from parsed content (S1 scaffold; the real
821
876
  * `load(ParsedDocument)` lands with the ops track). Returns paraIds per
@@ -829,7 +884,7 @@ interface YrsSession extends CollaborationReplica {
829
884
  /** Full state, or only the state missing from a peer vector. */
830
885
  encodeStateAsUpdate(remoteStateVector?: Uint8Array): Uint8Array;
831
886
  /** Applies a remote/incremental yrs v1 update. */
832
- applyUpdate(update: Uint8Array): void;
887
+ applyUpdate(update: Uint8Array): CollaborationTextInsertion | null;
833
888
  /** Apply a same-user worker update under the local undo origin. @internal */
834
889
  applyLocalUpdate(update: Uint8Array, story: string): void;
835
890
  /**
@@ -837,10 +892,18 @@ interface YrsSession extends CollaborationReplica {
837
892
  * applied-remote). Returns an unsubscribe function.
838
893
  */
839
894
  onUpdate(listener: (update: Uint8Array, origin: CollaborationUpdateOrigin) => void): () => void;
895
+ /** Encode one location as a binary Yrs sticky position. */
896
+ encodeStickyPosition(loc: YrsLoc): YrsStickyPosition;
897
+ /** Resolve a binary Yrs sticky position against this replica. */
898
+ resolveStickyPosition(position: YrsStickyPosition): YrsLoc | null;
840
899
  /** Store this peer's awareness selection as sticky positions. */
841
900
  setSelection(anchor: YrsLoc, head?: YrsLoc): void;
842
901
  /** Resolve this peer's current sticky selection, or null before initialization. */
843
902
  selection(): YrsSelection | null;
903
+ /** Encode the current selection as binary Yrs sticky indices. */
904
+ encodeSelection(): CollaborationCursor | null;
905
+ /** Resolve a peer's binary Yrs sticky indices against this replica. */
906
+ resolveSelection(cursor: CollaborationCursor): YrsSelection | null;
844
907
  /** Store this peer's rectangular table selection outside the document. */
845
908
  setCellSelection(range: YrsTableRange): void;
846
909
  /** Resolve the current sticky cell selection, or null before initialization. */
@@ -1007,4 +1070,4 @@ interface CreateYrsSessionOptions {
1007
1070
  */
1008
1071
  declare function createYrsSession(options?: CreateYrsSessionOptions): Promise<YrsSession>;
1009
1072
 
1010
- export { type YrsRunMark as $, type YrsEngineApplyProfile as A, type YrsHyperlinkAttrs as B, type CollaborationReplica as C, type YrsImageGeometry as D, type YrsInlineFormatDelta as E, type YrsInputParagraphSeed as F, type YrsInputParagraphSpan as G, type YrsInputPositionMap as H, type YrsNumberingProperties as I, type YrsParaOffset as J, type YrsParagraph as K, type YrsParagraphAttrs as L, type YrsParagraphLength as M, type YrsParagraphReceipt as N, type YrsParagraphSeed as O, type YrsParagraphSpan as P, type YrsParagraphTabStop as Q, type ResidentCaretPaintStyle as R, type YrsRawOp as S, type YrsResidentCaretRect as T, type YrsResidentCaretSnapshot as U, type YrsResidentWorkerSnapshot as V, type YrsResidentWorkerSyncOptions as W, type YrsResolveReceipt as X, type YrsSession as Y, type YrsResolvedCommentAnchor as Z, type YrsRevisionReceipt as _, type YrsRenderEnv as a, type YrsSelectionContext as a0, type YrsSplitReceipt as a1, type YrsStoryRange as a2, type YrsStorySeed as a3, type YrsStorySegment as a4, type YrsTableLoc as a5, type YrsTableRange as a6, type YrsTableReceipt as a7, type YrsTextColor as a8, type YrsTriState as a9, type YrsWatermark as aa, canUseResidentEngineWorker as ab, compareYrsLocs as ac, createYrsInputPositionMap as ad, createYrsSession as ae, displayPositionToYrsLoc as af, documentToYrs as ag, residentCaretDeviceRect as ah, residentCaretSnapshotForFrame as ai, sameYrsSelection as aj, yrsLocToDisplayPosition as ak, yrsToDocument as al, type CollaborationTransport as b, type CollaborationProviderOptions as c, type CollaborationStatus as d, type CollaborationStatusListener as e, type CollaborationErrorListener as f, type YrsSelection as g, CollaborationError as h, type CollaborationErrorCode as i, type CollaborationStatusChange as j, type CollaborationTransportEvent as k, type CollaborationUpdateOrigin as l, type YrsLoc as m, type YrsRevisionInfo as n, type CreateYrsSessionOptions as o, type ResidentEngineOffscreenPage as p, type ResidentEngineWorkerApplyResult as q, ResidentEngineWorkerClient as r, type ResidentEngineWorkerFrame as s, type YrsAuthor as t, type YrsCellBorder as u, type YrsCellBorders as v, type YrsCellLoc as w, type YrsChangeTarget as x, type YrsCommentReceipt as y, type YrsContentControlValue as z };
1073
+ export { type YrsParagraphTabStop as $, type ResidentEngineWorkerFrame as A, type YrsAuthor as B, type CollaborationReplica as C, type YrsCellBorder as D, type YrsCellBorders as E, type YrsCellLoc as F, type YrsChangeTarget as G, type YrsCommentReceipt as H, type YrsContentControlValue as I, type YrsDocxHost as J, type YrsEngineApplyProfile as K, type YrsHyperlinkAttrs as L, type YrsImageGeometry as M, type YrsInlineFormatDelta as N, type YrsInputParagraphSeed as O, type YrsInputParagraphSpan as P, type YrsInputPositionMap as Q, type ResidentCaretPaintStyle as R, type YrsNumberingProperties as S, type YrsParaOffset as T, type YrsParagraph as U, type YrsParagraphAttrs as V, type YrsParagraphLength as W, type YrsParagraphReceipt as X, type YrsSession as Y, type YrsParagraphSeed as Z, type YrsParagraphSpan as _, type YrsRenderEnv as a, type YrsRawOp as a0, type YrsResidentCaretRect as a1, type YrsResidentCaretSnapshot as a2, type YrsResidentWorkerSnapshot as a3, type YrsResidentWorkerSyncOptions as a4, type YrsResolveReceipt as a5, type YrsResolvedCommentAnchor as a6, type YrsRevisionReceipt as a7, type YrsRunMark as a8, type YrsSelectionContext as a9, type YrsSplitReceipt as aa, type YrsStickyPosition as ab, type YrsStoryRange as ac, type YrsStorySeed as ad, type YrsStorySegment as ae, type YrsTableLoc as af, type YrsTableRange as ag, type YrsTableReceipt as ah, type YrsTextColor as ai, type YrsTriState as aj, type YrsWatermark as ak, canUseResidentEngineWorker as al, compareYrsLocs as am, createYrsInputPositionMap as an, createYrsSession as ao, displayPositionToYrsLoc as ap, documentToYrs as aq, residentCaretDeviceRect as ar, residentCaretSnapshotForFrame as as, sameYrsSelection as at, yrsLocToDisplayPosition as au, yrsToDocument as av, type CollaborationTransport as b, type CollaborationProviderOptions as c, type CollaborationStatus as d, type CollaborationPeer as e, type CollaborationCursor as f, type CollaborationPeerListener as g, type CollaborationStatusListener as h, type CollaborationErrorListener as i, type YrsSelection as j, type CollaborationAwarenessState as k, CollaborationError as l, type CollaborationErrorCode as m, type CollaborationPresence as n, type CollaborationResolvedUser as o, type CollaborationStatusChange as p, type CollaborationTextInsertion as q, type CollaborationTransportEvent as r, type CollaborationUpdateOrigin as s, type CollaborationUser as t, type YrsLoc as u, type YrsRevisionInfo as v, type CreateYrsSessionOptions as w, type ResidentEngineOffscreenPage as x, type ResidentEngineWorkerApplyResult as y, ResidentEngineWorkerClient as z };
@@ -1,13 +1,14 @@
1
1
  export { B as BundledFontProvider, E as EmbeddedFaceInput, F as FontScript, a as ResidentFontRequirement, R as ResidentMeasurementConfig, b as RustMeasureSource, c as RustTextEngine, d as createRustMeasureSource, g as getRustTextEngine } from '../rustMeasureSource-D1KsQvVC.mjs';
2
+ import { S as SectionProperties, H as HeaderFooter } from '../content-C3sTRz-u.mjs';
3
+ export { D as DrawingScene, T as DrawingSceneNode, c as ShapeEffect, aU as ShapeFillPaint, aV as ShapeStrokePaint, d as ShapeTextBodyProperties } from '../content-C3sTRz-u.mjs';
2
4
  import { Document } from '../types/document.mjs';
3
- import { S as SectionProperties, H as HeaderFooter } from '../content-MOZ6hKP4.mjs';
4
- import { a as DisplayListQueries, D as DisplayListRect } from '../displayListQueries-BJlo7Jkz.mjs';
5
- import '../formatting-D1EPSaJP.mjs';
6
- import '../styles-Dn_o3Vo5.mjs';
5
+ import { a as DisplayListQueries, D as DisplayListRect } from '../displayListQueries-DLzpvJV6.mjs';
6
+ import '../formatting-BEkIBePP.mjs';
7
7
  import '../docx/wrapTypes.mjs';
8
- import '../frameDelta-D965X8yK.mjs';
9
- import '../rustDisplayList-BRuZBqdL.mjs';
10
- import '../types-BfqUl2h_.mjs';
8
+ import '../styles-BK3Jecxs.mjs';
9
+ import '../frameDelta-B2kC6XiP.mjs';
10
+ import '../rustDisplayList-B0M2eBkU.mjs';
11
+ import '../types-C1rv3KM-.mjs';
11
12
  import './pagination/index.mjs';
12
13
 
13
14
  /**
@@ -1 +1 @@
1
- import {d,e,g as g$1,c,f,b as b$1}from'../chunk-TTRUPDAB.mjs';function x(o){return o.trim().toLowerCase()}function B(o,e,t){return `${x(o)}|${e?1:0}|${t?1:0}`}var I=class{constructor(e,t){b$1(this,"sink");b$1(this,"bundled");b$1(this,"facesByFamily",new Map);b$1(this,"faceIds",new WeakMap);b$1(this,"bundledIds",new Map);b$1(this,"lastResortIds",new Map);b$1(this,"bufferIds",new WeakMap);b$1(this,"scriptIds",new Map);b$1(this,"scriptResults",new Map);b$1(this,"chains",new Map);b$1(this,"chainResults",new Map);b$1(this,"generation",0);this.sink=e,this.bundled=t?.bundled;}setEmbeddedFaces(e){this.generation++,this.facesByFamily=new Map;for(let t of e){let n=x(t.family),r=this.facesByFamily.get(n);r?r.push(t):this.facesByFamily.set(n,[t]);}this.chains=new Map,this.chainResults=new Map;}getFontIdChain(e,t,n){let r=B(e,t,n),i=this.chains.get(r);return i||(i=this.resolveChain(r,e,t,n),this.chains.set(r,i)),i}getCachedFontIdChain(e,t,n){return this.chainResults.get(B(e,t,n))}getScriptFallbackIds(e){let t=[...new Set(e)];return Promise.all(t.map(n=>this.resolveScript(n))).then(n=>{let r=[];for(let i of n)i!==null&&!r.includes(i)&&r.push(i);return r})}getCachedScriptFallbackIds(e){let t=[];for(let n of e){if(!this.scriptResults.has(n))return;let r=this.scriptResults.get(n);r!==null&&!t.includes(r)&&t.push(r);}return t}clear(){this.generation++,this.faceIds=new WeakMap,this.bundledIds=new Map,this.lastResortIds=new Map,this.bufferIds=new WeakMap,this.scriptIds=new Map,this.scriptResults=new Map,this.chains=new Map,this.chainResults=new Map;}async resolveChain(e,t,n,r){let i=this.generation,s=[],a=this.pickEmbeddedFace(t,n,r);if(a){let l=await this.registerFace(a);l!==null&&s.push(l);}let f=this.bundled?.resolve(t,n,r);if(f){let l=await this.registerBundled(e,f,t);l!==null&&!s.includes(l)&&s.push(l);}let h=this.bundled?.resolveLastResort?.(t,n,r);if(h){let l=await this.registerLastResort(e,h,t);l!==null&&!s.includes(l)&&s.push(l);}return i===this.generation&&this.chainResults.set(e,s),s}pickEmbeddedFace(e,t,n){let r=this.facesByFamily.get(x(e));if(!r)return;let i=t?"bold":"normal",s=n?"italic":"normal";return r.find(a=>a.weight===i&&a.style===s)??r.find(a=>a.weight==="normal"&&a.style==="normal")}registerBuffer(e){let t=this.bufferIds.get(e);return t||(t=Promise.resolve().then(()=>this.sink.registerFont(new Uint8Array(e))),t.catch(()=>{}),this.bufferIds.set(e,t)),t}registerFace(e){let t=this.faceIds.get(e);return t||(t=(async()=>{try{return await this.registerBuffer(e.data)}catch{return console.warn(`[fontRegistry] embedded face "${e.family}" (${e.weight} ${e.style}) was rejected by the text engine; falling back`),null}})(),this.faceIds.set(e,t)),t}registerBundled(e,t,n){let r=this.bundledIds.get(e);return r||(r=(async()=>{try{let i=await t();return await this.registerBuffer(i)}catch{return console.warn(`[fontRegistry] bundled face for "${n}" failed to load or register; falling back`),null}})(),this.bundledIds.set(e,r)),r}registerLastResort(e,t,n){let r=this.lastResortIds.get(e);return r||(r=(async()=>{try{let i=await t();return await this.registerBuffer(i)}catch{return console.warn(`[fontRegistry] last-resort base face for "${n}" failed to load or register; falling back`),null}})(),this.lastResortIds.set(e,r)),r}resolveScript(e){let t=this.scriptIds.get(e);if(!t){let n=this.scriptResults;t=(async()=>{let r=null,i=this.bundled?.resolveScriptFallback?.(e,false,false);if(i)try{let s=await i();r=await this.registerBuffer(s);}catch{console.warn(`[fontRegistry] script-fallback face for "${e}" failed to load or register; falling back`);}return n.set(e,r),r})(),this.scriptIds.set(e,t);}return t}};var L=null;function T(){return L??(L=import('../wasm-DO3BUV7C.mjs').then(async o=>(await o.preloadLayoutWasm(),{registerFont:o.registerMeasureFont,clearFonts:o.clearMeasureFonts}))),L}function H(o){let e=new I({registerFont:n=>o.engine.registerFont(n)},{bundled:o.bundled}),t;return {setEmbeddedFaces(n){e.setEmbeddedFaces(n);},setCompat(n){t=n;},async prepareFontRequirements(n){return (await Promise.all(n.flatMap(i=>[(async()=>{try{return e.getCachedFontIdChain(i.family,i.bold,i.italic)!==void 0?!1:(await e.getFontIdChain(i.family,i.bold,i.italic),!0)}catch{return false}})(),...Array.from(new Set(i.scripts??[]),async s=>{try{return e.getCachedScriptFallbackIds([s])!==void 0?!1:(await e.getScriptFallbackIds([s]),!0)}catch{return false}})]))).some(Boolean)},measurementConfigForRequirements(n){let r={};for(let i of n){let s=e.getCachedFontIdChain(i.family,i.bold,i.italic),a=e.getCachedScriptFallbackIds(i.scripts??[]);if(s===void 0||a===void 0)return;let f=Array.from(s);for(let h of a)f.includes(h)||f.push(h);f.length>0&&(r[i.key]=f);}return {fontChains:r,defaults:{fontSize:11,fontFamily:"Calibri"},compat:{noLeading:t?.noLeading??false,doNotExpandShiftReturn:t?.doNotExpandShiftReturn??false},authoritativeShaping:true}},clear(){e.clear();}}}var q=1056;function A(o,e){let t=o?.package.headers,n=o?.package.footers,r=e?.headerReferences?.find(y=>y.type==="default"),i=e?.headerReferences?.find(y=>y.type==="first"),s=e?.footerReferences?.find(y=>y.type==="default"),a=e?.footerReferences?.find(y=>y.type==="first"),f=r?t?.get(r.rId)??null:null,h=s?n?.get(s.rId)??null:null,l=i?t?.get(i.rId)??null:null,M=a?n?.get(a.rId)??null:null;return e?.titlePg||(f??(f=l),h??(h=M)),{header:f,footer:h,firstHeader:l,firstFooter:M}}function D(o,e,t,n,r){let i=o.hfCaretRects(e,t,n);return r===void 0?i:i.filter(s=>s.pageIndex===r)}function $(o,e,t,n,r,i){let s=o.hfRangeRects(e,t,Math.min(n,r),Math.max(n,r));return i===void 0?s:s.filter(a=>a.pageIndex===i)}var p,m,g,b,R,w,E,C=class{constructor(){d(this,w);d(this,p,0);d(this,m,0);d(this,g,false);d(this,b,false);d(this,R,new Set);}setStateSeq(e$1){e(this,p,e$1);}incrementStateSeq(){return ++g$1(this,p)._}getStateSeq(){return c(this,p)}getRenderSeq(){return c(this,m)}onLayoutStart(){e(this,g,true);}onLayoutComplete(e$1){e(this,m,e$1),e(this,g,false),c(this,b)&&this.isSafeToRender()&&(e(this,b,false),f(this,w,E).call(this));}isSafeToRender(){return !c(this,g)&&c(this,m)>=c(this,p)}requestRender(){this.isSafeToRender()?f(this,w,E).call(this):e(this,b,true);}onRender(e){return c(this,R).add(e),()=>c(this,R).delete(e)}reset(){e(this,p,0),e(this,m,0),e(this,g,false),e(this,b,false);}getDebugInfo(){return {stateSeq:c(this,p),renderSeq:c(this,m),layoutUpdating:c(this,g),hasPendingRender:c(this,b),isSafe:this.isSafeToRender()}}};p=new WeakMap,m=new WeakMap,g=new WeakMap,b=new WeakMap,R=new WeakMap,w=new WeakSet,E=function(){for(let e of c(this,R))try{e();}catch(t){console.error("LayoutSelectionGate: render callback error",t);}};export{q as DEFAULT_PAGE_HEIGHT_PX,C as LayoutSelectionGate,D as computeHfCaretRectsFromDisplayList,$ as computeHfSelectionRectsFromDisplayList,H as createRustMeasureSource,T as getRustTextEngine,A as resolveHeaderFooter};
1
+ import {d,e,g as g$1,c,f,b as b$1}from'../chunk-TTRUPDAB.mjs';function x(o){return o.trim().toLowerCase()}function B(o,e,t){return `${x(o)}|${e?1:0}|${t?1:0}`}var I=class{constructor(e,t){b$1(this,"sink");b$1(this,"bundled");b$1(this,"facesByFamily",new Map);b$1(this,"faceIds",new WeakMap);b$1(this,"bundledIds",new Map);b$1(this,"lastResortIds",new Map);b$1(this,"bufferIds",new WeakMap);b$1(this,"scriptIds",new Map);b$1(this,"scriptResults",new Map);b$1(this,"chains",new Map);b$1(this,"chainResults",new Map);b$1(this,"generation",0);this.sink=e,this.bundled=t?.bundled;}setEmbeddedFaces(e){this.generation++,this.facesByFamily=new Map;for(let t of e){let n=x(t.family),r=this.facesByFamily.get(n);r?r.push(t):this.facesByFamily.set(n,[t]);}this.chains=new Map,this.chainResults=new Map;}getFontIdChain(e,t,n){let r=B(e,t,n),i=this.chains.get(r);return i||(i=this.resolveChain(r,e,t,n),this.chains.set(r,i)),i}getCachedFontIdChain(e,t,n){return this.chainResults.get(B(e,t,n))}getScriptFallbackIds(e){let t=[...new Set(e)];return Promise.all(t.map(n=>this.resolveScript(n))).then(n=>{let r=[];for(let i of n)i!==null&&!r.includes(i)&&r.push(i);return r})}getCachedScriptFallbackIds(e){let t=[];for(let n of e){if(!this.scriptResults.has(n))return;let r=this.scriptResults.get(n);r!==null&&!t.includes(r)&&t.push(r);}return t}clear(){this.generation++,this.faceIds=new WeakMap,this.bundledIds=new Map,this.lastResortIds=new Map,this.bufferIds=new WeakMap,this.scriptIds=new Map,this.scriptResults=new Map,this.chains=new Map,this.chainResults=new Map;}async resolveChain(e,t,n,r){let i=this.generation,s=[],a=this.pickEmbeddedFace(t,n,r);if(a){let l=await this.registerFace(a);l!==null&&s.push(l);}let f=this.bundled?.resolve(t,n,r);if(f){let l=await this.registerBundled(e,f,t);l!==null&&!s.includes(l)&&s.push(l);}let h=this.bundled?.resolveLastResort?.(t,n,r);if(h){let l=await this.registerLastResort(e,h,t);l!==null&&!s.includes(l)&&s.push(l);}return i===this.generation&&this.chainResults.set(e,s),s}pickEmbeddedFace(e,t,n){let r=this.facesByFamily.get(x(e));if(!r)return;let i=t?"bold":"normal",s=n?"italic":"normal";return r.find(a=>a.weight===i&&a.style===s)??r.find(a=>a.weight==="normal"&&a.style==="normal")}registerBuffer(e){let t=this.bufferIds.get(e);return t||(t=Promise.resolve().then(()=>this.sink.registerFont(new Uint8Array(e))),t.catch(()=>{}),this.bufferIds.set(e,t)),t}registerFace(e){let t=this.faceIds.get(e);return t||(t=(async()=>{try{return await this.registerBuffer(e.data)}catch{return console.warn(`[fontRegistry] embedded face "${e.family}" (${e.weight} ${e.style}) was rejected by the text engine; falling back`),null}})(),this.faceIds.set(e,t)),t}registerBundled(e,t,n){let r=this.bundledIds.get(e);return r||(r=(async()=>{try{let i=await t();return await this.registerBuffer(i)}catch{return console.warn(`[fontRegistry] bundled face for "${n}" failed to load or register; falling back`),null}})(),this.bundledIds.set(e,r)),r}registerLastResort(e,t,n){let r=this.lastResortIds.get(e);return r||(r=(async()=>{try{let i=await t();return await this.registerBuffer(i)}catch{return console.warn(`[fontRegistry] last-resort base face for "${n}" failed to load or register; falling back`),null}})(),this.lastResortIds.set(e,r)),r}resolveScript(e){let t=this.scriptIds.get(e);if(!t){let n=this.scriptResults;t=(async()=>{let r=null,i=this.bundled?.resolveScriptFallback?.(e,false,false);if(i)try{let s=await i();r=await this.registerBuffer(s);}catch{console.warn(`[fontRegistry] script-fallback face for "${e}" failed to load or register; falling back`);}return n.set(e,r),r})(),this.scriptIds.set(e,t);}return t}};var L=null;function T(){return L??(L=import('../wasm-JE7B3ROD.mjs').then(async o=>(await o.preloadLayoutWasm(),{registerFont:o.registerMeasureFont,clearFonts:o.clearMeasureFonts}))),L}function H(o){let e=new I({registerFont:n=>o.engine.registerFont(n)},{bundled:o.bundled}),t;return {setEmbeddedFaces(n){e.setEmbeddedFaces(n);},setCompat(n){t=n;},async prepareFontRequirements(n){return (await Promise.all(n.flatMap(i=>[(async()=>{try{return e.getCachedFontIdChain(i.family,i.bold,i.italic)!==void 0?!1:(await e.getFontIdChain(i.family,i.bold,i.italic),!0)}catch{return false}})(),...Array.from(new Set(i.scripts??[]),async s=>{try{return e.getCachedScriptFallbackIds([s])!==void 0?!1:(await e.getScriptFallbackIds([s]),!0)}catch{return false}})]))).some(Boolean)},measurementConfigForRequirements(n){let r={};for(let i of n){let s=e.getCachedFontIdChain(i.family,i.bold,i.italic),a=e.getCachedScriptFallbackIds(i.scripts??[]);if(s===void 0||a===void 0)return;let f=Array.from(s);for(let h of a)f.includes(h)||f.push(h);f.length>0&&(r[i.key]=f);}return {fontChains:r,defaults:{fontSize:11,fontFamily:"Calibri"},compat:{noLeading:t?.noLeading??false,doNotExpandShiftReturn:t?.doNotExpandShiftReturn??false},authoritativeShaping:true}},clear(){e.clear();}}}var q=1056;function A(o,e){let t=o?.package.headers,n=o?.package.footers,r=e?.headerReferences?.find(y=>y.type==="default"),i=e?.headerReferences?.find(y=>y.type==="first"),s=e?.footerReferences?.find(y=>y.type==="default"),a=e?.footerReferences?.find(y=>y.type==="first"),f=r?t?.get(r.rId)??null:null,h=s?n?.get(s.rId)??null:null,l=i?t?.get(i.rId)??null:null,k=a?n?.get(a.rId)??null:null;return e?.titlePg||(f??(f=l),h??(h=k)),{header:f,footer:h,firstHeader:l,firstFooter:k}}function D(o,e,t,n,r){let i=o.hfCaretRects(e,t,n);return r===void 0?i:i.filter(s=>s.pageIndex===r)}function $(o,e,t,n,r,i){let s=o.hfRangeRects(e,t,Math.min(n,r),Math.max(n,r));return i===void 0?s:s.filter(a=>a.pageIndex===i)}var p,m,g,b,R,w,E,C=class{constructor(){d(this,w);d(this,p,0);d(this,m,0);d(this,g,false);d(this,b,false);d(this,R,new Set);}setStateSeq(e$1){e(this,p,e$1);}incrementStateSeq(){return ++g$1(this,p)._}getStateSeq(){return c(this,p)}getRenderSeq(){return c(this,m)}onLayoutStart(){e(this,g,true);}onLayoutComplete(e$1){e(this,m,e$1),e(this,g,false),c(this,b)&&this.isSafeToRender()&&(e(this,b,false),f(this,w,E).call(this));}isSafeToRender(){return !c(this,g)&&c(this,m)>=c(this,p)}requestRender(){this.isSafeToRender()?f(this,w,E).call(this):e(this,b,true);}onRender(e){return c(this,R).add(e),()=>c(this,R).delete(e)}reset(){e(this,p,0),e(this,m,0),e(this,g,false),e(this,b,false);}getDebugInfo(){return {stateSeq:c(this,p),renderSeq:c(this,m),layoutUpdating:c(this,g),hasPendingRender:c(this,b),isSafe:this.isSafeToRender()}}};p=new WeakMap,m=new WeakMap,g=new WeakMap,b=new WeakMap,R=new WeakMap,w=new WeakSet,E=function(){for(let e of c(this,R))try{e();}catch(t){console.error("LayoutSelectionGate: render callback error",t);}};export{q as DEFAULT_PAGE_HEIGHT_PX,C as LayoutSelectionGate,D as computeHfCaretRectsFromDisplayList,$ as computeHfSelectionRectsFromDisplayList,H as createRustMeasureSource,T as getRustTextEngine,A as resolveHeaderFooter};
@@ -1,7 +1,7 @@
1
- import { L as LayoutBlock, B as BlockExtent } from '../../types-BfqUl2h_.mjs';
2
- export { A as AnchoredObjectPositionInput, d as BlockId, e as BorderStyle, C as CellBorderSpec, f as CellBorders, g as ChartBlock, h as ChartExtent, i as ChartFragment, j as ColumnBreakBlock, k as ColumnBreakExtent, l as ColumnLayout, D as DEFAULT_TEXTBOX_MARGINS, m as DEFAULT_TEXTBOX_WIDTH, n as DocumentPosition, o as FieldRun, p as FloatingTablePosition, F as FootnoteContent, q as FootnoteRenderItem, r as Fragment, s as FragmentBase, H as HeaderFooterContent, t as HeaderFooterContentHeights, u as HeaderFooterLayout, v as HitTestResult, w as HyperlinkInfo, I as ImageBlock, x as ImageExtent, y as ImageFragment, z as ImageRun, E as ImageRunPosition, G as InlineSdtWidget, a as Layout, b as LayoutOptions, J as LineBreakRun, K as ListNumPr, N as NoteAreaContract, M as NoteLayoutItem, O as NoteSettingsContract, P as Page, Q as PageBorderContract, S as PageBreakBlock, T as PageBreakExtent, U as PageGeometry, V as PageHeaderFooterRefs, W as PageMargins, X as PageNumberingContract, Y as ParagraphAttrs, Z as ParagraphBlock, _ as ParagraphBorders, $ as ParagraphExtent, a0 as ParagraphFragment, a1 as ParagraphIndent, a2 as ParagraphSpacing, R as ResolvedLine, c as ResolvedSegment, a3 as Run, a4 as RunFontSlots, a5 as RunFormatting, a6 as RunLanguageSlots, a7 as SdtGroup, a8 as SectionBreakBlock, a9 as SectionBreakExtent, aa as ShapeBlock, ab as ShapeBlockFill, ac as ShapeBlockStroke, ad as ShapeBlockTransform, ae as ShapeExtent, af as ShapeFragment, ag as TabAlignment, ah as TabRun, ai as TabStop, aj as TableBlock, ak as TableCell, al as TableCellExtent, am as TableExtent, an as TableFragment, ao as TableRow, ap as TableRowExtent, aq as TextBoxBlock, ar as TextBoxExtent, as as TextBoxFragment, at as TextRun, au as TypesetBidiSlice, av as TypesetClusterAdvance, aw as TypesetRow, ax as TypesetRowSegment, ay as TypesetRunAdvance, az as WrapTextDirection, aA as assertExhaustiveLayoutBlock, aB as isTextWrappingFloatingImageRun, aC as pageGeometryFromPage, aD as resolveAnchoredObjectVerticalTop } from '../../types-BfqUl2h_.mjs';
3
- import '../../content-MOZ6hKP4.mjs';
4
- import '../../formatting-D1EPSaJP.mjs';
1
+ import { L as LayoutBlock, B as BlockExtent } from '../../types-C1rv3KM-.mjs';
2
+ export { A as AnchoredObjectPositionInput, d as BlockId, e as BorderStyle, C as CellBorderSpec, f as CellBorders, g as ChartBlock, h as ChartExtent, i as ChartFragment, j as ColumnBreakBlock, k as ColumnBreakExtent, l as ColumnLayout, D as DEFAULT_TEXTBOX_MARGINS, m as DEFAULT_TEXTBOX_WIDTH, n as DocumentPosition, o as FieldRun, p as FloatingTablePosition, F as FootnoteContent, q as FootnoteRenderItem, r as Fragment, s as FragmentBase, H as HeaderFooterContent, t as HeaderFooterContentHeights, u as HeaderFooterLayout, v as HitTestResult, w as HyperlinkInfo, I as ImageBlock, x as ImageExtent, y as ImageFragment, z as ImageRun, E as ImageRunPosition, G as InlineSdtWidget, a as Layout, b as LayoutOptions, J as LineBreakRun, K as ListNumPr, N as NoteAreaContract, M as NoteLayoutItem, O as NoteSettingsContract, P as Page, Q as PageBorderContract, S as PageBreakBlock, T as PageBreakExtent, U as PageGeometry, V as PageHeaderFooterRefs, W as PageMargins, X as PageNumberingContract, Y as ParagraphAttrs, Z as ParagraphBlock, _ as ParagraphBorders, $ as ParagraphExtent, a0 as ParagraphFragment, a1 as ParagraphIndent, a2 as ParagraphSpacing, R as ResolvedLine, c as ResolvedSegment, a3 as Run, a4 as RunFontSlots, a5 as RunFormatting, a6 as RunLanguageSlots, a7 as SdtGroup, a8 as SectionBreakBlock, a9 as SectionBreakExtent, aa as ShapeBlock, ab as ShapeBlockFill, ac as ShapeBlockStroke, ad as ShapeBlockTransform, ae as ShapeExtent, af as ShapeFragment, ag as TabAlignment, ah as TabRun, ai as TabStop, aj as TableBlock, ak as TableCell, al as TableCellExtent, am as TableExtent, an as TableFragment, ao as TableRow, ap as TableRowExtent, aq as TextBoxBlock, ar as TextBoxExtent, as as TextBoxFragment, at as TextRun, au as TypesetBidiSlice, av as TypesetClusterAdvance, aw as TypesetRow, ax as TypesetRowSegment, ay as TypesetRunAdvance, az as WrapTextDirection, aA as assertExhaustiveLayoutBlock, aB as isTextWrappingFloatingImageRun, aC as pageGeometryFromPage, aD as resolveAnchoredObjectVerticalTop } from '../../types-C1rv3KM-.mjs';
3
+ import '../../content-C3sTRz-u.mjs';
4
+ import '../../formatting-BEkIBePP.mjs';
5
5
  import '../../docx/wrapTypes.mjs';
6
6
 
7
7
  interface MeasuredBlock {
@@ -1 +1 @@
1
- import {b as b$2,c as c$1}from'../../chunk-OBQGPMPQ.mjs';import {b as b$1}from'../../chunk-3UBMCDME.mjs';import'../../chunk-TTRUPDAB.mjs';var c={top:4,bottom:4,left:7,right:7},h=200;function y(e,r){let o=e.kind??"<unknown>";throw new Error(`${r}: unhandled LayoutBlock kind "${o}". Add the case alongside the other LayoutBlock switches (see types.ts).`)}function x(e){return {pageWidth:e.size.w,pageHeight:e.size.h,marginLeft:e.margins.left,marginTop:e.margins.top,contentWidth:e.size.w-e.margins.left-e.margins.right,contentHeight:e.size.h-e.margins.top-e.margins.bottom}}function f(e,r,o){return l(e,r,o)}function l(e,r,o){let n=e.position?.vertical;if(!n)return r;let t=b(n.relativeTo,r,o);return n.align==="top"?t.base:n.align==="center"?t.size?t.base+(t.size-e.height)/2:r:n.align==="bottom"?t.size?t.base+t.size-e.height:r:n.posOffset!==void 0?t.base+b$1(n.posOffset):n.relativeTo==="paragraph"||n.relativeTo==="line"?r:t.base}function b(e,r,o){let n=o?.pageHeight??0,t=o?.marginTop??0,a=o?.contentHeight??0;switch(e){case "paragraph":case "line":return {base:r,size:0};case "page":return {base:-t,size:n};case "topMargin":return {base:-t,size:t};case "bottomMargin":return {base:a,size:t};default:return {base:0,size:a}}}function k(e){return b$2(e.wrapType)||e.wrapType==="topAndBottom"?false:c$1(e.wrapType)?true:e.displayMode==="float"&&e.cssFloat!=="none"}export{c as DEFAULT_TEXTBOX_MARGINS,h as DEFAULT_TEXTBOX_WIDTH,y as assertExhaustiveLayoutBlock,k as isTextWrappingFloatingImageRun,x as pageGeometryFromPage,f as resolveAnchoredObjectVerticalTop};
1
+ import {b as b$2,c as c$1}from'../../chunk-OBQGPMPQ.mjs';import {b as b$1}from'../../chunk-CTBUQRYQ.mjs';import'../../chunk-TTRUPDAB.mjs';var c={top:4,bottom:4,left:7,right:7},h=200;function y(e,r){let o=e.kind??"<unknown>";throw new Error(`${r}: unhandled LayoutBlock kind "${o}". Add the case alongside the other LayoutBlock switches (see types.ts).`)}function x(e){return {pageWidth:e.size.w,pageHeight:e.size.h,marginLeft:e.margins.left,marginTop:e.margins.top,contentWidth:e.size.w-e.margins.left-e.margins.right,contentHeight:e.size.h-e.margins.top-e.margins.bottom}}function f(e,r,o){return l(e,r,o)}function l(e,r,o){let n=e.position?.vertical;if(!n)return r;let t=b(n.relativeTo,r,o);return n.align==="top"?t.base:n.align==="center"?t.size?t.base+(t.size-e.height)/2:r:n.align==="bottom"?t.size?t.base+t.size-e.height:r:n.posOffset!==void 0?t.base+b$1(n.posOffset):n.relativeTo==="paragraph"||n.relativeTo==="line"?r:t.base}function b(e,r,o){let n=o?.pageHeight??0,t=o?.marginTop??0,a=o?.contentHeight??0;switch(e){case "paragraph":case "line":return {base:r,size:0};case "page":return {base:-t,size:n};case "topMargin":return {base:-t,size:t};case "bottomMargin":return {base:a,size:t};default:return {base:0,size:a}}}function k(e){return b$2(e.wrapType)||e.wrapType==="topAndBottom"?false:c$1(e.wrapType)?true:e.displayMode==="float"&&e.cssFloat!=="none"}export{c as DEFAULT_TEXTBOX_MARGINS,h as DEFAULT_TEXTBOX_WIDTH,y as assertExhaustiveLayoutBlock,k as isTextWrappingFloatingImageRun,x as pageGeometryFromPage,f as resolveAnchoredObjectVerticalTop};
@@ -1,17 +1,17 @@
1
- import { a as DisplayPage, b as DisplayPrimitive, D as DisplayList, G as GlyphRunPrimitive, L as LinePrimitive, T as TextRunPrimitive } from '../../frameDelta-D965X8yK.mjs';
2
- export { c as DecodedFrameDelta, d as DecorationPrimitive, e as DisplayBounds, f as DocAttrs, F as FRAME_DELTA_HEADER_BYTES, g as FRAME_DELTA_PAGE_OP_BYTES, h as FRAME_DELTA_VERSION, i as FrameDeltaError, j as FrameDeltaErrorCode, k as FramePageOperation, H as HfRegion, I as ImagePrimitive, P as PositionedGlyph, l as RectPrimitive, R as RetainedFrame, m as RetainedFramePage, n as TableCellRef, o as applyFrameDelta, p as applyFrameDeltaOwned, q as decodeFrameDelta } from '../../frameDelta-D965X8yK.mjs';
3
- export { a as DisplayListBuildInputs, D as DisplayListHeadersFooters, b as DisplayListHfVariant, c as DisplayListPictureWatermark, d as DisplayListTextWatermark, e as DisplayListWatermark, f as RustDisplayFrameResult, g as RustDisplayListEngine, R as RustDisplayListQueryEngine, h as RustDisplayListSourceError, i as RustDisplayListSourceErrorStage, j as buildRustDisplayFrame, k as buildRustDisplayList, l as encodeDisplayListFrameExtras, m as loadRustDisplayListQueryEngine } from '../../rustDisplayList-BRuZBqdL.mjs';
4
- import { a as DisplayListQueries, b as DisplayListRegionHit, D as DisplayListRect } from '../../displayListQueries-BJlo7Jkz.mjs';
5
- export { c as DisplayListHitRegion, d as DisplayListImageGeometry, e as DisplayListImageRegion, f as DisplayListParagraphGeometry, g as DisplayListQuerySourceState, h as DisplayListVisualLine, L as LocatedImagePrimitive, R as ResidentDisplayListQueryEngine, i as captureInlinePositionEmuFromDisplayList, j as createDisplayListQueries, k as findImagePrimitiveAtPoint, l as findImagePrimitiveByDocPos } from '../../displayListQueries-BJlo7Jkz.mjs';
6
- import { m as YrsLoc, Y as YrsSession, n as YrsRevisionInfo } from '../../index-Dx4Z3lkz.mjs';
1
+ import { a as DisplayPage, b as DisplayPrimitive, D as DisplayList, G as GlyphRunPrimitive, L as LinePrimitive, T as TextRunPrimitive } from '../../frameDelta-B2kC6XiP.mjs';
2
+ export { c as DecodedFrameDelta, d as DecorationPrimitive, e as DisplayBounds, f as DocAttrs, F as FRAME_DELTA_HEADER_BYTES, g as FRAME_DELTA_PAGE_OP_BYTES, h as FRAME_DELTA_VERSION, i as FrameDeltaError, j as FrameDeltaErrorCode, k as FramePageOperation, H as HfRegion, I as ImagePrimitive, P as PositionedGlyph, l as RectPrimitive, R as RetainedFrame, m as RetainedFramePage, n as TableCellRef, o as applyFrameDelta, p as applyFrameDeltaOwned, q as decodeFrameDelta } from '../../frameDelta-B2kC6XiP.mjs';
3
+ export { a as DisplayListBuildInputs, D as DisplayListHeadersFooters, b as DisplayListHfVariant, c as DisplayListPictureWatermark, d as DisplayListTextWatermark, e as DisplayListWatermark, f as RustDisplayFrameResult, g as RustDisplayListEngine, R as RustDisplayListQueryEngine, h as RustDisplayListSourceError, i as RustDisplayListSourceErrorStage, j as buildRustDisplayFrame, k as buildRustDisplayList, l as encodeDisplayListFrameExtras, m as loadRustDisplayListQueryEngine } from '../../rustDisplayList-B0M2eBkU.mjs';
4
+ import { a as DisplayListQueries, b as DisplayListRegionHit, D as DisplayListRect } from '../../displayListQueries-DLzpvJV6.mjs';
5
+ export { c as DisplayListHitRegion, d as DisplayListImageGeometry, e as DisplayListImageRegion, f as DisplayListParagraphGeometry, g as DisplayListQuerySourceState, h as DisplayListVerticalMove, i as DisplayListVisualLine, L as LocatedImagePrimitive, R as ResidentDisplayListQueryEngine, j as captureInlinePositionEmuFromDisplayList, k as createDisplayListQueries, l as findImagePrimitiveAtPoint, m as findImagePrimitiveByDocPos, n as isDisplayListQuerySourceDead, o as onDisplayListQuerySourceFailure } from '../../displayListQueries-DLzpvJV6.mjs';
6
+ import { u as YrsLoc, Y as YrsSession, v as YrsRevisionInfo } from '../../index-2piKi4gO.mjs';
7
7
  import { TrackedChangeEntry } from '../../utils/comments.mjs';
8
- import '../../content-MOZ6hKP4.mjs';
9
- import '../../formatting-D1EPSaJP.mjs';
8
+ import '../../formatting-BEkIBePP.mjs';
9
+ import '../../content-C3sTRz-u.mjs';
10
10
  import '../../docx/wrapTypes.mjs';
11
- import '../../types-BfqUl2h_.mjs';
11
+ import '../../types-C1rv3KM-.mjs';
12
12
  import '../pagination/index.mjs';
13
13
  import '../../types/document.mjs';
14
- import '../../styles-Dn_o3Vo5.mjs';
14
+ import '../../styles-BK3Jecxs.mjs';
15
15
 
16
16
  /** a cached glyph: its outline path (font units) plus the font's units-per-em. */
17
17
  interface GlyphOutline {