pptx-templates 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/AI-INSTRUCTOR.md +2253 -0
  2. package/CHANGELOG.md +49 -0
  3. package/LICENSE +23 -0
  4. package/README.md +86 -2
  5. package/dist/automizer.d.ts +224 -0
  6. package/dist/automizer.js +704 -0
  7. package/dist/automizer.js.map +1 -0
  8. package/dist/classes/content-type-registry.d.ts +46 -0
  9. package/dist/classes/content-type-registry.js +170 -0
  10. package/dist/classes/content-type-registry.js.map +1 -0
  11. package/dist/classes/element-importer.d.ts +49 -0
  12. package/dist/classes/element-importer.js +254 -0
  13. package/dist/classes/element-importer.js.map +1 -0
  14. package/dist/classes/has-shapes.d.ts +286 -0
  15. package/dist/classes/has-shapes.js +385 -0
  16. package/dist/classes/has-shapes.js.map +1 -0
  17. package/dist/classes/layout.d.ts +42 -0
  18. package/dist/classes/layout.js +113 -0
  19. package/dist/classes/layout.js.map +1 -0
  20. package/dist/classes/master.d.ts +45 -0
  21. package/dist/classes/master.js +146 -0
  22. package/dist/classes/master.js.map +1 -0
  23. package/dist/classes/placeholder-normalizer.d.ts +42 -0
  24. package/dist/classes/placeholder-normalizer.js +136 -0
  25. package/dist/classes/placeholder-normalizer.js.map +1 -0
  26. package/dist/classes/related-content-copier.d.ts +18 -0
  27. package/dist/classes/related-content-copier.js +114 -0
  28. package/dist/classes/related-content-copier.js.map +1 -0
  29. package/dist/classes/shape.d.ts +62 -0
  30. package/dist/classes/shape.js +194 -0
  31. package/dist/classes/shape.js.map +1 -0
  32. package/dist/classes/slide-master-remover.d.ts +44 -0
  33. package/dist/classes/slide-master-remover.js +201 -0
  34. package/dist/classes/slide-master-remover.js.map +1 -0
  35. package/dist/classes/slide-notes-copier.d.ts +26 -0
  36. package/dist/classes/slide-notes-copier.js +76 -0
  37. package/dist/classes/slide-notes-copier.js.map +1 -0
  38. package/dist/classes/slide.d.ts +91 -0
  39. package/dist/classes/slide.js +286 -0
  40. package/dist/classes/slide.js.map +1 -0
  41. package/dist/classes/template.d.ts +137 -0
  42. package/dist/classes/template.js +311 -0
  43. package/dist/classes/template.js.map +1 -0
  44. package/dist/constants/constants.d.ts +11 -0
  45. package/dist/constants/constants.js +182 -0
  46. package/dist/constants/constants.js.map +1 -0
  47. package/dist/enums/chart-type.d.ts +11 -0
  48. package/dist/enums/chart-type.js +16 -0
  49. package/dist/enums/chart-type.js.map +1 -0
  50. package/dist/enums/content-type-map.d.ts +16 -0
  51. package/dist/enums/content-type-map.js +23 -0
  52. package/dist/enums/content-type-map.js.map +1 -0
  53. package/dist/enums/element-type.d.ts +14 -0
  54. package/dist/enums/element-type.js +20 -0
  55. package/dist/enums/element-type.js.map +1 -0
  56. package/dist/errors.d.ts +81 -0
  57. package/dist/errors.js +100 -0
  58. package/dist/errors.js.map +1 -0
  59. package/dist/extensions/index.d.ts +5 -0
  60. package/dist/extensions/index.js +31 -0
  61. package/dist/extensions/index.js.map +1 -0
  62. package/dist/extensions/pptxgenjs-compat/img-broken-png.d.ts +5 -0
  63. package/dist/extensions/pptxgenjs-compat/img-broken-png.js +9 -0
  64. package/dist/extensions/pptxgenjs-compat/img-broken-png.js.map +1 -0
  65. package/dist/extensions/pptxgenjs-compat/index.d.ts +5 -0
  66. package/dist/extensions/pptxgenjs-compat/index.js +10 -0
  67. package/dist/extensions/pptxgenjs-compat/index.js.map +1 -0
  68. package/dist/extensions/pptxgenjs-compat/svg-fallback.d.ts +14 -0
  69. package/dist/extensions/pptxgenjs-compat/svg-fallback.js +139 -0
  70. package/dist/extensions/pptxgenjs-compat/svg-fallback.js.map +1 -0
  71. package/dist/extensions/template-logic/commands.d.ts +22 -0
  72. package/dist/extensions/template-logic/commands.js +83 -0
  73. package/dist/extensions/template-logic/commands.js.map +1 -0
  74. package/dist/extensions/template-logic/expression.d.ts +61 -0
  75. package/dist/extensions/template-logic/expression.js +499 -0
  76. package/dist/extensions/template-logic/expression.js.map +1 -0
  77. package/dist/extensions/template-logic/images.d.ts +26 -0
  78. package/dist/extensions/template-logic/images.js +183 -0
  79. package/dist/extensions/template-logic/images.js.map +1 -0
  80. package/dist/extensions/template-logic/index.d.ts +14 -0
  81. package/dist/extensions/template-logic/index.js +64 -0
  82. package/dist/extensions/template-logic/index.js.map +1 -0
  83. package/dist/extensions/template-logic/list-commands.d.ts +9 -0
  84. package/dist/extensions/template-logic/list-commands.js +72 -0
  85. package/dist/extensions/template-logic/list-commands.js.map +1 -0
  86. package/dist/extensions/template-logic/renderer.d.ts +85 -0
  87. package/dist/extensions/template-logic/renderer.js +867 -0
  88. package/dist/extensions/template-logic/renderer.js.map +1 -0
  89. package/dist/extensions/template-logic/types.d.ts +62 -0
  90. package/dist/extensions/template-logic/types.js +3 -0
  91. package/dist/extensions/template-logic/types.js.map +1 -0
  92. package/dist/helper/archive/archive-fs.d.ts +45 -0
  93. package/dist/helper/archive/archive-fs.js +206 -0
  94. package/dist/helper/archive/archive-fs.js.map +1 -0
  95. package/dist/helper/archive/archive-jszip.d.ts +31 -0
  96. package/dist/helper/archive/archive-jszip.js +173 -0
  97. package/dist/helper/archive/archive-jszip.js.map +1 -0
  98. package/dist/helper/archive/archive.d.ts +27 -0
  99. package/dist/helper/archive/archive.js +78 -0
  100. package/dist/helper/archive/archive.js.map +1 -0
  101. package/dist/helper/cell-id-helper.d.ts +25 -0
  102. package/dist/helper/cell-id-helper.js +95 -0
  103. package/dist/helper/cell-id-helper.js.map +1 -0
  104. package/dist/helper/compute-src-rect.d.ts +9 -0
  105. package/dist/helper/compute-src-rect.js +52 -0
  106. package/dist/helper/compute-src-rect.js.map +1 -0
  107. package/dist/helper/content-tracker.d.ts +31 -0
  108. package/dist/helper/content-tracker.js +227 -0
  109. package/dist/helper/content-tracker.js.map +1 -0
  110. package/dist/helper/count-helper.d.ts +33 -0
  111. package/dist/helper/count-helper.js +140 -0
  112. package/dist/helper/count-helper.js.map +1 -0
  113. package/dist/helper/css-style-parser.d.ts +52 -0
  114. package/dist/helper/css-style-parser.js +246 -0
  115. package/dist/helper/css-style-parser.js.map +1 -0
  116. package/dist/helper/file-helper.d.ts +36 -0
  117. package/dist/helper/file-helper.js +150 -0
  118. package/dist/helper/file-helper.js.map +1 -0
  119. package/dist/helper/general-helper.d.ts +6 -0
  120. package/dist/helper/general-helper.js +34 -0
  121. package/dist/helper/general-helper.js.map +1 -0
  122. package/dist/helper/generate/generate-pptxgenjs.d.ts +37 -0
  123. package/dist/helper/generate/generate-pptxgenjs.js +134 -0
  124. package/dist/helper/generate/generate-pptxgenjs.js.map +1 -0
  125. package/dist/helper/html-to-multitext-helper.d.ts +84 -0
  126. package/dist/helper/html-to-multitext-helper.js +490 -0
  127. package/dist/helper/html-to-multitext-helper.js.map +1 -0
  128. package/dist/helper/hyperlink-processor.d.ts +54 -0
  129. package/dist/helper/hyperlink-processor.js +289 -0
  130. package/dist/helper/hyperlink-processor.js.map +1 -0
  131. package/dist/helper/image-dimensions.d.ts +21 -0
  132. package/dist/helper/image-dimensions.js +202 -0
  133. package/dist/helper/image-dimensions.js.map +1 -0
  134. package/dist/helper/jszip-helper.d.ts +21 -0
  135. package/dist/helper/jszip-helper.js +162 -0
  136. package/dist/helper/jszip-helper.js.map +1 -0
  137. package/dist/helper/layout-index.d.ts +55 -0
  138. package/dist/helper/layout-index.js +155 -0
  139. package/dist/helper/layout-index.js.map +1 -0
  140. package/dist/helper/logger.d.ts +53 -0
  141. package/dist/helper/logger.js +73 -0
  142. package/dist/helper/logger.js.map +1 -0
  143. package/dist/helper/media-deduplicator.d.ts +42 -0
  144. package/dist/helper/media-deduplicator.js +88 -0
  145. package/dist/helper/media-deduplicator.js.map +1 -0
  146. package/dist/helper/modify-background-helper.d.ts +19 -0
  147. package/dist/helper/modify-background-helper.js +59 -0
  148. package/dist/helper/modify-background-helper.js.map +1 -0
  149. package/dist/helper/modify-chart-helper.d.ts +159 -0
  150. package/dist/helper/modify-chart-helper.js +642 -0
  151. package/dist/helper/modify-chart-helper.js.map +1 -0
  152. package/dist/helper/modify-cleanup-helper.d.ts +69 -0
  153. package/dist/helper/modify-cleanup-helper.js +343 -0
  154. package/dist/helper/modify-cleanup-helper.js.map +1 -0
  155. package/dist/helper/modify-color-helper.d.ts +35 -0
  156. package/dist/helper/modify-color-helper.js +211 -0
  157. package/dist/helper/modify-color-helper.js.map +1 -0
  158. package/dist/helper/modify-helper.d.ts +23 -0
  159. package/dist/helper/modify-helper.js +61 -0
  160. package/dist/helper/modify-helper.js.map +1 -0
  161. package/dist/helper/modify-hyperlink-element.d.ts +9 -0
  162. package/dist/helper/modify-hyperlink-element.js +34 -0
  163. package/dist/helper/modify-hyperlink-element.js.map +1 -0
  164. package/dist/helper/modify-hyperlink-helper.d.ts +42 -0
  165. package/dist/helper/modify-hyperlink-helper.js +258 -0
  166. package/dist/helper/modify-hyperlink-helper.js.map +1 -0
  167. package/dist/helper/modify-image-helper.d.ts +23 -0
  168. package/dist/helper/modify-image-helper.js +157 -0
  169. package/dist/helper/modify-image-helper.js.map +1 -0
  170. package/dist/helper/modify-presentation-helper.d.ts +55 -0
  171. package/dist/helper/modify-presentation-helper.js +177 -0
  172. package/dist/helper/modify-presentation-helper.js.map +1 -0
  173. package/dist/helper/modify-shape-helper.d.ts +111 -0
  174. package/dist/helper/modify-shape-helper.js +340 -0
  175. package/dist/helper/modify-shape-helper.js.map +1 -0
  176. package/dist/helper/modify-table-helper.d.ts +11 -0
  177. package/dist/helper/modify-table-helper.js +100 -0
  178. package/dist/helper/modify-table-helper.js.map +1 -0
  179. package/dist/helper/modify-text-helper.d.ts +62 -0
  180. package/dist/helper/modify-text-helper.js +244 -0
  181. package/dist/helper/modify-text-helper.js.map +1 -0
  182. package/dist/helper/modify-xml-helper.d.ts +52 -0
  183. package/dist/helper/modify-xml-helper.js +305 -0
  184. package/dist/helper/modify-xml-helper.js.map +1 -0
  185. package/dist/helper/multitext-helper.d.ts +116 -0
  186. package/dist/helper/multitext-helper.js +462 -0
  187. package/dist/helper/multitext-helper.js.map +1 -0
  188. package/dist/helper/ppt-paths.d.ts +76 -0
  189. package/dist/helper/ppt-paths.js +116 -0
  190. package/dist/helper/ppt-paths.js.map +1 -0
  191. package/dist/helper/shape-type-detector.d.ts +34 -0
  192. package/dist/helper/shape-type-detector.js +99 -0
  193. package/dist/helper/shape-type-detector.js.map +1 -0
  194. package/dist/helper/text-replace-helper.d.ts +30 -0
  195. package/dist/helper/text-replace-helper.js +147 -0
  196. package/dist/helper/text-replace-helper.js.map +1 -0
  197. package/dist/helper/xml/lnLRTB.d.ts +1 -0
  198. package/dist/helper/xml/lnLRTB.js +62 -0
  199. package/dist/helper/xml/lnLRTB.js.map +1 -0
  200. package/dist/helper/xml/prstGeom.d.ts +1 -0
  201. package/dist/helper/xml/prstGeom.js +11 -0
  202. package/dist/helper/xml/prstGeom.js.map +1 -0
  203. package/dist/helper/xml-elements.d.ts +134 -0
  204. package/dist/helper/xml-elements.js +538 -0
  205. package/dist/helper/xml-elements.js.map +1 -0
  206. package/dist/helper/xml-helper.d.ts +120 -0
  207. package/dist/helper/xml-helper.js +495 -0
  208. package/dist/helper/xml-helper.js.map +1 -0
  209. package/dist/helper/xml-placeholder-helper.d.ts +92 -0
  210. package/dist/helper/xml-placeholder-helper.js +454 -0
  211. package/dist/helper/xml-placeholder-helper.js.map +1 -0
  212. package/dist/helper/xml-pretty-print.d.ts +17 -0
  213. package/dist/helper/xml-pretty-print.js +88 -0
  214. package/dist/helper/xml-pretty-print.js.map +1 -0
  215. package/dist/helper/xml-relationship-helper.d.ts +103 -0
  216. package/dist/helper/xml-relationship-helper.js +397 -0
  217. package/dist/helper/xml-relationship-helper.js.map +1 -0
  218. package/dist/helper/xml-slide-helper.d.ts +107 -0
  219. package/dist/helper/xml-slide-helper.js +676 -0
  220. package/dist/helper/xml-slide-helper.js.map +1 -0
  221. package/dist/helper/xml-template-helper.d.ts +42 -0
  222. package/dist/helper/xml-template-helper.js +252 -0
  223. package/dist/helper/xml-template-helper.js.map +1 -0
  224. package/dist/helper/xmldom-sax-patch.d.ts +18 -0
  225. package/dist/helper/xmldom-sax-patch.js +58 -0
  226. package/dist/helper/xmldom-sax-patch.js.map +1 -0
  227. package/dist/index.d.ts +81 -0
  228. package/dist/index.js +177 -0
  229. package/dist/index.js.map +1 -0
  230. package/dist/interfaces/iarchive.d.ts +43 -0
  231. package/dist/interfaces/iarchive.js +3 -0
  232. package/dist/interfaces/iarchive.js.map +1 -0
  233. package/dist/interfaces/ichart.d.ts +7 -0
  234. package/dist/interfaces/ichart.js +3 -0
  235. package/dist/interfaces/ichart.js.map +1 -0
  236. package/dist/interfaces/icounter.d.ts +7 -0
  237. package/dist/interfaces/icounter.js +3 -0
  238. package/dist/interfaces/icounter.js.map +1 -0
  239. package/dist/interfaces/igenerator.d.ts +4 -0
  240. package/dist/interfaces/igenerator.js +3 -0
  241. package/dist/interfaces/igenerator.js.map +1 -0
  242. package/dist/interfaces/iimage.d.ts +7 -0
  243. package/dist/interfaces/iimage.js +3 -0
  244. package/dist/interfaces/iimage.js.map +1 -0
  245. package/dist/interfaces/ilayout.d.ts +14 -0
  246. package/dist/interfaces/ilayout.js +3 -0
  247. package/dist/interfaces/ilayout.js.map +1 -0
  248. package/dist/interfaces/imaster.d.ts +15 -0
  249. package/dist/interfaces/imaster.js +3 -0
  250. package/dist/interfaces/imaster.js.map +1 -0
  251. package/dist/interfaces/imulti-text.d.ts +50 -0
  252. package/dist/interfaces/imulti-text.js +3 -0
  253. package/dist/interfaces/imulti-text.js.map +1 -0
  254. package/dist/interfaces/ipptxgenjs-slide.d.ts +40 -0
  255. package/dist/interfaces/ipptxgenjs-slide.js +3 -0
  256. package/dist/interfaces/ipptxgenjs-slide.js.map +1 -0
  257. package/dist/interfaces/ipresentation-props.d.ts +16 -0
  258. package/dist/interfaces/ipresentation-props.js +3 -0
  259. package/dist/interfaces/ipresentation-props.js.map +1 -0
  260. package/dist/interfaces/ishape-action.d.ts +18 -0
  261. package/dist/interfaces/ishape-action.js +3 -0
  262. package/dist/interfaces/ishape-action.js.map +1 -0
  263. package/dist/interfaces/ishape.d.ts +5 -0
  264. package/dist/interfaces/ishape.js +3 -0
  265. package/dist/interfaces/ishape.js.map +1 -0
  266. package/dist/interfaces/islide.d.ts +71 -0
  267. package/dist/interfaces/islide.js +3 -0
  268. package/dist/interfaces/islide.js.map +1 -0
  269. package/dist/interfaces/itemplate.d.ts +9 -0
  270. package/dist/interfaces/itemplate.js +3 -0
  271. package/dist/interfaces/itemplate.js.map +1 -0
  272. package/dist/interfaces/pres-template.d.ts +9 -0
  273. package/dist/interfaces/pres-template.js +3 -0
  274. package/dist/interfaces/pres-template.js.map +1 -0
  275. package/dist/interfaces/root-pres-template.d.ts +38 -0
  276. package/dist/interfaces/root-pres-template.js +3 -0
  277. package/dist/interfaces/root-pres-template.js.map +1 -0
  278. package/dist/modify/modify-chart.d.ts +74 -0
  279. package/dist/modify/modify-chart.js +753 -0
  280. package/dist/modify/modify-chart.js.map +1 -0
  281. package/dist/modify/modify-table.d.ts +64 -0
  282. package/dist/modify/modify-table.js +435 -0
  283. package/dist/modify/modify-table.js.map +1 -0
  284. package/dist/shapes/chart.d.ts +91 -0
  285. package/dist/shapes/chart.js +437 -0
  286. package/dist/shapes/chart.js.map +1 -0
  287. package/dist/shapes/diagram.d.ts +33 -0
  288. package/dist/shapes/diagram.js +167 -0
  289. package/dist/shapes/diagram.js.map +1 -0
  290. package/dist/shapes/generic.d.ts +27 -0
  291. package/dist/shapes/generic.js +118 -0
  292. package/dist/shapes/generic.js.map +1 -0
  293. package/dist/shapes/hyperlink.d.ts +27 -0
  294. package/dist/shapes/hyperlink.js +193 -0
  295. package/dist/shapes/hyperlink.js.map +1 -0
  296. package/dist/shapes/image.d.ts +47 -0
  297. package/dist/shapes/image.js +244 -0
  298. package/dist/shapes/image.js.map +1 -0
  299. package/dist/shapes/ole.d.ts +30 -0
  300. package/dist/shapes/ole.js +237 -0
  301. package/dist/shapes/ole.js.map +1 -0
  302. package/dist/types/chart-types.d.ts +115 -0
  303. package/dist/types/chart-types.js +3 -0
  304. package/dist/types/chart-types.js.map +1 -0
  305. package/dist/types/modify-types.d.ts +128 -0
  306. package/dist/types/modify-types.js +3 -0
  307. package/dist/types/modify-types.js.map +1 -0
  308. package/dist/types/shape-types.d.ts +40 -0
  309. package/dist/types/shape-types.js +3 -0
  310. package/dist/types/shape-types.js.map +1 -0
  311. package/dist/types/table-types.d.ts +38 -0
  312. package/dist/types/table-types.js +3 -0
  313. package/dist/types/table-types.js.map +1 -0
  314. package/dist/types/types.d.ts +317 -0
  315. package/dist/types/types.js +16 -0
  316. package/dist/types/types.js.map +1 -0
  317. package/dist/types/xml-types.d.ts +168 -0
  318. package/dist/types/xml-types.js +3 -0
  319. package/dist/types/xml-types.js.map +1 -0
  320. package/package.json +92 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-elements.js","sourceRoot":"","sources":["../../src/helper/xml-elements.ts"],"names":[],"mappings":";;;AACA,6CAAyC;AACzC,2CAA2C;AAE3C,yCAAsC;AAQtC;;;;GAIG;AACH,MAAM,cAAc,GAAG;IACrB,UAAU;IACV,aAAa;IACb,YAAY;IACZ,YAAY;CACb,CAAC;AACF,MAAM,cAAc,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AACpD,MAAM,oBAAoB,GAAG;IAC3B,SAAS;IACT,SAAS;IACT,SAAS;IACT,WAAW;IACX,WAAW;IACX,UAAU;CACX,CAAC;AAEF;;;;GAIG;AACU,QAAA,iBAAiB,GAAG;IAC/B,OAAO;IACP,SAAS;IACT,MAAM;IACN,QAAQ;IACR,oBAAoB;IACpB,kBAAkB;IAClB,aAAa;IACb,UAAU;IACV,OAAO;IACP,SAAS;IACT,aAAa;IACb,WAAW;IACX,OAAO;IACP,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,SAAS;IACT,cAAc;IACd,YAAY;IACZ,UAAU;CACX,CAAC;AAEF;;;GAGG;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,CAAC;QAChE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;IAC7D,CAAC;;AApED;;;;GAIG;AACI,2BAAe,GAAG;IACvB,YAAY;IACZ,YAAY;IACZ,oBAAoB;IACpB,UAAU;IACV,UAAU;CACX,CAAC;kBApciB,WAAW"}
