@betteroffice/docx 0.2.0 → 0.3.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 (69) hide show
  1. package/README.md +522 -3
  2. package/dist/{chunk-JHJLG4I6.mjs → chunk-5B4VMUXM.mjs} +1 -1
  3. package/dist/chunk-5JEQC76K.mjs +1 -0
  4. package/dist/chunk-7GJG6LLU.mjs +1 -0
  5. package/dist/chunk-FE6FWGBJ.mjs +1 -0
  6. package/dist/chunk-H5YYCN42.mjs +1 -0
  7. package/dist/chunk-NT2OYIJ4.mjs +57 -0
  8. package/dist/chunk-QE4ZDRKV.mjs +1 -0
  9. package/dist/chunk-VQXNED2P.mjs +2 -0
  10. package/dist/chunk-Z4HZIPBS.mjs +1 -0
  11. package/dist/collaboration/index.d.mts +8 -6
  12. package/dist/compareDocx-XXTZV4CG.mjs +1 -0
  13. package/dist/computeLayout-LWLAJWYA.mjs +1 -0
  14. package/dist/{content-CvEtPl0c.d.mts → content-BzoC6bSz.d.mts} +48 -8
  15. package/dist/core.d.mts +172 -9
  16. package/dist/core.mjs +1 -1
  17. package/dist/{displayListQueries-DF8F6fMl.d.mts → displayListQueries-BYFrBkw5.d.mts} +2 -2
  18. package/dist/docx/index.d.mts +5 -4
  19. package/dist/docx/index.mjs +1 -1
  20. package/dist/editor/index.d.mts +10 -8
  21. package/dist/editor/index.mjs +1 -1
  22. package/dist/{fontLoader-b8eicJKV.d.mts → fontLoader-CkXcPB1C.d.mts} +1 -1
  23. package/dist/{formatting-7zKCTu5a.d.mts → formatting-gqLFeJ9X.d.mts} +8 -0
  24. package/dist/{frameDelta-pA4jrQ1G.d.mts → frameDelta-CVt5FAXT.d.mts} +14 -3
  25. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  26. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  27. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  28. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  29. package/dist/{index-CHl2zLJ7.d.mts → index-BbZwdkPz.d.mts} +457 -29
  30. package/dist/layout/index.d.mts +6 -6
  31. package/dist/layout/index.mjs +1 -1
  32. package/dist/layout/pagination/index.d.mts +4 -4
  33. package/dist/layout/render/index.d.mts +12 -10
  34. package/dist/layout/render/index.mjs +1 -1
  35. package/dist/pagedExport-D3E4jZ-B.d.mts +907 -0
  36. package/dist/plugin-api/RenderedDomContext.d.mts +10 -9
  37. package/dist/plugin-api/RenderedDomContext.mjs +1 -1
  38. package/dist/plugin-api/index.d.mts +21 -4
  39. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  40. package/dist/rezip-Bxiq4Z_R.d.mts +24 -0
  41. package/dist/{rustDisplayList-BJqaN9tt.d.mts → rustDisplayList-CwOoUn3t.d.mts} +2 -2
  42. package/dist/{rustMeasureSource-C0EZB055.d.mts → rustMeasureSource-CyBMcy1x.d.mts} +12 -4
  43. package/dist/{selectiveSave-CRh-_Y_C.d.mts → selectiveSave-r-NMK6aI.d.mts} +1 -22
  44. package/dist/styles/index.d.mts +2 -2
  45. package/dist/{styles-7e-mq3c-.d.mts → styles-AryxLAhx.d.mts} +1 -1
  46. package/dist/types/content.d.mts +2 -2
  47. package/dist/types/document.d.mts +6 -6
  48. package/dist/{types-C4A8mWjU.d.mts → types-B4jD0rrc.d.mts} +19 -2
  49. package/dist/utils/comments.d.mts +2 -2
  50. package/dist/utils/index.d.mts +7 -4
  51. package/dist/utils/index.mjs +1 -1
  52. package/dist/utils/stylePreview.d.mts +2 -2
  53. package/dist/wasm-G62X4WRW.mjs +1 -0
  54. package/dist/wasm-US6R7SWN.mjs +1 -0
  55. package/dist/wasm-edit.d.mts +246 -13
  56. package/dist/wasm-edit.mjs +1 -1
  57. package/dist/wasm-layout.d.mts +8 -1
  58. package/dist/wasm-layout.mjs +1 -1
  59. package/dist/yrs/index.d.mts +7 -5
  60. package/dist/yrs/index.mjs +1 -1
  61. package/dist/yrs/residentEngineWorker.mjs +1 -1
  62. package/package.json +2 -2
  63. package/dist/chunk-6LQJAKOC.mjs +0 -1
  64. package/dist/chunk-AFMVSI4Z.mjs +0 -57
  65. package/dist/chunk-GD4VNJ64.mjs +0 -1
  66. package/dist/chunk-WRWRCBLK.mjs +0 -1
  67. package/dist/chunk-WTFRNX5K.mjs +0 -1
  68. package/dist/wasm-7SOSHNGP.mjs +0 -1
  69. package/dist/wasm-ZQAVP7P2.mjs +0 -1
@@ -1,13 +1,13 @@
1
- import { RenderedDomContext, PositionCoordinates } from './index.mjs';
2
- import { D as DisplayListRect, a as DisplayListQueries } from '../displayListQueries-DF8F6fMl.mjs';
1
+ import { RenderedDomContext, PositionCoordinates, PointPosition } from './index.mjs';
2
+ import { D as DisplayListRect, a as DisplayListQueries } from '../displayListQueries-BYFrBkw5.mjs';
3
3
  import '../types/document.mjs';
4
- import '../content-CvEtPl0c.mjs';
5
- import '../formatting-7zKCTu5a.mjs';
4
+ import '../content-BzoC6bSz.mjs';
5
+ import '../formatting-gqLFeJ9X.mjs';
6
6
  import '../docx/wrapTypes.mjs';
7
- import '../styles-7e-mq3c-.mjs';
8
- import '../frameDelta-pA4jrQ1G.mjs';
9
- import '../rustDisplayList-BJqaN9tt.mjs';
10
- import '../types-C4A8mWjU.mjs';
7
+ import '../styles-AryxLAhx.mjs';
8
+ import '../frameDelta-CVt5FAXT.mjs';
9
+ import '../rustDisplayList-CwOoUn3t.mjs';
10
+ import '../types-B4jD0rrc.mjs';
11
11
  import '../layout/pagination/index.mjs';
12
12
 
13
13
  /**
@@ -74,6 +74,7 @@ declare class RenderedDomContextImpl implements RenderedDomContext {
74
74
  * Uses the browser's text rendering via Range API for precise positioning.
75
75
  */
76
76
  getCoordinatesForPosition(position: number): PositionCoordinates | null;
77
+ getPositionAtPoint(clientX: number, clientY: number): PointPosition | null;
77
78
  /**
78
79
  * Find DOM elements that overlap with a display-position range.
79
80
  */
