@docx-editor.dev/core 2.27.0 → 2.29.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 (124) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.ts +76 -16
  3. package/dist/automation.js +1 -1
  4. package/dist/binding.cjs +1 -1
  5. package/dist/binding.d.ts +31 -12
  6. package/dist/binding.js +1 -1
  7. package/dist/{index-CkQVRJtJ.d.ts → chrome-print-CAs51cpq.d.ts} +248 -115
  8. package/dist/chunk-236O4YQW.js +2 -0
  9. package/dist/chunk-4HENIAFG.js +1 -0
  10. package/dist/chunk-6JPL6ZAS.cjs +5 -0
  11. package/dist/chunk-6ZQP4HQ7.js +3 -0
  12. package/dist/{chunk-2GK7YQB2.cjs → chunk-7WQ7AAHW.cjs} +1 -1
  13. package/dist/chunk-BCXH4BXB.js +5 -0
  14. package/dist/chunk-BY2ACZZ6.cjs +1 -0
  15. package/dist/chunk-CAJEXXVG.cjs +4 -0
  16. package/dist/chunk-CPWLFPWC.js +30 -0
  17. package/dist/chunk-D7ZMDMPX.cjs +3 -0
  18. package/dist/chunk-DOHF6FA7.cjs +30 -0
  19. package/dist/chunk-DVX32P2P.js +27 -0
  20. package/dist/chunk-E4LOMDNL.js +1 -0
  21. package/dist/chunk-EKLM7NWB.cjs +7 -0
  22. package/dist/chunk-G3K63G7P.cjs +27 -0
  23. package/dist/chunk-G4HOFIKJ.js +1 -0
  24. package/dist/chunk-JLVBDYVQ.cjs +2 -0
  25. package/dist/chunk-LQX36Z5P.js +7 -0
  26. package/dist/chunk-LSZ6KPKK.js +1 -0
  27. package/dist/chunk-MM5QBMTE.cjs +1 -0
  28. package/dist/chunk-OMCG63ZF.js +1 -0
  29. package/dist/chunk-OSFOJTHU.cjs +18 -0
  30. package/dist/chunk-RCLZXP3B.js +2 -0
  31. package/dist/chunk-T6K2QYNZ.cjs +2 -0
  32. package/dist/chunk-TRGAVV2Y.js +4 -0
  33. package/dist/chunk-U4JZVSOE.js +2 -0
  34. package/dist/chunk-UHHYFIDT.cjs +1 -0
  35. package/dist/chunk-V3N4SOAK.cjs +1 -0
  36. package/dist/chunk-W35WTWAO.cjs +1 -0
  37. package/dist/chunk-YQ5G6LC7.js +18 -0
  38. package/dist/collaboration/replication.cjs +1 -1
  39. package/dist/collaboration/replication.d.ts +42 -6
  40. package/dist/collaboration/replication.js +1 -1
  41. package/dist/collaboration.cjs +1 -1
  42. package/dist/collaboration.d.ts +99 -7
  43. package/dist/collaboration.js +1 -1
  44. package/dist/contracts/document.d.ts +18 -3
  45. package/dist/contracts/editor.d.ts +19 -10
  46. package/dist/contracts/interaction.d.ts +31 -2
  47. package/dist/contracts/modules.cjs +1 -1
  48. package/dist/contracts/modules.d.ts +56 -8
  49. package/dist/contracts/modules.js +1 -1
  50. package/dist/contracts/types.d.ts +11 -2
  51. package/dist/{custom-node-writes-Vzpq9I8_.d.ts → custom-node-writes-Bn6uciLb.d.ts} +2 -2
  52. package/dist/diagnostic-context-B8M79cfK.d.ts +30 -0
  53. package/dist/diagnostic-hints-BeVjfNOv.d.ts +113 -0
  54. package/dist/{document-protection-9zpIHWTE.d.ts → document-protection-CUb55pl_.d.ts} +2 -2
  55. package/dist/{editor-B3OBYNrF.d.ts → editor-CZQZmTIU.d.ts} +770 -141
  56. package/dist/{editor-scope-OHPwVQ5l.d.ts → editor-scope-7o9xweiJ.d.ts} +1 -1
  57. package/dist/editor.cjs +1 -1
  58. package/dist/editor.css +5 -5
  59. package/dist/editor.d.ts +439 -33
  60. package/dist/editor.js +1 -1
  61. package/dist/export.cjs +2 -2
  62. package/dist/export.d.ts +23 -14
  63. package/dist/export.js +2 -2
  64. package/dist/failure-NS2lsya4.d.ts +115 -0
  65. package/dist/{font-resolver-DN0xNOf_.d.ts → font-resolver-lSBLirLR.d.ts} +3 -3
  66. package/dist/{headless-document-view-ICYqNkQ1.d.ts → headless-document-view-pp3q7wIh.d.ts} +2 -2
  67. package/dist/{image-resources-BDFxcu7W.d.ts → image-resources-tXLQShoC.d.ts} +10 -10
  68. package/dist/index.cjs +1 -1
  69. package/dist/index.d.ts +92 -20
  70. package/dist/index.js +1 -1
  71. package/dist/{layout-shaping-BvZD_VKP.d.ts → layout-shaping-BD-dF_rn.d.ts} +1 -1
  72. package/dist/layout.cjs +1 -1
  73. package/dist/layout.d.ts +168 -79
  74. package/dist/layout.js +1 -1
  75. package/dist/{note-properties-CkAk7g-n.d.ts → note-properties-qQUjO1GQ.d.ts} +3 -3
  76. package/dist/{omml-equation-DuczgG5o.d.ts → omml-equation-BUbU0utM.d.ts} +1 -1
  77. package/dist/output.cjs +1 -1
  78. package/dist/output.d.ts +18 -9
  79. package/dist/output.js +1 -1
  80. package/dist/{protocol-aKYr8r3u.d.ts → protocol-DYzzz2ej.d.ts} +44 -4
  81. package/dist/{review-paragraph-order-Ddj5d6rp.d.ts → review-paragraph-order-CN_0l2Cb.d.ts} +5 -2
  82. package/dist/{semantic-cell-selection-DoqYCz_F.d.ts → semantic-cell-selection-eYag3P47.d.ts} +8 -213
  83. package/dist/{semantic-interaction-G0bjmmmk.d.ts → semantic-interaction-kR_QB845.d.ts} +25 -34
  84. package/dist/{semantic-paint-CsMzF8-O.d.ts → semantic-paint-ZayFF3tD.d.ts} +17 -5
  85. package/dist/{semantic-record-queries-1du6lQqS.d.ts → semantic-record-queries-Bsgth6lv.d.ts} +1 -1
  86. package/dist/{semantic-records-B9OolWGN.d.ts → semantic-records-DQmumPgL.d.ts} +1367 -884
  87. package/dist/store.cjs +1 -1
  88. package/dist/store.d.ts +1611 -1586
  89. package/dist/store.js +1 -1
  90. package/dist/{tree-package-fragment-DYZIk1rY.d.ts → tree-package-store-CovjNARF.d.ts} +157 -137
  91. package/dist/{tree-session-contract-DQVJOOkv.d.ts → tree-session-contract-CZVAGl51.d.ts} +8 -6
  92. package/dist/{types-barrel-BFKR8Pzp.d.ts → types-barrel-DuC5QBNC.d.ts} +352 -231
  93. package/package.json +3 -3
  94. package/dist/chunk-4KZ6L5YF.cjs +0 -15
  95. package/dist/chunk-55AT3MOU.cjs +0 -25
  96. package/dist/chunk-6ZQMII6V.js +0 -1
  97. package/dist/chunk-7IGCWG4H.js +0 -2
  98. package/dist/chunk-7MYITTAH.js +0 -5
  99. package/dist/chunk-AVKVRU7Z.cjs +0 -5
  100. package/dist/chunk-CWRBFNK5.cjs +0 -5
  101. package/dist/chunk-DGPA3TST.cjs +0 -27
  102. package/dist/chunk-DNXVNQEO.js +0 -1
  103. package/dist/chunk-FQN4KSFL.cjs +0 -7
  104. package/dist/chunk-GVUOWHTO.cjs +0 -1
  105. package/dist/chunk-GWQJ5774.js +0 -5
  106. package/dist/chunk-HAQ72KD7.js +0 -1
  107. package/dist/chunk-HO5XFO32.cjs +0 -3
  108. package/dist/chunk-IGR23DV2.js +0 -1
  109. package/dist/chunk-JSIX2EOH.js +0 -3
  110. package/dist/chunk-K246T47S.cjs +0 -1
  111. package/dist/chunk-KAXOGCGA.js +0 -1
  112. package/dist/chunk-LZLTN5A3.cjs +0 -1
  113. package/dist/chunk-NBCVVZOM.cjs +0 -1
  114. package/dist/chunk-O5INAWZQ.js +0 -1
  115. package/dist/chunk-OHAXVTWG.cjs +0 -1
  116. package/dist/chunk-S74GRBNE.js +0 -7
  117. package/dist/chunk-UBLUVNZR.js +0 -27
  118. package/dist/chunk-UMRSBLO7.js +0 -15
  119. package/dist/chunk-VIPMGGUT.js +0 -25
  120. package/dist/chunk-WG4KMSX2.cjs +0 -2
  121. package/dist/chunk-WRLKVNNR.cjs +0 -1
  122. package/dist/chunk-ZU7IVN6G.js +0 -2
  123. package/dist/failure-BIPVQbRm.d.ts +0 -65
  124. package/dist/revision-projection-CSNFudZY.d.ts +0 -242