@@ -0,0 +1,120 @@
1
+ import { Node } from '@xmldom/xmldom';
2
+ import { DefaultAttribute, HelperElement, ModifyXmlCallback, OverrideAttribute, RelationshipAttribute, XmlDocument, XmlElement, XmlElementCollection, XmlNodeCollection } from '../types/xml-types';
3
+ import { GetRelationshipsCallback, Target } from '../types/types';
4
+ import IArchive from '../interfaces/iarchive';
5
+ import { ContentTypeExtension } from '../enums/content-type-map';
6
+ export declare class XmlHelper {
7
+ static modifyXmlInArchive(archive: IArchive, file: string, callbacks: ModifyXmlCallback[]): Promise<void>;
8
+ static getXmlFromArchive(archive: IArchive, file: string): Promise<XmlDocument>;
9
+ static writeXmlToArchive(archive: IArchive, file: string, xml: XmlDocument): void;
10
+ static appendIf(element: HelperElement): Promise<XmlElement | boolean>;
11
+ static append(element: HelperElement): Promise<XmlElement>;
12
+ static removeIf(element: HelperElement): Promise<XmlElement[]>;
13
+ /** @deprecated Use XmlRelationshipHelper.getNextRelId */
14
+ static getNextRelId(rootArchive: IArchive, file: string): Promise<string>;
15
+ /** @deprecated Use XmlRelationshipHelper.getMaxId */
16
+ static getMaxId(rels: XmlNodeCollection | XmlElementCollection, attribute: string, increment?: boolean, minId?: number): number;
17
+ /** @deprecated Use XmlRelationshipHelper.getRelationshipTargetsByPrefix */
18
+ static getRelationshipTargetsByPrefix(archive: IArchive, path: string, prefix: string | string[]): Promise<Target[]>;
19
+ /** @deprecated Use XmlRelationshipHelper.parseRelationTarget */
20
+ static parseRelationTarget(element: XmlElement, prefix?: string): Target;
21
+ /** @deprecated Use XmlRelationshipHelper.targetMatchesRelationship */
22
+ static targetMatchesRelationship(relType: string, subtype: string, file: string, prefix: string): boolean;
23
+ /** @deprecated Use XmlRelationshipHelper.getTargetsByRelationshipType */
24
+ static getTargetsByRelationshipType(archive: IArchive, path: string, type: string): Promise<Target[]>;
25
+ /** @deprecated Use XmlRelationshipHelper.getRelationshipItems */
26
+ static getRelationshipItems(archive: IArchive, path: string, cb: GetRelationshipsCallback, tag?: string): Promise<Target[]>;
27
+ static findByAttribute(xml: XmlDocument, tagName: string, attributeName: string, attributeValue: string): boolean;
28
+ static replaceAttribute(archive: IArchive, path: string, tagName: string, attributeName: string, attributeValue: string, replaceValue: string, replaceAttributeName?: string): Promise<void>;
29
+ /** @deprecated Use XmlRelationshipHelper.resolveElementTarget */
30
+ static getTargetByRelId(archive: IArchive, relsPath: string, element: XmlElement, type: string): Promise<Target>;
31
+ static isElementCreationId(selector: string): boolean;
32
+ static findByElementCreationId(archive: IArchive, path: string, creationId: string): Promise<XmlElement>;
33
+ static findByElementName(archive: IArchive, path: string, name: string, nameIdx?: number): Promise<XmlElement>;
34
+ static findByName(doc: XmlDocument, name: string, nameIdx?: number): XmlElement;
35
+ static findByCreationId(doc: XmlDocument, creationId: string): XmlElement;
36
+ static findFirstByAttributeValue(nodes: XmlNodeCollection | XmlElementCollection, attributeName: string, attributeValue: string): XmlElement;
37
+ static findByAttributeValue(nodes: XmlNodeCollection | XmlElementCollection, attributeName: string, attributeValue: string): XmlElement[];
38
+ static createContentTypeChild(archive: IArchive, attributes: OverrideAttribute | DefaultAttribute): HelperElement;
39
+ /** @deprecated Use XmlRelationshipHelper.createRelationshipChild */
40
+ static createRelationshipChild(archive: IArchive, targetRelFile: string, attributes: RelationshipAttribute): HelperElement;
41
+ static appendImageExtensionToContentType(targetArchive: IArchive, extension: ContentTypeExtension): Promise<XmlElement | boolean>;
42
+ static appendSharedString(sharedStrings: XmlDocument, stringValue: string): number;
43
+ /**
44
+ * Sanitize text for XML 1.0 compatibility.
45
+ * - Replace vertical tab (\u000B / \v) with a newline.
46
+ * - Remove other disallowed control characters (except TAB, LF, CR).
47
+ */
48
+ static sanitizeText(value: string | number | undefined | null): string;
49
+ /**
50
+ * Sanitize attribute values for XML 1.0. Uses same rules as sanitizeText.
51
+ */
52
+ static sanitizeAttr(value: string | number | undefined | null): string;
53
+ static insertAfter(newNode: XmlElement, referenceNode: XmlElement): XmlElement;
54
+ /**
55
+ * Copies a node collection into a plain array. xmldom's LiveNodeList
56
+ * re-walks the entire document on `.length` access after a mutation,
57
+ * while indexed access returns entries from before it — snapshot before
58
+ * iterating whenever the loop (or its callback) mutates the tree.
59
+ */
60
+ static collectionToArray(collection: XmlElementCollection | XmlNodeCollection): XmlElement[];
61
+ static sliceCollection(collection: XmlElementCollection, length: number, from?: number): void;
62
+ /**
63
+ * Find the first *direct* child of an element matching one of the given
64
+ * tag names. Unlike getElementsByTagName, this will not descend into
65
+ * grandchildren - e.g. an <a:ln> inside <p:spPr> is the shape outline,
66
+ * while an <a:ln> found anywhere below <p:sp> might belong to a text run.
67
+ *
68
+ * @param element - The parent element to scan
69
+ * @param tagNames - Tag names to look for, in no particular order
70
+ * @returns The first matching child element, or undefined
71
+ */
72
+ static getFirstDirectChild(element: XmlElement, tagNames: string[]): XmlElement | undefined;
73
+ /**
74
+ * Insert a child element at the position required by an OOXML schema
75
+ * sequence. Most DrawingML property containers (`a:pPr`, `a:rPr`, `a:ln`, …)
76
+ * declare their children as an ordered <xsd:sequence>: appending in call
77
+ * order instead of schema order is what makes PowerPoint offer to repair the
78
+ * file.
79
+ *
80
+ * The new child is inserted before the first existing direct child that
81
+ * ranks *after* it in `order`. Tags missing from `order` are treated as
82
+ * "ranks last" and therefore never displace a known tag.
83
+ *
84
+ * @param parent - The property container
85
+ * @param child - The element to insert
86
+ * @param order - Tag names in schema sequence order
87
+ */
88
+ static insertInSchemaOrder(parent: XmlElement, child: XmlElement, order: string[]): XmlElement;
89
+ /**
90
+ * Reorder the direct element children of a property container into the
91
+ * OOXML schema sequence given by `order`, keeping the relative order of
92
+ * equally-ranked and unknown tags (stable).
93
+ *
94
+ * Useful when several independent helpers append to the same container and
95
+ * no single one of them can know the final child set - e.g. `a:rPr`, which
96
+ * collects a fill, a highlight, a typeface and a hyperlink from four
97
+ * different code paths.
98
+ *
99
+ * @param parent - The property container
100
+ * @param order - Tag names in schema sequence order
101
+ */
102
+ static sortChildrenBySchema(parent: XmlElement, order: string[]): void;
103
+ static getClosestParent(tag: string, element: XmlElement): XmlElement;
104
+ static remove(toRemove: XmlElement): void;
105
+ static removeAllChildren(element: XmlElement): void;
106
+ static moveChild(childToMove: XmlElement, insertBefore?: XmlElement): void;
107
+ static appendClone(childToClone: XmlElement, parent: XmlElement): XmlElement;
108
+ static sortCollection(collection: XmlElementCollection, order: number[], callback?: ModifyXmlCallback): void;
109
+ static modifyCollection(collection: XmlElementCollection, callback: ModifyXmlCallback): void;
110
+ static modifyCollectionAsync(collection: XmlElementCollection, callback: ModifyXmlCallback): Promise<void>;
111
+ static dump(element: XmlDocument | XmlElement | Node): void;
112
+ static removeByTagName: (element: XmlElement, tagName: string, i?: number) => void;
113
+ /**
114
+ * Find an element with the given tag name, searching deeply through the structure
115
+ * @param element The root element to search in
116
+ * @param tagName The tag name to search for
117
+ * @returns The found element or null
118
+ */
119
+ static findElement(element: XmlElement, tagName: string): XmlElement | null;
120
+ }
@@ -0,0 +1,495 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.XmlHelper = void 0;
13
+ const xmldom_1 = require("@xmldom/xmldom");
14
+ const xml_pretty_print_1 = require("./xml-pretty-print");
15
+ const logger_1 = require("./logger");
16
+ const xml_relationship_helper_1 = require("./xml-relationship-helper");
17
+ const content_type_map_1 = require("../enums/content-type-map");
18
+ class XmlHelper {
19
+ static modifyXmlInArchive(archive, file, callbacks) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const fileProxy = yield archive;
22
+ const xml = yield XmlHelper.getXmlFromArchive(fileProxy, file);
23
+ let i = 0;
24
+ for (const callback of callbacks) {
25
+ yield callback(xml, i++, fileProxy);
26
+ }
27
+ XmlHelper.writeXmlToArchive(yield archive, file, xml);
28
+ });
29
+ }
30
+ static getXmlFromArchive(archive, file) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ return archive.readXml(file);
33
+ });
34
+ }
35
+ static writeXmlToArchive(archive, file, xml) {
36
+ archive.writeXml(file, xml);
37
+ }
38
+ static appendIf(element) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const xml = yield XmlHelper.getXmlFromArchive(element.archive, element.file);
41
+ return element.clause !== undefined && !element.clause(xml)
42
+ ? false
43
+ : XmlHelper.append(element);
44
+ });
45
+ }
46
+ static append(element) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ var _a;
49
+ const xml = yield XmlHelper.getXmlFromArchive(element.archive, element.file);
50
+ const newElement = xml.createElement(element.tag);
51
+ const attributes = (element.attributes || {});
52
+ for (const attribute in attributes) {
53
+ const value = attributes[attribute];
54
+ const setValue = typeof value === 'function' ? value(xml) : value;
55
+ newElement.setAttribute(attribute, String(setValue));
56
+ }
57
+ (_a = element.archive.contentTracker) === null || _a === void 0 ? void 0 : _a.trackRelation(element.file, element.attributes);
58
+ if (element.assert) {
59
+ element.assert(xml);
60
+ }
61
+ const parent = element.parent(xml);
62
+ parent.appendChild(newElement);
63
+ XmlHelper.writeXmlToArchive(element.archive, element.file, xml);
64
+ return newElement;
65
+ });
66
+ }
67
+ static removeIf(element) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const xml = yield XmlHelper.getXmlFromArchive(element.archive, element.file);
70
+ const collection = xml.getElementsByTagName(element.tag);
71
+ const toRemove = [];
72
+ XmlHelper.modifyCollection(collection, (item) => {
73
+ if (element.clause(xml, item)) {
74
+ toRemove.push(item);
75
+ }
76
+ });
77
+ toRemove.forEach((item) => {
78
+ XmlHelper.remove(item);
79
+ });
80
+ XmlHelper.writeXmlToArchive(element.archive, element.file, xml);
81
+ return toRemove;
82
+ });
83
+ }
84
+ /** @deprecated Use XmlRelationshipHelper.getNextRelId */
85
+ static getNextRelId(rootArchive, file) {
86
+ return __awaiter(this, void 0, void 0, function* () {
87
+ return xml_relationship_helper_1.XmlRelationshipHelper.getNextRelId(rootArchive, file);
88
+ });
89
+ }
90
+ /** @deprecated Use XmlRelationshipHelper.getMaxId */
91
+ static getMaxId(rels, attribute, increment, minId) {
92
+ return xml_relationship_helper_1.XmlRelationshipHelper.getMaxId(rels, attribute, increment, minId);
93
+ }
94
+ /** @deprecated Use XmlRelationshipHelper.getRelationshipTargetsByPrefix */
95
+ static getRelationshipTargetsByPrefix(archive, path, prefix) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ return xml_relationship_helper_1.XmlRelationshipHelper.getRelationshipTargetsByPrefix(archive, path, prefix);
98
+ });
99
+ }
100
+ /** @deprecated Use XmlRelationshipHelper.parseRelationTarget */
101
+ static parseRelationTarget(element, prefix) {
102
+ return xml_relationship_helper_1.XmlRelationshipHelper.parseRelationTarget(element, prefix);
103
+ }
104
+ /** @deprecated Use XmlRelationshipHelper.targetMatchesRelationship */
105
+ static targetMatchesRelationship(relType, subtype, file, prefix) {
106
+ return xml_relationship_helper_1.XmlRelationshipHelper.targetMatchesRelationship(relType, subtype, file, prefix);
107
+ }
108
+ /** @deprecated Use XmlRelationshipHelper.getTargetsByRelationshipType */
109
+ static getTargetsByRelationshipType(archive, path, type) {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ return xml_relationship_helper_1.XmlRelationshipHelper.getTargetsByRelationshipType(archive, path, type);
112
+ });
113
+ }
114
+ /** @deprecated Use XmlRelationshipHelper.getRelationshipItems */
115
+ static getRelationshipItems(archive, path, cb, tag) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ return xml_relationship_helper_1.XmlRelationshipHelper.getRelationshipItems(archive, path, cb, tag);
118
+ });
119
+ }
120
+ static findByAttribute(xml, tagName, attributeName, attributeValue) {
121
+ const elements = xml.getElementsByTagName(tagName);
122
+ for (const i in elements) {
123
+ const element = elements[i];
124
+ if (element.getAttribute !== undefined) {
125
+ if (element.getAttribute(attributeName) === attributeValue) {
126
+ return true;
127
+ }
128
+ }
129
+ }
130
+ return false;
131
+ }
132
+ static replaceAttribute(archive, path, tagName, attributeName, attributeValue, replaceValue, replaceAttributeName) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ var _a;
135
+ const xml = yield XmlHelper.getXmlFromArchive(archive, path);
136
+ const elements = xml.getElementsByTagName(tagName);
137
+ for (const i in elements) {
138
+ const element = elements[i];
139
+ if (element.getAttribute !== undefined &&
140
+ element.getAttribute(attributeName) === attributeValue) {
141
+ element.setAttribute(replaceAttributeName || attributeName, replaceValue);
142
+ }
143
+ if (element.getAttribute !== undefined) {
144
+ (_a = archive.contentTracker) === null || _a === void 0 ? void 0 : _a.trackRelation(path, {
145
+ Id: element.getAttribute('Id'),
146
+ Target: element.getAttribute('Target'),
147
+ Type: element.getAttribute('Type'),
148
+ });
149
+ }
150
+ }
151
+ XmlHelper.writeXmlToArchive(archive, path, xml);
152
+ });
153
+ }
154
+ /** @deprecated Use XmlRelationshipHelper.resolveElementTarget */
155
+ static getTargetByRelId(archive, relsPath, element, type) {
156
+ return __awaiter(this, void 0, void 0, function* () {
157
+ return xml_relationship_helper_1.XmlRelationshipHelper.resolveElementTarget(archive, relsPath, element, type);
158
+ });
159
+ }
160
+ // Determine whether a given string is a creationId or a shape name
161
+ // Example creationId: '{EFC74B4C-D832-409B-9CF4-73C1EFF132D8}'
162
+ static isElementCreationId(selector) {
163
+ return selector.indexOf('{') === 0 && selector.split('-').length === 5;
164
+ }
165
+ static findByElementCreationId(archive, path, creationId) {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ const slideXml = yield XmlHelper.getXmlFromArchive(archive, path);
168
+ return XmlHelper.findByCreationId(slideXml, creationId);
169
+ });
170
+ }
171
+ static findByElementName(archive, path, name, nameIdx) {
172
+ return __awaiter(this, void 0, void 0, function* () {
173
+ const slideXml = yield XmlHelper.getXmlFromArchive(archive, path);
174
+ return XmlHelper.findByName(slideXml, name, nameIdx);
175
+ });
176
+ }
177
+ static findByName(doc, name, nameIdx) {
178
+ const names = doc.getElementsByTagName('p:cNvPr');
179
+ let matchCount = 0;
180
+ // Default nameIdx to 0 if not provided
181
+ const targetIdx = nameIdx !== undefined ? nameIdx : 0;
182
+ for (let i = 0; i < names.length; i++) {
183
+ const item = names.item(i);
184
+ if (item && item.getAttribute && item.getAttribute('name') === name) {
185
+ // Check if this is the occurrence we're looking for
186
+ if (matchCount === targetIdx) {
187
+ return item.parentNode.parentNode;
188
+ }
189
+ matchCount++;
190
+ }
191
+ }
192
+ return null;
193
+ }
194
+ static findByCreationId(doc, creationId) {
195
+ const creationIds = doc.getElementsByTagName('a16:creationId');
196
+ for (const i in creationIds) {
197
+ if (creationIds[i].getAttribute &&
198
+ creationIds[i].getAttribute('id') === creationId) {
199
+ return creationIds[i].parentNode.parentNode.parentNode.parentNode
200
+ .parentNode;
201
+ }
202
+ }
203
+ return null;
204
+ }
205
+ static findFirstByAttributeValue(nodes, attributeName, attributeValue) {
206
+ for (const i in nodes) {
207
+ const node = nodes[i];
208
+ if (node.getAttribute &&
209
+ node.getAttribute(attributeName) === attributeValue) {
210
+ return node;
211
+ }
212
+ }
213
+ return null;
214
+ }
215
+ static findByAttributeValue(nodes, attributeName, attributeValue) {
216
+ const matchingNodes = [];
217
+ for (const i in nodes) {
218
+ const node = nodes[i];
219
+ if (node.getAttribute &&
220
+ node.getAttribute(attributeName) === attributeValue) {
221
+ matchingNodes.push(node);
222
+ }
223
+ }
224
+ return matchingNodes;
225
+ }
226
+ static createContentTypeChild(archive, attributes) {
227
+ return {
228
+ archive,
229
+ file: `[Content_Types].xml`,
230
+ // `Types` is the document element; a live getElementsByTagName lookup
231
+ // would re-walk the whole (growing) part on every append.
232
+ parent: (xml) => xml.documentElement,
233
+ tag: 'Override',
234
+ attributes,
235
+ };
236
+ }
237
+ /** @deprecated Use XmlRelationshipHelper.createRelationshipChild */
238
+ static createRelationshipChild(archive, targetRelFile, attributes) {
239
+ return xml_relationship_helper_1.XmlRelationshipHelper.createRelationshipChild(archive, targetRelFile, attributes);
240
+ }
241
+ static appendImageExtensionToContentType(targetArchive, extension) {
242
+ const contentType = content_type_map_1.ContentTypeMap[extension]
243
+ ? content_type_map_1.ContentTypeMap[extension]
244
+ : 'image/' + extension;
245
+ return XmlHelper.appendIf(Object.assign(Object.assign({}, XmlHelper.createContentTypeChild(targetArchive, {
246
+ Extension: extension,
247
+ ContentType: contentType,
248
+ })), { tag: 'Default', clause: (xml) => !XmlHelper.findByAttribute(xml, 'Default', 'Extension', extension) }));
249
+ }
250
+ static appendSharedString(sharedStrings, stringValue) {
251
+ const strings = sharedStrings.getElementsByTagName('sst')[0];
252
+ const newLabel = sharedStrings.createTextNode(XmlHelper.sanitizeText(stringValue));
253
+ const newText = sharedStrings.createElement('t');
254
+ newText.appendChild(newLabel);
255
+ const newString = sharedStrings.createElement('si');
256
+ newString.appendChild(newText);
257
+ strings.appendChild(newString);
258
+ return strings.getElementsByTagName('si').length - 1;
259
+ }
260
+ /**
261
+ * Sanitize text for XML 1.0 compatibility.
262
+ * - Replace vertical tab (\u000B / \v) with a newline.
263
+ * - Remove other disallowed control characters (except TAB, LF, CR).
264
+ */
265
+ static sanitizeText(value) {
266
+ if (value == null)
267
+ return '';
268
+ return (String(value)
269
+ // eslint-disable-next-line no-control-regex -- stripping control chars is the point here
270
+ .replace(/\u000B/g, '\n')
271
+ // eslint-disable-next-line no-control-regex -- stripping control chars is the point here
272
+ .replace(/[\u0000-\u0008\u000C\u000E-\u001F]/g, ''));
273
+ }
274
+ /**
275
+ * Sanitize attribute values for XML 1.0. Uses same rules as sanitizeText.
276
+ */
277
+ static sanitizeAttr(value) {
278
+ return XmlHelper.sanitizeText(value);
279
+ }
280
+ static insertAfter(newNode, referenceNode) {
281
+ return referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
282
+ }
283
+ /**
284
+ * Copies a node collection into a plain array. xmldom's LiveNodeList
285
+ * re-walks the entire document on `.length` access after a mutation,
286
+ * while indexed access returns entries from before it — snapshot before
287
+ * iterating whenever the loop (or its callback) mutates the tree.
288
+ */
289
+ static collectionToArray(collection) {
290
+ const items = [];
291
+ const length = collection.length;
292
+ for (let i = 0; i < length; i++) {
293
+ items.push(collection[i]);
294
+ }
295
+ return items;
296
+ }
297
+ static sliceCollection(collection, length, from) {
298
+ const items = XmlHelper.collectionToArray(collection);
299
+ const removeItems = from !== undefined ? items.slice(from, length) : items.slice(length);
300
+ removeItems.forEach((item) => XmlHelper.remove(item));
301
+ }
302
+ /**
303
+ * Find the first *direct* child of an element matching one of the given
304
+ * tag names. Unlike getElementsByTagName, this will not descend into
305
+ * grandchildren - e.g. an <a:ln> inside <p:spPr> is the shape outline,
306
+ * while an <a:ln> found anywhere below <p:sp> might belong to a text run.
307
+ *
308
+ * @param element - The parent element to scan
309
+ * @param tagNames - Tag names to look for, in no particular order
310
+ * @returns The first matching child element, or undefined
311
+ */
312
+ static getFirstDirectChild(element, tagNames) {
313
+ for (let i = 0; i < element.childNodes.length; i++) {
314
+ const child = element.childNodes.item(i);
315
+ if (tagNames.includes(child.nodeName)) {
316
+ return child;
317
+ }
318
+ }
319
+ }
320
+ /**
321
+ * Insert a child element at the position required by an OOXML schema
322
+ * sequence. Most DrawingML property containers (`a:pPr`, `a:rPr`, `a:ln`, …)
323
+ * declare their children as an ordered <xsd:sequence>: appending in call
324
+ * order instead of schema order is what makes PowerPoint offer to repair the
325
+ * file.
326
+ *
327
+ * The new child is inserted before the first existing direct child that
328
+ * ranks *after* it in `order`. Tags missing from `order` are treated as
329
+ * "ranks last" and therefore never displace a known tag.
330
+ *
331
+ * @param parent - The property container
332
+ * @param child - The element to insert
333
+ * @param order - Tag names in schema sequence order
334
+ */
335
+ static insertInSchemaOrder(parent, child, order) {
336
+ const rank = (tagName) => {
337
+ const index = order.indexOf(tagName);
338
+ return index === -1 ? order.length : index;
339
+ };
340
+ const childRank = rank(child.nodeName);
341
+ for (let i = 0; i < parent.childNodes.length; i++) {
342
+ const existing = parent.childNodes.item(i);
343
+ if (existing.nodeType !== 1) {
344
+ continue;
345
+ }
346
+ if (rank(existing.nodeName) > childRank) {
347
+ return parent.insertBefore(child, existing);
348
+ }
349
+ }
350
+ return parent.appendChild(child);
351
+ }
352
+ /**
353
+ * Reorder the direct element children of a property container into the
354
+ * OOXML schema sequence given by `order`, keeping the relative order of
355
+ * equally-ranked and unknown tags (stable).
356
+ *
357
+ * Useful when several independent helpers append to the same container and
358
+ * no single one of them can know the final child set - e.g. `a:rPr`, which
359
+ * collects a fill, a highlight, a typeface and a hyperlink from four
360
+ * different code paths.
361
+ *
362
+ * @param parent - The property container
363
+ * @param order - Tag names in schema sequence order
364
+ */
365
+ static sortChildrenBySchema(parent, order) {
366
+ if (!(parent === null || parent === void 0 ? void 0 : parent.childNodes)) {
367
+ return;
368
+ }
369
+ const children = [];
370
+ for (let i = 0; i < parent.childNodes.length; i++) {
371
+ const child = parent.childNodes.item(i);
372
+ if (child.nodeType === 1) {
373
+ children.push(child);
374
+ }
375
+ }
376
+ const rank = (element) => {
377
+ const index = order.indexOf(element.nodeName);
378
+ return index === -1 ? order.length : index;
379
+ };
380
+ const sorted = children
381
+ .map((child, index) => ({ child, index }))
382
+ .sort((a, b) => rank(a.child) - rank(b.child) || a.index - b.index)
383
+ .map((entry) => entry.child);
384
+ const alreadySorted = sorted.every((child, index) => child === children[index]);
385
+ if (alreadySorted) {
386
+ return;
387
+ }
388
+ sorted.forEach((child) => parent.appendChild(child));
389
+ }
390
+ static getClosestParent(tag, element) {
391
+ if (element.parentNode) {
392
+ if (element.parentNode.nodeName === tag) {
393
+ return element.parentNode;
394
+ }
395
+ return XmlHelper.getClosestParent(tag, element.parentNode);
396
+ }
397
+ }
398
+ static remove(toRemove) {
399
+ if (toRemove === null || toRemove === void 0 ? void 0 : toRemove.parentNode) {
400
+ toRemove.parentNode.removeChild(toRemove);
401
+ }
402
+ }
403
+ static removeAllChildren(element) {
404
+ if (element === null || element === void 0 ? void 0 : element.childNodes) {
405
+ while (element.childNodes.length > 0) {
406
+ element.removeChild(element.childNodes[0]);
407
+ }
408
+ }
409
+ }
410
+ static moveChild(childToMove, insertBefore) {
411
+ const parent = childToMove.parentNode;
412
+ parent.insertBefore(childToMove, insertBefore);
413
+ }
414
+ static appendClone(childToClone, parent) {
415
+ const clone = childToClone.cloneNode(true);
416
+ parent.appendChild(clone);
417
+ return clone;
418
+ }
419
+ static sortCollection(collection, order, callback) {
420
+ if (collection.length === 0) {
421
+ return;
422
+ }
423
+ const parent = collection[0].parentNode;
424
+ order.forEach((index, i) => {
425
+ if (!collection[index]) {
426
+ logger_1.log.warn('sortCollection index not found' + index);
427
+ return;
428
+ }
429
+ const item = collection[index];
430
+ if (callback) {
431
+ callback(item, i);
432
+ }
433
+ parent.appendChild(item);
434
+ });
435
+ }
436
+ static modifyCollection(collection, callback) {
437
+ const items = XmlHelper.collectionToArray(collection);
438
+ for (let i = 0; i < items.length; i++) {
439
+ callback(items[i], i);
440
+ }
441
+ }
442
+ static modifyCollectionAsync(collection, callback) {
443
+ return __awaiter(this, void 0, void 0, function* () {
444
+ const items = XmlHelper.collectionToArray(collection);
445
+ for (let i = 0; i < items.length; i++) {
446
+ yield callback(items[i], i);
447
+ }
448
+ });
449
+ }
450
+ static dump(element) {
451
+ const s = new xmldom_1.XMLSerializer();
452
+ const xmlBuffer = s.serializeToString(element);
453
+ const p = new xml_pretty_print_1.XmlPrettyPrint(xmlBuffer);
454
+ p.dump();
455
+ }
456
+ /**
457
+ * Find an element with the given tag name, searching deeply through the structure
458
+ * @param element The root element to search in
459
+ * @param tagName The tag name to search for
460
+ * @returns The found element or null
461
+ */
462
+ static findElement(element, tagName) {
463
+ // Check if element exists
464
+ if (!element) {
465
+ return null;
466
+ }
467
+ // Direct child check
468
+ const directMatch = element.getElementsByTagName(tagName)[0];
469
+ if (directMatch) {
470
+ return directMatch;
471
+ }
472
+ // Recursive check in child elements
473
+ // Make sure element.children exists before accessing it
474
+ if (element.children && element.children.length) {
475
+ for (let i = 0; i < element.children.length; i++) {
476
+ const child = element.children[i];
477
+ if (child.nodeType === 1) {
478
+ // Element node
479
+ const found = XmlHelper.findElement(child, tagName);
480
+ if (found) {
481
+ return found;
482
+ }
483
+ }
484
+ }
485
+ }
486
+ return null;
487
+ }
488
+ }
489
+ exports.XmlHelper = XmlHelper;
490
+ XmlHelper.removeByTagName = (element, tagName, i = 0) => {
491
+ const tagToRemove = element.getElementsByTagName(tagName).item(i);
492
+ if (tagToRemove)
493
+ XmlHelper.remove(tagToRemove);
494
+ };
495
+ //# sourceMappingURL=xml-helper.js.map