@eigenpal/docx-js-editor 0.0.16 → 0.0.19

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 (211) hide show
  1. package/dist/ClipboardManager-D6dkOFg6.d.ts +436 -0
  2. package/dist/ClipboardManager-EZ0C6Onq.d.cts +436 -0
  3. package/dist/{DocumentAgent-Ci6_T-XM.d.ts → DocumentAgent-B0EC8lPC.d.cts} +2 -2
  4. package/dist/{DocumentAgent-DEGFgYEN.d.cts → DocumentAgent-BcCDg7i2.d.ts} +2 -2
  5. package/dist/{FindReplaceDialog-UMXCBBST.js → FindReplaceDialog-AWQXKEUQ.js} +2 -1
  6. package/dist/FindReplaceDialog-AWQXKEUQ.js.map +1 -0
  7. package/dist/FindReplaceDialog-I4SZDSVP.cjs +2 -0
  8. package/dist/FindReplaceDialog-I4SZDSVP.cjs.map +1 -0
  9. package/dist/{FootnotePropertiesDialog-OBQXOBJE.cjs → FootnotePropertiesDialog-73VT2ZVZ.cjs} +2 -1
  10. package/dist/FootnotePropertiesDialog-73VT2ZVZ.cjs.map +1 -0
  11. package/dist/{FootnotePropertiesDialog-TYQGPWPX.js → FootnotePropertiesDialog-ZM3EF3EF.js} +2 -1
  12. package/dist/FootnotePropertiesDialog-ZM3EF3EF.js.map +1 -0
  13. package/dist/{HyperlinkDialog-UOERZIBM.js → HyperlinkDialog-BA25XUT5.js} +2 -1
  14. package/dist/HyperlinkDialog-BA25XUT5.js.map +1 -0
  15. package/dist/HyperlinkDialog-V63LPOT2.cjs +2 -0
  16. package/dist/HyperlinkDialog-V63LPOT2.cjs.map +1 -0
  17. package/dist/{ImagePositionDialog-52FDANUK.js → ImagePositionDialog-AIAMKPFK.js} +2 -1
  18. package/dist/ImagePositionDialog-AIAMKPFK.js.map +1 -0
  19. package/dist/{ImagePositionDialog-ZK5WFBRC.cjs → ImagePositionDialog-KMK7ROV2.cjs} +2 -1
  20. package/dist/ImagePositionDialog-KMK7ROV2.cjs.map +1 -0
  21. package/dist/{ImagePropertiesDialog-YPSLPSF6.js → ImagePropertiesDialog-ERFCUVCW.js} +2 -1
  22. package/dist/ImagePropertiesDialog-ERFCUVCW.js.map +1 -0
  23. package/dist/{ImagePropertiesDialog-LU44RDIY.cjs → ImagePropertiesDialog-USMMRK6X.cjs} +2 -1
  24. package/dist/ImagePropertiesDialog-USMMRK6X.cjs.map +1 -0
  25. package/dist/{TablePropertiesDialog-KMOYHPGF.cjs → TablePropertiesDialog-72CIUAZT.cjs} +2 -1
  26. package/dist/TablePropertiesDialog-72CIUAZT.cjs.map +1 -0
  27. package/dist/{TablePropertiesDialog-OUUJAA7D.js → TablePropertiesDialog-EMUEVYB3.js} +2 -1
  28. package/dist/TablePropertiesDialog-EMUEVYB3.js.map +1 -0
  29. package/dist/{agentApi-CbVUCZRu.d.cts → agentApi-BFVyKagE.d.cts} +143 -2
  30. package/dist/{agentApi-CbVUCZRu.d.ts → agentApi-BFVyKagE.d.ts} +143 -2
  31. package/dist/{chunk-OEOUMSWH.cjs → chunk-2CHPKB5A.cjs} +8 -7
  32. package/dist/chunk-2CHPKB5A.cjs.map +1 -0
  33. package/dist/{chunk-R5SKERM2.js → chunk-2QOEHCBX.js} +2 -1
  34. package/dist/chunk-2QOEHCBX.js.map +1 -0
  35. package/dist/chunk-4QT5LPBA.cjs +24 -0
  36. package/dist/chunk-4QT5LPBA.cjs.map +1 -0
  37. package/dist/chunk-5DYSI4O4.cjs +60 -0
  38. package/dist/chunk-5DYSI4O4.cjs.map +1 -0
  39. package/dist/{chunk-DYQUXFE5.cjs → chunk-5FJXHXFV.cjs} +2 -1
  40. package/dist/chunk-5FJXHXFV.cjs.map +1 -0
  41. package/dist/chunk-6FEWNF6B.js +4 -0
  42. package/dist/chunk-6FEWNF6B.js.map +1 -0
  43. package/dist/chunk-6LF5HZCV.js +10 -0
  44. package/dist/chunk-6LF5HZCV.js.map +1 -0
  45. package/dist/{chunk-EMKABJPH.js → chunk-7JSPKVOW.js} +2 -1
  46. package/dist/chunk-7JSPKVOW.js.map +1 -0
  47. package/dist/chunk-C33XDRDJ.cjs +28 -0
  48. package/dist/chunk-C33XDRDJ.cjs.map +1 -0
  49. package/dist/chunk-CV5WFE7K.js +24 -0
  50. package/dist/chunk-CV5WFE7K.js.map +1 -0
  51. package/dist/{chunk-WFYRA2TH.js → chunk-CXJRNISO.js} +2 -1
  52. package/dist/chunk-CXJRNISO.js.map +1 -0
  53. package/dist/{chunk-VTAS7VZ6.cjs → chunk-DJAEBZ33.cjs} +2 -1
  54. package/dist/chunk-DJAEBZ33.cjs.map +1 -0
  55. package/dist/chunk-DP6Q75ZD.js +28 -0
  56. package/dist/chunk-DP6Q75ZD.js.map +1 -0
  57. package/dist/chunk-FDANI5P4.cjs +2 -0
  58. package/dist/chunk-FDANI5P4.cjs.map +1 -0
  59. package/dist/chunk-FGVGZLBL.js +2 -0
  60. package/dist/chunk-FGVGZLBL.js.map +1 -0
  61. package/dist/{chunk-SF53KLDZ.cjs → chunk-GJ4GKSDU.cjs} +2 -1
  62. package/dist/chunk-GJ4GKSDU.cjs.map +1 -0
  63. package/dist/{chunk-FYAWM7MP.cjs → chunk-GWBTKVFD.cjs} +2 -1
  64. package/dist/chunk-GWBTKVFD.cjs.map +1 -0
  65. package/dist/{chunk-WFWLPKQA.js → chunk-JOYPFQW2.js} +2 -1
  66. package/dist/chunk-JOYPFQW2.js.map +1 -0
  67. package/dist/{chunk-ZDYHAYN6.js → chunk-L54YNLSE.js} +2 -1
  68. package/dist/chunk-L54YNLSE.js.map +1 -0
  69. package/dist/chunk-LPGMLJMO.js +259 -0
  70. package/dist/chunk-LPGMLJMO.js.map +1 -0
  71. package/dist/{chunk-CTYOM6BE.js → chunk-M2T6XKT5.js} +2 -1
  72. package/dist/chunk-M2T6XKT5.js.map +1 -0
  73. package/dist/chunk-OHG7ROFC.js +11 -0
  74. package/dist/chunk-OHG7ROFC.js.map +1 -0
  75. package/dist/chunk-PANKMCFX.cjs +4 -0
  76. package/dist/chunk-PANKMCFX.cjs.map +1 -0
  77. package/dist/{chunk-PJVI53AH.js → chunk-Q6HUGWO6.js} +2 -1
  78. package/dist/chunk-Q6HUGWO6.js.map +1 -0
  79. package/dist/{chunk-MLSHZVL7.js → chunk-QDV75OJ4.js} +8 -7
  80. package/dist/chunk-QDV75OJ4.js.map +1 -0
  81. package/dist/chunk-QEBO3EQP.cjs +2 -0
  82. package/dist/chunk-QEBO3EQP.cjs.map +1 -0
  83. package/dist/chunk-QVIZ775M.cjs +259 -0
  84. package/dist/chunk-QVIZ775M.cjs.map +1 -0
  85. package/dist/chunk-RMUMR42R.cjs +10 -0
  86. package/dist/chunk-RMUMR42R.cjs.map +1 -0
  87. package/dist/{chunk-XS2AQFMF.cjs → chunk-S26DZVRQ.cjs} +2 -1
  88. package/dist/chunk-S26DZVRQ.cjs.map +1 -0
  89. package/dist/{chunk-L34XFLQZ.cjs → chunk-T2HQYRA7.cjs} +2 -1
  90. package/dist/chunk-T2HQYRA7.cjs.map +1 -0
  91. package/dist/chunk-ULXNEG66.js +60 -0
  92. package/dist/chunk-ULXNEG66.js.map +1 -0
  93. package/dist/{chunk-PXC7ARQB.cjs → chunk-WD2HTKRR.cjs} +2 -1
  94. package/dist/chunk-WD2HTKRR.cjs.map +1 -0
  95. package/dist/chunk-XZNOV52K.cjs +11 -0
  96. package/dist/chunk-XZNOV52K.cjs.map +1 -0
  97. package/dist/chunk-Y6VCTLCJ.js +2 -0
  98. package/dist/chunk-Y6VCTLCJ.js.map +1 -0
  99. package/dist/{clipboard-Cx7cb3kX.d.cts → clipboard-CqE-UZ2d.d.cts} +1 -1
  100. package/dist/{clipboard-BOocwmAM.d.ts → clipboard-beGtyabO.d.ts} +1 -1
  101. package/dist/{colorResolver-KXbUgzWC.d.ts → colorResolver-B5YbO_a4.d.ts} +170 -170
  102. package/dist/{colorResolver-CIDiSPWd.d.cts → colorResolver-Cu46bSKr.d.cts} +170 -170
  103. package/dist/core-plugins-reexport.cjs +2 -0
  104. package/dist/core-plugins-reexport.cjs.map +1 -0
  105. package/dist/{core-plugins.d.cts → core-plugins-reexport.d.cts} +4 -4
  106. package/dist/{core-plugins.d.ts → core-plugins-reexport.d.ts} +4 -4
  107. package/dist/core-plugins-reexport.js +2 -0
  108. package/dist/core-plugins-reexport.js.map +1 -0
  109. package/dist/core-reexport.cjs +2 -0
  110. package/dist/core-reexport.cjs.map +1 -0
  111. package/dist/core-reexport.d.cts +309 -0
  112. package/dist/core-reexport.d.ts +309 -0
  113. package/dist/core-reexport.js +2 -0
  114. package/dist/core-reexport.js.map +1 -0
  115. package/dist/executor-K5RXUTTR.js +2 -0
  116. package/dist/executor-K5RXUTTR.js.map +1 -0
  117. package/dist/executor-XIPIU3H4.cjs +2 -0
  118. package/dist/executor-XIPIU3H4.cjs.map +1 -0
  119. package/dist/{insertOperations-CzB5b-Of.d.ts → fontLoader-CFKpg0Ri.d.ts} +86 -86
  120. package/dist/{insertOperations-DKVmCV32.d.cts → fontLoader-HZYfILUm.d.cts} +86 -86
  121. package/dist/headless-reexport.cjs +5 -0
  122. package/dist/headless-reexport.cjs.map +1 -0
  123. package/dist/{headless.d.cts → headless-reexport.d.cts} +7 -7
  124. package/dist/{headless.d.ts → headless-reexport.d.ts} +7 -7
  125. package/dist/{headless.js → headless-reexport.js} +3 -2
  126. package/dist/headless-reexport.js.map +1 -0
  127. package/dist/index.cjs +6 -5
  128. package/dist/index.cjs.map +1 -0
  129. package/dist/index.css +1 -0
  130. package/dist/index.css.map +1 -0
  131. package/dist/index.d.cts +15 -13
  132. package/dist/index.d.ts +15 -13
  133. package/dist/index.js +6 -5
  134. package/dist/index.js.map +1 -0
  135. package/dist/{mcp.cjs → mcp-reexport.cjs} +11 -10
  136. package/dist/mcp-reexport.cjs.map +1 -0
  137. package/dist/{mcp.d.cts → mcp-reexport.d.cts} +2 -2
  138. package/dist/{mcp.d.ts → mcp-reexport.d.ts} +2 -2
  139. package/dist/{mcp.js → mcp-reexport.js} +10 -9
  140. package/dist/mcp-reexport.js.map +1 -0
  141. package/dist/{processTemplate-RJN6452W.js → processTemplate-G37IM66O.js} +2 -1
  142. package/dist/processTemplate-G37IM66O.js.map +1 -0
  143. package/dist/processTemplate-RFBGVH7T.cjs +2 -0
  144. package/dist/processTemplate-RFBGVH7T.cjs.map +1 -0
  145. package/dist/{react-BZxD04XV.d.ts → react-BjOCdeTs.d.ts} +43 -366
  146. package/dist/{react-D8eAYckC.d.cts → react-UzAn4o7l.d.cts} +43 -366
  147. package/dist/react.cjs +2 -1
  148. package/dist/react.cjs.map +1 -0
  149. package/dist/react.css +1 -0
  150. package/dist/react.css.map +1 -0
  151. package/dist/react.d.cts +6 -5
  152. package/dist/react.d.ts +6 -5
  153. package/dist/react.js +2 -1
  154. package/dist/react.js.map +1 -0
  155. package/dist/{registry-D4tvj9f3.d.ts → registry-CV6nYWqP.d.ts} +1 -1
  156. package/dist/{registry-ngv6Bumt.d.cts → registry-DjacfR6Q.d.cts} +1 -1
  157. package/dist/selectionRects-6DU7HN7E.js +2 -0
  158. package/dist/selectionRects-6DU7HN7E.js.map +1 -0
  159. package/dist/selectionRects-YZSC24ZP.cjs +2 -0
  160. package/dist/selectionRects-YZSC24ZP.cjs.map +1 -0
  161. package/dist/styles.css +1 -1
  162. package/dist/{types-D96elyJF.d.cts → types-Bnp8rvJn.d.cts} +2 -2
  163. package/dist/{types-xMzSPT4i.d.ts → types-DwZ3xysp.d.ts} +2 -2
  164. package/dist/ui.cjs +2 -1
  165. package/dist/ui.cjs.map +1 -0
  166. package/dist/ui.d.cts +3 -3
  167. package/dist/ui.d.ts +3 -3
  168. package/dist/ui.js +2 -1
  169. package/dist/ui.js.map +1 -0
  170. package/dist/{variableDetector-DeM1N-_L.d.ts → variableDetector-BaDeXz7D.d.ts} +1 -1
  171. package/dist/{variableDetector-CPxKo9jP.d.cts → variableDetector-CMhJtM96.d.cts} +1 -1
  172. package/package.json +26 -79
  173. package/LICENSE +0 -21
  174. package/README.md +0 -171
  175. package/dist/FindReplaceDialog-46BE7Q2G.cjs +0 -1
  176. package/dist/HyperlinkDialog-22NH7ZLP.cjs +0 -1
  177. package/dist/chunk-24N3L4IL.cjs +0 -258
  178. package/dist/chunk-2ASOEN3V.js +0 -1
  179. package/dist/chunk-46OFHSPJ.cjs +0 -2
  180. package/dist/chunk-65OFYOHF.cjs +0 -58
  181. package/dist/chunk-6YFGCUHU.js +0 -4
  182. package/dist/chunk-ESI4BSBF.js +0 -1
  183. package/dist/chunk-GLFFXY2X.js +0 -258
  184. package/dist/chunk-ITWEFKGQ.cjs +0 -1
  185. package/dist/chunk-JKN7TNPA.js +0 -12
  186. package/dist/chunk-KESNGXGO.js +0 -1
  187. package/dist/chunk-NO7WUK5E.cjs +0 -12
  188. package/dist/chunk-NT2REEAA.cjs +0 -1
  189. package/dist/chunk-O7QVCJN6.cjs +0 -4
  190. package/dist/chunk-OW5H5DNE.cjs +0 -1
  191. package/dist/chunk-OWMXCVKB.js +0 -1
  192. package/dist/chunk-RM3ITJ2H.cjs +0 -10
  193. package/dist/chunk-TOI5W3HK.js +0 -8
  194. package/dist/chunk-UAVOWAIF.cjs +0 -8
  195. package/dist/chunk-ULNHBTYA.js +0 -2
  196. package/dist/chunk-UXXV4GT6.js +0 -10
  197. package/dist/chunk-VOWKSURW.cjs +0 -1
  198. package/dist/chunk-YMXKVLTU.js +0 -58
  199. package/dist/core-plugins.cjs +0 -1
  200. package/dist/core-plugins.js +0 -1
  201. package/dist/core.cjs +0 -1
  202. package/dist/core.d.cts +0 -23
  203. package/dist/core.d.ts +0 -23
  204. package/dist/core.js +0 -1
  205. package/dist/executor-ITYZTNSH.cjs +0 -1
  206. package/dist/executor-TC7CLATE.js +0 -1
  207. package/dist/headless.cjs +0 -4
  208. package/dist/mcp-cli.js +0 -136
  209. package/dist/processTemplate-525HZL4S.cjs +0 -1
  210. package/dist/selectionRects-PQEUEW35.cjs +0 -1
  211. package/dist/selectionRects-QAG5RSHD.js +0 -1