@@ -109,6 +110,6 @@ declare class RenderedDomContextImpl implements RenderedDomContext {
109
110
  * @param options - query/projector backend options. Omit for the mirror-DOM
110
111
  * fallback.
111
112
  */
112
- declare function createRenderedDomContext(pagesContainer: HTMLElement, zoom?: number, options?: RenderedDomContextOptions): RenderedDomContext;
113
+ declare function createRenderedDomContext(pagesContainer: HTMLElement, zoom?: number, options?: RenderedDomContextOptions): RenderedDomContext & Required<Pick<RenderedDomContext, 'getPositionAtPoint'>>;
113
114
 
114
115
  export { type DisplayListPageProjector, type ProjectedDisplayListRect, RenderedDomContextImpl, type RenderedDomContextOptions, createCanvasHostProjector, createRenderedDomContext };
@@ -1 +1 @@
1
- import {a}from'../chunk-WRWRCBLK.mjs';import {b}from'../chunk-TTRUPDAB.mjs';function E(h,n,s=1){let t=s>0?s:1,o=e=>{let r=n.pageSize(e.pageIndex),i=a(h,n,e.pageIndex);if(!i||!r||r.width<=0||r.height<=0)return null;let a$1=h.getBoundingClientRect(),c=i.width/r.width,u=i.height/r.height;return {x:(i.left-a$1.left+e.x*c)/t,y:(i.top-a$1.top+e.y*u)/t,width:e.width*c/t,height:e.height*u/t}};return {projectRect:o,getPageBounds:e=>{let r=n.pageBounds(e);return r?o(r):null}}}var f=class{constructor(n,s=1,t){b(this,"pagesContainer");b(this,"zoom");b(this,"queries");b(this,"projector");if(this.pagesContainer=n,this.zoom=s,this.queries=t?.displayListQueries??null,this.projector=t?.projector??null,this.queries===null!=(this.projector===null))throw new Error("RenderedDomContext requires displayListQueries and projector together")}spanEntries(){let n=[],s=Array.from(this.pagesContainer.querySelectorAll(".layout-page-content")),t=s.length>0?s:[this.pagesContainer];for(let o of t)for(let e of Array.from(o.querySelectorAll("span[data-doc-start][data-doc-end]")))n.push({el:e,start:Number(e.dataset.docStart),end:Number(e.dataset.docEnd)});return n}emptyRuns(){return Array.from(this.pagesContainer.querySelectorAll(".layout-empty-run"))}getCoordinatesForPosition(n){if(this.queries&&this.projector){let t=this.queries.caretRect(n),o=t?this.projector.projectRect(t):null;return o?{x:o.x,y:o.y,height:o.height}:null}let s=this.pagesContainer.getBoundingClientRect();for(let{el:t,start:o,end:e}of this.spanEntries()){let r=t;if(t.classList.contains("layout-run-tab")){if(n>=o&&n<e){let i=t.getBoundingClientRect(),a=t.closest(".layout-line"),c=a?a.offsetHeight:16;return {x:(i.left-s.left)/this.zoom,y:(i.top-s.top)/this.zoom,height:c/this.zoom}}continue}if(n>=o&&n<=e&&r.firstChild?.nodeType===Node.TEXT_NODE){let i=r.firstChild,a=Math.min(n-o,i.length),c=t.ownerDocument;if(!c)continue;let u=c.createRange();u.setStart(i,a),u.setEnd(i,a);let p=u.getBoundingClientRect(),d=t.closest(".layout-line"),l=d?d.offsetHeight:16;return {x:(p.left-s.left)/this.zoom,y:(p.top-s.top)/this.zoom,height:l/this.zoom}}}for(let t of this.emptyRuns()){let o=t.closest(".layout-paragraph");if(!o)continue;let e=Number(o.dataset.docStart),r=Number(o.dataset.docEnd);if(n>=e&&n<=r){let i=t.getBoundingClientRect(),a=t.closest(".layout-line"),c=a?a.offsetHeight:16;return {x:(i.left-s.left)/this.zoom,y:(i.top-s.top)/this.zoom,height:c/this.zoom}}}return null}findElementsForRange(n,s){let t=[];for(let{el:o,start:e,end:r}of this.spanEntries())r>n&&e<s&&t.push(o);return t}getRectsForRange(n,s){if(this.queries&&this.projector)return this.queries.rangeRects(n,s).map(e=>this.projector.projectRect(e)).filter(e=>e!==null);let t=this.pagesContainer.getBoundingClientRect(),o=[];for(let{el:e,start:r,end:i}of this.spanEntries()){let a=e;if(i>n&&r<s){if(e.classList.contains("layout-run-tab")){let l=e.getBoundingClientRect();o.push({x:(l.left-t.left)/this.zoom,y:(l.top-t.top)/this.zoom,width:l.width/this.zoom,height:l.height/this.zoom});continue}if(a.firstChild?.nodeType!==Node.TEXT_NODE)continue;let c=a.firstChild,u=e.ownerDocument;if(!u)continue;let p=Math.max(0,n-r),d=Math.min(c.length,s-r);if(p<d){let l=u.createRange();l.setStart(c,p),l.setEnd(c,d);let R=l.getClientRects();for(let m of Array.from(R))o.push({x:(m.left-t.left)/this.zoom,y:(m.top-t.top)/this.zoom,width:m.width/this.zoom,height:m.height/this.zoom});}}}return o}getCoordinatesForHfPosition(n,s,t,o){if(!this.queries||!this.projector)return null;let e=this.queries.hfCaretRects(n,s,t).find(i=>i.pageIndex===o),r=e?this.projector.projectRect(e):null;return r?{x:r.x,y:r.y,height:r.height}:null}getRectsForHfRange(n,s,t,o,e){return !this.queries||!this.projector?[]:this.queries.hfRangeRects(n,s,t,o).filter(r=>r.pageIndex===e).map(r=>this.projector.projectRect(r)).filter(r=>r!==null)}getPageBounds(n){if(this.projector)return this.projector.getPageBounds(n);let s=this.pagesContainer.querySelectorAll(".layout-page"),t=Array.from(s).find((r,i)=>Number(r.dataset.pageIndex??i)===n);if(!t)return null;let o=t.getBoundingClientRect(),e=this.pagesContainer.getBoundingClientRect();return {x:(o.left-e.left)/this.zoom,y:(o.top-e.top)/this.zoom,width:o.width/this.zoom,height:o.height/this.zoom}}getContainerOffset(){let n=this.pagesContainer.parentElement;if(!n)return {x:0,y:0};let s=this.pagesContainer.getBoundingClientRect(),t=n.getBoundingClientRect();return {x:(s.left-t.left)/this.zoom,y:(s.top-t.top)/this.zoom}}};function L(h,n=1,s){return new f(h,n,s)}export{f as RenderedDomContextImpl,E as createCanvasHostProjector,L as createRenderedDomContext};
1
+ import {b as b$1,a}from'../chunk-7GJG6LLU.mjs';import {b}from'../chunk-TTRUPDAB.mjs';function L(h,n,r=1){let t=r>0?r:1,e=o=>{let i=n.pageSize(o.pageIndex),s=a(h,n,o.pageIndex);if(!s||!i||i.width<=0||i.height<=0)return null;let a$1=h.getBoundingClientRect(),c=s.width/i.width,u=s.height/i.height;return {x:(s.left-a$1.left+o.x*c)/t,y:(s.top-a$1.top+o.y*u)/t,width:o.width*c/t,height:o.height*u/t}};return {projectRect:e,getPageBounds:o=>{let i=n.pageBounds(o);return i?e(i):null}}}var f=class{constructor(n,r=1,t){b(this,"pagesContainer");b(this,"zoom");b(this,"queries");b(this,"projector");if(this.pagesContainer=n,this.zoom=r,this.queries=t?.displayListQueries??null,this.projector=t?.projector??null,this.queries===null!=(this.projector===null))throw new Error("RenderedDomContext requires displayListQueries and projector together")}spanEntries(){let n=[],r=Array.from(this.pagesContainer.querySelectorAll(".layout-page-content")),t=r.length>0?r:[this.pagesContainer];for(let e of t)for(let o of Array.from(e.querySelectorAll("span[data-doc-start][data-doc-end]")))n.push({el:o,start:Number(o.dataset.docStart),end:Number(o.dataset.docEnd)});return n}emptyRuns(){return Array.from(this.pagesContainer.querySelectorAll(".layout-empty-run"))}getCoordinatesForPosition(n){if(this.queries&&this.projector){let t=this.queries.caretRect(n),e=t?this.projector.projectRect(t):null;return e?{x:e.x,y:e.y,height:e.height}:null}let r=this.pagesContainer.getBoundingClientRect();for(let{el:t,start:e,end:o}of this.spanEntries()){let i=t;if(t.classList.contains("layout-run-tab")){if(n>=e&&n<o){let s=t.getBoundingClientRect(),a=t.closest(".layout-line"),c=a?a.offsetHeight:16;return {x:(s.left-r.left)/this.zoom,y:(s.top-r.top)/this.zoom,height:c/this.zoom}}continue}if(n>=e&&n<=o&&i.firstChild?.nodeType===Node.TEXT_NODE){let s=i.firstChild,a=Math.min(n-e,s.length),c=t.ownerDocument;if(!c)continue;let u=c.createRange();u.setStart(s,a),u.setEnd(s,a);let p=u.getBoundingClientRect(),d=t.closest(".layout-line"),l=d?d.offsetHeight:16;return {x:(p.left-r.left)/this.zoom,y:(p.top-r.top)/this.zoom,height:l/this.zoom}}}for(let t of this.emptyRuns()){let e=t.closest(".layout-paragraph");if(!e)continue;let o=Number(e.dataset.docStart),i=Number(e.dataset.docEnd);if(n>=o&&n<=i){let s=t.getBoundingClientRect(),a=t.closest(".layout-line"),c=a?a.offsetHeight:16;return {x:(s.left-r.left)/this.zoom,y:(s.top-r.top)/this.zoom,height:c/this.zoom}}}return null}getPositionAtPoint(n,r){if(!this.queries||!Number.isFinite(n)||!Number.isFinite(r))return null;let t=b$1(this.pagesContainer,this.queries,n,r),e=t?.hit;return !t||!e||e.pos===null||e.target!=="text"||(e.region==="header"||e.region==="footer")&&!e.rId||(e.region==="footnote"||e.region==="endnote")&&e.noteId===void 0?null:{position:e.pos,pageIndex:t.pageIndex,region:e.region,...e.rId===void 0?{}:{rId:e.rId},...e.noteId===void 0?{}:{noteId:e.noteId}}}findElementsForRange(n,r){let t=[];for(let{el:e,start:o,end:i}of this.spanEntries())i>n&&o<r&&t.push(e);return t}getRectsForRange(n,r){if(this.queries&&this.projector)return this.queries.rangeRects(n,r).map(o=>this.projector.projectRect(o)).filter(o=>o!==null);let t=this.pagesContainer.getBoundingClientRect(),e=[];for(let{el:o,start:i,end:s}of this.spanEntries()){let a=o;if(s>n&&i<r){if(o.classList.contains("layout-run-tab")){let l=o.getBoundingClientRect();e.push({x:(l.left-t.left)/this.zoom,y:(l.top-t.top)/this.zoom,width:l.width/this.zoom,height:l.height/this.zoom});continue}if(a.firstChild?.nodeType!==Node.TEXT_NODE)continue;let c=a.firstChild,u=o.ownerDocument;if(!u)continue;let p=Math.max(0,n-i),d=Math.min(c.length,r-i);if(p<d){let l=u.createRange();l.setStart(c,p),l.setEnd(c,d);let b=l.getClientRects();for(let m of Array.from(b))e.push({x:(m.left-t.left)/this.zoom,y:(m.top-t.top)/this.zoom,width:m.width/this.zoom,height:m.height/this.zoom});}}}return e}getCoordinatesForHfPosition(n,r,t,e){if(!this.queries||!this.projector)return null;let o=this.queries.hfCaretRects(n,r,t).find(s=>s.pageIndex===e),i=o?this.projector.projectRect(o):null;return i?{x:i.x,y:i.y,height:i.height}:null}getRectsForHfRange(n,r,t,e,o){return !this.queries||!this.projector?[]:this.queries.hfRangeRects(n,r,t,e).filter(i=>i.pageIndex===o).map(i=>this.projector.projectRect(i)).filter(i=>i!==null)}getPageBounds(n){if(this.projector)return this.projector.getPageBounds(n);let r=this.pagesContainer.querySelectorAll(".layout-page"),t=Array.from(r).find((i,s)=>Number(i.dataset.pageIndex??s)===n);if(!t)return null;let e=t.getBoundingClientRect(),o=this.pagesContainer.getBoundingClientRect();return {x:(e.left-o.left)/this.zoom,y:(e.top-o.top)/this.zoom,width:e.width/this.zoom,height:e.height/this.zoom}}getContainerOffset(){let n=this.pagesContainer.parentElement;if(!n)return {x:0,y:0};let r=this.pagesContainer.getBoundingClientRect(),t=n.getBoundingClientRect();return {x:(r.left-t.left)/this.zoom,y:(r.top-t.top)/this.zoom}}};function j(h,n=1,r){return new f(h,n,r)}export{f as RenderedDomContextImpl,L as createCanvasHostProjector,j as createRenderedDomContext};
@@ -1,8 +1,8 @@
1
1
  import { Document } from '../types/document.mjs';
2
- import '../content-CvEtPl0c.mjs';
3
- import '../formatting-7zKCTu5a.mjs';
2
+ import '../content-BzoC6bSz.mjs';
3
+ import '../formatting-gqLFeJ9X.mjs';
4
4
  import '../docx/wrapTypes.mjs';
5
- import '../styles-7e-mq3c-.mjs';
5
+ import '../styles-AryxLAhx.mjs';
6
6
 
7
7
  /**
8
8
  * Framework-Agnostic Plugin Interface for the DOCX Editor
@@ -22,6 +22,14 @@ interface PositionCoordinates {
22
22
  y: number;
23
23
  height: number;
24
24
  }
25
+ /** A caret position within a page's body, header, footer, or note. */
26
+ interface PointPosition {
27
+ position: number;
28
+ pageIndex: number;
29
+ region: 'body' | 'header' | 'footer' | 'footnote' | 'endnote';
30
+ rId?: string;
31
+ noteId?: number;
32
+ }
25
33
  /**
26
34
  * Context for accessing rendered-page geometry in the paged editor.
27
35
  *
@@ -41,6 +49,11 @@ interface RenderedDomContext {
41
49
  * Returns null if the position cannot be found.
42
50
  */
43
51
  getCoordinatesForPosition(position: number): PositionCoordinates | null;
52
+ /**
53
+ * Client coordinates to a region-local caret; null outside text or without ready canvas queries.
54
+ * Optional so contexts written before it keep compiling; a context without it answers null.
55
+ */
56
+ getPositionAtPoint?(clientX: number, clientY: number): PointPosition | null;
44
57
  /**
45
58
  * Find DOM elements that overlap with a display-position range.
46
59
  */
@@ -83,6 +96,7 @@ interface RenderedDomContext {
83
96
  }
84
97
  /**
85
98
  * Props passed to plugin panel components (framework-agnostic base).
99
+ * @deprecated Use `DocxPluginPanel` from `@betteroffice/docx-react`.
86
100
  */
87
101
  interface PluginPanelProps<TState = unknown> {
88
102
  /** Current serializer-facing document snapshot. */
@@ -103,6 +117,7 @@ interface PluginPanelProps<TState = unknown> {
103
117
  }
104
118
  /**
105
119
  * Configuration for plugin panel rendering.
120
+ * @deprecated Use `DocxPluginPanel` from `@betteroffice/docx-react`.
106
121
  */
107
122
  interface PanelConfig {
108
123
  /** Where to render the panel */
@@ -130,6 +145,7 @@ interface PanelConfig {
130
145
  *
131
146
  * Framework adapters (ReactEditorPlugin, VueEditorPlugin) extend this
132
147
  * with their own Panel component type and renderOverlay function.
148
+ * @deprecated Use `defineDocxPlugin` and the `plugins` prop of `@betteroffice/docx-react`.
133
149
  */
134
150
  interface EditorPluginCore<TState = any> {
135
151
  /** Unique plugin identifier */
@@ -180,6 +196,7 @@ interface SidebarItem {
180
196
  }
181
197
  /**
182
198
  * Context provided to plugins when computing sidebar items.
199
+ * @deprecated Use `DocxPluginSidebarItem` from `@betteroffice/docx-react`.
183
200
  */
184
201
  interface SidebarItemContext {
185
202
  document: Document | null;
@@ -189,4 +206,4 @@ interface SidebarItemContext {
189
206
  zoom: number;
190
207
  }
191
208
 
192
- export type { EditorPluginCore, PanelConfig, PluginPanelProps, PositionCoordinates, RenderedDomContext, SidebarItem, SidebarItemContext };
209
+ export type { EditorPluginCore, PanelConfig, PluginPanelProps, PointPosition, PositionCoordinates, RenderedDomContext, SidebarItem, SidebarItemContext };
@@ -1,9 +1,9 @@
1
1
  import { SidebarItem, RenderedDomContext } from './index.mjs';
2
2
  import '../types/document.mjs';
3
- import '../content-CvEtPl0c.mjs';
4
- import '../formatting-7zKCTu5a.mjs';
3
+ import '../content-BzoC6bSz.mjs';
4
+ import '../formatting-gqLFeJ9X.mjs';
5
5
  import '../docx/wrapTypes.mjs';
6
- import '../styles-7e-mq3c-.mjs';
6
+ import '../styles-AryxLAhx.mjs';
7
7
 
8
8
  /**
9
9
  * Pure layout algorithm: given a list of sidebar items + their
@@ -0,0 +1,24 @@
1
+ import { Document } from './types/document.mjs';
2
+
3
+ /**
4
+ * Public DOCX package I/O wrappers.
5
+ *
6
+ * Model serialization and selective package writing are Rust-owned. The
7
+ * TypeScript kept here is compatibility glue for public ZIP utilities and host
8
+ * values; package inflation/deflation continues through `docx-container` wasm.
9
+ * @packageDocumentation
10
+ * @public
11
+ */
12
+
13
+ interface RepackOptions {
14
+ /** Retained for signature compatibility; `docx-container` chooses compression. */
15
+ compressionLevel?: number;
16
+ updateModifiedDate?: boolean;
17
+ modifiedBy?: string;
18
+ }
19
+ /** Repack a public Document through the Rust package writer. */
20
+ declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
21
+ declare function updateMultipleFiles(originalBuffer: ArrayBuffer, updates: Map<string, string | ArrayBuffer>, options?: RepackOptions): Promise<ArrayBuffer>;
22
+ declare function createDocx(doc: Document): Promise<ArrayBuffer>;
23
+
24
+ export { type RepackOptions as R, createDocx as c, repackDocx as r, updateMultipleFiles as u };
@@ -1,6 +1,6 @@
1
- import { L as Layout } from './types-C4A8mWjU.mjs';
1
+ import { L as Layout } from './types-B4jD0rrc.mjs';
2
2
  import { MeasuredBlock } from './layout/pagination/index.mjs';
3
- import { D as DisplayList, R as RetainedFrame } from './frameDelta-pA4jrQ1G.mjs';
3
+ import { D as DisplayList, R as RetainedFrame } from './frameDelta-CVt5FAXT.mjs';
4
4
 
5
5
  /**
6
6
  * JS seam to the Rust display-list builder.
@@ -42,9 +42,10 @@ interface BundledFontProvider {
42
42
  * Optional so mock/partial providers can omit it; when absent (or returning
43
43
  * undefined) an unmapped family still yields an empty chain and the caller
44
44
  * browser-falls-back that run — the pre-policy behavior. Same lazy loader
45
- * contract as {@link BundledFontProvider.resolve}.
45
+ * contract as {@link BundledFontProvider.resolve}. This registry passes
46
+ * `office: 'word'` so the pick follows Word's substitution.
46
47
  */
47
- resolveLastResort?(family: string, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
48
+ resolveLastResort?(family: string, bold: boolean, italic: boolean, office?: 'word' | 'powerpoint'): (() => Promise<ArrayBuffer>) | undefined;
48
49
  }
49
50
  /**
50
51
  * One embedded face extracted from the open document. Structurally identical
@@ -71,6 +72,13 @@ type BundledFontProviderSource = BundledFontProvider | (() => Promise<BundledFon
71
72
 
72
73
  interface RustTextEngine {
73
74
  registerFont(bytes: Uint8Array): number;
75
+ /**
76
+ * Measurement view of `id` carrying the vertical metrics and advance pitch
77
+ * Word measures `family` with; `id` when the engine knows none. Optional so
78
+ * a host that predates it still measures, with the substitute's own
79
+ * metrics.
80
+ */
81
+ registerSubstituteFont?(id: number, family: string): number;
74
82
  clearFonts(): void;
75
83
  }
76
84
  interface ResidentFontRequirement {
@@ -83,8 +91,8 @@ interface ResidentFontRequirement {
83
91
  interface ResidentMeasurementConfig {
84
92
  fontChains: Record<string, number[]>;
85
93
  defaults: {
86
- fontSize: 11;
87
- fontFamily: 'Calibri';
94
+ fontSize: number;
95
+ fontFamily: string;
88
96
  };
89
97
  compat: {
90
98
  noLeading: boolean;
@@ -19,27 +19,6 @@ interface ParseOptions {
19
19
  }
20
20
  declare function parseDocx(input: DocxInput, options?: ParseOptions): Promise<Document>;
21
21
 
22
- /**
23
- * Public DOCX package I/O wrappers.
24
- *
25
- * Model serialization and selective package writing are Rust-owned. The
26
- * TypeScript kept here is compatibility glue for public ZIP utilities and host
27
- * values; package inflation/deflation continues through `docx-container` wasm.
28
- * @packageDocumentation
29
- * @public
30
- */
31
-
32
- interface RepackOptions {
33
- /** Retained for signature compatibility; `docx-container` chooses compression. */
34
- compressionLevel?: number;
35
- updateModifiedDate?: boolean;
36
- modifiedBy?: string;
37
- }
38
- /** Repack a public Document through the Rust package writer. */
39
- declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
40
- declare function updateMultipleFiles(originalBuffer: ArrayBuffer, updates: Map<string, string | ArrayBuffer>, options?: RepackOptions): Promise<ArrayBuffer>;
41
- declare function createDocx(doc: Document): Promise<ArrayBuffer>;
42
-
43
22
  /** Rust-backed selective DOCX save compatibility wrapper. */
44
23
 
45
24
  interface SelectiveSaveOptions {
@@ -53,4 +32,4 @@ interface SelectiveSaveOptions {
53
32
  */
54
33
  declare function attemptSelectiveSave(doc: Document, originalBuffer: ArrayBuffer, options: SelectiveSaveOptions): Promise<ArrayBuffer | null>;
55
34
 
56
- export { attemptSelectiveSave as a, createDocx as c, parseDocx as p, repackDocx as r, updateMultipleFiles as u };
35
+ export { attemptSelectiveSave as a, parseDocx as p };
@@ -1,5 +1,5 @@
1
- import { a as ParagraphFormatting, b as TextFormatting } from '../formatting-7zKCTu5a.mjs';
2
- import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-7e-mq3c-.mjs';
1
+ import { a as ParagraphFormatting, b as TextFormatting } from '../formatting-gqLFeJ9X.mjs';
2
+ import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-AryxLAhx.mjs';
3
3
 
4
4
  /**
5
5
  * Style Resolver
@@ -1,4 +1,4 @@
1
- import { b as TextFormatting, a as ParagraphFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting } from './formatting-7zKCTu5a.mjs';
1
+ import { b as TextFormatting, a as ParagraphFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting } from './formatting-gqLFeJ9X.mjs';
2
2
 
3
3
  /**
4
4
  * Styles, Theme, Font Table, Relationships & Media Types
@@ -1,3 +1,3 @@
1
- export { B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, d as Chart, p as ChartAxis, q as ChartContent, t as ChartLegend, x as ChartSeries, y as ChartType, z as Column, e as Comment, J as CommentRangeEnd, K as CommentRangeStart, M as ComplexField, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, g as DocumentBody, U as DrawingContent, j as Endnote, X as EndnotePosition, E as EndnoteProperties, Y as Field, Z as FieldCharContent, a0 as FieldType, a1 as FooterReference, i as Footnote, a2 as FootnotePosition, F as FootnoteProperties, H as HeaderFooter, a3 as HeaderFooterType, a4 as HeaderReference, a6 as Hyperlink, a8 as Image, a9 as ImageCrop, ac as ImagePadding, ad as ImagePosition, af as ImageSize, ag as ImageTransform, ah as ImageWrap, aj as InlineSdt, ak as Insertion, al as InstrTextContent, an as LineNumberRestart, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aF as PageOrientation, P as Paragraph, aG as ParagraphContent, aH as ParagraphPropertyChange, aI as PictureWatermark, aJ as PropertyChangeInfo, bi as RawXml, aK as Run, aL as RunContent, aM as RunPropertyChange, aO as SdtDataBinding, a as SdtProperties, aR as SdtType, aS as Section, f as SectionProperties, aT as SectionStart, aU as SeparatorContent, aV as Shape, aW as ShapeContent, aZ as ShapeTextBody, a_ as SimpleField, a$ as SoftHyphenContent, b2 as SymbolContent, b3 as TabContent, b4 as Table, b5 as TableCell, b6 as TableCellPropertyChange, b7 as TablePropertyChange, b8 as TableRow, b9 as TableRowPropertyChange, ba as TableStructuralChangeInfo, bb as TextBox, bc as TextContent, bd as TextWatermark, be as TrackedChangeInfo, bf as TrackedRunChange, bg as VerticalAlign, W as Watermark, bh as pictureWatermarkDisplayEmu } from '../content-CvEtPl0c.mjs';
2
- export { k as ShapeFill, l as ShapeOutline, m as ShapeType } from '../formatting-7zKCTu5a.mjs';
1
+ export { B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, d as Chart, p as ChartAxis, q as ChartContent, t as ChartLegend, x as ChartSeries, y as ChartType, z as Column, e as Comment, J as CommentRangeEnd, K as CommentRangeStart, M as ComplexField, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, g as DocumentBody, U as DrawingContent, j as Endnote, X as EndnotePosition, E as EndnoteProperties, Y as Field, Z as FieldCharContent, a0 as FieldType, a1 as FooterReference, i as Footnote, a2 as FootnotePosition, F as FootnoteProperties, H as HeaderFooter, a3 as HeaderFooterType, a4 as HeaderReference, a6 as Hyperlink, a8 as Image, a9 as ImageCrop, ac as ImagePadding, ad as ImagePosition, af as ImageSize, ag as ImageTransform, ah as ImageWrap, aj as InlineSdt, ak as Insertion, al as InstrTextContent, an as LineNumberRestart, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aF as PageOrientation, P as Paragraph, aG as ParagraphContent, aH as ParagraphPropertyChange, aI as PictureWatermark, aJ as PropertyChangeInfo, bi as RawXml, aK as Run, aL as RunContent, aM as RunPropertyChange, aO as SdtDataBinding, a as SdtProperties, aR as SdtType, aS as Section, f as SectionProperties, aT as SectionStart, aU as SeparatorContent, aV as Shape, aW as ShapeContent, aZ as ShapeTextBody, a_ as SimpleField, a$ as SoftHyphenContent, b2 as SymbolContent, b3 as TabContent, b4 as Table, b5 as TableCell, b6 as TableCellPropertyChange, b7 as TablePropertyChange, b8 as TableRow, b9 as TableRowPropertyChange, ba as TableStructuralChangeInfo, bb as TextBox, bc as TextContent, bd as TextWatermark, be as TrackedChangeInfo, bf as TrackedRunChange, bg as VerticalAlign, W as Watermark, bh as pictureWatermarkDisplayEmu } from '../content-BzoC6bSz.mjs';
2
+ export { k as ShapeFill, l as ShapeOutline, m as ShapeType } from '../formatting-gqLFeJ9X.mjs';
3
3
  import '../docx/wrapTypes.mjs';
@@ -1,9 +1,9 @@
1
- import { F as FootnoteProperties, E as EndnoteProperties, g as DocumentBody, h as NumberingDefinitions, i as Footnote, j as Endnote, H as HeaderFooter, d as Chart, k as BookmarkRange } from '../content-CvEtPl0c.mjs';
2
- export { A as AbstractNumbering, B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, p as ChartAxis, q as ChartContent, r as ChartDataLabels, s as ChartGrouping, t as ChartLegend, u as ChartPlotGroup, v as ChartPoint, w as ChartPointLabel, x as ChartSeries, y as ChartType, z as Column, e as Comment, G as CommentAnchorRange, I as CommentAuthor, J as CommentRangeEnd, K as CommentRangeStart, L as CommentReferenceContent, M as ComplexField, O as ContentPosition, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, U as DrawingContent, D as DrawingScene, V as DrawingSceneNode, X as EndnotePosition, Y as Field, Z as FieldCharContent, _ as FieldFormData, $ as FieldInlineContent, a0 as FieldType, a1 as FooterReference, a2 as FootnotePosition, a3 as HeaderFooterType, a4 as HeaderReference, a5 as HorizontalRuleContent, a6 as Hyperlink, a7 as HyperlinkContent, a8 as Image, a9 as ImageCrop, aa as ImageEffect, ab as ImageHyperlink, ac as ImagePadding, ad as ImagePosition, ae as ImageRotationBounds, af as ImageSize, ag as ImageTransform, ah as ImageWrap, ai as ImageWrapPoint, aj as InlineSdt, ak as Insertion, al as InstrTextContent, am as LevelSuffix, an as LineNumberRestart, ao as ListLevel, ap as ListRendering, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, N as NoteKind, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aB as NoteSeparatorReference, aC as NumberFormat, aD as NumberingInstance, aE as PageNumberingProperties, aF as PageOrientation, P as Paragraph, aG as ParagraphContent, aH as ParagraphPropertyChange, aI as PictureWatermark, aJ as PropertyChangeInfo, aK as Run, aL as RunContent, aM as RunPropertyChange, aN as SdtCheckboxGlyph, S as SdtControlState, aO as SdtDataBinding, aP as SdtDateState, aQ as SdtGalleryState, a as SdtProperties, aR as SdtType, aS as Section, f as SectionProperties, aT as SectionStart, aU as SeparatorContent, aV as Shape, aW as ShapeContent, b as ShapeEffect, aX as ShapeFillPaint, aY as ShapeStrokePaint, aZ as ShapeTextBody, c as ShapeTextBodyProperties, a_ as SimpleField, a$ as SoftHyphenContent, b0 as StructuredFieldContent, b1 as StructuredFieldTree, b2 as SymbolContent, b3 as TabContent, b4 as Table, b5 as TableCell, b6 as TableCellPropertyChange, b7 as TablePropertyChange, b8 as TableRow, b9 as TableRowPropertyChange, ba as TableStructuralChangeInfo, bb as TextBox, bc as TextContent, bd as TextWatermark, be as TrackedChangeInfo, bf as TrackedRunChange, bg as VerticalAlign, W as Watermark, bh as pictureWatermarkDisplayEmu } from '../content-CvEtPl0c.mjs';
3
- import { f as Theme, C as ColorValue } from '../formatting-7zKCTu5a.mjs';
4
- export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, i as ParagraphAlignment, a as ParagraphFormatting, R as RunFontHint, j as RunLanguage, S as ShadingProperties, k as ShapeFill, l as ShapeOutline, m as ShapeType, n as TabLeader, o as TabStop, p as TabStopAlignment, q as TableBorders, e as TableCellFormatting, c as TableFormatting, r as TableLook, s as TableMeasurement, d as TableRowFormatting, t as TableStyleCascade, u as TableStyleRegion, v as TableWidthType, w as TextEffect, b as TextFormatting, T as TextModernEffects, x as ThemeColorScheme, y as ThemeColorSlot, z as ThemeFont, A as ThemeFontScheme, U as UnderlineStyle } from '../formatting-7zKCTu5a.mjs';
5
- import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-7e-mq3c-.mjs';
6
- export { D as DocDefaults, b as FontEmbed, c as FontInfo, d as Relationship, e as RelationshipType, a as Style, f as StyleType } from '../styles-7e-mq3c-.mjs';
1
+ import { F as FootnoteProperties, E as EndnoteProperties, g as DocumentBody, h as NumberingDefinitions, i as Footnote, j as Endnote, H as HeaderFooter, d as Chart, k as BookmarkRange } from '../content-BzoC6bSz.mjs';
2
+ export { A as AbstractNumbering, B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, p as ChartAxis, q as ChartContent, r as ChartDataLabels, s as ChartGrouping, t as ChartLegend, u as ChartPlotGroup, v as ChartPoint, w as ChartPointLabel, x as ChartSeries, y as ChartType, z as Column, e as Comment, G as CommentAnchorRange, I as CommentAuthor, J as CommentRangeEnd, K as CommentRangeStart, L as CommentReferenceContent, M as ComplexField, O as ContentPosition, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, U as DrawingContent, D as DrawingScene, V as DrawingSceneNode, X as EndnotePosition, Y as Field, Z as FieldCharContent, _ as FieldFormData, $ as FieldInlineContent, a0 as FieldType, a1 as FooterReference, a2 as FootnotePosition, a3 as HeaderFooterType, a4 as HeaderReference, a5 as HorizontalRuleContent, a6 as Hyperlink, a7 as HyperlinkContent, a8 as Image, a9 as ImageCrop, aa as ImageEffect, ab as ImageHyperlink, ac as ImagePadding, ad as ImagePosition, ae as ImageRotationBounds, af as ImageSize, ag as ImageTransform, ah as ImageWrap, ai as ImageWrapPoint, aj as InlineSdt, ak as Insertion, al as InstrTextContent, am as LevelSuffix, an as LineNumberRestart, ao as ListLevel, ap as ListRendering, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, N as NoteKind, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aB as NoteSeparatorReference, aC as NumberFormat, aD as NumberingInstance, aE as PageNumberingProperties, aF as PageOrientation, P as Paragraph, aG as ParagraphContent, aH as ParagraphPropertyChange, aI as PictureWatermark, aJ as PropertyChangeInfo, aK as Run, aL as RunContent, aM as RunPropertyChange, aN as SdtCheckboxGlyph, S as SdtControlState, aO as SdtDataBinding, aP as SdtDateState, aQ as SdtGalleryState, a as SdtProperties, aR as SdtType, aS as Section, f as SectionProperties, aT as SectionStart, aU as SeparatorContent, aV as Shape, aW as ShapeContent, b as ShapeEffect, aX as ShapeFillPaint, aY as ShapeStrokePaint, aZ as ShapeTextBody, c as ShapeTextBodyProperties, a_ as SimpleField, a$ as SoftHyphenContent, b0 as StructuredFieldContent, b1 as StructuredFieldTree, b2 as SymbolContent, b3 as TabContent, b4 as Table, b5 as TableCell, b6 as TableCellPropertyChange, b7 as TablePropertyChange, b8 as TableRow, b9 as TableRowPropertyChange, ba as TableStructuralChangeInfo, bb as TextBox, bc as TextContent, bd as TextWatermark, be as TrackedChangeInfo, bf as TrackedRunChange, bg as VerticalAlign, W as Watermark, bh as pictureWatermarkDisplayEmu } from '../content-BzoC6bSz.mjs';
3
+ import { f as Theme, C as ColorValue } from '../formatting-gqLFeJ9X.mjs';
4
+ export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, i as ParagraphAlignment, a as ParagraphFormatting, R as RunFontHint, j as RunLanguage, S as ShadingProperties, k as ShapeFill, l as ShapeOutline, m as ShapeType, n as TabLeader, o as TabStop, p as TabStopAlignment, q as TableBorders, e as TableCellFormatting, c as TableFormatting, r as TableLook, s as TableMeasurement, d as TableRowFormatting, t as TableStyleCascade, u as TableStyleRegion, v as TableWidthType, w as TextEffect, b as TextFormatting, T as TextModernEffects, x as ThemeColorScheme, y as ThemeColorSlot, z as ThemeFont, A as ThemeFontScheme, U as UnderlineStyle } from '../formatting-gqLFeJ9X.mjs';
5
+ import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-AryxLAhx.mjs';
6
+ export { D as DocDefaults, b as FontEmbed, c as FontInfo, d as Relationship, e as RelationshipType, a as Style, f as StyleType } from '../styles-AryxLAhx.mjs';
7
7
  import '../docx/wrapTypes.mjs';
8
8
 
9
9
  interface CompatibilityFlags {
@@ -1,5 +1,5 @@
1
- import { S as SdtControlState, a as SdtProperties, R as RevisionInfo, C as CellMarker, D as DrawingScene, b as ShapeEffect, c as ShapeTextBodyProperties, d as Chart, W as Watermark, F as FootnoteProperties, E as EndnoteProperties } from './content-CvEtPl0c.mjs';
2
- import { T as TextModernEffects, P as PresetGeometryPathCommand, B as BorderSpec } from './formatting-7zKCTu5a.mjs';
1
+ import { S as SdtControlState, a as SdtProperties, R as RevisionInfo, C as CellMarker, D as DrawingScene, b as ShapeEffect, c as ShapeTextBodyProperties, d as Chart, W as Watermark, F as FootnoteProperties, E as EndnoteProperties } from './content-BzoC6bSz.mjs';
2
+ import { T as TextModernEffects, P as PresetGeometryPathCommand, B as BorderSpec } from './formatting-gqLFeJ9X.mjs';
3
3
 
4
4
  /**
5
5
  * Inline SDT widget metadata carried by a painted text run.
@@ -128,6 +128,8 @@ type RunFormatting = {
128
128
  emphasisMark?: 'dot' | 'comma' | 'circle' | 'underDot';
129
129
  /** Hidden run (OOXML w:vanish, §17.3.2.41). Painter skips the run. */
130
130
  hidden?: boolean;
131
+ /** Run-level document-grid opt-out (OOXML w:snapToGrid, §17.3.2). Absent = on. */
132
+ snapToGrid?: boolean;
131
133
  /**
132
134
  * Per-run right-to-left direction (OOXML w:rtl, §17.3.2.30). Independent
133
135
  * from the paragraph's bidi flag — a single run may flip direction within
@@ -330,6 +332,8 @@ type ImageRun = {
330
332
  changeRevisionId?: number;
331
333
  pmStart?: number;
332
334
  pmEnd?: number;
335
+ /** Native inline DrawingML payload; present only for textless inline shapes. */
336
+ inlineShape?: unknown;
333
337
  };
334
338
  /** Run for an explicit w:br — ends the line, not the paragraph. */
335
339
  type LineBreakRun = {
@@ -438,6 +442,11 @@ type ParagraphAttrs = {
438
442
  /** w:widowControl, a toggle defaulting on: only an authored off is carried. */
439
443
  widowControl?: boolean;
440
444
  pageBreakBefore?: boolean;
445
+ /**
446
+ * The paragraph opens with a hard `w:br w:type="page"` run rather than
447
+ * carrying `w:pageBreakBefore`; Word keeps its space-before.
448
+ */
449
+ pageBreakBeforeRun?: boolean;
441
450
  styleId?: string;
442
451
  effectiveStyleId?: string;
443
452
  contextualSpacing?: boolean;
@@ -484,6 +493,14 @@ type ParagraphAttrs = {
484
493
  pPrIns?: RevisionInfo | null;
485
494
  /** Tracked-change marker on the paragraph mark (`<w:pPr><w:rPr><w:del/>`). */
486
495
  pPrDel?: RevisionInfo | null;
496
+ /** Paragraph-level document-grid opt-out (OOXML w:snapToGrid, §17.3.1). Absent = on. */
497
+ snapToGrid?: boolean;
498
+ /** East Asian / Latin auto-spacing opt-out (OOXML w:autoSpaceDE, §17.3.1.11). Absent = on. */
499
+ autoSpaceDE?: boolean;
500
+ /** East Asian / number auto-spacing opt-out (OOXML w:autoSpaceDN, §17.3.1.12). Absent = on. */
501
+ autoSpaceDN?: boolean;
502
+ /** Section grid pitch in px (w:docGrid w:linePitch), gated to an activating grid type. Absent = no snap. */
503
+ docGridPitchPx?: number;
487
504
  };
488
505
  /**
489
506
  * Flow block for one paragraph: its runs plus resolved attributes.
@@ -1,5 +1,5 @@
1
- import { P as Paragraph, B as BlockContent, e as Comment } from '../content-CvEtPl0c.mjs';
2
- import '../formatting-7zKCTu5a.mjs';
1
+ import { P as Paragraph, B as BlockContent, e as Comment } from '../content-BzoC6bSz.mjs';
2
+ import '../formatting-gqLFeJ9X.mjs';
3
3
  import '../docx/wrapTypes.mjs';
4
4
 
5
5
  /**
@@ -1,12 +1,12 @@
1
1
  export { PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels } from './units.mjs';
2
- export { F as FONT_MAPPING, C as FontDefinition, T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, D as extractFontsFromDocument, h as generateThemeTintShadeMatrix, i as getContrastingColor, E as getGoogleFontEquivalent, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, o as isGoogleFontsEnabled, n as isLoading, p as isWhite, q as lightenColor, G as loadDocumentFonts, r as loadFont, H as loadFontDefinitions, s as loadFontFromBuffer, I as loadFontFromUrl, J as loadFontWithMapping, t as loadFonts, K as loadFontsWithMapping, L as onFontError, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, M as resolveColorToHex, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from '../fontLoader-b8eicJKV.mjs';
2
+ export { F as FONT_MAPPING, C as FontDefinition, T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, D as extractFontsFromDocument, h as generateThemeTintShadeMatrix, i as getContrastingColor, E as getGoogleFontEquivalent, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, o as isGoogleFontsEnabled, n as isLoading, p as isWhite, q as lightenColor, G as loadDocumentFonts, r as loadFont, H as loadFontDefinitions, s as loadFontFromBuffer, I as loadFontFromUrl, J as loadFontWithMapping, t as loadFonts, K as loadFontsWithMapping, L as onFontError, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, M as resolveColorToHex, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from '../fontLoader-CkXcPB1C.mjs';
3
3
  export { D as DocxInput, t as toArrayBuffer } from '../docxInput-DTbCa48g.mjs';
4
- import { F as FontTable } from '../styles-7e-mq3c-.mjs';
4
+ import { F as FontTable } from '../styles-AryxLAhx.mjs';
5
5
  import { Document } from '../types/document.mjs';
6
6
  import { FontOption } from './fontOptions.mjs';
7
7
  export { MIN_CARD_GAP, SIDEBAR_DOCUMENT_SHIFT, SIDEBAR_PAGE_GAP, SIDEBAR_WIDTH } from './sidebarConstants.mjs';
8
- import { e as Comment } from '../content-CvEtPl0c.mjs';
9
- import '../formatting-7zKCTu5a.mjs';
8
+ import { e as Comment } from '../content-BzoC6bSz.mjs';
9
+ import '../formatting-gqLFeJ9X.mjs';
10
10
  import '../docx/wrapTypes.mjs';
11
11
 
12
12
  /**
@@ -208,6 +208,9 @@ interface HeadingInfo {
208
208
  * Detection logic:
209
209
  * 1. Check `outlineLevel` attr (set by OOXML parsing or style resolution)
210
210
  * 2. Fallback to `styleId` matching /^[Hh]eading(\d)$/
211
+ *
212
+ * @deprecated A legacy tree walker kept for compatibility. `YrsSession.headings(story)` classifies
213
+ * headings with the engine's resolver, which also reads style inheritance and document defaults.
211
214
  */
212
215
  declare function collectHeadings(doc: EditorTreeNode): HeadingInfo[];
213
216
 
@@ -1 +1 @@
1
- export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,b as resolveColorToHex,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'../chunk-LTVVQMHB.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-CTBUQRYQ.mjs';import {n,d}from'../chunk-JHJLG4I6.mjs';export{r as FONT_MAPPING,n as canRenderFont,c as deobfuscateFont,A as extractEmbeddedFontFaces,w as extractFontsFromDocument,z as getEmbeddedFontFaces,y as getEmbeddedFontFamilies,s as getGoogleFontEquivalent,k as getLoadedFonts,g as isFontLoaded,i as isGoogleFontsEnabled,j as isLoading,b as isValidFontKey,x as loadDocumentFonts,B as loadEmbeddedFonts,e as loadFont,q as loadFontDefinitions,o as loadFontFromBuffer,p as loadFontFromUrl,t as loadFontWithMapping,f as loadFonts,u as loadFontsWithMapping,m as onFontError,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-JHJLG4I6.mjs';import'../chunk-6LQJAKOC.mjs';import'../chunk-HLDJMU3R.mjs';import'../chunk-ACGKK7IB.mjs';import'../chunk-5F6DLQZP.mjs';import'../chunk-TTRUPDAB.mjs';function H(e){let t=new Set,o=e.package;if(o.theme&&nt(o.theme,t),o.styles&&rt(o.styles,t),o.document)for(let n of o.document.content)T(n,t);if(o.headers)for(let n of o.headers.values())O(n,t);if(o.footers)for(let n of o.footers.values())O(n,t);if(o.footnotes)for(let n of o.footnotes)ut(n,t);if(o.endnotes)for(let n of o.endnotes)mt(n,t);return Array.from(t).sort()}function nt(e,t){let o=e.fontScheme;o&&(o.majorFont&&_(o.majorFont,t),o.minorFont&&_(o.minorFont,t));}function _(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function rt(e,t){e.docDefaults&&(e.docDefaults.rPr&&h(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&h(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&h(o.rPr,t),o.pPr?.runProperties&&h(o.pPr.runProperties,t);}function h(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function at(e,t){e.runProperties&&h(e.runProperties,t);}function T(e,t){e.type==="paragraph"?st(e,t):e.type==="table"&&ct(e,t);}function st(e,t){e.formatting&&at(e.formatting,t);for(let o of e.content)it(o,t);}function it(e,t){if(e.type==="run")b(e,t);else if(e.type==="hyperlink")lt(e,t);else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&b(o,t);if("fieldResult"in e)for(let o of e.fieldResult)b(o,t);}}function b(e,t){e.formatting&&h(e.formatting,t);}function lt(e,t){for(let o of e.children)o.type==="run"&&b(o,t);}function ct(e,t){for(let o of e.rows)ft(o,t);}function ft(e,t){for(let o of e.cells)dt(o,t);}function dt(e,t){for(let o of e.content)T(o,t);}function O(e,t){for(let o of e.content)T(o,t);}function ut(e,t){for(let o of e.content)T(o,t);}function mt(e,t){for(let o of e.content)T(o,t);}var pt=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function N(e,t={}){let o=t.canRender??n,n$1=new Set;for(let i of t.exclude??[])n$1.add(i.trim().toLowerCase());let r=new Set;for(let i of t.embeddedFamilies??[])r.add(i.trim().toLowerCase());let s=[],a=new Set;for(let i of e){let c=i.trim(),f=c.toLowerCase();!c||pt.has(f)||n$1.has(f)||a.has(f)||!r.has(f)&&!o(c)||(a.add(f),s.push({name:c,fontFamily:d(c).cssFallback,category:"other"}));}return s}function gt(e,t={}){return N(H(e),t)}function ht(e,t){if(!e||e.length===0)return [];let o=new Set;for(let s of t)o.add(s.trim().toLowerCase());let n=new Set,r=[];for(let s of e){let a=s.name.trim().toLowerCase();o.has(a)||n.has(a)||(n.add(a),r.push(s));}return r}function xt(e){let t=[];return e.descendants((o,n)=>{if(o.type.name==="paragraph"){let r=o.attrs.outlineLevel,s=o.attrs.styleId,a=r;if(a==null&&s){let i=s.match(/^[Hh]eading(\d)$/);i&&(a=parseInt(i[1],10)-1);}if(a!=null&&a>=0&&a<=8){let i="";o.forEach(c=>{c.isText&&(i+=c.text||"");}),i.trim()&&t.push({text:i.trim(),level:a,pmPos:n});}}}),t}var L="rgba(255, 235, 59, 0.55)",Ft=1200,y="docx-paragraph-flash",S=new WeakMap;function Tt(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function bt(e){return e?.color?.trim()||L}function yt(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function k(e,t){if(!t||!t.trim())return [];let o=Tt(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function W(e,t){let o=0,n=bt(t),r=yt(t);for(let s of e){o++;let a=S.get(s);a!==void 0&&clearTimeout(a),s.classList.remove(y),s.offsetWidth,s.style.setProperty("--docx-paragraph-flash-color",n),s.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),s.classList.add(y);let i=setTimeout(()=>{s.classList.remove(y),s.style.removeProperty("--docx-paragraph-flash-color"),s.style.removeProperty("--docx-paragraph-flash-duration"),S.delete(s);},r);S.set(s,i);}return o}function Ct(e,t,o){let n=k(e,t);return W(n,o)>0}function B(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function At(e,t,o,n){let r=B(e,t,o),s=Math.floor(r/Math.max(n,1)),a=r-s*n,i=Array.from({length:n},(c,f)=>s+(f<a?1:0));return [...e.slice(0,t),...i,...e.slice(t+o)]}function St(e,t,o,n,r,s){let a=o-t.rowspan,i=n-t.colspan,c=r+a,f=t.row+t.rowspan,F=t.col+t.colspan,p=[];for(let l of e){if(l===t)continue;let g=l.row+l.rowspan,C=l.col+l.colspan,I=l.row<f&&g>t.row,v=l.col<F&&C>t.col;p.push({data:l.data,row:l.row>=f?l.row+a:l.row,col:l.col>=F?l.col+i:l.col,rowspan:l.rowspan+(a>0&&I&&!v?a:0),colspan:l.colspan+(i>0&&v&&!I?i:0)});}for(let l=0;l<o;l++)for(let g=0;g<n;g++){let C=l===0&&g===0;p.push({data:s(C,l,g),row:t.row+l,col:t.col+g,rowspan:1,colspan:1});}return {anchors:p,deltaRows:a,deltaCols:i,newRowCount:c}}function wt(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let s=n.col;s<n.col+n.colspan;s++)o.set(`${r}-${s}`,n);}return {byStart:t,byCoveredSlot:o}}function Et(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}var Pt=/[\p{L}\p{N}\p{M}_''\-]/u,Rt=/\s/;function w(e){return !e||e.length===0?false:Pt.test(e)}function E(e){return !e||e.length===0?false:Rt.test(e)}function m(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(E(o)){let n=t,r=t;for(;n>0&&E(e[n-1]);)n--;for(;r<e.length&&E(e[r]);)r++;return [n,r]}if(w(o)){let n=t,r=t;for(;n>0&&w(e[n-1]);)n--;for(;r<e.length&&w(e[r]);)r++;return [n,r]}return [t,t+1]}function Dt(e,t){let[o,n]=m(e,t);return e.slice(o,n)}function It(e,t){let[o,n]=m(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function D(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[s,a]=m(n,r);if(a>s)return t.setStart(o,s),t.setEnd(o,a),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=G(n);if(r.length>0){let s=t.startOffset,a=null,i=s;if(s<n.childNodes.length){let c=n.childNodes[s];if(c.nodeType===Node.TEXT_NODE)a=c,i=0;else if(c instanceof Element){let f=G(c);f.length>0&&(a=f[0],i=0);}}if(!a&&r.length>0&&(a=r[0],i=0),a){let c=a.textContent||"",[f,F]=m(c,i);if(F>f){let p=document.createRange();return p.setStart(a,f),p.setEnd(a,F),e.removeAllRanges(),e.addRange(p),true}}}}return false}function vt(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,s]=m(n,t);if(s>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,s),o.removeAllRanges(),o.addRange(a),true}return false}function Mt(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return D();let o=t.startContainer,n=t.endContainer,r=t.startOffset,s=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",[i]=m(a,t.startOffset);r=i;}if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",i=Math.max(0,t.endOffset-1),[,c]=m(a,i);s=c;}try{return t.setStart(o,r),t.setEnd(n,s),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function X(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=_t(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function _t(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function G(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var P=0,x=null,R=null,Ot=500;function U(){P=0,R=null,x&&(clearTimeout(x),x=null);}function K(e){return e.target!==R&&U(),P++,R=e.target,x&&clearTimeout(x),x=setTimeout(U,Ot),Math.min(P,3)}function Ht(){return e=>{e.ctrlKey||e.metaKey||e.altKey||D();}}function Nt(){return e=>{if(K(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;X();}}}async function Lt(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var $="(prefers-color-scheme: dark)";function z(){return typeof window<"u"&&typeof window.matchMedia=="function"}function kt(){return z()?window.matchMedia($).matches:false}function Wt(e,t){return e==="dark"||e==="system"&&t}function Bt(e){if(!z())return ()=>{};let t=window.matchMedia($);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var Gt=-1;function Ut(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function Xt(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}var Kt=/^[a-z][a-z0-9+.-]*:/i,$t=/^(https?|mailto|tel|ftp):/i;function zt(e){if(!e)return;let t=e.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(t)return Kt.test(t)?$t.test(t)?e:void 0:e}export{L as DEFAULT_PARAGRAPH_FLASH_COLOR,Ft as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,y as PARAGRAPH_FLASH_CLASS_NAME,Gt as PENDING_COMMENT_ID,wt as buildAnchorMaps,xt as collectHeadings,Et as computeSplitDialogDefaults,St as computeSplitLayout,Xt as createComment,Ut as createCommentIdAllocator,Ht as createDoubleClickWordSelector,Nt as createTripleClickParagraphSelector,ht as excludeFontsByName,Mt as expandSelectionToWordBoundaries,k as findParagraphFragmentsByParaId,It as findWordAt,m as findWordBoundaries,W as flashParagraphElements,Ct as flashParagraphFragmentsByParaId,gt as getRenderableDocumentFonts,Dt as getWordAt,K as handleClickForMultiClick,kt as prefersColorSchemeDark,Lt as readDocxFileFromInput,At as redistributeColumnWidths,Wt as resolveIsDark,zt as sanitizeHref,X as selectParagraphAtCursor,N as selectRenderableFonts,D as selectWordAtCursor,vt as selectWordInTextNode,Bt as subscribeSystemDark,B as sumColumnWidths};
1
+ export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,b as resolveColorToHex,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'../chunk-LTVVQMHB.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-CTBUQRYQ.mjs';import {n,d}from'../chunk-5B4VMUXM.mjs';export{r as FONT_MAPPING,n as canRenderFont,c as deobfuscateFont,A as extractEmbeddedFontFaces,w as extractFontsFromDocument,z as getEmbeddedFontFaces,y as getEmbeddedFontFamilies,s as getGoogleFontEquivalent,k as getLoadedFonts,g as isFontLoaded,i as isGoogleFontsEnabled,j as isLoading,b as isValidFontKey,x as loadDocumentFonts,B as loadEmbeddedFonts,e as loadFont,q as loadFontDefinitions,o as loadFontFromBuffer,p as loadFontFromUrl,t as loadFontWithMapping,f as loadFonts,u as loadFontsWithMapping,m as onFontError,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-5B4VMUXM.mjs';import'../chunk-QE4ZDRKV.mjs';import'../chunk-HLDJMU3R.mjs';import'../chunk-ACGKK7IB.mjs';import'../chunk-5F6DLQZP.mjs';import'../chunk-TTRUPDAB.mjs';function H(e){let t=new Set,o=e.package;if(o.theme&&nt(o.theme,t),o.styles&&rt(o.styles,t),o.document)for(let n of o.document.content)T(n,t);if(o.headers)for(let n of o.headers.values())O(n,t);if(o.footers)for(let n of o.footers.values())O(n,t);if(o.footnotes)for(let n of o.footnotes)ut(n,t);if(o.endnotes)for(let n of o.endnotes)mt(n,t);return Array.from(t).sort()}function nt(e,t){let o=e.fontScheme;o&&(o.majorFont&&_(o.majorFont,t),o.minorFont&&_(o.minorFont,t));}function _(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function rt(e,t){e.docDefaults&&(e.docDefaults.rPr&&h(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&h(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&h(o.rPr,t),o.pPr?.runProperties&&h(o.pPr.runProperties,t);}function h(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function at(e,t){e.runProperties&&h(e.runProperties,t);}function T(e,t){e.type==="paragraph"?st(e,t):e.type==="table"&&ct(e,t);}function st(e,t){e.formatting&&at(e.formatting,t);for(let o of e.content)it(o,t);}function it(e,t){if(e.type==="run")b(e,t);else if(e.type==="hyperlink")lt(e,t);else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&b(o,t);if("fieldResult"in e)for(let o of e.fieldResult)b(o,t);}}function b(e,t){e.formatting&&h(e.formatting,t);}function lt(e,t){for(let o of e.children)o.type==="run"&&b(o,t);}function ct(e,t){for(let o of e.rows)ft(o,t);}function ft(e,t){for(let o of e.cells)dt(o,t);}function dt(e,t){for(let o of e.content)T(o,t);}function O(e,t){for(let o of e.content)T(o,t);}function ut(e,t){for(let o of e.content)T(o,t);}function mt(e,t){for(let o of e.content)T(o,t);}var pt=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function N(e,t={}){let o=t.canRender??n,n$1=new Set;for(let i of t.exclude??[])n$1.add(i.trim().toLowerCase());let r=new Set;for(let i of t.embeddedFamilies??[])r.add(i.trim().toLowerCase());let s=[],a=new Set;for(let i of e){let c=i.trim(),f=c.toLowerCase();!c||pt.has(f)||n$1.has(f)||a.has(f)||!r.has(f)&&!o(c)||(a.add(f),s.push({name:c,fontFamily:d(c).cssFallback,category:"other"}));}return s}function gt(e,t={}){return N(H(e),t)}function ht(e,t){if(!e||e.length===0)return [];let o=new Set;for(let s of t)o.add(s.trim().toLowerCase());let n=new Set,r=[];for(let s of e){let a=s.name.trim().toLowerCase();o.has(a)||n.has(a)||(n.add(a),r.push(s));}return r}function xt(e){let t=[];return e.descendants((o,n)=>{if(o.type.name==="paragraph"){let r=o.attrs.outlineLevel,s=o.attrs.styleId,a=r;if(a==null&&s){let i=s.match(/^[Hh]eading(\d)$/);i&&(a=parseInt(i[1],10)-1);}if(a!=null&&a>=0&&a<=8){let i="";o.forEach(c=>{c.isText&&(i+=c.text||"");}),i.trim()&&t.push({text:i.trim(),level:a,pmPos:n});}}}),t}var L="rgba(255, 235, 59, 0.55)",Ft=1200,y="docx-paragraph-flash",S=new WeakMap;function Tt(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function bt(e){return e?.color?.trim()||L}function yt(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function k(e,t){if(!t||!t.trim())return [];let o=Tt(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function W(e,t){let o=0,n=bt(t),r=yt(t);for(let s of e){o++;let a=S.get(s);a!==void 0&&clearTimeout(a),s.classList.remove(y),s.offsetWidth,s.style.setProperty("--docx-paragraph-flash-color",n),s.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),s.classList.add(y);let i=setTimeout(()=>{s.classList.remove(y),s.style.removeProperty("--docx-paragraph-flash-color"),s.style.removeProperty("--docx-paragraph-flash-duration"),S.delete(s);},r);S.set(s,i);}return o}function Ct(e,t,o){let n=k(e,t);return W(n,o)>0}function B(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function At(e,t,o,n){let r=B(e,t,o),s=Math.floor(r/Math.max(n,1)),a=r-s*n,i=Array.from({length:n},(c,f)=>s+(f<a?1:0));return [...e.slice(0,t),...i,...e.slice(t+o)]}function St(e,t,o,n,r,s){let a=o-t.rowspan,i=n-t.colspan,c=r+a,f=t.row+t.rowspan,F=t.col+t.colspan,p=[];for(let l of e){if(l===t)continue;let g=l.row+l.rowspan,C=l.col+l.colspan,I=l.row<f&&g>t.row,v=l.col<F&&C>t.col;p.push({data:l.data,row:l.row>=f?l.row+a:l.row,col:l.col>=F?l.col+i:l.col,rowspan:l.rowspan+(a>0&&I&&!v?a:0),colspan:l.colspan+(i>0&&v&&!I?i:0)});}for(let l=0;l<o;l++)for(let g=0;g<n;g++){let C=l===0&&g===0;p.push({data:s(C,l,g),row:t.row+l,col:t.col+g,rowspan:1,colspan:1});}return {anchors:p,deltaRows:a,deltaCols:i,newRowCount:c}}function wt(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let s=n.col;s<n.col+n.colspan;s++)o.set(`${r}-${s}`,n);}return {byStart:t,byCoveredSlot:o}}function Et(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}var Pt=/[\p{L}\p{N}\p{M}_''\-]/u,Rt=/\s/;function w(e){return !e||e.length===0?false:Pt.test(e)}function E(e){return !e||e.length===0?false:Rt.test(e)}function m(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(E(o)){let n=t,r=t;for(;n>0&&E(e[n-1]);)n--;for(;r<e.length&&E(e[r]);)r++;return [n,r]}if(w(o)){let n=t,r=t;for(;n>0&&w(e[n-1]);)n--;for(;r<e.length&&w(e[r]);)r++;return [n,r]}return [t,t+1]}function Dt(e,t){let[o,n]=m(e,t);return e.slice(o,n)}function It(e,t){let[o,n]=m(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function D(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[s,a]=m(n,r);if(a>s)return t.setStart(o,s),t.setEnd(o,a),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=G(n);if(r.length>0){let s=t.startOffset,a=null,i=s;if(s<n.childNodes.length){let c=n.childNodes[s];if(c.nodeType===Node.TEXT_NODE)a=c,i=0;else if(c instanceof Element){let f=G(c);f.length>0&&(a=f[0],i=0);}}if(!a&&r.length>0&&(a=r[0],i=0),a){let c=a.textContent||"",[f,F]=m(c,i);if(F>f){let p=document.createRange();return p.setStart(a,f),p.setEnd(a,F),e.removeAllRanges(),e.addRange(p),true}}}}return false}function vt(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,s]=m(n,t);if(s>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,s),o.removeAllRanges(),o.addRange(a),true}return false}function Mt(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return D();let o=t.startContainer,n=t.endContainer,r=t.startOffset,s=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",[i]=m(a,t.startOffset);r=i;}if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",i=Math.max(0,t.endOffset-1),[,c]=m(a,i);s=c;}try{return t.setStart(o,r),t.setEnd(n,s),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function X(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=_t(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function _t(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function G(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var P=0,x=null,R=null,Ot=500;function U(){P=0,R=null,x&&(clearTimeout(x),x=null);}function K(e){return e.target!==R&&U(),P++,R=e.target,x&&clearTimeout(x),x=setTimeout(U,Ot),Math.min(P,3)}function Ht(){return e=>{e.ctrlKey||e.metaKey||e.altKey||D();}}function Nt(){return e=>{if(K(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;X();}}}async function Lt(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var $="(prefers-color-scheme: dark)";function z(){return typeof window<"u"&&typeof window.matchMedia=="function"}function kt(){return z()?window.matchMedia($).matches:false}function Wt(e,t){return e==="dark"||e==="system"&&t}function Bt(e){if(!z())return ()=>{};let t=window.matchMedia($);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var Gt=-1;function Ut(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function Xt(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}var Kt=/^[a-z][a-z0-9+.-]*:/i,$t=/^(https?|mailto|tel|ftp):/i;function zt(e){if(!e)return;let t=e.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(t)return Kt.test(t)?$t.test(t)?e:void 0:e}export{L as DEFAULT_PARAGRAPH_FLASH_COLOR,Ft as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,y as PARAGRAPH_FLASH_CLASS_NAME,Gt as PENDING_COMMENT_ID,wt as buildAnchorMaps,xt as collectHeadings,Et as computeSplitDialogDefaults,St as computeSplitLayout,Xt as createComment,Ut as createCommentIdAllocator,Ht as createDoubleClickWordSelector,Nt as createTripleClickParagraphSelector,ht as excludeFontsByName,Mt as expandSelectionToWordBoundaries,k as findParagraphFragmentsByParaId,It as findWordAt,m as findWordBoundaries,W as flashParagraphElements,Ct as flashParagraphFragmentsByParaId,gt as getRenderableDocumentFonts,Dt as getWordAt,K as handleClickForMultiClick,kt as prefersColorSchemeDark,Lt as readDocxFileFromInput,At as redistributeColumnWidths,Wt as resolveIsDark,zt as sanitizeHref,X as selectParagraphAtCursor,N as selectRenderableFonts,D as selectWordAtCursor,vt as selectWordInTextNode,Bt as subscribeSystemDark,B as sumColumnWidths};
@@ -1,5 +1,5 @@
1
- import { a as Style } from '../styles-7e-mq3c-.mjs';
2
- import '../formatting-7zKCTu5a.mjs';
1
+ import { a as Style } from '../styles-AryxLAhx.mjs';
2
+ import '../formatting-gqLFeJ9X.mjs';
3
3
 
4
4
  /**
5
5
  * Paragraph-style preview + option resolution — shared between the React and
@@ -0,0 +1 @@
1
+ export{p as buildDisplayListJson,t as clearMeasureFonts,g as closeDisplayList,d as hasDisplayListSession,i as hasDisplayListUpdate,e as hasRangeRectsRegion,j as hitTestRegionsByHandle,b as hitTestRegionsJson,q as layoutDocumentJson,u as measureParagraphJson,f as openDisplayList,v as outlineGlyphJson,a as preloadLayoutWasm,m as rangeRectsByHandle,c as rangeRectsJson,o as rangeRectsRegionByHandle,n as rangeRectsRegionJson,r as registerMeasureFont,s as registerSubstituteMeasureFont,h as updateDisplayList,l as verticalMoveByHandle,k as verticalMoveJson}from'./chunk-H5YYCN42.mjs';import'./chunk-5F6DLQZP.mjs';import'./chunk-TTRUPDAB.mjs';
@@ -0,0 +1 @@
1
+ import'./chunk-EUUIJVM6.mjs';export{b as createEditSession,d as exportDocxMarkdownJson,c as exportDocxStructuredJson,g as findDocxContentControlsJson,f as listDocxContentControlsJson,a as preloadEditWasm,e as renderDocxMarkdownJson,h as renderDocxMarkdownWithPagesJson}from'./chunk-Z4HZIPBS.mjs';import'./chunk-5F6DLQZP.mjs';import'./chunk-TTRUPDAB.mjs';