@@ -1,23 +1,19 @@
1
- import { W as TreeDocOp, cl as TextFormFieldRange, ck as TextFormFieldOptions, ah as Unsubscribe, ab as DrawingPositionInput, aJ as DrawingTransform, E as ExecResult, A as ParagraphTabStop, y as IndentFormatting, z as ParagraphFlags, ao as ParagraphDisagreements, aB as DrawingTreeDocOp, ag as SelectionPin, Q as OoxmlPackage, g as ReviewRevisionKind, aa as ImageWrapTarget } from './types-barrel-BFKR8Pzp.js';
2
- import { a as ImageDecodePort, S as SupportedImageMime } from './image-resources-BDFxcu7W.js';
3
- import './document-protection-9zpIHWTE.js';
1
+ import { c as FontConfigurationFragment, g as FontResolver, M as MarkedFontResolver, f as FontResolutionRequest } from './font-resolver-lSBLirLR.js';
2
+ import { p as DocumentSource, P as FontConfiguration, aK as ZoomMode, y as EditorFontError, s as Editor, R as ReviewPaneOptions, b as EditorCommand, C as CanResult, at as SelectedImageState, X as FormatPainterSurfaceState, ar as ScrollPlacement, aI as TrackedChangePredicate, aH as TrackedChangeFilterMode, Q as FontFaceRequest, T as FontSource, a6 as ImageContext, av as TableBorderEdgeTarget, aw as TableBorderSpec, ax as TableBorderStyle, aC as TableContext } from './editor-CZQZmTIU.js';
3
+ import { V as ViewScope, a as EditorExecOptions } from './editor-scope-7o9xweiJ.js';
4
+ import { ag as TreeDocOp, aS as TextFormFieldRange, aT as TextFormFieldOptions, ae as Unsubscribe, E as ExecResult, _ as DrawingPositionInput, aP as DrawingTransform, A as ParagraphTabStop, y as IndentFormatting, z as ParagraphFlags, a4 as ParagraphDisagreements, ay as DrawingTreeDocOp, ab as SelectionPin, Q as OoxmlPackage, g as ReviewRevisionKind, a1 as ImageWrapTarget } from './types-barrel-DuC5QBNC.js';
5
+ import { c as ImageDecodePort, S as SupportedImageMime } from './image-resources-tXLQShoC.js';
6
+ import { t as RevisionMarkupOptions, a as ReviewDisplayMode, z as RevisionMarkupChromeHandlers, S as SemanticLayout, T as TextMeasurer, C as ContentControlBoundaryRecord, q as ResolvedRevisionMarkup, O as SectionProperties } from './semantic-records-DQmumPgL.js';
7
+ import { F as FieldResultsMode, I as InsertImageInput, S as StoryScope, A as ApplyImagePropertiesInput, i as ImageIntentResult } from './tree-package-store-CovjNARF.js';
4
8
  import { EditorModule, ReviewModuleContribution } from './contracts/modules.js';
5
- import { D as DocumentSource, a as FontConfiguration, Z as ZoomMode, E as EditorFontError, h as Editor, e as EditorCommand, C as CanResult, o as SelectedImageState, y as FormatPainterSurfaceState, q as TrackedChangePredicate, p as TrackedChangeFilterMode, F as FontFaceRequest, b as FontSource, I as ImageContext, z as TableBorderEdgeTarget, B as TableBorderSpec, G as TableBorderStyle, J as TableContext } from './editor-B3OBYNrF.js';
6
- import { e as RevisionMarkupOptions, a as ReviewDisplayMode, i as RevisionMarkupChromeHandlers, d as ResolvedRevisionMarkup } from './revision-projection-CSNFudZY.js';
7
- import { S as SemanticPosition, a as SemanticSelection, N as NavigationCommand } from './semantic-interaction-G0bjmmmk.js';
8
- import { e as FontConfigurationFragment, g as FontResolver, i as MarkedFontResolver, f as FontResolutionRequest } from './font-resolver-DN0xNOf_.js';
9
9
  import { EditorCollaborationSession, CollaborationRemoteSelection, CollaborationModuleContribution } from './collaboration.js';
10
- import { d as RevisionStyles, R as ReviewAuthorInfo, c as RevisionAuthorStyle, F as FieldShadingMode, f as DrawingPaintStrings } from './semantic-paint-CsMzF8-O.js';
11
- import { b as ResolvedFootnoteProperties, R as ResolvedEndnoteProperties, A as AuthoredNoteProperties } from './note-properties-CkAk7g-n.js';
12
- import { S as SemanticLayout, T as TextMeasurer, C as ContentControlBoundaryRecord } from './semantic-records-B9OolWGN.js';
13
- import { B as BookmarkIndex } from './custom-node-writes-Vzpq9I8_.js';
14
- import { I as InsertImageInput, S as StoryScope, A as ApplyImagePropertiesInput, i as ImageIntentResult } from './tree-package-fragment-DYZIk1rY.js';
15
- import { C as CellSelection, S as SectionProperties } from './semantic-cell-selection-DoqYCz_F.js';
16
- import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-DQVJOOkv.js';
17
- import { C as CollaborationStatus } from './failure-BIPVQbRm.js';
18
- import { V as ViewScope, b as EditorExecOptions } from './editor-scope-OHPwVQ5l.js';
19
- import './contracts/document.js';
20
- import './contracts/interaction.js';
10
+ import { d as RevisionStyles, R as ReviewAuthorInfo, c as RevisionAuthorStyle, F as FieldShadingMode, f as DrawingPaintStrings } from './semantic-paint-ZayFF3tD.js';
11
+ import { R as ResolvedFootnoteProperties, a as ResolvedEndnoteProperties, A as AuthoredNoteProperties } from './note-properties-qQUjO1GQ.js';
12
+ import { B as BookmarkIndex } from './custom-node-writes-Bn6uciLb.js';
13
+ import { S as SemanticPosition, a as SemanticSelection, N as NavigationCommand } from './semantic-interaction-kR_QB845.js';
14
+ import { C as CellSelection } from './semantic-cell-selection-eYag3P47.js';
15
+ import { T as TreeDocxSessionView, a as TreeApplyResult } from './tree-session-contract-CZVAGl51.js';
16
+ import { C as CollaborationStatus } from './failure-NS2lsya4.js';
21
17
 
22
18
  /**
23
19
  * A blank document, freshly zipped per call (the caller may hand the
@@ -140,6 +136,31 @@ interface TextFormFieldChromeHandlers {
140
136
  readonly onRequest?: (session: TextFormFieldDialogSession) => void;
141
137
  }
142
138
 
139
+ /**
140
+ * Receives the element that shows the loading indicator on the first page, while a large
141
+ * document lays out its remaining pages.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * editor.setOpeningIndicatorHost({
146
+ * publish(element) {
147
+ * // Render your indicator into `element`, or remove it when `element` is null.
148
+ * },
149
+ * });
150
+ * ```
151
+ *
152
+ * @public
153
+ */
154
+ interface OpeningIndicatorHost {
155
+ /**
156
+ * Called with the indicator element when the first pages show, and with `null` when the
157
+ * remaining pages are laid out or the open is abandoned. The element is empty while a host
158
+ * is set: render the host's content into it. It is centered on the first page, at most 30%
159
+ * of the window height below the page top, and scrolls with the document.
160
+ */
161
+ publish(element: HTMLElement | null): void;
162
+ }
163
+
143
164
  /**
144
165
  * A hyperlink as the surface reports it: its identity, where it sits, and the SANITIZED
145
166
  * target. `href: null` is an inert link — a refused scheme or a dangling relationship — which
@@ -372,6 +393,23 @@ interface DocxEditorConfig {
372
393
  revisionMarkup?: RevisionMarkupOptions;
373
394
  /** Initial review projection. Markup modes require a review module. */
374
395
  reviewDisplayMode?: ReviewDisplayMode;
396
+ /**
397
+ * How the reader edits saved field results.
398
+ *
399
+ * - `'atomic'` (the DEFAULT) — every field is one unit: typing beside a field lands before
400
+ * or after it, and Backspace removes it whole.
401
+ * - `'editable'` — fields that show their saved result (DATE, TIME, MERGEFIELD, HYPERLINK
402
+ * display text, QUOTE, FILENAME, FILLIN, SEQ, and the save, print, and creation dates)
403
+ * accept typing, deletion, and selection inside the result. Fields the engine computes
404
+ * live (PAGE, NUMPAGES, REF, PAGEREF, DOCPROPERTY, and others) stay one unit.
405
+ *
406
+ * Editable results must be unnested. Simple fields inside complex field results are not
407
+ * supported in editable mode.
408
+ *
409
+ * Fixed for the instance. `'editable'` with a collaboration module throws a `TypeError`:
410
+ * shared paragraph text keeps every field one unit.
411
+ */
412
+ fieldResults?: FieldResultsMode;
375
413
  /** Override raster decode for insert/replace image commands; defaults to browser/headless. */
376
414
  imageDecodePort?: ImageDecodePort;
377
415
  /**
@@ -472,6 +510,25 @@ interface DocxEditorInstance extends Editor {
472
510
  * mount, and it survives a document reload the way the hyperlink chrome does.
473
511
  */
474
512
  setRemoteCaretLabelHost(host: RemoteCaretLabelHost | null): void;
513
+ /**
514
+ * Render the host's own loading indicator on the first page while a large document lays out
515
+ * its remaining pages, or restore the packaged spinner with `null`. The engine keeps owning
516
+ * the element and its place on the page; the host owns its content.
517
+ *
518
+ * Instance-only, like `setRemoteCaretLabelHost`, and tolerated at any time: a host set
519
+ * before the open applies when the first pages show. `DocxEditor.Loading` with `overlay`
520
+ * registers one for you, so set this only when you build your own loading screen.
521
+ *
522
+ * @example
523
+ * ```ts
524
+ * editor.setOpeningIndicatorHost({
525
+ * publish(element) {
526
+ * element?.replaceChildren(document.createTextNode('Opening…'));
527
+ * },
528
+ * });
529
+ * ```
530
+ */
531
+ setOpeningIndicatorHost(host: OpeningIndicatorHost | null): void;
475
532
  /**
476
533
  * Monotonic version of the observable editor state. Bumps whenever anything
477
534
  * `snapshot()` reports could have moved — a committed change, a selection move, zoom,
@@ -616,6 +673,26 @@ interface DocxEditorInstance extends Editor {
616
673
  * Invalid settings throw TypeError without changing the previous settings.
617
674
  */
618
675
  setRevisionMarkup(options: RevisionMarkupOptions): void;