@@ -1,4 +1,89 @@
1
- import { h as Document, ad as BreakContent, P as Paragraph, y as Run, z as RunContent } from './agentApi-CbVUCZRu.js';
1
+ import { D as Document, B as BreakContent, a as Paragraph, b as Run, c as RunContent } from './agentApi-BFVyKagE.js';
2
+
3
+ /**
4
+ * Insert Operations Utility
5
+ *
6
+ * Utility functions for inserting content into the document.
7
+ * Provides functions for inserting page breaks, horizontal rules, and other elements.
8
+ */
9
+
10
+ /**
11
+ * Insert position in the document
12
+ */
13
+ interface InsertPosition {
14
+ /** Paragraph index in the document body */
15
+ paragraphIndex: number;
16
+ /** Run index within the paragraph (optional) */
17
+ runIndex?: number;
18
+ /** Character offset within the run (optional) */
19
+ offset?: number;
20
+ }
21
+ /**
22
+ * Create a page break content element
23
+ */
24
+ declare function createPageBreak(): BreakContent;
25
+ /**
26
+ * Create a column break content element
27
+ */
28
+ declare function createColumnBreak(): BreakContent;
29
+ /**
30
+ * Create a text wrapping break (line break)
31
+ */
32
+ declare function createLineBreak(clear?: 'none' | 'left' | 'right' | 'all'): BreakContent;
33
+ /**
34
+ * Create a run containing a page break
35
+ */
36
+ declare function createPageBreakRun(): Run;
37
+ /**
38
+ * Create an empty paragraph with a page break before it
39
+ */
40
+ declare function createPageBreakParagraph(): Paragraph;
41
+ /**
42
+ * Insert a page break at a position in the document
43
+ * This inserts a new paragraph with pageBreakBefore: true
44
+ */
45
+ declare function insertPageBreak(doc: Document, position: InsertPosition): Document;
46
+ /**
47
+ * Create a horizontal rule paragraph
48
+ * Uses a paragraph with bottom border to simulate horizontal rule
49
+ */
50
+ declare function createHorizontalRule(): Paragraph;
51
+ /**
52
+ * Insert a horizontal rule at a position in the document
53
+ */
54
+ declare function insertHorizontalRule(doc: Document, position: InsertPosition): Document;
55
+ /**
56
+ * Check if content is a page break
57
+ */
58
+ declare function isPageBreak(content: RunContent): boolean;
59
+ /**
60
+ * Check if content is a column break
61
+ */
62
+ declare function isColumnBreak(content: RunContent): boolean;
63
+ /**
64
+ * Check if content is a line break
65
+ */
66
+ declare function isLineBreak(content: RunContent): boolean;
67
+ /**
68
+ * Check if content is any type of break
69
+ */
70
+ declare function isBreakContent(content: RunContent): content is BreakContent;
71
+ /**
72
+ * Check if a paragraph has pageBreakBefore
73
+ */
74
+ declare function hasPageBreakBefore(paragraph: Paragraph): boolean;
75
+ /**
76
+ * Count page breaks in a document
77
+ */
78
+ declare function countPageBreaks(doc: Document): number;
79
+ /**
80
+ * Find all page break positions in a document
81
+ */
82
+ declare function findPageBreaks(doc: Document): InsertPosition[];
83
+ /**
84
+ * Remove a page break at a specific position
85
+ */
86
+ declare function removePageBreak(doc: Document, position: InsertPosition): Document;
2
87
 
3
88
  /**
4
89
  * Google Fonts Loader
@@ -88,89 +173,4 @@ declare function loadFontFromBuffer(fontFamily: string, buffer: ArrayBuffer, opt
88
173
  */
89
174
  declare function preloadCommonFonts(): Promise<void>;
90
175
 
91
- /**
92
- * Insert Operations Utility
93
- *
94
- * Utility functions for inserting content into the document.
95
- * Provides functions for inserting page breaks, horizontal rules, and other elements.
96
- */
97
-
98
- /**
99
- * Insert position in the document
100
- */
101
- interface InsertPosition {
102
- /** Paragraph index in the document body */
103
- paragraphIndex: number;
104
- /** Run index within the paragraph (optional) */
105
- runIndex?: number;
106
- /** Character offset within the run (optional) */
107
- offset?: number;
108
- }
109
- /**
110
- * Create a page break content element
111
- */
112
- declare function createPageBreak(): BreakContent;
113
- /**
114
- * Create a column break content element
115
- */
116
- declare function createColumnBreak(): BreakContent;
117
- /**
118
- * Create a text wrapping break (line break)
119
- */
120
- declare function createLineBreak(clear?: 'none' | 'left' | 'right' | 'all'): BreakContent;
121
- /**
122
- * Create a run containing a page break
123
- */
124
- declare function createPageBreakRun(): Run;
125
- /**
126
- * Create an empty paragraph with a page break before it
127
- */
128
- declare function createPageBreakParagraph(): Paragraph;
129
- /**
130
- * Insert a page break at a position in the document
131
- * This inserts a new paragraph with pageBreakBefore: true
132
- */
133
- declare function insertPageBreak(doc: Document, position: InsertPosition): Document;
134
- /**
135
- * Create a horizontal rule paragraph
136
- * Uses a paragraph with bottom border to simulate horizontal rule
137
- */
138
- declare function createHorizontalRule(): Paragraph;
139
- /**
140
- * Insert a horizontal rule at a position in the document
141
- */
142
- declare function insertHorizontalRule(doc: Document, position: InsertPosition): Document;
143
- /**
144
- * Check if content is a page break
145
- */
146
- declare function isPageBreak(content: RunContent): boolean;
147
- /**
148
- * Check if content is a column break
149
- */
150
- declare function isColumnBreak(content: RunContent): boolean;
151
- /**
152
- * Check if content is a line break
153
- */
154
- declare function isLineBreak(content: RunContent): boolean;
155
- /**
156
- * Check if content is any type of break
157
- */
158
- declare function isBreakContent(content: RunContent): content is BreakContent;
159
- /**
160
- * Check if a paragraph has pageBreakBefore
161
- */
162
- declare function hasPageBreakBefore(paragraph: Paragraph): boolean;
163
- /**
164
- * Count page breaks in a document
165
- */
166
- declare function countPageBreaks(doc: Document): number;
167
- /**
168
- * Find all page break positions in a document
169
- */
170
- declare function findPageBreaks(doc: Document): InsertPosition[];
171
- /**
172
- * Remove a page break at a specific position
173
- */
174
- declare function removePageBreak(doc: Document, position: InsertPosition): Document;
175
-
176
176
  export { type InsertPosition as I, countPageBreaks as a, createColumnBreak as b, canRenderFont as c, createHorizontalRule as d, createLineBreak as e, createPageBreak as f, createPageBreakParagraph as g, createPageBreakRun as h, findPageBreaks as i, getLoadedFonts as j, hasPageBreakBefore as k, insertHorizontalRule as l, insertPageBreak as m, isBreakContent as n, isColumnBreak as o, isFontLoaded as p, isLoading as q, isLineBreak as r, isPageBreak as s, loadFont as t, loadFontFromBuffer as u, loadFonts as v, onFontsLoaded as w, preloadCommonFonts as x, removePageBreak as y };
