@syncfusion/ej2-docx 0.0.0-stage → 35.1.40

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 (417) hide show
  1. package/.gitleaksignore +35 -0
  2. package/README.md +68 -2
  3. package/core.js +4 -0
  4. package/dist/ej2-docx.umd.min.js +11 -0
  5. package/dist/ej2-docx.umd.min.js.map +1 -0
  6. package/dist/es6/ej2-docx.es2015.js +66697 -0
  7. package/dist/es6/ej2-docx.es2015.js.map +1 -0
  8. package/dist/es6/ej2-docx.es5.js +77568 -0
  9. package/dist/es6/ej2-docx.es5.js.map +1 -0
  10. package/dist/global/ej2-docx.min.js +11 -0
  11. package/dist/global/ej2-docx.min.js.map +1 -0
  12. package/dist/global/index.d.ts +14 -0
  13. package/features.js +4 -0
  14. package/index.js +4 -0
  15. package/license +10 -0
  16. package/package.json +30 -3
  17. package/src/all.d.ts +50 -0
  18. package/src/all.js +147 -0
  19. package/src/core/compat/base64.d.ts +13 -0
  20. package/src/core/compat/base64.js +90 -0
  21. package/src/core/compat/object-compat.d.ts +30 -0
  22. package/src/core/compat/object-compat.js +40 -0
  23. package/src/core/compat/sha256.d.ts +9 -0
  24. package/src/core/compat/sha256.js +98 -0
  25. package/src/core/errors/docx-error.d.ts +89 -0
  26. package/src/core/errors/docx-error.js +138 -0
  27. package/src/core/errors/error-codes.d.ts +8 -0
  28. package/src/core/errors/error-codes.js +0 -0
  29. package/src/core/errors/index.d.ts +10 -0
  30. package/src/core/errors/index.js +9 -0
  31. package/src/core/index.d.ts +12 -0
  32. package/src/core/index.js +12 -0
  33. package/src/core/mc/alternate-content.d.ts +7 -0
  34. package/src/core/mc/alternate-content.js +67 -0
  35. package/src/core/mc/attributes.d.ts +24 -0
  36. package/src/core/mc/attributes.js +82 -0
  37. package/src/core/mc/index.d.ts +7 -0
  38. package/src/core/mc/index.js +5 -0
  39. package/src/core/mc/inspect.d.ts +16 -0
  40. package/src/core/mc/inspect.js +148 -0
  41. package/src/core/mc/namespaces.d.ts +4 -0
  42. package/src/core/mc/namespaces.js +4 -0
  43. package/src/core/mc/scope.d.ts +6 -0
  44. package/src/core/mc/scope.js +47 -0
  45. package/src/core/opc/content-types.d.ts +34 -0
  46. package/src/core/opc/content-types.js +162 -0
  47. package/src/core/opc/index.d.ts +8 -0
  48. package/src/core/opc/index.js +4 -0
  49. package/src/core/opc/package.d.ts +49 -0
  50. package/src/core/opc/package.js +324 -0
  51. package/src/core/opc/part-name.d.ts +47 -0
  52. package/src/core/opc/part-name.js +205 -0
  53. package/src/core/opc/relationships.d.ts +46 -0
  54. package/src/core/opc/relationships.js +212 -0
  55. package/src/core/preservation/index.d.ts +2 -0
  56. package/src/core/preservation/index.js +1 -0
  57. package/src/core/preservation/opaque-body.d.ts +16 -0
  58. package/src/core/preservation/opaque-body.js +69 -0
  59. package/src/core/registry/block-handlers.d.ts +30 -0
  60. package/src/core/registry/block-handlers.js +36 -0
  61. package/src/core/registry/create-defaults.d.ts +39 -0
  62. package/src/core/registry/create-defaults.js +42 -0
  63. package/src/core/registry/feature-registry.d.ts +20 -0
  64. package/src/core/registry/feature-registry.js +29 -0
  65. package/src/core/registry/index.d.ts +9 -0
  66. package/src/core/registry/index.js +8 -0
  67. package/src/core/registry/inline-handlers.d.ts +20 -0
  68. package/src/core/registry/inline-handlers.js +30 -0
  69. package/src/core/registry/materialize-handlers.d.ts +35 -0
  70. package/src/core/registry/materialize-handlers.js +75 -0
  71. package/src/core/registry/multi-part-handlers.d.ts +37 -0
  72. package/src/core/registry/multi-part-handlers.js +206 -0
  73. package/src/core/registry/package-part-handlers.d.ts +28 -0
  74. package/src/core/registry/package-part-handlers.js +190 -0
  75. package/src/core/registry/part-handlers.d.ts +24 -0
  76. package/src/core/registry/part-handlers.js +172 -0
  77. package/src/core/registry/run-leaf-handlers.d.ts +26 -0
  78. package/src/core/registry/run-leaf-handlers.js +72 -0
  79. package/src/core/security/limits.d.ts +40 -0
  80. package/src/core/security/limits.js +26 -0
  81. package/src/core/xml/index.d.ts +7 -0
  82. package/src/core/xml/index.js +3 -0
  83. package/src/core/xml/model.d.ts +66 -0
  84. package/src/core/xml/model.js +17 -0
  85. package/src/core/xml/parse.d.ts +12 -0
  86. package/src/core/xml/parse.js +382 -0
  87. package/src/core/xml/serialize.d.ts +6 -0
  88. package/src/core/xml/serialize.js +93 -0
  89. package/src/core/zip/crc32.d.ts +2 -0
  90. package/src/core/zip/crc32.js +25 -0
  91. package/src/core/zip/deflate.d.ts +6 -0
  92. package/src/core/zip/deflate.js +6 -0
  93. package/src/core/zip/index.d.ts +10 -0
  94. package/src/core/zip/index.js +4 -0
  95. package/src/core/zip/inflate-raw.d.ts +17 -0
  96. package/src/core/zip/inflate-raw.js +450 -0
  97. package/src/core/zip/names.d.ts +6 -0
  98. package/src/core/zip/names.js +52 -0
  99. package/src/core/zip/read.d.ts +8 -0
  100. package/src/core/zip/read.js +262 -0
  101. package/src/core/zip/write.d.ts +7 -0
  102. package/src/core/zip/write.js +189 -0
  103. package/src/core/zip/zip-entry.d.ts +4 -0
  104. package/src/core/zip/zip-entry.js +0 -0
  105. package/src/features/bibliography/index.d.ts +100 -0
  106. package/src/features/bibliography/index.js +290 -0
  107. package/src/features/bookmarks/index.d.ts +331 -0
  108. package/src/features/bookmarks/index.js +1009 -0
  109. package/src/features/comments/comment-extensions.d.ts +157 -0
  110. package/src/features/comments/comment-extensions.js +356 -0
  111. package/src/features/comments/index.d.ts +579 -0
  112. package/src/features/comments/index.js +1727 -0
  113. package/src/features/content-controls/index.d.ts +821 -0
  114. package/src/features/content-controls/index.js +2857 -0
  115. package/src/features/custom-xml/index.d.ts +236 -0
  116. package/src/features/custom-xml/index.js +661 -0
  117. package/src/features/document/alignment.d.ts +23 -0
  118. package/src/features/document/alignment.js +36 -0
  119. package/src/features/document/alt-chunk.d.ts +103 -0
  120. package/src/features/document/alt-chunk.js +221 -0
  121. package/src/features/document/assert-never.d.ts +1 -0
  122. package/src/features/document/assert-never.js +4 -0
  123. package/src/features/document/augmentations.d.ts +578 -0
  124. package/src/features/document/augmentations.js +0 -0
  125. package/src/features/document/body-always-on.d.ts +36 -0
  126. package/src/features/document/body-always-on.js +66 -0
  127. package/src/features/document/body-blocks.d.ts +7 -0
  128. package/src/features/document/body-blocks.js +78 -0
  129. package/src/features/document/body-item-adapters.d.ts +62 -0
  130. package/src/features/document/body-item-adapters.js +97 -0
  131. package/src/features/document/body-item-collection.d.ts +151 -0
  132. package/src/features/document/body-item-collection.js +440 -0
  133. package/src/features/document/body-item.d.ts +35 -0
  134. package/src/features/document/body-item.js +8 -0
  135. package/src/features/document/body.d.ts +150 -0
  136. package/src/features/document/body.js +263 -0
  137. package/src/features/document/character-format.d.ts +413 -0
  138. package/src/features/document/character-format.js +2054 -0
  139. package/src/features/document/color.d.ts +178 -0
  140. package/src/features/document/color.js +495 -0
  141. package/src/features/document/document.d.ts +410 -0
  142. package/src/features/document/document.js +1049 -0
  143. package/src/features/document/element-type.d.ts +68 -0
  144. package/src/features/document/element-type.js +133 -0
  145. package/src/features/document/entity-type.d.ts +92 -0
  146. package/src/features/document/entity-type.js +93 -0
  147. package/src/features/document/feature-block.d.ts +16 -0
  148. package/src/features/document/feature-block.js +0 -0
  149. package/src/features/document/feature-inline.d.ts +13 -0
  150. package/src/features/document/feature-inline.js +0 -0
  151. package/src/features/document/feature-multi-package-part.d.ts +19 -0
  152. package/src/features/document/feature-multi-package-part.js +8 -0
  153. package/src/features/document/feature-package-level-part.d.ts +18 -0
  154. package/src/features/document/feature-package-level-part.js +8 -0
  155. package/src/features/document/feature-package-part.d.ts +14 -0
  156. package/src/features/document/feature-package-part.js +0 -0
  157. package/src/features/document/feature-run-leaf.d.ts +9 -0
  158. package/src/features/document/feature-run-leaf.js +0 -0
  159. package/src/features/document/headers-footers.d.ts +206 -0
  160. package/src/features/document/headers-footers.js +384 -0
  161. package/src/features/document/index.d.ts +41 -0
  162. package/src/features/document/index.js +34 -0
  163. package/src/features/document/length.d.ts +152 -0
  164. package/src/features/document/length.js +245 -0
  165. package/src/features/document/load-options.d.ts +14 -0
  166. package/src/features/document/load-options.js +0 -0
  167. package/src/features/document/locale-ids.d.ts +227 -0
  168. package/src/features/document/locale-ids.js +485 -0
  169. package/src/features/document/on-off.d.ts +9 -0
  170. package/src/features/document/on-off.js +27 -0
  171. package/src/features/document/page-setup.d.ts +339 -0
  172. package/src/features/document/page-setup.js +244 -0
  173. package/src/features/document/paragraph-format.d.ts +880 -0
  174. package/src/features/document/paragraph-format.js +2807 -0
  175. package/src/features/document/paragraph-item-collection.d.ts +162 -0
  176. package/src/features/document/paragraph-item-collection.js +363 -0
  177. package/src/features/document/paragraph-item.d.ts +83 -0
  178. package/src/features/document/paragraph-item.js +103 -0
  179. package/src/features/document/paragraph.d.ts +435 -0
  180. package/src/features/document/paragraph.js +888 -0
  181. package/src/features/document/run.d.ts +1 -0
  182. package/src/features/document/run.js +768 -0
  183. package/src/features/document/section-partition-flatten.d.ts +124 -0
  184. package/src/features/document/section-partition-flatten.js +217 -0
  185. package/src/features/document/section-properties-model.d.ts +13 -0
  186. package/src/features/document/section-properties-model.js +0 -0
  187. package/src/features/document/section.d.ts +93 -0
  188. package/src/features/document/section.js +178 -0
  189. package/src/features/document/sections.d.ts +103 -0
  190. package/src/features/document/sections.js +217 -0
  191. package/src/features/document/sub-super-script.d.ts +23 -0
  192. package/src/features/document/sub-super-script.js +43 -0
  193. package/src/features/document/text-range.d.ts +445 -0
  194. package/src/features/document/text-range.js +1156 -0
  195. package/src/features/document/typed-body-collections.d.ts +162 -0
  196. package/src/features/document/typed-body-collections.js +371 -0
  197. package/src/features/document/underline-style.d.ts +38 -0
  198. package/src/features/document/underline-style.js +126 -0
  199. package/src/features/document/units.d.ts +8 -0
  200. package/src/features/document/units.js +7 -0
  201. package/src/features/document/wml.d.ts +16 -0
  202. package/src/features/document/wml.js +67 -0
  203. package/src/features/drawing/authoring.d.ts +27 -0
  204. package/src/features/drawing/authoring.js +271 -0
  205. package/src/features/drawing/body-pr.d.ts +271 -0
  206. package/src/features/drawing/body-pr.js +663 -0
  207. package/src/features/drawing/drawing-shape.d.ts +1192 -0
  208. package/src/features/drawing/drawing-shape.js +3239 -0
  209. package/src/features/drawing/encode-builders.d.ts +176 -0
  210. package/src/features/drawing/encode-builders.js +390 -0
  211. package/src/features/drawing/fill-format.d.ts +52 -0
  212. package/src/features/drawing/fill-format.js +124 -0
  213. package/src/features/drawing/host-codec.d.ts +632 -0
  214. package/src/features/drawing/host-codec.js +2595 -0
  215. package/src/features/drawing/index.d.ts +13 -0
  216. package/src/features/drawing/index.js +33 -0
  217. package/src/features/drawing/line-format.d.ts +76 -0
  218. package/src/features/drawing/line-format.js +343 -0
  219. package/src/features/drawing/parse-register.d.ts +50 -0
  220. package/src/features/drawing/parse-register.js +257 -0
  221. package/src/features/drawing/residual-utils.d.ts +47 -0
  222. package/src/features/drawing/residual-utils.js +290 -0
  223. package/src/features/drawing/shape-types.d.ts +433 -0
  224. package/src/features/drawing/shape-types.js +437 -0
  225. package/src/features/drawing/sp-pr.d.ts +396 -0
  226. package/src/features/drawing/sp-pr.js +610 -0
  227. package/src/features/drawing/text-frame.d.ts +90 -0
  228. package/src/features/drawing/text-frame.js +152 -0
  229. package/src/features/drawing/types.d.ts +352 -0
  230. package/src/features/drawing/types.js +60 -0
  231. package/src/features/drawing/wrap-format.d.ts +62 -0
  232. package/src/features/drawing/wrap-format.js +114 -0
  233. package/src/features/editable-ranges/index.d.ts +494 -0
  234. package/src/features/editable-ranges/index.js +1348 -0
  235. package/src/features/fields/index.d.ts +428 -0
  236. package/src/features/fields/index.js +2148 -0
  237. package/src/features/fields/paragraph-field.d.ts +187 -0
  238. package/src/features/fields/paragraph-field.js +692 -0
  239. package/src/features/font-table/font-substitution-table.d.ts +75 -0
  240. package/src/features/font-table/font-substitution-table.js +257 -0
  241. package/src/features/font-table/font-table-entry.d.ts +255 -0
  242. package/src/features/font-table/font-table-entry.js +823 -0
  243. package/src/features/font-table/font-table.d.ts +128 -0
  244. package/src/features/font-table/font-table.js +313 -0
  245. package/src/features/font-table/index.d.ts +27 -0
  246. package/src/features/font-table/index.js +48 -0
  247. package/src/features/glossary/index.d.ts +97 -0
  248. package/src/features/glossary/index.js +286 -0
  249. package/src/features/headers-footers/index.d.ts +506 -0
  250. package/src/features/headers-footers/index.js +1666 -0
  251. package/src/features/hyperlinks/index.d.ts +230 -0
  252. package/src/features/hyperlinks/index.js +685 -0
  253. package/src/features/images/caption-authoring-api.d.ts +33 -0
  254. package/src/features/images/caption-authoring-api.js +33 -0
  255. package/src/features/images/caption-enums.d.ts +52 -0
  256. package/src/features/images/caption-enums.js +141 -0
  257. package/src/features/images/caption-host.d.ts +10 -0
  258. package/src/features/images/caption-host.js +21 -0
  259. package/src/features/images/captions.d.ts +13 -0
  260. package/src/features/images/captions.js +142 -0
  261. package/src/features/images/host-codec.d.ts +103 -0
  262. package/src/features/images/host-codec.js +720 -0
  263. package/src/features/images/image-sniff.d.ts +21 -0
  264. package/src/features/images/image-sniff.js +71 -0
  265. package/src/features/images/index.d.ts +506 -0
  266. package/src/features/images/index.js +1429 -0
  267. package/src/features/images/layout-types.d.ts +232 -0
  268. package/src/features/images/layout-types.js +294 -0
  269. package/src/features/images/public-entry.d.ts +9 -0
  270. package/src/features/images/public-entry.js +9 -0
  271. package/src/features/index.d.ts +35 -0
  272. package/src/features/index.js +36 -0
  273. package/src/features/mail-merge/index.d.ts +113 -0
  274. package/src/features/mail-merge/index.js +315 -0
  275. package/src/features/notes/index.d.ts +573 -0
  276. package/src/features/notes/index.js +1725 -0
  277. package/src/features/numbering/abstract-numbering.d.ts +90 -0
  278. package/src/features/numbering/abstract-numbering.js +292 -0
  279. package/src/features/numbering/index.d.ts +182 -0
  280. package/src/features/numbering/index.js +668 -0
  281. package/src/features/numbering/list-format.d.ts +158 -0
  282. package/src/features/numbering/list-format.js +590 -0
  283. package/src/features/numbering/list-string.d.ts +7 -0
  284. package/src/features/numbering/list-string.js +423 -0
  285. package/src/features/numbering/list-style.d.ts +204 -0
  286. package/src/features/numbering/list-style.js +1084 -0
  287. package/src/features/numbering/numbering-instance.d.ts +101 -0
  288. package/src/features/numbering/numbering-instance.js +329 -0
  289. package/src/features/numbering/numbering-level.d.ts +118 -0
  290. package/src/features/numbering/numbering-level.js +501 -0
  291. package/src/features/numbering/picture-bullet.d.ts +34 -0
  292. package/src/features/numbering/picture-bullet.js +88 -0
  293. package/src/features/ole-object/catalog.d.ts +300 -0
  294. package/src/features/ole-object/catalog.js +908 -0
  295. package/src/features/ole-object/index.d.ts +526 -0
  296. package/src/features/ole-object/index.js +1421 -0
  297. package/src/features/ole-object/relationship.d.ts +27 -0
  298. package/src/features/ole-object/relationship.js +27 -0
  299. package/src/features/ole-object/typed-dom.d.ts +186 -0
  300. package/src/features/ole-object/typed-dom.js +595 -0
  301. package/src/features/properties/index.d.ts +205 -0
  302. package/src/features/properties/index.js +549 -0
  303. package/src/features/revisions/index.d.ts +204 -0
  304. package/src/features/revisions/index.js +695 -0
  305. package/src/features/sections/column-collection.d.ts +119 -0
  306. package/src/features/sections/column-collection.js +478 -0
  307. package/src/features/sections/column.d.ts +15 -0
  308. package/src/features/sections/column.js +37 -0
  309. package/src/features/sections/index.d.ts +91 -0
  310. package/src/features/sections/index.js +1096 -0
  311. package/src/features/sections/margins.d.ts +40 -0
  312. package/src/features/sections/margins.js +105 -0
  313. package/src/features/sections/page-number-style.d.ts +21 -0
  314. package/src/features/sections/page-number-style.js +62 -0
  315. package/src/features/sections/page-orientation.d.ts +10 -0
  316. package/src/features/sections/page-orientation.js +10 -0
  317. package/src/features/sections/page-setup.d.ts +435 -0
  318. package/src/features/sections/page-setup.js +1479 -0
  319. package/src/features/sections/page-size.d.ts +59 -0
  320. package/src/features/sections/page-size.js +68 -0
  321. package/src/features/sections/section-break-code.d.ts +27 -0
  322. package/src/features/sections/section-break-code.js +60 -0
  323. package/src/features/sections/section-document-association.d.ts +18 -0
  324. package/src/features/sections/section-document-association.js +31 -0
  325. package/src/features/sections/section-validation.d.ts +43 -0
  326. package/src/features/sections/section-validation.js +97 -0
  327. package/src/features/settings/attached-template.d.ts +35 -0
  328. package/src/features/settings/attached-template.js +98 -0
  329. package/src/features/settings/compat-settings.d.ts +216 -0
  330. package/src/features/settings/compat-settings.js +508 -0
  331. package/src/features/settings/document-background.d.ts +59 -0
  332. package/src/features/settings/document-background.js +131 -0
  333. package/src/features/settings/document-protection.d.ts +65 -0
  334. package/src/features/settings/document-protection.js +157 -0
  335. package/src/features/settings/document-settings-facades.d.ts +108 -0
  336. package/src/features/settings/document-settings-facades.js +312 -0
  337. package/src/features/settings/document-settings-values.d.ts +43 -0
  338. package/src/features/settings/document-settings-values.js +60 -0
  339. package/src/features/settings/footnote-properties.d.ts +211 -0
  340. package/src/features/settings/footnote-properties.js +591 -0
  341. package/src/features/settings/index.d.ts +356 -0
  342. package/src/features/settings/index.js +829 -0
  343. package/src/features/settings/settings-children.d.ts +151 -0
  344. package/src/features/settings/settings-children.js +505 -0
  345. package/src/features/settings/web-settings.d.ts +88 -0
  346. package/src/features/settings/web-settings.js +227 -0
  347. package/src/features/settings/zoom.d.ts +79 -0
  348. package/src/features/settings/zoom.js +147 -0
  349. package/src/features/styles/builtin-catalog.d.ts +159 -0
  350. package/src/features/styles/builtin-catalog.js +963 -0
  351. package/src/features/styles/builtin-resolver.d.ts +49 -0
  352. package/src/features/styles/builtin-resolver.js +165 -0
  353. package/src/features/styles/default-styles.d.ts +37 -0
  354. package/src/features/styles/default-styles.js +186 -0
  355. package/src/features/styles/default-theme.d.ts +13 -0
  356. package/src/features/styles/default-theme.js +13 -0
  357. package/src/features/styles/doc-defaults.d.ts +58 -0
  358. package/src/features/styles/doc-defaults.js +178 -0
  359. package/src/features/styles/formatting-resolver.d.ts +27 -0
  360. package/src/features/styles/formatting-resolver.js +72 -0
  361. package/src/features/styles/index.d.ts +256 -0
  362. package/src/features/styles/index.js +1325 -0
  363. package/src/features/styles/latent-styles.d.ts +68 -0
  364. package/src/features/styles/latent-styles.js +305 -0
  365. package/src/features/styles/paragraph-properties.d.ts +71 -0
  366. package/src/features/styles/paragraph-properties.js +237 -0
  367. package/src/features/styles/run-properties.d.ts +93 -0
  368. package/src/features/styles/run-properties.js +516 -0
  369. package/src/features/styles/style-base.d.ts +402 -0
  370. package/src/features/styles/style-base.js +1026 -0
  371. package/src/features/styles/style-collection.d.ts +264 -0
  372. package/src/features/styles/style-collection.js +714 -0
  373. package/src/features/styles/style-format-bridge.d.ts +64 -0
  374. package/src/features/styles/style-format-bridge.js +100 -0
  375. package/src/features/styles/style.d.ts +84 -0
  376. package/src/features/styles/style.js +375 -0
  377. package/src/features/styles/styles-with-effects.d.ts +71 -0
  378. package/src/features/styles/styles-with-effects.js +180 -0
  379. package/src/features/styles/table-style.d.ts +272 -0
  380. package/src/features/styles/table-style.js +1226 -0
  381. package/src/features/styles/theme.d.ts +126 -0
  382. package/src/features/styles/theme.js +377 -0
  383. package/src/features/tables/border-style-map.d.ts +24 -0
  384. package/src/features/tables/border-style-map.js +81 -0
  385. package/src/features/tables/borders.d.ts +126 -0
  386. package/src/features/tables/borders.js +527 -0
  387. package/src/features/tables/collections.d.ts +113 -0
  388. package/src/features/tables/collections.js +261 -0
  389. package/src/features/tables/format.d.ts +208 -0
  390. package/src/features/tables/format.js +716 -0
  391. package/src/features/tables/index.d.ts +597 -0
  392. package/src/features/tables/index.js +2386 -0
  393. package/src/features/tables/paddings.d.ts +41 -0
  394. package/src/features/tables/paddings.js +97 -0
  395. package/src/features/tables/tbl-pr-positioning.d.ts +27 -0
  396. package/src/features/tables/tbl-pr-positioning.js +178 -0
  397. package/src/features/tables/tbl-pr.d.ts +528 -0
  398. package/src/features/tables/tbl-pr.js +1208 -0
  399. package/src/features/tables/tc-pr.d.ts +168 -0
  400. package/src/features/tables/tc-pr.js +553 -0
  401. package/src/features/tables/tr-pr.d.ts +60 -0
  402. package/src/features/tables/tr-pr.js +215 -0
  403. package/src/features/watermark/detect.d.ts +76 -0
  404. package/src/features/watermark/detect.js +219 -0
  405. package/src/features/watermark/index.d.ts +28 -0
  406. package/src/features/watermark/index.js +91 -0
  407. package/src/features/watermark/logical-store.d.ts +29 -0
  408. package/src/features/watermark/logical-store.js +31 -0
  409. package/src/features/watermark/model.d.ts +285 -0
  410. package/src/features/watermark/model.js +597 -0
  411. package/src/features/watermark/parse.d.ts +84 -0
  412. package/src/features/watermark/parse.js +815 -0
  413. package/src/features/watermark/serialize.d.ts +98 -0
  414. package/src/features/watermark/serialize.js +1517 -0
  415. package/src/global.js +1 -0
  416. package/src/index.d.ts +2 -0
  417. package/src/index.js +2 -0