676
+ /**
677
+ * Change the review pane settings: every field of `ReviewPaneOptions`, such as when the
678
+ * pane opens by itself and what it does when its card column does not fit. An omitted
679
+ * field keeps its value. Read the settings in force
680
+ * from `snapshot().reviewPane`. They stay in force across `load()` and are never saved into
681
+ * the document. This sets how the pane behaves; to open or close the pane itself, use
682
+ * `useReview().setPaneOpen` or the `toggleReviewPane` command.
683
+ *
684
+ * Returns `changed: false` on success, like every view-only call, because `changed` answers
685
+ * for the document; to detect a settings change, compare the `snapshot().reviewPane`
686
+ * reference, which changes only when a setting changes. Refused with `unsupported` when no review module is registered, and
687
+ * with `invalidArgs` for an unknown field or value. A refusal changes nothing.
688
+ *
689
+ * @example
690
+ * ```ts
691
+ * const result = editor.setReviewPaneOptions({ opening: 'manual', overflow: 'shrinkPage' });
692
+ * if (!result.ok) console.warn(result.reason);
693
+ * ```
694
+ */
695
+ setReviewPaneOptions(options: ReviewPaneOptions): ExecResult;
619
696
  /**
620
697
  * Mount into `el`. If the instance holds pending document bytes (created without a
621
698
  * container, or previously detached), they mount now — under the shaped measurer when
@@ -635,6 +712,37 @@ interface DocxEditorInstance extends Editor {
635
712
  detach(): void;
636
713
  }
637
714
 
715
+ /** Which of the eight resize handles a drag started from, by compass direction. */
716
+ type ImageResizeHandle = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw';
717
+ /** EMUs per point. DrawingML stores extents in EMU; layout works in points. */
718
+ declare const EMU_PER_POINT = 12700;
719
+ /** Points to EMU, rounded — EMUs are integral in the file. */
720
+ declare function pointsToEmu(points: number): number;
721
+ /** EMU to points. Unrounded, so overlay geometry keeps sub-point precision during a drag. */
722
+ declare function emuToOverlayPoints(emu: number): number;
723
+ /**
724
+ * The extent a resize drag produces, in EMU.
725
+ *
726
+ * Computed from the drag's START extent rather than the previous frame's, so a drag that reverses
727
+ * direction lands exactly where it began instead of accumulating rounding error.
728
+ *
729
+ * `preserveAspect` behaves the way Word's handles do: a corner handle scales by whichever axis
730
+ * moved further, while an edge handle drives the other axis from the original ratio. Both axes
731
+ * are floored at one point, so a drag past the opposite edge cannot invert the image.
732
+ */
733
+ declare function computeResizedImageExtentEmu(startWidthEmu: number, startHeightEmu: number, handle: ImageResizeHandle, deltaWidthPt: number, deltaHeightPt: number, preserveAspect: boolean): {
734
+ readonly cx: number;
735
+ readonly cy: number;
736
+ };
737
+ /**
738
+ * The position a move drag produces, preserving the anchoring the file already used.
739
+ *
740
+ * A `frame`-mode position keeps its `relativeToH`/`relativeToV` bases and only shifts the offsets
741
+ * it actually had — writing an offset the file omitted would re-anchor the drawing to a different
742
+ * reference and move it somewhere the drag never pointed.
743
+ */
744
+ declare function computeMovedImagePosition(start: DrawingPositionInput, deltaXPt: number, deltaYPt: number): DrawingPositionInput;
745
+
638
746
  type ImageMutationPreconditions = Readonly<{
639
747
  mountGeneration: number;
640
748
  packageRevision: number;
@@ -669,19 +777,16 @@ declare function canExecuteImageCommand(command: Extract<EditorCommand, {
669
777
  * Run an insert or replace, re-checking the same gates {@link canExecuteImageCommand} applies.
670
778
  *
671
779
  * Async because image bytes must be decoded to derive their natural extent before the drawing can
672
- * be projected — the one editor command that cannot complete synchronously.
780
+ * be projected — the one editor command that cannot complete synchronously. It runs outside
781
+ * `exec`, so it reports a refusal to the editor's diagnostics itself.
673
782
  */
674
783
  declare function executeImageCommand(editor: DocxEditorInstance, command: Extract<EditorCommand, {
675
784
  type: 'insertImage' | 'replaceImage';
676
785
  }>): Promise<ExecResult>;
677
- /** Which of the eight resize handles a drag started from, by compass direction. */
678
- type ImageResizeHandle = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw';
679
786
  /** How far one arrow-key press nudges a selected image, in points. */
680
787
  declare const IMAGE_OVERLAY_NUDGE_PT = 1;
681
788
  /** How far Shift+arrow nudges a selected image, in points. */
682
789
  declare const IMAGE_OVERLAY_NUDGE_SHIFT_PT = 10;
683
- /** EMUs per point. DrawingML stores extents in EMU; layout works in points. */
684
- declare const EMU_PER_POINT = 12700;
685
790
  /**
686
791
  * One in-flight image drag: where it started, and everything needed to decide at commit time
687
792
  * whether the document still describes what the gesture was planned against.
@@ -761,32 +866,6 @@ interface SelectedDrawingOverlayTarget {
761
866
  * claim an object the user did not single out.
762
867
  */
763
868
  declare function selectedDrawingOverlayTargetOf(surface: PaginatedSurface | null): SelectedDrawingOverlayTarget | null;
764
- /** Points to EMU, rounded — EMUs are integral in the file. */
765
- declare function pointsToEmu(points: number): number;
766
- /** EMU to points. Unrounded, so overlay geometry keeps sub-point precision during a drag. */
767
- declare function emuToOverlayPoints(emu: number): number;
768
- /**
769
- * The extent a resize drag produces, in EMU.
770
- *
771
- * Computed from the drag's START extent rather than the previous frame's, so a drag that reverses
772
- * direction lands exactly where it began instead of accumulating rounding error.
773
- *
774
- * `preserveAspect` behaves the way Word's handles do: a corner handle scales by whichever axis
775
- * moved further, while an edge handle drives the other axis from the original ratio. Both axes
776
- * are floored at one point, so a drag past the opposite edge cannot invert the image.
777
- */
778
- declare function computeResizedImageExtentEmu(startWidthEmu: number, startHeightEmu: number, handle: ImageResizeHandle, deltaWidthPt: number, deltaHeightPt: number, preserveAspect: boolean): {
779
- readonly cx: number;
780
- readonly cy: number;
781
- };
782
- /**
783
- * The position a move drag produces, preserving the anchoring the file already used.
784
- *
785
- * A `frame`-mode position keeps its `relativeToH`/`relativeToV` bases and only shifts the offsets
786
- * it actually had — writing an offset the file omitted would re-anchor the drawing to a different
787
- * reference and move it somewhere the drag never pointed.
788
- */
789
- declare function computeMovedImagePosition(start: DrawingPositionInput, deltaXPt: number, deltaYPt: number): DrawingPositionInput;
790
869
  /**
791
870
  * Whether a drag's commit should be refused because the document moved under it — the refusal to
792
871
  * return, or null when the commit is still valid.
@@ -1034,7 +1113,7 @@ interface ParagraphPropertyEdit {
1034
1113
  * `commentReference` naming a comment it never received. Naming the write lets each be admitted
1035
1114
  * only once a two-replica test proves it arrives whole.
1036
1115
  */
1037
- type ReviewWriteIntent = 'revision-resolve' | 'comment-add' | 'comment-reply' | 'comment-resolve' | 'comment-delete' | 'package-scoped';
1116
+ type ReviewWriteIntent = 'revision-resolve' | 'revision-attribution' | 'comment-add' | 'comment-reply' | 'comment-resolve' | 'comment-delete' | 'package-scoped';
1038
1117
 
1039
1118
  /**
1040
1119
  * Everything an overlay needs to paint over one rendered frame of the surface.
@@ -1228,6 +1307,13 @@ interface PaginatedSurfaceOptions {
1228
1307
  * authority.
1229
1308
  */
1230
1309
  readonly collaborationModel?: CollaborationModuleContribution;
1310
+ /**
1311
+ * How saved field results are edited. `atomic` (the default) keeps every field one unit.
1312
+ * `editable` lets the reader type, delete, and select inside the saved result of a DATE,
1313
+ * MERGEFIELD, HYPERLINK, or similar field. Results must be unnested; simple fields inside
1314
+ * complex field results are not supported. Refused with a {@link collaborationModel}.
1315
+ */
1316
+ readonly fieldResults?: FieldResultsMode;
1231
1317
  readonly measurer?: TextMeasurer;
1232
1318
  /** Ambient author for tracked edits. Required before suggesting can write anything. */
1233
1319
  readonly author?: string;
@@ -1302,6 +1388,18 @@ interface PaginatedSurfaceOptions {
1302
1388
  */
1303
1389
  readonly pointer?: 'engine' | 'native';
1304
1390
  readonly onChange?: (state: PaginatedSurfaceState) => void;
1391
+ /**
1392
+ * Told each time an edit is refused, with the raw reason: a store code such as `'locked'`,
1393
+ * or the surface's own refusal sentence. The raw reason can be a sentence, so a listener
1394
+ * maps it to a public code before it reports anything.
1395
+ */
1396
+ readonly onRejection?: (reason: string) => void;
1397
+ /**
1398
+ * Told the milliseconds of each layout pass and each paint. For `'input'`, told the browser
1399
+ * timestamp of each key press or pointer press on the pages, so a listener can time it to
1400
+ * the next frame. Numbers only.
1401
+ */
1402
+ readonly onTiming?: (phase: 'layout' | 'paint' | 'input', value: number) => void;
1305
1403
  /**
1306
1404
  * A plain click on an external (or inert) hyperlink, for a host to open its popover with.
1307
1405
  *
@@ -1416,7 +1514,7 @@ interface RevealOptions {
1416
1514
  * centred when it has to move, so the reader lands looking AT the thing rather than at
1417
1515
  * the bottom line of the window. Default `'start'`.
1418
1516
  */
1419
- readonly block?: 'start' | 'center' | 'centerIfNeeded' | 'nearest';
1517
+ readonly block?: ScrollPlacement;
1420
1518
  /** Padding above the target, in CSS pixels. Default 24. */
1421
1519
  readonly offsetPx?: number;
1422
1520
  readonly behavior?: ScrollBehavior;
@@ -1604,6 +1702,25 @@ interface PaginatedSurface {
1604
1702
  * where there is no list to demote).
1605
1703
  */
1606
1704
  adjustIndent(direction: 'increase' | 'decrease'): boolean;
1705
+ /**
1706
+ * Tab (`increase`) or Shift+Tab (`decrease`) over a selection outside a list: change the
1707
+ * indent and keep the text.
1708
+ *
1709
+ * A selection over two or more paragraphs, or a cell rectangle, steps the left indent of
1710
+ * each paragraph. A selection in one paragraph that starts at the paragraph start, whole or
1711
+ * partial, works on the first line: Tab sets a first-line indent of one default tab stop
1712
+ * (`w:defaultTabStop`), or steps the left indent when the first line already has that
1713
+ * indent or more, or a hanging indent. Shift+Tab clears a first-line indent that the
1714
+ * paragraph states itself, so a style value applies again, and otherwise steps the left
1715
+ * indent back. A paragraph the selection reaches only at its start is not touched by this
1716
+ * rule, unless it is the empty last paragraph of the story.
1717
+ *
1718
+ * Answers true when the selection takes this rule, also when the write is refused or
1719
+ * changes nothing, so the text is never replaced. Answers false for a caret and for a
1720
+ * selection in one paragraph that starts inside the text; there Tab types a tab character
1721
+ * and Shift+Tab steps the left indent.
1722
+ */
1723
+ indentWithTab(direction: 'increase' | 'decrease'): boolean;
1607
1724
  /**
1608
1725
  * Set indent to exact values on every paragraph the selection touches — what a ruler
1609
1726
  * drag and an indent spinner both need, where {@link adjustIndent} only steps.
@@ -1925,6 +2042,8 @@ interface PaginatedSurface {
1925
2042
  setEditingMode(mode: SurfaceEditingMode): void;
1926
2043
  /** Set the ambient author after buffered text commits under the previous author. */
1927
2044
  setAuthor(author: string | undefined): void;
2045
+ /** The ambient author tracked edits and review writes record, or undefined. */
2046
+ author(): string | undefined;
1928
2047
  /** Replace localized drawing labels and repaint materialized pages. */
1929
2048
  setDrawingStrings(strings: DrawingPaintStrings): void;
1930
2049
  /** Update shared form-control labels without replacing open dialogs. */
@@ -2284,6 +2403,8 @@ type OpenPaginatedResult = {
2284
2403
  readonly ok: false;
2285
2404
  readonly reason: string;
2286
2405
  readonly detail?: string;
2406
+ /** The resource limit the package crossed, when the reason is a size refusal. */
2407
+ readonly limit?: string;
2287
2408
  };
2288
2409
 
2289
2410
  /** One URL to fetch and the face it claims to be. */
@@ -2418,6 +2539,68 @@ type CustomFontsResolver = MarkedFontResolver<(request: FontResolutionRequest) =
2418
2539
  */
2419
2540
  declare function customFonts(options: CustomFontsOptions): CustomFontsResolver;
2420
2541
 
2542
+ /**
2543
+ * A row that runs one chrome slot.
2544
+ *
2545
+ * @public
2546
+ */
2547
+ interface ChromeMenuItemEntry {
2548
+ readonly kind: 'item';
2549
+ readonly slot: ChromeSlotId;
2550
+ /**
2551
+ * Plain-label override for this row.
2552
+ *
2553
+ * A slot's own `labelKey` is a TOOLTIP key, and several of them fold the shortcut into
2554
+ * the text (`formattingBar.boldShortcut` is "Bold (Ctrl+B)"). A menu puts the shortcut
2555
+ * in its own right-hand column, so the row needs the bare noun. Both keys already exist
2556
+ * in the catalogue — this points at the plain one rather than minting a duplicate.
2557
+ */
2558
+ readonly labelKey?: string;
2559
+ /** i18n key of the shortcut shown right-aligned on the row (`toolbar.saveShortcut`). */
2560
+ readonly shortcutKey?: string;
2561
+ /**
2562
+ * The row opens a size PICKER instead of firing on click — Word's insert-table grid.
2563
+ * The slot still owns the label, the icon and the enabled state; only the dispatch
2564
+ * differs, and the picked size is what the host sends.
2565
+ */
2566
+ readonly picker?: 'tableGrid';
2567
+ }
2568
+ /**
2569
+ * A row that opens a nested panel of rows (Insert › Break).
2570
+ *
2571
+ * It carries its own label and icon rather than a slot, because a submenu PARENT has no
2572
+ * command: clicking it opens the panel. Giving it a slot would mint a public id for a
2573
+ * control that can never be enabled, and `toolbarCommandState` would have to invent an
2574
+ * answer about it.
2575
+ *
2576
+ * @public
2577
+ */
2578
+ interface ChromeMenuSubmenuEntry {
2579
+ readonly kind: 'submenu';
2580
+ readonly labelKey: string;
2581
+ readonly paths: readonly string[] | null;
2582
+ readonly items: readonly ChromeMenuEntry[];
2583
+ }
2584
+ /** A horizontal rule between groups of rows. @public */
2585
+ interface ChromeMenuSeparatorEntry {
2586
+ readonly kind: 'separator';
2587
+ }
2588
+ /** One row of a chrome menu. @public */
2589
+ type ChromeMenuEntry = ChromeMenuItemEntry | ChromeMenuSubmenuEntry | ChromeMenuSeparatorEntry;
2590
+ /**
2591
+ * Every menu id, as a literal union. Stable public API; renaming one is a breaking change,
2592
+ * exactly like a group or slot id.
2593
+ *
2594
+ * @public
2595
+ */
2596
+ type ChromeMenuId = 'file' | 'format' | 'insert' | 'review' | 'help';
2597
+ /** One menu of the menu bar. @public */
2598
+ interface ChromeMenu {
2599
+ readonly id: ChromeMenuId;
2600
+ readonly labelKey: string;
2601
+ readonly entries: readonly ChromeMenuEntry[];
2602
+ }
2603
+
2421
2604
  /**
2422
2605
  * HOW a control reaches the engine — never WHETHER it is enabled.
2423
2606
  *
@@ -2812,6 +2995,7 @@ declare const CHROME_GROUPS: readonly [{
2812
2995
  readonly id: 'revisionMarkup';
2813
2996
  readonly shape: 'icon';
2814
2997
  readonly labelKey: 'revisionMarkup.title';
2998
+ readonly defaultToolbar: false;
2815
2999
  readonly paths: readonly string[];
2816
3000
  readonly state: {
2817
3001
  readonly kind: 'command';
@@ -2914,6 +3098,15 @@ declare const CHROME_GROUPS: readonly [{
2914
3098
  readonly state: {
2915
3099
  readonly kind: 'command';
2916
3100
  };
3101
+ }, {
3102
+ readonly id: 'addComment';
3103
+ readonly shape: 'icon';
3104
+ readonly labelKey: 'formattingBar.addComment';
3105
+ readonly defaultToolbar: false;
3106
+ readonly paths: readonly string[];
3107
+ readonly state: {
3108
+ readonly kind: 'command';
3109
+ };
2917
3110
  }, {
2918
3111
  readonly id: 'authors';
2919
3112
  readonly shape: 'dropdown';
@@ -3213,7 +3406,7 @@ type ChromeGroupId = 'history' | 'zoom' | 'styles' | 'font' | 'text' | 'script'
3213
3406
  *
3214
3407
  * @public
3215
3408
  */
3216
- type ChromeSlotId = 'history.undo' | 'history.redo' | 'zoom.level' | 'styles.style' | 'font.family' | 'font.size' | 'text.bold' | 'text.italic' | 'text.underline' | 'text.strike' | 'text.color' | 'text.highlight' | 'text.link' | 'script.super' | 'script.sub' | 'alignment.left' | 'alignment.center' | 'alignment.right' | 'alignment.justify' | 'direction.ltr' | 'direction.rtl' | 'list.bullet' | 'list.numbered' | 'list.outdent' | 'list.indent' | 'list.lineSpacing' | 'format.painter' | 'format.clear' | 'review.revisionMarkup' | 'review.comments' | 'review.paragraphMarks' | 'review.protectDocument' | 'review.simpleMarkup' | 'review.allMarkup' | 'review.noMarkup' | 'review.original' | 'review.previousChange' | 'review.nextChange' | 'review.acceptAllChanges' | 'review.rejectAllChanges' | 'review.authors' | 'review.editingMode' | 'contentControl.showAll' | 'contentControl.formFill' | 'contentControl.inspector' | 'contentControl.remove' | 'image.insert' | 'image.properties' | 'image.wrap' | 'image.altText' | 'table.insert' | 'table.borderTarget' | 'table.borderColor' | 'table.borderStyle' | 'table.borderWidth' | 'table.cellFill' | 'file.open' | 'file.save' | 'file.exportMarkdown' | 'file.exportPdf' | 'file.print' | 'paragraph.dialog' | 'file.pageSetup' | 'insert.textBox' | 'insert.footnote' | 'insert.endnote' | 'insert.pageNumber' | 'insert.totalPages' | 'insert.sectionPages' | 'insert.pageXofY' | 'insert.pageBreak' | 'insert.sectionBreakNextPage' | 'insert.sectionBreakContinuous' | 'insert.toc';
3409
+ type ChromeSlotId = 'history.undo' | 'history.redo' | 'zoom.level' | 'styles.style' | 'font.family' | 'font.size' | 'text.bold' | 'text.italic' | 'text.underline' | 'text.strike' | 'text.color' | 'text.highlight' | 'text.link' | 'script.super' | 'script.sub' | 'alignment.left' | 'alignment.center' | 'alignment.right' | 'alignment.justify' | 'direction.ltr' | 'direction.rtl' | 'list.bullet' | 'list.numbered' | 'list.outdent' | 'list.indent' | 'list.lineSpacing' | 'format.painter' | 'format.clear' | 'review.revisionMarkup' | 'review.comments' | 'review.addComment' | 'review.paragraphMarks' | 'review.protectDocument' | 'review.simpleMarkup' | 'review.allMarkup' | 'review.noMarkup' | 'review.original' | 'review.previousChange' | 'review.nextChange' | 'review.acceptAllChanges' | 'review.rejectAllChanges' | 'review.authors' | 'review.editingMode' | 'contentControl.showAll' | 'contentControl.formFill' | 'contentControl.inspector' | 'contentControl.remove' | 'image.insert' | 'image.properties' | 'image.wrap' | 'image.altText' | 'table.insert' | 'table.borderTarget' | 'table.borderColor' | 'table.borderStyle' | 'table.borderWidth' | 'table.cellFill' | 'file.open' | 'file.save' | 'file.exportMarkdown' | 'file.exportPdf' | 'file.print' | 'paragraph.dialog' | 'file.pageSetup' | 'insert.textBox' | 'insert.footnote' | 'insert.endnote' | 'insert.pageNumber' | 'insert.totalPages' | 'insert.sectionPages' | 'insert.pageXofY' | 'insert.pageBreak' | 'insert.sectionBreakNextPage' | 'insert.sectionBreakContinuous' | 'insert.toc';
3217
3410
  /**
3218
3411
  * Every control id in the chrome, as a literal union. Unique WITHIN a group, not
3219
3412
  * globally (`image.insert` / `table.insert`) — key consumers on {@link ChromeSlotId}.
@@ -3252,67 +3445,7 @@ declare function defaultChromeGroups(): readonly ChromeGroup[];
3252
3445
  * @public
3253
3446
  */
3254
3447
  declare function formattingBarChromeGroups(image: ImageContext | null): readonly ChromeGroup[];
3255
- /**
3256
- * A row that runs one chrome slot.
3257
- *
3258
- * @public
3259
- */
3260
- interface ChromeMenuItemEntry {
3261
- readonly kind: 'item';
3262
- readonly slot: ChromeSlotId;
3263
- /**
3264
- * Plain-label override for this row.
3265
- *
3266
- * A slot's own `labelKey` is a TOOLTIP key, and several of them fold the shortcut into
3267
- * the text (`formattingBar.boldShortcut` is "Bold (Ctrl+B)"). A menu puts the shortcut
3268
- * in its own right-hand column, so the row needs the bare noun. Both keys already exist
3269
- * in the catalogue — this points at the plain one rather than minting a duplicate.
3270
- */
3271
- readonly labelKey?: string;
3272
- /** i18n key of the shortcut shown right-aligned on the row (`toolbar.saveShortcut`). */
3273
- readonly shortcutKey?: string;
3274
- /**
3275
- * The row opens a size PICKER instead of firing on click — Word's insert-table grid.
3276
- * The slot still owns the label, the icon and the enabled state; only the dispatch
3277
- * differs, and the picked size is what the host sends.
3278
- */
3279
- readonly picker?: 'tableGrid';
3280
- }
3281
- /**
3282
- * A row that opens a nested panel of rows (Insert › Break).
3283
- *
3284
- * It carries its own label and icon rather than a slot, because a submenu PARENT has no
3285
- * command: clicking it opens the panel. Giving it a slot would mint a public id for a
3286
- * control that can never be enabled, and `toolbarCommandState` would have to invent an
3287
- * answer about it.
3288
- *
3289
- * @public
3290
- */
3291
- interface ChromeMenuSubmenuEntry {
3292
- readonly kind: 'submenu';
3293
- readonly labelKey: string;
3294
- readonly paths: readonly string[] | null;
3295
- readonly items: readonly ChromeMenuEntry[];
3296
- }
3297
- /** A horizontal rule between groups of rows. @public */
3298
- interface ChromeMenuSeparatorEntry {
3299
- readonly kind: 'separator';
3300
- }
3301
- /** One row of a chrome menu. @public */
3302
- type ChromeMenuEntry = ChromeMenuItemEntry | ChromeMenuSubmenuEntry | ChromeMenuSeparatorEntry;
3303
- /**
3304
- * Every menu id, as a literal union. Stable public API; renaming one is a breaking change,
3305
- * exactly like a group or slot id.
3306
- *
3307
- * @public
3308
- */
3309
- type ChromeMenuId = 'file' | 'format' | 'insert' | 'review' | 'help';
3310
- /** One menu of the menu bar. @public */
3311
- interface ChromeMenu {
3312
- readonly id: ChromeMenuId;
3313
- readonly labelKey: string;
3314
- readonly entries: readonly ChromeMenuEntry[];
3315
- }
3448
+
3316
3449
  /**
3317
3450
  * The menu bar the chrome shows above the toolbar, in bar order: File, Format, Insert, Review,
3318
3451
  * Help.
@@ -3742,5 +3875,5 @@ interface ChromePrintJob {
3742
3875
  */
3743
3876
  declare function runChromePrint(editor: Pick<Editor, 'save'> & Partial<Pick<Editor, 'snapshot'>>, handlers?: ChromeExportHandlers, container?: Document | Element): Promise<ChromePrintJob>;
3744
3877
 
3745
- export { IMAGE_OVERLAY_NUDGE_SHIFT_PT as $, CHROME_GROUPS as C, DEFAULT_TABLE_CHROME_DRAFT as F, EMU_PER_POINT as I, IMAGE_OVERLAY_NUDGE_PT as _, createImageOverlayScrollPort as a$, applyTableChromePick as aI, bindHistoryGroup as aJ, blankDocumentBytes as aK, canExecuteImageCommand as aL, captureImageMutationPreconditions as aM, chromeControlCount as aN, chromeMenuSlots as aO, chromeProbeForSlot as aP, chromeSlotId as aQ, chromeSlotIsToggle as aR, commandExecOptions as aS, commandForSlot as aT, commandForSlotValue as aU, commandForTableChromeSlotValue as aV, computeImageResizeResult as aW, computeMovedImagePosition as aX, computeResizedImageExtentEmu as aY, createDocxEditor as aZ, createFontSource as a_, TABLE_BORDER_STYLE_OPTIONS as aq, TABLE_BORDER_TARGET_OPTIONS as ar, TABLE_BORDER_WIDTH_OPTIONS as as, TABLE_CHROME_SLOT_IDS as at, CHROME_MENUS as b, cssPixelsToLayoutPoints as b0, customFonts as b1, defaultChromeGroups as b2, defaultTableLabel as b3, emuToOverlayPoints as b4, equationAtPosition as b5, executeImageCommand as b6, finalizeImageOverlayInteraction as b7, formattingBarChromeGroups as b8, isChromePrintShortcut as b9, isStaleImageInteractionCommit as ba, isTableChromeSlot as bb, layoutPointsToCssPixels as bc, loadFonts as bd, overlayFrameToSheetCssPixels as be, overlayHostOrigin as bf, pointsToEmu as bg, probeTableChromeCommand as bh, resizePreservesAspect as bi, runChromeExport as bj, runChromePrint as bk, runSave as bl, runTableChromeCommand as bm, runTableCommand as bn, runToolbarCommand as bo, selectedDrawingOverlayTargetOf as bp, selectedImageStateOf as bq, surfacePaintScale as br, tableChromeIconPaths as bs, tableChromeLabelKeyForTarget as bt, tableChromeToolbarState as bu, tableChromeVisible as bv, tableCommandToolbarState as bw, toolbarCommandState as bx, toolbarCommandStates as by, CHROME_UNAVAILABLE_KEY as c, ChromeExportError as g, ChromePrintError as t };
3746
- export type { AnchorFrameOrigin as A, CustomFontsOptions as B, DocxEditorInstance as D, CustomFontsResolver as E, DocxEditorConfig as G, DrawingSelectionIntent as H, EditorCommandExecute as J, EquationActivation as K, EquationChromeHandlers as L, EquationOps as M, FinalizedImageOverlayInteraction as N, OpenPaginatedResult as O, PaginatedSurfaceOptions as P, FontLoadFailure as Q, FontLoadFailureReason as R, FontMeasurementState as S, TableCommandPlan as T, FontUrlSource as U, HistoryGroupBinding as V, HistoryGroupBindingOptions as W, HyperlinkActivation as X, HyperlinkChromeHandlers as Y, HyperlinkOps as Z, PaginatedSurface as a, ImageInteractionSession as a0, ImageOverlayScrollPort as a1, ImageResizeHandle as a2, ImageResizeResult as a3, InvalidTextFormFieldChromeHandlers as a4, InvalidTextFormFieldSession as a5, LoadFontsRequest as a6, LoadFontsResult as a7, OverlayFrameRect as a8, PaginatedSurfaceState as a9, TableChromeSlotId as aA, TableInteractionLabelKey as aB, TextFormFieldChromeHandlers as aC, TextFormFieldDialogSession as aD, ToolbarCommandState as aE, ToolbarSlotValue as aF, ToolbarValueMap as aG, ToolbarValueSlot as aH, ParagraphPropertyEdit as aa, PopupChromeRegistrationOptions as ab, RemoteCaretLabelAnchor as ac, RemoteCaretLabelHost as ad, ReviewWriteIntent as ae, RunTableChromeCommandResult as af, SectionAnchor as ag, SectionBreakInsertType as ah, SelectedDrawingOverlayTarget as ai, SurfaceEquation as aj, SurfaceFormatting as ak, SurfaceHyperlink as al, SurfaceInsertImageInput as am, SurfaceNavigation as an, SurfaceOverlayCoordinates as ao, SurfaceParagraphFormat as ap, TableBorderStyleOption as au, TableBorderTargetOption as av, TableBorderTargetValue as aw, TableBorderWidthOption as ax, TableChromeDraft as ay, TableChromePick as az, ChromeControl as d, ChromeControlId as e, ChromeControlState as f, ChromeExportFormat as h, ChromeExportHandlers as i, ChromeExportResult as j, ChromeExportView as k, ChromeGroup as l, ChromeGroupId as m, ChromeMenu as n, ChromeMenuEntry as o, ChromeMenuId as p, ChromeMenuItemEntry as q, ChromeMenuSeparatorEntry as r, ChromeMenuSubmenuEntry as s, ChromePrintErrorCode as u, ChromePrintJob as v, ChromePrintOptions as w, ChromeSlotId as x, ContentControlWidgetChromeHandlers as y, ContentControlWidgetSession as z };
3878
+ export { bindHistoryGroup as A, blankDocumentBytes as B, CHROME_GROUPS as C, chromeMenuSlots as E, commandForSlot as G, commandForSlotValue as I, createDocxEditor as J, createFontSource as K, customFonts as M, isChromePrintShortcut as N, loadFonts as O, runChromeExport as P, runChromePrint as Q, runToolbarCommand as R, toolbarCommandState as U, CHROME_UNAVAILABLE_KEY as _, CHROME_MENUS as a, chromeProbeForSlot as a$, DEFAULT_TABLE_CHROME_DRAFT as a7, EMU_PER_POINT as a9, TABLE_BORDER_STYLE_OPTIONS as aG, TABLE_BORDER_TARGET_OPTIONS as aH, TABLE_BORDER_WIDTH_OPTIONS as aI, TABLE_CHROME_SLOT_IDS as aJ, applyTableChromePick as aX, canExecuteImageCommand as aY, captureImageMutationPreconditions as aZ, chromeControlCount as a_, IMAGE_OVERLAY_NUDGE_PT as ag, IMAGE_OVERLAY_NUDGE_SHIFT_PT as ah, ChromeExportError as b, chromeSlotId as b0, chromeSlotIsToggle as b1, commandExecOptions as b2, commandForTableChromeSlotValue as b3, computeImageResizeResult as b4, computeMovedImagePosition as b5, computeResizedImageExtentEmu as b6, createImageOverlayScrollPort as b7, cssPixelsToLayoutPoints as b8, defaultChromeGroups as b9, defaultTableLabel as ba, emuToOverlayPoints as bb, equationAtPosition as bc, executeImageCommand as bd, finalizeImageOverlayInteraction as be, formattingBarChromeGroups as bf, isStaleImageInteractionCommit as bg, isTableChromeSlot as bh, layoutPointsToCssPixels as bi, overlayFrameToSheetCssPixels as bj, overlayHostOrigin as bk, pointsToEmu as bl, probeTableChromeCommand as bm, resizePreservesAspect as bn, runSave as bo, runTableChromeCommand as bp, runTableCommand as bq, selectedDrawingOverlayTargetOf as br, selectedImageStateOf as bs, surfacePaintScale as bt, tableChromeIconPaths as bu, tableChromeLabelKeyForTarget as bv, tableChromeToolbarState as bw, tableChromeVisible as bx, tableCommandToolbarState as by, toolbarCommandStates as bz, ChromePrintError as l };
3879
+ export type { ChromeControl as $, DocxEditorConfig as D, FontLoadFailure as F, HistoryGroupBinding as H, LoadFontsRequest as L, SurfaceHyperlink as S, ToolbarCommandState as T, PaginatedSurfaceOptions as V, OpenPaginatedResult as W, PaginatedSurface as X, TableCommandPlan as Y, AnchorFrameOrigin as Z, ChromeControlId as a0, ChromeControlState as a1, ChromeExportView as a2, ChromeGroup as a3, ChromeGroupId as a4, ContentControlWidgetChromeHandlers as a5, ContentControlWidgetSession as a6, DrawingSelectionIntent as a8, SurfaceEquation as aA, SurfaceFormatting as aB, SurfaceInsertImageInput as aC, SurfaceNavigation as aD, SurfaceOverlayCoordinates as aE, SurfaceParagraphFormat as aF, TableBorderStyleOption as aK, TableBorderTargetOption as aL, TableBorderTargetValue as aM, TableBorderWidthOption as aN, TableChromeDraft as aO, TableChromePick as aP, TableChromeSlotId as aQ, TableInteractionLabelKey as aR, TextFormFieldChromeHandlers as aS, TextFormFieldDialogSession as aT, ToolbarSlotValue as aU, ToolbarValueMap as aV, ToolbarValueSlot as aW, EditorCommandExecute as aa, EquationActivation as ab, EquationChromeHandlers as ac, EquationOps as ad, FinalizedImageOverlayInteraction as ae, HyperlinkOps as af, ImageInteractionSession as ai, ImageOverlayScrollPort as aj, ImageResizeHandle as ak, ImageResizeResult as al, InvalidTextFormFieldChromeHandlers as am, InvalidTextFormFieldSession as an, OpeningIndicatorHost as ao, OverlayFrameRect as ap, PaginatedSurfaceState as aq, ParagraphPropertyEdit as ar, PopupChromeRegistrationOptions as as, RemoteCaretLabelAnchor as at, RemoteCaretLabelHost as au, ReviewWriteIntent as av, RunTableChromeCommandResult as aw, SectionAnchor as ax, SectionBreakInsertType as ay, SelectedDrawingOverlayTarget as az, ChromeExportFormat as c, ChromeExportHandlers as d, ChromeExportResult as e, ChromeMenu as f, ChromeMenuEntry as g, ChromeMenuId as h, ChromeMenuItemEntry as i, ChromeMenuSeparatorEntry as j, ChromeMenuSubmenuEntry as k, ChromePrintErrorCode as m, ChromePrintJob as n, ChromePrintOptions as o, ChromeSlotId as p, CustomFontsOptions as q, CustomFontsResolver as r, DocxEditorInstance as s, FontLoadFailureReason as t, FontMeasurementState as u, FontUrlSource as v, HistoryGroupBindingOptions as w, HyperlinkActivation as x, HyperlinkChromeHandlers as y, LoadFontsResult as z };
@@ -0,0 +1,2 @@
1
+ import {h,a,b,e,c,f,Ud,Vb,Yb,_b,$b,Zb,Wc,Wb,Xb,lc,hd,yc,We as We$1,Ve as Ve$1,d,w,Hb,aa,Jb,id,ic,ld}from'./chunk-CPWLFPWC.js';import {b as b$1,a as a$1}from'./chunk-G4HOFIKJ.js';import {rb,wa,la,xa,Yc,f as f$1,J as J$1,a as a$2}from'./chunk-YQ5G6LC7.js';var Ye=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function $(e){let t=new Map;for(let n of e)if(Array.isArray(n)){for(let o of n.slice(0,2048)){if(typeof o!="string"||!Ye.test(o))continue;let r=o.toLowerCase();if(t.has(r)||t.set(r,o),t.size===2048)break}if(t.size===2048)break}return Object.freeze([...t.values()])}function kt(e){let t=e&&"failures"in e?e.failures:void 0;return e==null||(e.sources?.length??0)===0&&(e.substitutions?.length??0)===0&&(t===void 0||Array.isArray(t)&&t.length===0)?void 0:e}var De=64,re=Object.freeze({family:"Calibri",sizeHalfPoints:22}),At=re;function Y(e,...t){let n=[e,...t],o=[],r=new Set;for(let l of n)for(let c of l.sources??[]){let u=h(c.request);r.has(u)||(r.add(u),o.push(c));}let i=[],s=new Set;for(let l of n)for(let c of l.substitutions??[]){let u=h(c.from);r.has(u)||s.has(u)||(s.add(u),i.push(c));}let a$1=$(n.map(l=>l.supportedFamilies));return Object.freeze({...a$1.length?{supportedFamilies:a$1}:{},epoch:e.epoch??0,maxFontBytes:e.maxFontBytes??a,sources:Object.freeze(o),...i.length>0?{substitutions:Object.freeze(i)}:{},defaultFont:e.defaultFont??re,...e.language!==void 0?{language:e.language}:{}})}var Ge=/^[\p{L}\p{N}\p{M} \-.+_,;]{1,64}$/u;function G(e){let t=e?.defaultFont?.family;return t!==void 0&&Ge.test(t)?t:re.family}var We="docx-editor.dev/font-resolver",ze=Symbol.for("docx-editor.dev/font-resolver");function Lt(e){let t={value:true,enumerable:false,configurable:true};try{Object.defineProperty(e,ze,t),Object.defineProperty(e,We,t);}catch(n){throw new TypeError("defineFontResolver cannot mark a frozen or sealed function; mark it before freezing, or wrap it in a fresh function and mark that.",{cause:n})}return e}function It(e){return typeof e=="function"&&e[ze]===true}var se=class extends RangeError{constructor(n,o,r){super(`Font source ${n.family} (${o} bytes) exceeds the shaping byte ceiling (${r} bytes)`);this.request=n;}request},ae=class extends AggregateError{causes;constructor(t){let n=Object.freeze(t.slice(0,b*2));super(n,`Font origin rejected all ${n.length} face and substitution candidates`),this.causes=n;}},J=e=>`${e.family.trim().toLowerCase()} ${e.weight} ${e.style}`;function Je(e,t,n){let o=new Map(e.map(r=>[J(r),r]));for(let[r,i]of t)o.set(r,i);for(let r of n)o.has(J(r.to))&&o.set(J(r.from),r.from);return [...o.values()]}async function Pt(e,t,n={}){return je(e,t,n)}async function Bt(e,t,n={}){return je(e,t,n)}async function je(e,t,n){let o=n.maxExecutionFontBytes??a;if(!Number.isSafeInteger(o)||o<=0||o>a)throw new RangeError("Font execution byte ceiling is outside the supported range");let r=e.map(Qe),i,s=[],a$1=[],l=new Map,c=new Set,u=0,d=[],m=new Set,y=[],p=t.resolvedFaces??[],F=t.defaultFamily;for(let w=0;w<e.length;w+=1){Ue(t.signal);let R=e[w],A=Je(p,l,d),B;try{let S=r[w],T;if(S){let f=await qe(S,t.signal);if(!f.ok)throw f.cause;T=f.value;}else if(typeof R=="function"){let f=await qe(Promise.resolve(R(tt(t,F,A,u))).then(g=>({ok:!0,value:g}),g=>({ok:!1,cause:g})),t.signal);if(!f.ok)throw f.cause;T=f.value;}else T=R;if(T==null)continue;if(typeof T=="function"){W(n,R,w,new TypeError("A font origin answered with a function; pass the resolver itself rather than a function returning one"));continue}let _="failures"in T?T.failures:void 0,D=[];if(Array.isArray(_)){let f=Math.min(_.length,b);for(let g=0;g<f;g++)D.push(_[g]);_.length>f&&D.push(new Error("Additional font-origin failures were omitted"));}else _!==void 0&&D.push(_);let M;try{M=Ze(T,c,u,m,i?"maxFontBytes"in i&&i.maxFontBytes!==void 0?i.maxFontBytes:a:void 0,n.reserveOwnedBytes,n.instrumentation,o);}catch(f){for(let g of new Set(D))W(n,R,w,g);throw f}B=M;for(let f of new Set([...M.dropped,...D]))W(n,R,w,f);let v=M.fragment;v.supportedFamilies&&s.push(v.supportedFamilies),y.push(...D);let X=(v.sources??[]).map(f=>(h(f.request),[J(f.request),f.request])),b$1=[...v.substitutions??[]];!i&&"defaultFont"in v&&(F=G(v)),i||(i=v);let x=new Set(M.sourceKeys);if(x.size>0){d=d.filter(f=>!x.has(h(f.from)));for(let f of x)m.delete(f);}a$1.push(...v.sources??[]);for(let f of M.sourceKeys)c.add(f);u+=M.ownedBytes;for(let[f,g]of X)l.set(f,g);for(let f of b$1)d.push(f),m.add(h(f.from));}catch(S){if(B?.releaseOwnedBytes?.(),t.signal?.aborted)throw t.signal.reason??S;if(S instanceof Q)throw S.cause;W(n,R,w,S);continue}}if(!i)return;let{epoch:E,...P}=Y({...i,supportedFamilies:$(s),sources:a$1,substitutions:d});return y.length===0?P:{...P,failures:Object.freeze(y)}}var Q=class extends Error{constructor(n){super("Unable to reserve owned font bytes");this.cause=n;this.name="FontOwnershipReservationError";}cause},Z=class extends RangeError{};async function qe(e,t){if(!t)return e;Ue(t);let n,o=new Promise((i,s)=>{n=s;}),r=()=>n?.(t.reason);t.addEventListener("abort",r,{once:true});try{return await Promise.race([e,o])}finally{t.removeEventListener("abort",r);}}function Qe(e){if(e===null||typeof e!="object")return;let t;try{t=e.then;}catch(n){return Promise.resolve({ok:false,cause:n})}if(typeof t=="function")return Promise.resolve(e).then(n=>({ok:true,value:n}),n=>({ok:false,cause:n}))}function Ze(e$1,t,n,o,r,i,s,a$1=a){let l=e$1.sources??[],c$1=e$1.substitutions??[],u="maxFontBytes"in e$1?e$1.maxFontBytes:void 0,d="defaultFont"in e$1?e$1.defaultFont:void 0,m="epoch"in e$1?e$1.epoch:void 0,y="language"in e$1?e$1.language:void 0;if(!Array.isArray(l)||!Array.isArray(c$1))throw new TypeError("Font origin sources and substitutions must be arrays");let p=l.length,F=c$1.length;if(p>b)throw new RangeError(`Font source count must not exceed ${b}`);if(F>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let E=u??a;if(!Number.isSafeInteger(E)||E<=0||E>a)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${a}`);let P=Math.min(r??E,a$1),w=0,R=[],A=new Set,B=[],S=[];for(let b$1=0;b$1<p;b$1+=1){let x=l[b$1];try{let f=ie(x.request),g=h(f);if(t.has(g)||A.has(g))continue;let L=x.availability,O=x.faceIndex,q=x.hash,ne=x.id;if(L!==void 0&&L!=="available"&&L!=="forbidden")throw new TypeError("Font source availability must be available or forbidden");if(!Number.isSafeInteger(O)||O<0)throw new RangeError("Font face index must be a non-negative safe integer");if(typeof q!="string"||q.length===0)throw new TypeError("Font source hash must be a non-empty string");let V;if(L!=="forbidden"){if(typeof ne!="string"||ne.length===0)throw new TypeError("Font source id must be a non-empty string");V=x.bytes;let j=e(V);if(j>P)throw j<=(r??E)?new se(f,j,a$1):new RangeError(`Font source ${f.family} (${j} bytes) exceeds the effective base byte ceiling (${P} bytes)`);if(t.has(g)||A.has(g))continue;if(n+w+j>c)throw new RangeError(`Font sources exceed the aggregate byte ceiling of ${c}`);w+=j;}else V=new Uint8Array(0);if(t.has(g)||A.has(g))continue;if(t.size+A.size>=b)throw new Z(`Font source count must not exceed ${b}`);A.add(g),R.push(g),B.push(Object.freeze({request:f,id:ne,bytes:V,hash:q,faceIndex:O,...L?{availability:L}:{}}));}catch(f){if(f instanceof Z)throw f;S.push(f);}}let T=new Set,_=[];for(let b=0;b<F;b+=1){let x=c$1[b];try{let f=ie(x.from),g=ie(x.to);h(f),h(g);let L=x.lineMetrics,O=L?Object.freeze({heightEm:L.heightEm,baselineEm:L.baselineEm}):void 0;if(O&&(!Number.isFinite(O.heightEm)||!Number.isFinite(O.baselineEm)||O.heightEm<=0||O.heightEm>4||O.baselineEm<0||O.baselineEm>O.heightEm))throw new RangeError("Font substitution line metrics must fit within a bounded em box");let q=h(f);if(t.has(q)||A.has(q)||o.has(q)||T.has(q))continue;T.add(q),_.push(Object.freeze({from:f,to:g,...O?{lineMetrics:O}:{}}));}catch(f){S.push(f);}}if((p>0||F>0)&&B.length===0&&_.length===0&&S.length>0)throw S.length===1?S[0]:new ae(S);let D=o.size;for(let b of A)o.has(b)&&(D-=1);if(D+T.size>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let M;if(d!==void 0){let b=d.family,x=d.sizeHalfPoints;if(h({family:b,weight:400,style:"normal"}),!Number.isSafeInteger(x)||x<=0)throw new RangeError("Default font size must be a positive safe integer in half-points");M=Object.freeze({family:b,sizeHalfPoints:x});}if(m!==void 0&&(!Number.isSafeInteger(m)||m<0))throw new RangeError("Font configuration epoch must be a non-negative safe integer");if(y!==void 0&&typeof y!="string")throw new TypeError("Font shaping language must be a string");let v;if(w>0&&i)try{v=i(w);}catch(b){throw new Q(b)}let X;try{X=B.map(b=>f(b,s));}catch(b){throw v?.(),b}return {fragment:Object.freeze({supportedFamilies:$([e$1.supportedFamilies]),sources:Object.freeze(X),substitutions:Object.freeze(_),...m!==void 0?{epoch:m}:{},...u!==void 0?{maxFontBytes:u}:{},...M?{defaultFont:M}:{},...y!==void 0?{language:y}:{}}),sourceKeys:Object.freeze(R),ownedBytes:w,dropped:Object.freeze(S),releaseOwnedBytes:v}}function et(e){return !Number.isSafeInteger(e)||e<=0?0:e>c?c:e}function tt(e,t,n,o){let{committedSourceBytes:r,...i}=e,s=et(o);return {...i,defaultFamily:t,...n.length>0?{resolvedFaces:n}:{},...s>0?{committedSourceBytes:s}:{}}}function ie(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}function Ue(e){if(e?.aborted)throw e.reason??new DOMException("Font resolution was aborted","AbortError")}function W(e,t,n,o){let r;try{typeof t=="function"&&t.name.length>0&&(r=t.name);}catch{}try{o instanceof Error&&o.stack;}catch{}let i=Object.freeze({originIndex:n,...r!==void 0?{originName:r}:{},cause:o});if(e.onOriginFailure)try{let a=e.onOriginFailure(i);Promise.resolve(a).catch(l=>{console.warn("[fonts] font-origin diagnostic callback failed",l);});return}catch(a){console.warn("[fonts] font-origin diagnostic callback failed",a);}let s="";try{o instanceof Error&&o.message.length>0&&(s=`: ${o.message}`);}catch{}console.warn(`[fonts] a font origin failed and was skipped${s}`,o);}var nt=256,ot=Object.freeze([]);function ee(e){let t=new WeakMap;return (n,o)=>{let r=new Set;for(let i of n){let s=[{node:i,context:o,next:0}],a=l=>{s.pop();let c=s.at(-1)?.found??r;for(let u of l)c.add(u);};for(;s.length;){let l=s[s.length-1],c=t.get(l.node);if(c?.key===l.context.key){a(c.families);continue}if(!l.children){let m=e(l.node,l.context);l.children=m.children,l.found=new Set(m.families);}let u=l.children[l.next++];if(u){s.push({...u,next:0});continue}let d=l.found.size===0?ot:[...l.found];d.length<=nt&&rb(l.node)?t.set(l.node,{key:l.context.key,families:d}):t.delete(l.node),a(d);}}return [...r]}}function te(e,t){return e.children.flatMap(n=>n.kind==="textValue"?[]:[{node:n,context:t}])}var $e=new WeakMap,rt=4096;function Xe(e,t){let n=`${e.baseKey}|${e.depth+1}|${JSON.stringify(t)}`,o=$e.get(e);o||$e.set(e,o=new Map);let r=o.get(n);if(r)return r;let i={...e,depth:e.depth+1,cellStyle:t,key:n};return o.size<rt&&o.set(n,i),i}function it(e,t){let{styles:n,theme:o,supplementalFamilies:r,depth:i}=t;if(e.kind==="table"){let l=Ud(e,468,i,n),c=[];for(let u of l?.rows??[])for(let d of u.cells){let m=Xe(t,d.styleFormatting);for(let y of d.blocks)c.push({node:y,context:m});}return {children:c.reverse()}}let s=new Set;if(e.kind==="paragraph"){let l=e.children.find(u=>u.kind==="paragraphProperties"),c=id(n,l,t.cellStyle).runProperties;for(let u of ic(e,c,void 0,(d,m)=>ld(d,m,n),void 0,void 0,"all-markup",void 0,void 0,o)){if(!u.text||u.fontSlot!=="eastAsia"&&!r.has(u.style.fontFamily??""))continue;let d=b$1((u.fontSlot==="eastAsia"?u.style.fontFamilyEastAsia:u.style.fontFamily)??void 0);d&&s.add(d);}}let a=e.localName==="txbxContent"?{...t,cellStyle:void 0,key:`${t.baseKey}|${i}|undefined`}:t;return {families:[...s],children:te(e,a).reverse()}}function st(){let e=ee(it),t,n,o=(i,s)=>{if(!t||n!==i||t.theme!==s){let a=hd(i,s);n=i,t={key:`${a.cacheToken}|0|undefined`,baseKey:a.cacheToken,styles:a,theme:s,depth:0,supplementalFamilies:new Set([...Object.values(s.majorSupplemental??{}),...Object.values(s.minorSupplemental??{})])};}return t};return Object.assign((i,s,a)=>e([...i].reverse(),o(s,a)),{warmTableRows(i,s,a,l,c){let u=o(l,c),d=Ud(i,468,u.depth,u.styles)?.rows??[];for(let m of d.slice(s,a))for(let y of m.cells)e(y.blocks,Xe(u,y.styleFormatting));return d.length}})}function Ht(e,t,n){return st()(e,t,n)}function le(e,t){return e.attributes.find(n=>n.localName===t)?.value}var at=ee((e,t)=>{let n=[];if(e.namespaceUri===la){if(e.localName==="fldSimple"){let o=Wc(le(e,"instr")??"")?.font;o&&n.push(o);}if(e.localName==="p")for(let o of lt(e))n.push(o);}return {families:n,children:te(e,t)}});function rn(e){let t=new Map;for(let n of at(e,{key:""})){let o=b$1(n);o!==null&&!t.has(o.toLowerCase())&&t.set(o.toLowerCase(),o);}return [...t.values()]}function lt(e){let t=[],n=Vb(),o=[];for(let r=e.children.length-1;r>=0;r-=1){let i=e.children[r];i.kind!=="textValue"&&o.push({node:i,containerDepth:0});}for(;o.length>0;){let{node:r,containerDepth:i}=o.pop();if(i>=wa||r.namespaceUri===la&&r.localName==="p")continue;if(r.namespaceUri===la&&r.localName==="fldChar"){let a=le(r,"fldCharType");a==="begin"?Yb(n):a==="separate"?(n.nesting===1&&Ve(n,t),_b(n)):a==="end"&&(n.nesting===1&&Ve(n,t),$b(n));continue}if(r.namespaceUri===la&&(r.localName==="instrText"||r.localName==="delInstrText")){Zb(n,ut(r),r.localName==="delInstrText");continue}if(r.namespaceUri===la&&r.localName==="fldSimple"){let a=Wc(le(r,"instr")??"");a?.font&&t.push(a.font);}let s=xa(r,i);for(let a=r.children.length-1;a>=0;a-=1){let l=r.children[a];l.kind!=="textValue"&&o.push({node:l,containerDepth:s});}}return Wb(n),t}function Ve(e,t){let n=Xb(e);if(n.overflow)return;let o=Wc(n.instruction);o?.font&&t.push(o.font);}function ut(e){let t="",n=[...e.children].reverse();for(;n.length>0&&t.length<=256;){let o=n.pop();if(o.kind==="textValue")t+=o.value;else for(let r=o.children.length-1;r>=0;r-=1)n.push(o.children[r]);}return t}var ct=()=>true,ft=/[ᄀ-ᇿ⺀-鿿ꥠ-꥿가-퟿豈-﫿︰-﹏＀-￯]/u;function sn(e,t,n,o){if(!t)return [];let r=lc(t),i=hd(n,o),s=new Map;for(let a of e)for(let l of dt(a)){let c=Yc(l.children),u=d=>{if(d)for(let m of d.values()){let y=m.markerText===void 0||ft.test(m.markerText);for(let p of [m.markerStyle.fontFamily,y?m.markerStyle.fontFamilyEastAsia:null]){let F=b$1(p??void 0);if(F===null)continue;let E=F.toLowerCase();s.has(E)||s.set(E,F);}}};u(yc(c,r,i,ct));for(let d of c){let m=We$1(d);for(let y of m.contents)u(Ve$1(y,r,i));}}return [...s.values()].sort((a,l)=>a.localeCompare(l))}function dt(e){if(e.localName==="document"){for(let t of e.children)if(t.kind!=="textValue"&&t.localName==="body")return [t];return []}if(e.localName==="footnotes"||e.localName==="endnotes"){let t=[];for(let n of e.children)n.kind!=="textValue"&&(n.localName==="footnote"||n.localName==="endnote")&&t.push(n);return t}return [e]}var mt="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",yt=256,gt=31;function ue(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===la}function He(e,t){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===la)?.value}function Ke(e){let t=(e.relationships.get(e.mainDocumentPart)??[]).find(a=>a.type===mt),n=t?J$1(t):void 0,r=((n?.mode==="Internal"&&n.target.ok?e.parts.get(n.target.partName):void 0)??e.parts.get("/word/fontTable.xml"))?.root,i=new Map;if(!r||!ue(r,"fonts"))return i;let s=0;for(let a of r.children){if(!ue(a,"font"))continue;if(++s>yt)break;let l=a$1(He(a,"name"));if(!l)continue;let c=a.children.find(y=>ue(y,"altName")),u=c&&c.kind!=="textValue"?He(c,"val"):void 0,d=u!==void 0&&u.length<=gt?a$1(u):null,m=l.trim().toLowerCase();d&&!i.has(m)&&i.set(m,d);}return i}function En(e,t,n){let o=new Set;for(let r of e.substitutions??[]){let i=r.from.family.trim().toLowerCase(),s=r.to.family.trim().toLowerCase(),a=[t.alternates.get(i),t.fallbacks.get(i)].some(l=>l?.trim().toLowerCase()===s);s!==i&&a&&!(n.resolve(r.from)instanceof d)&&o.add(r.from.family.toLowerCase());}return o}function pt(e,t){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===la)?.value}var Ft=new Set(["document","hdr","ftr","footnotes","endnotes","comments","styles","numbering","glossaryDocument"]),ht=new Set(["t","delText","instrText","delInstrText"]),bt=2e6;function xt(e,t){let n=e.stylesRoot(),o=e.documentThemeFonts(),r=[...w(n),...n?Hb(n).run:[]],i=aa(r,o),s=a$1(i.fontFamily??void 0)??t,a=a$1(Jb([{text:"\xE9",props:r,style:i,start:0,end:1}],o)[0]?.style.fontFamily??void 0)??s,l=a$1(i.fontFamilyEastAsia??void 0),c=a$1(i.complexLane?.fontFamily??void 0)??o.minorBidi??t,u=new Map,d=0;for(let p of e.currentPackage().parts.values()){if(p.root.namespaceUri!==la||!Ft.has(p.root.localName))continue;let F=[p.root];for(;F.length>0&&d<bt;){d++;let E=F.pop();if(E.kind!=="textValue"){if(E.namespaceUri===la){if(ht.has(E.localName))continue;if(E.localName==="rFonts"){for(let[P,w]of [["ascii",s],["hAnsi",a],["eastAsia",l],["cs",c]]){let R=a$1(pt(E,P));if(!R||!w)continue;let A=R.trim().toLowerCase(),B=u.get(A)??new Set;B.add(w),u.set(A,B);}continue}}for(let P of E.children)F.push(P);}}}for(let p of a$2)u.delete(p);let m=new Map,y=[];for(let[p,F]of u)F.size===1?m.set(p,[...F][0]):y.push(p);return {fallbacks:m,ambiguousFamilies:y,defaults:new Map([...u].map(([p,F])=>[p,[...F]]))}}function wt(e,t,n=[],o="Calibri"){let r=Ke(e.currentPackage()),i=xt(e,o),s=t.flatMap(c=>{let u=r.get(c.trim().toLowerCase());return u?[u]:[]}),a=new Map,l=t.flatMap(c=>i.defaults.get(c.trim().toLowerCase())??[]).filter(c=>c.trim().toLowerCase()!==o.trim().toLowerCase());for(let c of [...t,...s,...n,...l]){let u=a$1(c);if(u&&!a.has(u.trim().toLowerCase())&&a.set(u.trim().toLowerCase(),u),a.size===De)break}return {families:[...a.values()],alternates:r,fallbacks:i.fallbacks,ambiguousFamilies:i.ambiguousFamilies}}function Sn(e,t,n){let o=G(n),r=wt(e,t,[],o);return {plan:r,request:{families:r.families,defaultFamily:o}}}function On(e,t,n=t.fallbacks){let o=new Map(e.sources.map(a=>[h(a.request),a.request])),r=[],i=new Set((e.substitutions??[]).map(a=>h(a.from))),s=Math.max(0,b-i.size);for(let a of t.families){let l=a.trim().toLowerCase(),c=t.alternates.get(l),u=n.get(l);for(let d of [400,700])for(let m of ["normal","italic"]){let y={family:a,weight:d,style:m};if(!o.has(h(y)))for(let p of [c,u]){if(!p||p.trim().toLowerCase()===l)continue;let F=o.get(h({family:p,weight:d,style:m}));if(F){if(!i.has(h(y))){if(s===0)break;s--;}r.push({from:y,to:F});break}}}}return Y({...e,substitutions:[...r,...e.substitutions??[]]})}var Et={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function kn(e,t){let n=[],o=[],r=0;for(let i of e){let s=i.bytes.byteLength;if(!Number.isSafeInteger(s)||s>t||s>a||s>c-r){o.push(i);continue}r+=s,n.push(i);}return {sources:n,dropped:o}}function An(e,t,n){let o=t.reduce((i,s)=>i+s.bytes.byteLength,0),r=new Set(t.filter(i=>i.request.family.trim().length>0).map(i=>h(i.request)));return St(e,{maxFontBytes:n,aggregateBudget:Math.max(0,c-o),shadowedRequests:r})}function St(e,t){let n=[],o=[],r=t.aggregateBudget,i=new Set;for(let s of e){let a=Et[s.style],l=Object.freeze({family:s.family,weight:a.weight,style:a.style});if(s.family.trim().length===0){o.push({request:l,partName:s.partName,reason:"malformed"});continue}let c=h(l);if(!(t.shadowedRequests?.has(c)||i.has(c))){if(i.add(c),s.bytes.byteLength>t.maxFontBytes||s.bytes.byteLength>r){o.push({request:l,partName:s.partName,reason:"overLimit"});continue}r-=s.bytes.byteLength,n.push({request:l,id:`embedded:${s.partName}#${s.style}`,bytes:s.bytes,hash:f$1(s.bytes),faceIndex:0});}}return {sources:n,dropped:o}}
2
+ export{kn as A,An as B,St as C,$ as a,kt as b,De as c,re as d,At as e,Y as f,G as g,We as h,ze as i,Lt as j,It as k,se as l,ae as m,Pt as n,Bt as o,ee as p,te as q,st as r,Ht as s,rn as t,lt as u,sn as v,En as w,wt as x,Sn as y,On as z};
@@ -0,0 +1 @@
1
+ var c=Object.freeze({review:null,collaboration:null,customNodes:Object.freeze([]),customNodePayloadNamespaces:Object.freeze([]),customNodeDiagnostics:Object.freeze([]),diagnosticListeners:Object.freeze([]),wantsDiagnostic:()=>false});function u(e){if(!e||e.length===0)return c;let i=null,t=null,r=[],a=new Set,s=[],d=[],l=[];for(let o of e){o.review&&i===null&&(i=o.review),o.collaboration&&t===null&&(t=o.collaboration),o.customNodes&&r.push(...o.customNodes);for(let n of o.customNodePayloadNamespaces??[])a.add(n);o.onCustomNodeDiagnostic&&s.push(o.onCustomNodeDiagnostic),o.onDiagnostic&&(d.push(o.onDiagnostic),l.push(o.wantsDiagnostic??(()=>true)));}return {review:i,collaboration:t,customNodes:r,customNodePayloadNamespaces:[...a],customNodeDiagnostics:s,diagnosticListeners:d,wantsDiagnostic:o=>l.some(n=>{try{return n(o)===!0}catch{return false}})}}export{u as a};