@@ -1,4 +1,89 @@
1
- import { h as Document, ad as BreakContent, P as Paragraph, y as Run, z as RunContent } from './agentApi-CbVUCZRu.cjs';
1
+ import { D as Document, B as BreakContent, a as Paragraph, b as Run, c as RunContent } from './agentApi-BFVyKagE.cjs';
2
+
3
+ /**
4
+ * Insert Operations Utility
5
+ *
6
+ * Utility functions for inserting content into the document.
7
+ * Provides functions for inserting page breaks, horizontal rules, and other elements.
8
+ */
9
+
10
+ /**
11
+ * Insert position in the document
12
+ */
13
+ interface InsertPosition {
14
+ /** Paragraph index in the document body */
15
+ paragraphIndex: number;
16
+ /** Run index within the paragraph (optional) */
17
+ runIndex?: number;
18
+ /** Character offset within the run (optional) */
19
+ offset?: number;
20
+ }
21
+ /**
22
+ * Create a page break content element
23
+ */
24
+ declare function createPageBreak(): BreakContent;
25
+ /**
26
+ * Create a column break content element
27
+ */
28
+ declare function createColumnBreak(): BreakContent;
29
+ /**
30
+ * Create a text wrapping break (line break)
31
+ */
32
+ declare function createLineBreak(clear?: 'none' | 'left' | 'right' | 'all'): BreakContent;
33
+ /**
34
+ * Create a run containing a page break
35
+ */
36
+ declare function createPageBreakRun(): Run;
37
+ /**
38
+ * Create an empty paragraph with a page break before it
39
+ */
40
+ declare function createPageBreakParagraph(): Paragraph;
41
+ /**
42
+ * Insert a page break at a position in the document
43
+ * This inserts a new paragraph with pageBreakBefore: true
44
+ */
45
+ declare function insertPageBreak(doc: Document, position: InsertPosition): Document;
46
+ /**
47
+ * Create a horizontal rule paragraph
48
+ * Uses a paragraph with bottom border to simulate horizontal rule
49
+ */
50
+ declare function createHorizontalRule(): Paragraph;
51
+ /**
52
+ * Insert a horizontal rule at a position in the document
53
+ */
54
+ declare function insertHorizontalRule(doc: Document, position: InsertPosition): Document;
55
+ /**
56
+ * Check if content is a page break
57
+ */
58
+ declare function isPageBreak(content: RunContent): boolean;
59
+ /**
60
+ * Check if content is a column break
61
+ */
62
+ declare function isColumnBreak(content: RunContent): boolean;
63
+ /**
64
+ * Check if content is a line break
65
+ */
66
+ declare function isLineBreak(content: RunContent): boolean;
67
+ /**
68
+ * Check if content is any type of break
69
+ */
70
+ declare function isBreakContent(content: RunContent): content is BreakContent;
71
+ /**
72
+ * Check if a paragraph has pageBreakBefore
73
+ */
74
+ declare function hasPageBreakBefore(paragraph: Paragraph): boolean;
75
+ /**
76
+ * Count page breaks in a document
77
+ */
78
+ declare function countPageBreaks(doc: Document): number;
79
+ /**
80
+ * Find all page break positions in a document
81
+ */
82
+ declare function findPageBreaks(doc: Document): InsertPosition[];
83
+ /**
84
+ * Remove a page break at a specific position
85
+ */
86
+ declare function removePageBreak(doc: Document, position: InsertPosition): Document;
2
87
 
3
88
  /**
4
89
  * Google Fonts Loader
@@ -88,89 +173,4 @@ declare function loadFontFromBuffer(fontFamily: string, buffer: ArrayBuffer, opt
88
173
  */
89
174
  declare function preloadCommonFonts(): Promise<void>;
90
175
 
91
- /**
92
- * Insert Operations Utility
93
- *
94
- * Utility functions for inserting content into the document.
95
- * Provides functions for inserting page breaks, horizontal rules, and other elements.
96
- */
97
-
98
- /**
99
- * Insert position in the document
100
- */
101
- interface InsertPosition {
102
- /** Paragraph index in the document body */
103
- paragraphIndex: number;
104
- /** Run index within the paragraph (optional) */
105
- runIndex?: number;
106
- /** Character offset within the run (optional) */
107
- offset?: number;
108
- }
109
- /**
110
- * Create a page break content element
111
- */
112
- declare function createPageBreak(): BreakContent;
113
- /**
114
- * Create a column break content element
115
- */
116
- declare function createColumnBreak(): BreakContent;
117
- /**
118
- * Create a text wrapping break (line break)
119
- */
120
- declare function createLineBreak(clear?: 'none' | 'left' | 'right' | 'all'): BreakContent;
121
- /**
122
- * Create a run containing a page break
123
- */
124
- declare function createPageBreakRun(): Run;
125
- /**
126
- * Create an empty paragraph with a page break before it
127
- */
128
- declare function createPageBreakParagraph(): Paragraph;
129
- /**
130
- * Insert a page break at a position in the document
131
- * This inserts a new paragraph with pageBreakBefore: true
132
- */
133
- declare function insertPageBreak(doc: Document, position: InsertPosition): Document;
134
- /**
135
- * Create a horizontal rule paragraph
136
- * Uses a paragraph with bottom border to simulate horizontal rule
137
- */
138
- declare function createHorizontalRule(): Paragraph;
139
- /**
140
- * Insert a horizontal rule at a position in the document
141
- */
142
- declare function insertHorizontalRule(doc: Document, position: InsertPosition): Document;
143
- /**
144
- * Check if content is a page break
145
- */
146
- declare function isPageBreak(content: RunContent): boolean;
147
- /**
148
- * Check if content is a column break
149
- */
150
- declare function isColumnBreak(content: RunContent): boolean;
151
- /**
152
- * Check if content is a line break
153
- */
154
- declare function isLineBreak(content: RunContent): boolean;
155
- /**
156
- * Check if content is any type of break
157
- */
158
- declare function isBreakContent(content: RunContent): content is BreakContent;
159
- /**
160
- * Check if a paragraph has pageBreakBefore
161
- */
162
- declare function hasPageBreakBefore(paragraph: Paragraph): boolean;
163
- /**
164
- * Count page breaks in a document
165
- */
166
- declare function countPageBreaks(doc: Document): number;
167
- /**
168
- * Find all page break positions in a document
169
- */
170
- declare function findPageBreaks(doc: Document): InsertPosition[];
171
- /**
172
- * Remove a page break at a specific position
173
- */
174
- declare function removePageBreak(doc: Document, position: InsertPosition): Document;
175
-
176
176
  export { type InsertPosition as I, countPageBreaks as a, createColumnBreak as b, canRenderFont as c, createHorizontalRule as d, createLineBreak as e, createPageBreak as f, createPageBreakParagraph as g, createPageBreakRun as h, findPageBreaks as i, getLoadedFonts as j, hasPageBreakBefore as k, insertHorizontalRule as l, insertPageBreak as m, isBreakContent as n, isColumnBreak as o, isFontLoaded as p, isLoading as q, isLineBreak as r, isPageBreak as s, loadFont as t, loadFontFromBuffer as u, loadFonts as v, onFontsLoaded as w, preloadCommonFonts as x, removePageBreak as y };
