@beyondwork/docx-react-component 1.0.28 → 1.0.29

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 (354) hide show
  1. package/dist/canonical-document-BLEbzL2J.d.cts +844 -0
  2. package/dist/canonical-document-BLEbzL2J.d.ts +844 -0
  3. package/dist/chunk-2FJS5GZM.js +763 -0
  4. package/dist/chunk-2FJS5GZM.js.map +1 -0
  5. package/{src/core/commands/section-layout-commands.ts → dist/chunk-2OQBZS3F.js} +106 -340
  6. package/dist/chunk-2OQBZS3F.js.map +1 -0
  7. package/dist/chunk-2S7W4KFO.js +127 -0
  8. package/dist/chunk-2S7W4KFO.js.map +1 -0
  9. package/dist/chunk-2TG72QSW.js +3874 -0
  10. package/dist/chunk-2TG72QSW.js.map +1 -0
  11. package/{src/core/commands/table-structure-commands.ts → dist/chunk-36QNIZBO.js} +126 -315
  12. package/dist/chunk-36QNIZBO.js.map +1 -0
  13. package/dist/chunk-4AQOYAW4.js +3069 -0
  14. package/dist/chunk-4AQOYAW4.js.map +1 -0
  15. package/dist/chunk-4D5EWJ3P.js +77 -0
  16. package/dist/chunk-4D5EWJ3P.js.map +1 -0
  17. package/dist/chunk-5FN54NDH.js +2257 -0
  18. package/dist/chunk-5FN54NDH.js.map +1 -0
  19. package/dist/chunk-BOYGQYRQ.js +7306 -0
  20. package/dist/chunk-BOYGQYRQ.js.map +1 -0
  21. package/dist/chunk-CN3XMECL.js +212 -0
  22. package/dist/chunk-CN3XMECL.js.map +1 -0
  23. package/dist/chunk-EBI3BX6U.js +164 -0
  24. package/dist/chunk-EBI3BX6U.js.map +1 -0
  25. package/dist/chunk-EILUG3VB.js +1275 -0
  26. package/dist/chunk-EILUG3VB.js.map +1 -0
  27. package/dist/chunk-FUDY333O.js +70 -0
  28. package/dist/chunk-FUDY333O.js.map +1 -0
  29. package/dist/chunk-GBVOWFIK.js +1237 -0
  30. package/dist/chunk-GBVOWFIK.js.map +1 -0
  31. package/dist/chunk-H4TQ3H3Y.js +262 -0
  32. package/dist/chunk-H4TQ3H3Y.js.map +1 -0
  33. package/{src/core/commands/style-commands.ts → dist/chunk-JGB3IXZO.js} +40 -113
  34. package/dist/chunk-JGB3IXZO.js.map +1 -0
  35. package/dist/chunk-KD2QRQPY.js +4342 -0
  36. package/dist/chunk-KD2QRQPY.js.map +1 -0
  37. package/dist/chunk-KLMXQVYK.js +369 -0
  38. package/dist/chunk-KLMXQVYK.js.map +1 -0
  39. package/dist/chunk-KZUG5KFQ.js +214 -0
  40. package/dist/chunk-KZUG5KFQ.js.map +1 -0
  41. package/{src/core/state/text-transaction.ts → dist/chunk-QDAQ4CJU.js} +79 -236
  42. package/dist/chunk-QDAQ4CJU.js.map +1 -0
  43. package/{src/legal/bookmarks.ts → dist/chunk-RMH72RZI.js} +44 -130
  44. package/dist/chunk-RMH72RZI.js.map +1 -0
  45. package/dist/chunk-SWKWQZXM.js +117 -0
  46. package/dist/chunk-SWKWQZXM.js.map +1 -0
  47. package/{src/core/commands/formatting-commands.ts → dist/chunk-TJBP2K4T.js} +196 -536
  48. package/dist/chunk-TJBP2K4T.js.map +1 -0
  49. package/dist/chunk-TLCEAQDQ.js +542 -0
  50. package/dist/chunk-TLCEAQDQ.js.map +1 -0
  51. package/{src/core/commands/text-commands.ts → dist/chunk-UZXBISGO.js} +86 -142
  52. package/dist/chunk-UZXBISGO.js.map +1 -0
  53. package/dist/chunk-WGBAKP3Q.js +3220 -0
  54. package/dist/chunk-WGBAKP3Q.js.map +1 -0
  55. package/dist/compare/index.cjs +5475 -0
  56. package/dist/compare/index.cjs.map +1 -0
  57. package/dist/compare/index.d.cts +114 -0
  58. package/dist/compare/index.d.ts +114 -0
  59. package/dist/compare/index.js +731 -0
  60. package/dist/compare/index.js.map +1 -0
  61. package/dist/core/commands/formatting-commands.cjs +828 -0
  62. package/dist/core/commands/formatting-commands.cjs.map +1 -0
  63. package/dist/core/commands/formatting-commands.d.cts +63 -0
  64. package/dist/core/commands/formatting-commands.d.ts +63 -0
  65. package/dist/core/commands/formatting-commands.js +37 -0
  66. package/dist/core/commands/formatting-commands.js.map +1 -0
  67. package/dist/core/commands/image-commands.cjs +2023 -0
  68. package/dist/core/commands/image-commands.cjs.map +1 -0
  69. package/dist/core/commands/image-commands.d.cts +58 -0
  70. package/dist/core/commands/image-commands.d.ts +58 -0
  71. package/dist/core/commands/image-commands.js +18 -0
  72. package/dist/core/commands/image-commands.js.map +1 -0
  73. package/dist/core/commands/section-layout-commands.cjs +477 -0
  74. package/dist/core/commands/section-layout-commands.cjs.map +1 -0
  75. package/dist/core/commands/section-layout-commands.d.cts +62 -0
  76. package/dist/core/commands/section-layout-commands.d.ts +62 -0
  77. package/dist/core/commands/section-layout-commands.js +21 -0
  78. package/dist/core/commands/section-layout-commands.js.map +1 -0
  79. package/dist/core/commands/style-commands.cjs +214 -0
  80. package/dist/core/commands/style-commands.cjs.map +1 -0
  81. package/dist/core/commands/style-commands.d.cts +13 -0
  82. package/dist/core/commands/style-commands.d.ts +13 -0
  83. package/dist/core/commands/style-commands.js +9 -0
  84. package/dist/core/commands/style-commands.js.map +1 -0
  85. package/dist/core/commands/table-structure-commands.cjs +1883 -0
  86. package/dist/core/commands/table-structure-commands.cjs.map +1 -0
  87. package/dist/core/commands/table-structure-commands.d.cts +59 -0
  88. package/dist/core/commands/table-structure-commands.d.ts +59 -0
  89. package/dist/core/commands/table-structure-commands.js +12 -0
  90. package/dist/core/commands/table-structure-commands.js.map +1 -0
  91. package/dist/core/commands/text-commands.cjs +2391 -0
  92. package/dist/core/commands/text-commands.cjs.map +1 -0
  93. package/dist/core/commands/text-commands.d.cts +24 -0
  94. package/dist/core/commands/text-commands.d.ts +24 -0
  95. package/dist/core/commands/text-commands.js +28 -0
  96. package/dist/core/commands/text-commands.js.map +1 -0
  97. package/dist/core/selection/mapping.cjs +200 -0
  98. package/dist/core/selection/mapping.cjs.map +1 -0
  99. package/dist/core/selection/mapping.d.cts +2 -0
  100. package/dist/core/selection/mapping.d.ts +2 -0
  101. package/dist/core/selection/mapping.js +31 -0
  102. package/dist/core/selection/mapping.js.map +1 -0
  103. package/dist/core/state/editor-state.cjs +2278 -0
  104. package/dist/core/state/editor-state.cjs.map +1 -0
  105. package/dist/core/state/editor-state.d.cts +2 -0
  106. package/dist/core/state/editor-state.d.ts +2 -0
  107. package/dist/core/state/editor-state.js +26 -0
  108. package/dist/core/state/editor-state.js.map +1 -0
  109. package/dist/index.cjs +38553 -0
  110. package/dist/index.cjs.map +1 -0
  111. package/dist/index.d.cts +15 -0
  112. package/dist/index.d.ts +15 -0
  113. package/dist/index.js +7856 -0
  114. package/dist/index.js.map +1 -0
  115. package/dist/io/docx-session.cjs +16236 -0
  116. package/dist/io/docx-session.cjs.map +1 -0
  117. package/dist/io/docx-session.d.cts +21 -0
  118. package/dist/io/docx-session.d.ts +21 -0
  119. package/dist/io/docx-session.js +18 -0
  120. package/dist/io/docx-session.js.map +1 -0
  121. package/dist/legal/index.cjs +3900 -0
  122. package/dist/legal/index.cjs.map +1 -0
  123. package/dist/legal/index.d.cts +86 -0
  124. package/dist/legal/index.d.ts +86 -0
  125. package/dist/legal/index.js +616 -0
  126. package/dist/legal/index.js.map +1 -0
  127. package/dist/public-types-7ZL_94cz.d.ts +1573 -0
  128. package/dist/public-types-CeMaDueh.d.cts +1573 -0
  129. package/dist/public-types.cjs +19 -0
  130. package/dist/public-types.cjs.map +1 -0
  131. package/dist/public-types.d.cts +2 -0
  132. package/dist/public-types.d.ts +2 -0
  133. package/dist/public-types.js +1 -0
  134. package/dist/public-types.js.map +1 -0
  135. package/dist/runtime/document-runtime.cjs +11140 -0
  136. package/dist/runtime/document-runtime.cjs.map +1 -0
  137. package/dist/runtime/document-runtime.d.cts +231 -0
  138. package/dist/runtime/document-runtime.d.ts +231 -0
  139. package/dist/runtime/document-runtime.js +21 -0
  140. package/dist/runtime/document-runtime.js.map +1 -0
  141. package/dist/structural-helpers-CilgOVhh.d.cts +10 -0
  142. package/dist/structural-helpers-q0Gd-eBN.d.ts +10 -0
  143. package/dist/ui-tailwind/editor-surface/search-plugin.cjs +313 -0
  144. package/dist/ui-tailwind/editor-surface/search-plugin.cjs.map +1 -0
  145. package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +67 -0
  146. package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +67 -0
  147. package/dist/ui-tailwind/editor-surface/search-plugin.js +23 -0
  148. package/dist/ui-tailwind/editor-surface/search-plugin.js.map +1 -0
  149. package/dist/ui-tailwind/index.cjs +4833 -0
  150. package/dist/ui-tailwind/index.cjs.map +1 -0
  151. package/dist/ui-tailwind/index.d.cts +617 -0
  152. package/dist/ui-tailwind/index.d.ts +617 -0
  153. package/dist/ui-tailwind/index.js +575 -0
  154. package/dist/ui-tailwind/index.js.map +1 -0
  155. package/package.json +61 -41
  156. package/src/README.md +0 -85
  157. package/src/api/README.md +0 -26
  158. package/src/api/public-types.ts +0 -1421
  159. package/src/api/session-state.ts +0 -60
  160. package/src/compare/diff-engine.ts +0 -623
  161. package/src/compare/export-redlines.ts +0 -280
  162. package/src/compare/index.ts +0 -25
  163. package/src/compare/snapshot.ts +0 -97
  164. package/src/component-inventory.md +0 -99
  165. package/src/core/README.md +0 -10
  166. package/src/core/commands/README.md +0 -3
  167. package/src/core/commands/image-commands.ts +0 -373
  168. package/src/core/commands/index.ts +0 -1757
  169. package/src/core/commands/list-commands.ts +0 -565
  170. package/src/core/commands/paragraph-layout-commands.ts +0 -339
  171. package/src/core/commands/review-commands.ts +0 -108
  172. package/src/core/commands/structural-helpers.ts +0 -309
  173. package/src/core/schema/README.md +0 -3
  174. package/src/core/schema/text-schema.ts +0 -516
  175. package/src/core/search/search-text.ts +0 -357
  176. package/src/core/selection/README.md +0 -3
  177. package/src/core/selection/mapping.ts +0 -289
  178. package/src/core/selection/review-anchors.ts +0 -183
  179. package/src/core/state/README.md +0 -3
  180. package/src/core/state/editor-state.ts +0 -892
  181. package/src/formats/xlsx/io/parse-shared-strings.ts +0 -41
  182. package/src/formats/xlsx/io/parse-sheet.ts +0 -459
  183. package/src/formats/xlsx/io/parse-styles.ts +0 -59
  184. package/src/formats/xlsx/io/parse-workbook.ts +0 -75
  185. package/src/formats/xlsx/io/serialize-shared-strings.ts +0 -72
  186. package/src/formats/xlsx/io/serialize-sheet.ts +0 -333
  187. package/src/formats/xlsx/io/serialize-styles.ts +0 -98
  188. package/src/formats/xlsx/io/serialize-workbook.ts +0 -429
  189. package/src/formats/xlsx/io/xlsx-session.ts +0 -314
  190. package/src/formats/xlsx/model/cell.ts +0 -189
  191. package/src/formats/xlsx/model/sheet.ts +0 -326
  192. package/src/formats/xlsx/model/styles.ts +0 -118
  193. package/src/formats/xlsx/model/workbook.ts +0 -453
  194. package/src/formats/xlsx/runtime/cell-commands.ts +0 -567
  195. package/src/formats/xlsx/runtime/sheet-commands.ts +0 -206
  196. package/src/formats/xlsx/runtime/workbook-runtime.ts +0 -177
  197. package/src/formats/xlsx/runtime/workbook-transaction.ts +0 -822
  198. package/src/index.ts +0 -101
  199. package/src/io/README.md +0 -10
  200. package/src/io/docx-session.ts +0 -2882
  201. package/src/io/export/README.md +0 -3
  202. package/src/io/export/export-session.ts +0 -220
  203. package/src/io/export/minimal-docx.ts +0 -115
  204. package/src/io/export/reattach-preserved-parts.ts +0 -54
  205. package/src/io/export/serialize-comments.ts +0 -947
  206. package/src/io/export/serialize-footnotes.ts +0 -399
  207. package/src/io/export/serialize-headers-footers.ts +0 -372
  208. package/src/io/export/serialize-main-document.ts +0 -1376
  209. package/src/io/export/serialize-numbering.ts +0 -118
  210. package/src/io/export/serialize-revisions.ts +0 -389
  211. package/src/io/export/serialize-runtime-revisions.ts +0 -269
  212. package/src/io/export/serialize-tables.ts +0 -174
  213. package/src/io/export/split-review-boundaries.ts +0 -356
  214. package/src/io/normalize/README.md +0 -3
  215. package/src/io/normalize/normalize-text.ts +0 -639
  216. package/src/io/ooxml/README.md +0 -3
  217. package/src/io/ooxml/highlight-colors.ts +0 -39
  218. package/src/io/ooxml/numbering-sentinels.ts +0 -44
  219. package/src/io/ooxml/parse-comments.ts +0 -846
  220. package/src/io/ooxml/parse-complex-content.ts +0 -287
  221. package/src/io/ooxml/parse-fields.ts +0 -834
  222. package/src/io/ooxml/parse-footnotes.ts +0 -896
  223. package/src/io/ooxml/parse-headers-footers.ts +0 -1169
  224. package/src/io/ooxml/parse-inline-media.ts +0 -461
  225. package/src/io/ooxml/parse-main-document.ts +0 -2877
  226. package/src/io/ooxml/parse-numbering.ts +0 -432
  227. package/src/io/ooxml/parse-revisions.ts +0 -931
  228. package/src/io/ooxml/parse-settings.ts +0 -184
  229. package/src/io/ooxml/parse-shapes.ts +0 -296
  230. package/src/io/ooxml/parse-styles.ts +0 -463
  231. package/src/io/ooxml/parse-tables.ts +0 -618
  232. package/src/io/ooxml/parse-theme.ts +0 -346
  233. package/src/io/ooxml/part-manifest.ts +0 -136
  234. package/src/io/ooxml/revision-boundaries.ts +0 -351
  235. package/src/io/opc/README.md +0 -3
  236. package/src/io/opc/corrupt-package.ts +0 -166
  237. package/src/io/opc/docx-package.ts +0 -74
  238. package/src/io/opc/package-reader.ts +0 -325
  239. package/src/io/opc/package-writer.ts +0 -273
  240. package/src/io/source-package-provenance.ts +0 -241
  241. package/src/legal/cross-references.ts +0 -414
  242. package/src/legal/defined-terms.ts +0 -203
  243. package/src/legal/index.ts +0 -32
  244. package/src/legal/signature-blocks.ts +0 -259
  245. package/src/model/README.md +0 -3
  246. package/src/model/canonical-document.ts +0 -2632
  247. package/src/model/cds-1.0.0.ts +0 -212
  248. package/src/model/snapshot.ts +0 -649
  249. package/src/preservation/README.md +0 -3
  250. package/src/preservation/markup-compatibility.ts +0 -48
  251. package/src/preservation/opaque-fragment-store.ts +0 -89
  252. package/src/preservation/opaque-region.ts +0 -233
  253. package/src/preservation/package-preservation.ts +0 -113
  254. package/src/preservation/preserved-part-manifest.ts +0 -56
  255. package/src/preservation/relationship-retention.ts +0 -57
  256. package/src/preservation/store.ts +0 -185
  257. package/src/review/README.md +0 -16
  258. package/src/review/store/README.md +0 -3
  259. package/src/review/store/comment-anchors.ts +0 -70
  260. package/src/review/store/comment-remapping.ts +0 -154
  261. package/src/review/store/comment-store.ts +0 -331
  262. package/src/review/store/comment-thread.ts +0 -109
  263. package/src/review/store/revision-actions.ts +0 -394
  264. package/src/review/store/revision-store.ts +0 -312
  265. package/src/review/store/revision-types.ts +0 -171
  266. package/src/review/store/runtime-comment-store.ts +0 -43
  267. package/src/runtime/README.md +0 -3
  268. package/src/runtime/ai-action-policy.ts +0 -764
  269. package/src/runtime/document-layout.ts +0 -332
  270. package/src/runtime/document-navigation.ts +0 -603
  271. package/src/runtime/document-runtime.ts +0 -3159
  272. package/src/runtime/document-search.ts +0 -145
  273. package/src/runtime/numbering-prefix.ts +0 -216
  274. package/src/runtime/page-layout-estimation.ts +0 -212
  275. package/src/runtime/read-only-diagnostics-runtime.ts +0 -241
  276. package/src/runtime/review-runtime.ts +0 -44
  277. package/src/runtime/revision-runtime.ts +0 -107
  278. package/src/runtime/session-capabilities.ts +0 -192
  279. package/src/runtime/story-context.ts +0 -164
  280. package/src/runtime/story-targeting.ts +0 -162
  281. package/src/runtime/surface-projection.ts +0 -1357
  282. package/src/runtime/table-commands.ts +0 -173
  283. package/src/runtime/table-schema.ts +0 -309
  284. package/src/runtime/view-state.ts +0 -477
  285. package/src/runtime/virtualized-rendering.ts +0 -258
  286. package/src/runtime/workflow-markup.ts +0 -353
  287. package/src/ui/README.md +0 -30
  288. package/src/ui/WordReviewEditor.tsx +0 -4086
  289. package/src/ui/browser-export.ts +0 -52
  290. package/src/ui/comments/README.md +0 -3
  291. package/src/ui/compatibility/README.md +0 -3
  292. package/src/ui/editor-command-bag.ts +0 -120
  293. package/src/ui/editor-runtime-boundary.ts +0 -1457
  294. package/src/ui/editor-shell-view.tsx +0 -142
  295. package/src/ui/editor-surface/README.md +0 -3
  296. package/src/ui/editor-surface-controller.tsx +0 -61
  297. package/src/ui/headless/comment-decoration-model.ts +0 -124
  298. package/src/ui/headless/preserve-editor-selection.ts +0 -5
  299. package/src/ui/headless/revision-decoration-model.ts +0 -128
  300. package/src/ui/headless/selection-helpers.ts +0 -54
  301. package/src/ui/headless/selection-toolbar-model.ts +0 -34
  302. package/src/ui/headless/use-editor-keyboard.ts +0 -103
  303. package/src/ui/review/README.md +0 -3
  304. package/src/ui/runtime-snapshot-selectors.ts +0 -197
  305. package/src/ui/shared/revision-filters.ts +0 -31
  306. package/src/ui/status/README.md +0 -3
  307. package/src/ui/theme/README.md +0 -3
  308. package/src/ui/toolbar/README.md +0 -3
  309. package/src/ui/workflow-surface-blocked-rails.ts +0 -94
  310. package/src/ui-tailwind/chrome/tw-alert-banner.tsx +0 -64
  311. package/src/ui-tailwind/chrome/tw-image-context-toolbar.tsx +0 -129
  312. package/src/ui-tailwind/chrome/tw-layout-panel.tsx +0 -114
  313. package/src/ui-tailwind/chrome/tw-object-context-toolbar.tsx +0 -34
  314. package/src/ui-tailwind/chrome/tw-page-ruler.tsx +0 -386
  315. package/src/ui-tailwind/chrome/tw-selection-toolbar.tsx +0 -186
  316. package/src/ui-tailwind/chrome/tw-suggestion-card.tsx +0 -139
  317. package/src/ui-tailwind/chrome/tw-table-context-toolbar.tsx +0 -128
  318. package/src/ui-tailwind/chrome/tw-unsaved-modal.tsx +0 -58
  319. package/src/ui-tailwind/chrome/use-before-unload.ts +0 -20
  320. package/src/ui-tailwind/editor-surface/perf-probe.ts +0 -179
  321. package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +0 -184
  322. package/src/ui-tailwind/editor-surface/pm-contextual-ui.ts +0 -31
  323. package/src/ui-tailwind/editor-surface/pm-decorations.ts +0 -427
  324. package/src/ui-tailwind/editor-surface/pm-position-map.ts +0 -123
  325. package/src/ui-tailwind/editor-surface/pm-schema.ts +0 -876
  326. package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +0 -504
  327. package/src/ui-tailwind/editor-surface/search-plugin.ts +0 -168
  328. package/src/ui-tailwind/editor-surface/surface-build-keys.ts +0 -61
  329. package/src/ui-tailwind/editor-surface/tw-caret.tsx +0 -12
  330. package/src/ui-tailwind/editor-surface/tw-editor-surface.tsx +0 -150
  331. package/src/ui-tailwind/editor-surface/tw-inline-token.tsx +0 -129
  332. package/src/ui-tailwind/editor-surface/tw-opaque-block.tsx +0 -58
  333. package/src/ui-tailwind/editor-surface/tw-paragraph-block.tsx +0 -151
  334. package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +0 -944
  335. package/src/ui-tailwind/editor-surface/tw-segment-view.tsx +0 -111
  336. package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +0 -436
  337. package/src/ui-tailwind/index.ts +0 -62
  338. package/src/ui-tailwind/page-chrome-model.ts +0 -27
  339. package/src/ui-tailwind/review/tw-comment-sidebar.tsx +0 -406
  340. package/src/ui-tailwind/review/tw-health-panel.tsx +0 -149
  341. package/src/ui-tailwind/review/tw-review-rail.tsx +0 -120
  342. package/src/ui-tailwind/review/tw-revision-sidebar.tsx +0 -164
  343. package/src/ui-tailwind/status/tw-status-bar.tsx +0 -61
  344. package/src/ui-tailwind/toolbar/tw-toolbar-icon-button.tsx +0 -52
  345. package/src/ui-tailwind/toolbar/tw-toolbar.tsx +0 -1064
  346. package/src/ui-tailwind/tw-review-workspace.tsx +0 -1417
  347. package/src/validation/README.md +0 -3
  348. package/src/validation/compatibility-engine.ts +0 -634
  349. package/src/validation/compatibility-report.ts +0 -161
  350. package/src/validation/diagnostics.ts +0 -204
  351. package/src/validation/docx-comment-proof.ts +0 -707
  352. package/src/validation/import-diagnostics.ts +0 -128
  353. package/src/validation/low-priority-word-surfaces.ts +0 -373
  354. /package/{src → dist}/ui-tailwind/theme/editor-theme.css +0 -0
