@zowe/cli 8.36.1 → 8.37.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 (562) hide show
  1. package/lib/zosfiles/-strings-/en.d.ts +2 -0
  2. package/lib/zosfiles/-strings-/en.d.ts.map +1 -1
  3. package/lib/zosfiles/-strings-/en.js +5 -1
  4. package/lib/zosfiles/-strings-/en.js.map +1 -1
  5. package/lib/zosfiles/ZosFiles.options.d.ts.map +1 -1
  6. package/lib/zosfiles/ZosFiles.options.js +3 -1
  7. package/lib/zosfiles/ZosFiles.options.js.map +1 -1
  8. package/lib/zosfiles/create/Create.utils.d.ts.map +1 -1
  9. package/lib/zosfiles/create/Create.utils.js +3 -1
  10. package/lib/zosfiles/create/Create.utils.js.map +1 -1
  11. package/lib/zosfiles/create/ussDir/ussDir.handler.d.ts.map +1 -1
  12. package/lib/zosfiles/create/ussDir/ussDir.handler.js +5 -1
  13. package/lib/zosfiles/create/ussDir/ussDir.handler.js.map +1 -1
  14. package/lib/zosfiles/create/ussFile/ussFile.handler.d.ts.map +1 -1
  15. package/lib/zosfiles/create/ussFile/ussFile.handler.js +5 -1
  16. package/lib/zosfiles/create/ussFile/ussFile.handler.js.map +1 -1
  17. package/lib/zosfiles/create/vsam/vsam.handler.d.ts.map +1 -1
  18. package/lib/zosfiles/create/vsam/vsam.handler.js +3 -1
  19. package/lib/zosfiles/create/vsam/vsam.handler.js.map +1 -1
  20. package/lib/zosfiles/create/zfs/zfs.handler.d.ts.map +1 -1
  21. package/lib/zosfiles/create/zfs/zfs.handler.js +3 -1
  22. package/lib/zosfiles/create/zfs/zfs.handler.js.map +1 -1
  23. package/lib/zosfiles/delete/ds/Ds.handler.d.ts.map +1 -1
  24. package/lib/zosfiles/delete/ds/Ds.handler.js +4 -1
  25. package/lib/zosfiles/delete/ds/Ds.handler.js.map +1 -1
  26. package/lib/zosfiles/delete/uss/Uss.handler.d.ts.map +1 -1
  27. package/lib/zosfiles/delete/uss/Uss.handler.js +5 -1
  28. package/lib/zosfiles/delete/uss/Uss.handler.js.map +1 -1
  29. package/lib/zosfiles/delete/vsam/Vsam.handler.d.ts.map +1 -1
  30. package/lib/zosfiles/delete/vsam/Vsam.handler.js +3 -1
  31. package/lib/zosfiles/delete/vsam/Vsam.handler.js.map +1 -1
  32. package/lib/zosfiles/delete/zfs/zfs.handler.d.ts.map +1 -1
  33. package/lib/zosfiles/delete/zfs/zfs.handler.js +3 -1
  34. package/lib/zosfiles/delete/zfs/zfs.handler.js.map +1 -1
  35. package/lib/zosfiles/download/am/AllMembers.handler.d.ts.map +1 -1
  36. package/lib/zosfiles/download/am/AllMembers.handler.js +3 -1
  37. package/lib/zosfiles/download/am/AllMembers.handler.js.map +1 -1
  38. package/lib/zosfiles/download/amm/AllMembersMatching.handler.d.ts.map +1 -1
  39. package/lib/zosfiles/download/amm/AllMembersMatching.handler.js +2 -0
  40. package/lib/zosfiles/download/amm/AllMembersMatching.handler.js.map +1 -1
  41. package/lib/zosfiles/download/ds/Dataset.handler.d.ts.map +1 -1
  42. package/lib/zosfiles/download/ds/Dataset.handler.js +3 -1
  43. package/lib/zosfiles/download/ds/Dataset.handler.js.map +1 -1
  44. package/lib/zosfiles/download/dsm/DataSetMatching.handler.d.ts.map +1 -1
  45. package/lib/zosfiles/download/dsm/DataSetMatching.handler.js +6 -2
  46. package/lib/zosfiles/download/dsm/DataSetMatching.handler.js.map +1 -1
  47. package/lib/zosfiles/download/uss/UssFile.handler.d.ts.map +1 -1
  48. package/lib/zosfiles/download/uss/UssFile.handler.js +2 -0
  49. package/lib/zosfiles/download/uss/UssFile.handler.js.map +1 -1
  50. package/lib/zosfiles/download/ussdir/UssDir.handler.d.ts.map +1 -1
  51. package/lib/zosfiles/download/ussdir/UssDir.handler.js +6 -2
  52. package/lib/zosfiles/download/ussdir/UssDir.handler.js.map +1 -1
  53. package/lib/zosfiles/edit/Edit.utils.d.ts +2 -2
  54. package/lib/zosfiles/edit/Edit.utils.d.ts.map +1 -1
  55. package/lib/zosfiles/edit/Edit.utils.js +10 -10
  56. package/lib/zosfiles/edit/Edit.utils.js.map +1 -1
  57. package/lib/zosfiles/invoke/amsFile/AmsFile.handler.d.ts.map +1 -1
  58. package/lib/zosfiles/invoke/amsFile/AmsFile.handler.js +5 -1
  59. package/lib/zosfiles/invoke/amsFile/AmsFile.handler.js.map +1 -1
  60. package/lib/zosfiles/invoke/amsStatements/AmsStatements.handler.d.ts.map +1 -1
  61. package/lib/zosfiles/invoke/amsStatements/AmsStatements.handler.js +5 -1
  62. package/lib/zosfiles/invoke/amsStatements/AmsStatements.handler.js.map +1 -1
  63. package/lib/zosfiles/list/alias/Alias.handler.d.ts.map +1 -1
  64. package/lib/zosfiles/list/alias/Alias.handler.js +3 -1
  65. package/lib/zosfiles/list/alias/Alias.handler.js.map +1 -1
  66. package/lib/zosfiles/list/am/AllMembers.handler.d.ts.map +1 -1
  67. package/lib/zosfiles/list/am/AllMembers.handler.js +3 -1
  68. package/lib/zosfiles/list/am/AllMembers.handler.js.map +1 -1
  69. package/lib/zosfiles/list/ds/DataSet.handler.d.ts.map +1 -1
  70. package/lib/zosfiles/list/ds/DataSet.handler.js +3 -1
  71. package/lib/zosfiles/list/ds/DataSet.handler.js.map +1 -1
  72. package/lib/zosfiles/list/fs/Fs.handler.d.ts.map +1 -1
  73. package/lib/zosfiles/list/fs/Fs.handler.js +6 -2
  74. package/lib/zosfiles/list/fs/Fs.handler.js.map +1 -1
  75. package/lib/zosfiles/list/uss/UssFile.handler.d.ts.map +1 -1
  76. package/lib/zosfiles/list/uss/UssFile.handler.js +3 -1
  77. package/lib/zosfiles/list/uss/UssFile.handler.js.map +1 -1
  78. package/lib/zosfiles/mount/fs/fs.handler.d.ts.map +1 -1
  79. package/lib/zosfiles/mount/fs/fs.handler.js +3 -1
  80. package/lib/zosfiles/mount/fs/fs.handler.js.map +1 -1
  81. package/lib/zosfiles/rename/ds/Ds.handler.d.ts.map +1 -1
  82. package/lib/zosfiles/rename/ds/Ds.handler.js +4 -1
  83. package/lib/zosfiles/rename/ds/Ds.handler.js.map +1 -1
  84. package/lib/zosfiles/rename/dsm/Dsm.handler.d.ts.map +1 -1
  85. package/lib/zosfiles/rename/dsm/Dsm.handler.js +4 -1
  86. package/lib/zosfiles/rename/dsm/Dsm.handler.js.map +1 -1
  87. package/lib/zosfiles/search/ds/DataSets.handler.d.ts.map +1 -1
  88. package/lib/zosfiles/search/ds/DataSets.handler.js +10 -2
  89. package/lib/zosfiles/search/ds/DataSets.handler.js.map +1 -1
  90. package/lib/zosfiles/upload/dtp/DirToPds.handler.d.ts.map +1 -1
  91. package/lib/zosfiles/upload/dtp/DirToPds.handler.js +3 -1
  92. package/lib/zosfiles/upload/dtp/DirToPds.handler.js.map +1 -1
  93. package/lib/zosfiles/upload/dtu/DirToUSSDir.handler.d.ts.map +1 -1
  94. package/lib/zosfiles/upload/dtu/DirToUSSDir.handler.js +3 -1
  95. package/lib/zosfiles/upload/dtu/DirToUSSDir.handler.js.map +1 -1
  96. package/lib/zosfiles/upload/ftds/FileToDataSet.handler.d.ts.map +1 -1
  97. package/lib/zosfiles/upload/ftds/FileToDataSet.handler.js +3 -1
  98. package/lib/zosfiles/upload/ftds/FileToDataSet.handler.js.map +1 -1
  99. package/lib/zosfiles/upload/ftu/FileToUSS.handler.d.ts.map +1 -1
  100. package/lib/zosfiles/upload/ftu/FileToUSS.handler.js +3 -1
  101. package/lib/zosfiles/upload/ftu/FileToUSS.handler.js.map +1 -1
  102. package/lib/zosfiles/upload/stds/StdinToDataSet.handler.d.ts.map +1 -1
  103. package/lib/zosfiles/upload/stds/StdinToDataSet.handler.js +3 -1
  104. package/lib/zosfiles/upload/stds/StdinToDataSet.handler.js.map +1 -1
  105. package/lib/zosfiles/view/ds/Dataset.handler.d.ts.map +1 -1
  106. package/lib/zosfiles/view/ds/Dataset.handler.js +3 -1
  107. package/lib/zosfiles/view/ds/Dataset.handler.js.map +1 -1
  108. package/lib/zosfiles/view/uss/USSFile.handler.d.ts.map +1 -1
  109. package/lib/zosfiles/view/uss/USSFile.handler.js +3 -1
  110. package/lib/zosfiles/view/uss/USSFile.handler.js.map +1 -1
  111. package/node_modules/@zowe/core-for-zowe-sdk/lib/rest/ZosmfHeaders.d.ts +14 -0
  112. package/node_modules/@zowe/core-for-zowe-sdk/lib/rest/ZosmfHeaders.d.ts.map +1 -1
  113. package/node_modules/@zowe/core-for-zowe-sdk/lib/rest/ZosmfHeaders.js +14 -0
  114. package/node_modules/@zowe/core-for-zowe-sdk/lib/rest/ZosmfHeaders.js.map +1 -1
  115. package/node_modules/@zowe/core-for-zowe-sdk/package.json +3 -3
  116. package/node_modules/@zowe/imperative/lib/config/src/ConfigSchema.d.ts.map +1 -1
  117. package/node_modules/@zowe/imperative/lib/config/src/ConfigSchema.js +1 -0
  118. package/node_modules/@zowe/imperative/lib/config/src/ConfigSchema.js.map +1 -1
  119. package/node_modules/@zowe/imperative/package.json +3 -3
  120. package/node_modules/@zowe/imperative/web-help/package-lock.json +62 -62
  121. package/node_modules/@zowe/provisioning-for-zowe-sdk/package.json +4 -4
  122. package/node_modules/@zowe/secrets-for-zowe-sdk/README.md +70 -0
  123. package/node_modules/@zowe/secrets-for-zowe-sdk/package.json +1 -1
  124. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.darwin-arm64.node +0 -0
  125. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.darwin-x64.node +0 -0
  126. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-arm-gnueabihf.node +0 -0
  127. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-arm64-gnu.node +0 -0
  128. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-ia32-gnu.node +0 -0
  129. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-x64-gnu.node +0 -0
  130. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.win32-arm64-msvc.node +0 -0
  131. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.win32-ia32-msvc.node +0 -0
  132. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.win32-x64-msvc.node +0 -0
  133. package/node_modules/@zowe/zos-console-for-zowe-sdk/package.json +4 -4
  134. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/doc/IZosFilesOptions.d.ts +12 -0
  135. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/doc/IZosFilesOptions.d.ts.map +1 -1
  136. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/copy/Copy.js +1 -1
  137. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/copy/Copy.js.map +1 -1
  138. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/create/Create.d.ts.map +1 -1
  139. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/create/Create.js +18 -3
  140. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/create/Create.js.map +1 -1
  141. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/delete/Delete.d.ts.map +1 -1
  142. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/delete/Delete.js +7 -3
  143. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/delete/Delete.js.map +1 -1
  144. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/download/Download.js +1 -1
  145. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/download/Download.js.map +1 -1
  146. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/invoke/Invoke.d.ts.map +1 -1
  147. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/invoke/Invoke.js +2 -1
  148. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/invoke/Invoke.js.map +1 -1
  149. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/list/List.d.ts.map +1 -1
  150. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/list/List.js +6 -5
  151. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/list/List.js.map +1 -1
  152. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/mount/Mount.d.ts.map +1 -1
  153. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/mount/Mount.js +6 -0
  154. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/mount/Mount.js.map +1 -1
  155. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/rename/Rename.d.ts.map +1 -1
  156. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/rename/Rename.js +2 -1
  157. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/rename/Rename.js.map +1 -1
  158. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/unmount/Unmount.d.ts.map +1 -1
  159. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/unmount/Unmount.js +3 -1
  160. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/unmount/Unmount.js.map +1 -1
  161. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/upload/Upload.d.ts.map +1 -1
  162. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/upload/Upload.js +5 -5
  163. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/upload/Upload.js.map +1 -1
  164. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.d.ts +4 -4
  165. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.d.ts.map +1 -1
  166. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.js +10 -33
  167. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.js.map +1 -1
  168. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.d.ts +7 -0
  169. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.d.ts.map +1 -1
  170. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.js +16 -0
  171. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.js.map +1 -1
  172. package/node_modules/@zowe/zos-files-for-zowe-sdk/package.json +5 -5
  173. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/package.json +5 -5
  174. package/node_modules/@zowe/zos-logs-for-zowe-sdk/package.json +4 -4
  175. package/node_modules/@zowe/zos-tso-for-zowe-sdk/package.json +5 -5
  176. package/node_modules/@zowe/zos-uss-for-zowe-sdk/package.json +3 -3
  177. package/node_modules/@zowe/zos-workflows-for-zowe-sdk/package.json +5 -5
  178. package/node_modules/@zowe/zosmf-for-zowe-sdk/lib/constants/Zosmf.constants.d.ts.map +1 -1
  179. package/node_modules/@zowe/zosmf-for-zowe-sdk/lib/constants/Zosmf.constants.js +21 -0
  180. package/node_modules/@zowe/zosmf-for-zowe-sdk/lib/constants/Zosmf.constants.js.map +1 -1
  181. package/node_modules/@zowe/zosmf-for-zowe-sdk/lib/constants/Zosmf.profile.d.ts.map +1 -1
  182. package/node_modules/@zowe/zosmf-for-zowe-sdk/lib/constants/Zosmf.profile.js +8 -0
  183. package/node_modules/@zowe/zosmf-for-zowe-sdk/lib/constants/Zosmf.profile.js.map +1 -1
  184. package/node_modules/@zowe/zosmf-for-zowe-sdk/package.json +4 -4
  185. package/node_modules/js-yaml/dist/js-yaml.js +11 -3
  186. package/node_modules/js-yaml/dist/js-yaml.js.map +1 -1
  187. package/node_modules/js-yaml/dist/js-yaml.min.js +1 -1
  188. package/node_modules/js-yaml/dist/js-yaml.min.js.map +1 -1
  189. package/node_modules/js-yaml/dist/js-yaml.mjs +11 -3
  190. package/node_modules/js-yaml/dist/js-yaml.mjs.map +1 -1
  191. package/node_modules/js-yaml/lib/loader.js +16 -3
  192. package/node_modules/js-yaml/package.json +1 -1
  193. package/node_modules/sanitize-html/README.md +13 -0
  194. package/node_modules/sanitize-html/index.js +86 -12
  195. package/node_modules/sanitize-html/node_modules/dom-serializer/LICENSE +7 -0
  196. package/node_modules/{dom-serializer → sanitize-html/node_modules/dom-serializer}/README.md +14 -8
  197. package/node_modules/sanitize-html/node_modules/dom-serializer/dist/foreign-names.d.ts +11 -0
  198. package/node_modules/sanitize-html/node_modules/dom-serializer/dist/foreign-names.d.ts.map +1 -0
  199. package/node_modules/sanitize-html/node_modules/dom-serializer/dist/foreign-names.js +15 -0
  200. package/node_modules/sanitize-html/node_modules/dom-serializer/dist/foreign-names.js.map +1 -0
  201. package/node_modules/sanitize-html/node_modules/dom-serializer/dist/index.d.ts +72 -0
  202. package/node_modules/sanitize-html/node_modules/dom-serializer/dist/index.d.ts.map +1 -0
  203. package/node_modules/sanitize-html/node_modules/dom-serializer/dist/index.js +173 -0
  204. package/node_modules/sanitize-html/node_modules/dom-serializer/dist/index.js.map +1 -0
  205. package/node_modules/sanitize-html/node_modules/dom-serializer/package.json +69 -0
  206. package/node_modules/sanitize-html/node_modules/dom-serializer/src/foreign-names.ts +19 -0
  207. package/node_modules/sanitize-html/node_modules/dom-serializer/src/index.ts +315 -0
  208. package/node_modules/{domelementtype/lib → sanitize-html/node_modules/domelementtype/dist}/index.d.ts +12 -12
  209. package/node_modules/sanitize-html/node_modules/domelementtype/dist/index.d.ts.map +1 -0
  210. package/node_modules/{domelementtype/lib/esm → sanitize-html/node_modules/domelementtype/dist}/index.js +15 -6
  211. package/node_modules/sanitize-html/node_modules/domelementtype/package.json +59 -0
  212. package/node_modules/{domhandler/lib → sanitize-html/node_modules/domhandler/dist}/index.d.ts +9 -6
  213. package/node_modules/sanitize-html/node_modules/domhandler/dist/index.d.ts.map +1 -0
  214. package/node_modules/{domhandler/lib/esm → sanitize-html/node_modules/domhandler/dist}/index.js +34 -25
  215. package/node_modules/{domhandler/lib → sanitize-html/node_modules/domhandler/dist}/node.d.ts +34 -15
  216. package/node_modules/sanitize-html/node_modules/domhandler/dist/node.d.ts.map +1 -0
  217. package/node_modules/{domhandler/lib/esm → sanitize-html/node_modules/domhandler/dist}/node.js +81 -60
  218. package/node_modules/sanitize-html/node_modules/domhandler/package.json +65 -0
  219. package/node_modules/{domhandler → sanitize-html/node_modules/domhandler}/readme.md +1 -7
  220. package/node_modules/{domutils/lib → sanitize-html/node_modules/domutils/dist}/feeds.d.ts +2 -2
  221. package/node_modules/sanitize-html/node_modules/domutils/dist/feeds.d.ts.map +1 -0
  222. package/node_modules/{domutils/lib/esm → sanitize-html/node_modules/domutils/dist}/feeds.js +22 -25
  223. package/node_modules/sanitize-html/node_modules/domutils/dist/feeds.js.map +1 -0
  224. package/node_modules/{domutils/lib → sanitize-html/node_modules/domutils/dist}/helpers.d.ts +1 -1
  225. package/node_modules/sanitize-html/node_modules/domutils/dist/helpers.d.ts.map +1 -0
  226. package/node_modules/{domutils/lib/esm → sanitize-html/node_modules/domutils/dist}/helpers.js +16 -16
  227. package/node_modules/sanitize-html/node_modules/domutils/dist/helpers.js.map +1 -0
  228. package/node_modules/{domutils/lib/esm → sanitize-html/node_modules/domutils/dist}/index.d.ts +5 -7
  229. package/node_modules/sanitize-html/node_modules/domutils/dist/index.d.ts.map +1 -0
  230. package/node_modules/{domutils/lib/esm → sanitize-html/node_modules/domutils/dist}/index.js +5 -7
  231. package/node_modules/sanitize-html/node_modules/domutils/dist/index.js.map +1 -0
  232. package/node_modules/{domutils/lib/esm → sanitize-html/node_modules/domutils/dist}/legacy.d.ts +1 -1
  233. package/node_modules/sanitize-html/node_modules/domutils/dist/legacy.d.ts.map +1 -0
  234. package/node_modules/{domutils/lib/esm → sanitize-html/node_modules/domutils/dist}/legacy.js +15 -15
  235. package/node_modules/sanitize-html/node_modules/domutils/dist/legacy.js.map +1 -0
  236. package/node_modules/{domutils/lib/esm → sanitize-html/node_modules/domutils/dist}/manipulation.d.ts +9 -9
  237. package/node_modules/sanitize-html/node_modules/domutils/dist/manipulation.d.ts.map +1 -0
  238. package/node_modules/sanitize-html/node_modules/domutils/dist/manipulation.js +138 -0
  239. package/node_modules/sanitize-html/node_modules/domutils/dist/manipulation.js.map +1 -0
  240. package/node_modules/{domutils/lib → sanitize-html/node_modules/domutils/dist}/querying.d.ts +6 -16
  241. package/node_modules/sanitize-html/node_modules/domutils/dist/querying.d.ts.map +1 -0
  242. package/node_modules/{domutils/lib/esm → sanitize-html/node_modules/domutils/dist}/querying.js +13 -26
  243. package/node_modules/sanitize-html/node_modules/domutils/dist/querying.js.map +1 -0
  244. package/node_modules/{domutils/lib → sanitize-html/node_modules/domutils/dist}/stringify.d.ts +2 -2
  245. package/node_modules/sanitize-html/node_modules/domutils/dist/stringify.d.ts.map +1 -0
  246. package/node_modules/{domutils/lib/esm → sanitize-html/node_modules/domutils/dist}/stringify.js +1 -1
  247. package/node_modules/sanitize-html/node_modules/domutils/dist/stringify.js.map +1 -0
  248. package/node_modules/sanitize-html/node_modules/domutils/dist/traversal.d.ts +74 -0
  249. package/node_modules/sanitize-html/node_modules/domutils/dist/traversal.d.ts.map +1 -0
  250. package/node_modules/sanitize-html/node_modules/domutils/dist/traversal.js +105 -0
  251. package/node_modules/sanitize-html/node_modules/domutils/dist/traversal.js.map +1 -0
  252. package/node_modules/sanitize-html/node_modules/domutils/package.json +69 -0
  253. package/node_modules/{domutils → sanitize-html/node_modules/domutils}/readme.md +0 -6
  254. package/node_modules/sanitize-html/node_modules/domutils/src/__snapshots__/feeds.spec.ts.snap +103 -0
  255. package/node_modules/sanitize-html/node_modules/domutils/src/feeds.ts +301 -0
  256. package/node_modules/{domutils/lib/helpers.js → sanitize-html/node_modules/domutils/src/helpers.ts} +55 -43
  257. package/node_modules/{domutils/lib/index.d.ts → sanitize-html/node_modules/domutils/src/index.ts} +5 -8
  258. package/node_modules/sanitize-html/node_modules/domutils/src/legacy.ts +224 -0
  259. package/node_modules/sanitize-html/node_modules/domutils/src/manipulation.ts +156 -0
  260. package/node_modules/{domutils/lib/querying.js → sanitize-html/node_modules/domutils/src/querying.ts} +77 -60
  261. package/node_modules/sanitize-html/node_modules/domutils/src/stringify.ts +90 -0
  262. package/node_modules/sanitize-html/node_modules/domutils/src/traversal.ts +132 -0
  263. package/node_modules/sanitize-html/node_modules/entities/dist/decode-codepoint.d.ts +28 -0
  264. package/node_modules/sanitize-html/node_modules/entities/dist/decode-codepoint.d.ts.map +1 -0
  265. package/node_modules/sanitize-html/node_modules/entities/dist/decode-codepoint.js +61 -0
  266. package/node_modules/sanitize-html/node_modules/entities/dist/decode-codepoint.js.map +1 -0
  267. package/node_modules/{htmlparser2/node_modules/entities/dist/commonjs → sanitize-html/node_modules/entities/dist}/decode.d.ts +66 -44
  268. package/node_modules/sanitize-html/node_modules/entities/dist/decode.d.ts.map +1 -0
  269. package/node_modules/sanitize-html/node_modules/entities/dist/decode.js +1132 -0
  270. package/node_modules/sanitize-html/node_modules/entities/dist/decode.js.map +1 -0
  271. package/node_modules/{htmlparser2/node_modules/entities/dist/commonjs → sanitize-html/node_modules/entities/dist}/encode.d.ts +4 -0
  272. package/node_modules/sanitize-html/node_modules/entities/dist/encode.d.ts.map +1 -0
  273. package/node_modules/sanitize-html/node_modules/entities/dist/encode.js +295 -0
  274. package/node_modules/sanitize-html/node_modules/entities/dist/encode.js.map +1 -0
  275. package/node_modules/{htmlparser2/node_modules/entities/dist/commonjs → sanitize-html/node_modules/entities/dist}/escape.d.ts +23 -9
  276. package/node_modules/sanitize-html/node_modules/entities/dist/escape.d.ts.map +1 -0
  277. package/node_modules/sanitize-html/node_modules/entities/dist/escape.js +172 -0
  278. package/node_modules/sanitize-html/node_modules/entities/dist/escape.js.map +1 -0
  279. package/node_modules/sanitize-html/node_modules/entities/dist/generated/decode-data-html.d.ts +3 -0
  280. package/node_modules/sanitize-html/node_modules/entities/dist/generated/decode-data-html.d.ts.map +1 -0
  281. package/node_modules/sanitize-html/node_modules/entities/dist/generated/decode-data-html.js +5 -0
  282. package/node_modules/sanitize-html/node_modules/entities/dist/generated/decode-data-html.js.map +1 -0
  283. package/node_modules/sanitize-html/node_modules/entities/dist/generated/decode-data-xml.d.ts +3 -0
  284. package/node_modules/sanitize-html/node_modules/entities/dist/generated/decode-data-xml.d.ts.map +1 -0
  285. package/node_modules/sanitize-html/node_modules/entities/dist/generated/decode-data-xml.js +7 -0
  286. package/node_modules/sanitize-html/node_modules/entities/dist/generated/decode-data-xml.js.map +1 -0
  287. package/node_modules/sanitize-html/node_modules/entities/dist/generated/encode-html.d.ts +3 -0
  288. package/node_modules/sanitize-html/node_modules/entities/dist/generated/encode-html.d.ts.map +1 -0
  289. package/node_modules/sanitize-html/node_modules/entities/dist/generated/encode-html.js +3 -0
  290. package/node_modules/sanitize-html/node_modules/entities/dist/generated/encode-html.js.map +1 -0
  291. package/node_modules/{htmlparser2/node_modules/entities/dist/commonjs → sanitize-html/node_modules/entities/dist}/index.d.ts +11 -18
  292. package/node_modules/sanitize-html/node_modules/entities/dist/index.d.ts.map +1 -0
  293. package/node_modules/{htmlparser2/node_modules/entities/dist/esm → sanitize-html/node_modules/entities/dist}/index.js +9 -29
  294. package/node_modules/sanitize-html/node_modules/entities/dist/index.js.map +1 -0
  295. package/node_modules/sanitize-html/node_modules/entities/dist/internal/bin-trie-flags.d.ts +48 -0
  296. package/node_modules/sanitize-html/node_modules/entities/dist/internal/bin-trie-flags.d.ts.map +1 -0
  297. package/node_modules/sanitize-html/node_modules/entities/dist/internal/bin-trie-flags.js +49 -0
  298. package/node_modules/sanitize-html/node_modules/entities/dist/internal/bin-trie-flags.js.map +1 -0
  299. package/node_modules/sanitize-html/node_modules/entities/dist/internal/decode-shared.d.ts +38 -0
  300. package/node_modules/sanitize-html/node_modules/entities/dist/internal/decode-shared.d.ts.map +1 -0
  301. package/node_modules/sanitize-html/node_modules/entities/dist/internal/decode-shared.js +195 -0
  302. package/node_modules/sanitize-html/node_modules/entities/dist/internal/decode-shared.js.map +1 -0
  303. package/node_modules/sanitize-html/node_modules/entities/package.json +83 -0
  304. package/node_modules/{htmlparser2 → sanitize-html}/node_modules/entities/readme.md +4 -16
  305. package/node_modules/sanitize-html/node_modules/entities/src/decode-codepoint.ts +69 -0
  306. package/node_modules/sanitize-html/node_modules/entities/src/decode.ts +1368 -0
  307. package/node_modules/sanitize-html/node_modules/entities/src/encode.ts +337 -0
  308. package/node_modules/sanitize-html/node_modules/entities/src/escape.ts +187 -0
  309. package/node_modules/sanitize-html/node_modules/entities/src/generated/decode-data-html.ts +12 -0
  310. package/node_modules/sanitize-html/node_modules/entities/src/generated/decode-data-xml.ts +7 -0
  311. package/node_modules/sanitize-html/node_modules/entities/src/generated/encode-html.ts +3 -0
  312. package/node_modules/{htmlparser2 → sanitize-html}/node_modules/entities/src/index.ts +14 -41
  313. package/node_modules/sanitize-html/node_modules/entities/src/internal/bin-trie-flags.ts +47 -0
  314. package/node_modules/sanitize-html/node_modules/entities/src/internal/decode-shared.ts +209 -0
  315. package/node_modules/sanitize-html/node_modules/htmlparser2/README.md +257 -0
  316. package/node_modules/{htmlparser2/dist/esm → sanitize-html/node_modules/htmlparser2/dist}/Parser.d.ts +97 -38
  317. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/Parser.d.ts.map +1 -0
  318. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/Parser.js +644 -0
  319. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/Parser.js.map +1 -0
  320. package/node_modules/{htmlparser2/dist/commonjs → sanitize-html/node_modules/htmlparser2/dist}/Tokenizer.d.ts +75 -7
  321. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/Tokenizer.d.ts.map +1 -0
  322. package/node_modules/{htmlparser2/dist/esm → sanitize-html/node_modules/htmlparser2/dist}/Tokenizer.js +434 -179
  323. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/Tokenizer.js.map +1 -0
  324. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/WebWritableStream.d.ts +24 -0
  325. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/WebWritableStream.d.ts.map +1 -0
  326. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/WebWritableStream.js +44 -0
  327. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/WebWritableStream.js.map +1 -0
  328. package/node_modules/{htmlparser2/dist/commonjs → sanitize-html/node_modules/htmlparser2/dist}/WritableStream.d.ts +1 -2
  329. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/WritableStream.d.ts.map +1 -0
  330. package/node_modules/{htmlparser2/dist/esm → sanitize-html/node_modules/htmlparser2/dist}/WritableStream.js +3 -3
  331. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/WritableStream.js.map +1 -0
  332. package/node_modules/{htmlparser2/dist/commonjs → sanitize-html/node_modules/htmlparser2/dist}/index.d.ts +6 -26
  333. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/index.d.ts.map +1 -0
  334. package/node_modules/{htmlparser2/dist/esm → sanitize-html/node_modules/htmlparser2/dist}/index.js +2 -30
  335. package/node_modules/sanitize-html/node_modules/htmlparser2/dist/index.js.map +1 -0
  336. package/node_modules/sanitize-html/node_modules/htmlparser2/package.json +86 -0
  337. package/node_modules/{htmlparser2 → sanitize-html/node_modules/htmlparser2}/src/Parser.ts +260 -100
  338. package/node_modules/{htmlparser2 → sanitize-html/node_modules/htmlparser2}/src/Tokenizer.ts +438 -165
  339. package/node_modules/sanitize-html/node_modules/htmlparser2/src/WebWritableStream.ts +47 -0
  340. package/node_modules/{htmlparser2 → sanitize-html/node_modules/htmlparser2}/src/WritableStream.ts +1 -2
  341. package/node_modules/{htmlparser2 → sanitize-html/node_modules/htmlparser2}/src/index.ts +14 -43
  342. package/node_modules/sanitize-html/package.json +5 -2
  343. package/package.json +15 -15
  344. package/scripts/validateSecretsPrebuild.js +231 -0
  345. package/node_modules/dom-serializer/LICENSE +0 -11
  346. package/node_modules/dom-serializer/lib/esm/foreignNames.d.ts +0 -3
  347. package/node_modules/dom-serializer/lib/esm/foreignNames.d.ts.map +0 -1
  348. package/node_modules/dom-serializer/lib/esm/foreignNames.js +0 -100
  349. package/node_modules/dom-serializer/lib/esm/index.d.ts +0 -52
  350. package/node_modules/dom-serializer/lib/esm/index.d.ts.map +0 -1
  351. package/node_modules/dom-serializer/lib/esm/index.js +0 -190
  352. package/node_modules/dom-serializer/lib/esm/package.json +0 -1
  353. package/node_modules/dom-serializer/lib/foreignNames.d.ts +0 -3
  354. package/node_modules/dom-serializer/lib/foreignNames.d.ts.map +0 -1
  355. package/node_modules/dom-serializer/lib/foreignNames.js +0 -103
  356. package/node_modules/dom-serializer/lib/index.d.ts +0 -52
  357. package/node_modules/dom-serializer/lib/index.d.ts.map +0 -1
  358. package/node_modules/dom-serializer/lib/index.js +0 -229
  359. package/node_modules/dom-serializer/package.json +0 -69
  360. package/node_modules/domelementtype/lib/esm/index.d.ts +0 -48
  361. package/node_modules/domelementtype/lib/esm/index.d.ts.map +0 -1
  362. package/node_modules/domelementtype/lib/esm/package.json +0 -1
  363. package/node_modules/domelementtype/lib/index.d.ts.map +0 -1
  364. package/node_modules/domelementtype/lib/index.js +0 -55
  365. package/node_modules/domelementtype/package.json +0 -54
  366. package/node_modules/domhandler/lib/esm/index.d.ts +0 -76
  367. package/node_modules/domhandler/lib/esm/index.d.ts.map +0 -1
  368. package/node_modules/domhandler/lib/esm/node.d.ts +0 -245
  369. package/node_modules/domhandler/lib/esm/node.d.ts.map +0 -1
  370. package/node_modules/domhandler/lib/esm/package.json +0 -1
  371. package/node_modules/domhandler/lib/index.d.ts.map +0 -1
  372. package/node_modules/domhandler/lib/index.js +0 -165
  373. package/node_modules/domhandler/lib/node.d.ts.map +0 -1
  374. package/node_modules/domhandler/lib/node.js +0 -474
  375. package/node_modules/domhandler/package.json +0 -73
  376. package/node_modules/domutils/lib/esm/feeds.d.ts +0 -71
  377. package/node_modules/domutils/lib/esm/feeds.d.ts.map +0 -1
  378. package/node_modules/domutils/lib/esm/feeds.js.map +0 -1
  379. package/node_modules/domutils/lib/esm/helpers.d.ts +0 -59
  380. package/node_modules/domutils/lib/esm/helpers.d.ts.map +0 -1
  381. package/node_modules/domutils/lib/esm/helpers.js.map +0 -1
  382. package/node_modules/domutils/lib/esm/index.d.ts.map +0 -1
  383. package/node_modules/domutils/lib/esm/index.js.map +0 -1
  384. package/node_modules/domutils/lib/esm/legacy.d.ts.map +0 -1
  385. package/node_modules/domutils/lib/esm/legacy.js.map +0 -1
  386. package/node_modules/domutils/lib/esm/manipulation.d.ts.map +0 -1
  387. package/node_modules/domutils/lib/esm/manipulation.js +0 -134
  388. package/node_modules/domutils/lib/esm/manipulation.js.map +0 -1
  389. package/node_modules/domutils/lib/esm/package.json +0 -1
  390. package/node_modules/domutils/lib/esm/querying.d.ts +0 -64
  391. package/node_modules/domutils/lib/esm/querying.d.ts.map +0 -1
  392. package/node_modules/domutils/lib/esm/querying.js.map +0 -1
  393. package/node_modules/domutils/lib/esm/stringify.d.ts +0 -46
  394. package/node_modules/domutils/lib/esm/stringify.d.ts.map +0 -1
  395. package/node_modules/domutils/lib/esm/stringify.js.map +0 -1
  396. package/node_modules/domutils/lib/esm/traversal.d.ts +0 -67
  397. package/node_modules/domutils/lib/esm/traversal.d.ts.map +0 -1
  398. package/node_modules/domutils/lib/esm/traversal.js +0 -112
  399. package/node_modules/domutils/lib/esm/traversal.js.map +0 -1
  400. package/node_modules/domutils/lib/feeds.d.ts.map +0 -1
  401. package/node_modules/domutils/lib/feeds.js +0 -190
  402. package/node_modules/domutils/lib/feeds.js.map +0 -1
  403. package/node_modules/domutils/lib/helpers.d.ts.map +0 -1
  404. package/node_modules/domutils/lib/helpers.js.map +0 -1
  405. package/node_modules/domutils/lib/index.d.ts.map +0 -1
  406. package/node_modules/domutils/lib/index.js +0 -33
  407. package/node_modules/domutils/lib/index.js.map +0 -1
  408. package/node_modules/domutils/lib/legacy.d.ts +0 -79
  409. package/node_modules/domutils/lib/legacy.d.ts.map +0 -1
  410. package/node_modules/domutils/lib/legacy.js +0 -168
  411. package/node_modules/domutils/lib/legacy.js.map +0 -1
  412. package/node_modules/domutils/lib/manipulation.d.ts +0 -49
  413. package/node_modules/domutils/lib/manipulation.d.ts.map +0 -1
  414. package/node_modules/domutils/lib/manipulation.js +0 -142
  415. package/node_modules/domutils/lib/manipulation.js.map +0 -1
  416. package/node_modules/domutils/lib/querying.d.ts.map +0 -1
  417. package/node_modules/domutils/lib/querying.js.map +0 -1
  418. package/node_modules/domutils/lib/stringify.d.ts.map +0 -1
  419. package/node_modules/domutils/lib/stringify.js +0 -91
  420. package/node_modules/domutils/lib/stringify.js.map +0 -1
  421. package/node_modules/domutils/lib/traversal.d.ts +0 -67
  422. package/node_modules/domutils/lib/traversal.d.ts.map +0 -1
  423. package/node_modules/domutils/lib/traversal.js +0 -125
  424. package/node_modules/domutils/lib/traversal.js.map +0 -1
  425. package/node_modules/domutils/package.json +0 -79
  426. package/node_modules/htmlparser2/README.md +0 -171
  427. package/node_modules/htmlparser2/WritableStream.js +0 -3
  428. package/node_modules/htmlparser2/dist/commonjs/Parser.d.ts +0 -198
  429. package/node_modules/htmlparser2/dist/commonjs/Parser.d.ts.map +0 -1
  430. package/node_modules/htmlparser2/dist/commonjs/Parser.js +0 -527
  431. package/node_modules/htmlparser2/dist/commonjs/Parser.js.map +0 -1
  432. package/node_modules/htmlparser2/dist/commonjs/Tokenizer.d.ts.map +0 -1
  433. package/node_modules/htmlparser2/dist/commonjs/Tokenizer.js +0 -805
  434. package/node_modules/htmlparser2/dist/commonjs/Tokenizer.js.map +0 -1
  435. package/node_modules/htmlparser2/dist/commonjs/WritableStream.d.ts.map +0 -1
  436. package/node_modules/htmlparser2/dist/commonjs/WritableStream.js +0 -36
  437. package/node_modules/htmlparser2/dist/commonjs/WritableStream.js.map +0 -1
  438. package/node_modules/htmlparser2/dist/commonjs/index.d.ts.map +0 -1
  439. package/node_modules/htmlparser2/dist/commonjs/index.js +0 -123
  440. package/node_modules/htmlparser2/dist/commonjs/index.js.map +0 -1
  441. package/node_modules/htmlparser2/dist/commonjs/package.json +0 -3
  442. package/node_modules/htmlparser2/dist/esm/Parser.d.ts.map +0 -1
  443. package/node_modules/htmlparser2/dist/esm/Parser.js +0 -490
  444. package/node_modules/htmlparser2/dist/esm/Parser.js.map +0 -1
  445. package/node_modules/htmlparser2/dist/esm/Tokenizer.d.ts +0 -126
  446. package/node_modules/htmlparser2/dist/esm/Tokenizer.d.ts.map +0 -1
  447. package/node_modules/htmlparser2/dist/esm/Tokenizer.js.map +0 -1
  448. package/node_modules/htmlparser2/dist/esm/WritableStream.d.ts +0 -15
  449. package/node_modules/htmlparser2/dist/esm/WritableStream.d.ts.map +0 -1
  450. package/node_modules/htmlparser2/dist/esm/WritableStream.js.map +0 -1
  451. package/node_modules/htmlparser2/dist/esm/index.d.ts +0 -54
  452. package/node_modules/htmlparser2/dist/esm/index.d.ts.map +0 -1
  453. package/node_modules/htmlparser2/dist/esm/index.js.map +0 -1
  454. package/node_modules/htmlparser2/dist/esm/package.json +0 -3
  455. package/node_modules/htmlparser2/node_modules/entities/decode.d.ts +0 -3
  456. package/node_modules/htmlparser2/node_modules/entities/decode.js +0 -3
  457. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/decode-codepoint.d.ts +0 -19
  458. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/decode-codepoint.d.ts.map +0 -1
  459. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/decode-codepoint.js +0 -77
  460. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/decode-codepoint.js.map +0 -1
  461. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/decode.d.ts.map +0 -1
  462. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/decode.js +0 -568
  463. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/decode.js.map +0 -1
  464. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/encode.d.ts.map +0 -1
  465. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/encode.js +0 -92
  466. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/encode.js.map +0 -1
  467. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/escape.d.ts.map +0 -1
  468. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/escape.js +0 -138
  469. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/escape.js.map +0 -1
  470. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts +0 -2
  471. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts.map +0 -1
  472. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/decode-data-html.js +0 -7
  473. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/decode-data-html.js.map +0 -1
  474. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts +0 -2
  475. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts.map +0 -1
  476. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +0 -7
  477. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/decode-data-xml.js.map +0 -1
  478. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/encode-html.d.ts +0 -3
  479. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/encode-html.d.ts.map +0 -1
  480. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/encode-html.js +0 -14
  481. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/generated/encode-html.js.map +0 -1
  482. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/index.d.ts.map +0 -1
  483. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/index.js +0 -131
  484. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/index.js.map +0 -1
  485. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/bin-trie-flags.d.ts +0 -17
  486. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/bin-trie-flags.d.ts.map +0 -1
  487. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +0 -21
  488. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js.map +0 -1
  489. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/decode-shared.d.ts +0 -2
  490. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/decode-shared.d.ts.map +0 -1
  491. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/decode-shared.js +0 -31
  492. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/decode-shared.js.map +0 -1
  493. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/encode-shared.d.ts +0 -32
  494. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/encode-shared.d.ts.map +0 -1
  495. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/encode-shared.js +0 -94
  496. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/internal/encode-shared.js.map +0 -1
  497. package/node_modules/htmlparser2/node_modules/entities/dist/commonjs/package.json +0 -3
  498. package/node_modules/htmlparser2/node_modules/entities/dist/esm/decode-codepoint.d.ts +0 -19
  499. package/node_modules/htmlparser2/node_modules/entities/dist/esm/decode-codepoint.d.ts.map +0 -1
  500. package/node_modules/htmlparser2/node_modules/entities/dist/esm/decode-codepoint.js +0 -72
  501. package/node_modules/htmlparser2/node_modules/entities/dist/esm/decode-codepoint.js.map +0 -1
  502. package/node_modules/htmlparser2/node_modules/entities/dist/esm/decode.d.ts +0 -205
  503. package/node_modules/htmlparser2/node_modules/entities/dist/esm/decode.d.ts.map +0 -1
  504. package/node_modules/htmlparser2/node_modules/entities/dist/esm/decode.js +0 -554
  505. package/node_modules/htmlparser2/node_modules/entities/dist/esm/decode.js.map +0 -1
  506. package/node_modules/htmlparser2/node_modules/entities/dist/esm/encode.d.ts +0 -22
  507. package/node_modules/htmlparser2/node_modules/entities/dist/esm/encode.d.ts.map +0 -1
  508. package/node_modules/htmlparser2/node_modules/entities/dist/esm/encode.js +0 -88
  509. package/node_modules/htmlparser2/node_modules/entities/dist/esm/encode.js.map +0 -1
  510. package/node_modules/htmlparser2/node_modules/entities/dist/esm/escape.d.ts +0 -46
  511. package/node_modules/htmlparser2/node_modules/entities/dist/esm/escape.d.ts.map +0 -1
  512. package/node_modules/htmlparser2/node_modules/entities/dist/esm/escape.js +0 -134
  513. package/node_modules/htmlparser2/node_modules/entities/dist/esm/escape.js.map +0 -1
  514. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/decode-data-html.d.ts +0 -2
  515. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/decode-data-html.d.ts.map +0 -1
  516. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/decode-data-html.js +0 -4
  517. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/decode-data-html.js.map +0 -1
  518. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/decode-data-xml.d.ts +0 -2
  519. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/decode-data-xml.d.ts.map +0 -1
  520. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/decode-data-xml.js +0 -4
  521. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/decode-data-xml.js.map +0 -1
  522. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/encode-html.d.ts +0 -3
  523. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/encode-html.d.ts.map +0 -1
  524. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/encode-html.js +0 -11
  525. package/node_modules/htmlparser2/node_modules/entities/dist/esm/generated/encode-html.js.map +0 -1
  526. package/node_modules/htmlparser2/node_modules/entities/dist/esm/index.d.ts +0 -96
  527. package/node_modules/htmlparser2/node_modules/entities/dist/esm/index.d.ts.map +0 -1
  528. package/node_modules/htmlparser2/node_modules/entities/dist/esm/index.js.map +0 -1
  529. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/bin-trie-flags.d.ts +0 -17
  530. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/bin-trie-flags.d.ts.map +0 -1
  531. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/bin-trie-flags.js +0 -18
  532. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/bin-trie-flags.js.map +0 -1
  533. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/decode-shared.d.ts +0 -2
  534. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/decode-shared.d.ts.map +0 -1
  535. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/decode-shared.js +0 -28
  536. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/decode-shared.js.map +0 -1
  537. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/encode-shared.d.ts +0 -32
  538. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/encode-shared.d.ts.map +0 -1
  539. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/encode-shared.js +0 -91
  540. package/node_modules/htmlparser2/node_modules/entities/dist/esm/internal/encode-shared.js.map +0 -1
  541. package/node_modules/htmlparser2/node_modules/entities/dist/esm/package.json +0 -3
  542. package/node_modules/htmlparser2/node_modules/entities/escape.d.ts +0 -3
  543. package/node_modules/htmlparser2/node_modules/entities/escape.js +0 -3
  544. package/node_modules/htmlparser2/node_modules/entities/package.json +0 -120
  545. package/node_modules/htmlparser2/node_modules/entities/src/decode-codepoint.ts +0 -81
  546. package/node_modules/htmlparser2/node_modules/entities/src/decode.ts +0 -685
  547. package/node_modules/htmlparser2/node_modules/entities/src/encode.ts +0 -93
  548. package/node_modules/htmlparser2/node_modules/entities/src/escape.ts +0 -161
  549. package/node_modules/htmlparser2/node_modules/entities/src/generated/.eslintrc.json +0 -10
  550. package/node_modules/htmlparser2/node_modules/entities/src/generated/decode-data-html.ts +0 -6
  551. package/node_modules/htmlparser2/node_modules/entities/src/generated/decode-data-xml.ts +0 -6
  552. package/node_modules/htmlparser2/node_modules/entities/src/generated/encode-html.ts +0 -17
  553. package/node_modules/htmlparser2/node_modules/entities/src/internal/bin-trie-flags.ts +0 -16
  554. package/node_modules/htmlparser2/node_modules/entities/src/internal/decode-shared.ts +0 -30
  555. package/node_modules/htmlparser2/node_modules/entities/src/internal/encode-shared.ts +0 -121
  556. package/node_modules/htmlparser2/package.json +0 -113
  557. /package/node_modules/{domelementtype → sanitize-html/node_modules/domelementtype}/LICENSE +0 -0
  558. /package/node_modules/{domelementtype → sanitize-html/node_modules/domelementtype}/readme.md +0 -0
  559. /package/node_modules/{domhandler → sanitize-html/node_modules/domhandler}/LICENSE +0 -0
  560. /package/node_modules/{domutils → sanitize-html/node_modules/domutils}/LICENSE +0 -0
  561. /package/node_modules/{htmlparser2 → sanitize-html}/node_modules/entities/LICENSE +0 -0
  562. /package/node_modules/{htmlparser2 → sanitize-html/node_modules/htmlparser2}/LICENSE +0 -0