@@ -0,0 +1,5 @@
1
+ 'use strict';var chunkT2HQYRA7_cjs=require('./chunk-T2HQYRA7.cjs'),chunkRMUMR42R_cjs=require('./chunk-RMUMR42R.cjs'),chunkGJ4GKSDU_cjs=require('./chunk-GJ4GKSDU.cjs'),chunkXZNOV52K_cjs=require('./chunk-XZNOV52K.cjs'),chunk5DYSI4O4_cjs=require('./chunk-5DYSI4O4.cjs'),chunkGWBTKVFD_cjs=require('./chunk-GWBTKVFD.cjs'),chunkC33XDRDJ_cjs=require('./chunk-C33XDRDJ.cjs'),chunkWD2HTKRR_cjs=require('./chunk-WD2HTKRR.cjs'),chunk4QT5LPBA_cjs=require('./chunk-4QT5LPBA.cjs');require('./chunk-QEBO3EQP.cjs');function p(n){let e=[];for(let t of n.content)t.type==="run"?e.push(c(t)):t.type==="hyperlink"&&e.push(g(t));return e.join("")}function c(n){return n.content.filter(e=>e.type==="text").map(e=>e.text).join("")}function g(n){let e=[];for(let t of n.children)t.type==="run"&&e.push(c(t));return e.join("")}function m(n){let e=[];for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&e.push(p(r));return e.join(" ")}function Me(n){let e=[];for(let t of n.content)t.type==="paragraph"?e.push(p(t)):t.type==="table"&&e.push(m(t));return e.join(`
2
+ `)}function f(n){return n.split(/\s+/).filter(t=>t.length>0).length}function je(n,e=true){return e?n.length:n.replace(/\s/g,"").length}function We(n){let e=0;for(let t of n.content)t.type==="paragraph"?e+=f(p(t)):t.type==="table"&&(e+=ze(t));return e}function ze(n){let e=0;for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&(e+=f(p(r)));return e}function Ne(n){let e=0;for(let t of n.content)t.type==="paragraph"?e+=p(t).length:t.type==="table"&&(e+=qe(t));return e}function qe(n){let e=0;for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&(e+=p(r).length);return e}function Ze(n,e,t){let o=[],r=0,i=n[e.paragraphIndex];if(i){let s=p(i).slice(0,e.offset);o.unshift(s),r+=s.length;}for(let l=e.paragraphIndex-1;l>=0&&r<t;l--){let s=n[l];if(!s)continue;let u=p(s);o.unshift(u),r+=u.length;}let a=o.join(`
3
+ `);return a.length>t?"..."+a.slice(-t):a}function _e(n,e,t){let o=[],r=0,i=n[e.paragraphIndex];if(i){let s=p(i).slice(e.offset);o.push(s),r+=s.length;}for(let l=e.paragraphIndex+1;l<n.length&&r<t;l++){let s=n[l];if(!s)continue;let u=p(s);o.push(u),r+=u.length;}let a=o.join(`
4
+ `);return a.length>t?a.slice(0,t)+"...":a}function Je(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o),i=t+r.length;if(e>=t&&e<i)return o.formatting||{};t=i;}else if(o.type==="hyperlink"){let r=g(o),i=t+r.length;if(e>=t&&e<i){for(let a of o.children)if(a.type==="run")return a.formatting||{}}t=i;}return {}}function Ue(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return true;t=a;}return false}function Ge(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return o;t=a;}}function Ke(n){return n?n.toLowerCase().includes("heading"):false}function Qe(n){if(!n)return;let e=n.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}function Xe(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="run"){for(let o of t.content)if(o.type==="drawing")return true}}return false}function Ye(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="hyperlink")return true}return false}function $e(n){return n.content.some(e=>e.type==="table")}function x(n){return n.content.filter(e=>e.type==="paragraph")}function et(n,e){return x(n)[e]}function tt(n,e){let t=0;for(let o=0;o<n.content.length;o++)if(n.content[o].type==="paragraph"){if(t===e)return o;t++;}return -1}var ot="0.0.2";Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunkT2HQYRA7_cjs.g}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunkT2HQYRA7_cjs.d}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunkT2HQYRA7_cjs.a}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunkT2HQYRA7_cjs.h}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunkT2HQYRA7_cjs.b}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunkT2HQYRA7_cjs.f}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunkT2HQYRA7_cjs.e}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunkT2HQYRA7_cjs.c}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkRMUMR42R_cjs.c}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkRMUMR42R_cjs.j}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkRMUMR42R_cjs.i}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunkRMUMR42R_cjs.g}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunkRMUMR42R_cjs.d}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunkRMUMR42R_cjs.e}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkRMUMR42R_cjs.b}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkRMUMR42R_cjs.a}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkRMUMR42R_cjs.f}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkRMUMR42R_cjs.h}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunkRMUMR42R_cjs.k}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.l}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.m}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.i}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.h}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.j}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.p}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.r}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.x}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.f}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.u}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.d}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.e}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.k}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.g}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.q}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.o}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.a}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.b}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.c}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.s}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkGJ4GKSDU_cjs.n}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.a}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.b}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.c}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.d}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.m}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.e}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.i}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.f}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.g}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.n}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.j}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.l}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.k}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkXZNOV52K_cjs.h}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunk5DYSI4O4_cjs.e}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunk5DYSI4O4_cjs.d}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunk5DYSI4O4_cjs.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunk5DYSI4O4_cjs.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunk5DYSI4O4_cjs.a}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkGWBTKVFD_cjs.a}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkGWBTKVFD_cjs.b}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkC33XDRDJ_cjs.q}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunkWD2HTKRR_cjs.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkWD2HTKRR_cjs.d}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkWD2HTKRR_cjs.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkWD2HTKRR_cjs.c}});Object.defineProperty(exports,"createTemplateProcessor",{enumerable:true,get:function(){return chunk4QT5LPBA_cjs.j}});Object.defineProperty(exports,"getMissingVariables",{enumerable:true,get:function(){return chunk4QT5LPBA_cjs.g}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunk4QT5LPBA_cjs.e}});Object.defineProperty(exports,"previewTemplate",{enumerable:true,get:function(){return chunk4QT5LPBA_cjs.h}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunk4QT5LPBA_cjs.a}});Object.defineProperty(exports,"processTemplateAdvanced",{enumerable:true,get:function(){return chunk4QT5LPBA_cjs.i}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunk4QT5LPBA_cjs.c}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunk4QT5LPBA_cjs.b}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunk4QT5LPBA_cjs.f}});exports.VERSION=ot;exports.countCharacters=je;exports.countWords=f;exports.getBlockIndexForParagraph=tt;exports.getBodyCharacterCount=Ne;exports.getBodyText=Me;exports.getBodyWordCount=We;exports.getFormattingAtPosition=Je;exports.getHyperlinkAtPosition=Ge;exports.getHyperlinkText=g;exports.getParagraphAtIndex=et;exports.getParagraphText=p;exports.getParagraphs=x;exports.getRunText=c;exports.getTableText=m;exports.getTextAfter=_e;exports.getTextBefore=Ze;exports.hasHyperlinks=Ye;exports.hasImages=Xe;exports.hasTables=$e;exports.isHeadingStyle=Ke;exports.isPositionInHyperlink=Ue;exports.parseHeadingLevel=Qe;//# sourceMappingURL=headless-reexport.cjs.map
5
+ //# sourceMappingURL=headless-reexport.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../core/src/agent/text-utils.ts","../../core/src/headless.ts"],"names":["getParagraphText","paragraph","texts","item","getRunText","getHyperlinkText","run","c","hyperlink","child","getTableText","table","row","cell","block","getBodyText","body","countWords","text","w","countCharacters","includeSpaces","getBodyWordCount","count","getTableWordCount","getBodyCharacterCount","getTableCharacterCount","getTextBefore","paragraphs","position","maxChars","totalChars","currentPara","beforeText","i","para","combined","getTextAfter","afterText","getFormattingAtPosition","offset","currentOffset","runEnd","linkEnd","isPositionInHyperlink","linkStart","getHyperlinkAtPosition","isHeadingStyle","styleId","parseHeadingLevel","match","hasImages","content","hasHyperlinks","hasTables","getParagraphs","getParagraphAtIndex","index","getBlockIndexForParagraph","paragraphIndex","currentParagraphIndex","VERSION"],"mappings":"mfA2BO,SAASA,CAAAA,CAAiBC,CAAAA,CAA8B,CAC7D,IAAMC,EAAkB,EAAC,CAEzB,IAAA,IAAWC,CAAAA,IAAQF,EAAU,OAAA,CACvBE,CAAAA,CAAK,IAAA,GAAS,KAAA,CAChBD,EAAM,IAAA,CAAKE,CAAAA,CAAWD,CAAI,CAAC,CAAA,CAClBA,CAAAA,CAAK,IAAA,GAAS,WAAA,EACvBD,EAAM,IAAA,CAAKG,CAAAA,CAAiBF,CAAI,CAAC,EAIrC,OAAOD,CAAAA,CAAM,IAAA,CAAK,EAAE,CACtB,CAKO,SAASE,CAAAA,CAAWE,CAAAA,CAAkB,CAC3C,OAAOA,CAAAA,CAAI,OAAA,CACR,OAAQC,CAAAA,EAAMA,CAAAA,CAAE,IAAA,GAAS,MAAM,EAC/B,GAAA,CAAKA,CAAAA,EAAOA,CAAAA,CAAqC,IAAI,EACrD,IAAA,CAAK,EAAE,CACZ,CAKO,SAASF,CAAAA,CAAiBG,CAAAA,CAA8B,CAC7D,IAAMN,EAAkB,EAAC,CACzB,IAAA,IAAWO,CAAAA,IAASD,EAAU,QAAA,CACxBC,CAAAA,CAAM,IAAA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AA,CAAM,OAAS,WAAW,CACtF,CASO,SAAS0C,EAAAA,CAAoBxC,CAAAA,CAAoByC,CAAAA,CAAsC,CAE5F,OADmBF,CAAAA,CAAcvC,CAAI,CAAA,CACnByC,CAAK,CACzB,CASO,SAASC,GAA0B1C,CAAAA,CAAoB2C,CAAAA,CAAgC,CAC5F,IAAIC,CAAAA,CAAwB,EAC5B,IAAA,IAAS1B,CAAAA,CAAI,EAAGA,CAAAA,CAAIlB,CAAAA,CAAK,QAAQ,MAAA,CAAQkB,CAAAA,EAAAA,CACvC,GAAIlB,CAAAA,CAAK,OAAA,CAAQkB,CAAC,CAAA,CAAE,IAAA,GAAS,YAAa,CACxC,GAAI0B,IAA0BD,CAAAA,CAC5B,OAAOzB,EAET0B,CAAAA,GACF,CAEF,OAAO,GACT,KCrdaC,EAAAA,CAAU","file":"headless-reexport.cjs","sourcesContent":["/**\n * Shared Text Utilities for Agent Module\n *\n * Common text extraction and manipulation utilities used by\n * context.ts, selectionContext.ts, and other agent-related code.\n *\n * Consolidates duplicated helper functions into a single location.\n */\n\nimport type {\n DocumentBody,\n Paragraph,\n Run,\n Hyperlink,\n Table,\n TextFormatting,\n} from '../types/document';\n\nimport type { Position } from '../types/agentApi';\n\n// ============================================================================\n// TEXT EXTRACTION\n// ============================================================================\n\n/**\n * Get plain text from a paragraph\n */\nexport function getParagraphText(paragraph: Paragraph): string {\n const texts: string[] = [];\n\n for (const item of paragraph.content) {\n if (item.type === 'run') {\n texts.push(getRunText(item));\n } else if (item.type === 'hyperlink') {\n texts.push(getHyperlinkText(item));\n }\n }\n\n return texts.join('');\n}\n\n/**\n * Get plain text from a run\n */\nexport function getRunText(run: Run): string {\n return run.content\n .filter((c) => c.type === 'text')\n .map((c) => (c as { type: 'text'; text: string }).text)\n .join('');\n}\n\n/**\n * Get plain text from a hyperlink\n */\nexport function getHyperlinkText(hyperlink: Hyperlink): string {\n const texts: string[] = [];\n for (const child of hyperlink.children) {\n if (child.type === 'run') {\n texts.push(getRunText(child));\n }\n }\n return texts.join('');\n}\n\n/**\n * Get plain text from a table\n */\nexport function getTableText(table: Table): string {\n const texts: string[] = [];\n\n for (const row of table.rows) {\n for (const cell of row.cells) {\n for (const block of cell.content) {\n if (block.type === 'paragraph') {\n texts.push(getParagraphText(block));\n }\n }\n }\n }\n\n return texts.join('\\t');\n}\n\n/**\n * Get plain text from document body\n */\nexport function getBodyText(body: DocumentBody): string {\n const texts: string[] = [];\n\n for (const block of body.content) {\n if (block.type === 'paragraph') {\n texts.push(getParagraphText(block));\n } else if (block.type === 'table') {\n texts.push(getTableText(block));\n }\n }\n\n return texts.join('\\n');\n}\n\n// ============================================================================\n// WORD COUNTING\n// ============================================================================\n\n/**\n * Count words in text\n */\nexport function countWords(text: string): number {\n const words = text.split(/\\s+/).filter((w) => w.length > 0);\n return words.length;\n}\n\n/**\n * Count characters in text\n */\nexport function countCharacters(text: string, includeSpaces = true): number {\n if (includeSpaces) {\n return text.length;\n }\n return text.replace(/\\s/g, '').length;\n}\n\n/**\n * Get word count from document body\n */\nexport function getBodyWordCount(body: DocumentBody): number {\n let count = 0;\n for (const block of body.content) {\n if (block.type === 'paragraph') {\n count += countWords(getParagraphText(block));\n } else if (block.type === 'table') {\n count += getTableWordCount(block);\n }\n }\n return count;\n}\n\n/**\n * Get word count from table\n */\nexport function getTableWordCount(table: Table): number {\n let count = 0;\n for (const row of table.rows) {\n for (const cell of row.cells) {\n for (const block of cell.content) {\n if (block.type === 'paragraph') {\n count += countWords(getParagraphText(block));\n }\n }\n }\n }\n return count;\n}\n\n/**\n * Get character count from document body\n */\nexport function getBodyCharacterCount(body: DocumentBody): number {\n let count = 0;\n for (const block of body.content) {\n if (block.type === 'paragraph') {\n count += getParagraphText(block).length;\n } else if (block.type === 'table') {\n count += getTableCharacterCount(block);\n }\n }\n return count;\n}\n\n/**\n * Get character count from table\n */\nexport function getTableCharacterCount(table: Table): number {\n let count = 0;\n for (const row of table.rows) {\n for (const cell of row.cells) {\n for (const block of cell.content) {\n if (block.type === 'paragraph') {\n count += getParagraphText(block).length;\n }\n }\n }\n }\n return count;\n}\n\n// ============================================================================\n// CONTEXT EXTRACTION\n// ============================================================================\n\n/**\n * Get text before a position\n *\n * @param paragraphs - Array of paragraphs\n * @param position - Position to get text before\n * @param maxChars - Maximum characters to return\n * @returns Text before the position\n */\nexport function getTextBefore(\n paragraphs: Paragraph[],\n position: Position,\n maxChars: number\n): string {\n const texts: string[] = [];\n let totalChars = 0;\n\n // Text before offset in current paragraph\n const currentPara = paragraphs[position.paragraphIndex];\n if (currentPara) {\n const text = getParagraphText(currentPara);\n const beforeText = text.slice(0, position.offset);\n texts.unshift(beforeText);\n totalChars += beforeText.length;\n }\n\n // Text from previous paragraphs\n for (let i = position.paragraphIndex - 1; i >= 0 && totalChars < maxChars; i--) {\n const para = paragraphs[i];\n if (!para) continue;\n const text = getParagraphText(para);\n texts.unshift(text);\n totalChars += text.length;\n }\n\n const combined = texts.join('\\n');\n if (combined.length > maxChars) {\n return '...' + combined.slice(-maxChars);\n }\n return combined;\n}\n\n/**\n * Get text after a position\n *\n * @param paragraphs - Array of paragraphs\n * @param position - Position to get text after\n * @param maxChars - Maximum characters to return\n * @returns Text after the position\n */\nexport function getTextAfter(\n paragraphs: Paragraph[],\n position: Position,\n maxChars: number\n): string {\n const texts: string[] = [];\n let totalChars = 0;\n\n // Text after offset in current paragraph\n const currentPara = paragraphs[position.paragraphIndex];\n if (currentPara) {\n const text = getParagraphText(currentPara);\n const afterText = text.slice(position.offset);\n texts.push(afterText);\n totalChars += afterText.length;\n }\n\n // Text from following paragraphs\n for (let i = position.paragraphIndex + 1; i < paragraphs.length && totalChars < maxChars; i++) {\n const para = paragraphs[i];\n if (!para) continue;\n const text = getParagraphText(para);\n texts.push(text);\n totalChars += text.length;\n }\n\n const combined = texts.join('\\n');\n if (combined.length > maxChars) {\n return combined.slice(0, maxChars) + '...';\n }\n return combined;\n}\n\n// ============================================================================\n// FORMATTING QUERIES\n// ============================================================================\n\n/**\n * Get formatting at a specific position in a paragraph\n *\n * @param paragraph - The paragraph to check\n * @param offset - Character offset in the paragraph\n * @returns Formatting at that position\n */\nexport function getFormattingAtPosition(\n paragraph: Paragraph,\n offset: number\n): Partial<TextFormatting> {\n let currentOffset = 0;\n\n for (const item of paragraph.content) {\n if (item.type === 'run') {\n const text = getRunText(item);\n const runEnd = currentOffset + text.length;\n\n if (offset >= currentOffset && offset < runEnd) {\n return item.formatting || {};\n }\n\n currentOffset = runEnd;\n } else if (item.type === 'hyperlink') {\n const text = getHyperlinkText(item);\n const linkEnd = currentOffset + text.length;\n\n if (offset >= currentOffset && offset < linkEnd) {\n // Return formatting from first child run\n for (const child of item.children) {\n if (child.type === 'run') {\n return child.formatting || {};\n }\n }\n }\n\n currentOffset = linkEnd;\n }\n }\n\n return {};\n}\n\n/**\n * Check if position is within a hyperlink\n *\n * @param paragraph - The paragraph to check\n * @param offset - Character offset in the paragraph\n * @returns True if position is in a hyperlink\n */\nexport function isPositionInHyperlink(paragraph: Paragraph, offset: number): boolean {\n let currentOffset = 0;\n\n for (const item of paragraph.content) {\n if (item.type === 'run') {\n const text = getRunText(item);\n currentOffset += text.length;\n } else if (item.type === 'hyperlink') {\n const text = getHyperlinkText(item);\n const linkStart = currentOffset;\n const linkEnd = currentOffset + text.length;\n\n if (offset >= linkStart && offset < linkEnd) {\n return true;\n }\n\n currentOffset = linkEnd;\n }\n }\n\n return false;\n}\n\n/**\n * Get hyperlink at position\n *\n * @param paragraph - The paragraph to check\n * @param offset - Character offset in the paragraph\n * @returns The hyperlink at that position, or undefined\n */\nexport function getHyperlinkAtPosition(\n paragraph: Paragraph,\n offset: number\n): Hyperlink | undefined {\n let currentOffset = 0;\n\n for (const item of paragraph.content) {\n if (item.type === 'run') {\n const text = getRunText(item);\n currentOffset += text.length;\n } else if (item.type === 'hyperlink') {\n const text = getHyperlinkText(item);\n const linkStart = currentOffset;\n const linkEnd = currentOffset + text.length;\n\n if (offset >= linkStart && offset < linkEnd) {\n return item;\n }\n\n currentOffset = linkEnd;\n }\n }\n\n return undefined;\n}\n\n// ============================================================================\n// STYLE HELPERS\n// ============================================================================\n\n/**\n * Check if style ID represents a heading\n *\n * @param styleId - Style ID to check\n * @returns True if it's a heading style\n */\nexport function isHeadingStyle(styleId?: string): boolean {\n if (!styleId) return false;\n return styleId.toLowerCase().includes('heading');\n}\n\n/**\n * Parse heading level from style ID\n *\n * @param styleId - Style ID to parse\n * @returns Heading level (1-9) or undefined\n */\nexport function parseHeadingLevel(styleId?: string): number | undefined {\n if (!styleId) return undefined;\n const match = styleId.match(/heading\\s*(\\d)/i);\n if (match) {\n return parseInt(match[1], 10);\n }\n return undefined;\n}\n\n// ============================================================================\n// DOCUMENT QUERIES\n// ============================================================================\n\n/**\n * Check if document body has images\n *\n * @param body - Document body to check\n * @returns True if contains images\n */\nexport function hasImages(body: DocumentBody): boolean {\n for (const block of body.content) {\n if (block.type === 'paragraph') {\n for (const item of block.content) {\n if (item.type === 'run') {\n for (const content of item.content) {\n if (content.type === 'drawing') {\n return true;\n }\n }\n }\n }\n }\n }\n return false;\n}\n\n/**\n * Check if document body has hyperlinks\n *\n * @param body - Document body to check\n * @returns True if contains hyperlinks\n */\nexport function hasHyperlinks(body: DocumentBody): boolean {\n for (const block of body.content) {\n if (block.type === 'paragraph') {\n for (const item of block.content) {\n if (item.type === 'hyperlink') {\n return true;\n }\n }\n }\n }\n return false;\n}\n\n/**\n * Check if document body has tables\n *\n * @param body - Document body to check\n * @returns True if contains tables\n */\nexport function hasTables(body: DocumentBody): boolean {\n return body.content.some((block) => block.type === 'table');\n}\n\n// ============================================================================\n// PARAGRAPH HELPERS\n// ============================================================================\n\n/**\n * Get all paragraphs from document body\n *\n * @param body - Document body\n * @returns Array of paragraphs\n */\nexport function getParagraphs(body: DocumentBody): Paragraph[] {\n return body.content.filter((block): block is Paragraph => block.type === 'paragraph');\n}\n\n/**\n * Get paragraph at index from document body\n *\n * @param body - Document body\n * @param index - Paragraph index (0-indexed)\n * @returns Paragraph or undefined\n */\nexport function getParagraphAtIndex(body: DocumentBody, index: number): Paragraph | undefined {\n const paragraphs = getParagraphs(body);\n return paragraphs[index];\n}\n\n/**\n * Get block index for a paragraph index\n *\n * @param body - Document body\n * @param paragraphIndex - Paragraph index\n * @returns Block index or -1 if not found\n */\nexport function getBlockIndexForParagraph(body: DocumentBody, paragraphIndex: number): number {\n let currentParagraphIndex = 0;\n for (let i = 0; i < body.content.length; i++) {\n if (body.content[i].type === 'paragraph') {\n if (currentParagraphIndex === paragraphIndex) {\n return i;\n }\n currentParagraphIndex++;\n }\n }\n return -1;\n}\n\n// ============================================================================\n// EXPORTS\n// ============================================================================\n\nexport default {\n getParagraphText,\n getRunText,\n getHyperlinkText,\n getTableText,\n getBodyText,\n countWords,\n countCharacters,\n getBodyWordCount,\n getBodyCharacterCount,\n getTextBefore,\n getTextAfter,\n getFormattingAtPosition,\n isPositionInHyperlink,\n getHyperlinkAtPosition,\n isHeadingStyle,\n parseHeadingLevel,\n hasImages,\n hasHyperlinks,\n hasTables,\n getParagraphs,\n getParagraphAtIndex,\n getBlockIndexForParagraph,\n};\n","/**\n * Headless API Entry Point\n *\n * Provides document manipulation functionality without React/DOM dependencies.\n * Suitable for Node.js scripts, CLI tools, and server-side processing.\n *\n * @example\n * ```ts\n * import { DocumentAgent, parseDocx, pluginRegistry } from '@eigenpal/docx-editor/headless';\n * import { docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins';\n *\n * // Register plugins\n * pluginRegistry.register(docxtemplaterPlugin);\n *\n * // Load and manipulate document\n * const buffer = fs.readFileSync('template.docx');\n * const agent = await DocumentAgent.fromBuffer(buffer);\n *\n * // Get document info\n * console.log('Word count:', agent.getWordCount());\n * console.log('Variables:', agent.getVariables());\n *\n * // Edit document\n * const newAgent = agent\n * .insertText({ paragraphIndex: 0, offset: 0 }, 'Hello ')\n * .applyStyle(0, 'Heading1');\n *\n * // Apply template variables\n * const finalAgent = await newAgent.applyVariables({\n * customer_name: 'Jane Doe',\n * date: '2024-02-15',\n * });\n *\n * // Export\n * const output = await finalAgent.toBuffer();\n * fs.writeFileSync('output.docx', Buffer.from(output));\n * ```\n */\n\n// ============================================================================\n// VERSION\n// ============================================================================\n\nexport const VERSION = '0.0.2';\n\n// ============================================================================\n// DOCUMENT AGENT\n// ============================================================================\n\nexport { DocumentAgent, createAgent, createAgentFromDocument } from './agent/DocumentAgent';\nexport type {\n InsertTextOptions,\n InsertTableOptions,\n InsertImageOptions,\n InsertHyperlinkOptions,\n FormattedTextSegment,\n} from './agent/DocumentAgent';\n\n// ============================================================================\n// COMMAND EXECUTION\n// ============================================================================\n\nexport { executeCommand, executeCommands } from './agent/executor';\n\n// ============================================================================\n// CONTEXT BUILDERS\n// ============================================================================\n\nexport {\n getAgentContext,\n getDocumentSummary,\n buildSelectionContext as buildSelectionContextFromContext,\n type AgentContextOptions,\n type SelectionContextOptions as ContextSelectionOptions,\n} from './agent/context';\n\nexport {\n buildSelectionContext,\n buildExtendedSelectionContext,\n getSelectionFormattingSummary,\n type SelectionContextOptions,\n type ExtendedSelectionContext,\n type FormattingSummary,\n} from './agent/selectionContext';\n\n// ============================================================================\n// TEXT UTILITIES\n// ============================================================================\n\nexport {\n getParagraphText,\n getRunText,\n getHyperlinkText,\n getTableText,\n getBodyText,\n countWords,\n countCharacters,\n getBodyWordCount,\n getBodyCharacterCount,\n getTextBefore,\n getTextAfter,\n getFormattingAtPosition,\n isPositionInHyperlink,\n getHyperlinkAtPosition,\n isHeadingStyle,\n parseHeadingLevel,\n hasImages,\n hasHyperlinks,\n hasTables,\n getParagraphs,\n getParagraphAtIndex,\n getBlockIndexForParagraph,\n} from './agent/text-utils';\n\n// ============================================================================\n// PARSER / SERIALIZER\n// ============================================================================\n\nexport { parseDocx } from './docx/parser';\nexport {\n serializeDocument as serializeDocx,\n serializeDocumentBody,\n serializeSectionProperties,\n} from './docx/serializer/documentSerializer';\nexport { repackDocx, createDocx } from './docx/rezip';\n\n// ============================================================================\n// TEMPLATE PROCESSING\n// ============================================================================\n\nexport {\n processTemplate,\n processTemplateDetailed,\n processTemplateAsBlob,\n processTemplateAdvanced,\n getTemplateTags,\n validateTemplate,\n getMissingVariables,\n previewTemplate,\n createTemplateProcessor,\n type ProcessTemplateOptions,\n type ProcessTemplateResult,\n type TemplateError,\n} from './utils/processTemplate';\n\n// ============================================================================\n// VARIABLE DETECTION\n// ============================================================================\n\nexport {\n detectVariables,\n detectVariablesDetailed,\n detectVariablesInBody,\n detectVariablesInParagraph,\n extractVariablesFromText,\n hasTemplateVariables,\n isValidVariableName,\n sanitizeVariableName,\n formatVariable,\n parseVariable,\n replaceVariables,\n removeVariables,\n documentHasVariables,\n type VariableDetectionResult,\n type VariableOccurrence,\n} from './utils/variableDetector';\n\n// ============================================================================\n// DOCUMENT CREATION\n// ============================================================================\n\nexport {\n createEmptyDocument,\n createDocumentWithText,\n type CreateEmptyDocumentOptions,\n} from './utils/createDocument';\n\n// ============================================================================\n// UTILITIES\n// ============================================================================\n\nexport {\n twipsToPixels,\n pixelsToTwips,\n formatPx,\n emuToPixels,\n pointsToPixels,\n halfPointsToPixels,\n pixelsToEmu,\n emuToTwips,\n twipsToEmu,\n} from './utils/units';\n\nexport {\n resolveColor,\n resolveHighlightColor,\n resolveShadingColor,\n parseColorString,\n createThemeColor,\n createRgbColor,\n darkenColor,\n lightenColor,\n blendColors,\n getContrastingColor,\n isBlack,\n isWhite,\n colorsEqual,\n} from './utils/colorResolver';\n\n// ============================================================================\n// PLUGIN SYSTEM\n// ============================================================================\n\nexport {\n pluginRegistry,\n PluginRegistry,\n registerPlugins,\n createPluginRegistrar,\n isZodSchema,\n type CorePlugin,\n type Plugin,\n type PluginCommand,\n type CommandHandler,\n type PluginCommandHandler,\n type CommandResult,\n type PluginOptions,\n type PluginRegistrationResult,\n type McpToolDefinition,\n type ToolDefinition,\n type McpToolHandler,\n type ToolHandler,\n type McpToolResult,\n type ToolResult,\n type McpToolContent,\n type McpToolContext,\n type McpToolAnnotations,\n type McpSession,\n type LoadedDocument,\n type JsonSchema,\n type ZodSchemaLike,\n type PluginEvent,\n type PluginEventListener,\n} from './core-plugins';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\n// Document types\nexport type {\n Document,\n DocxPackage,\n DocumentBody,\n BlockContent,\n Paragraph,\n Run,\n RunContent,\n TextContent,\n Table,\n TableRow,\n TableCell,\n Image,\n Hyperlink,\n Theme,\n Style,\n StyleDefinitions,\n TextFormatting,\n ParagraphFormatting,\n SectionProperties,\n Footnote,\n Endnote,\n ListLevel,\n NumberingDefinitions,\n Relationship,\n} from './types/document';\n\n// Agent API types\nexport type {\n AIAction,\n AIActionRequest,\n AgentResponse,\n AgentContext,\n SelectionContext,\n Range,\n Position,\n ParagraphContext,\n ParagraphOutline,\n SectionInfo,\n StyleInfo,\n SuggestedAction,\n AgentCommand,\n InsertTextCommand,\n ReplaceTextCommand,\n DeleteTextCommand,\n FormatTextCommand,\n FormatParagraphCommand,\n InsertTableCommand,\n InsertImageCommand,\n InsertHyperlinkCommand,\n SetVariableCommand,\n ApplyStyleCommand,\n ApplyVariablesCommand,\n} from './types/agentApi';\n\n// API functions\nexport {\n createCollapsedRange,\n createRange,\n isPositionInRange,\n comparePositions,\n getActionLabel,\n getActionDescription,\n createCommand,\n DEFAULT_AI_ACTIONS,\n} from './types/agentApi';\n"]}
@@ -1,10 +1,10 @@
1
- export { D as DocumentAgent, F as FormattedTextSegment, I as InsertHyperlinkOptions, b as InsertImageOptions, c as InsertTableOptions, d as InsertTextOptions, e as createAgent, f as createAgentFromDocument } from './DocumentAgent-DEGFgYEN.cjs';
2
- export { A as AgentContextOptions, T as ContextSelectionOptions, C as CreateEmptyDocumentOptions, E as ExtendedSelectionContext, U as FormattingSummary, P as ProcessTemplateOptions, a as ProcessTemplateResult, S as SelectionContextOptions, V as TemplateError, b as blendColors, c as buildExtendedSelectionContext, d as buildSelectionContext, W as buildSelectionContextFromContext, e as colorsEqual, f as createDocumentWithText, g as createEmptyDocument, h as createRgbColor, X as createTemplateProcessor, i as createThemeColor, j as darkenColor, k as emuToPixels, l as emuToTwips, m as executeCommand, n as executeCommands, o as formatPx, p as getAgentContext, q as getContrastingColor, r as getDocumentSummary, Y as getMissingVariables, Z as getSelectionFormattingSummary, s as getTemplateTags, t as halfPointsToPixels, u as isBlack, v as isWhite, w as lightenColor, x as parseColorString, y as parseDocx, z as pixelsToEmu, B as pixelsToTwips, D as pointsToPixels, _ as previewTemplate, F as processTemplate, $ as processTemplateAdvanced, G as processTemplateAsBlob, H as processTemplateDetailed, I as resolveColor, J as resolveHighlightColor, K as resolveShadingColor, L as serializeDocumentBody, M as serializeDocx, N as serializeSectionProperties, O as twipsToEmu, Q as twipsToPixels, R as validateTemplate } from './colorResolver-CIDiSPWd.cjs';
3
- import { i as DocumentBody, P as Paragraph, X as TextFormatting, o as Hyperlink, y as Run, T as Table, v as Position } from './agentApi-CbVUCZRu.cjs';
4
- export { A as AIAction, a as AIActionRequest, b as AgentCommand, c as AgentContext, d as AgentResponse, e as ApplyStyleCommand, a0 as ApplyVariablesCommand, B as BlockContent, a1 as DEFAULT_AI_ACTIONS, D as DeleteTextCommand, h as Document, j as DocxPackage, E as Endnote, l as Footnote, a2 as FormatParagraphCommand, m as FormatTextCommand, I as Image, p as InsertHyperlinkCommand, q as InsertImageCommand, r as InsertTableCommand, s as InsertTextCommand, L as ListLevel, N as NumberingDefinitions, t as ParagraphContext, u as ParagraphFormatting, a3 as ParagraphOutline, R as Range, w as Relationship, x as ReplaceTextCommand, z as RunContent, a4 as SectionInfo, S as SectionProperties, C as SelectionContext, G as SetVariableCommand, K as Style, M as StyleDefinitions, a5 as StyleInfo, O as SuggestedAction, Q as TableCell, U as TableRow, W as TextContent, Y as Theme, a6 as comparePositions, a7 as createCollapsedRange, a8 as createCommand, a9 as createRange, aa as getActionDescription, ab as getActionLabel, ac as isPositionInRange } from './agentApi-CbVUCZRu.cjs';
5
- export { V as VariableDetectionResult, a as VariableOccurrence, c as createDocx, d as detectVariables, b as detectVariablesDetailed, e as detectVariablesInBody, f as detectVariablesInParagraph, g as documentHasVariables, h as extractVariablesFromText, i as formatVariable, j as hasTemplateVariables, k as isValidVariableName, p as parseVariable, r as removeVariables, l as repackDocx, m as replaceVariables, s as sanitizeVariableName } from './variableDetector-CPxKo9jP.cjs';
6
- export { e as CommandHandler, g as CommandResult, C as CorePlugin, J as JsonSchema, L as LoadedDocument, M as McpSession, h as McpToolAnnotations, i as McpToolContent, j as McpToolContext, a as McpToolDefinition, b as McpToolHandler, c as McpToolResult, C as Plugin, k as PluginCommand, e as PluginCommandHandler, l as PluginEvent, f as PluginEventListener, P as PluginOptions, d as PluginRegistrationResult, a as ToolDefinition, b as ToolHandler, c as ToolResult, Z as ZodSchemaLike, m as isZodSchema } from './types-D96elyJF.cjs';
7
- export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-ngv6Bumt.cjs';
1
+ import { d as DocumentBody, a as Paragraph, T as TextFormatting, H as Hyperlink, b as Run, e as Table, P as Position } from './agentApi-BFVyKagE.cjs';
2
+ export { f as AIAction, g as AIActionRequest, A as AgentCommand, h as AgentContext, i as AgentResponse, j as ApplyStyleCommand, k as ApplyVariablesCommand, l as BlockContent, m as DEFAULT_AI_ACTIONS, n as DeleteTextCommand, D as Document, o as DocxPackage, E as Endnote, F as Footnote, p as FormatParagraphCommand, q as FormatTextCommand, I as Image, r as InsertHyperlinkCommand, s as InsertImageCommand, t as InsertTableCommand, u as InsertTextCommand, L as ListLevel, N as NumberingDefinitions, v as ParagraphContext, w as ParagraphFormatting, x as ParagraphOutline, R as Range, y as Relationship, z as ReplaceTextCommand, c as RunContent, S as SectionInfo, C as SectionProperties, G as SelectionContext, J as SetVariableCommand, K as Style, M as StyleDefinitions, O as StyleInfo, Q as SuggestedAction, U as TableCell, V as TableRow, W as TextContent, X as Theme, Y as comparePositions, Z as createCollapsedRange, _ as createCommand, $ as createRange, a0 as getActionDescription, a1 as getActionLabel, a2 as isPositionInRange } from './agentApi-BFVyKagE.cjs';
3
+ export { A as AgentContextOptions, S as ContextSelectionOptions, C as CreateEmptyDocumentOptions, E as ExtendedSelectionContext, F as FormattingSummary, P as ProcessTemplateOptions, a as ProcessTemplateResult, b as SelectionContextOptions, T as TemplateError, c as blendColors, d as buildExtendedSelectionContext, e as buildSelectionContext, f as buildSelectionContextFromContext, g as colorsEqual, h as createDocumentWithText, i as createEmptyDocument, j as createRgbColor, k as createTemplateProcessor, l as createThemeColor, m as darkenColor, n as emuToPixels, o as emuToTwips, p as executeCommand, q as executeCommands, r as formatPx, s as getAgentContext, t as getContrastingColor, u as getDocumentSummary, v as getMissingVariables, w as getSelectionFormattingSummary, x as getTemplateTags, y as halfPointsToPixels, z as isBlack, B as isWhite, D as lightenColor, G as parseColorString, H as parseDocx, I as pixelsToEmu, J as pixelsToTwips, K as pointsToPixels, L as previewTemplate, M as processTemplate, N as processTemplateAdvanced, O as processTemplateAsBlob, Q as processTemplateDetailed, R as resolveColor, U as resolveHighlightColor, V as resolveShadingColor, W as serializeDocumentBody, X as serializeDocx, Y as serializeSectionProperties, Z as twipsToEmu, _ as twipsToPixels, $ as validateTemplate } from './colorResolver-Cu46bSKr.cjs';
4
+ export { b as CommandHandler, d as CommandResult, C as CorePlugin, J as JsonSchema, L as LoadedDocument, e as McpSession, f as McpToolAnnotations, g as McpToolContent, h as McpToolContext, M as McpToolDefinition, i as McpToolHandler, j as McpToolResult, C as Plugin, k as PluginCommand, b as PluginCommandHandler, l as PluginEvent, c as PluginEventListener, P as PluginOptions, a as PluginRegistrationResult, M as ToolDefinition, i as ToolHandler, j as ToolResult, Z as ZodSchemaLike, m as isZodSchema } from './types-Bnp8rvJn.cjs';
5
+ export { D as DocumentAgent, F as FormattedTextSegment, I as InsertHyperlinkOptions, a as InsertImageOptions, b as InsertTableOptions, c as InsertTextOptions, d as createAgent, e as createAgentFromDocument } from './DocumentAgent-B0EC8lPC.cjs';
6
+ export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-DjacfR6Q.cjs';
7
+ export { V as VariableDetectionResult, a as VariableOccurrence, c as createDocx, d as detectVariables, b as detectVariablesDetailed, e as detectVariablesInBody, f as detectVariablesInParagraph, g as documentHasVariables, h as extractVariablesFromText, i as formatVariable, j as hasTemplateVariables, k as isValidVariableName, p as parseVariable, r as removeVariables, l as repackDocx, m as replaceVariables, s as sanitizeVariableName } from './variableDetector-CMhJtM96.cjs';
8
8
 