@@ -0,0 +1,2054 @@
1
+ var __values = (this && this.__values) || function (o) {
2
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
3
+ if (m) return m.call(o);
4
+ return {
5
+ next: function () {
6
+ if (o && i >= o.length) o = void 0;
7
+ return { value: o && o[i++], done: !o };
8
+ }
9
+ };
10
+ };
11
+ import { parseOnOff, serializeOnOff } from './on-off';
12
+ import { halfPoints, halfPointsToPoint, lengthToHalfPoints, pointToTwips, twipsToPoint, } from './length';
13
+ import { elementChildren, isWml, wValAttribute, wmlAttr, wmlElement, } from './wml';
14
+ import { Color, colorFromWire, colorToHexWire, colorToHighlightWire, highlightWireToColor, } from './color';
15
+ import { localeIdFromBcp47, localeIdToBcp47 } from './locale-ids';
16
+ import { SubSuperScript, subSuperScriptFromWire, subSuperScriptToWire } from './sub-super-script';
17
+ import { UnderlineStyle, underlineStyleFromWire, underlineStyleToWire, } from './underline-style';
18
+ export { SubSuperScript } from './sub-super-script';
19
+ var MODELED_RPR = new Set([
20
+ 'rStyle',
21
+ 'rFonts',
22
+ 'b',
23
+ 'bCs',
24
+ 'i',
25
+ 'iCs',
26
+ 'caps',
27
+ 'smallCaps',
28
+ 'strike',
29
+ 'dstrike',
30
+ 'outline',
31
+ 'shadow',
32
+ 'emboss',
33
+ 'imprint',
34
+ 'snapToGrid',
35
+ 'vanish',
36
+ 'webHidden',
37
+ 'noProof',
38
+ 'hidden',
39
+ 'specVanish',
40
+ 'color',
41
+ 'spacing',
42
+ 'w',
43
+ 'kern',
44
+ 'position',
45
+ 'sz',
46
+ 'szCs',
47
+ 'highlight',
48
+ 'u',
49
+ 'vertAlign',
50
+ 'lang',
51
+ 'em',
52
+ 'effect',
53
+ 'shd',
54
+ 'bdr',
55
+ 'cs',
56
+ 'rtl',
57
+ ]);
58
+ /** Parked only — Group C / complex. */
59
+ var RPR_EXTRA_ONLY = new Set(['rPrChange', 'oMath', 'eastAsianLayout', 'fitText']);
60
+ var HIGHLIGHT_COLORS = new Set([
61
+ 'black',
62
+ 'blue',
63
+ 'cyan',
64
+ 'darkBlue',
65
+ 'darkCyan',
66
+ 'darkGray',
67
+ 'darkGreen',
68
+ 'darkMagenta',
69
+ 'darkRed',
70
+ 'darkYellow',
71
+ 'green',
72
+ 'lightGray',
73
+ 'magenta',
74
+ 'none',
75
+ 'red',
76
+ 'white',
77
+ 'yellow',
78
+ ]);
79
+ var UNDERLINE_STYLES = new Set([
80
+ 'single',
81
+ 'words',
82
+ 'double',
83
+ 'thick',
84
+ 'dotted',
85
+ 'dottedHeavy',
86
+ 'dash',
87
+ 'dashedHeavy',
88
+ 'dashLong',
89
+ 'dashLongHeavy',
90
+ 'dotDash',
91
+ 'dotDashHeavy',
92
+ 'dotDotDash',
93
+ 'dotDotDashHeavy',
94
+ 'wave',
95
+ 'wavyHeavy',
96
+ 'wavyDouble',
97
+ 'none',
98
+ ]);
99
+ var EMPHASIS_MARKS = new Set(['none', 'dot', 'comma', 'circle', 'underDot']);
100
+ var TEXT_EFFECTS = new Set([
101
+ 'none',
102
+ 'blinkBackground',
103
+ 'lights',
104
+ 'antsBlack',
105
+ 'antsRed',
106
+ 'shimmer',
107
+ 'sparkle',
108
+ 'movie',
109
+ ]);
110
+ function pointToSignedHalfPoints(points) {
111
+ return Math.round(points * 2);
112
+ }
113
+ function parseDecimalVal(raw) {
114
+ if (raw === undefined || !/^-?\d+$/.test(raw)) {
115
+ return undefined;
116
+ }
117
+ return Number.parseInt(raw, 10);
118
+ }
119
+ function wmlAttrVal(el, localName) {
120
+ var __ts33_0;
121
+ return ((__ts33_0 = el.attributes.find(function (a) {
122
+ return a.localName === localName && (a.prefix === 'w' || a.prefix === '');
123
+ })),
124
+ __ts33_0 == null ? undefined : __ts33_0.value);
125
+ }
126
+ function emptySnapshot() {
127
+ return {
128
+ rPrExtra: [],
129
+ styleIdValue: undefined,
130
+ boldValue: undefined,
131
+ italicValue: undefined,
132
+ strikeValue: undefined,
133
+ doubleStrikeValue: undefined,
134
+ vanishValue: undefined,
135
+ legacyHiddenValue: undefined,
136
+ noProofValue: undefined,
137
+ fontSizeValue: undefined,
138
+ fontSizeBidiValue: undefined,
139
+ textColorValue: undefined,
140
+ textColorTheme: undefined,
141
+ highlightValue: undefined,
142
+ shadingValue: undefined,
143
+ underlineStyleValue: undefined,
144
+ underlineColorValue: undefined,
145
+ vertAlignValue: undefined,
146
+ smallCapsValue: undefined,
147
+ allCapsValue: undefined,
148
+ fontsValue: undefined,
149
+ characterScaleValue: undefined,
150
+ kerningValue: undefined,
151
+ characterSpacingValue: undefined,
152
+ positionValue: undefined,
153
+ borderValue: undefined,
154
+ languageValue: undefined,
155
+ embossValue: undefined,
156
+ imprintValue: undefined,
157
+ outlineValue: undefined,
158
+ shadowValue: undefined,
159
+ webHiddenValue: undefined,
160
+ bidiValue: undefined,
161
+ complexScriptValue: undefined,
162
+ boldBidiValue: undefined,
163
+ italicBidiValue: undefined,
164
+ emphasisValue: undefined,
165
+ textEffectValue: undefined,
166
+ specVanishValue: undefined,
167
+ snapToGridValue: undefined,
168
+ };
169
+ }
170
+ function validateFontSizePoints(name, value) {
171
+ if (!(value > 0 && value <= 1638)) {
172
+ throw new RangeError(name + ' must be in (0, 1638] points, got ' + String(value));
173
+ }
174
+ }
175
+ function validateSignedExtentPoints(name, value) {
176
+ if (value < -1584 || value > 1584) {
177
+ throw new RangeError(name + ' must be in [-1584, 1584] points, got ' + String(value));
178
+ }
179
+ }
180
+ function ensureFonts(record) {
181
+ if (record !== undefined) {
182
+ return record;
183
+ }
184
+ return {};
185
+ }
186
+ function fontsRecordIsEmpty(f) {
187
+ return (f.ascii === undefined &&
188
+ f.hAnsi === undefined &&
189
+ f.cs === undefined &&
190
+ f.eastAsia === undefined &&
191
+ f.hint === undefined &&
192
+ f.asciiTheme === undefined &&
193
+ f.hAnsiTheme === undefined &&
194
+ f.eastAsiaTheme === undefined &&
195
+ f.cTheme === undefined);
196
+ }
197
+ function pushOnOff(children, localName, value) {
198
+ if (value === undefined) {
199
+ return;
200
+ }
201
+ children.push(serializeOnOff(localName, value));
202
+ }
203
+ // ---------------------------------------------------------------------------
204
+ // Parse helpers
205
+ // ---------------------------------------------------------------------------
206
+ function parseHighlight(el) {
207
+ var raw = wValAttribute(el);
208
+ if (raw === undefined || !HIGHLIGHT_COLORS.has(raw)) {
209
+ return undefined;
210
+ }
211
+ return raw;
212
+ }
213
+ function parseUnderline(el) {
214
+ var attr = wmlAttrVal(el, 'val');
215
+ var raw = attr !== undefined ? attr : 'single';
216
+ if (!UNDERLINE_STYLES.has(raw)) {
217
+ return undefined;
218
+ }
219
+ var color = wmlAttrVal(el, 'color');
220
+ if (color !== undefined) {
221
+ return { style: raw, color: color };
222
+ }
223
+ return { style: raw };
224
+ }
225
+ function parseRunFonts(el) {
226
+ var ascii = wmlAttrVal(el, 'ascii');
227
+ var hAnsi = wmlAttrVal(el, 'hAnsi');
228
+ var cs = wmlAttrVal(el, 'cs');
229
+ var eastAsia = wmlAttrVal(el, 'eastAsia');
230
+ var hint = wmlAttrVal(el, 'hint');
231
+ var asciiTheme = wmlAttrVal(el, 'asciiTheme');
232
+ var hAnsiTheme = wmlAttrVal(el, 'hAnsiTheme');
233
+ var eastAsiaTheme = wmlAttrVal(el, 'eastAsiaTheme');
234
+ var cTheme = wmlAttrVal(el, 'cTheme');
235
+ var out = {};
236
+ if (ascii !== undefined) {
237
+ out.ascii = ascii;
238
+ }
239
+ if (hAnsi !== undefined) {
240
+ out.hAnsi = hAnsi;
241
+ }
242
+ if (cs !== undefined) {
243
+ out.cs = cs;
244
+ }
245
+ if (eastAsia !== undefined) {
246
+ out.eastAsia = eastAsia;
247
+ }
248
+ if (hint !== undefined) {
249
+ out.hint = hint;
250
+ }
251
+ if (asciiTheme !== undefined) {
252
+ out.asciiTheme = asciiTheme;
253
+ }
254
+ if (hAnsiTheme !== undefined) {
255
+ out.hAnsiTheme = hAnsiTheme;
256
+ }
257
+ if (eastAsiaTheme !== undefined) {
258
+ out.eastAsiaTheme = eastAsiaTheme;
259
+ }
260
+ if (cTheme !== undefined) {
261
+ out.cTheme = cTheme;
262
+ }
263
+ return out;
264
+ }
265
+ function parseCharacterScale(el) {
266
+ var n = parseDecimalVal(wValAttribute(el));
267
+ if (n === undefined || n < 1 || n > 600) {
268
+ return undefined;
269
+ }
270
+ return n;
271
+ }
272
+ function parseKerning(el) {
273
+ var n = parseDecimalVal(wValAttribute(el));
274
+ if (n === undefined || n < 0) {
275
+ return undefined;
276
+ }
277
+ return n;
278
+ }
279
+ function parseCharacterSpacing(el) {
280
+ return parseDecimalVal(wValAttribute(el));
281
+ }
282
+ function parsePosition(el) {
283
+ return parseDecimalVal(wValAttribute(el));
284
+ }
285
+ function parseRunBorder(el) {
286
+ var style = wmlAttrVal(el, 'val');
287
+ if (style === undefined) {
288
+ return undefined;
289
+ }
290
+ var color = wmlAttrVal(el, 'color');
291
+ var sz = parseDecimalVal(wmlAttrVal(el, 'sz'));
292
+ var space = parseDecimalVal(wmlAttrVal(el, 'space'));
293
+ if (color !== undefined && sz !== undefined && space !== undefined) {
294
+ return { style: style, color: color, size: sz, space: space };
295
+ }
296
+ if (color !== undefined && sz !== undefined) {
297
+ return { style: style, color: color, size: sz };
298
+ }
299
+ if (color !== undefined && space !== undefined) {
300
+ return { style: style, color: color, space: space };
301
+ }
302
+ if (sz !== undefined && space !== undefined) {
303
+ return { style: style, size: sz, space: space };
304
+ }
305
+ if (color !== undefined) {
306
+ return { style: style, color: color };
307
+ }
308
+ if (sz !== undefined) {
309
+ return { style: style, size: sz };
310
+ }
311
+ if (space !== undefined) {
312
+ return { style: style, space: space };
313
+ }
314
+ return { style: style };
315
+ }
316
+ function parseRunShading(el) {
317
+ var fill = wmlAttrVal(el, 'fill');
318
+ var color = wmlAttrVal(el, 'color');
319
+ var pattern = wmlAttrVal(el, 'val');
320
+ var out = {};
321
+ if (fill !== undefined) {
322
+ out.fill = fill;
323
+ }
324
+ if (color !== undefined) {
325
+ out.color = color;
326
+ }
327
+ if (pattern !== undefined) {
328
+ out.pattern = pattern;
329
+ }
330
+ return out;
331
+ }
332
+ function parseRunLanguage(el) {
333
+ var val = wmlAttrVal(el, 'val');
334
+ var bidi = wmlAttrVal(el, 'bidi');
335
+ var eastAsia = wmlAttrVal(el, 'eastAsia');
336
+ if (val !== undefined && bidi !== undefined && eastAsia !== undefined) {
337
+ return { latin: val, bidi: bidi, eastAsia: eastAsia };
338
+ }
339
+ if (val !== undefined && bidi !== undefined) {
340
+ return { latin: val, bidi: bidi };
341
+ }
342
+ if (val !== undefined && eastAsia !== undefined) {
343
+ return { latin: val, eastAsia: eastAsia };
344
+ }
345
+ if (bidi !== undefined && eastAsia !== undefined) {
346
+ return { bidi: bidi, eastAsia: eastAsia };
347
+ }
348
+ if (val !== undefined) {
349
+ return { latin: val };
350
+ }
351
+ if (bidi !== undefined) {
352
+ return { bidi: bidi };
353
+ }
354
+ if (eastAsia !== undefined) {
355
+ return { eastAsia: eastAsia };
356
+ }
357
+ return {};
358
+ }
359
+ function parseVertAlign(el) {
360
+ var raw = wValAttribute(el);
361
+ if (raw === 'baseline' || raw === 'superscript' || raw === 'subscript') {
362
+ return raw;
363
+ }
364
+ return undefined;
365
+ }
366
+ function parseEmphasis(el) {
367
+ var raw = wValAttribute(el);
368
+ if (raw === undefined || !EMPHASIS_MARKS.has(raw)) {
369
+ return undefined;
370
+ }
371
+ return raw;
372
+ }
373
+ function parseTextEffect(el) {
374
+ var raw = wValAttribute(el);
375
+ if (raw === undefined || !TEXT_EFFECTS.has(raw)) {
376
+ return undefined;
377
+ }
378
+ return raw;
379
+ }
380
+ function parseColorPair(el) {
381
+ var value = wmlAttrVal(el, 'val');
382
+ if (value === undefined) {
383
+ return undefined;
384
+ }
385
+ var themeColor = wmlAttrVal(el, 'themeColor');
386
+ if (themeColor !== undefined) {
387
+ return { value: value, themeColor: themeColor };
388
+ }
389
+ return { value: value };
390
+ }
391
+ /**
392
+ * Parse `w:rPr` children into a {@link CharacterFormatSnapshot}.
393
+ * Invalid modeled markup is parked in `rPrExtra` (never throws on load).
394
+ *
395
+ * @private
396
+ */
397
+ export function parseCharacterFormat(rPrElement) {
398
+ var e_1, _a;
399
+ var snap = emptySnapshot();
400
+ var rPrExtra = [];
401
+ try {
402
+ for (var _b = __values(elementChildren(rPrElement)), _c = _b.next(); !_c.done; _c = _b.next()) {
403
+ var prop = _c.value;
404
+ if (!isWml(prop, prop.localName)) {
405
+ rPrExtra.push(prop);
406
+ continue;
407
+ }
408
+ if (RPR_EXTRA_ONLY.has(prop.localName)) {
409
+ rPrExtra.push(prop);
410
+ continue;
411
+ }
412
+ if (!MODELED_RPR.has(prop.localName)) {
413
+ rPrExtra.push(prop);
414
+ continue;
415
+ }
416
+ if (prop.localName === 'rStyle') {
417
+ snap.styleIdValue = wValAttribute(prop);
418
+ continue;
419
+ }
420
+ if (prop.localName === 'sz') {
421
+ var raw = wValAttribute(prop);
422
+ if (raw !== undefined && /^\d+$/.test(raw)) {
423
+ snap.fontSizeValue = halfPoints(Number.parseInt(raw, 10));
424
+ }
425
+ else {
426
+ rPrExtra.push(prop);
427
+ }
428
+ continue;
429
+ }
430
+ if (prop.localName === 'szCs') {
431
+ var raw = wValAttribute(prop);
432
+ if (raw !== undefined && /^\d+$/.test(raw)) {
433
+ snap.fontSizeBidiValue = halfPoints(Number.parseInt(raw, 10));
434
+ }
435
+ else {
436
+ rPrExtra.push(prop);
437
+ }
438
+ continue;
439
+ }
440
+ if (prop.localName === 'color') {
441
+ var parsed = parseColorPair(prop);
442
+ if (parsed === undefined) {
443
+ rPrExtra.push(prop);
444
+ }
445
+ else {
446
+ snap.textColorValue = parsed.value;
447
+ snap.textColorTheme = parsed.themeColor;
448
+ }
449
+ continue;
450
+ }
451
+ if (prop.localName === 'highlight') {
452
+ var parsed = parseHighlight(prop);
453
+ if (parsed === undefined) {
454
+ rPrExtra.push(prop);
455
+ }
456
+ else {
457
+ snap.highlightValue = parsed;
458
+ }
459
+ continue;
460
+ }
461
+ if (prop.localName === 'shd') {
462
+ snap.shadingValue = parseRunShading(prop);
463
+ continue;
464
+ }
465
+ if (prop.localName === 'u') {
466
+ var parsed = parseUnderline(prop);
467
+ if (parsed === undefined) {
468
+ rPrExtra.push(prop);
469
+ }
470
+ else {
471
+ snap.underlineStyleValue = parsed.style;
472
+ snap.underlineColorValue = parsed.color;
473
+ }
474
+ continue;
475
+ }
476
+ if (prop.localName === 'vertAlign') {
477
+ var parsed = parseVertAlign(prop);
478
+ if (parsed === undefined) {
479
+ rPrExtra.push(prop);
480
+ }
481
+ else {
482
+ snap.vertAlignValue = parsed;
483
+ }
484
+ continue;
485
+ }
486
+ if (prop.localName === 'rFonts') {
487
+ snap.fontsValue = parseRunFonts(prop);
488
+ continue;
489
+ }
490
+ if (prop.localName === 'w') {
491
+ var parsed = parseCharacterScale(prop);
492
+ if (parsed === undefined) {
493
+ rPrExtra.push(prop);
494
+ }
495
+ else {
496
+ snap.characterScaleValue = parsed;
497
+ }
498
+ continue;
499
+ }
500
+ if (prop.localName === 'kern') {
501
+ var parsed = parseKerning(prop);
502
+ if (parsed === undefined) {
503
+ rPrExtra.push(prop);
504
+ }
505
+ else {
506
+ snap.kerningValue = parsed;
507
+ }
508
+ continue;
509
+ }
510
+ if (prop.localName === 'spacing') {
511
+ var parsed = parseCharacterSpacing(prop);
512
+ if (parsed === undefined) {
513
+ rPrExtra.push(prop);
514
+ }
515
+ else {
516
+ snap.characterSpacingValue = parsed;
517
+ }
518
+ continue;
519
+ }
520
+ if (prop.localName === 'position') {
521
+ var parsed = parsePosition(prop);
522
+ if (parsed === undefined) {
523
+ rPrExtra.push(prop);
524
+ }
525
+ else {
526
+ snap.positionValue = parsed;
527
+ }
528
+ continue;
529
+ }
530
+ if (prop.localName === 'bdr') {
531
+ var parsed = parseRunBorder(prop);
532
+ if (parsed === undefined) {
533
+ rPrExtra.push(prop);
534
+ }
535
+ else {
536
+ snap.borderValue = parsed;
537
+ }
538
+ continue;
539
+ }
540
+ if (prop.localName === 'lang') {
541
+ snap.languageValue = parseRunLanguage(prop);
542
+ continue;
543
+ }
544
+ if (prop.localName === 'em') {
545
+ var parsed = parseEmphasis(prop);
546
+ if (parsed === undefined) {
547
+ rPrExtra.push(prop);
548
+ }
549
+ else {
550
+ snap.emphasisValue = parsed;
551
+ }
552
+ continue;
553
+ }
554
+ if (prop.localName === 'effect') {
555
+ var parsed = parseTextEffect(prop);
556
+ if (parsed === undefined) {
557
+ rPrExtra.push(prop);
558
+ }
559
+ else {
560
+ snap.textEffectValue = parsed;
561
+ }
562
+ continue;
563
+ }
564
+ var flag = parseOnOff(prop);
565
+ if (flag === undefined) {
566
+ rPrExtra.push(prop);
567
+ continue;
568
+ }
569
+ if (prop.localName === 'b') {
570
+ snap.boldValue = flag;
571
+ }
572
+ else if (prop.localName === 'bCs') {
573
+ snap.boldBidiValue = flag;
574
+ }
575
+ else if (prop.localName === 'i') {
576
+ snap.italicValue = flag;
577
+ }
578
+ else if (prop.localName === 'iCs') {
579
+ snap.italicBidiValue = flag;
580
+ }
581
+ else if (prop.localName === 'strike') {
582
+ snap.strikeValue = flag;
583
+ }
584
+ else if (prop.localName === 'dstrike') {
585
+ snap.doubleStrikeValue = flag;
586
+ }
587
+ else if (prop.localName === 'vanish') {
588
+ snap.vanishValue = flag;
589
+ }
590
+ else if (prop.localName === 'noProof') {
591
+ snap.noProofValue = flag;
592
+ }
593
+ else if (prop.localName === 'smallCaps') {
594
+ snap.smallCapsValue = flag;
595
+ }
596
+ else if (prop.localName === 'caps') {
597
+ snap.allCapsValue = flag;
598
+ }
599
+ else if (prop.localName === 'hidden') {
600
+ // Legacy element — public `hidden` maps to `w:vanish`. Preserve for RT.
601
+ snap.legacyHiddenValue = flag;
602
+ }
603
+ else if (prop.localName === 'emboss') {
604
+ snap.embossValue = flag;
605
+ }
606
+ else if (prop.localName === 'imprint') {
607
+ snap.imprintValue = flag;
608
+ }
609
+ else if (prop.localName === 'outline') {
610
+ snap.outlineValue = flag;
611
+ }
612
+ else if (prop.localName === 'shadow') {
613
+ snap.shadowValue = flag;
614
+ }
615
+ else if (prop.localName === 'webHidden') {
616
+ snap.webHiddenValue = flag;
617
+ }
618
+ else if (prop.localName === 'cs') {
619
+ snap.complexScriptValue = flag;
620
+ }
621
+ else if (prop.localName === 'rtl') {
622
+ snap.bidiValue = flag;
623
+ }
624
+ else if (prop.localName === 'specVanish') {
625
+ snap.specVanishValue = flag;
626
+ }
627
+ else if (prop.localName === 'snapToGrid') {
628
+ snap.snapToGridValue = flag;
629
+ }
630
+ else {
631
+ rPrExtra.push(prop);
632
+ }
633
+ }
634
+ }
635
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
636
+ finally {
637
+ try {
638
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
639
+ }
640
+ finally { if (e_1) throw e_1.error; }
641
+ }
642
+ snap.rPrExtra = rPrExtra;
643
+ return snap;
644
+ }
645
+ // ---------------------------------------------------------------------------
646
+ // Serialize helpers
647
+ // ---------------------------------------------------------------------------
648
+ function serializeRunColor(value, themeColor) {
649
+ var attrs = [wmlAttr('val', value)];
650
+ if (themeColor !== undefined) {
651
+ attrs.push(wmlAttr('themeColor', themeColor));
652
+ }
653
+ return wmlElement('color', { attributes: attrs });
654
+ }
655
+ function serializeUnderline(style, color) {
656
+ var attrs = [wmlAttr('val', style)];
657
+ if (color !== undefined) {
658
+ attrs.push(wmlAttr('color', color));
659
+ }
660
+ return wmlElement('u', { attributes: attrs });
661
+ }
662
+ function ensureLanguage(record) {
663
+ if (record !== undefined) {
664
+ return {
665
+ latin: record.latin,
666
+ bidi: record.bidi,
667
+ eastAsia: record.eastAsia,
668
+ };
669
+ }
670
+ return {};
671
+ }
672
+ function languageRecordIsEmpty(lang) {
673
+ return lang.latin === undefined && lang.bidi === undefined && lang.eastAsia === undefined;
674
+ }
675
+ function setLocaleIdField(current, field, value) {
676
+ var next = ensureLanguage(current);
677
+ if (value === undefined) {
678
+ next[field] = undefined;
679
+ }
680
+ else {
681
+ var tag = localeIdToBcp47(value);
682
+ next[field] = tag !== undefined ? tag : undefined;
683
+ }
684
+ return languageRecordIsEmpty(next) ? undefined : next;
685
+ }
686
+ function getLocaleIdField(current, field) {
687
+ if (current === undefined) {
688
+ return undefined;
689
+ }
690
+ var tag = current[field];
691
+ if (tag === undefined) {
692
+ return undefined;
693
+ }
694
+ return localeIdFromBcp47(tag);
695
+ }
696
+ function colorToWireOrUndefined(value) {
697
+ if (value === undefined) {
698
+ return undefined;
699
+ }
700
+ return colorToHexWire(value);
701
+ }
702
+ function wireColorToEnum(value) {
703
+ if (value === undefined) {
704
+ return undefined;
705
+ }
706
+ return colorFromWire(value);
707
+ }
708
+ function serializeRunFonts(fonts) {
709
+ var attrs = [];
710
+ if (fonts.ascii !== undefined) {
711
+ attrs.push(wmlAttr('ascii', fonts.ascii));
712
+ }
713
+ if (fonts.hAnsi !== undefined) {
714
+ attrs.push(wmlAttr('hAnsi', fonts.hAnsi));
715
+ }
716
+ if (fonts.cs !== undefined) {
717
+ attrs.push(wmlAttr('cs', fonts.cs));
718
+ }
719
+ if (fonts.eastAsia !== undefined) {
720
+ attrs.push(wmlAttr('eastAsia', fonts.eastAsia));
721
+ }
722
+ if (fonts.hint !== undefined) {
723
+ attrs.push(wmlAttr('hint', fonts.hint));
724
+ }
725
+ if (fonts.asciiTheme !== undefined) {
726
+ attrs.push(wmlAttr('asciiTheme', fonts.asciiTheme));
727
+ }
728
+ if (fonts.hAnsiTheme !== undefined) {
729
+ attrs.push(wmlAttr('hAnsiTheme', fonts.hAnsiTheme));
730
+ }
731
+ if (fonts.eastAsiaTheme !== undefined) {
732
+ attrs.push(wmlAttr('eastAsiaTheme', fonts.eastAsiaTheme));
733
+ }
734
+ if (fonts.cTheme !== undefined) {
735
+ attrs.push(wmlAttr('cTheme', fonts.cTheme));
736
+ }
737
+ return wmlElement('rFonts', { attributes: attrs });
738
+ }
739
+ function serializeRunBorder(edge) {
740
+ var attrs = [wmlAttr('val', edge.style)];
741
+ if (edge.color !== undefined) {
742
+ attrs.push(wmlAttr('color', edge.color));
743
+ }
744
+ if (edge.size !== undefined) {
745
+ attrs.push(wmlAttr('sz', String(edge.size)));
746
+ }
747
+ if (edge.space !== undefined) {
748
+ attrs.push(wmlAttr('space', String(edge.space)));
749
+ }
750
+ return wmlElement('bdr', { attributes: attrs });
751
+ }
752
+ function serializeRunShading(shd) {
753
+ var attrs = [];
754
+ if (shd.pattern !== undefined) {
755
+ attrs.push(wmlAttr('val', shd.pattern));
756
+ }
757
+ if (shd.color !== undefined) {
758
+ attrs.push(wmlAttr('color', shd.color));
759
+ }
760
+ if (shd.fill !== undefined) {
761
+ attrs.push(wmlAttr('fill', shd.fill));
762
+ }
763
+ return wmlElement('shd', { attributes: attrs });
764
+ }
765
+ function serializeRunLanguage(lang) {
766
+ var attrs = [];
767
+ if (lang.latin !== undefined) {
768
+ attrs.push(wmlAttr('val', lang.latin));
769
+ }
770
+ if (lang.bidi !== undefined) {
771
+ attrs.push(wmlAttr('bidi', lang.bidi));
772
+ }
773
+ if (lang.eastAsia !== undefined) {
774
+ attrs.push(wmlAttr('eastAsia', lang.eastAsia));
775
+ }
776
+ return wmlElement('lang', { attributes: attrs });
777
+ }
778
+ /**
779
+ * Build `w:rPr` children in Spec §7.2 house order.
780
+ * @private
781
+ */
782
+ export function buildRPrChildrenFromSnapshot(snap) {
783
+ var rPrChildren = [];
784
+ if (snap.styleIdValue !== undefined) {
785
+ rPrChildren.push(wmlElement('rStyle', { attributes: [wmlAttr('val', snap.styleIdValue)] }));
786
+ }
787
+ if (snap.fontsValue !== undefined && !fontsRecordIsEmpty(snap.fontsValue)) {
788
+ rPrChildren.push(serializeRunFonts(snap.fontsValue));
789
+ }
790
+ pushOnOff(rPrChildren, 'b', snap.boldValue);
791
+ pushOnOff(rPrChildren, 'bCs', snap.boldBidiValue);
792
+ pushOnOff(rPrChildren, 'i', snap.italicValue);
793
+ pushOnOff(rPrChildren, 'iCs', snap.italicBidiValue);
794
+ pushOnOff(rPrChildren, 'caps', snap.allCapsValue);
795
+ pushOnOff(rPrChildren, 'smallCaps', snap.smallCapsValue);
796
+ pushOnOff(rPrChildren, 'strike', snap.strikeValue);
797
+ pushOnOff(rPrChildren, 'dstrike', snap.doubleStrikeValue);
798
+ pushOnOff(rPrChildren, 'outline', snap.outlineValue);
799
+ pushOnOff(rPrChildren, 'shadow', snap.shadowValue);
800
+ pushOnOff(rPrChildren, 'emboss', snap.embossValue);
801
+ pushOnOff(rPrChildren, 'imprint', snap.imprintValue);
802
+ pushOnOff(rPrChildren, 'snapToGrid', snap.snapToGridValue);
803
+ pushOnOff(rPrChildren, 'vanish', snap.vanishValue);
804
+ pushOnOff(rPrChildren, 'webHidden', snap.webHiddenValue);
805
+ pushOnOff(rPrChildren, 'noProof', snap.noProofValue);
806
+ pushOnOff(rPrChildren, 'hidden', snap.legacyHiddenValue);
807
+ pushOnOff(rPrChildren, 'specVanish', snap.specVanishValue);
808
+ if (snap.textColorValue !== undefined) {
809
+ rPrChildren.push(serializeRunColor(snap.textColorValue, snap.textColorTheme));
810
+ }
811
+ if (snap.characterSpacingValue !== undefined) {
812
+ rPrChildren.push(wmlElement('spacing', {
813
+ attributes: [wmlAttr('val', String(snap.characterSpacingValue))],
814
+ }));
815
+ }
816
+ if (snap.characterScaleValue !== undefined) {
817
+ rPrChildren.push(wmlElement('w', { attributes: [wmlAttr('val', String(snap.characterScaleValue))] }));
818
+ }
819
+ if (snap.kerningValue !== undefined) {
820
+ rPrChildren.push(wmlElement('kern', { attributes: [wmlAttr('val', String(snap.kerningValue))] }));
821
+ }
822
+ if (snap.positionValue !== undefined) {
823
+ rPrChildren.push(wmlElement('position', { attributes: [wmlAttr('val', String(snap.positionValue))] }));
824
+ }
825
+ if (snap.fontSizeValue !== undefined) {
826
+ rPrChildren.push(wmlElement('sz', { attributes: [wmlAttr('val', String(snap.fontSizeValue))] }));
827
+ }
828
+ if (snap.fontSizeBidiValue !== undefined) {
829
+ rPrChildren.push(wmlElement('szCs', { attributes: [wmlAttr('val', String(snap.fontSizeBidiValue))] }));
830
+ }
831
+ if (snap.highlightValue !== undefined) {
832
+ rPrChildren.push(wmlElement('highlight', { attributes: [wmlAttr('val', snap.highlightValue)] }));
833
+ }
834
+ if (snap.underlineStyleValue !== undefined) {
835
+ rPrChildren.push(serializeUnderline(snap.underlineStyleValue, snap.underlineColorValue));
836
+ }
837
+ if (snap.vertAlignValue !== undefined) {
838
+ rPrChildren.push(wmlElement('vertAlign', { attributes: [wmlAttr('val', snap.vertAlignValue)] }));
839
+ }
840
+ if (snap.languageValue !== undefined) {
841
+ rPrChildren.push(serializeRunLanguage(snap.languageValue));
842
+ }
843
+ if (snap.emphasisValue !== undefined) {
844
+ rPrChildren.push(wmlElement('em', { attributes: [wmlAttr('val', snap.emphasisValue)] }));
845
+ }
846
+ if (snap.textEffectValue !== undefined) {
847
+ rPrChildren.push(wmlElement('effect', { attributes: [wmlAttr('val', snap.textEffectValue)] }));
848
+ }
849
+ if (snap.shadingValue !== undefined) {
850
+ rPrChildren.push(serializeRunShading(snap.shadingValue));
851
+ }
852
+ if (snap.borderValue !== undefined) {
853
+ rPrChildren.push(serializeRunBorder(snap.borderValue));
854
+ }
855
+ pushOnOff(rPrChildren, 'cs', snap.complexScriptValue);
856
+ pushOnOff(rPrChildren, 'rtl', snap.bidiValue);
857
+ for (var i = 0; i < snap.rPrExtra.length; i++) {
858
+ rPrChildren.push(snap.rPrExtra[i]);
859
+ }
860
+ return rPrChildren;
861
+ }
862
+ var CHARACTER_FORMAT_DEFAULTS = {
863
+ bold: false,
864
+ italic: false,
865
+ strikethrough: false,
866
+ doubleStrikethrough: false,
867
+ allCaps: false,
868
+ smallCaps: false,
869
+ hidden: false,
870
+ emboss: false,
871
+ engrave: false,
872
+ outline: false,
873
+ shadow: false,
874
+ noProof: false,
875
+ webHidden: false,
876
+ fontSize: 10,
877
+ fontName: 'Times New Roman',
878
+ fontNameAscii: 'Times New Roman',
879
+ fontNameNonFarEast: 'Times New Roman',
880
+ fontNameFarEast: 'Times New Roman',
881
+ fontNameBidi: 'Times New Roman',
882
+ underlineStyle: UnderlineStyle.None,
883
+ underlineColor: Color.Transparent,
884
+ textColor: Color.Transparent,
885
+ highlightColor: Color.Transparent,
886
+ textBackgroundColor: Color.Transparent,
887
+ subSuperScript: SubSuperScript.None,
888
+ characterSpacing: 0,
889
+ position: 0,
890
+ kerning: 0,
891
+ scaling: 100,
892
+ localeId: 1033,
893
+ localeIdBidi: 1025,
894
+ localeIdFarEast: 1033,
895
+ bidi: false,
896
+ complexScript: false,
897
+ boldBidi: false,
898
+ italicBidi: false,
899
+ fontSizeBidi: 10,
900
+ emphasisMark: 'none',
901
+ textEffect: 'none',
902
+ specVanish: false,
903
+ snapToGrid: true,
904
+ };
905
+ /**
906
+ * Character formatting model for a run (`w:rPr`).
907
+ *
908
+ * @public
909
+ */
910
+ var CharacterFormat = /** @class */ (function () {
911
+ /**
912
+ * @private
913
+ */
914
+ function CharacterFormat(host) {
915
+ this.rPrExtra = [];
916
+ this.host = host;
917
+ }
918
+ CharacterFormat.prototype.mutate = function () {
919
+ this.host.notifyCharacterFormatMutation();
920
+ };
921
+ CharacterFormat.prototype.effective = function (key) {
922
+ var resolve = this.host.resolveEffectiveCharacterValue;
923
+ var value = resolve !== undefined ? resolve.call(this.host, key) : undefined;
924
+ return value !== undefined ? value : undefined;
925
+ };
926
+ CharacterFormat.prototype.effectiveOrDefault = function (key, defaultValue) {
927
+ var value = this.effective(key);
928
+ return value !== undefined ? value : defaultValue;
929
+ };
930
+ Object.defineProperty(CharacterFormat.prototype, "bold", {
931
+ // ---- Group A ----
932
+ /** Direct `w:b` (`CT_OnOff`). `undefined` means absent. */
933
+ get: function () {
934
+ if (this.boldValue !== undefined) {
935
+ return this.boldValue;
936
+ }
937
+ return this.effective('bold');
938
+ },
939
+ set: function (value) {
940
+ this.boldValue = value;
941
+ this.mutate();
942
+ },
943
+ enumerable: true,
944
+ configurable: true
945
+ });
946
+ Object.defineProperty(CharacterFormat.prototype, "italic", {
947
+ /** Direct `w:i` (`CT_OnOff`). `undefined` means absent. */
948
+ get: function () {
949
+ if (this.italicValue !== undefined) {
950
+ return this.italicValue;
951
+ }
952
+ return this.effective('italic');
953
+ },
954
+ set: function (value) {
955
+ this.italicValue = value;
956
+ this.mutate();
957
+ },
958
+ enumerable: true,
959
+ configurable: true
960
+ });
961
+ Object.defineProperty(CharacterFormat.prototype, "strikethrough", {
962
+ /** Direct `w:strike` (`CT_OnOff`). Setter clears `doubleStrikethrough` when set true. */
963
+ get: function () {
964
+ if (this.strikeValue !== undefined) {
965
+ return this.strikeValue;
966
+ }
967
+ return this.effective('strikethrough');
968
+ },
969
+ set: function (value) {
970
+ this.strikeValue = value;
971
+ if (value === true) {
972
+ this.doubleStrikeValue = undefined;
973
+ }
974
+ this.mutate();
975
+ },
976
+ enumerable: true,
977
+ configurable: true
978
+ });
979
+ Object.defineProperty(CharacterFormat.prototype, "doubleStrikethrough", {
980
+ /** Direct `w:dstrike`. Setter clears `strikethrough` when set true. */
981
+ get: function () {
982
+ if (this.doubleStrikeValue !== undefined) {
983
+ return this.doubleStrikeValue;
984
+ }
985
+ return this.effective('doubleStrikethrough');
986
+ },
987
+ set: function (value) {
988
+ this.doubleStrikeValue = value;
989
+ if (value === true) {
990
+ this.strikeValue = undefined;
991
+ }
992
+ this.mutate();
993
+ },
994
+ enumerable: true,
995
+ configurable: true
996
+ });
997
+ Object.defineProperty(CharacterFormat.prototype, "allCaps", {
998
+ /** Direct `w:caps`. Setter clears `smallCaps` when set true (not on hydrate). */
999
+ get: function () {
1000
+ if (this.allCapsValue !== undefined) {
1001
+ return this.allCapsValue;
1002
+ }
1003
+ return this.effective('allCaps');
1004
+ },
1005
+ set: function (value) {
1006
+ this.allCapsValue = value;
1007
+ if (value === true) {
1008
+ this.smallCapsValue = undefined;
1009
+ }
1010
+ this.mutate();
1011
+ },
1012
+ enumerable: true,
1013
+ configurable: true
1014
+ });
1015
+ Object.defineProperty(CharacterFormat.prototype, "smallCaps", {
1016
+ /** Direct `w:smallCaps`. Setter clears `allCaps` when set true (not on hydrate). */
1017
+ get: function () {
1018
+ if (this.smallCapsValue !== undefined) {
1019
+ return this.smallCapsValue;
1020
+ }
1021
+ return this.effective('smallCaps');
1022
+ },
1023
+ set: function (value) {
1024
+ this.smallCapsValue = value;
1025
+ if (value === true) {
1026
+ this.allCapsValue = undefined;
1027
+ }
1028
+ this.mutate();
1029
+ },
1030
+ enumerable: true,
1031
+ configurable: true
1032
+ });
1033
+ Object.defineProperty(CharacterFormat.prototype, "hidden", {
1034
+ /**
1035
+ * Hidden text. Maps to `w:vanish` (Spec §4.1 #7).
1036
+ * `undefined` means absent.
1037
+ */
1038
+ get: function () {
1039
+ if (this.vanishValue !== undefined) {
1040
+ return this.vanishValue;
1041
+ }
1042
+ return this.effective('hidden');
1043
+ },
1044
+ set: function (value) {
1045
+ this.vanishValue = value;
1046
+ this.mutate();
1047
+ },
1048
+ enumerable: true,
1049
+ configurable: true
1050
+ });
1051
+ Object.defineProperty(CharacterFormat.prototype, "emboss", {
1052
+ /** Direct `w:emboss`. Setter clears engrave/outline/shadow when true (not on hydrate). */
1053
+ get: function () {
1054
+ if (this.embossValue !== undefined) {
1055
+ return this.embossValue;
1056
+ }
1057
+ return this.effective('emboss');
1058
+ },
1059
+ set: function (value) {
1060
+ this.embossValue = value;
1061
+ if (value === true) {
1062
+ this.imprintValue = undefined;
1063
+ this.outlineValue = undefined;
1064
+ this.shadowValue = undefined;
1065
+ }
1066
+ this.mutate();
1067
+ },
1068
+ enumerable: true,
1069
+ configurable: true
1070
+ });
1071
+ Object.defineProperty(CharacterFormat.prototype, "engrave", {
1072
+ /** Direct `w:imprint` (engrave). Member of legacy effect group. */
1073
+ get: function () {
1074
+ if (this.imprintValue !== undefined) {
1075
+ return this.imprintValue;
1076
+ }
1077
+ return this.effective('engrave');
1078
+ },
1079
+ set: function (value) {
1080
+ this.imprintValue = value;
1081
+ if (value === true) {
1082
+ this.embossValue = undefined;
1083
+ this.outlineValue = undefined;
1084
+ this.shadowValue = undefined;
1085
+ }
1086
+ this.mutate();
1087
+ },
1088
+ enumerable: true,
1089
+ configurable: true
1090
+ });
1091
+ Object.defineProperty(CharacterFormat.prototype, "outline", {
1092
+ /** Direct `w:outline`. */
1093
+ get: function () {
1094
+ if (this.outlineValue !== undefined) {
1095
+ return this.outlineValue;
1096
+ }
1097
+ return this.effective('outline');
1098
+ },
1099
+ set: function (value) {
1100
+ this.outlineValue = value;
1101
+ if (value === true) {
1102
+ this.embossValue = undefined;
1103
+ this.imprintValue = undefined;
1104
+ this.shadowValue = undefined;
1105
+ }
1106
+ this.mutate();
1107
+ },
1108
+ enumerable: true,
1109
+ configurable: true
1110
+ });
1111
+ Object.defineProperty(CharacterFormat.prototype, "shadow", {
1112
+ /** Direct `w:shadow`. */
1113
+ get: function () {
1114
+ if (this.shadowValue !== undefined) {
1115
+ return this.shadowValue;
1116
+ }
1117
+ return this.effective('shadow');
1118
+ },
1119
+ set: function (value) {
1120
+ this.shadowValue = value;
1121
+ if (value === true) {
1122
+ this.embossValue = undefined;
1123
+ this.imprintValue = undefined;
1124
+ this.outlineValue = undefined;
1125
+ }
1126
+ this.mutate();
1127
+ },
1128
+ enumerable: true,
1129
+ configurable: true
1130
+ });
1131
+ Object.defineProperty(CharacterFormat.prototype, "noProof", {
1132
+ /** Direct `w:noProof`. */
1133
+ get: function () {
1134
+ if (this.noProofValue !== undefined) {
1135
+ return this.noProofValue;
1136
+ }
1137
+ return this.effective('noProof');
1138
+ },
1139
+ set: function (value) {
1140
+ this.noProofValue = value;
1141
+ this.mutate();
1142
+ },
1143
+ enumerable: true,
1144
+ configurable: true
1145
+ });
1146
+ Object.defineProperty(CharacterFormat.prototype, "webHidden", {
1147
+ /** Direct `w:webHidden`. */
1148
+ get: function () {
1149
+ if (this.webHiddenValue !== undefined) {
1150
+ return this.webHiddenValue;
1151
+ }
1152
+ return this.effective('webHidden');
1153
+ },
1154
+ set: function (value) {
1155
+ this.webHiddenValue = value;
1156
+ this.mutate();
1157
+ },
1158
+ enumerable: true,
1159
+ configurable: true
1160
+ });
1161
+ Object.defineProperty(CharacterFormat.prototype, "fontSize", {
1162
+ /** Font size in points (`w:sz` half-points). Range (0, 1638]. */
1163
+ get: function () {
1164
+ if (this.fontSizeValue !== undefined) {
1165
+ return halfPointsToPoint(this.fontSizeValue);
1166
+ }
1167
+ return this.effectiveOrDefault('fontSize', CHARACTER_FORMAT_DEFAULTS.fontSize);
1168
+ },
1169
+ set: function (value) {
1170
+ if (value === undefined) {
1171
+ this.fontSizeValue = undefined;
1172
+ this.mutate();
1173
+ return;
1174
+ }
1175
+ validateFontSizePoints('fontSize', value);
1176
+ this.fontSizeValue = lengthToHalfPoints(value);
1177
+ this.mutate();
1178
+ },
1179
+ enumerable: true,
1180
+ configurable: true
1181
+ });
1182
+ Object.defineProperty(CharacterFormat.prototype, "fontName", {
1183
+ /**
1184
+ * Font name (`w:rFonts` ascii + hAnsi).
1185
+ * Setter also writes eastAsia/cs only when those slots are already set.
1186
+ */
1187
+ get: function () {
1188
+ if (this.fontsValue !== undefined) {
1189
+ if (this.fontsValue.ascii !== undefined) {
1190
+ return this.fontsValue.ascii;
1191
+ }
1192
+ if (this.fontsValue.hAnsi !== undefined) {
1193
+ return this.fontsValue.hAnsi;
1194
+ }
1195
+ }
1196
+ return this.effectiveOrDefault('fontName', CHARACTER_FORMAT_DEFAULTS.fontName);
1197
+ },
1198
+ set: function (value) {
1199
+ if (value === undefined) {
1200
+ if (this.fontsValue === undefined) {
1201
+ return;
1202
+ }
1203
+ this.fontsValue.ascii = undefined;
1204
+ this.fontsValue.hAnsi = undefined;
1205
+ if (fontsRecordIsEmpty(this.fontsValue)) {
1206
+ this.fontsValue = undefined;
1207
+ }
1208
+ this.mutate();
1209
+ return;
1210
+ }
1211
+ var fonts = ensureFonts(this.fontsValue);
1212
+ fonts.ascii = value;
1213
+ fonts.hAnsi = value;
1214
+ if (fonts.eastAsia !== undefined) {
1215
+ fonts.eastAsia = value;
1216
+ }
1217
+ if (fonts.cs !== undefined) {
1218
+ fonts.cs = value;
1219
+ }
1220
+ this.fontsValue = fonts;
1221
+ this.mutate();
1222
+ },
1223
+ enumerable: true,
1224
+ configurable: true
1225
+ });
1226
+ Object.defineProperty(CharacterFormat.prototype, "fontNameAscii", {
1227
+ /**
1228
+ * @private
1229
+ * `w:rFonts/@w:ascii`
1230
+ */
1231
+ get: function () {
1232
+ if (this.fontsValue !== undefined) {
1233
+ if (this.fontsValue.ascii !== undefined) {
1234
+ return this.fontsValue.ascii;
1235
+ }
1236
+ }
1237
+ return this.effectiveOrDefault('fontNameAscii', CHARACTER_FORMAT_DEFAULTS.fontNameAscii);
1238
+ },
1239
+ /**
1240
+ * @private
1241
+ */
1242
+ set: function (value) {
1243
+ var fonts = ensureFonts(this.fontsValue);
1244
+ fonts.ascii = value;
1245
+ this.fontsValue = fontsRecordIsEmpty(fonts) ? undefined : fonts;
1246
+ this.mutate();
1247
+ },
1248
+ enumerable: true,
1249
+ configurable: true
1250
+ });
1251
+ Object.defineProperty(CharacterFormat.prototype, "fontNameNonFarEast", {
1252
+ /**
1253
+ * @private
1254
+ * `w:rFonts/@w:hAnsi`
1255
+ */
1256
+ get: function () {
1257
+ if (this.fontsValue !== undefined) {
1258
+ if (this.fontsValue.hAnsi !== undefined) {
1259
+ return this.fontsValue.hAnsi;
1260
+ }
1261
+ }
1262
+ return this.effectiveOrDefault('fontNameNonFarEast', CHARACTER_FORMAT_DEFAULTS.fontNameNonFarEast);
1263
+ },
1264
+ /**
1265
+ * @private
1266
+ */
1267
+ set: function (value) {
1268
+ var fonts = ensureFonts(this.fontsValue);
1269
+ fonts.hAnsi = value;
1270
+ this.fontsValue = fontsRecordIsEmpty(fonts) ? undefined : fonts;
1271
+ this.mutate();
1272
+ },
1273
+ enumerable: true,
1274
+ configurable: true
1275
+ });
1276
+ Object.defineProperty(CharacterFormat.prototype, "fontNameFarEast", {
1277
+ /**
1278
+ * @private
1279
+ * `w:rFonts/@w:eastAsia`
1280
+ */
1281
+ get: function () {
1282
+ if (this.fontsValue !== undefined) {
1283
+ if (this.fontsValue.eastAsia !== undefined) {
1284
+ return this.fontsValue.eastAsia;
1285
+ }
1286
+ }
1287
+ return this.effectiveOrDefault('fontNameFarEast', CHARACTER_FORMAT_DEFAULTS.fontNameFarEast);
1288
+ },
1289
+ /**
1290
+ * @private
1291
+ */
1292
+ set: function (value) {
1293
+ var fonts = ensureFonts(this.fontsValue);
1294
+ fonts.eastAsia = value;
1295
+ this.fontsValue = fontsRecordIsEmpty(fonts) ? undefined : fonts;
1296
+ this.mutate();
1297
+ },
1298
+ enumerable: true,
1299
+ configurable: true
1300
+ });
1301
+ Object.defineProperty(CharacterFormat.prototype, "fontNameBidi", {
1302
+ /** Complex-script font (`w:rFonts/@w:cs`). */
1303
+ get: function () {
1304
+ if (this.fontsValue !== undefined) {
1305
+ if (this.fontsValue.cs !== undefined) {
1306
+ return this.fontsValue.cs;
1307
+ }
1308
+ }
1309
+ return this.effectiveOrDefault('fontNameBidi', CHARACTER_FORMAT_DEFAULTS.fontNameBidi);
1310
+ },
1311
+ set: function (value) {
1312
+ var fonts = ensureFonts(this.fontsValue);
1313
+ fonts.cs = value;
1314
+ this.fontsValue = fontsRecordIsEmpty(fonts) ? undefined : fonts;
1315
+ this.mutate();
1316
+ },
1317
+ enumerable: true,
1318
+ configurable: true
1319
+ });
1320
+ Object.defineProperty(CharacterFormat.prototype, "underlineStyle", {
1321
+ /** Underline style (`w:u/@w:val`). */
1322
+ get: function () {
1323
+ if (this.underlineStyleValue !== undefined) {
1324
+ return underlineStyleFromWire(this.underlineStyleValue);
1325
+ }
1326
+ return this.effectiveOrDefault('underlineStyle', CHARACTER_FORMAT_DEFAULTS.underlineStyle);
1327
+ },
1328
+ set: function (value) {
1329
+ if (value === undefined) {
1330
+ this.underlineStyleValue = undefined;
1331
+ this.underlineColorValue = undefined;
1332
+ this.mutate();
1333
+ return;
1334
+ }
1335
+ this.underlineStyleValue = underlineStyleToWire(value);
1336
+ this.mutate();
1337
+ },
1338
+ enumerable: true,
1339
+ configurable: true
1340
+ });
1341
+ Object.defineProperty(CharacterFormat.prototype, "underlineColor", {
1342
+ /** Underline color (`w:u/@w:color`). */
1343
+ get: function () {
1344
+ if (this.underlineColorValue !== undefined) {
1345
+ var mapped = wireColorToEnum(this.underlineColorValue);
1346
+ return mapped !== undefined ? mapped : Color.Transparent;
1347
+ }
1348
+ var resolved = this.effective('underlineColor');
1349
+ if (resolved === 'transparent') {
1350
+ return Color.Transparent;
1351
+ }
1352
+ return resolved !== undefined ? resolved : CHARACTER_FORMAT_DEFAULTS.underlineColor;
1353
+ },
1354
+ set: function (value) {
1355
+ this.underlineColorValue = colorToWireOrUndefined(value);
1356
+ this.mutate();
1357
+ },
1358
+ enumerable: true,
1359
+ configurable: true
1360
+ });
1361
+ Object.defineProperty(CharacterFormat.prototype, "textColor", {
1362
+ /** Text color (`w:color/@w:val`). Setting clears theme color. */
1363
+ get: function () {
1364
+ if (this.textColorValue !== undefined) {
1365
+ var mapped = wireColorToEnum(this.textColorValue);
1366
+ return mapped !== undefined ? mapped : Color.Transparent;
1367
+ }
1368
+ var resolved = this.effective('textColor');
1369
+ if (resolved === 'transparent') {
1370
+ return Color.Transparent;
1371
+ }
1372
+ return resolved !== undefined ? resolved : CHARACTER_FORMAT_DEFAULTS.textColor;
1373
+ },
1374
+ set: function (value) {
1375
+ this.textColorValue = colorToWireOrUndefined(value);
1376
+ this.textColorTheme = undefined;
1377
+ this.mutate();
1378
+ },
1379
+ enumerable: true,
1380
+ configurable: true
1381
+ });
1382
+ Object.defineProperty(CharacterFormat.prototype, "highlightColor", {
1383
+ /** Highlight color (`w:highlight`). */
1384
+ get: function () {
1385
+ if (this.highlightValue !== undefined) {
1386
+ return highlightWireToColor(this.highlightValue);
1387
+ }
1388
+ var resolved = this.effective('highlightColor');
1389
+ if (resolved === 'transparent') {
1390
+ return Color.Transparent;
1391
+ }
1392
+ return resolved !== undefined ? resolved : CHARACTER_FORMAT_DEFAULTS.highlightColor;
1393
+ },
1394
+ set: function (value) {
1395
+ if (value === undefined) {
1396
+ this.highlightValue = undefined;
1397
+ this.mutate();
1398
+ return;
1399
+ }
1400
+ this.highlightValue = colorToHighlightWire(value);
1401
+ this.mutate();
1402
+ },
1403
+ enumerable: true,
1404
+ configurable: true
1405
+ });
1406
+ Object.defineProperty(CharacterFormat.prototype, "textBackgroundColor", {
1407
+ /**
1408
+ * Text background (`w:shd/@w:fill`). Authoring writes `val="clear"` + fill.
1409
+ */
1410
+ get: function () {
1411
+ if (this.shadingValue !== undefined && this.shadingValue.fill !== undefined) {
1412
+ var mapped = wireColorToEnum(this.shadingValue.fill);
1413
+ return mapped !== undefined ? mapped : Color.Transparent;
1414
+ }
1415
+ var resolved = this.effective('textBackgroundColor');
1416
+ if (resolved === 'transparent') {
1417
+ return Color.Transparent;
1418
+ }
1419
+ return resolved !== undefined ? resolved : CHARACTER_FORMAT_DEFAULTS.textBackgroundColor;
1420
+ },
1421
+ set: function (value) {
1422
+ if (value === undefined) {
1423
+ this.shadingValue = undefined;
1424
+ this.mutate();
1425
+ return;
1426
+ }
1427
+ var fill = colorToHexWire(value);
1428
+ this.shadingValue = { pattern: 'clear', fill: fill };
1429
+ this.mutate();
1430
+ },
1431
+ enumerable: true,
1432
+ configurable: true
1433
+ });
1434
+ Object.defineProperty(CharacterFormat.prototype, "subSuperScript", {
1435
+ /** Sub/superscript (`w:vertAlign`). */
1436
+ get: function () {
1437
+ if (this.vertAlignValue !== undefined) {
1438
+ return subSuperScriptFromWire(this.vertAlignValue);
1439
+ }
1440
+ return this.effectiveOrDefault('subSuperScript', CHARACTER_FORMAT_DEFAULTS.subSuperScript);
1441
+ },
1442
+ set: function (value) {
1443
+ if (value === undefined) {
1444
+ this.vertAlignValue = undefined;
1445
+ this.mutate();
1446
+ return;
1447
+ }
1448
+ this.vertAlignValue = subSuperScriptToWire(value);
1449
+ this.mutate();
1450
+ },
1451
+ enumerable: true,
1452
+ configurable: true
1453
+ });
1454
+ Object.defineProperty(CharacterFormat.prototype, "characterSpacing", {
1455
+ /** Character spacing in points (`w:spacing` twips). Range ±1584. */
1456
+ get: function () {
1457
+ if (this.characterSpacingValue !== undefined) {
1458
+ return twipsToPoint(this.characterSpacingValue);
1459
+ }
1460
+ return this.effectiveOrDefault('characterSpacing', CHARACTER_FORMAT_DEFAULTS.characterSpacing);
1461
+ },
1462
+ set: function (value) {
1463
+ if (value === undefined) {
1464
+ this.characterSpacingValue = undefined;
1465
+ this.mutate();
1466
+ return;
1467
+ }
1468
+ validateSignedExtentPoints('characterSpacing', value);
1469
+ this.characterSpacingValue = pointToTwips(value);
1470
+ this.mutate();
1471
+ },
1472
+ enumerable: true,
1473
+ configurable: true
1474
+ });
1475
+ Object.defineProperty(CharacterFormat.prototype, "position", {
1476
+ /** Raised/lowered position in points (`w:position` half-points). Range ±1584. */
1477
+ get: function () {
1478
+ if (this.positionValue !== undefined) {
1479
+ return halfPointsToPoint(this.positionValue);
1480
+ }
1481
+ return this.effectiveOrDefault('position', CHARACTER_FORMAT_DEFAULTS.position);
1482
+ },
1483
+ set: function (value) {
1484
+ if (value === undefined) {
1485
+ this.positionValue = undefined;
1486
+ this.mutate();
1487
+ return;
1488
+ }
1489
+ validateSignedExtentPoints('position', value);
1490
+ this.positionValue = pointToSignedHalfPoints(value);
1491
+ this.mutate();
1492
+ },
1493
+ enumerable: true,
1494
+ configurable: true
1495
+ });
1496
+ Object.defineProperty(CharacterFormat.prototype, "kerning", {
1497
+ /** Kerning threshold in points (`w:kern` half-points). */
1498
+ get: function () {
1499
+ if (this.kerningValue !== undefined) {
1500
+ return halfPointsToPoint(this.kerningValue);
1501
+ }
1502
+ return this.effectiveOrDefault('kerning', CHARACTER_FORMAT_DEFAULTS.kerning);
1503
+ },
1504
+ set: function (value) {
1505
+ if (value === undefined) {
1506
+ this.kerningValue = undefined;
1507
+ this.mutate();
1508
+ return;
1509
+ }
1510
+ if (value < 0) {
1511
+ throw new RangeError('kerning must be non-negative, got ' + String(value));
1512
+ }
1513
+ var hp = pointToSignedHalfPoints(value);
1514
+ if (hp < 0) {
1515
+ throw new RangeError('kerning must be non-negative, got ' + String(hp) + ' half-points');
1516
+ }
1517
+ this.kerningValue = hp;
1518
+ this.mutate();
1519
+ },
1520
+ enumerable: true,
1521
+ configurable: true
1522
+ });
1523
+ Object.defineProperty(CharacterFormat.prototype, "scaling", {
1524
+ /** Character scale percentage (`w:w`). Integer 1–600. */
1525
+ get: function () {
1526
+ if (this.characterScaleValue !== undefined) {
1527
+ return this.characterScaleValue;
1528
+ }
1529
+ return this.effectiveOrDefault('scaling', CHARACTER_FORMAT_DEFAULTS.scaling);
1530
+ },
1531
+ set: function (value) {
1532
+ if (value !== undefined && (!Number.isInteger(value) || value < 1 || value > 600)) {
1533
+ throw new RangeError('scaling must be an integer 1–600, got ' + String(value));
1534
+ }
1535
+ this.characterScaleValue = value;
1536
+ this.mutate();
1537
+ },
1538
+ enumerable: true,
1539
+ configurable: true
1540
+ });
1541
+ Object.defineProperty(CharacterFormat.prototype, "border", {
1542
+ /** Character border (`w:bdr`). */
1543
+ get: function () {
1544
+ if (this.borderValue !== undefined) {
1545
+ return this.borderValue;
1546
+ }
1547
+ return this.effective('border');
1548
+ },
1549
+ set: function (value) {
1550
+ this.borderValue = value;
1551
+ this.mutate();
1552
+ },
1553
+ enumerable: true,
1554
+ configurable: true
1555
+ });
1556
+ Object.defineProperty(CharacterFormat.prototype, "localeId", {
1557
+ /**
1558
+ * Latin locale id (`w:lang/@w:val` as {@link LocaleIDs}).
1559
+ * @public
1560
+ */
1561
+ get: function () {
1562
+ var direct = getLocaleIdField(this.languageValue, 'latin');
1563
+ if (direct !== undefined) {
1564
+ return direct;
1565
+ }
1566
+ return this.effectiveOrDefault('localeId', CHARACTER_FORMAT_DEFAULTS.localeId);
1567
+ },
1568
+ set: function (value) {
1569
+ this.languageValue = setLocaleIdField(this.languageValue, 'latin', value);
1570
+ this.mutate();
1571
+ },
1572
+ enumerable: true,
1573
+ configurable: true
1574
+ });
1575
+ Object.defineProperty(CharacterFormat.prototype, "localeIdBidi", {
1576
+ /**
1577
+ * Bidirectional locale id (`w:lang/@w:bidi` as {@link LocaleIDs}).
1578
+ * @public
1579
+ */
1580
+ get: function () {
1581
+ var direct = getLocaleIdField(this.languageValue, 'bidi');
1582
+ if (direct !== undefined) {
1583
+ return direct;
1584
+ }
1585
+ return this.effectiveOrDefault('localeIdBidi', CHARACTER_FORMAT_DEFAULTS.localeIdBidi);
1586
+ },
1587
+ set: function (value) {
1588
+ this.languageValue = setLocaleIdField(this.languageValue, 'bidi', value);
1589
+ this.mutate();
1590
+ },
1591
+ enumerable: true,
1592
+ configurable: true
1593
+ });
1594
+ Object.defineProperty(CharacterFormat.prototype, "localeIdFarEast", {
1595
+ /**
1596
+ * East Asian locale id (`w:lang/@w:eastAsia` as {@link LocaleIDs}).
1597
+ * @public
1598
+ */
1599
+ get: function () {
1600
+ var direct = getLocaleIdField(this.languageValue, 'eastAsia');
1601
+ if (direct !== undefined) {
1602
+ return direct;
1603
+ }
1604
+ return this.effectiveOrDefault('localeIdFarEast', CHARACTER_FORMAT_DEFAULTS.localeIdFarEast);
1605
+ },
1606
+ set: function (value) {
1607
+ this.languageValue = setLocaleIdField(this.languageValue, 'eastAsia', value);
1608
+ this.mutate();
1609
+ },
1610
+ enumerable: true,
1611
+ configurable: true
1612
+ });
1613
+ Object.defineProperty(CharacterFormat.prototype, "characterStyle", {
1614
+ /** Character style id (`w:rStyle/@w:val`). */
1615
+ get: function () {
1616
+ return this.styleIdValue;
1617
+ },
1618
+ set: function (value) {
1619
+ this.styleIdValue = value;
1620
+ this.mutate();
1621
+ },
1622
+ enumerable: true,
1623
+ configurable: true
1624
+ });
1625
+ Object.defineProperty(CharacterFormat.prototype, "bidi", {
1626
+ // ---- Group B ----
1627
+ /** Bidirectional (`w:rtl`). */
1628
+ get: function () {
1629
+ if (this.bidiValue !== undefined) {
1630
+ return this.bidiValue;
1631
+ }
1632
+ return this.effective('bidi');
1633
+ },
1634
+ set: function (value) {
1635
+ this.bidiValue = value;
1636
+ this.mutate();
1637
+ },
1638
+ enumerable: true,
1639
+ configurable: true
1640
+ });
1641
+ Object.defineProperty(CharacterFormat.prototype, "complexScript", {
1642
+ /** Complex script (`w:cs`). */
1643
+ get: function () {
1644
+ if (this.complexScriptValue !== undefined) {
1645
+ return this.complexScriptValue;
1646
+ }
1647
+ return this.effective('complexScript');
1648
+ },
1649
+ set: function (value) {
1650
+ this.complexScriptValue = value;
1651
+ this.mutate();
1652
+ },
1653
+ enumerable: true,
1654
+ configurable: true
1655
+ });
1656
+ Object.defineProperty(CharacterFormat.prototype, "boldBidi", {
1657
+ /** Bold complex script (`w:bCs`). */
1658
+ get: function () {
1659
+ if (this.boldBidiValue !== undefined) {
1660
+ return this.boldBidiValue;
1661
+ }
1662
+ return this.effective('boldBidi');
1663
+ },
1664
+ set: function (value) {
1665
+ this.boldBidiValue = value;
1666
+ this.mutate();
1667
+ },
1668
+ enumerable: true,
1669
+ configurable: true
1670
+ });
1671
+ Object.defineProperty(CharacterFormat.prototype, "italicBidi", {
1672
+ /** Italic complex script (`w:iCs`). */
1673
+ get: function () {
1674
+ if (this.italicBidiValue !== undefined) {
1675
+ return this.italicBidiValue;
1676
+ }
1677
+ return this.effective('italicBidi');
1678
+ },
1679
+ set: function (value) {
1680
+ this.italicBidiValue = value;
1681
+ this.mutate();
1682
+ },
1683
+ enumerable: true,
1684
+ configurable: true
1685
+ });
1686
+ Object.defineProperty(CharacterFormat.prototype, "fontSizeBidi", {
1687
+ /** Complex-script font size in points (`w:szCs`). Range (0, 1638]. */
1688
+ get: function () {
1689
+ if (this.fontSizeBidiValue !== undefined) {
1690
+ return halfPointsToPoint(this.fontSizeBidiValue);
1691
+ }
1692
+ return this.effectiveOrDefault('fontSizeBidi', CHARACTER_FORMAT_DEFAULTS.fontSizeBidi);
1693
+ },
1694
+ set: function (value) {
1695
+ if (value === undefined) {
1696
+ this.fontSizeBidiValue = undefined;
1697
+ this.mutate();
1698
+ return;
1699
+ }
1700
+ validateFontSizePoints('fontSizeBidi', value);
1701
+ this.fontSizeBidiValue = lengthToHalfPoints(value);
1702
+ this.mutate();
1703
+ },
1704
+ enumerable: true,
1705
+ configurable: true
1706
+ });
1707
+ Object.defineProperty(CharacterFormat.prototype, "emphasisMark", {
1708
+ /** Emphasis mark (`w:em`). */
1709
+ get: function () {
1710
+ if (this.emphasisValue !== undefined) {
1711
+ return this.emphasisValue;
1712
+ }
1713
+ return this.effectiveOrDefault('emphasisMark', CHARACTER_FORMAT_DEFAULTS.emphasisMark);
1714
+ },
1715
+ set: function (value) {
1716
+ this.emphasisValue = value;
1717
+ this.mutate();
1718
+ },
1719
+ enumerable: true,
1720
+ configurable: true
1721
+ });
1722
+ Object.defineProperty(CharacterFormat.prototype, "textEffect", {
1723
+ /** Animated text effect (`w:effect`). */
1724
+ get: function () {
1725
+ if (this.textEffectValue !== undefined) {
1726
+ return this.textEffectValue;
1727
+ }
1728
+ return this.effectiveOrDefault('textEffect', CHARACTER_FORMAT_DEFAULTS.textEffect);
1729
+ },
1730
+ set: function (value) {
1731
+ this.textEffectValue = value;
1732
+ this.mutate();
1733
+ },
1734
+ enumerable: true,
1735
+ configurable: true
1736
+ });
1737
+ Object.defineProperty(CharacterFormat.prototype, "specVanish", {
1738
+ /**
1739
+ * @private
1740
+ * `w:specVanish`
1741
+ */
1742
+ get: function () {
1743
+ if (this.specVanishValue !== undefined) {
1744
+ return this.specVanishValue;
1745
+ }
1746
+ return this.effective('specVanish');
1747
+ },
1748
+ /**
1749
+ * @private
1750
+ */
1751
+ set: function (value) {
1752
+ this.specVanishValue = value;
1753
+ this.mutate();
1754
+ },
1755
+ enumerable: true,
1756
+ configurable: true
1757
+ });
1758
+ Object.defineProperty(CharacterFormat.prototype, "snapToGrid", {
1759
+ /**
1760
+ * @private
1761
+ * `w:snapToGrid`
1762
+ */
1763
+ get: function () {
1764
+ if (this.snapToGridValue !== undefined) {
1765
+ return this.snapToGridValue;
1766
+ }
1767
+ return this.effective('snapToGrid');
1768
+ },
1769
+ /**
1770
+ * @private
1771
+ */
1772
+ set: function (value) {
1773
+ this.snapToGridValue = value;
1774
+ this.mutate();
1775
+ },
1776
+ enumerable: true,
1777
+ configurable: true
1778
+ });
1779
+ /**
1780
+ * Apply a partial delta. Uses setters (exclusivity applies).
1781
+ * @public
1782
+ */
1783
+ CharacterFormat.prototype.assign = function (delta) {
1784
+ if (delta.bold !== undefined) {
1785
+ this.bold = delta.bold;
1786
+ }
1787
+ if (delta.italic !== undefined) {
1788
+ this.italic = delta.italic;
1789
+ }
1790
+ if (delta.strikethrough !== undefined) {
1791
+ this.strikethrough = delta.strikethrough;
1792
+ }
1793
+ if (delta.doubleStrikethrough !== undefined) {
1794
+ this.doubleStrikethrough = delta.doubleStrikethrough;
1795
+ }
1796
+ if (delta.allCaps !== undefined) {
1797
+ this.allCaps = delta.allCaps;
1798
+ }
1799
+ if (delta.smallCaps !== undefined) {
1800
+ this.smallCaps = delta.smallCaps;
1801
+ }
1802
+ if (delta.hidden !== undefined) {
1803
+ this.hidden = delta.hidden;
1804
+ }
1805
+ if (delta.emboss !== undefined) {
1806
+ this.emboss = delta.emboss;
1807
+ }
1808
+ if (delta.engrave !== undefined) {
1809
+ this.engrave = delta.engrave;
1810
+ }
1811
+ if (delta.outline !== undefined) {
1812
+ this.outline = delta.outline;
1813
+ }
1814
+ if (delta.shadow !== undefined) {
1815
+ this.shadow = delta.shadow;
1816
+ }
1817
+ if (delta.noProof !== undefined) {
1818
+ this.noProof = delta.noProof;
1819
+ }
1820
+ if (delta.webHidden !== undefined) {
1821
+ this.webHidden = delta.webHidden;
1822
+ }
1823
+ if (delta.fontSize !== undefined) {
1824
+ this.fontSize = delta.fontSize;
1825
+ }
1826
+ if (delta.fontName !== undefined) {
1827
+ this.fontName = delta.fontName;
1828
+ }
1829
+ if (delta.fontNameBidi !== undefined) {
1830
+ this.fontNameBidi = delta.fontNameBidi;
1831
+ }
1832
+ if (delta.underlineStyle !== undefined) {
1833
+ this.underlineStyle = delta.underlineStyle;
1834
+ }
1835
+ if (delta.underlineColor !== undefined) {
1836
+ this.underlineColor = delta.underlineColor;
1837
+ }
1838
+ if (delta.textColor !== undefined) {
1839
+ this.textColor = delta.textColor;
1840
+ }
1841
+ if (delta.highlightColor !== undefined) {
1842
+ this.highlightColor = delta.highlightColor;
1843
+ }
1844
+ if (delta.textBackgroundColor !== undefined) {
1845
+ this.textBackgroundColor = delta.textBackgroundColor;
1846
+ }
1847
+ if (delta.subSuperScript !== undefined) {
1848
+ this.subSuperScript = delta.subSuperScript;
1849
+ }
1850
+ if (delta.characterSpacing !== undefined) {
1851
+ this.characterSpacing = delta.characterSpacing;
1852
+ }
1853
+ if (delta.position !== undefined) {
1854
+ this.position = delta.position;
1855
+ }
1856
+ if (delta.kerning !== undefined) {
1857
+ this.kerning = delta.kerning;
1858
+ }
1859
+ if (delta.scaling !== undefined) {
1860
+ this.scaling = delta.scaling;
1861
+ }
1862
+ if (delta.border !== undefined) {
1863
+ this.border = delta.border;
1864
+ }
1865
+ if (delta.localeId !== undefined) {
1866
+ this.localeId = delta.localeId;
1867
+ }
1868
+ if (delta.localeIdBidi !== undefined) {
1869
+ this.localeIdBidi = delta.localeIdBidi;
1870
+ }
1871
+ if (delta.localeIdFarEast !== undefined) {
1872
+ this.localeIdFarEast = delta.localeIdFarEast;
1873
+ }
1874
+ if (delta.characterStyle !== undefined) {
1875
+ this.characterStyle = delta.characterStyle;
1876
+ }
1877
+ if (delta.bidi !== undefined) {
1878
+ this.bidi = delta.bidi;
1879
+ }
1880
+ if (delta.complexScript !== undefined) {
1881
+ this.complexScript = delta.complexScript;
1882
+ }
1883
+ if (delta.boldBidi !== undefined) {
1884
+ this.boldBidi = delta.boldBidi;
1885
+ }
1886
+ if (delta.italicBidi !== undefined) {
1887
+ this.italicBidi = delta.italicBidi;
1888
+ }
1889
+ if (delta.fontSizeBidi !== undefined) {
1890
+ this.fontSizeBidi = delta.fontSizeBidi;
1891
+ }
1892
+ if (delta.emphasisMark !== undefined) {
1893
+ this.emphasisMark = delta.emphasisMark;
1894
+ }
1895
+ if (delta.textEffect !== undefined) {
1896
+ this.textEffect = delta.textEffect;
1897
+ }
1898
+ };
1899
+ /**
1900
+ * Clear all typed formatting. Does not clear `rPrExtra`.
1901
+ * @public
1902
+ */
1903
+ CharacterFormat.prototype.clear = function () {
1904
+ this.styleIdValue = undefined;
1905
+ this.boldValue = undefined;
1906
+ this.italicValue = undefined;
1907
+ this.strikeValue = undefined;
1908
+ this.doubleStrikeValue = undefined;
1909
+ this.vanishValue = undefined;
1910
+ this.legacyHiddenValue = undefined;
1911
+ this.noProofValue = undefined;
1912
+ this.fontSizeValue = undefined;
1913
+ this.fontSizeBidiValue = undefined;
1914
+ this.textColorValue = undefined;
1915
+ this.textColorTheme = undefined;
1916
+ this.highlightValue = undefined;
1917
+ this.shadingValue = undefined;
1918
+ this.underlineStyleValue = undefined;
1919
+ this.underlineColorValue = undefined;
1920
+ this.vertAlignValue = undefined;
1921
+ this.smallCapsValue = undefined;
1922
+ this.allCapsValue = undefined;
1923
+ this.fontsValue = undefined;
1924
+ this.characterScaleValue = undefined;
1925
+ this.kerningValue = undefined;
1926
+ this.characterSpacingValue = undefined;
1927
+ this.positionValue = undefined;
1928
+ this.borderValue = undefined;
1929
+ this.languageValue = undefined;
1930
+ this.embossValue = undefined;
1931
+ this.imprintValue = undefined;
1932
+ this.outlineValue = undefined;
1933
+ this.shadowValue = undefined;
1934
+ this.webHiddenValue = undefined;
1935
+ this.bidiValue = undefined;
1936
+ this.complexScriptValue = undefined;
1937
+ this.boldBidiValue = undefined;
1938
+ this.italicBidiValue = undefined;
1939
+ this.emphasisValue = undefined;
1940
+ this.textEffectValue = undefined;
1941
+ this.specVanishValue = undefined;
1942
+ this.snapToGridValue = undefined;
1943
+ this.mutate();
1944
+ };
1945
+ /**
1946
+ * @private
1947
+ * Load snapshot without exclusivity side-effects.
1948
+ */
1949
+ CharacterFormat.prototype.hydrate = function (data) {
1950
+ this.rPrExtra = data.rPrExtra;
1951
+ this.styleIdValue = data.styleIdValue;
1952
+ this.boldValue = data.boldValue;
1953
+ this.italicValue = data.italicValue;
1954
+ this.strikeValue = data.strikeValue;
1955
+ this.doubleStrikeValue = data.doubleStrikeValue;
1956
+ this.vanishValue = data.vanishValue;
1957
+ this.legacyHiddenValue = data.legacyHiddenValue;
1958
+ this.noProofValue = data.noProofValue;
1959
+ this.fontSizeValue = data.fontSizeValue;
1960
+ this.fontSizeBidiValue = data.fontSizeBidiValue;
1961
+ this.textColorValue = data.textColorValue;
1962
+ this.textColorTheme = data.textColorTheme;
1963
+ this.highlightValue = data.highlightValue;
1964
+ this.shadingValue = data.shadingValue;
1965
+ this.underlineStyleValue = data.underlineStyleValue;
1966
+ this.underlineColorValue = data.underlineColorValue;
1967
+ this.vertAlignValue = data.vertAlignValue;
1968
+ this.smallCapsValue = data.smallCapsValue;
1969
+ this.allCapsValue = data.allCapsValue;
1970
+ this.fontsValue = data.fontsValue;
1971
+ this.characterScaleValue = data.characterScaleValue;
1972
+ this.kerningValue = data.kerningValue;
1973
+ this.characterSpacingValue = data.characterSpacingValue;
1974
+ this.positionValue = data.positionValue;
1975
+ this.borderValue = data.borderValue;
1976
+ this.languageValue = data.languageValue;
1977
+ this.embossValue = data.embossValue;
1978
+ this.imprintValue = data.imprintValue;
1979
+ this.outlineValue = data.outlineValue;
1980
+ this.shadowValue = data.shadowValue;
1981
+ this.webHiddenValue = data.webHiddenValue;
1982
+ this.bidiValue = data.bidiValue;
1983
+ this.complexScriptValue = data.complexScriptValue;
1984
+ this.boldBidiValue = data.boldBidiValue;
1985
+ this.italicBidiValue = data.italicBidiValue;
1986
+ this.emphasisValue = data.emphasisValue;
1987
+ this.textEffectValue = data.textEffectValue;
1988
+ this.specVanishValue = data.specVanishValue;
1989
+ this.snapToGridValue = data.snapToGridValue;
1990
+ };
1991
+ /**
1992
+ * @private
1993
+ */
1994
+ CharacterFormat.prototype.snapshot = function () {
1995
+ return {
1996
+ rPrExtra: this.rPrExtra,
1997
+ styleIdValue: this.styleIdValue,
1998
+ boldValue: this.boldValue,
1999
+ italicValue: this.italicValue,
2000
+ strikeValue: this.strikeValue,
2001
+ doubleStrikeValue: this.doubleStrikeValue,
2002
+ vanishValue: this.vanishValue,
2003
+ legacyHiddenValue: this.legacyHiddenValue,
2004
+ noProofValue: this.noProofValue,
2005
+ fontSizeValue: this.fontSizeValue,
2006
+ fontSizeBidiValue: this.fontSizeBidiValue,
2007
+ textColorValue: this.textColorValue,
2008
+ textColorTheme: this.textColorTheme,
2009
+ highlightValue: this.highlightValue,
2010
+ shadingValue: this.shadingValue,
2011
+ underlineStyleValue: this.underlineStyleValue,
2012
+ underlineColorValue: this.underlineColorValue,
2013
+ vertAlignValue: this.vertAlignValue,
2014
+ smallCapsValue: this.smallCapsValue,
2015
+ allCapsValue: this.allCapsValue,
2016
+ fontsValue: this.fontsValue,
2017
+ characterScaleValue: this.characterScaleValue,
2018
+ kerningValue: this.kerningValue,
2019
+ characterSpacingValue: this.characterSpacingValue,
2020
+ positionValue: this.positionValue,
2021
+ borderValue: this.borderValue,
2022
+ languageValue: this.languageValue,
2023
+ embossValue: this.embossValue,
2024
+ imprintValue: this.imprintValue,
2025
+ outlineValue: this.outlineValue,
2026
+ shadowValue: this.shadowValue,
2027
+ webHiddenValue: this.webHiddenValue,
2028
+ bidiValue: this.bidiValue,
2029
+ complexScriptValue: this.complexScriptValue,
2030
+ boldBidiValue: this.boldBidiValue,
2031
+ italicBidiValue: this.italicBidiValue,
2032
+ emphasisValue: this.emphasisValue,
2033
+ textEffectValue: this.textEffectValue,
2034
+ specVanishValue: this.specVanishValue,
2035
+ snapToGridValue: this.snapToGridValue,
2036
+ };
2037
+ };
2038
+ /**
2039
+ * @private
2040
+ * Materialize `w:rPr` children (Spec §7.2 order).
2041
+ */
2042
+ CharacterFormat.prototype.buildRPrChildren = function () {
2043
+ return buildRPrChildrenFromSnapshot(this.snapshot());
2044
+ };
2045
+ /**
2046
+ * @private
2047
+ * Fonts record for style resolver / direct font parse.
2048
+ */
2049
+ CharacterFormat.prototype.fontsRecord = function () {
2050
+ return this.fontsValue;
2051
+ };
2052
+ return CharacterFormat;
2053
+ }());
2054
+ export { CharacterFormat };