@@ -0,0 +1,1132 @@
1
+ import { codePointToString, replaceCodePoint, replaceCodePointXML, } from "./decode-codepoint.js";
2
+ import { htmlDecodeTree } from "./generated/decode-data-html.js";
3
+ import { xmlDecodeTree } from "./generated/decode-data-xml.js";
4
+ import { BinTrieFlags } from "./internal/bin-trie-flags.js";
5
+ var CharCodes;
6
+ (function (CharCodes) {
7
+ CharCodes[CharCodes["AMP"] = 38] = "AMP";
8
+ CharCodes[CharCodes["NUM"] = 35] = "NUM";
9
+ CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
10
+ CharCodes[CharCodes["EQUALS"] = 61] = "EQUALS";
11
+ CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
12
+ CharCodes[CharCodes["NINE"] = 57] = "NINE";
13
+ CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
14
+ CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
15
+ })(CharCodes || (CharCodes = {}));
16
+ /** Bit that needs to be set to convert an upper case ASCII character to lower case */
17
+ const TO_LOWER_BIT = 0b10_0000;
18
+ /*
19
+ * `parseNumericEntity` packs its two results into one 32-bit integer:
20
+ * `(consumed << CONSUMED_SHIFT) | codePoint`. The 21-bit code point field
21
+ * fits any valid Unicode value (max 0x10FFFF, clamped before packing); the
22
+ * consumed count excludes `&` and gets the remaining 11 bits. Extract it
23
+ * with `>>>` so the topmost bit isn't treated as a sign.
24
+ *
25
+ * Plain consts rather than a `const enum`: with `isolatedModules`, enum
26
+ * member reads compile to runtime property loads.
27
+ */
28
+ const CONSUMED_SHIFT = 21;
29
+ const CODE_POINT_MASK = 0x1f_ff_ff;
30
+ /**
31
+ * Reserved consumed field for counts of at least 2047 characters after `&`.
32
+ * The true count is in `longNumericConsumed`.
33
+ */
34
+ const CONSUMED_OVERFLOW = 0x7_ff;
35
+ /**
36
+ * Side channel for numeric entities of at least 2048 characters including
37
+ * `&`. Set by `parseNumericEntity` when its consumed count reaches the
38
+ * reserved value `CONSUMED_OVERFLOW`; callers read the true count from here.
39
+ * A module-level slot avoids a tuple allocation on the hot path.
40
+ */
41
+ let longNumericConsumed = 0;
42
+ /**
43
+ * Extract the consumed count from a `parseNumericEntity` packed result,
44
+ * recovering the true length from `longNumericConsumed` when the packed
45
+ * field contains the sentinel. Read it before the next `parseNumericEntity`
46
+ * call, which may overwrite the side channel. This helper owns that protocol.
47
+ * @param packed Packed result of `parseNumericEntity`.
48
+ */
49
+ function unpackConsumed(packed) {
50
+ const consumed = packed >>> CONSUMED_SHIFT;
51
+ return consumed === CONSUMED_OVERFLOW ? longNumericConsumed : consumed;
52
+ }
53
+ /**
54
+ * Unsigned subtraction trick: (code - lo) >>> 0 wraps negatives to large
55
+ * values, so a single `<=` covers the entire [lo..hi] range check.
56
+ * @param code Code point to check.
57
+ */
58
+ function isNumber(code) {
59
+ return (code - CharCodes.ZERO) >>> 0 <= 9;
60
+ }
61
+ function isHexadecimalCharacter(code) {
62
+ return ((code | TO_LOWER_BIT) - CharCodes.LOWER_A) >>> 0 <= 5; // F - a
63
+ }
64
+ function isAlpha(code) {
65
+ return ((code | TO_LOWER_BIT) - CharCodes.LOWER_A) >>> 0 <= 25; // Z - a
66
+ }
67
+ /**
68
+ * Checks if the given character is a valid end character for an entity in an attribute.
69
+ *
70
+ * Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
71
+ * See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
72
+ * @param code Code point to check.
73
+ */
74
+ function isEntityInAttributeInvalidEnd(code) {
75
+ return code === CharCodes.EQUALS || isAlpha(code) || isNumber(code);
76
+ }
77
+ var EntityDecoderState;
78
+ (function (EntityDecoderState) {
79
+ EntityDecoderState[EntityDecoderState["EntityStart"] = 0] = "EntityStart";
80
+ EntityDecoderState[EntityDecoderState["NumericStart"] = 1] = "NumericStart";
81
+ EntityDecoderState[EntityDecoderState["NumericDecimal"] = 2] = "NumericDecimal";
82
+ EntityDecoderState[EntityDecoderState["NumericHex"] = 3] = "NumericHex";
83
+ EntityDecoderState[EntityDecoderState["NamedEntity"] = 4] = "NamedEntity";
84
+ })(EntityDecoderState || (EntityDecoderState = {}));
85
+ /**
86
+ * Decoding mode for named entities.
87
+ */
88
+ export var DecodingMode;
89
+ (function (DecodingMode) {
90
+ /** Entities in text nodes that can end with any character. */
91
+ DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
92
+ /** Only allow entities terminated with a semicolon. */
93
+ DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
94
+ /** Entities in attributes have limitations on ending characters. */
95
+ DecodingMode[DecodingMode["Attribute"] = 2] = "Attribute";
96
+ })(DecodingMode || (DecodingMode = {}));
97
+ /**
98
+ * Token decoder with support of writing partial entities.
99
+ */
100
+ export class EntityDecoder {
101
+ decodeTree;
102
+ emitCodePoint;
103
+ errors;
104
+ /** The current state of the decoder. */
105
+ state = EntityDecoderState.EntityStart;
106
+ /** Characters that were consumed while parsing an entity. */
107
+ consumed = 1;
108
+ /**
109
+ * The result of the entity.
110
+ *
111
+ * For named entities: the trie index of the best legacy match so far
112
+ * (0 = none). For numeric entities: the accumulated code point.
113
+ */
114
+ result = 0;
115
+ /** The current index in the decode tree. */
116
+ treeIndex = 0;
117
+ /**
118
+ * Characters consumed since the last recorded legacy match, plus one.
119
+ * Invariant at the top of the `stateNamedEntity` loop: `excess` equals
120
+ * the number of unrecorded consumed characters + 1.
121
+ */
122
+ // biome-ignore lint/correctness/noUnusedPrivateClassMembers: False positive (read via destructuring)
123
+ excess = 1;
124
+ /** The mode in which the decoder is operating. */
125
+ decodeMode = DecodingMode.Strict;
126
+ /** The number of characters that have been consumed in the current run. */
127
+ // biome-ignore lint/correctness/noUnusedPrivateClassMembers: False positive
128
+ runConsumed = 0;
129
+ constructor(
130
+ /** The predefined HTML or XML decode tree. */
131
+ decodeTree,
132
+ /**
133
+ * The function that is called when a codepoint is decoded.
134
+ *
135
+ * For named entities that decode to multiple code points, this will
136
+ * be called multiple times, with the second codepoint, and the same
137
+ * `consumed` value.
138
+ * @param codepoint The decoded codepoint.
139
+ * @param consumed The number of characters consumed by the decoder.
140
+ */
141
+ emitCodePoint,
142
+ /** An object that is used to produce errors. */
143
+ errors) {
144
+ this.decodeTree = decodeTree;
145
+ this.emitCodePoint = emitCodePoint;
146
+ this.errors = errors;
147
+ }
148
+ /**
149
+ * Resets the instance to make it reusable.
150
+ * @param decodeMode Entity decoding mode to use.
151
+ */
152
+ startEntity(decodeMode) {
153
+ this.decodeMode = decodeMode;
154
+ this.state = EntityDecoderState.EntityStart;
155
+ this.result = 0;
156
+ this.treeIndex = 0;
157
+ this.excess = 1;
158
+ this.consumed = 1;
159
+ this.runConsumed = 0;
160
+ }
161
+ /**
162
+ * Write an entity to the decoder. This can be called multiple times with partial entities.
163
+ * If the entity is incomplete, the decoder will return -1.
164
+ *
165
+ * Mirrors the non-streaming `decodeWithTrie`, but with the ability to stop decoding if the
166
+ * entity is incomplete, and resume when the next string is written.
167
+ * @param input The string containing the entity (or a continuation of the entity).
168
+ * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
169
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
170
+ */
171
+ write(input, offset) {
172
+ switch (this.state) {
173
+ case EntityDecoderState.EntityStart: {
174
+ if (input.charCodeAt(offset) === CharCodes.NUM) {
175
+ this.state = EntityDecoderState.NumericStart;
176
+ this.consumed += 1;
177
+ return this.stateNumericStart(input, offset + 1);
178
+ }
179
+ this.state = EntityDecoderState.NamedEntity;
180
+ return this.stateNamedEntity(input, offset);
181
+ }
182
+ case EntityDecoderState.NumericStart: {
183
+ return this.stateNumericStart(input, offset);
184
+ }
185
+ case EntityDecoderState.NumericDecimal: {
186
+ return this.stateNumericDecimal(input, offset);
187
+ }
188
+ case EntityDecoderState.NumericHex: {
189
+ return this.stateNumericHex(input, offset);
190
+ }
191
+ default: {
192
+ // NamedEntity — the only remaining state.
193
+ return this.stateNamedEntity(input, offset);
194
+ }
195
+ }
196
+ }
197
+ /**
198
+ * Switches between the numeric decimal and hexadecimal states.
199
+ *
200
+ * Equivalent to the `Numeric character reference state` in the HTML spec.
201
+ * @param input The string containing the entity (or a continuation of the entity).
202
+ * @param offset The current offset.
203
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
204
+ */
205
+ // eslint-disable-next-line unicorn/consistent-class-member-order
206
+ stateNumericStart(input, offset) {
207
+ if (offset >= input.length) {
208
+ return -1;
209
+ }
210
+ if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
211
+ this.state = EntityDecoderState.NumericHex;
212
+ this.consumed += 1;
213
+ return this.stateNumericHex(input, offset + 1);
214
+ }
215
+ this.state = EntityDecoderState.NumericDecimal;
216
+ return this.stateNumericDecimal(input, offset);
217
+ }
218
+ /**
219
+ * Parses a hexadecimal numeric entity.
220
+ *
221
+ * Equivalent to the `Hexademical character reference state` in the HTML
222
+ * spec. Digit parsing matches the hex loop in `parseNumericEntity`.
223
+ * The accumulated value is preserved for numeric validation callbacks.
224
+ * @param input The string containing the entity (or a continuation of the entity).
225
+ * @param offset The current offset.
226
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
227
+ */
228
+ stateNumericHex(input, offset) {
229
+ const inputLength = input.length;
230
+ // Local accumulators; flushed before any exit (see stateNamedEntity).
231
+ let { result } = this;
232
+ let { consumed } = this;
233
+ while (offset < inputLength) {
234
+ const char = input.charCodeAt(offset);
235
+ if (isNumber(char) || isHexadecimalCharacter(char)) {
236
+ // Convert hex digit to value (0-15); 'a'/'A' -> 10.
237
+ const digit = char <= CharCodes.NINE
238
+ ? char - CharCodes.ZERO
239
+ : (char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10;
240
+ result = result * 16 + digit;
241
+ consumed += 1;
242
+ offset += 1;
243
+ }
244
+ else {
245
+ this.result = result;
246
+ this.consumed = consumed;
247
+ return this.emitNumericEntity(char, 3);
248
+ }
249
+ }
250
+ this.result = result;
251
+ this.consumed = consumed;
252
+ return -1; // Incomplete entity
253
+ }
254
+ /**
255
+ * Parses a decimal numeric entity.
256
+ *
257
+ * Equivalent to the `Decimal character reference state` in the HTML
258
+ * spec. Digit parsing matches the decimal loop in `parseNumericEntity`.
259
+ * The accumulated value is preserved for numeric validation callbacks.
260
+ * @param input The string containing the entity (or a continuation of the entity).
261
+ * @param offset The current offset.
262
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
263
+ */
264
+ stateNumericDecimal(input, offset) {
265
+ const inputLength = input.length;
266
+ // Local accumulators; flushed before any exit (see stateNamedEntity).
267
+ let { result } = this;
268
+ let { consumed } = this;
269
+ while (offset < inputLength) {
270
+ const digit = input.charCodeAt(offset) - CharCodes.ZERO;
271
+ if (digit >>> 0 > 9) {
272
+ this.result = result;
273
+ this.consumed = consumed;
274
+ return this.emitNumericEntity(digit + CharCodes.ZERO, 2);
275
+ }
276
+ result = result * 10 + digit;
277
+ consumed += 1;
278
+ offset += 1;
279
+ }
280
+ this.result = result;
281
+ this.consumed = consumed;
282
+ return -1; // Incomplete entity
283
+ }
284
+ /**
285
+ * Validate and emit a numeric entity.
286
+ *
287
+ * Implements the logic from the `Hexademical character reference start
288
+ * state` and `Numeric character reference end state` in the HTML spec.
289
+ * @param lastCp The last code point of the entity. Used to see if the
290
+ * entity was terminated with a semicolon.
291
+ * @param expectedLength The minimum number of characters that should be
292
+ * consumed. Used to validate that at least one digit
293
+ * was consumed.
294
+ * @returns The number of characters that were consumed.
295
+ */
296
+ emitNumericEntity(lastCp, expectedLength) {
297
+ // Ensure we consumed at least one digit.
298
+ if (this.consumed <= expectedLength) {
299
+ this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed);
300
+ return 0;
301
+ }
302
+ // Figure out if this is a legit end of the entity
303
+ if (lastCp === CharCodes.SEMI) {
304
+ this.consumed += 1;
305
+ }
306
+ else if (this.decodeMode === DecodingMode.Strict) {
307
+ return 0;
308
+ }
309
+ this.emitCodePoint((this.decodeTree === xmlDecodeTree
310
+ ? replaceCodePointXML
311
+ : replaceCodePoint)(this.result), this.consumed);
312
+ if (this.errors) {
313
+ if (lastCp !== CharCodes.SEMI) {
314
+ this.errors.missingSemicolonAfterCharacterReference();
315
+ }
316
+ this.errors.validateNumericCharacterReference(this.result);
317
+ }
318
+ return this.consumed;
319
+ }
320
+ /**
321
+ * Flush locally-tracked walk state back to the fields, then emit the
322
+ * recorded legacy match or reject (cold path — at most once per
323
+ * entity). Called after failed navigation (leaf node, branch miss, or
324
+ * compact-run mismatch). In attribute mode, reject if no legacy was
325
+ * recorded at the current node, if we descended past it, or if the
326
+ * pending input character is an invalid attribute terminator.
327
+ * @param consumed Locally-tracked consumed count.
328
+ * @param excess Locally-tracked excess count.
329
+ * @param char Pending input character (may be the mismatching char).
330
+ * @param valueLength Value length at the current trie node.
331
+ */
332
+ flushAndEmitLegacyOrReject(consumed, excess, char, valueLength) {
333
+ this.consumed = consumed;
334
+ this.excess = excess;
335
+ return this.result === 0 ||
336
+ (this.decodeMode === DecodingMode.Attribute &&
337
+ (valueLength === 0 ||
338
+ excess > 1 ||
339
+ isEntityInAttributeInvalidEnd(char)))
340
+ ? 0
341
+ : this.emitNotTerminatedNamedEntity();
342
+ }
343
+ /**
344
+ * Parses a named entity.
345
+ *
346
+ * Equivalent to the `Named character reference state` in the HTML spec.
347
+ * @param input The string containing the entity (or a continuation of the entity).
348
+ * @param offset The current offset.
349
+ * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
350
+ */
351
+ stateNamedEntity(input, offset) {
352
+ const { decodeTree } = this;
353
+ const inputLength = input.length;
354
+ const isStrict = this.decodeMode === DecodingMode.Strict;
355
+ /*
356
+ * Local copies of the resumable walk state avoid per-character
357
+ * field writes. They are flushed back to the fields
358
+ * on every exit (chunk end, and before any emit helper that reads
359
+ * them). `this.result` is only written at the (rare) record points,
360
+ * so it stays a direct field write.
361
+ *
362
+ * Legacy-match recording happens in two idempotent places: at the
363
+ * loop top when sitting on a value node, and in the chunk-end
364
+ * epilogue (so `end()` sees matches that land exactly on a chunk
365
+ * boundary). Recording applies `consumed += excess - 1; excess = 1`,
366
+ * which is a no-op when repeated — the loop-top invariant is
367
+ * `excess` = unrecorded consumed characters + 1.
368
+ */
369
+ let { treeIndex } = this;
370
+ let { excess } = this;
371
+ let { consumed } = this;
372
+ let current = decodeTree[treeIndex];
373
+ while (offset < inputLength) {
374
+ /*
375
+ * Descend through value-less jump-table nodes (including the
376
+ * single-branch encoding) inline, mirroring `decodeWithTrie`:
377
+ * this avoids a `determineBranch` call per level for the
378
+ * dominant node shape — including the root on the first write.
379
+ */
380
+ while ((current &
381
+ (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===
382
+ 0 &&
383
+ (current & BinTrieFlags.JUMP_TABLE) !== 0) {
384
+ const char = input.charCodeAt(offset);
385
+ const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
386
+ const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
387
+ if (branchCount === 0) {
388
+ // Single branch encoded inline in the jump offset bits.
389
+ if (char !== jumpOffset) {
390
+ return this.flushAndEmitLegacyOrReject(consumed, excess, char, 0);
391
+ }
392
+ treeIndex += 1;
393
+ }
394
+ else {
395
+ const slot = char - jumpOffset;
396
+ if (slot >>> 0 >= branchCount) {
397
+ return this.flushAndEmitLegacyOrReject(consumed, excess, char, 0);
398
+ }
399
+ const stored = decodeTree[treeIndex + 1 + slot];
400
+ if (stored === 0) {
401
+ return this.flushAndEmitLegacyOrReject(consumed, excess, char, 0);
402
+ }
403
+ // End-relative: branch data ends at treeIndex+1+branchCount.
404
+ treeIndex = (treeIndex + branchCount + stored) & 0xff_ff;
405
+ }
406
+ current = decodeTree[treeIndex];
407
+ offset += 1;
408
+ excess += 1;
409
+ /*
410
+ * `charCodeAt` past the end returns NaN, which would alias
411
+ * to slot 0 after `>>> 0` — bail out explicitly.
412
+ */
413
+ // eslint-disable-next-line unicorn/no-break-in-nested-loop
414
+ if (offset >= inputLength)
415
+ break;
416
+ }
417
+ if (offset >= inputLength)
418
+ break;
419
+ // Handle compact runs (resumable across chunks).
420
+ if ((current &
421
+ (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===
422
+ BinTrieFlags.FLAG13) {
423
+ const runLength = (current & BinTrieFlags.BRANCH_LENGTH) >> 7; /* 3..63 */
424
+ let { runConsumed } = this;
425
+ // If we are starting a run, check the first char.
426
+ if (runConsumed === 0) {
427
+ const char = input.charCodeAt(offset);
428
+ if (char !== (current & BinTrieFlags.JUMP_TABLE)) {
429
+ return this.flushAndEmitLegacyOrReject(consumed, excess, char, 0);
430
+ }
431
+ offset += 1;
432
+ excess += 1;
433
+ runConsumed = 1;
434
+ }
435
+ // Check remaining characters in the run (packed two per uint16 word).
436
+ while (runConsumed < runLength) {
437
+ if (offset >= inputLength) {
438
+ this.treeIndex = treeIndex;
439
+ this.excess = excess;
440
+ this.consumed = consumed;
441
+ this.runConsumed = runConsumed;
442
+ return -1;
443
+ }
444
+ const charIndexInPacked = runConsumed - 1;
445
+ const packedWord = decodeTree[treeIndex + 1 + (charIndexInPacked >> 1)];
446
+ const expectedChar = (packedWord >> ((charIndexInPacked & 1) << 3)) & 0xff;
447
+ const char = input.charCodeAt(offset);
448
+ if (char !== expectedChar) {
449
+ this.runConsumed = 0;
450
+ return this.flushAndEmitLegacyOrReject(consumed, excess, char, 0);
451
+ }
452
+ offset += 1;
453
+ excess += 1;
454
+ runConsumed += 1;
455
+ }
456
+ this.runConsumed = 0;
457
+ treeIndex += 1 + (runLength >> 1);
458
+ current = decodeTree[treeIndex];
459
+ // Loop top handles the landed-on node (record/emit/branch).
460
+ continue;
461
+ }
462
+ // Header plus out-of-line value words; 0 means no value.
463
+ const valueLength = current >>> 14;
464
+ const char = input.charCodeAt(offset);
465
+ if (valueLength !== 0) {
466
+ // Record a legacy match (FLAG13 clear = semicolon optional).
467
+ if (!isStrict && (current & BinTrieFlags.FLAG13) === 0) {
468
+ this.result = treeIndex;
469
+ consumed += excess - 1;
470
+ excess = 1;
471
+ }
472
+ /*
473
+ * Implicit semicolon handling: emit immediately. Covers both
474
+ * strict (FLAG13 set) and legacy entities — neither stores
475
+ * an explicit `;` branch in the trie.
476
+ */
477
+ if (char === CharCodes.SEMI) {
478
+ return this.emitNamedEntityData(treeIndex, valueLength, consumed + excess);
479
+ }
480
+ /*
481
+ * `valueLength === 1` packs the codepoint into the header
482
+ * word's low 13 bits, where branch metadata also lives. Skip
483
+ * the branch lookup on leaves so those value bits aren't
484
+ * reinterpreted as branch offsets.
485
+ */
486
+ if (valueLength === 1) {
487
+ return this.flushAndEmitLegacyOrReject(consumed, excess, char, valueLength);
488
+ }
489
+ }
490
+ // Value-bearing or dictionary node: dispatch through determineBranch.
491
+ const next = determineBranch(decodeTree, current, treeIndex + (valueLength || 1), char);
492
+ if (next < 0) {
493
+ return this.flushAndEmitLegacyOrReject(consumed, excess, char, valueLength);
494
+ }
495
+ treeIndex = next;
496
+ current = decodeTree[treeIndex];
497
+ offset += 1;
498
+ excess += 1;
499
+ }
500
+ /*
501
+ * Chunk exhausted. Record a legacy match we may be sitting on, so a
502
+ * subsequent `end()` emits it, then persist the walk state.
503
+ */
504
+ if (!isStrict &&
505
+ current >>> 14 !== 0 &&
506
+ (current & BinTrieFlags.FLAG13) === 0) {
507
+ this.result = treeIndex;
508
+ consumed += excess - 1;
509
+ excess = 1;
510
+ }
511
+ this.treeIndex = treeIndex;
512
+ this.excess = excess;
513
+ this.consumed = consumed;
514
+ return -1;
515
+ }
516
+ /**
517
+ * Emit a named entity that was not terminated with a semicolon.
518
+ * @returns The number of characters consumed.
519
+ */
520
+ emitNotTerminatedNamedEntity() {
521
+ const { result, decodeTree } = this;
522
+ const valueLength = decodeTree[result] >>> 14;
523
+ this.emitNamedEntityData(result, valueLength, this.consumed);
524
+ this.errors?.missingSemicolonAfterCharacterReference();
525
+ return this.consumed;
526
+ }
527
+ /**
528
+ * Emit a named entity.
529
+ * @param result The index of the entity in the decode tree.
530
+ * @param valueLength Encoded value length (header plus any value words).
531
+ * @param consumed The number of characters consumed.
532
+ * @returns The number of characters consumed.
533
+ */
534
+ emitNamedEntityData(result, valueLength, consumed) {
535
+ const { decodeTree } = this;
536
+ this.emitCodePoint(valueLength === 1
537
+ ? decodeTree[result] & BinTrieFlags.VALUE_MASK
538
+ : decodeTree[result + 1], consumed);
539
+ if (valueLength === 3) {
540
+ // Emit the second UTF-16 code unit.
541
+ this.emitCodePoint(decodeTree[result + 2], consumed);
542
+ }
543
+ return consumed;
544
+ }
545
+ /**
546
+ * Signal to the parser that the end of the input was reached.
547
+ *
548
+ * Remaining data will be emitted and relevant errors will be produced.
549
+ * @returns The number of characters consumed.
550
+ */
551
+ end() {
552
+ switch (this.state) {
553
+ case EntityDecoderState.NamedEntity: {
554
+ // Emit a named entity if we have one.
555
+ return this.result !== 0 &&
556
+ (this.decodeMode !== DecodingMode.Attribute ||
557
+ this.result === this.treeIndex)
558
+ ? this.emitNotTerminatedNamedEntity()
559
+ : 0;
560
+ }
561
+ // Otherwise, emit a numeric entity if we have one.
562
+ case EntityDecoderState.NumericDecimal: {
563
+ return this.emitNumericEntity(0, 2);
564
+ }
565
+ case EntityDecoderState.NumericHex: {
566
+ return this.emitNumericEntity(0, 3);
567
+ }
568
+ case EntityDecoderState.NumericStart: {
569
+ this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed);
570
+ return 0;
571
+ }
572
+ default: {
573
+ // EntityStart or unknown — return 0.
574
+ return 0;
575
+ }
576
+ }
577
+ }
578
+ }
579
+ /**
580
+ * Determines the branch of the current node that is taken given the current
581
+ * character. This function is used to traverse the trie.
582
+ *
583
+ * See `BinTrieFlags` for the branch-data layouts handled here.
584
+ * @param decodeTree The trie.
585
+ * @param current The current node's header word.
586
+ * @param nodeIndex Index of the node's first branch-data word (the header
587
+ * plus any value words have been skipped by the caller).
588
+ * @param char The current character.
589
+ * @returns The index of the next node, or -1 if no branch is taken.
590
+ */
591
+ export function determineBranch(decodeTree, current, nodeIndex, char) {
592
+ const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
593
+ const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
594
+ // Case 1: Single branch or jump table (jumpOffset encodes the first/only char code).
595
+ if (jumpOffset) {
596
+ if (branchCount === 0) {
597
+ // Single branch encoded inline in the jump offset bits.
598
+ return char === jumpOffset ? nodeIndex : -1;
599
+ }
600
+ /*
601
+ * Jump table: branchCount consecutive slots starting at jumpOffset.
602
+ * Unsigned comparison handles both < 0 and >= branchCount in one check.
603
+ */
604
+ const slot = char - jumpOffset;
605
+ if (slot >>> 0 >= branchCount)
606
+ return -1;
607
+ const stored = decodeTree[nodeIndex + slot];
608
+ /*
609
+ * 0 = empty slot (no branch); otherwise the child's offset from the
610
+ * end of the branch array, +1 (end-relative pointers compress
611
+ * better). `& 0xff_ff` mirrors the encoder's uint16 wrap for
612
+ * backreferences to already-encoded nodes.
613
+ */
614
+ return stored === 0
615
+ ? -1
616
+ : (nodeIndex + branchCount + stored - 1) & 0xff_ff;
617
+ }
618
+ /*
619
+ * Case 2: Packed dictionary. Linear scan — over 90% of dict nodes have
620
+ * <= 4 branches in the HTML trie, where the constant-factor savings
621
+ * dominate over binary search's asymptotic edge.
622
+ */
623
+ if (branchCount === 0)
624
+ return -1;
625
+ const packedKeySlots = (branchCount + 1) >> 1;
626
+ const branchEnd = nodeIndex + packedKeySlots + branchCount;
627
+ for (let index = 0; index < branchCount; index++) {
628
+ const packed = decodeTree[nodeIndex + (index >> 1)];
629
+ const key = (packed >> ((index & 1) << 3)) & 0xff;
630
+ if (key === char) {
631
+ const pointerIndex = nodeIndex + packedKeySlots + index;
632
+ // Pointers are relative to the end of the branch data.
633
+ return (branchEnd + decodeTree[pointerIndex]) & 0xff_ff;
634
+ }
635
+ // Keys are sorted; if we've passed `char`, no match is possible.
636
+ if (key > char)
637
+ return -1;
638
+ }
639
+ return -1;
640
+ }
641
+ /**
642
+ * Read the decoded value from a trie node.
643
+ * @param decodeTree The trie.
644
+ * @param nodeIndex The index of the node.
645
+ * @param valueLength The length of the value (1, 2, or 3).
646
+ * @returns The decoded string.
647
+ */
648
+ function readTrieValue(decodeTree, nodeIndex, valueLength) {
649
+ if (valueLength === 1) {
650
+ return String.fromCharCode(decodeTree[nodeIndex] & BinTrieFlags.VALUE_MASK);
651
+ }
652
+ if (valueLength === 2) {
653
+ return String.fromCharCode(decodeTree[nodeIndex + 1]);
654
+ }
655
+ return String.fromCharCode(decodeTree[nodeIndex + 1], decodeTree[nodeIndex + 2]);
656
+ }
657
+ /**
658
+ * Parse a numeric entity (`&#DDD;` or `&#xHHH;`).
659
+ *
660
+ * Encodes the result as `(consumed << CONSUMED_SHIFT) | codepoint` (see
661
+ * the packing comment at the top of the file; overlong entities spill
662
+ * their length into `longNumericConsumed`). Returns 0 when no digits were
663
+ * found.
664
+ *
665
+ * This is the sync counterpart of the streaming
666
+ * `EntityDecoder#stateNumericDecimal` / `#stateNumericHex`. Digit parsing
667
+ * matches those methods; only this packed result needs a value clamp.
668
+ * @param input The input string.
669
+ * @param numberStart Index of the `#` character.
670
+ * @param inputLength Cached `input.length`.
671
+ */
672
+ function parseNumericEntity(input, numberStart, inputLength) {
673
+ let offset = numberStart + 1; // Skip "#"
674
+ let cp = 0;
675
+ let digitStart = offset;
676
+ /*
677
+ * Separate decimal and hexadecimal loops: each multiplies by a constant
678
+ * and runs a single digit test, instead of a per-character base check.
679
+ */
680
+ if (offset < inputLength &&
681
+ (input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
682
+ offset += 1;
683
+ digitStart = offset;
684
+ while (offset < inputLength) {
685
+ const char = input.charCodeAt(offset);
686
+ if (isNumber(char)) {
687
+ cp = cp * 16 + (char - CharCodes.ZERO);
688
+ }
689
+ else if (isHexadecimalCharacter(char)) {
690
+ cp = cp * 16 + ((char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10);
691
+ }
692
+ else {
693
+ break;
694
+ }
695
+ offset += 1;
696
+ }
697
+ }
698
+ else {
699
+ while (offset < inputLength) {
700
+ const digit = input.charCodeAt(offset) - CharCodes.ZERO;
701
+ if (digit >>> 0 > 9)
702
+ break;
703
+ cp = cp * 10 + digit;
704
+ offset += 1;
705
+ }
706
+ }
707
+ if (offset === digitStart)
708
+ return 0;
709
+ // Include the semicolon in consumed when present.
710
+ if (offset < inputLength && input.charCodeAt(offset) === CharCodes.SEMI) {
711
+ offset += 1;
712
+ }
713
+ /*
714
+ * Clamp out-of-range values to 0x110000 so they fit the 21-bit field
715
+ * and decode to U+FFFD. Lengths at or above CONSUMED_OVERFLOW use the
716
+ * side channel described with the packing constants.
717
+ */
718
+ if (cp > 0x10_ff_ff)
719
+ cp = 0x11_00_00;
720
+ let consumed = offset - numberStart;
721
+ if (consumed >= CONSUMED_OVERFLOW) {
722
+ // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- deliberate side channel, see `longNumericConsumed`
723
+ longNumericConsumed = consumed;
724
+ consumed = CONSUMED_OVERFLOW;
725
+ }
726
+ return (consumed << CONSUMED_SHIFT) | cp;
727
+ }
728
+ /**
729
+ * Decode all entities in `input` using the HTML trie.
730
+ *
731
+ * Hard-wired to `htmlDecodeTree`: the inline root navigation below assumes
732
+ * the HTML root's jump-table shape, so this must not be generalized to
733
+ * other tries (the XML trie's dictionary root would silently match no
734
+ * entities — `decodeXML` has its own hand-coded fast path instead).
735
+ * @param input The string to decode.
736
+ * @param isStrict Only match semicolon-terminated entities.
737
+ * @param isAttribute Whether to apply attribute-specific parsing rules (disallowing certain non-semicolon terminators).
738
+ * @returns The decoded string.
739
+ */
740
+ function decodeWithTrie(input, isStrict, isAttribute) {
741
+ const decodeTree = htmlDecodeTree;
742
+ // Fast path: no entities at all — return input without any allocation.
743
+ let offset = input.indexOf("&");
744
+ if (offset < 0)
745
+ return input;
746
+ const inputLength = input.length;
747
+ /*
748
+ * `chunkStart` marks the start of the next pending slice. Rejected
749
+ * entities don't advance it, so consecutive rejections are stitched
750
+ * into a single `slice` once a real match (or end of input) is hit.
751
+ */
752
+ let chunkStart = 0;
753
+ let result = "";
754
+ /*
755
+ * Root navigation fields, hoisted out of the per-entity loop. The HTML
756
+ * root is a multi-branch jump-table covering [A-Za-z]; see the inline
757
+ * first-iteration comment below.
758
+ */
759
+ const root = decodeTree[0];
760
+ const rootJumpOffset = root & BinTrieFlags.JUMP_TABLE;
761
+ const rootBranchCount = (root & BinTrieFlags.BRANCH_LENGTH) >> 7;
762
+ do {
763
+ const entityStart = offset + 1;
764
+ // Quick check: entity names must start with [A-Za-z], numeric with #.
765
+ const firstChar = input.charCodeAt(entityStart);
766
+ let consumed;
767
+ let value;
768
+ if (firstChar === CharCodes.NUM) {
769
+ const packed = parseNumericEntity(input, entityStart, inputLength);
770
+ consumed = unpackConsumed(packed);
771
+ // In strict mode, require semicolon termination.
772
+ if (isStrict &&
773
+ consumed > 0 &&
774
+ input.charCodeAt(entityStart + consumed - 1) !== CharCodes.SEMI) {
775
+ consumed = 0;
776
+ }
777
+ value =
778
+ consumed === 0
779
+ ? ""
780
+ : codePointToString(packed & CODE_POINT_MASK);
781
+ }
782
+ else if (isAlpha(firstChar)) {
783
+ consumed = 0;
784
+ value = "";
785
+ /*
786
+ * The generator guarantees a jump-table root. Consume the first
787
+ * character directly, then walk from its child.
788
+ */
789
+ const rootSlotIndex = firstChar - rootJumpOffset;
790
+ let nodeIndex;
791
+ if (rootSlotIndex >>> 0 < rootBranchCount) {
792
+ const stored = decodeTree[1 + rootSlotIndex];
793
+ nodeIndex =
794
+ stored === 0 ? -1 : (rootBranchCount + stored) & 0xff_ff;
795
+ }
796
+ else {
797
+ nodeIndex = -1;
798
+ }
799
+ /*
800
+ * Best legacy (no-semicolon) match so far, as trie coordinates.
801
+ * Deferring `readTrieValue` to the end avoids allocating a
802
+ * string for matches that longer matches supersede.
803
+ */
804
+ let bestNodeIndex = 0;
805
+ let bestValueLength = 0;
806
+ let current = nodeIndex < 0 ? 0 : decodeTree[nodeIndex];
807
+ let index = entityStart + 1;
808
+ /*
809
+ * Walk the trie from the root child. The `trie` label lets the
810
+ * inner descent and compact-run loops abandon the entity (and
811
+ * fall through to the legacy/reject handling) directly.
812
+ */
813
+ trie: while (index < inputLength) {
814
+ /*
815
+ * Inline value-less jump tables and single branches. A miss
816
+ * falls through to the recorded legacy match or rejection.
817
+ */
818
+ while (
819
+ // Value-less, non-run node with a nonzero jump offset.
820
+ (current &
821
+ (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===
822
+ 0 &&
823
+ (current & BinTrieFlags.JUMP_TABLE) !== 0) {
824
+ const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
825
+ const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
826
+ if (branchCount === 0) {
827
+ // Single branch encoded inline in the jump offset bits.
828
+ if (input.charCodeAt(index) !== jumpOffset)
829
+ break trie;
830
+ nodeIndex += 1;
831
+ }
832
+ else {
833
+ const slot = input.charCodeAt(index) - jumpOffset;
834
+ if (slot >>> 0 >= branchCount)
835
+ break trie;
836
+ const stored = decodeTree[nodeIndex + 1 + slot];
837
+ if (stored === 0)
838
+ break trie;
839
+ // End-relative: branch data ends at nodeIndex+1+branchCount.
840
+ nodeIndex =
841
+ (nodeIndex + branchCount + stored) & 0xff_ff;
842
+ }
843
+ current = decodeTree[nodeIndex];
844
+ index += 1;
845
+ /*
846
+ * `charCodeAt` past the end returns NaN, which would
847
+ * alias to slot 0 after `>>> 0` — bail out explicitly.
848
+ */
849
+ if (index >= inputLength)
850
+ break trie;
851
+ }
852
+ // FLAG13 without a value marks a compact run.
853
+ if ((current &
854
+ (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) ===
855
+ BinTrieFlags.FLAG13) {
856
+ const runLength = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
857
+ // Check first char (stored in JUMP_TABLE bits).
858
+ if (input.charCodeAt(index) !==
859
+ (current & BinTrieFlags.JUMP_TABLE)) {
860
+ // eslint-disable-next-line unicorn/no-break-in-nested-loop
861
+ break;
862
+ }
863
+ index += 1;
864
+ // Check remaining characters (packed two per uint16 word).
865
+ const remaining = runLength - 1;
866
+ let wordIndex = nodeIndex + 1;
867
+ let charIndexInPacked = 0;
868
+ /*
869
+ * Process pairs: read one packed word, compare low byte then high byte.
870
+ * No explicit bounds check needed — charCodeAt returns NaN for OOB,
871
+ * which never equals an integer, so the mismatch break fires naturally.
872
+ */
873
+ for (; charIndexInPacked + 1 < remaining; charIndexInPacked += 2) {
874
+ const packed = decodeTree[wordIndex];
875
+ if (input.charCodeAt(index) !== (packed & 0xff))
876
+ break trie;
877
+ index += 1;
878
+ if (input.charCodeAt(index) !== ((packed >> 8) & 0xff))
879
+ break trie;
880
+ index += 1;
881
+ wordIndex += 1;
882
+ }
883
+ // Handle odd trailing char.
884
+ if (charIndexInPacked < remaining) {
885
+ if (input.charCodeAt(index) !==
886
+ (decodeTree[wordIndex] & 0xff))
887
+ // eslint-disable-next-line unicorn/no-break-in-nested-loop
888
+ break;
889
+ index += 1;
890
+ }
891
+ nodeIndex += 1 + (runLength >> 1);
892
+ current = decodeTree[nodeIndex];
893
+ // eslint-disable-next-line unicorn/no-break-in-nested-loop
894
+ continue;
895
+ }
896
+ // Header plus out-of-line value words; 0 means no value.
897
+ const valueLength = current >>> 14;
898
+ const char = input.charCodeAt(index);
899
+ /*
900
+ * Check current node for a value before navigating.
901
+ * This handles both: (a) values reached via compact runs on the
902
+ * previous iteration, and (b) values at regular branch targets.
903
+ */
904
+ if (valueLength !== 0) {
905
+ // If char is `;`, emit immediately.
906
+ if (char === CharCodes.SEMI) {
907
+ consumed = index - entityStart + 1;
908
+ // Inline leaves carry the value in the low 13 bits.
909
+ value =
910
+ valueLength === 1
911
+ ? String.fromCharCode(current & BinTrieFlags.VALUE_MASK)
912
+ : readTrieValue(decodeTree, nodeIndex, valueLength);
913
+ // eslint-disable-next-line unicorn/no-break-in-nested-loop
914
+ break;
915
+ }
916
+ // Record non-terminated (legacy) match (FLAG13 clear = semicolon optional).
917
+ if (!isStrict && (current & BinTrieFlags.FLAG13) === 0) {
918
+ consumed = index - entityStart;
919
+ bestNodeIndex = nodeIndex;
920
+ bestValueLength = valueLength;
921
+ }
922
+ /*
923
+ * A valueLength of 1 means the value is packed inline in the header
924
+ * word — these are always leaf nodes with no branches, so we can
925
+ * stop walking the trie.
926
+ */
927
+ // eslint-disable-next-line unicorn/no-break-in-nested-loop
928
+ if (valueLength === 1)
929
+ break;
930
+ }
931
+ // Navigate to the next node (valueLength || 1: skip past value words, minimum 1 for header).
932
+ const next = determineBranch(decodeTree, current, nodeIndex + (valueLength || 1), char);
933
+ // eslint-disable-next-line unicorn/no-break-in-nested-loop
934
+ if (next < 0)
935
+ break;
936
+ nodeIndex = next;
937
+ current = decodeTree[nodeIndex];
938
+ index += 1;
939
+ }
940
+ /*
941
+ * Post-loop: if the semicolon path didn't set value,
942
+ * check for a final legacy match. The last navigation may
943
+ * have landed on a legacy node whose value hasn't been
944
+ * recorded yet (loop exited before the top-of-loop check
945
+ * could run).
946
+ */
947
+ if (value === "") {
948
+ const finalVL = current >>> 14;
949
+ if (finalVL !== 0 &&
950
+ !isStrict &&
951
+ (current & BinTrieFlags.FLAG13) === 0) {
952
+ consumed = index - entityStart;
953
+ bestNodeIndex = nodeIndex;
954
+ bestValueLength = finalVL;
955
+ }
956
+ if (consumed > 0) {
957
+ value = readTrieValue(decodeTree, bestNodeIndex, bestValueLength);
958
+ }
959
+ }
960
+ }
961
+ else {
962
+ consumed = 0;
963
+ value = "";
964
+ }
965
+ /*
966
+ * The attribute end-char rule (HTML spec §13.2.5.73) only applies to
967
+ * unterminated *named* references. Semicolon-terminated entities and
968
+ * numeric entities are always accepted, matching EntityDecoder behavior.
969
+ *
970
+ * When `attribute` is false (the common case), short-circuit skips all
971
+ * the unterminated-named checks entirely.
972
+ */
973
+ if (consumed === 0 ||
974
+ (isAttribute &&
975
+ firstChar !== CharCodes.NUM &&
976
+ input.charCodeAt(entityStart + consumed - 1) !==
977
+ CharCodes.SEMI &&
978
+ entityStart + consumed < inputLength &&
979
+ isEntityInAttributeInvalidEnd(input.charCodeAt(entityStart + consumed)))) {
980
+ // Rejected: leave `&` in the pending chunk, scan past it.
981
+ offset = entityStart;
982
+ }
983
+ else {
984
+ if (chunkStart < offset) {
985
+ result += input.slice(chunkStart, offset);
986
+ }
987
+ result += value;
988
+ offset = chunkStart = entityStart + consumed;
989
+ }
990
+ /*
991
+ * Adjacent entities (`&x;&y;`) are common in entity-dense input;
992
+ * checking the single character at `offset` first skips the
993
+ * `indexOf` call (and its per-call overhead) for that case.
994
+ */
995
+ if (input.charCodeAt(offset) !== CharCodes.AMP) {
996
+ offset = input.indexOf("&", offset);
997
+ }
998
+ } while (offset >= 0);
999
+ return result + input.slice(chunkStart);
1000
+ }
1001
+ /**
1002
+ * Decodes an HTML string.
1003
+ * @param htmlString The string to decode.
1004
+ * @param mode The decoding mode.
1005
+ * @returns The decoded string.
1006
+ */
1007
+ export function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
1008
+ return decodeWithTrie(htmlString, mode === DecodingMode.Strict, mode === DecodingMode.Attribute);
1009
+ }
1010
+ /**
1011
+ * Decodes an HTML string in an attribute.
1012
+ * @param htmlAttribute The string to decode.
1013
+ * @returns The decoded string.
1014
+ */
1015
+ export function decodeHTMLAttribute(htmlAttribute) {
1016
+ return decodeWithTrie(htmlAttribute, false, true);
1017
+ }
1018
+ /**
1019
+ * Decodes an HTML string, requiring all entities to be terminated by a semicolon.
1020
+ * @param htmlString The string to decode.
1021
+ * @returns The decoded string.
1022
+ */
1023
+ export function decodeHTMLStrict(htmlString) {
1024
+ return decodeWithTrie(htmlString, true, false);
1025
+ }
1026
+ /**
1027
+ * Decodes an XML string, requiring all entities to be terminated by a semicolon.
1028
+ *
1029
+ * Uses a hand-coded fast path for the 5 XML named entities (amp, lt, gt,
1030
+ * quot, apos) plus numeric entities, bypassing the trie entirely.
1031
+ * @param xmlString The string to decode.
1032
+ * @returns The decoded string.
1033
+ */
1034
+ export function decodeXML(xmlString) {
1035
+ let offset = xmlString.indexOf("&");
1036
+ if (offset < 0)
1037
+ return xmlString;
1038
+ let lastIndex = 0;
1039
+ let result = "";
1040
+ do {
1041
+ const start = offset + 1;
1042
+ let consumed = 0;
1043
+ let value = "";
1044
+ const c1 = xmlString.charCodeAt(start);
1045
+ if (c1 === CharCodes.NUM) {
1046
+ const packed = parseNumericEntity(xmlString, start, xmlString.length);
1047
+ consumed = unpackConsumed(packed);
1048
+ // XML is always strict — require semicolon.
1049
+ if (consumed === 0 ||
1050
+ xmlString.charCodeAt(start + consumed - 1) !== CharCodes.SEMI) {
1051
+ consumed = 0;
1052
+ }
1053
+ else {
1054
+ const codePoint = packed & CODE_POINT_MASK;
1055
+ // Nonzero BMP values below the surrogate range need no replacement.
1056
+ value =
1057
+ (codePoint - 1) >>> 0 < 0xd7_ff
1058
+ ? String.fromCharCode(codePoint)
1059
+ : String.fromCodePoint(replaceCodePointXML(codePoint));
1060
+ }
1061
+ }
1062
+ else {
1063
+ /* eslint-disable unicorn/no-break-in-nested-loop -- Keep XML name dispatch inline with the decode loop. */
1064
+ switch (c1) {
1065
+ // &lt; / &gt;
1066
+ case 0x6c:
1067
+ case 0x67: {
1068
+ if (xmlString.charCodeAt(start + 1) === 0x74 &&
1069
+ xmlString.charCodeAt(start + 2) === CharCodes.SEMI) {
1070
+ consumed = 3;
1071
+ value = c1 === 0x6c ? "<" : ">";
1072
+ }
1073
+ break;
1074
+ }
1075
+ // &amp; / &apos;
1076
+ case 0x61: {
1077
+ const c2 = xmlString.charCodeAt(start + 1);
1078
+ if (c2 === 0x6d &&
1079
+ xmlString.charCodeAt(start + 2) === 0x70 &&
1080
+ xmlString.charCodeAt(start + 3) === CharCodes.SEMI) {
1081
+ consumed = 4;
1082
+ value = "&";
1083
+ }
1084
+ else if (c2 === 0x70 &&
1085
+ xmlString.charCodeAt(start + 2) === 0x6f &&
1086
+ xmlString.charCodeAt(start + 3) === 0x73 &&
1087
+ xmlString.charCodeAt(start + 4) === CharCodes.SEMI) {
1088
+ consumed = 5;
1089
+ value = "'";
1090
+ }
1091
+ break;
1092
+ }
1093
+ // &quot;
1094
+ case 0x71: {
1095
+ if (xmlString.charCodeAt(start + 1) === 0x75 &&
1096
+ xmlString.charCodeAt(start + 2) === 0x6f &&
1097
+ xmlString.charCodeAt(start + 3) === 0x74 &&
1098
+ xmlString.charCodeAt(start + 4) === CharCodes.SEMI) {
1099
+ consumed = 5;
1100
+ value = '"';
1101
+ }
1102
+ break;
1103
+ }
1104
+ }
1105
+ /* eslint-enable unicorn/no-break-in-nested-loop */
1106
+ }
1107
+ if (consumed > 0) {
1108
+ if (lastIndex < offset)
1109
+ result += xmlString.slice(lastIndex, offset);
1110
+ result += value;
1111
+ offset = lastIndex = start + consumed;
1112
+ }
1113
+ else {
1114
+ offset = start;
1115
+ }
1116
+ /*
1117
+ * Adjacent entities (`&x;&y;`) are common in entity-dense input;
1118
+ * checking the single character at `lastIndex` first skips the
1119
+ * `indexOf` call (and its per-call overhead) for that case.
1120
+ */
1121
+ offset =
1122
+ xmlString.charCodeAt(offset) === CharCodes.AMP
1123
+ ? offset
1124
+ : xmlString.indexOf("&", offset);
1125
+ } while (offset >= 0);
1126
+ return result + xmlString.slice(lastIndex);
1127
+ }
1128
+ export { replaceCodePoint, replaceCodePointXML, } from "./decode-codepoint.js";
1129
+ // Re-export for use by eg. htmlparser2
1130
+ export { htmlDecodeTree } from "./generated/decode-data-html.js";
1131
+ export { xmlDecodeTree } from "./generated/decode-data-xml.js";
1132
+ //# sourceMappingURL=decode.js.map