9
9
  /**
10
10
  * Shared Text Utilities for Agent Module
@@ -1,10 +1,10 @@
1
- export { D as DocumentAgent, F as FormattedTextSegment, I as InsertHyperlinkOptions, b as InsertImageOptions, c as InsertTableOptions, d as InsertTextOptions, e as createAgent, f as createAgentFromDocument } from './DocumentAgent-Ci6_T-XM.js';
2
- export { A as AgentContextOptions, T as ContextSelectionOptions, C as CreateEmptyDocumentOptions, E as ExtendedSelectionContext, U as FormattingSummary, P as ProcessTemplateOptions, a as ProcessTemplateResult, S as SelectionContextOptions, V as TemplateError, b as blendColors, c as buildExtendedSelectionContext, d as buildSelectionContext, W as buildSelectionContextFromContext, e as colorsEqual, f as createDocumentWithText, g as createEmptyDocument, h as createRgbColor, X as createTemplateProcessor, i as createThemeColor, j as darkenColor, k as emuToPixels, l as emuToTwips, m as executeCommand, n as executeCommands, o as formatPx, p as getAgentContext, q as getContrastingColor, r as getDocumentSummary, Y as getMissingVariables, Z as getSelectionFormattingSummary, s as getTemplateTags, t as halfPointsToPixels, u as isBlack, v as isWhite, w as lightenColor, x as parseColorString, y as parseDocx, z as pixelsToEmu, B as pixelsToTwips, D as pointsToPixels, _ as previewTemplate, F as processTemplate, $ as processTemplateAdvanced, G as processTemplateAsBlob, H as processTemplateDetailed, I as resolveColor, J as resolveHighlightColor, K as resolveShadingColor, L as serializeDocumentBody, M as serializeDocx, N as serializeSectionProperties, O as twipsToEmu, Q as twipsToPixels, R as validateTemplate } from './colorResolver-KXbUgzWC.js';
3
- import { i as DocumentBody, P as Paragraph, X as TextFormatting, o as Hyperlink, y as Run, T as Table, v as Position } from './agentApi-CbVUCZRu.js';
4
- export { A as AIAction, a as AIActionRequest, b as AgentCommand, c as AgentContext, d as AgentResponse, e as ApplyStyleCommand, a0 as ApplyVariablesCommand, B as BlockContent, a1 as DEFAULT_AI_ACTIONS, D as DeleteTextCommand, h as Document, j as DocxPackage, E as Endnote, l as Footnote, a2 as FormatParagraphCommand, m as FormatTextCommand, I as Image, p as InsertHyperlinkCommand, q as InsertImageCommand, r as InsertTableCommand, s as InsertTextCommand, L as ListLevel, N as NumberingDefinitions, t as ParagraphContext, u as ParagraphFormatting, a3 as ParagraphOutline, R as Range, w as Relationship, x as ReplaceTextCommand, z as RunContent, a4 as SectionInfo, S as SectionProperties, C as SelectionContext, G as SetVariableCommand, K as Style, M as StyleDefinitions, a5 as StyleInfo, O as SuggestedAction, Q as TableCell, U as TableRow, W as TextContent, Y as Theme, a6 as comparePositions, a7 as createCollapsedRange, a8 as createCommand, a9 as createRange, aa as getActionDescription, ab as getActionLabel, ac as isPositionInRange } from './agentApi-CbVUCZRu.js';
5
- export { V as VariableDetectionResult, a as VariableOccurrence, c as createDocx, d as detectVariables, b as detectVariablesDetailed, e as detectVariablesInBody, f as detectVariablesInParagraph, g as documentHasVariables, h as extractVariablesFromText, i as formatVariable, j as hasTemplateVariables, k as isValidVariableName, p as parseVariable, r as removeVariables, l as repackDocx, m as replaceVariables, s as sanitizeVariableName } from './variableDetector-DeM1N-_L.js';
6
- export { e as CommandHandler, g as CommandResult, C as CorePlugin, J as JsonSchema, L as LoadedDocument, M as McpSession, h as McpToolAnnotations, i as McpToolContent, j as McpToolContext, a as McpToolDefinition, b as McpToolHandler, c as McpToolResult, C as Plugin, k as PluginCommand, e as PluginCommandHandler, l as PluginEvent, f as PluginEventListener, P as PluginOptions, d as PluginRegistrationResult, a as ToolDefinition, b as ToolHandler, c as ToolResult, Z as ZodSchemaLike, m as isZodSchema } from './types-xMzSPT4i.js';
7
- export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-D4tvj9f3.js';
1
+ import { d as DocumentBody, a as Paragraph, T as TextFormatting, H as Hyperlink, b as Run, e as Table, P as Position } from './agentApi-BFVyKagE.js';
2
+ export { f as AIAction, g as AIActionRequest, A as AgentCommand, h as AgentContext, i as AgentResponse, j as ApplyStyleCommand, k as ApplyVariablesCommand, l as BlockContent, m as DEFAULT_AI_ACTIONS, n as DeleteTextCommand, D as Document, o as DocxPackage, E as Endnote, F as Footnote, p as FormatParagraphCommand, q as FormatTextCommand, I as Image, r as InsertHyperlinkCommand, s as InsertImageCommand, t as InsertTableCommand, u as InsertTextCommand, L as ListLevel, N as NumberingDefinitions, v as ParagraphContext, w as ParagraphFormatting, x as ParagraphOutline, R as Range, y as Relationship, z as ReplaceTextCommand, c as RunContent, S as SectionInfo, C as SectionProperties, G as SelectionContext, J as SetVariableCommand, K as Style, M as StyleDefinitions, O as StyleInfo, Q as SuggestedAction, U as TableCell, V as TableRow, W as TextContent, X as Theme, Y as comparePositions, Z as createCollapsedRange, _ as createCommand, $ as createRange, a0 as getActionDescription, a1 as getActionLabel, a2 as isPositionInRange } from './agentApi-BFVyKagE.js';
3
+ export { A as AgentContextOptions, S as ContextSelectionOptions, C as CreateEmptyDocumentOptions, E as ExtendedSelectionContext, F as FormattingSummary, P as ProcessTemplateOptions, a as ProcessTemplateResult, b as SelectionContextOptions, T as TemplateError, c as blendColors, d as buildExtendedSelectionContext, e as buildSelectionContext, f as buildSelectionContextFromContext, g as colorsEqual, h as createDocumentWithText, i as createEmptyDocument, j as createRgbColor, k as createTemplateProcessor, l as createThemeColor, m as darkenColor, n as emuToPixels, o as emuToTwips, p as executeCommand, q as executeCommands, r as formatPx, s as getAgentContext, t as getContrastingColor, u as getDocumentSummary, v as getMissingVariables, w as getSelectionFormattingSummary, x as getTemplateTags, y as halfPointsToPixels, z as isBlack, B as isWhite, D as lightenColor, G as parseColorString, H as parseDocx, I as pixelsToEmu, J as pixelsToTwips, K as pointsToPixels, L as previewTemplate, M as processTemplate, N as processTemplateAdvanced, O as processTemplateAsBlob, Q as processTemplateDetailed, R as resolveColor, U as resolveHighlightColor, V as resolveShadingColor, W as serializeDocumentBody, X as serializeDocx, Y as serializeSectionProperties, Z as twipsToEmu, _ as twipsToPixels, $ as validateTemplate } from './colorResolver-B5YbO_a4.js';
4
+ export { b as CommandHandler, d as CommandResult, C as CorePlugin, J as JsonSchema, L as LoadedDocument, e as McpSession, f as McpToolAnnotations, g as McpToolContent, h as McpToolContext, M as McpToolDefinition, i as McpToolHandler, j as McpToolResult, C as Plugin, k as PluginCommand, b as PluginCommandHandler, l as PluginEvent, c as PluginEventListener, P as PluginOptions, a as PluginRegistrationResult, M as ToolDefinition, i as ToolHandler, j as ToolResult, Z as ZodSchemaLike, m as isZodSchema } from './types-DwZ3xysp.js';
5
+ export { D as DocumentAgent, F as FormattedTextSegment, I as InsertHyperlinkOptions, a as InsertImageOptions, b as InsertTableOptions, c as InsertTextOptions, d as createAgent, e as createAgentFromDocument } from './DocumentAgent-BcCDg7i2.js';
6
+ export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-CV6nYWqP.js';
7
+ export { V as VariableDetectionResult, a as VariableOccurrence, c as createDocx, d as detectVariables, b as detectVariablesDetailed, e as detectVariablesInBody, f as detectVariablesInParagraph, g as documentHasVariables, h as extractVariablesFromText, i as formatVariable, j as hasTemplateVariables, k as isValidVariableName, p as parseVariable, r as removeVariables, l as repackDocx, m as replaceVariables, s as sanitizeVariableName } from './variableDetector-BaDeXz7D.js';
8
8
 
9
9
  /**
10
10
  * Shared Text Utilities for Agent Module
@@ -1,4 +1,5 @@
1
- export{e as buildExtendedSelectionContext,d as buildSelectionContext,b as buildSelectionContextFromContext,h as createDocumentWithText,g as createEmptyDocument,a as getAgentContext,c as getDocumentSummary,f as getSelectionFormattingSummary}from'./chunk-TOI5W3HK.js';export{a as DocumentAgent,b as createAgent,c as createAgentFromDocument}from'./chunk-ULNHBTYA.js';export{g as DEFAULT_AI_ACTIONS,d as comparePositions,a as createCollapsedRange,h as createCommand,b as createRange,f as getActionDescription,e as getActionLabel,c as isPositionInRange}from'./chunk-EMKABJPH.js';export{l as blendColors,m as colorsEqual,i as createRgbColor,h as createThemeColor,j as darkenColor,p as emuToPixels,r as emuToTwips,x as formatPx,f as getContrastingColor,u as halfPointsToPixels,d as isBlack,e as isWhite,k as lightenColor,g as parseColorString,q as pixelsToEmu,o as pixelsToTwips,t as pointsToPixels,a as resolveColor,b as resolveHighlightColor,c as resolveShadingColor,s as twipsToEmu,n as twipsToPixels}from'./chunk-ZDYHAYN6.js';export{a as isZodSchema}from'./chunk-UXXV4GT6.js';export{j as createTemplateProcessor,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-ESI4BSBF.js';export{a as detectVariables,b as detectVariablesDetailed,c as detectVariablesInBody,d as detectVariablesInParagraph,m as documentHasVariables,e as extractVariablesFromText,i as formatVariable,f as hasTemplateVariables,g as isValidVariableName,j as parseVariable,l as removeVariables,k as replaceVariables,h as sanitizeVariableName}from'./chunk-2ASOEN3V.js';export{e as createDocx,d as repackDocx,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties}from'./chunk-YMXKVLTU.js';export{a as executeCommand,b as executeCommands}from'./chunk-WFWLPKQA.js';export{p as parseDocx}from'./chunk-JKN7TNPA.js';export{a as PluginRegistry,d as createPluginRegistrar,b as pluginRegistry,c as registerPlugins}from'./chunk-R5SKERM2.js';import'./chunk-OWMXCVKB.js';function p(n){let e=[];for(let t of n.content)t.type==="run"?e.push(c(t)):t.type==="hyperlink"&&e.push(g(t));return e.join("")}function c(n){return n.content.filter(e=>e.type==="text").map(e=>e.text).join("")}function g(n){let e=[];for(let t of n.children)t.type==="run"&&e.push(c(t));return e.join("")}function m(n){let e=[];for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&e.push(p(r));return e.join(" ")}function Me(n){let e=[];for(let t of n.content)t.type==="paragraph"?e.push(p(t)):t.type==="table"&&e.push(m(t));return e.join(`
1
+ export{g as DEFAULT_AI_ACTIONS,d as comparePositions,a as createCollapsedRange,h as createCommand,b as createRange,f as getActionDescription,e as getActionLabel,c as isPositionInRange}from'./chunk-7JSPKVOW.js';export{c as DocumentAgent,j as buildExtendedSelectionContext,i as buildSelectionContext,g as buildSelectionContextFromContext,d as createAgent,e as createAgentFromDocument,b as createDocumentWithText,a as createEmptyDocument,f as getAgentContext,h as getDocumentSummary,k as getSelectionFormattingSummary}from'./chunk-6LF5HZCV.js';export{l as blendColors,m as colorsEqual,i as createRgbColor,h as createThemeColor,j as darkenColor,p as emuToPixels,r as emuToTwips,x as formatPx,f as getContrastingColor,u as halfPointsToPixels,d as isBlack,e as isWhite,k as lightenColor,g as parseColorString,q as pixelsToEmu,o as pixelsToTwips,t as pointsToPixels,a as resolveColor,b as resolveHighlightColor,c as resolveShadingColor,s as twipsToEmu,n as twipsToPixels}from'./chunk-L54YNLSE.js';export{a as detectVariables,b as detectVariablesDetailed,c as detectVariablesInBody,d as detectVariablesInParagraph,m as documentHasVariables,e as extractVariablesFromText,i as formatVariable,f as hasTemplateVariables,g as isValidVariableName,n as isZodSchema,j as parseVariable,l as removeVariables,k as replaceVariables,h as sanitizeVariableName}from'./chunk-OHG7ROFC.js';export{e as createDocx,d as repackDocx,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties}from'./chunk-ULXNEG66.js';export{a as executeCommand,b as executeCommands}from'./chunk-JOYPFQW2.js';export{q as parseDocx}from'./chunk-DP6Q75ZD.js';export{a as PluginRegistry,d as createPluginRegistrar,b as pluginRegistry,c as registerPlugins}from'./chunk-2QOEHCBX.js';export{j as createTemplateProcessor,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-CV5WFE7K.js';import'./chunk-Y6VCTLCJ.js';function p(n){let e=[];for(let t of n.content)t.type==="run"?e.push(c(t)):t.type==="hyperlink"&&e.push(g(t));return e.join("")}function c(n){return n.content.filter(e=>e.type==="text").map(e=>e.text).join("")}function g(n){let e=[];for(let t of n.children)t.type==="run"&&e.push(c(t));return e.join("")}function m(n){let e=[];for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&e.push(p(r));return e.join(" ")}function Me(n){let e=[];for(let t of n.content)t.type==="paragraph"?e.push(p(t)):t.type==="table"&&e.push(m(t));return e.join(`
2
2
  `)}function f(n){return n.split(/\s+/).filter(t=>t.length>0).length}function je(n,e=true){return e?n.length:n.replace(/\s/g,"").length}function We(n){let e=0;for(let t of n.content)t.type==="paragraph"?e+=f(p(t)):t.type==="table"&&(e+=ze(t));return e}function ze(n){let e=0;for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&(e+=f(p(r)));return e}function Ne(n){let e=0;for(let t of n.content)t.type==="paragraph"?e+=p(t).length:t.type==="table"&&(e+=qe(t));return e}function qe(n){let e=0;for(let t of n.rows)for(let o of t.cells)for(let r of o.content)r.type==="paragraph"&&(e+=p(r).length);return e}function Ze(n,e,t){let o=[],r=0,i=n[e.paragraphIndex];if(i){let s=p(i).slice(0,e.offset);o.unshift(s),r+=s.length;}for(let l=e.paragraphIndex-1;l>=0&&r<t;l--){let s=n[l];if(!s)continue;let u=p(s);o.unshift(u),r+=u.length;}let a=o.join(`
3
3
  `);return a.length>t?"..."+a.slice(-t):a}function _e(n,e,t){let o=[],r=0,i=n[e.paragraphIndex];if(i){let s=p(i).slice(e.offset);o.push(s),r+=s.length;}for(let l=e.paragraphIndex+1;l<n.length&&r<t;l++){let s=n[l];if(!s)continue;let u=p(s);o.push(u),r+=u.length;}let a=o.join(`
4
- `);return a.length>t?a.slice(0,t)+"...":a}function Je(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o),i=t+r.length;if(e>=t&&e<i)return o.formatting||{};t=i;}else if(o.type==="hyperlink"){let r=g(o),i=t+r.length;if(e>=t&&e<i){for(let a of o.children)if(a.type==="run")return a.formatting||{}}t=i;}return {}}function Ue(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return true;t=a;}return false}function Ge(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return o;t=a;}}function Ke(n){return n?n.toLowerCase().includes("heading"):false}function Qe(n){if(!n)return;let e=n.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}function Xe(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="run"){for(let o of t.content)if(o.type==="drawing")return true}}return false}function Ye(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="hyperlink")return true}return false}function $e(n){return n.content.some(e=>e.type==="table")}function x(n){return n.content.filter(e=>e.type==="paragraph")}function et(n,e){return x(n)[e]}function tt(n,e){let t=0;for(let o=0;o<n.content.length;o++)if(n.content[o].type==="paragraph"){if(t===e)return o;t++;}return -1}var ot="0.0.2";export{ot as VERSION,je as countCharacters,f as countWords,tt as getBlockIndexForParagraph,Ne as getBodyCharacterCount,Me as getBodyText,We as getBodyWordCount,Je as getFormattingAtPosition,Ge as getHyperlinkAtPosition,g as getHyperlinkText,et as getParagraphAtIndex,p as getParagraphText,x as getParagraphs,c as getRunText,m as getTableText,_e as getTextAfter,Ze as getTextBefore,Ye as hasHyperlinks,Xe as hasImages,$e as hasTables,Ke as isHeadingStyle,Ue as isPositionInHyperlink,Qe as parseHeadingLevel};
4
+ `);return a.length>t?a.slice(0,t)+"...":a}function Je(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o),i=t+r.length;if(e>=t&&e<i)return o.formatting||{};t=i;}else if(o.type==="hyperlink"){let r=g(o),i=t+r.length;if(e>=t&&e<i){for(let a of o.children)if(a.type==="run")return a.formatting||{}}t=i;}return {}}function Ue(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return true;t=a;}return false}function Ge(n,e){let t=0;for(let o of n.content)if(o.type==="run"){let r=c(o);t+=r.length;}else if(o.type==="hyperlink"){let r=g(o),i=t,a=t+r.length;if(e>=i&&e<a)return o;t=a;}}function Ke(n){return n?n.toLowerCase().includes("heading"):false}function Qe(n){if(!n)return;let e=n.match(/heading\s*(\d)/i);if(e)return parseInt(e[1],10)}function Xe(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="run"){for(let o of t.content)if(o.type==="drawing")return true}}return false}function Ye(n){for(let e of n.content)if(e.type==="paragraph"){for(let t of e.content)if(t.type==="hyperlink")return true}return false}function $e(n){return n.content.some(e=>e.type==="table")}function x(n){return n.content.filter(e=>e.type==="paragraph")}function et(n,e){return x(n)[e]}function tt(n,e){let t=0;for(let o=0;o<n.content.length;o++)if(n.content[o].type==="paragraph"){if(t===e)return o;t++;}return -1}var ot="0.0.2";export{ot as VERSION,je as countCharacters,f as countWords,tt as getBlockIndexForParagraph,Ne as getBodyCharacterCount,Me as getBodyText,We as getBodyWordCount,Je as getFormattingAtPosition,Ge as getHyperlinkAtPosition,g as getHyperlinkText,et as getParagraphAtIndex,p as getParagraphText,x as getParagraphs,c as getRunText,m as getTableText,_e as getTextAfter,Ze as getTextBefore,Ye as hasHyperlinks,Xe as hasImages,$e as hasTables,Ke as isHeadingStyle,Ue as isPositionInHyperlink,Qe as parseHeadingLevel};//# sourceMappingURL=headless-reexport.js.map
5
+ //# sourceMappingURL=headless-reexport.js.map