@@ -0,0 +1,763 @@
1
+ import {
2
+ describeOpaqueFragment,
3
+ listOpaqueFragments,
4
+ listPreservedPackageParts
5
+ } from "./chunk-SWKWQZXM.js";
6
+ import {
7
+ createRangeAnchor,
8
+ mapAnchor,
9
+ normalizeRange
10
+ } from "./chunk-EBI3BX6U.js";
11
+
12
+ // src/api/session-state.ts
13
+ var EDITOR_SESSION_STATE_VERSION = "editor-session-state/1";
14
+ function cloneStructuredValue(value) {
15
+ return structuredClone(value);
16
+ }
17
+ function createEditorSessionState(input) {
18
+ return cloneStructuredValue({
19
+ sessionVersion: EDITOR_SESSION_STATE_VERSION,
20
+ ...input
21
+ });
22
+ }
23
+ function editorSessionStateFromPersistedSnapshot(snapshot) {
24
+ return createEditorSessionState({
25
+ schemaVersion: snapshot.schemaVersion,
26
+ documentId: snapshot.documentId,
27
+ docId: snapshot.docId,
28
+ createdAt: snapshot.createdAt,
29
+ updatedAt: snapshot.updatedAt,
30
+ editorBuild: snapshot.editorBuild,
31
+ canonicalDocument: snapshot.canonicalDocument,
32
+ compatibility: snapshot.compatibility,
33
+ warningLog: snapshot.warningLog,
34
+ protectionSnapshot: snapshot.protectionSnapshot,
35
+ sourcePackage: snapshot.sourcePackage
36
+ });
37
+ }
38
+ function persistedSnapshotFromEditorSessionState(sessionState, options) {
39
+ return cloneStructuredValue({
40
+ snapshotVersion: "persisted-editor-snapshot/2",
41
+ schemaVersion: sessionState.schemaVersion,
42
+ documentId: sessionState.documentId,
43
+ docId: sessionState.docId,
44
+ createdAt: sessionState.createdAt,
45
+ updatedAt: sessionState.updatedAt,
46
+ savedAt: options.savedAt,
47
+ editorBuild: sessionState.editorBuild,
48
+ canonicalDocument: sessionState.canonicalDocument,
49
+ compatibility: sessionState.compatibility,
50
+ warningLog: sessionState.warningLog,
51
+ protectionSnapshot: sessionState.protectionSnapshot,
52
+ sourcePackage: sessionState.sourcePackage
53
+ });
54
+ }
55
+
56
+ // src/review/store/revision-types.ts
57
+ function createRevisionRangeAnchor(from, to = from, assoc) {
58
+ return createRangeAnchor(from, to, assoc);
59
+ }
60
+ function remapRevisionAnchor(anchor, mapping) {
61
+ return mapAnchor(anchor, mapping);
62
+ }
63
+ function isDetachedRevisionAnchor(anchor) {
64
+ return anchor.kind === "detached";
65
+ }
66
+ function summarizeRevisionAnchor(anchor) {
67
+ if (anchor.kind === "range") {
68
+ return {
69
+ anchor,
70
+ state: "active",
71
+ range: normalizeRange(anchor.range)
72
+ };
73
+ }
74
+ if (anchor.kind === "node") {
75
+ return {
76
+ anchor,
77
+ state: "active",
78
+ range: {
79
+ from: anchor.at,
80
+ to: anchor.at
81
+ }
82
+ };
83
+ }
84
+ return {
85
+ anchor,
86
+ state: "detached",
87
+ range: normalizeRange(anchor.lastKnownRange)
88
+ };
89
+ }
90
+ function getRevisionActionability(revision) {
91
+ if (typeof revision !== "string" && typeof revision.metadata.preserveOnlyReason === "string" && revision.metadata.preserveOnlyReason.length > 0) {
92
+ return "preserve-only";
93
+ }
94
+ const kind = typeof revision === "string" ? revision : revision.kind;
95
+ switch (kind) {
96
+ case "insertion":
97
+ case "deletion":
98
+ case "property-change":
99
+ return "actionable";
100
+ case "formatting":
101
+ case "move":
102
+ return "preserve-only";
103
+ }
104
+ }
105
+ function isRevisionActionable(record) {
106
+ return getRevisionActionability(record) === "actionable" && record.status === "active";
107
+ }
108
+ function describeRevisionKind(kind) {
109
+ switch (kind) {
110
+ case "insertion":
111
+ return "Insertion";
112
+ case "deletion":
113
+ return "Deletion";
114
+ case "formatting":
115
+ return "Formatting change";
116
+ case "move":
117
+ return "Move";
118
+ case "property-change":
119
+ return "Property change";
120
+ }
121
+ }
122
+
123
+ // src/review/store/revision-store.ts
124
+ function createRevisionStore(revisions = {}) {
125
+ return {
126
+ version: "revision-store/1",
127
+ revisions
128
+ };
129
+ }
130
+ function createRevisionRecord(params) {
131
+ return normalizeRevisionRecord({
132
+ revisionId: params.revisionId,
133
+ kind: params.kind,
134
+ anchor: params.anchor,
135
+ authorId: params.authorId,
136
+ createdAt: params.createdAt,
137
+ status: params.status ?? "active",
138
+ warningIds: [...params.warningIds ?? []],
139
+ metadata: {
140
+ source: params.metadata?.source ?? "runtime",
141
+ storyTarget: params.metadata?.storyTarget,
142
+ preserveOnlyReason: params.metadata?.preserveOnlyReason ?? (getRevisionActionability(params.kind) === "preserve-only" ? "Imported preserve-only revision." : void 0),
143
+ importedRevisionForm: params.metadata?.importedRevisionForm,
144
+ originalRevisionType: params.metadata?.originalRevisionType,
145
+ ooxmlRevisionId: params.metadata?.ooxmlRevisionId,
146
+ propertyChangeData: params.metadata?.propertyChangeData,
147
+ moveData: params.metadata?.moveData
148
+ }
149
+ });
150
+ }
151
+ function upsertRevisionRecord(store, revision) {
152
+ return {
153
+ ...store,
154
+ revisions: {
155
+ ...store.revisions,
156
+ [revision.revisionId]: normalizeRevisionRecord(revision)
157
+ }
158
+ };
159
+ }
160
+ function setRevisionStatus(store, revisionId, status) {
161
+ const existing = store.revisions[revisionId];
162
+ if (!existing) {
163
+ return store;
164
+ }
165
+ if (existing.status === "detached") {
166
+ return store;
167
+ }
168
+ if ((status === "accepted" || status === "rejected") && getRevisionActionability(existing) !== "actionable") {
169
+ return store;
170
+ }
171
+ return upsertRevisionRecord(store, {
172
+ ...existing,
173
+ status
174
+ });
175
+ }
176
+ function remapRevisionStore(store, mapping) {
177
+ return createRevisionStore(
178
+ Object.fromEntries(
179
+ Object.entries(store.revisions).map(([revisionId, revision]) => {
180
+ const anchor = remapRevisionAnchor(revision.anchor, mapping);
181
+ const status = anchor.kind === "detached" ? "detached" : revision.status === "accepted" || revision.status === "rejected" ? revision.status : "active";
182
+ return [
183
+ revisionId,
184
+ normalizeRevisionRecord({
185
+ ...revision,
186
+ anchor,
187
+ status
188
+ })
189
+ ];
190
+ })
191
+ )
192
+ );
193
+ }
194
+ function createRevisionSidebarProjection(store) {
195
+ const revisions = Object.values(store.revisions).map(toSidebarEntry).sort(compareRevisionEntries);
196
+ return {
197
+ totalCount: revisions.length,
198
+ activeRevisionIds: revisions.filter((revision) => revision.status === "active").map((revision) => revision.revisionId),
199
+ acceptedRevisionIds: revisions.filter((revision) => revision.status === "accepted").map((revision) => revision.revisionId),
200
+ rejectedRevisionIds: revisions.filter((revision) => revision.status === "rejected").map((revision) => revision.revisionId),
201
+ detachedRevisionIds: revisions.filter((revision) => revision.status === "detached").map((revision) => revision.revisionId),
202
+ actionableRevisionIds: revisions.filter((revision) => revision.actionability === "actionable").map((revision) => revision.revisionId),
203
+ preserveOnlyRevisionIds: revisions.filter((revision) => revision.actionability === "preserve-only").map((revision) => revision.revisionId),
204
+ revisions
205
+ };
206
+ }
207
+ function toSidebarEntry(revision) {
208
+ const anchorSummary = summarizeRevisionAnchor(revision.anchor);
209
+ const actionability = getRevisionActionability(revision);
210
+ const moveData = revision.metadata.moveData;
211
+ return {
212
+ revisionId: revision.revisionId,
213
+ kind: revision.kind,
214
+ label: describeRevisionKind(revision.kind),
215
+ status: revision.status,
216
+ actionability,
217
+ anchorLabel: anchorSummary.state === "detached" ? `Detached ${anchorSummary.range.from}-${anchorSummary.range.to}` : `Range ${anchorSummary.range.from}-${anchorSummary.range.to}`,
218
+ createdAt: revision.createdAt,
219
+ authorId: revision.authorId,
220
+ warningCount: revision.warningIds.length,
221
+ canAccept: isRevisionActionable(revision),
222
+ canReject: isRevisionActionable(revision),
223
+ preserveOnlyReason: revision.metadata.preserveOnlyReason,
224
+ linkedMoveRevisionId: moveData?.linkedRevisionId,
225
+ moveDirection: moveData?.direction
226
+ };
227
+ }
228
+ function normalizeRevisionRecord(revision) {
229
+ const actionability = getRevisionActionability(revision);
230
+ if (isDetachedRevisionAnchor(revision.anchor)) {
231
+ return {
232
+ ...revision,
233
+ status: "detached",
234
+ metadata: {
235
+ ...revision.metadata,
236
+ preserveOnlyReason: revision.metadata.preserveOnlyReason ?? (actionability === "preserve-only" ? "Imported preserve-only revision." : void 0)
237
+ }
238
+ };
239
+ }
240
+ if (actionability === "preserve-only" && revision.status !== "detached") {
241
+ return {
242
+ ...revision,
243
+ status: revision.status === "accepted" || revision.status === "rejected" ? "active" : revision.status,
244
+ metadata: {
245
+ ...revision.metadata,
246
+ preserveOnlyReason: revision.metadata.preserveOnlyReason ?? "Imported preserve-only revision."
247
+ }
248
+ };
249
+ }
250
+ return revision;
251
+ }
252
+ function compareRevisionEntries(left, right) {
253
+ const statusDelta = priorityForStatus(left.status) - priorityForStatus(right.status);
254
+ if (statusDelta !== 0) {
255
+ return statusDelta;
256
+ }
257
+ const actionabilityDelta = priorityForActionability(left.actionability) - priorityForActionability(right.actionability);
258
+ if (actionabilityDelta !== 0) {
259
+ return actionabilityDelta;
260
+ }
261
+ return left.createdAt.localeCompare(right.createdAt);
262
+ }
263
+ function priorityForStatus(status) {
264
+ switch (status) {
265
+ case "active":
266
+ return 0;
267
+ case "detached":
268
+ return 1;
269
+ case "accepted":
270
+ return 2;
271
+ case "rejected":
272
+ return 3;
273
+ }
274
+ }
275
+ function priorityForActionability(actionability) {
276
+ switch (actionability) {
277
+ case "actionable":
278
+ return 0;
279
+ case "preserve-only":
280
+ return 1;
281
+ }
282
+ }
283
+
284
+ // src/validation/compatibility-engine.ts
285
+ function buildCompatibilityReport(input) {
286
+ const content = normalizeDocumentRoot(input.document.content);
287
+ const contentFeatures = collectContentFeatures(content);
288
+ if (hasSupportedRuntimeComments(input.document.review.comments)) {
289
+ contentFeatures.push(
290
+ supportedEntry(
291
+ "comments-single-paragraph",
292
+ "Single-paragraph review comments stay mappable through runtime selections."
293
+ )
294
+ );
295
+ }
296
+ const featureEntries = [
297
+ ...contentFeatures,
298
+ ...collectPreservationFeatures(input.document)
299
+ ];
300
+ const warnings = dedupeWarnings([
301
+ ...input.warnings ?? [],
302
+ ...collectDiagnosticWarnings(input.document)
303
+ ]);
304
+ const errors = dedupeErrors([
305
+ ...collectDiagnosticErrors(input.document),
306
+ ...input.fatalError ? [input.fatalError] : []
307
+ ]);
308
+ return {
309
+ reportVersion: "compatibility-report/1",
310
+ generatedAt: input.generatedAt,
311
+ blockExport: featureEntries.some((entry) => entry.featureClass === "unsupported-fatal") || errors.some((error) => error.isFatal),
312
+ featureEntries,
313
+ warnings,
314
+ errors
315
+ };
316
+ }
317
+ function hasSupportedRuntimeComments(comments) {
318
+ return Object.values(comments).some((comment) => comment.anchor.kind !== "detached");
319
+ }
320
+ function normalizeDocumentRoot(content) {
321
+ if (content && typeof content === "object" && content.type === "doc") {
322
+ return content;
323
+ }
324
+ if (Array.isArray(content)) {
325
+ return {
326
+ type: "doc",
327
+ children: content.filter(
328
+ (value) => Boolean(value) && typeof value === "object" && (value.type === "paragraph" || value.type === "opaque_block")
329
+ )
330
+ };
331
+ }
332
+ return {
333
+ type: "doc",
334
+ children: [{ type: "paragraph", children: [] }]
335
+ };
336
+ }
337
+ function collectContentFeatures(content) {
338
+ const flags = {
339
+ paragraphs: false,
340
+ runs: false,
341
+ whitespace: false,
342
+ headings: false,
343
+ lists: false,
344
+ hyperlinks: false,
345
+ images: false,
346
+ tables: false,
347
+ sections: false,
348
+ contentControls: false
349
+ };
350
+ for (let index = 0; index < content.children.length; index += 1) {
351
+ measureBlock(content.children[index], flags);
352
+ }
353
+ const entries = [];
354
+ if (flags.paragraphs) {
355
+ entries.push(supportedEntry("paragraphs", "Paragraph structure is editable and round-trippable."));
356
+ }
357
+ if (flags.runs) {
358
+ entries.push(supportedEntry("runs", "Runs and inline text are editable through runtime commands."));
359
+ }
360
+ if (flags.whitespace) {
361
+ entries.push(supportedEntry("whitespace", "Whitespace-sensitive text units stay explicit in the runtime model."));
362
+ }
363
+ if (flags.headings) {
364
+ entries.push(supportedEntry("headings", "Heading styles remain attached to paragraph structure."));
365
+ }
366
+ if (flags.lists) {
367
+ entries.push(supportedEntry("lists", "Numbering metadata stays attached to paragraph blocks."));
368
+ }
369
+ if (flags.hyperlinks) {
370
+ entries.push(supportedEntry("hyperlinks", "Hyperlink relationships are preserved and re-serialized."));
371
+ }
372
+ if (flags.images) {
373
+ entries.push(supportedEntry("inline-images", "Inline image placements stay attached to preserved media parts."));
374
+ }
375
+ if (flags.tables) {
376
+ entries.push(
377
+ supportedEntry(
378
+ "tables",
379
+ "Structured tables keep cell topology and common visual properties through runtime editing and export."
380
+ )
381
+ );
382
+ }
383
+ if (flags.sections) {
384
+ entries.push(
385
+ supportedEntry(
386
+ "sections",
387
+ "Section boundaries and page-layout properties remain structured and export-safe."
388
+ )
389
+ );
390
+ }
391
+ if (flags.contentControls) {
392
+ entries.push(
393
+ supportedEntry(
394
+ "content-controls",
395
+ "Common content controls render through structured SDT state and round-trip without flattening to opaque placeholders."
396
+ )
397
+ );
398
+ }
399
+ return entries;
400
+ }
401
+ function measureBlock(block, flags) {
402
+ switch (block.type) {
403
+ case "paragraph":
404
+ flags.paragraphs = true;
405
+ if (block.styleId?.toLowerCase().startsWith("heading")) {
406
+ flags.headings = true;
407
+ }
408
+ if (block.numbering) {
409
+ flags.lists = true;
410
+ }
411
+ return measureParagraph(block, flags);
412
+ case "table":
413
+ flags.tables = true;
414
+ return block.rows.reduce(
415
+ (size, row) => size + row.cells.reduce(
416
+ (cellSize, cell) => cellSize + cell.children.reduce((childSize, child) => childSize + measureBlock(child, flags), 0),
417
+ 0
418
+ ),
419
+ 0
420
+ );
421
+ case "sdt":
422
+ flags.contentControls = true;
423
+ return block.children.reduce((size, child) => size + measureBlock(child, flags), 0);
424
+ case "custom_xml":
425
+ return block.children.reduce((size, child) => size + measureBlock(child, flags), 0);
426
+ case "section_break":
427
+ flags.sections = true;
428
+ return 1;
429
+ default:
430
+ return 0;
431
+ }
432
+ }
433
+ function measureParagraph(paragraph, flags) {
434
+ let size = 0;
435
+ const children = Array.isArray(paragraph.children) ? paragraph.children : [];
436
+ for (const child of children) {
437
+ size += measureInlineNode(child, flags);
438
+ }
439
+ return size;
440
+ }
441
+ function measureInlineNode(node, flags) {
442
+ switch (node.type) {
443
+ case "text":
444
+ flags.runs = flags.runs || node.text.length > 0;
445
+ flags.whitespace = flags.whitespace || /^\s/u.test(node.text) || /\s$/u.test(node.text) || node.text.includes(" ");
446
+ return Array.from(node.text).length;
447
+ case "tab":
448
+ case "hard_break":
449
+ flags.runs = true;
450
+ flags.whitespace = true;
451
+ return 1;
452
+ case "hyperlink":
453
+ flags.runs = true;
454
+ flags.hyperlinks = true;
455
+ return node.children.reduce((size, child) => size + measureInlineNode(child, flags), 0);
456
+ case "image":
457
+ flags.images = true;
458
+ flags.runs = true;
459
+ return 1;
460
+ case "opaque_inline":
461
+ flags.runs = true;
462
+ return 1;
463
+ case "column_break":
464
+ case "symbol":
465
+ case "field":
466
+ case "bookmark_start":
467
+ case "bookmark_end":
468
+ case "footnote_ref":
469
+ case "chart_preview":
470
+ case "smartart_preview":
471
+ case "shape":
472
+ case "wordart":
473
+ case "vml_shape":
474
+ default:
475
+ flags.runs = true;
476
+ return 1;
477
+ }
478
+ }
479
+ function collectPreservationFeatures(document) {
480
+ const entries = [];
481
+ const structuredSubPartPaths = collectStructuredSubPartPaths(document);
482
+ entries.push(...collectSubPartFeatures(document));
483
+ for (const fragment of listOpaqueFragments(document.preservation)) {
484
+ const descriptor = describeOpaqueFragment(fragment);
485
+ entries.push({
486
+ featureEntryId: `feature:${fragment.fragmentId}`,
487
+ featureKey: descriptor.featureKey,
488
+ featureClass: "preserve-only",
489
+ message: descriptor.label,
490
+ affectedAnchor: createRangeAnchor(
491
+ fragment.lastKnownRange.from,
492
+ fragment.lastKnownRange.to
493
+ ),
494
+ details: {
495
+ fragmentId: fragment.fragmentId,
496
+ warningId: fragment.warningId,
497
+ detail: descriptor.detail
498
+ }
499
+ });
500
+ }
501
+ for (const packagePart of listPreservedPackageParts(document.preservation)) {
502
+ if (structuredSubPartPaths.has(packagePart.packagePartName)) {
503
+ continue;
504
+ }
505
+ entries.push({
506
+ featureEntryId: `feature:package:${packagePart.packagePartName}`,
507
+ featureKey: "unknown-package-parts",
508
+ featureClass: "preserve-only",
509
+ message: `Preserved package part ${packagePart.packagePartName}.`,
510
+ details: {
511
+ packagePartName: packagePart.packagePartName,
512
+ contentType: packagePart.contentType,
513
+ relationshipIds: packagePart.relationshipIds
514
+ }
515
+ });
516
+ }
517
+ return entries;
518
+ }
519
+ function collectStructuredSubPartPaths(document) {
520
+ const subParts = document.subParts;
521
+ if (!subParts) {
522
+ return /* @__PURE__ */ new Set();
523
+ }
524
+ const paths = /* @__PURE__ */ new Set();
525
+ for (const header of subParts.headers ?? []) {
526
+ paths.add(header.partPath);
527
+ }
528
+ for (const footer of subParts.footers ?? []) {
529
+ paths.add(footer.partPath);
530
+ }
531
+ if (subParts.footnoteCollection) {
532
+ paths.add("/word/footnotes.xml");
533
+ paths.add("/word/endnotes.xml");
534
+ }
535
+ if (subParts.theme) {
536
+ paths.add("/word/theme/theme1.xml");
537
+ }
538
+ return paths;
539
+ }
540
+ function collectSubPartFeatures(document) {
541
+ const subParts = document.subParts;
542
+ if (!subParts) {
543
+ return [];
544
+ }
545
+ const entries = collectLossySubPartFeatures(subParts);
546
+ const hasHeaderFooterContent = (subParts.headers?.length ?? 0) > 0 || (subParts.footers?.length ?? 0) > 0;
547
+ const noteCount = Object.keys(subParts.footnoteCollection?.footnotes ?? {}).length + Object.keys(subParts.footnoteCollection?.endnotes ?? {}).length;
548
+ if (hasHeaderFooterContent && !entries.some((entry) => entry.featureKey === "headers-footers-lossy")) {
549
+ entries.push({
550
+ featureEntryId: "feature:subparts:headers-footers",
551
+ featureKey: "headers-footers",
552
+ featureClass: "supported-roundtrip",
553
+ message: "Headers and footers resolve as structured secondary stories with export-safe ownership.",
554
+ details: {
555
+ headerCount: subParts.headers?.length ?? 0,
556
+ footerCount: subParts.footers?.length ?? 0
557
+ }
558
+ });
559
+ }
560
+ if (noteCount > 0 && !entries.some((entry) => entry.featureKey === "notes-lossy")) {
561
+ entries.push({
562
+ featureEntryId: "feature:subparts:notes",
563
+ featureKey: "notes",
564
+ featureClass: "supported-roundtrip",
565
+ message: "Footnotes and endnotes resolve as structured secondary stories with export-safe ownership.",
566
+ details: {
567
+ footnoteCount: Object.keys(subParts.footnoteCollection?.footnotes ?? {}).length,
568
+ endnoteCount: Object.keys(subParts.footnoteCollection?.endnotes ?? {}).length
569
+ }
570
+ });
571
+ }
572
+ if (subParts.theme) {
573
+ entries.push({
574
+ featureEntryId: "feature:subparts:theme",
575
+ featureKey: "unknown-package-parts",
576
+ featureClass: "preserve-only",
577
+ message: "Theme metadata is preserved through structured sub-part ownership.",
578
+ details: {
579
+ surface: "theme-subpart",
580
+ themeName: subParts.theme.name
581
+ }
582
+ });
583
+ }
584
+ return entries;
585
+ }
586
+ function collectLossySubPartFeatures(subParts) {
587
+ const entries = [];
588
+ const headerFooterLossy = [
589
+ ...(subParts.headers ?? []).flatMap(
590
+ (header) => collectLossyBlocks(header.blocks, `header:${header.partPath}`)
591
+ ),
592
+ ...(subParts.footers ?? []).flatMap(
593
+ (footer) => collectLossyBlocks(footer.blocks, `footer:${footer.partPath}`)
594
+ )
595
+ ];
596
+ if (headerFooterLossy.length > 0) {
597
+ entries.push({
598
+ featureEntryId: "feature:subparts:headers-footers-lossy",
599
+ featureKey: "headers-footers-lossy",
600
+ featureClass: "unsupported-fatal",
601
+ message: "Headers or footers contain content the current sub-part serializer cannot re-emit safely.",
602
+ details: {
603
+ issues: headerFooterLossy
604
+ }
605
+ });
606
+ }
607
+ const noteLossy = [
608
+ ...Object.values(subParts.footnoteCollection?.footnotes ?? {}).flatMap(
609
+ (note) => collectLossyBlocks(note.blocks, `footnote:${note.noteId}`)
610
+ ),
611
+ ...Object.values(subParts.footnoteCollection?.endnotes ?? {}).flatMap(
612
+ (note) => collectLossyBlocks(note.blocks, `endnote:${note.noteId}`)
613
+ )
614
+ ];
615
+ if (noteLossy.length > 0) {
616
+ entries.push({
617
+ featureEntryId: "feature:subparts:notes-lossy",
618
+ featureKey: "notes-lossy",
619
+ featureClass: "unsupported-fatal",
620
+ message: "Footnotes or endnotes contain content the current sub-part serializer cannot re-emit safely.",
621
+ details: {
622
+ issues: noteLossy
623
+ }
624
+ });
625
+ }
626
+ return entries;
627
+ }
628
+ function collectLossyBlocks(blocks, surface) {
629
+ const issues = [];
630
+ for (const block of blocks) {
631
+ if (block.type === "table") {
632
+ for (const row of block.rows) {
633
+ for (const cell of row.cells) {
634
+ issues.push(...collectLossyBlocks(cell.children, `${surface}:table-cell`));
635
+ }
636
+ }
637
+ continue;
638
+ }
639
+ if (block.type !== "paragraph") {
640
+ issues.push(`${surface}:${block.type}`);
641
+ continue;
642
+ }
643
+ if (block.numbering !== void 0 || block.keepNext !== void 0 || block.keepLines !== void 0 || block.outlineLevel !== void 0 || block.pageBreakBefore !== void 0 || block.widowControl !== void 0 || block.borders !== void 0 || block.shading !== void 0 || block.bidi !== void 0 || block.suppressLineNumbers !== void 0 || block.cnfStyle !== void 0) {
644
+ issues.push(`${surface}:paragraph-properties`);
645
+ }
646
+ for (const child of block.children) {
647
+ issues.push(...collectLossyInlineContent(child, surface));
648
+ }
649
+ }
650
+ return [...new Set(issues)];
651
+ }
652
+ function collectLossyInlineContent(node, surface) {
653
+ switch (node.type) {
654
+ case "text": {
655
+ const allowSecondaryStoryColorMarks = surface.startsWith("header:") || surface.startsWith("footer:");
656
+ const unsupportedMarks = (node.marks ?? []).filter(
657
+ (mark) => mark.type !== "bold" && mark.type !== "italic" && mark.type !== "underline" && mark.type !== "strikethrough" && mark.type !== "doubleStrikethrough" && mark.type !== "fontFamily" && mark.type !== "fontSize" && mark.type !== "textColor" && (!allowSecondaryStoryColorMarks || mark.type !== "backgroundColor") && (!allowSecondaryStoryColorMarks || mark.type !== "highlight") && mark.type !== "smallCaps" && mark.type !== "allCaps"
658
+ ).map((mark) => `${surface}:mark:${mark.type}`);
659
+ return unsupportedMarks;
660
+ }
661
+ case "tab":
662
+ case "hard_break":
663
+ case "footnote_ref":
664
+ case "field":
665
+ case "bookmark_start":
666
+ case "bookmark_end":
667
+ case "shape":
668
+ case "wordart":
669
+ case "vml_shape":
670
+ case "chart_preview":
671
+ case "smartart_preview":
672
+ return [];
673
+ default:
674
+ return [`${surface}:${node.type}`];
675
+ }
676
+ }
677
+ function collectDiagnosticWarnings(document) {
678
+ const diagnostics = Array.isArray(document.diagnostics?.warnings) ? document.diagnostics.warnings : [];
679
+ return diagnostics.map((warning) => ({
680
+ warningId: warning.warningId,
681
+ code: warning.source === "validation" || warning.source === "export" ? "export_roundtrip_risk" : warning.source === "preservation" ? "unsupported_ooxml_preserved" : "import_normalized",
682
+ severity: "warning",
683
+ message: warning.message,
684
+ source: warning.source
685
+ }));
686
+ }
687
+ function collectDiagnosticErrors(document) {
688
+ const diagnostics = Array.isArray(document.diagnostics?.errors) ? document.diagnostics.errors : [];
689
+ return diagnostics.map((error) => ({
690
+ errorId: error.diagnosticId,
691
+ code: error.code === "load_failed" ? "import_failed" : error.code,
692
+ message: error.message,
693
+ isFatal: error.isFatal,
694
+ source: error.source
695
+ }));
696
+ }
697
+ function supportedEntry(featureKey, message) {
698
+ return {
699
+ featureEntryId: `feature:${featureKey}`,
700
+ featureKey,
701
+ featureClass: "supported-roundtrip",
702
+ message
703
+ };
704
+ }
705
+ function dedupeWarnings(warnings) {
706
+ const byId = /* @__PURE__ */ new Map();
707
+ for (const warning of warnings) {
708
+ byId.set(warning.warningId, warning);
709
+ }
710
+ return [...byId.values()];
711
+ }
712
+ function dedupeErrors(errors) {
713
+ const byId = /* @__PURE__ */ new Map();
714
+ for (const error of errors) {
715
+ byId.set(error.errorId, error);
716
+ }
717
+ return [...byId.values()];
718
+ }
719
+
720
+ // src/validation/diagnostics.ts
721
+ var EXPORT_BLOCKING_ERROR_CODES = /* @__PURE__ */ new Set([
722
+ "import_failed",
723
+ "export_failed",
724
+ "package_corrupt",
725
+ "validation_failed"
726
+ ]);
727
+ function createDiagnostics(input = {}) {
728
+ return {
729
+ featureEntries: freezeArray(input.featureEntries ?? []),
730
+ warnings: freezeArray(input.warnings ?? []),
731
+ errors: freezeArray(input.errors ?? [])
732
+ };
733
+ }
734
+ function diagnosticsBlockExport(diagnostics, explicitBlockExport = false) {
735
+ if (explicitBlockExport) {
736
+ return true;
737
+ }
738
+ return diagnostics.featureEntries.some(
739
+ (entry) => entry.featureClass === "unsupported-fatal"
740
+ ) || diagnostics.errors.some(
741
+ (error) => error.isFatal || EXPORT_BLOCKING_ERROR_CODES.has(error.code)
742
+ );
743
+ }
744
+ function freezeArray(items) {
745
+ return Object.freeze([...items]);
746
+ }
747
+
748
+ export {
749
+ EDITOR_SESSION_STATE_VERSION,
750
+ createEditorSessionState,
751
+ editorSessionStateFromPersistedSnapshot,
752
+ persistedSnapshotFromEditorSessionState,
753
+ createRevisionRangeAnchor,
754
+ getRevisionActionability,
755
+ createRevisionRecord,
756
+ setRevisionStatus,
757
+ remapRevisionStore,
758
+ createRevisionSidebarProjection,
759
+ buildCompatibilityReport,
760
+ createDiagnostics,
761
+ diagnosticsBlockExport
762
+ };
763
+ //# sourceMappingURL=chunk-2FJS5GZM.js.map