openplanr 3.4.0 → 3.6.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 (530) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/cli/commands/backlog-commands.d.ts +3 -0
  3. package/dist/cli/commands/backlog-commands.d.ts.map +1 -0
  4. package/dist/cli/commands/backlog-commands.js +60 -0
  5. package/dist/cli/commands/backlog-commands.js.map +1 -0
  6. package/dist/cli/commands/company.d.ts.map +1 -1
  7. package/dist/cli/commands/company.js +17 -0
  8. package/dist/cli/commands/company.js.map +1 -1
  9. package/dist/cli/commands/design.d.ts +3 -0
  10. package/dist/cli/commands/design.d.ts.map +1 -0
  11. package/dist/cli/commands/design.js +137 -0
  12. package/dist/cli/commands/design.js.map +1 -0
  13. package/dist/cli/commands/groups/operations.d.ts.map +1 -1
  14. package/dist/cli/commands/groups/operations.js +2 -0
  15. package/dist/cli/commands/groups/operations.js.map +1 -1
  16. package/dist/cli/commands/planning-artifacts.d.ts.map +1 -1
  17. package/dist/cli/commands/planning-artifacts.js +13 -5
  18. package/dist/cli/commands/planning-artifacts.js.map +1 -1
  19. package/dist/dashboard/.vite/manifest.json +1 -1
  20. package/dist/dashboard/assets/{index-CvQAlBy3.js → index-C_OquZVk.js} +2 -2
  21. package/dist/dashboard/assets/{index-CvQAlBy3.js.map → index-C_OquZVk.js.map} +1 -1
  22. package/dist/dashboard/dashboard-manifest.json +13 -13
  23. package/dist/dashboard/index.html +1 -1
  24. package/dist/services/artifact-service.d.ts.map +1 -1
  25. package/dist/services/artifact-service.js +13 -6
  26. package/dist/services/artifact-service.js.map +1 -1
  27. package/dist/services/company-export-service.d.ts +41 -0
  28. package/dist/services/company-export-service.d.ts.map +1 -0
  29. package/dist/services/company-export-service.js +429 -0
  30. package/dist/services/company-export-service.js.map +1 -0
  31. package/dist/services/company-sync-service.d.ts +24 -1
  32. package/dist/services/company-sync-service.d.ts.map +1 -1
  33. package/dist/services/company-sync-service.js +36 -19
  34. package/dist/services/company-sync-service.js.map +1 -1
  35. package/dist/services/design-artifact-service.d.ts +22 -0
  36. package/dist/services/design-artifact-service.d.ts.map +1 -1
  37. package/dist/services/design-artifact-service.js +76 -16
  38. package/dist/services/design-artifact-service.js.map +1 -1
  39. package/dist/services/runtime-manager/runtime-package.js +1 -1
  40. package/dist/services/runtime-manager/runtime-package.js.map +1 -1
  41. package/docs/CLI.md +126 -1
  42. package/lib/backlog-item.d.mts +45 -1
  43. package/lib/backlog-item.mjs +302 -34
  44. package/lib/host-packages/adapter-registry.json +5 -5
  45. package/lib/host-packages/capability-map.json +1 -1
  46. package/lib/host-packages/claude/.claude-plugin/marketplace.json +2 -2
  47. package/lib/host-packages/claude/openplanr/.claude-plugin/icon.png +0 -0
  48. package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +1 -1
  49. package/lib/host-packages/claude/openplanr/.openplanr-content.json +97 -413
  50. package/lib/host-packages/claude/openplanr/README.md +8 -8
  51. package/lib/host-packages/claude/openplanr/skills/artifact/references/design-sharing.md +2 -2
  52. package/lib/host-packages/claude/openplanr/skills/ceo-review/references/note-checklist.md +131 -0
  53. package/lib/host-packages/claude/openplanr/skills/ceo-review/references/operate-advisor-contract.md +2 -7
  54. package/lib/host-packages/claude/openplanr/skills/chair-review/SKILL.md +2 -7
  55. package/lib/host-packages/claude/openplanr/skills/chair-review/references/note-checklist.md +131 -0
  56. package/lib/host-packages/claude/openplanr/skills/challenger-review/SKILL.md +3 -7
  57. package/lib/host-packages/claude/openplanr/skills/challenger-review/references/note-checklist.md +131 -0
  58. package/lib/host-packages/claude/openplanr/skills/cmo-review/references/note-checklist.md +131 -0
  59. package/lib/host-packages/claude/openplanr/skills/cmo-review/references/operate-advisor-contract.md +2 -7
  60. package/lib/host-packages/claude/openplanr/skills/coo-review/references/note-checklist.md +131 -0
  61. package/lib/host-packages/claude/openplanr/skills/coo-review/references/operate-advisor-contract.md +2 -7
  62. package/lib/host-packages/claude/openplanr/skills/cpo-review/references/note-checklist.md +131 -0
  63. package/lib/host-packages/claude/openplanr/skills/cpo-review/references/operate-advisor-contract.md +2 -7
  64. package/lib/host-packages/claude/openplanr/skills/cto-review/references/note-checklist.md +131 -0
  65. package/lib/host-packages/claude/openplanr/skills/cto-review/references/operate-advisor-contract.md +2 -7
  66. package/lib/host-packages/claude/openplanr/skills/design/SKILL.md +23 -12
  67. package/lib/host-packages/claude/openplanr/skills/design/references/design-system.md +2 -2
  68. package/lib/host-packages/claude/openplanr/skills/design/references/generation.md +3 -3
  69. package/lib/host-packages/claude/openplanr/skills/design/references/hosted-canvas.md +6 -3
  70. package/lib/host-packages/claude/openplanr/skills/design/references/review.md +6 -6
  71. package/lib/host-packages/claude/openplanr/skills/design/references/team-review.md +3 -4
  72. package/lib/host-packages/claude/openplanr/skills/design/references/utilities.md +78 -38
  73. package/lib/host-packages/claude/openplanr/skills/design-loop/SKILL.md +15 -7
  74. package/lib/host-packages/claude/openplanr/skills/design-loop/references/design-system.md +2 -2
  75. package/lib/host-packages/claude/openplanr/skills/design-loop/references/generation.md +3 -3
  76. package/lib/host-packages/claude/openplanr/skills/design-loop/references/review.md +6 -6
  77. package/lib/host-packages/claude/openplanr/skills/design-loop/references/team-review.md +3 -4
  78. package/lib/host-packages/claude/openplanr/skills/design-loop/references/utilities.md +78 -38
  79. package/lib/host-packages/claude/openplanr/skills/design-review/SKILL.md +25 -5
  80. package/lib/host-packages/claude/openplanr/skills/design-review/references/design-system.md +2 -2
  81. package/lib/host-packages/claude/openplanr/skills/design-review/references/generation.md +3 -3
  82. package/lib/host-packages/claude/openplanr/skills/design-review/references/review.md +6 -6
  83. package/lib/host-packages/claude/openplanr/skills/design-review/references/team-review.md +3 -4
  84. package/lib/host-packages/claude/openplanr/skills/design-review/references/utilities.md +78 -38
  85. package/lib/host-packages/claude/openplanr/skills/investigate/SKILL.md +2 -3
  86. package/lib/host-packages/claude/openplanr/skills/investigate/references/backlog-filing.md +102 -0
  87. package/lib/host-packages/claude/openplanr/skills/investigate/references/findings.md +8 -16
  88. package/lib/host-packages/claude/openplanr/skills/operate/SKILL.md +73 -84
  89. package/lib/host-packages/claude/openplanr/skills/operate/references/note-checklist.md +131 -0
  90. package/lib/host-packages/claude/openplanr/skills/operate/references/return-contract.md +10 -0
  91. package/lib/host-packages/claude/openplanr/skills/plan/SKILL.md +23 -20
  92. package/lib/host-packages/claude/openplanr/skills/plan/references/planning-ids.md +53 -0
  93. package/lib/host-packages/claude/openplanr/skills/plan/references/return-contract.md +10 -0
  94. package/lib/host-packages/claude/openplanr/skills/plan-review/SKILL.md +6 -6
  95. package/lib/host-packages/claude/openplanr/skills/plan-review/references/return-contract.md +10 -0
  96. package/lib/host-packages/claude/openplanr/skills/release/SKILL.md +40 -139
  97. package/lib/host-packages/claude/openplanr/skills/release/references/cadence.md +10 -0
  98. package/lib/host-packages/claude/openplanr/skills/release/references/release-notes.md +1 -1
  99. package/lib/host-packages/claude/openplanr/skills/release/references/return-contract.md +10 -0
  100. package/lib/host-packages/claude/openplanr/skills/release/references/schemes.md +4 -2
  101. package/lib/host-packages/claude/openplanr/skills/ship/SKILL.md +37 -24
  102. package/lib/host-packages/claude/openplanr/skills/ship/references/backlog-filing.md +102 -0
  103. package/lib/host-packages/claude/openplanr/skills/ship/references/findings.md +8 -16
  104. package/lib/host-packages/claude/openplanr/skills/ship/references/return-contract.md +10 -0
  105. package/lib/host-packages/claude/openplanr/skills/spec/SKILL.md +9 -9
  106. package/lib/host-packages/claude/openplanr/skills/spec/references/return-contract.md +10 -0
  107. package/lib/host-packages/cursor/openplanr/.openplanr-content.json +94 -410
  108. package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
  109. package/lib/host-packages/cursor/openplanr/rules/planr-artifact/references/design-sharing.md +2 -2
  110. package/lib/host-packages/cursor/openplanr/rules/planr-ceo-review/references/note-checklist.md +131 -0
  111. package/lib/host-packages/cursor/openplanr/rules/planr-ceo-review/references/operate-advisor-contract.md +2 -7
  112. package/lib/host-packages/cursor/openplanr/rules/planr-chair-review/references/note-checklist.md +131 -0
  113. package/lib/host-packages/cursor/openplanr/rules/planr-chair-review.mdc +2 -7
  114. package/lib/host-packages/cursor/openplanr/rules/planr-challenger-review/references/note-checklist.md +131 -0
  115. package/lib/host-packages/cursor/openplanr/rules/planr-challenger-review.mdc +3 -7
  116. package/lib/host-packages/cursor/openplanr/rules/planr-cmo-review/references/note-checklist.md +131 -0
  117. package/lib/host-packages/cursor/openplanr/rules/planr-cmo-review/references/operate-advisor-contract.md +2 -7
  118. package/lib/host-packages/cursor/openplanr/rules/planr-coo-review/references/note-checklist.md +131 -0
  119. package/lib/host-packages/cursor/openplanr/rules/planr-coo-review/references/operate-advisor-contract.md +2 -7
  120. package/lib/host-packages/cursor/openplanr/rules/planr-cpo-review/references/note-checklist.md +131 -0
  121. package/lib/host-packages/cursor/openplanr/rules/planr-cpo-review/references/operate-advisor-contract.md +2 -7
  122. package/lib/host-packages/cursor/openplanr/rules/planr-cto-review/references/note-checklist.md +131 -0
  123. package/lib/host-packages/cursor/openplanr/rules/planr-cto-review/references/operate-advisor-contract.md +2 -7
  124. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/design-system.md +2 -2
  125. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/generation.md +3 -3
  126. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/hosted-canvas.md +6 -3
  127. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/review.md +6 -6
  128. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/team-review.md +3 -4
  129. package/lib/host-packages/cursor/openplanr/rules/planr-design/references/utilities.md +78 -38
  130. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/design-system.md +2 -2
  131. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/generation.md +3 -3
  132. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/review.md +6 -6
  133. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/team-review.md +3 -4
  134. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/references/utilities.md +78 -38
  135. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop.mdc +15 -7
  136. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/design-system.md +2 -2
  137. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/generation.md +3 -3
  138. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/review.md +6 -6
  139. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/team-review.md +3 -4
  140. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/references/utilities.md +78 -38
  141. package/lib/host-packages/cursor/openplanr/rules/planr-design-review.mdc +25 -5
  142. package/lib/host-packages/cursor/openplanr/rules/planr-design.mdc +23 -12
  143. package/lib/host-packages/cursor/openplanr/rules/planr-investigate/references/backlog-filing.md +102 -0
  144. package/lib/host-packages/cursor/openplanr/rules/planr-investigate/references/findings.md +8 -16
  145. package/lib/host-packages/cursor/openplanr/rules/planr-investigate.mdc +2 -3
  146. package/lib/host-packages/cursor/openplanr/rules/planr-operate/references/note-checklist.md +131 -0
  147. package/lib/host-packages/cursor/openplanr/rules/planr-operate/references/return-contract.md +10 -0
  148. package/lib/host-packages/cursor/openplanr/rules/planr-operate.mdc +73 -84
  149. package/lib/host-packages/cursor/openplanr/rules/planr-plan/references/planning-ids.md +53 -0
  150. package/lib/host-packages/cursor/openplanr/rules/planr-plan/references/return-contract.md +10 -0
  151. package/lib/host-packages/cursor/openplanr/rules/planr-plan-review/references/return-contract.md +10 -0
  152. package/lib/host-packages/cursor/openplanr/rules/planr-plan-review.mdc +6 -6
  153. package/lib/host-packages/cursor/openplanr/rules/planr-plan.mdc +23 -20
  154. package/lib/host-packages/cursor/openplanr/rules/planr-release/references/cadence.md +10 -0
  155. package/lib/host-packages/cursor/openplanr/rules/planr-release/references/release-notes.md +1 -1
  156. package/lib/host-packages/cursor/openplanr/rules/planr-release/references/return-contract.md +10 -0
  157. package/lib/host-packages/cursor/openplanr/rules/planr-release/references/schemes.md +4 -2
  158. package/lib/host-packages/cursor/openplanr/rules/planr-release.mdc +40 -139
  159. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/backlog-filing.md +102 -0
  160. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/findings.md +8 -16
  161. package/lib/host-packages/cursor/openplanr/rules/planr-ship/references/return-contract.md +10 -0
  162. package/lib/host-packages/cursor/openplanr/rules/planr-ship.mdc +37 -24
  163. package/lib/host-packages/cursor/openplanr/rules/planr-spec/references/return-contract.md +10 -0
  164. package/lib/host-packages/cursor/openplanr/rules/planr-spec.mdc +9 -9
  165. package/lib/host-packages/openai/.claude-plugin/marketplace.json +2 -2
  166. package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +1 -1
  167. package/lib/host-packages/openai/openplanr/.openplanr-content.json +112 -428
  168. package/lib/host-packages/openai/openplanr/skills/artifact/references/design-sharing.md +2 -2
  169. package/lib/host-packages/openai/openplanr/skills/ceo-review/openplanr.skill.json +4 -4
  170. package/lib/host-packages/openai/openplanr/skills/ceo-review/references/note-checklist.md +131 -0
  171. package/lib/host-packages/openai/openplanr/skills/ceo-review/references/operate-advisor-contract.md +2 -7
  172. package/lib/host-packages/openai/openplanr/skills/chair-review/SKILL.md +2 -7
  173. package/lib/host-packages/openai/openplanr/skills/chair-review/openplanr.skill.json +4 -4
  174. package/lib/host-packages/openai/openplanr/skills/chair-review/references/note-checklist.md +131 -0
  175. package/lib/host-packages/openai/openplanr/skills/challenger-review/SKILL.md +3 -7
  176. package/lib/host-packages/openai/openplanr/skills/challenger-review/openplanr.skill.json +4 -4
  177. package/lib/host-packages/openai/openplanr/skills/challenger-review/references/note-checklist.md +131 -0
  178. package/lib/host-packages/openai/openplanr/skills/cmo-review/openplanr.skill.json +4 -4
  179. package/lib/host-packages/openai/openplanr/skills/cmo-review/references/note-checklist.md +131 -0
  180. package/lib/host-packages/openai/openplanr/skills/cmo-review/references/operate-advisor-contract.md +2 -7
  181. package/lib/host-packages/openai/openplanr/skills/coo-review/openplanr.skill.json +4 -4
  182. package/lib/host-packages/openai/openplanr/skills/coo-review/references/note-checklist.md +131 -0
  183. package/lib/host-packages/openai/openplanr/skills/coo-review/references/operate-advisor-contract.md +2 -7
  184. package/lib/host-packages/openai/openplanr/skills/cpo-review/openplanr.skill.json +4 -4
  185. package/lib/host-packages/openai/openplanr/skills/cpo-review/references/note-checklist.md +131 -0
  186. package/lib/host-packages/openai/openplanr/skills/cpo-review/references/operate-advisor-contract.md +2 -7
  187. package/lib/host-packages/openai/openplanr/skills/cto-review/openplanr.skill.json +4 -4
  188. package/lib/host-packages/openai/openplanr/skills/cto-review/references/note-checklist.md +131 -0
  189. package/lib/host-packages/openai/openplanr/skills/cto-review/references/operate-advisor-contract.md +2 -7
  190. package/lib/host-packages/openai/openplanr/skills/design/SKILL.md +23 -12
  191. package/lib/host-packages/openai/openplanr/skills/design/openplanr.skill.json +0 -11
  192. package/lib/host-packages/openai/openplanr/skills/design/references/design-system.md +2 -2
  193. package/lib/host-packages/openai/openplanr/skills/design/references/generation.md +3 -3
  194. package/lib/host-packages/openai/openplanr/skills/design/references/hosted-canvas.md +6 -3
  195. package/lib/host-packages/openai/openplanr/skills/design/references/review.md +6 -6
  196. package/lib/host-packages/openai/openplanr/skills/design/references/team-review.md +3 -4
  197. package/lib/host-packages/openai/openplanr/skills/design/references/utilities.md +78 -38
  198. package/lib/host-packages/openai/openplanr/skills/design-loop/SKILL.md +15 -7
  199. package/lib/host-packages/openai/openplanr/skills/design-loop/openplanr.skill.json +0 -11
  200. package/lib/host-packages/openai/openplanr/skills/design-loop/references/design-system.md +2 -2
  201. package/lib/host-packages/openai/openplanr/skills/design-loop/references/generation.md +3 -3
  202. package/lib/host-packages/openai/openplanr/skills/design-loop/references/review.md +6 -6
  203. package/lib/host-packages/openai/openplanr/skills/design-loop/references/team-review.md +3 -4
  204. package/lib/host-packages/openai/openplanr/skills/design-loop/references/utilities.md +78 -38
  205. package/lib/host-packages/openai/openplanr/skills/design-review/SKILL.md +25 -5
  206. package/lib/host-packages/openai/openplanr/skills/design-review/openplanr.skill.json +0 -11
  207. package/lib/host-packages/openai/openplanr/skills/design-review/references/design-system.md +2 -2
  208. package/lib/host-packages/openai/openplanr/skills/design-review/references/generation.md +3 -3
  209. package/lib/host-packages/openai/openplanr/skills/design-review/references/review.md +6 -6
  210. package/lib/host-packages/openai/openplanr/skills/design-review/references/team-review.md +3 -4
  211. package/lib/host-packages/openai/openplanr/skills/design-review/references/utilities.md +78 -38
  212. package/lib/host-packages/openai/openplanr/skills/investigate/SKILL.md +2 -3
  213. package/lib/host-packages/openai/openplanr/skills/investigate/openplanr.skill.json +4 -4
  214. package/lib/host-packages/openai/openplanr/skills/investigate/references/backlog-filing.md +102 -0
  215. package/lib/host-packages/openai/openplanr/skills/investigate/references/findings.md +8 -16
  216. package/lib/host-packages/openai/openplanr/skills/operate/SKILL.md +73 -84
  217. package/lib/host-packages/openai/openplanr/skills/operate/openplanr.skill.json +15 -4
  218. package/lib/host-packages/openai/openplanr/skills/operate/references/note-checklist.md +131 -0
  219. package/lib/host-packages/openai/openplanr/skills/operate/references/return-contract.md +10 -0
  220. package/lib/host-packages/openai/openplanr/skills/plan/SKILL.md +23 -20
  221. package/lib/host-packages/openai/openplanr/skills/plan/openplanr.skill.json +8 -8
  222. package/lib/host-packages/openai/openplanr/skills/plan/references/planning-ids.md +53 -0
  223. package/lib/host-packages/openai/openplanr/skills/plan/references/return-contract.md +10 -0
  224. package/lib/host-packages/openai/openplanr/skills/plan-review/SKILL.md +6 -6
  225. package/lib/host-packages/openai/openplanr/skills/plan-review/openplanr.skill.json +12 -1
  226. package/lib/host-packages/openai/openplanr/skills/plan-review/references/return-contract.md +10 -0
  227. package/lib/host-packages/openai/openplanr/skills/release/SKILL.md +40 -139
  228. package/lib/host-packages/openai/openplanr/skills/release/openplanr.skill.json +4 -4
  229. package/lib/host-packages/openai/openplanr/skills/release/references/cadence.md +10 -0
  230. package/lib/host-packages/openai/openplanr/skills/release/references/release-notes.md +1 -1
  231. package/lib/host-packages/openai/openplanr/skills/release/references/return-contract.md +10 -0
  232. package/lib/host-packages/openai/openplanr/skills/release/references/schemes.md +4 -2
  233. package/lib/host-packages/openai/openplanr/skills/ship/SKILL.md +37 -24
  234. package/lib/host-packages/openai/openplanr/skills/ship/openplanr.skill.json +9 -9
  235. package/lib/host-packages/openai/openplanr/skills/ship/references/backlog-filing.md +102 -0
  236. package/lib/host-packages/openai/openplanr/skills/ship/references/findings.md +8 -16
  237. package/lib/host-packages/openai/openplanr/skills/ship/references/return-contract.md +10 -0
  238. package/lib/host-packages/openai/openplanr/skills/spec/SKILL.md +9 -9
  239. package/lib/host-packages/openai/openplanr/skills/spec/openplanr.skill.json +12 -1
  240. package/lib/host-packages/openai/openplanr/skills/spec/references/return-contract.md +10 -0
  241. package/package.json +2 -2
  242. package/lib/host-packages/claude/openplanr/.claude-plugin/icon.svg +0 -11
  243. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1772
  244. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  245. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  246. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +0 -2370
  247. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  248. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  249. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  250. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review-state-store.mjs +0 -45
  251. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +0 -3376
  252. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -38
  253. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  254. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +0 -321
  255. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +0 -1652
  256. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs +0 -1037
  257. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +0 -137
  258. package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +0 -1500
  259. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2023
  260. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  261. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  262. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -814
  263. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -10
  264. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +0 -2568
  265. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -60
  266. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  267. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  268. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  269. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  270. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -139
  271. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  272. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  273. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  274. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  275. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  276. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  277. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  278. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  279. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  280. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  281. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  282. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  283. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  284. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  285. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  286. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  287. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  288. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  289. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  290. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  291. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  292. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  293. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  294. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -163
  295. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  296. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  297. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  298. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  299. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  300. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  301. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  302. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  303. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  304. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  305. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  306. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  307. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  308. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  309. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  310. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  311. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  312. package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  313. package/lib/host-packages/claude/openplanr/runtime/operate/scripts/errors.mjs +0 -8
  314. package/lib/host-packages/claude/openplanr/runtime/operate/scripts/operate-review-contract.mjs +0 -428
  315. package/lib/host-packages/claude/openplanr/runtime/operate/scripts/operate-review-note.mjs +0 -686
  316. package/lib/host-packages/claude/openplanr/runtime/operate/scripts/validate-note.mjs +0 -39
  317. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -1232
  318. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +0 -2611
  319. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  320. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -163
  321. package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  322. package/lib/host-packages/claude/openplanr/skills/ceo-review/scripts/validate-note.mjs +0 -12
  323. package/lib/host-packages/claude/openplanr/skills/chair-review/scripts/validate-note.mjs +0 -12
  324. package/lib/host-packages/claude/openplanr/skills/challenger-review/scripts/validate-note.mjs +0 -12
  325. package/lib/host-packages/claude/openplanr/skills/cmo-review/scripts/validate-note.mjs +0 -12
  326. package/lib/host-packages/claude/openplanr/skills/coo-review/scripts/validate-note.mjs +0 -12
  327. package/lib/host-packages/claude/openplanr/skills/cpo-review/scripts/validate-note.mjs +0 -12
  328. package/lib/host-packages/claude/openplanr/skills/cto-review/scripts/validate-note.mjs +0 -12
  329. package/lib/host-packages/claude/openplanr/skills/design/scripts/design.mjs +0 -12
  330. package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/design.mjs +0 -12
  331. package/lib/host-packages/claude/openplanr/skills/design-review/scripts/design.mjs +0 -12
  332. package/lib/host-packages/claude/openplanr/skills/investigate/scripts/backlog-item.mjs +0 -339
  333. package/lib/host-packages/claude/openplanr/skills/operate/scripts/validate-note.mjs +0 -12
  334. package/lib/host-packages/claude/openplanr/skills/plan/scripts/design.mjs +0 -12
  335. package/lib/host-packages/claude/openplanr/skills/plan/scripts/planning-ids.mjs +0 -166
  336. package/lib/host-packages/claude/openplanr/skills/release/scripts/collect_changes.sh +0 -85
  337. package/lib/host-packages/claude/openplanr/skills/ship/scripts/backlog-item.mjs +0 -339
  338. package/lib/host-packages/claude/openplanr/skills/ship/scripts/discover-verification.mjs +0 -108
  339. package/lib/host-packages/cursor/openplanr/rules/planr-ceo-review/scripts/validate-note.mjs +0 -12
  340. package/lib/host-packages/cursor/openplanr/rules/planr-chair-review/scripts/validate-note.mjs +0 -12
  341. package/lib/host-packages/cursor/openplanr/rules/planr-challenger-review/scripts/validate-note.mjs +0 -12
  342. package/lib/host-packages/cursor/openplanr/rules/planr-cmo-review/scripts/validate-note.mjs +0 -12
  343. package/lib/host-packages/cursor/openplanr/rules/planr-coo-review/scripts/validate-note.mjs +0 -12
  344. package/lib/host-packages/cursor/openplanr/rules/planr-cpo-review/scripts/validate-note.mjs +0 -12
  345. package/lib/host-packages/cursor/openplanr/rules/planr-cto-review/scripts/validate-note.mjs +0 -12
  346. package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/design.mjs +0 -12
  347. package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/design.mjs +0 -12
  348. package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/design.mjs +0 -12
  349. package/lib/host-packages/cursor/openplanr/rules/planr-investigate/scripts/backlog-item.mjs +0 -339
  350. package/lib/host-packages/cursor/openplanr/rules/planr-operate/scripts/validate-note.mjs +0 -12
  351. package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/design.mjs +0 -12
  352. package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/planning-ids.mjs +0 -166
  353. package/lib/host-packages/cursor/openplanr/rules/planr-release/scripts/collect_changes.sh +0 -85
  354. package/lib/host-packages/cursor/openplanr/rules/planr-ship/scripts/backlog-item.mjs +0 -339
  355. package/lib/host-packages/cursor/openplanr/rules/planr-ship/scripts/discover-verification.mjs +0 -108
  356. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1772
  357. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  358. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  359. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +0 -2370
  360. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  361. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  362. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  363. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review-state-store.mjs +0 -45
  364. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +0 -3376
  365. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -38
  366. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  367. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +0 -321
  368. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +0 -1652
  369. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs +0 -1037
  370. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +0 -137
  371. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +0 -1500
  372. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2023
  373. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  374. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  375. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -814
  376. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -10
  377. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +0 -2568
  378. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -60
  379. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  380. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  381. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  382. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  383. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -139
  384. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  385. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  386. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  387. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  388. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  389. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  390. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  391. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  392. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  393. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  394. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  395. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  396. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  397. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  398. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  399. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  400. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  401. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  402. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  403. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  404. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  405. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  406. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  407. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -163
  408. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  409. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  410. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  411. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  412. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  413. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  414. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  415. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  416. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  417. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  418. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  419. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  420. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  421. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  422. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  423. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  424. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  425. package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  426. package/lib/host-packages/cursor/openplanr/runtime/operate/scripts/errors.mjs +0 -8
  427. package/lib/host-packages/cursor/openplanr/runtime/operate/scripts/operate-review-contract.mjs +0 -428
  428. package/lib/host-packages/cursor/openplanr/runtime/operate/scripts/operate-review-note.mjs +0 -686
  429. package/lib/host-packages/cursor/openplanr/runtime/operate/scripts/validate-note.mjs +0 -39
  430. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -1232
  431. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +0 -2611
  432. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  433. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -163
  434. package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  435. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +0 -1772
  436. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +0 -2937
  437. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-entities.mjs +0 -439
  438. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +0 -2370
  439. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-loopback-server.mjs +0 -359
  440. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-parser.mjs +0 -3970
  441. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-parse5-tokenizer.mjs +0 -3501
  442. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review-state-store.mjs +0 -45
  443. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +0 -3376
  444. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +0 -38
  445. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-sandbox-guards.mjs +0 -1102
  446. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share-cli-bridge.mjs +0 -321
  447. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-d707e49b.mjs +0 -1652
  448. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-9f6918b0.mjs +0 -1037
  449. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-design-support-0bac378d.mjs +0 -137
  450. package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +0 -1500
  451. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -2023
  452. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/lib/artifact/ui/studio-shell.css +0 -2
  453. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +0 -18
  454. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +0 -814
  455. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +0 -10
  456. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-artifact-review-ui.js +0 -2568
  457. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +0 -60
  458. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +0 -65
  459. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/enhancements.css +0 -388
  460. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +0 -81
  461. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.css +0 -1
  462. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/share.js +0 -139
  463. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.css +0 -1159
  464. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +0 -30
  465. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +0 -900
  466. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +0 -2261
  467. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +0 -1595
  468. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +0 -1467
  469. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +0 -1860
  470. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +0 -914
  471. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +0 -2578
  472. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +0 -582
  473. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +0 -17
  474. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +0 -12
  475. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-protocol-contracts.js +0 -285
  476. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-design-review-experience.js +0 -2773
  477. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-studio-shell.js +0 -134
  478. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-canvas-engine.js +0 -2207
  479. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-design-review-experience.js +0 -16
  480. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-studio-shell.js +0 -8
  481. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/18-interface-primitives.js +0 -3883
  482. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/19-interface-primitives.js +0 -966
  483. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/20-studio-shell.js +0 -520
  484. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/21-design-studio.js +0 -1597
  485. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +0 -311
  486. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +0 -163
  487. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/registries/artifact-theme.json +0 -64
  488. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.0.0/design-manifest.schema.json +0 -90
  489. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-envelope.schema.json +0 -142
  490. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  491. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-bundle.schema.json +0 -584
  492. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-context.schema.json +0 -191
  493. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-handoff.schema.json +0 -407
  494. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.10.0/design-review-metadata-payload.schema.json +0 -106
  495. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-handoff-readiness.schema.json +0 -398
  496. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-implementation-handoff.schema.json +0 -518
  497. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-planning-lineage.schema.json +0 -106
  498. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.11.0/design-review-metadata-payload.schema.json +0 -107
  499. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.14.0/artifact-theme.schema.json +0 -316
  500. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/artifact-envelope.schema.json +0 -408
  501. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.16.0/design-review-bundle.schema.json +0 -590
  502. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-document.schema.json +0 -506
  503. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.22.0/design-review-bundle.schema.json +0 -822
  504. package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/schemas/v1.9.0/design-review-bundle.schema.json +0 -346
  505. package/lib/host-packages/openai/openplanr/runtime/operate/scripts/errors.mjs +0 -8
  506. package/lib/host-packages/openai/openplanr/runtime/operate/scripts/operate-review-contract.mjs +0 -428
  507. package/lib/host-packages/openai/openplanr/runtime/operate/scripts/operate-review-note.mjs +0 -686
  508. package/lib/host-packages/openai/openplanr/runtime/operate/scripts/validate-note.mjs +0 -39
  509. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +0 -1232
  510. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +0 -2611
  511. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/notices/THIRD_PARTY_NOTICES.txt +0 -21
  512. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +0 -163
  513. package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/schemas/v1.1.0/artifact-review.schema.json +0 -97
  514. package/lib/host-packages/openai/openplanr/skills/ceo-review/scripts/validate-note.mjs +0 -12
  515. package/lib/host-packages/openai/openplanr/skills/chair-review/scripts/validate-note.mjs +0 -12
  516. package/lib/host-packages/openai/openplanr/skills/challenger-review/scripts/validate-note.mjs +0 -12
  517. package/lib/host-packages/openai/openplanr/skills/cmo-review/scripts/validate-note.mjs +0 -12
  518. package/lib/host-packages/openai/openplanr/skills/coo-review/scripts/validate-note.mjs +0 -12
  519. package/lib/host-packages/openai/openplanr/skills/cpo-review/scripts/validate-note.mjs +0 -12
  520. package/lib/host-packages/openai/openplanr/skills/cto-review/scripts/validate-note.mjs +0 -12
  521. package/lib/host-packages/openai/openplanr/skills/design/scripts/design.mjs +0 -12
  522. package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/design.mjs +0 -12
  523. package/lib/host-packages/openai/openplanr/skills/design-review/scripts/design.mjs +0 -12
  524. package/lib/host-packages/openai/openplanr/skills/investigate/scripts/backlog-item.mjs +0 -339
  525. package/lib/host-packages/openai/openplanr/skills/operate/scripts/validate-note.mjs +0 -12
  526. package/lib/host-packages/openai/openplanr/skills/plan/scripts/design.mjs +0 -12
  527. package/lib/host-packages/openai/openplanr/skills/plan/scripts/planning-ids.mjs +0 -166
  528. package/lib/host-packages/openai/openplanr/skills/release/scripts/collect_changes.sh +0 -85
  529. package/lib/host-packages/openai/openplanr/skills/ship/scripts/backlog-item.mjs +0 -339
  530. package/lib/host-packages/openai/openplanr/skills/ship/scripts/discover-verification.mjs +0 -108
@@ -1,3970 +0,0 @@
1
- import {
2
- ATTRS,
3
- CODE_POINTS,
4
- DOCUMENT_MODE,
5
- ERR,
6
- NS,
7
- NUMBERED_HEADERS,
8
- REPLACEMENT_CHARACTER,
9
- SPECIAL_ELEMENTS,
10
- TAG_ID,
11
- TAG_NAMES,
12
- TokenType,
13
- Tokenizer,
14
- TokenizerMode,
15
- getTagID,
16
- getTokenAttr
17
- } from "./design-parse5-tokenizer.mjs";
18
-
19
- // node_modules/parse5/dist/parser/open-element-stack.js
20
- var IMPLICIT_END_TAG_REQUIRED = /* @__PURE__ */ new Set([TAG_ID.DD, TAG_ID.DT, TAG_ID.LI, TAG_ID.OPTGROUP, TAG_ID.OPTION, TAG_ID.P, TAG_ID.RB, TAG_ID.RP, TAG_ID.RT, TAG_ID.RTC]);
21
- var IMPLICIT_END_TAG_REQUIRED_THOROUGHLY = /* @__PURE__ */ new Set([
22
- ...IMPLICIT_END_TAG_REQUIRED,
23
- TAG_ID.CAPTION,
24
- TAG_ID.COLGROUP,
25
- TAG_ID.TBODY,
26
- TAG_ID.TD,
27
- TAG_ID.TFOOT,
28
- TAG_ID.TH,
29
- TAG_ID.THEAD,
30
- TAG_ID.TR
31
- ]);
32
- var SCOPING_ELEMENTS_HTML = /* @__PURE__ */ new Set([
33
- TAG_ID.APPLET,
34
- TAG_ID.CAPTION,
35
- TAG_ID.HTML,
36
- TAG_ID.MARQUEE,
37
- TAG_ID.OBJECT,
38
- TAG_ID.TABLE,
39
- TAG_ID.TD,
40
- TAG_ID.TEMPLATE,
41
- TAG_ID.TH
42
- ]);
43
- var SCOPING_ELEMENTS_HTML_LIST = /* @__PURE__ */ new Set([...SCOPING_ELEMENTS_HTML, TAG_ID.OL, TAG_ID.UL]);
44
- var SCOPING_ELEMENTS_HTML_BUTTON = /* @__PURE__ */ new Set([...SCOPING_ELEMENTS_HTML, TAG_ID.BUTTON]);
45
- var SCOPING_ELEMENTS_MATHML = /* @__PURE__ */ new Set([TAG_ID.ANNOTATION_XML, TAG_ID.MI, TAG_ID.MN, TAG_ID.MO, TAG_ID.MS, TAG_ID.MTEXT]);
46
- var SCOPING_ELEMENTS_SVG = /* @__PURE__ */ new Set([TAG_ID.DESC, TAG_ID.FOREIGN_OBJECT, TAG_ID.TITLE]);
47
- var TABLE_ROW_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TR, TAG_ID.TEMPLATE, TAG_ID.HTML]);
48
- var TABLE_BODY_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TBODY, TAG_ID.TFOOT, TAG_ID.THEAD, TAG_ID.TEMPLATE, TAG_ID.HTML]);
49
- var TABLE_CONTEXT = /* @__PURE__ */ new Set([TAG_ID.TABLE, TAG_ID.TEMPLATE, TAG_ID.HTML]);
50
- var TABLE_CELLS = /* @__PURE__ */ new Set([TAG_ID.TD, TAG_ID.TH]);
51
- var OpenElementStack = class {
52
- get currentTmplContentOrNode() {
53
- return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
54
- }
55
- constructor(document, treeAdapter, handler) {
56
- this.treeAdapter = treeAdapter;
57
- this.handler = handler;
58
- this.items = [];
59
- this.tagIDs = [];
60
- this.stackTop = -1;
61
- this.tmplCount = 0;
62
- this.currentTagId = TAG_ID.UNKNOWN;
63
- this.current = document;
64
- }
65
- //Index of element
66
- _indexOf(element) {
67
- return this.items.lastIndexOf(element, this.stackTop);
68
- }
69
- //Update current element
70
- _isInTemplate() {
71
- return this.currentTagId === TAG_ID.TEMPLATE && this.treeAdapter.getNamespaceURI(this.current) === NS.HTML;
72
- }
73
- _updateCurrentElement() {
74
- this.current = this.items[this.stackTop];
75
- this.currentTagId = this.tagIDs[this.stackTop];
76
- }
77
- //Mutations
78
- push(element, tagID) {
79
- this.stackTop++;
80
- this.items[this.stackTop] = element;
81
- this.current = element;
82
- this.tagIDs[this.stackTop] = tagID;
83
- this.currentTagId = tagID;
84
- if (this._isInTemplate()) {
85
- this.tmplCount++;
86
- }
87
- this.handler.onItemPush(element, tagID, true);
88
- }
89
- pop() {
90
- const popped = this.current;
91
- if (this.tmplCount > 0 && this._isInTemplate()) {
92
- this.tmplCount--;
93
- }
94
- this.stackTop--;
95
- this._updateCurrentElement();
96
- this.handler.onItemPop(popped, true);
97
- }
98
- replace(oldElement, newElement) {
99
- const idx = this._indexOf(oldElement);
100
- this.items[idx] = newElement;
101
- if (idx === this.stackTop) {
102
- this.current = newElement;
103
- }
104
- }
105
- insertAfter(referenceElement, newElement, newElementID) {
106
- const insertionIdx = this._indexOf(referenceElement) + 1;
107
- this.items.splice(insertionIdx, 0, newElement);
108
- this.tagIDs.splice(insertionIdx, 0, newElementID);
109
- this.stackTop++;
110
- if (insertionIdx === this.stackTop) {
111
- this._updateCurrentElement();
112
- }
113
- if (this.current && this.currentTagId !== void 0) {
114
- this.handler.onItemPush(this.current, this.currentTagId, insertionIdx === this.stackTop);
115
- }
116
- }
117
- popUntilTagNamePopped(tagName) {
118
- let targetIdx = this.stackTop + 1;
119
- do {
120
- targetIdx = this.tagIDs.lastIndexOf(tagName, targetIdx - 1);
121
- } while (targetIdx > 0 && this.treeAdapter.getNamespaceURI(this.items[targetIdx]) !== NS.HTML);
122
- this.shortenToLength(Math.max(targetIdx, 0));
123
- }
124
- shortenToLength(idx) {
125
- while (this.stackTop >= idx) {
126
- const popped = this.current;
127
- if (this.tmplCount > 0 && this._isInTemplate()) {
128
- this.tmplCount -= 1;
129
- }
130
- this.stackTop--;
131
- this._updateCurrentElement();
132
- this.handler.onItemPop(popped, this.stackTop < idx);
133
- }
134
- }
135
- popUntilElementPopped(element) {
136
- const idx = this._indexOf(element);
137
- this.shortenToLength(Math.max(idx, 0));
138
- }
139
- popUntilPopped(tagNames, targetNS) {
140
- const idx = this._indexOfTagNames(tagNames, targetNS);
141
- this.shortenToLength(Math.max(idx, 0));
142
- }
143
- popUntilNumberedHeaderPopped() {
144
- this.popUntilPopped(NUMBERED_HEADERS, NS.HTML);
145
- }
146
- popUntilTableCellPopped() {
147
- this.popUntilPopped(TABLE_CELLS, NS.HTML);
148
- }
149
- popAllUpToHtmlElement() {
150
- this.tmplCount = 0;
151
- this.shortenToLength(1);
152
- }
153
- _indexOfTagNames(tagNames, namespace) {
154
- for (let i = this.stackTop; i >= 0; i--) {
155
- if (tagNames.has(this.tagIDs[i]) && this.treeAdapter.getNamespaceURI(this.items[i]) === namespace) {
156
- return i;
157
- }
158
- }
159
- return -1;
160
- }
161
- clearBackTo(tagNames, targetNS) {
162
- const idx = this._indexOfTagNames(tagNames, targetNS);
163
- this.shortenToLength(idx + 1);
164
- }
165
- clearBackToTableContext() {
166
- this.clearBackTo(TABLE_CONTEXT, NS.HTML);
167
- }
168
- clearBackToTableBodyContext() {
169
- this.clearBackTo(TABLE_BODY_CONTEXT, NS.HTML);
170
- }
171
- clearBackToTableRowContext() {
172
- this.clearBackTo(TABLE_ROW_CONTEXT, NS.HTML);
173
- }
174
- remove(element) {
175
- const idx = this._indexOf(element);
176
- if (idx >= 0) {
177
- if (idx === this.stackTop) {
178
- this.pop();
179
- } else {
180
- this.items.splice(idx, 1);
181
- this.tagIDs.splice(idx, 1);
182
- this.stackTop--;
183
- this._updateCurrentElement();
184
- this.handler.onItemPop(element, false);
185
- }
186
- }
187
- }
188
- //Search
189
- tryPeekProperlyNestedBodyElement() {
190
- return this.stackTop >= 1 && this.tagIDs[1] === TAG_ID.BODY ? this.items[1] : null;
191
- }
192
- contains(element) {
193
- return this._indexOf(element) > -1;
194
- }
195
- getCommonAncestor(element) {
196
- const elementIdx = this._indexOf(element) - 1;
197
- return elementIdx >= 0 ? this.items[elementIdx] : null;
198
- }
199
- isRootHtmlElementCurrent() {
200
- return this.stackTop === 0 && this.tagIDs[0] === TAG_ID.HTML;
201
- }
202
- //Element in scope
203
- hasInDynamicScope(tagName, htmlScope) {
204
- for (let i = this.stackTop; i >= 0; i--) {
205
- const tn = this.tagIDs[i];
206
- switch (this.treeAdapter.getNamespaceURI(this.items[i])) {
207
- case NS.HTML: {
208
- if (tn === tagName)
209
- return true;
210
- if (htmlScope.has(tn))
211
- return false;
212
- break;
213
- }
214
- case NS.SVG: {
215
- if (SCOPING_ELEMENTS_SVG.has(tn))
216
- return false;
217
- break;
218
- }
219
- case NS.MATHML: {
220
- if (SCOPING_ELEMENTS_MATHML.has(tn))
221
- return false;
222
- break;
223
- }
224
- }
225
- }
226
- return true;
227
- }
228
- hasInScope(tagName) {
229
- return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML);
230
- }
231
- hasInListItemScope(tagName) {
232
- return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML_LIST);
233
- }
234
- hasInButtonScope(tagName) {
235
- return this.hasInDynamicScope(tagName, SCOPING_ELEMENTS_HTML_BUTTON);
236
- }
237
- hasNumberedHeaderInScope() {
238
- for (let i = this.stackTop; i >= 0; i--) {
239
- const tn = this.tagIDs[i];
240
- switch (this.treeAdapter.getNamespaceURI(this.items[i])) {
241
- case NS.HTML: {
242
- if (NUMBERED_HEADERS.has(tn))
243
- return true;
244
- if (SCOPING_ELEMENTS_HTML.has(tn))
245
- return false;
246
- break;
247
- }
248
- case NS.SVG: {
249
- if (SCOPING_ELEMENTS_SVG.has(tn))
250
- return false;
251
- break;
252
- }
253
- case NS.MATHML: {
254
- if (SCOPING_ELEMENTS_MATHML.has(tn))
255
- return false;
256
- break;
257
- }
258
- }
259
- }
260
- return true;
261
- }
262
- hasInTableScope(tagName) {
263
- for (let i = this.stackTop; i >= 0; i--) {
264
- if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {
265
- continue;
266
- }
267
- switch (this.tagIDs[i]) {
268
- case tagName: {
269
- return true;
270
- }
271
- case TAG_ID.TABLE:
272
- case TAG_ID.HTML: {
273
- return false;
274
- }
275
- }
276
- }
277
- return true;
278
- }
279
- hasTableBodyContextInTableScope() {
280
- for (let i = this.stackTop; i >= 0; i--) {
281
- if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {
282
- continue;
283
- }
284
- switch (this.tagIDs[i]) {
285
- case TAG_ID.TBODY:
286
- case TAG_ID.THEAD:
287
- case TAG_ID.TFOOT: {
288
- return true;
289
- }
290
- case TAG_ID.TABLE:
291
- case TAG_ID.HTML: {
292
- return false;
293
- }
294
- }
295
- }
296
- return true;
297
- }
298
- hasInSelectScope(tagName) {
299
- for (let i = this.stackTop; i >= 0; i--) {
300
- if (this.treeAdapter.getNamespaceURI(this.items[i]) !== NS.HTML) {
301
- continue;
302
- }
303
- switch (this.tagIDs[i]) {
304
- case tagName: {
305
- return true;
306
- }
307
- case TAG_ID.OPTION:
308
- case TAG_ID.OPTGROUP: {
309
- break;
310
- }
311
- default: {
312
- return false;
313
- }
314
- }
315
- }
316
- return true;
317
- }
318
- //Implied end tags
319
- generateImpliedEndTags() {
320
- while (this.currentTagId !== void 0 && IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId)) {
321
- this.pop();
322
- }
323
- }
324
- generateImpliedEndTagsThoroughly() {
325
- while (this.currentTagId !== void 0 && IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
326
- this.pop();
327
- }
328
- }
329
- generateImpliedEndTagsWithExclusion(exclusionId) {
330
- while (this.currentTagId !== void 0 && this.currentTagId !== exclusionId && IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
331
- this.pop();
332
- }
333
- }
334
- };
335
-
336
- // node_modules/parse5/dist/parser/formatting-element-list.js
337
- var NOAH_ARK_CAPACITY = 3;
338
- var EntryType;
339
- (function(EntryType2) {
340
- EntryType2[EntryType2["Marker"] = 0] = "Marker";
341
- EntryType2[EntryType2["Element"] = 1] = "Element";
342
- })(EntryType || (EntryType = {}));
343
- var MARKER = { type: EntryType.Marker };
344
- var FormattingElementList = class {
345
- constructor(treeAdapter) {
346
- this.treeAdapter = treeAdapter;
347
- this.entries = [];
348
- this.bookmark = null;
349
- }
350
- //Noah Ark's condition
351
- //OPTIMIZATION: at first we try to find possible candidates for exclusion using
352
- //lightweight heuristics without thorough attributes check.
353
- _getNoahArkConditionCandidates(newElement, neAttrs) {
354
- const candidates = [];
355
- const neAttrsLength = neAttrs.length;
356
- const neTagName = this.treeAdapter.getTagName(newElement);
357
- const neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement);
358
- for (let i = 0; i < this.entries.length; i++) {
359
- const entry = this.entries[i];
360
- if (entry.type === EntryType.Marker) {
361
- break;
362
- }
363
- const { element } = entry;
364
- if (this.treeAdapter.getTagName(element) === neTagName && this.treeAdapter.getNamespaceURI(element) === neNamespaceURI) {
365
- const elementAttrs = this.treeAdapter.getAttrList(element);
366
- if (elementAttrs.length === neAttrsLength) {
367
- candidates.push({ idx: i, attrs: elementAttrs });
368
- }
369
- }
370
- }
371
- return candidates;
372
- }
373
- _ensureNoahArkCondition(newElement) {
374
- if (this.entries.length < NOAH_ARK_CAPACITY)
375
- return;
376
- const neAttrs = this.treeAdapter.getAttrList(newElement);
377
- const candidates = this._getNoahArkConditionCandidates(newElement, neAttrs);
378
- if (candidates.length < NOAH_ARK_CAPACITY)
379
- return;
380
- const neAttrsMap = new Map(neAttrs.map((neAttr) => [neAttr.name, neAttr.value]));
381
- let validCandidates = 0;
382
- for (let i = 0; i < candidates.length; i++) {
383
- const candidate = candidates[i];
384
- if (candidate.attrs.every((cAttr) => neAttrsMap.get(cAttr.name) === cAttr.value)) {
385
- validCandidates += 1;
386
- if (validCandidates >= NOAH_ARK_CAPACITY) {
387
- this.entries.splice(candidate.idx, 1);
388
- }
389
- }
390
- }
391
- }
392
- //Mutations
393
- insertMarker() {
394
- this.entries.unshift(MARKER);
395
- }
396
- pushElement(element, token) {
397
- this._ensureNoahArkCondition(element);
398
- this.entries.unshift({
399
- type: EntryType.Element,
400
- element,
401
- token
402
- });
403
- }
404
- insertElementAfterBookmark(element, token) {
405
- const bookmarkIdx = this.entries.indexOf(this.bookmark);
406
- this.entries.splice(bookmarkIdx, 0, {
407
- type: EntryType.Element,
408
- element,
409
- token
410
- });
411
- }
412
- removeEntry(entry) {
413
- const entryIndex = this.entries.indexOf(entry);
414
- if (entryIndex !== -1) {
415
- this.entries.splice(entryIndex, 1);
416
- }
417
- }
418
- /**
419
- * Clears the list of formatting elements up to the last marker.
420
- *
421
- * @see https://html.spec.whatwg.org/multipage/parsing.html#clear-the-list-of-active-formatting-elements-up-to-the-last-marker
422
- */
423
- clearToLastMarker() {
424
- const markerIdx = this.entries.indexOf(MARKER);
425
- if (markerIdx === -1) {
426
- this.entries.length = 0;
427
- } else {
428
- this.entries.splice(0, markerIdx + 1);
429
- }
430
- }
431
- //Search
432
- getElementEntryInScopeWithTagName(tagName) {
433
- const entry = this.entries.find((entry2) => entry2.type === EntryType.Marker || this.treeAdapter.getTagName(entry2.element) === tagName);
434
- return entry && entry.type === EntryType.Element ? entry : null;
435
- }
436
- getElementEntry(element) {
437
- return this.entries.find((entry) => entry.type === EntryType.Element && entry.element === element);
438
- }
439
- };
440
-
441
- // node_modules/parse5/dist/tree-adapters/default.js
442
- var defaultTreeAdapter = {
443
- //Node construction
444
- createDocument() {
445
- return {
446
- nodeName: "#document",
447
- mode: DOCUMENT_MODE.NO_QUIRKS,
448
- childNodes: []
449
- };
450
- },
451
- createDocumentFragment() {
452
- return {
453
- nodeName: "#document-fragment",
454
- childNodes: []
455
- };
456
- },
457
- createElement(tagName, namespaceURI, attrs) {
458
- return {
459
- nodeName: tagName,
460
- tagName,
461
- attrs,
462
- namespaceURI,
463
- childNodes: [],
464
- parentNode: null
465
- };
466
- },
467
- createCommentNode(data) {
468
- return {
469
- nodeName: "#comment",
470
- data,
471
- parentNode: null
472
- };
473
- },
474
- createTextNode(value) {
475
- return {
476
- nodeName: "#text",
477
- value,
478
- parentNode: null
479
- };
480
- },
481
- //Tree mutation
482
- appendChild(parentNode, newNode) {
483
- parentNode.childNodes.push(newNode);
484
- newNode.parentNode = parentNode;
485
- },
486
- insertBefore(parentNode, newNode, referenceNode) {
487
- const insertionIdx = parentNode.childNodes.indexOf(referenceNode);
488
- parentNode.childNodes.splice(insertionIdx, 0, newNode);
489
- newNode.parentNode = parentNode;
490
- },
491
- setTemplateContent(templateElement, contentElement) {
492
- templateElement.content = contentElement;
493
- },
494
- getTemplateContent(templateElement) {
495
- return templateElement.content;
496
- },
497
- setDocumentType(document, name, publicId, systemId) {
498
- const doctypeNode = document.childNodes.find((node) => node.nodeName === "#documentType");
499
- if (doctypeNode) {
500
- doctypeNode.name = name;
501
- doctypeNode.publicId = publicId;
502
- doctypeNode.systemId = systemId;
503
- } else {
504
- const node = {
505
- nodeName: "#documentType",
506
- name,
507
- publicId,
508
- systemId,
509
- parentNode: null
510
- };
511
- defaultTreeAdapter.appendChild(document, node);
512
- }
513
- },
514
- setDocumentMode(document, mode) {
515
- document.mode = mode;
516
- },
517
- getDocumentMode(document) {
518
- return document.mode;
519
- },
520
- detachNode(node) {
521
- if (node.parentNode) {
522
- const idx = node.parentNode.childNodes.indexOf(node);
523
- node.parentNode.childNodes.splice(idx, 1);
524
- node.parentNode = null;
525
- }
526
- },
527
- insertText(parentNode, text) {
528
- if (parentNode.childNodes.length > 0) {
529
- const prevNode = parentNode.childNodes[parentNode.childNodes.length - 1];
530
- if (defaultTreeAdapter.isTextNode(prevNode)) {
531
- prevNode.value += text;
532
- return;
533
- }
534
- }
535
- defaultTreeAdapter.appendChild(parentNode, defaultTreeAdapter.createTextNode(text));
536
- },
537
- insertTextBefore(parentNode, text, referenceNode) {
538
- const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
539
- if (prevNode && defaultTreeAdapter.isTextNode(prevNode)) {
540
- prevNode.value += text;
541
- } else {
542
- defaultTreeAdapter.insertBefore(parentNode, defaultTreeAdapter.createTextNode(text), referenceNode);
543
- }
544
- },
545
- adoptAttributes(recipient, attrs) {
546
- const recipientAttrsMap = new Set(recipient.attrs.map((attr) => attr.name));
547
- for (let j = 0; j < attrs.length; j++) {
548
- if (!recipientAttrsMap.has(attrs[j].name)) {
549
- recipient.attrs.push(attrs[j]);
550
- }
551
- }
552
- },
553
- //Tree traversing
554
- getFirstChild(node) {
555
- return node.childNodes[0];
556
- },
557
- getChildNodes(node) {
558
- return node.childNodes;
559
- },
560
- getParentNode(node) {
561
- return node.parentNode;
562
- },
563
- getAttrList(element) {
564
- return element.attrs;
565
- },
566
- //Node data
567
- getTagName(element) {
568
- return element.tagName;
569
- },
570
- getNamespaceURI(element) {
571
- return element.namespaceURI;
572
- },
573
- getTextNodeContent(textNode) {
574
- return textNode.value;
575
- },
576
- getCommentNodeContent(commentNode) {
577
- return commentNode.data;
578
- },
579
- getDocumentTypeNodeName(doctypeNode) {
580
- return doctypeNode.name;
581
- },
582
- getDocumentTypeNodePublicId(doctypeNode) {
583
- return doctypeNode.publicId;
584
- },
585
- getDocumentTypeNodeSystemId(doctypeNode) {
586
- return doctypeNode.systemId;
587
- },
588
- //Node types
589
- isTextNode(node) {
590
- return node.nodeName === "#text";
591
- },
592
- isCommentNode(node) {
593
- return node.nodeName === "#comment";
594
- },
595
- isDocumentTypeNode(node) {
596
- return node.nodeName === "#documentType";
597
- },
598
- isElementNode(node) {
599
- return Object.prototype.hasOwnProperty.call(node, "tagName");
600
- },
601
- // Source code location
602
- setNodeSourceCodeLocation(node, location) {
603
- node.sourceCodeLocation = location;
604
- },
605
- getNodeSourceCodeLocation(node) {
606
- return node.sourceCodeLocation;
607
- },
608
- updateNodeSourceCodeLocation(node, endLocation) {
609
- node.sourceCodeLocation = { ...node.sourceCodeLocation, ...endLocation };
610
- }
611
- };
612
-
613
- // node_modules/parse5/dist/common/doctype.js
614
- var VALID_DOCTYPE_NAME = "html";
615
- var VALID_SYSTEM_ID = "about:legacy-compat";
616
- var QUIRKS_MODE_SYSTEM_ID = "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd";
617
- var QUIRKS_MODE_PUBLIC_ID_PREFIXES = [
618
- "+//silmaril//dtd html pro v0r11 19970101//",
619
- "-//as//dtd html 3.0 aswedit + extensions//",
620
- "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
621
- "-//ietf//dtd html 2.0 level 1//",
622
- "-//ietf//dtd html 2.0 level 2//",
623
- "-//ietf//dtd html 2.0 strict level 1//",
624
- "-//ietf//dtd html 2.0 strict level 2//",
625
- "-//ietf//dtd html 2.0 strict//",
626
- "-//ietf//dtd html 2.0//",
627
- "-//ietf//dtd html 2.1e//",
628
- "-//ietf//dtd html 3.0//",
629
- "-//ietf//dtd html 3.2 final//",
630
- "-//ietf//dtd html 3.2//",
631
- "-//ietf//dtd html 3//",
632
- "-//ietf//dtd html level 0//",
633
- "-//ietf//dtd html level 1//",
634
- "-//ietf//dtd html level 2//",
635
- "-//ietf//dtd html level 3//",
636
- "-//ietf//dtd html strict level 0//",
637
- "-//ietf//dtd html strict level 1//",
638
- "-//ietf//dtd html strict level 2//",
639
- "-//ietf//dtd html strict level 3//",
640
- "-//ietf//dtd html strict//",
641
- "-//ietf//dtd html//",
642
- "-//metrius//dtd metrius presentational//",
643
- "-//microsoft//dtd internet explorer 2.0 html strict//",
644
- "-//microsoft//dtd internet explorer 2.0 html//",
645
- "-//microsoft//dtd internet explorer 2.0 tables//",
646
- "-//microsoft//dtd internet explorer 3.0 html strict//",
647
- "-//microsoft//dtd internet explorer 3.0 html//",
648
- "-//microsoft//dtd internet explorer 3.0 tables//",
649
- "-//netscape comm. corp.//dtd html//",
650
- "-//netscape comm. corp.//dtd strict html//",
651
- "-//o'reilly and associates//dtd html 2.0//",
652
- "-//o'reilly and associates//dtd html extended 1.0//",
653
- "-//o'reilly and associates//dtd html extended relaxed 1.0//",
654
- "-//sq//dtd html 2.0 hotmetal + extensions//",
655
- "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//",
656
- "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//",
657
- "-//spyglass//dtd html 2.0 extended//",
658
- "-//sun microsystems corp.//dtd hotjava html//",
659
- "-//sun microsystems corp.//dtd hotjava strict html//",
660
- "-//w3c//dtd html 3 1995-03-24//",
661
- "-//w3c//dtd html 3.2 draft//",
662
- "-//w3c//dtd html 3.2 final//",
663
- "-//w3c//dtd html 3.2//",
664
- "-//w3c//dtd html 3.2s draft//",
665
- "-//w3c//dtd html 4.0 frameset//",
666
- "-//w3c//dtd html 4.0 transitional//",
667
- "-//w3c//dtd html experimental 19960712//",
668
- "-//w3c//dtd html experimental 970421//",
669
- "-//w3c//dtd w3 html//",
670
- "-//w3o//dtd w3 html 3.0//",
671
- "-//webtechs//dtd mozilla html 2.0//",
672
- "-//webtechs//dtd mozilla html//"
673
- ];
674
- var QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = [
675
- ...QUIRKS_MODE_PUBLIC_ID_PREFIXES,
676
- "-//w3c//dtd html 4.01 frameset//",
677
- "-//w3c//dtd html 4.01 transitional//"
678
- ];
679
- var QUIRKS_MODE_PUBLIC_IDS = /* @__PURE__ */ new Set([
680
- "-//w3o//dtd w3 html strict 3.0//en//",
681
- "-/w3c/dtd html 4.0 transitional/en",
682
- "html"
683
- ]);
684
- var LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ["-//w3c//dtd xhtml 1.0 frameset//", "-//w3c//dtd xhtml 1.0 transitional//"];
685
- var LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = [
686
- ...LIMITED_QUIRKS_PUBLIC_ID_PREFIXES,
687
- "-//w3c//dtd html 4.01 frameset//",
688
- "-//w3c//dtd html 4.01 transitional//"
689
- ];
690
- function hasPrefix(publicId, prefixes) {
691
- return prefixes.some((prefix) => publicId.startsWith(prefix));
692
- }
693
- function isConforming(token) {
694
- return token.name === VALID_DOCTYPE_NAME && token.publicId === null && (token.systemId === null || token.systemId === VALID_SYSTEM_ID);
695
- }
696
- function getDocumentMode(token) {
697
- if (token.name !== VALID_DOCTYPE_NAME) {
698
- return DOCUMENT_MODE.QUIRKS;
699
- }
700
- const { systemId } = token;
701
- if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) {
702
- return DOCUMENT_MODE.QUIRKS;
703
- }
704
- let { publicId } = token;
705
- if (publicId !== null) {
706
- publicId = publicId.toLowerCase();
707
- if (QUIRKS_MODE_PUBLIC_IDS.has(publicId)) {
708
- return DOCUMENT_MODE.QUIRKS;
709
- }
710
- let prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES;
711
- if (hasPrefix(publicId, prefixes)) {
712
- return DOCUMENT_MODE.QUIRKS;
713
- }
714
- prefixes = systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES;
715
- if (hasPrefix(publicId, prefixes)) {
716
- return DOCUMENT_MODE.LIMITED_QUIRKS;
717
- }
718
- }
719
- return DOCUMENT_MODE.NO_QUIRKS;
720
- }
721
-
722
- // node_modules/parse5/dist/common/foreign-content.js
723
- var MIME_TYPES = {
724
- TEXT_HTML: "text/html",
725
- APPLICATION_XML: "application/xhtml+xml"
726
- };
727
- var DEFINITION_URL_ATTR = "definitionurl";
728
- var ADJUSTED_DEFINITION_URL_ATTR = "definitionURL";
729
- var SVG_ATTRS_ADJUSTMENT_MAP = new Map([
730
- "attributeName",
731
- "attributeType",
732
- "baseFrequency",
733
- "baseProfile",
734
- "calcMode",
735
- "clipPathUnits",
736
- "diffuseConstant",
737
- "edgeMode",
738
- "filterUnits",
739
- "glyphRef",
740
- "gradientTransform",
741
- "gradientUnits",
742
- "kernelMatrix",
743
- "kernelUnitLength",
744
- "keyPoints",
745
- "keySplines",
746
- "keyTimes",
747
- "lengthAdjust",
748
- "limitingConeAngle",
749
- "markerHeight",
750
- "markerUnits",
751
- "markerWidth",
752
- "maskContentUnits",
753
- "maskUnits",
754
- "numOctaves",
755
- "pathLength",
756
- "patternContentUnits",
757
- "patternTransform",
758
- "patternUnits",
759
- "pointsAtX",
760
- "pointsAtY",
761
- "pointsAtZ",
762
- "preserveAlpha",
763
- "preserveAspectRatio",
764
- "primitiveUnits",
765
- "refX",
766
- "refY",
767
- "repeatCount",
768
- "repeatDur",
769
- "requiredExtensions",
770
- "requiredFeatures",
771
- "specularConstant",
772
- "specularExponent",
773
- "spreadMethod",
774
- "startOffset",
775
- "stdDeviation",
776
- "stitchTiles",
777
- "surfaceScale",
778
- "systemLanguage",
779
- "tableValues",
780
- "targetX",
781
- "targetY",
782
- "textLength",
783
- "viewBox",
784
- "viewTarget",
785
- "xChannelSelector",
786
- "yChannelSelector",
787
- "zoomAndPan"
788
- ].map((attr) => [attr.toLowerCase(), attr]));
789
- var XML_ATTRS_ADJUSTMENT_MAP = /* @__PURE__ */ new Map([
790
- ["xlink:actuate", { prefix: "xlink", name: "actuate", namespace: NS.XLINK }],
791
- ["xlink:arcrole", { prefix: "xlink", name: "arcrole", namespace: NS.XLINK }],
792
- ["xlink:href", { prefix: "xlink", name: "href", namespace: NS.XLINK }],
793
- ["xlink:role", { prefix: "xlink", name: "role", namespace: NS.XLINK }],
794
- ["xlink:show", { prefix: "xlink", name: "show", namespace: NS.XLINK }],
795
- ["xlink:title", { prefix: "xlink", name: "title", namespace: NS.XLINK }],
796
- ["xlink:type", { prefix: "xlink", name: "type", namespace: NS.XLINK }],
797
- ["xml:lang", { prefix: "xml", name: "lang", namespace: NS.XML }],
798
- ["xml:space", { prefix: "xml", name: "space", namespace: NS.XML }],
799
- ["xmlns", { prefix: "", name: "xmlns", namespace: NS.XMLNS }],
800
- ["xmlns:xlink", { prefix: "xmlns", name: "xlink", namespace: NS.XMLNS }]
801
- ]);
802
- var SVG_TAG_NAMES_ADJUSTMENT_MAP = new Map([
803
- "altGlyph",
804
- "altGlyphDef",
805
- "altGlyphItem",
806
- "animateColor",
807
- "animateMotion",
808
- "animateTransform",
809
- "clipPath",
810
- "feBlend",
811
- "feColorMatrix",
812
- "feComponentTransfer",
813
- "feComposite",
814
- "feConvolveMatrix",
815
- "feDiffuseLighting",
816
- "feDisplacementMap",
817
- "feDistantLight",
818
- "feFlood",
819
- "feFuncA",
820
- "feFuncB",
821
- "feFuncG",
822
- "feFuncR",
823
- "feGaussianBlur",
824
- "feImage",
825
- "feMerge",
826
- "feMergeNode",
827
- "feMorphology",
828
- "feOffset",
829
- "fePointLight",
830
- "feSpecularLighting",
831
- "feSpotLight",
832
- "feTile",
833
- "feTurbulence",
834
- "foreignObject",
835
- "glyphRef",
836
- "linearGradient",
837
- "radialGradient",
838
- "textPath"
839
- ].map((tn) => [tn.toLowerCase(), tn]));
840
- var EXITS_FOREIGN_CONTENT = /* @__PURE__ */ new Set([
841
- TAG_ID.B,
842
- TAG_ID.BIG,
843
- TAG_ID.BLOCKQUOTE,
844
- TAG_ID.BODY,
845
- TAG_ID.BR,
846
- TAG_ID.CENTER,
847
- TAG_ID.CODE,
848
- TAG_ID.DD,
849
- TAG_ID.DIV,
850
- TAG_ID.DL,
851
- TAG_ID.DT,
852
- TAG_ID.EM,
853
- TAG_ID.EMBED,
854
- TAG_ID.H1,
855
- TAG_ID.H2,
856
- TAG_ID.H3,
857
- TAG_ID.H4,
858
- TAG_ID.H5,
859
- TAG_ID.H6,
860
- TAG_ID.HEAD,
861
- TAG_ID.HR,
862
- TAG_ID.I,
863
- TAG_ID.IMG,
864
- TAG_ID.LI,
865
- TAG_ID.LISTING,
866
- TAG_ID.MENU,
867
- TAG_ID.META,
868
- TAG_ID.NOBR,
869
- TAG_ID.OL,
870
- TAG_ID.P,
871
- TAG_ID.PRE,
872
- TAG_ID.RUBY,
873
- TAG_ID.S,
874
- TAG_ID.SMALL,
875
- TAG_ID.SPAN,
876
- TAG_ID.STRONG,
877
- TAG_ID.STRIKE,
878
- TAG_ID.SUB,
879
- TAG_ID.SUP,
880
- TAG_ID.TABLE,
881
- TAG_ID.TT,
882
- TAG_ID.U,
883
- TAG_ID.UL,
884
- TAG_ID.VAR
885
- ]);
886
- function causesExit(startTagToken) {
887
- const tn = startTagToken.tagID;
888
- const isFontWithAttrs = tn === TAG_ID.FONT && startTagToken.attrs.some(({ name }) => name === ATTRS.COLOR || name === ATTRS.SIZE || name === ATTRS.FACE);
889
- return isFontWithAttrs || EXITS_FOREIGN_CONTENT.has(tn);
890
- }
891
- function adjustTokenMathMLAttrs(token) {
892
- for (let i = 0; i < token.attrs.length; i++) {
893
- if (token.attrs[i].name === DEFINITION_URL_ATTR) {
894
- token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR;
895
- break;
896
- }
897
- }
898
- }
899
- function adjustTokenSVGAttrs(token) {
900
- for (let i = 0; i < token.attrs.length; i++) {
901
- const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP.get(token.attrs[i].name);
902
- if (adjustedAttrName != null) {
903
- token.attrs[i].name = adjustedAttrName;
904
- }
905
- }
906
- }
907
- function adjustTokenXMLAttrs(token) {
908
- for (let i = 0; i < token.attrs.length; i++) {
909
- const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP.get(token.attrs[i].name);
910
- if (adjustedAttrEntry) {
911
- token.attrs[i].prefix = adjustedAttrEntry.prefix;
912
- token.attrs[i].name = adjustedAttrEntry.name;
913
- token.attrs[i].namespace = adjustedAttrEntry.namespace;
914
- }
915
- }
916
- }
917
- function adjustTokenSVGTagName(token) {
918
- const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP.get(token.tagName);
919
- if (adjustedTagName != null) {
920
- token.tagName = adjustedTagName;
921
- token.tagID = getTagID(token.tagName);
922
- }
923
- }
924
- function isMathMLTextIntegrationPoint(tn, ns) {
925
- return ns === NS.MATHML && (tn === TAG_ID.MI || tn === TAG_ID.MO || tn === TAG_ID.MN || tn === TAG_ID.MS || tn === TAG_ID.MTEXT);
926
- }
927
- function isHtmlIntegrationPoint(tn, ns, attrs) {
928
- if (ns === NS.MATHML && tn === TAG_ID.ANNOTATION_XML) {
929
- for (let i = 0; i < attrs.length; i++) {
930
- if (attrs[i].name === ATTRS.ENCODING) {
931
- const value = attrs[i].value.toLowerCase();
932
- return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML;
933
- }
934
- }
935
- }
936
- return ns === NS.SVG && (tn === TAG_ID.FOREIGN_OBJECT || tn === TAG_ID.DESC || tn === TAG_ID.TITLE);
937
- }
938
- function isIntegrationPoint(tn, ns, attrs, foreignNS) {
939
- return (!foreignNS || foreignNS === NS.HTML) && isHtmlIntegrationPoint(tn, ns, attrs) || (!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns);
940
- }
941
-
942
- // node_modules/parse5/dist/parser/index.js
943
- var HIDDEN_INPUT_TYPE = "hidden";
944
- var AA_OUTER_LOOP_ITER = 8;
945
- var AA_INNER_LOOP_ITER = 3;
946
- var InsertionMode;
947
- (function(InsertionMode2) {
948
- InsertionMode2[InsertionMode2["INITIAL"] = 0] = "INITIAL";
949
- InsertionMode2[InsertionMode2["BEFORE_HTML"] = 1] = "BEFORE_HTML";
950
- InsertionMode2[InsertionMode2["BEFORE_HEAD"] = 2] = "BEFORE_HEAD";
951
- InsertionMode2[InsertionMode2["IN_HEAD"] = 3] = "IN_HEAD";
952
- InsertionMode2[InsertionMode2["IN_HEAD_NO_SCRIPT"] = 4] = "IN_HEAD_NO_SCRIPT";
953
- InsertionMode2[InsertionMode2["AFTER_HEAD"] = 5] = "AFTER_HEAD";
954
- InsertionMode2[InsertionMode2["IN_BODY"] = 6] = "IN_BODY";
955
- InsertionMode2[InsertionMode2["TEXT"] = 7] = "TEXT";
956
- InsertionMode2[InsertionMode2["IN_TABLE"] = 8] = "IN_TABLE";
957
- InsertionMode2[InsertionMode2["IN_TABLE_TEXT"] = 9] = "IN_TABLE_TEXT";
958
- InsertionMode2[InsertionMode2["IN_CAPTION"] = 10] = "IN_CAPTION";
959
- InsertionMode2[InsertionMode2["IN_COLUMN_GROUP"] = 11] = "IN_COLUMN_GROUP";
960
- InsertionMode2[InsertionMode2["IN_TABLE_BODY"] = 12] = "IN_TABLE_BODY";
961
- InsertionMode2[InsertionMode2["IN_ROW"] = 13] = "IN_ROW";
962
- InsertionMode2[InsertionMode2["IN_CELL"] = 14] = "IN_CELL";
963
- InsertionMode2[InsertionMode2["IN_SELECT"] = 15] = "IN_SELECT";
964
- InsertionMode2[InsertionMode2["IN_SELECT_IN_TABLE"] = 16] = "IN_SELECT_IN_TABLE";
965
- InsertionMode2[InsertionMode2["IN_TEMPLATE"] = 17] = "IN_TEMPLATE";
966
- InsertionMode2[InsertionMode2["AFTER_BODY"] = 18] = "AFTER_BODY";
967
- InsertionMode2[InsertionMode2["IN_FRAMESET"] = 19] = "IN_FRAMESET";
968
- InsertionMode2[InsertionMode2["AFTER_FRAMESET"] = 20] = "AFTER_FRAMESET";
969
- InsertionMode2[InsertionMode2["AFTER_AFTER_BODY"] = 21] = "AFTER_AFTER_BODY";
970
- InsertionMode2[InsertionMode2["AFTER_AFTER_FRAMESET"] = 22] = "AFTER_AFTER_FRAMESET";
971
- })(InsertionMode || (InsertionMode = {}));
972
- var BASE_LOC = {
973
- startLine: -1,
974
- startCol: -1,
975
- startOffset: -1,
976
- endLine: -1,
977
- endCol: -1,
978
- endOffset: -1
979
- };
980
- var TABLE_STRUCTURE_TAGS = /* @__PURE__ */ new Set([TAG_ID.TABLE, TAG_ID.TBODY, TAG_ID.TFOOT, TAG_ID.THEAD, TAG_ID.TR]);
981
- var defaultParserOptions = {
982
- scriptingEnabled: true,
983
- sourceCodeLocationInfo: false,
984
- treeAdapter: defaultTreeAdapter,
985
- onParseError: null
986
- };
987
- var Parser = class {
988
- constructor(options, document, fragmentContext = null, scriptHandler = null) {
989
- this.fragmentContext = fragmentContext;
990
- this.scriptHandler = scriptHandler;
991
- this.currentToken = null;
992
- this.stopped = false;
993
- this.insertionMode = InsertionMode.INITIAL;
994
- this.originalInsertionMode = InsertionMode.INITIAL;
995
- this.headElement = null;
996
- this.formElement = null;
997
- this.currentNotInHTML = false;
998
- this.tmplInsertionModeStack = [];
999
- this.pendingCharacterTokens = [];
1000
- this.hasNonWhitespacePendingCharacterToken = false;
1001
- this.framesetOk = true;
1002
- this.skipNextNewLine = false;
1003
- this.fosterParentingEnabled = false;
1004
- this.options = {
1005
- ...defaultParserOptions,
1006
- ...options
1007
- };
1008
- this.treeAdapter = this.options.treeAdapter;
1009
- this.onParseError = this.options.onParseError;
1010
- if (this.onParseError) {
1011
- this.options.sourceCodeLocationInfo = true;
1012
- }
1013
- this.document = document !== null && document !== void 0 ? document : this.treeAdapter.createDocument();
1014
- this.tokenizer = new Tokenizer(this.options, this);
1015
- this.activeFormattingElements = new FormattingElementList(this.treeAdapter);
1016
- this.fragmentContextID = fragmentContext ? getTagID(this.treeAdapter.getTagName(fragmentContext)) : TAG_ID.UNKNOWN;
1017
- this._setContextModes(fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : this.document, this.fragmentContextID);
1018
- this.openElements = new OpenElementStack(this.document, this.treeAdapter, this);
1019
- }
1020
- // API
1021
- static parse(html, options) {
1022
- const parser = new this(options);
1023
- parser.tokenizer.write(html, true);
1024
- return parser.document;
1025
- }
1026
- static getFragmentParser(fragmentContext, options) {
1027
- const opts = {
1028
- ...defaultParserOptions,
1029
- ...options
1030
- };
1031
- fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : fragmentContext = opts.treeAdapter.createElement(TAG_NAMES.TEMPLATE, NS.HTML, []);
1032
- const documentMock = opts.treeAdapter.createElement("documentmock", NS.HTML, []);
1033
- const parser = new this(opts, documentMock, fragmentContext);
1034
- if (parser.fragmentContextID === TAG_ID.TEMPLATE) {
1035
- parser.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
1036
- }
1037
- parser._initTokenizerForFragmentParsing();
1038
- parser._insertFakeRootElement();
1039
- parser._resetInsertionMode();
1040
- parser._findFormInFragmentContext();
1041
- return parser;
1042
- }
1043
- getFragment() {
1044
- const rootElement = this.treeAdapter.getFirstChild(this.document);
1045
- const fragment = this.treeAdapter.createDocumentFragment();
1046
- this._adoptNodes(rootElement, fragment);
1047
- return fragment;
1048
- }
1049
- //Errors
1050
- /** @internal */
1051
- _err(token, code, beforeToken) {
1052
- var _a;
1053
- if (!this.onParseError)
1054
- return;
1055
- const loc = (_a = token.location) !== null && _a !== void 0 ? _a : BASE_LOC;
1056
- const err = {
1057
- code,
1058
- startLine: loc.startLine,
1059
- startCol: loc.startCol,
1060
- startOffset: loc.startOffset,
1061
- endLine: beforeToken ? loc.startLine : loc.endLine,
1062
- endCol: beforeToken ? loc.startCol : loc.endCol,
1063
- endOffset: beforeToken ? loc.startOffset : loc.endOffset
1064
- };
1065
- this.onParseError(err);
1066
- }
1067
- //Stack events
1068
- /** @internal */
1069
- onItemPush(node, tid, isTop) {
1070
- var _a, _b;
1071
- (_b = (_a = this.treeAdapter).onItemPush) === null || _b === void 0 ? void 0 : _b.call(_a, node);
1072
- if (isTop && this.openElements.stackTop > 0)
1073
- this._setContextModes(node, tid);
1074
- }
1075
- /** @internal */
1076
- onItemPop(node, isTop) {
1077
- var _a, _b;
1078
- if (this.options.sourceCodeLocationInfo) {
1079
- this._setEndLocation(node, this.currentToken);
1080
- }
1081
- (_b = (_a = this.treeAdapter).onItemPop) === null || _b === void 0 ? void 0 : _b.call(_a, node, this.openElements.current);
1082
- if (isTop) {
1083
- let current;
1084
- let currentTagId;
1085
- if (this.openElements.stackTop === 0 && this.fragmentContext) {
1086
- current = this.fragmentContext;
1087
- currentTagId = this.fragmentContextID;
1088
- } else {
1089
- ({ current, currentTagId } = this.openElements);
1090
- }
1091
- this._setContextModes(current, currentTagId);
1092
- }
1093
- }
1094
- _setContextModes(current, tid) {
1095
- const isHTML = current === this.document || current && this.treeAdapter.getNamespaceURI(current) === NS.HTML;
1096
- this.currentNotInHTML = !isHTML;
1097
- this.tokenizer.inForeignNode = !isHTML && current !== void 0 && tid !== void 0 && !this._isIntegrationPoint(tid, current);
1098
- }
1099
- /** @protected */
1100
- _switchToTextParsing(currentToken, nextTokenizerState) {
1101
- this._insertElement(currentToken, NS.HTML);
1102
- this.tokenizer.state = nextTokenizerState;
1103
- this.originalInsertionMode = this.insertionMode;
1104
- this.insertionMode = InsertionMode.TEXT;
1105
- }
1106
- switchToPlaintextParsing() {
1107
- this.insertionMode = InsertionMode.TEXT;
1108
- this.originalInsertionMode = InsertionMode.IN_BODY;
1109
- this.tokenizer.state = TokenizerMode.PLAINTEXT;
1110
- }
1111
- //Fragment parsing
1112
- /** @protected */
1113
- _getAdjustedCurrentElement() {
1114
- return this.openElements.stackTop === 0 && this.fragmentContext ? this.fragmentContext : this.openElements.current;
1115
- }
1116
- /** @protected */
1117
- _findFormInFragmentContext() {
1118
- let node = this.fragmentContext;
1119
- while (node) {
1120
- if (this.treeAdapter.getTagName(node) === TAG_NAMES.FORM) {
1121
- this.formElement = node;
1122
- break;
1123
- }
1124
- node = this.treeAdapter.getParentNode(node);
1125
- }
1126
- }
1127
- _initTokenizerForFragmentParsing() {
1128
- if (!this.fragmentContext || this.treeAdapter.getNamespaceURI(this.fragmentContext) !== NS.HTML) {
1129
- return;
1130
- }
1131
- switch (this.fragmentContextID) {
1132
- case TAG_ID.TITLE:
1133
- case TAG_ID.TEXTAREA: {
1134
- this.tokenizer.state = TokenizerMode.RCDATA;
1135
- break;
1136
- }
1137
- case TAG_ID.STYLE:
1138
- case TAG_ID.XMP:
1139
- case TAG_ID.IFRAME:
1140
- case TAG_ID.NOEMBED:
1141
- case TAG_ID.NOFRAMES:
1142
- case TAG_ID.NOSCRIPT: {
1143
- this.tokenizer.state = TokenizerMode.RAWTEXT;
1144
- break;
1145
- }
1146
- case TAG_ID.SCRIPT: {
1147
- this.tokenizer.state = TokenizerMode.SCRIPT_DATA;
1148
- break;
1149
- }
1150
- case TAG_ID.PLAINTEXT: {
1151
- this.tokenizer.state = TokenizerMode.PLAINTEXT;
1152
- break;
1153
- }
1154
- default:
1155
- }
1156
- }
1157
- //Tree mutation
1158
- /** @protected */
1159
- _setDocumentType(token) {
1160
- const name = token.name || "";
1161
- const publicId = token.publicId || "";
1162
- const systemId = token.systemId || "";
1163
- this.treeAdapter.setDocumentType(this.document, name, publicId, systemId);
1164
- if (token.location) {
1165
- const documentChildren = this.treeAdapter.getChildNodes(this.document);
1166
- const docTypeNode = documentChildren.find((node) => this.treeAdapter.isDocumentTypeNode(node));
1167
- if (docTypeNode) {
1168
- this.treeAdapter.setNodeSourceCodeLocation(docTypeNode, token.location);
1169
- }
1170
- }
1171
- }
1172
- /** @protected */
1173
- _attachElementToTree(element, location) {
1174
- if (this.options.sourceCodeLocationInfo) {
1175
- const loc = location && {
1176
- ...location,
1177
- startTag: location
1178
- };
1179
- this.treeAdapter.setNodeSourceCodeLocation(element, loc);
1180
- }
1181
- if (this._shouldFosterParentOnInsertion()) {
1182
- this._fosterParentElement(element);
1183
- } else {
1184
- const parent = this.openElements.currentTmplContentOrNode;
1185
- this.treeAdapter.appendChild(parent !== null && parent !== void 0 ? parent : this.document, element);
1186
- }
1187
- }
1188
- /**
1189
- * For self-closing tags. Add an element to the tree, but skip adding it
1190
- * to the stack.
1191
- */
1192
- /** @protected */
1193
- _appendElement(token, namespaceURI) {
1194
- const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
1195
- this._attachElementToTree(element, token.location);
1196
- }
1197
- /** @protected */
1198
- _insertElement(token, namespaceURI) {
1199
- const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
1200
- this._attachElementToTree(element, token.location);
1201
- this.openElements.push(element, token.tagID);
1202
- }
1203
- /** @protected */
1204
- _insertFakeElement(tagName, tagID) {
1205
- const element = this.treeAdapter.createElement(tagName, NS.HTML, []);
1206
- this._attachElementToTree(element, null);
1207
- this.openElements.push(element, tagID);
1208
- }
1209
- /** @protected */
1210
- _insertTemplate(token) {
1211
- const tmpl = this.treeAdapter.createElement(token.tagName, NS.HTML, token.attrs);
1212
- const content = this.treeAdapter.createDocumentFragment();
1213
- this.treeAdapter.setTemplateContent(tmpl, content);
1214
- this._attachElementToTree(tmpl, token.location);
1215
- this.openElements.push(tmpl, token.tagID);
1216
- if (this.options.sourceCodeLocationInfo)
1217
- this.treeAdapter.setNodeSourceCodeLocation(content, null);
1218
- }
1219
- /** @protected */
1220
- _insertFakeRootElement() {
1221
- const element = this.treeAdapter.createElement(TAG_NAMES.HTML, NS.HTML, []);
1222
- if (this.options.sourceCodeLocationInfo)
1223
- this.treeAdapter.setNodeSourceCodeLocation(element, null);
1224
- this.treeAdapter.appendChild(this.openElements.current, element);
1225
- this.openElements.push(element, TAG_ID.HTML);
1226
- }
1227
- /** @protected */
1228
- _appendCommentNode(token, parent) {
1229
- const commentNode = this.treeAdapter.createCommentNode(token.data);
1230
- this.treeAdapter.appendChild(parent, commentNode);
1231
- if (this.options.sourceCodeLocationInfo) {
1232
- this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location);
1233
- }
1234
- }
1235
- /** @protected */
1236
- _insertCharacters(token) {
1237
- let parent;
1238
- let beforeElement;
1239
- if (this._shouldFosterParentOnInsertion()) {
1240
- ({ parent, beforeElement } = this._findFosterParentingLocation());
1241
- if (beforeElement) {
1242
- this.treeAdapter.insertTextBefore(parent, token.chars, beforeElement);
1243
- } else {
1244
- this.treeAdapter.insertText(parent, token.chars);
1245
- }
1246
- } else {
1247
- parent = this.openElements.currentTmplContentOrNode;
1248
- this.treeAdapter.insertText(parent, token.chars);
1249
- }
1250
- if (!token.location)
1251
- return;
1252
- const siblings = this.treeAdapter.getChildNodes(parent);
1253
- const textNodeIdx = beforeElement ? siblings.lastIndexOf(beforeElement) : siblings.length;
1254
- const textNode = siblings[textNodeIdx - 1];
1255
- const tnLoc = this.treeAdapter.getNodeSourceCodeLocation(textNode);
1256
- if (tnLoc) {
1257
- const { endLine, endCol, endOffset } = token.location;
1258
- this.treeAdapter.updateNodeSourceCodeLocation(textNode, { endLine, endCol, endOffset });
1259
- } else if (this.options.sourceCodeLocationInfo) {
1260
- this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location);
1261
- }
1262
- }
1263
- /** @protected */
1264
- _adoptNodes(donor, recipient) {
1265
- for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) {
1266
- this.treeAdapter.detachNode(child);
1267
- this.treeAdapter.appendChild(recipient, child);
1268
- }
1269
- }
1270
- /** @protected */
1271
- _setEndLocation(element, closingToken) {
1272
- if (this.treeAdapter.getNodeSourceCodeLocation(element) && closingToken.location) {
1273
- const ctLoc = closingToken.location;
1274
- const tn = this.treeAdapter.getTagName(element);
1275
- const endLoc = (
1276
- // NOTE: For cases like <p> <p> </p> - First 'p' closes without a closing
1277
- // tag and for cases like <td> <p> </td> - 'p' closes without a closing tag.
1278
- closingToken.type === TokenType.END_TAG && tn === closingToken.tagName ? {
1279
- endTag: { ...ctLoc },
1280
- endLine: ctLoc.endLine,
1281
- endCol: ctLoc.endCol,
1282
- endOffset: ctLoc.endOffset
1283
- } : {
1284
- endLine: ctLoc.startLine,
1285
- endCol: ctLoc.startCol,
1286
- endOffset: ctLoc.startOffset
1287
- }
1288
- );
1289
- this.treeAdapter.updateNodeSourceCodeLocation(element, endLoc);
1290
- }
1291
- }
1292
- //Token processing
1293
- shouldProcessStartTagTokenInForeignContent(token) {
1294
- if (!this.currentNotInHTML)
1295
- return false;
1296
- let current;
1297
- let currentTagId;
1298
- if (this.openElements.stackTop === 0 && this.fragmentContext) {
1299
- current = this.fragmentContext;
1300
- currentTagId = this.fragmentContextID;
1301
- } else {
1302
- ({ current, currentTagId } = this.openElements);
1303
- }
1304
- if (token.tagID === TAG_ID.SVG && this.treeAdapter.getTagName(current) === TAG_NAMES.ANNOTATION_XML && this.treeAdapter.getNamespaceURI(current) === NS.MATHML) {
1305
- return false;
1306
- }
1307
- return (
1308
- // Check that `current` is not an integration point for HTML or MathML elements.
1309
- this.tokenizer.inForeignNode || // If it _is_ an integration point, then we might have to check that it is not an HTML
1310
- // integration point.
1311
- (token.tagID === TAG_ID.MGLYPH || token.tagID === TAG_ID.MALIGNMARK) && currentTagId !== void 0 && !this._isIntegrationPoint(currentTagId, current, NS.HTML)
1312
- );
1313
- }
1314
- /** @protected */
1315
- _processToken(token) {
1316
- switch (token.type) {
1317
- case TokenType.CHARACTER: {
1318
- this.onCharacter(token);
1319
- break;
1320
- }
1321
- case TokenType.NULL_CHARACTER: {
1322
- this.onNullCharacter(token);
1323
- break;
1324
- }
1325
- case TokenType.COMMENT: {
1326
- this.onComment(token);
1327
- break;
1328
- }
1329
- case TokenType.DOCTYPE: {
1330
- this.onDoctype(token);
1331
- break;
1332
- }
1333
- case TokenType.START_TAG: {
1334
- this._processStartTag(token);
1335
- break;
1336
- }
1337
- case TokenType.END_TAG: {
1338
- this.onEndTag(token);
1339
- break;
1340
- }
1341
- case TokenType.EOF: {
1342
- this.onEof(token);
1343
- break;
1344
- }
1345
- case TokenType.WHITESPACE_CHARACTER: {
1346
- this.onWhitespaceCharacter(token);
1347
- break;
1348
- }
1349
- }
1350
- }
1351
- //Integration points
1352
- /** @protected */
1353
- _isIntegrationPoint(tid, element, foreignNS) {
1354
- const ns = this.treeAdapter.getNamespaceURI(element);
1355
- const attrs = this.treeAdapter.getAttrList(element);
1356
- return isIntegrationPoint(tid, ns, attrs, foreignNS);
1357
- }
1358
- //Active formatting elements reconstruction
1359
- /** @protected */
1360
- _reconstructActiveFormattingElements() {
1361
- const listLength = this.activeFormattingElements.entries.length;
1362
- if (listLength) {
1363
- const endIndex = this.activeFormattingElements.entries.findIndex((entry) => entry.type === EntryType.Marker || this.openElements.contains(entry.element));
1364
- const unopenIdx = endIndex === -1 ? listLength - 1 : endIndex - 1;
1365
- for (let i = unopenIdx; i >= 0; i--) {
1366
- const entry = this.activeFormattingElements.entries[i];
1367
- this._insertElement(entry.token, this.treeAdapter.getNamespaceURI(entry.element));
1368
- entry.element = this.openElements.current;
1369
- }
1370
- }
1371
- }
1372
- //Close elements
1373
- /** @protected */
1374
- _closeTableCell() {
1375
- this.openElements.generateImpliedEndTags();
1376
- this.openElements.popUntilTableCellPopped();
1377
- this.activeFormattingElements.clearToLastMarker();
1378
- this.insertionMode = InsertionMode.IN_ROW;
1379
- }
1380
- /** @protected */
1381
- _closePElement() {
1382
- this.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.P);
1383
- this.openElements.popUntilTagNamePopped(TAG_ID.P);
1384
- }
1385
- //Insertion modes
1386
- /** @protected */
1387
- _resetInsertionMode() {
1388
- for (let i = this.openElements.stackTop; i >= 0; i--) {
1389
- switch (i === 0 && this.fragmentContext ? this.fragmentContextID : this.openElements.tagIDs[i]) {
1390
- case TAG_ID.TR: {
1391
- this.insertionMode = InsertionMode.IN_ROW;
1392
- return;
1393
- }
1394
- case TAG_ID.TBODY:
1395
- case TAG_ID.THEAD:
1396
- case TAG_ID.TFOOT: {
1397
- this.insertionMode = InsertionMode.IN_TABLE_BODY;
1398
- return;
1399
- }
1400
- case TAG_ID.CAPTION: {
1401
- this.insertionMode = InsertionMode.IN_CAPTION;
1402
- return;
1403
- }
1404
- case TAG_ID.COLGROUP: {
1405
- this.insertionMode = InsertionMode.IN_COLUMN_GROUP;
1406
- return;
1407
- }
1408
- case TAG_ID.TABLE: {
1409
- this.insertionMode = InsertionMode.IN_TABLE;
1410
- return;
1411
- }
1412
- case TAG_ID.BODY: {
1413
- this.insertionMode = InsertionMode.IN_BODY;
1414
- return;
1415
- }
1416
- case TAG_ID.FRAMESET: {
1417
- this.insertionMode = InsertionMode.IN_FRAMESET;
1418
- return;
1419
- }
1420
- case TAG_ID.SELECT: {
1421
- this._resetInsertionModeForSelect(i);
1422
- return;
1423
- }
1424
- case TAG_ID.TEMPLATE: {
1425
- this.insertionMode = this.tmplInsertionModeStack[0];
1426
- return;
1427
- }
1428
- case TAG_ID.HTML: {
1429
- this.insertionMode = this.headElement ? InsertionMode.AFTER_HEAD : InsertionMode.BEFORE_HEAD;
1430
- return;
1431
- }
1432
- case TAG_ID.TD:
1433
- case TAG_ID.TH: {
1434
- if (i > 0) {
1435
- this.insertionMode = InsertionMode.IN_CELL;
1436
- return;
1437
- }
1438
- break;
1439
- }
1440
- case TAG_ID.HEAD: {
1441
- if (i > 0) {
1442
- this.insertionMode = InsertionMode.IN_HEAD;
1443
- return;
1444
- }
1445
- break;
1446
- }
1447
- }
1448
- }
1449
- this.insertionMode = InsertionMode.IN_BODY;
1450
- }
1451
- /** @protected */
1452
- _resetInsertionModeForSelect(selectIdx) {
1453
- if (selectIdx > 0) {
1454
- for (let i = selectIdx - 1; i > 0; i--) {
1455
- const tn = this.openElements.tagIDs[i];
1456
- if (tn === TAG_ID.TEMPLATE) {
1457
- break;
1458
- } else if (tn === TAG_ID.TABLE) {
1459
- this.insertionMode = InsertionMode.IN_SELECT_IN_TABLE;
1460
- return;
1461
- }
1462
- }
1463
- }
1464
- this.insertionMode = InsertionMode.IN_SELECT;
1465
- }
1466
- //Foster parenting
1467
- /** @protected */
1468
- _isElementCausesFosterParenting(tn) {
1469
- return TABLE_STRUCTURE_TAGS.has(tn);
1470
- }
1471
- /** @protected */
1472
- _shouldFosterParentOnInsertion() {
1473
- return this.fosterParentingEnabled && this.openElements.currentTagId !== void 0 && this._isElementCausesFosterParenting(this.openElements.currentTagId);
1474
- }
1475
- /** @protected */
1476
- _findFosterParentingLocation() {
1477
- for (let i = this.openElements.stackTop; i >= 0; i--) {
1478
- const openElement = this.openElements.items[i];
1479
- switch (this.openElements.tagIDs[i]) {
1480
- case TAG_ID.TEMPLATE: {
1481
- if (this.treeAdapter.getNamespaceURI(openElement) === NS.HTML) {
1482
- return { parent: this.treeAdapter.getTemplateContent(openElement), beforeElement: null };
1483
- }
1484
- break;
1485
- }
1486
- case TAG_ID.TABLE: {
1487
- const parent = this.treeAdapter.getParentNode(openElement);
1488
- if (parent) {
1489
- return { parent, beforeElement: openElement };
1490
- }
1491
- return { parent: this.openElements.items[i - 1], beforeElement: null };
1492
- }
1493
- default:
1494
- }
1495
- }
1496
- return { parent: this.openElements.items[0], beforeElement: null };
1497
- }
1498
- /** @protected */
1499
- _fosterParentElement(element) {
1500
- const location = this._findFosterParentingLocation();
1501
- if (location.beforeElement) {
1502
- this.treeAdapter.insertBefore(location.parent, element, location.beforeElement);
1503
- } else {
1504
- this.treeAdapter.appendChild(location.parent, element);
1505
- }
1506
- }
1507
- //Special elements
1508
- /** @protected */
1509
- _isSpecialElement(element, id) {
1510
- const ns = this.treeAdapter.getNamespaceURI(element);
1511
- return SPECIAL_ELEMENTS[ns].has(id);
1512
- }
1513
- /** @internal */
1514
- onCharacter(token) {
1515
- this.skipNextNewLine = false;
1516
- if (this.tokenizer.inForeignNode) {
1517
- characterInForeignContent(this, token);
1518
- return;
1519
- }
1520
- switch (this.insertionMode) {
1521
- case InsertionMode.INITIAL: {
1522
- tokenInInitialMode(this, token);
1523
- break;
1524
- }
1525
- case InsertionMode.BEFORE_HTML: {
1526
- tokenBeforeHtml(this, token);
1527
- break;
1528
- }
1529
- case InsertionMode.BEFORE_HEAD: {
1530
- tokenBeforeHead(this, token);
1531
- break;
1532
- }
1533
- case InsertionMode.IN_HEAD: {
1534
- tokenInHead(this, token);
1535
- break;
1536
- }
1537
- case InsertionMode.IN_HEAD_NO_SCRIPT: {
1538
- tokenInHeadNoScript(this, token);
1539
- break;
1540
- }
1541
- case InsertionMode.AFTER_HEAD: {
1542
- tokenAfterHead(this, token);
1543
- break;
1544
- }
1545
- case InsertionMode.IN_BODY:
1546
- case InsertionMode.IN_CAPTION:
1547
- case InsertionMode.IN_CELL:
1548
- case InsertionMode.IN_TEMPLATE: {
1549
- characterInBody(this, token);
1550
- break;
1551
- }
1552
- case InsertionMode.TEXT:
1553
- case InsertionMode.IN_SELECT:
1554
- case InsertionMode.IN_SELECT_IN_TABLE: {
1555
- this._insertCharacters(token);
1556
- break;
1557
- }
1558
- case InsertionMode.IN_TABLE:
1559
- case InsertionMode.IN_TABLE_BODY:
1560
- case InsertionMode.IN_ROW: {
1561
- characterInTable(this, token);
1562
- break;
1563
- }
1564
- case InsertionMode.IN_TABLE_TEXT: {
1565
- characterInTableText(this, token);
1566
- break;
1567
- }
1568
- case InsertionMode.IN_COLUMN_GROUP: {
1569
- tokenInColumnGroup(this, token);
1570
- break;
1571
- }
1572
- case InsertionMode.AFTER_BODY: {
1573
- tokenAfterBody(this, token);
1574
- break;
1575
- }
1576
- case InsertionMode.AFTER_AFTER_BODY: {
1577
- tokenAfterAfterBody(this, token);
1578
- break;
1579
- }
1580
- default:
1581
- }
1582
- }
1583
- /** @internal */
1584
- onNullCharacter(token) {
1585
- this.skipNextNewLine = false;
1586
- if (this.tokenizer.inForeignNode) {
1587
- nullCharacterInForeignContent(this, token);
1588
- return;
1589
- }
1590
- switch (this.insertionMode) {
1591
- case InsertionMode.INITIAL: {
1592
- tokenInInitialMode(this, token);
1593
- break;
1594
- }
1595
- case InsertionMode.BEFORE_HTML: {
1596
- tokenBeforeHtml(this, token);
1597
- break;
1598
- }
1599
- case InsertionMode.BEFORE_HEAD: {
1600
- tokenBeforeHead(this, token);
1601
- break;
1602
- }
1603
- case InsertionMode.IN_HEAD: {
1604
- tokenInHead(this, token);
1605
- break;
1606
- }
1607
- case InsertionMode.IN_HEAD_NO_SCRIPT: {
1608
- tokenInHeadNoScript(this, token);
1609
- break;
1610
- }
1611
- case InsertionMode.AFTER_HEAD: {
1612
- tokenAfterHead(this, token);
1613
- break;
1614
- }
1615
- case InsertionMode.TEXT: {
1616
- this._insertCharacters(token);
1617
- break;
1618
- }
1619
- case InsertionMode.IN_TABLE:
1620
- case InsertionMode.IN_TABLE_BODY:
1621
- case InsertionMode.IN_ROW: {
1622
- characterInTable(this, token);
1623
- break;
1624
- }
1625
- case InsertionMode.IN_COLUMN_GROUP: {
1626
- tokenInColumnGroup(this, token);
1627
- break;
1628
- }
1629
- case InsertionMode.AFTER_BODY: {
1630
- tokenAfterBody(this, token);
1631
- break;
1632
- }
1633
- case InsertionMode.AFTER_AFTER_BODY: {
1634
- tokenAfterAfterBody(this, token);
1635
- break;
1636
- }
1637
- default:
1638
- }
1639
- }
1640
- /** @internal */
1641
- onComment(token) {
1642
- this.skipNextNewLine = false;
1643
- if (this.currentNotInHTML) {
1644
- appendComment(this, token);
1645
- return;
1646
- }
1647
- switch (this.insertionMode) {
1648
- case InsertionMode.INITIAL:
1649
- case InsertionMode.BEFORE_HTML:
1650
- case InsertionMode.BEFORE_HEAD:
1651
- case InsertionMode.IN_HEAD:
1652
- case InsertionMode.IN_HEAD_NO_SCRIPT:
1653
- case InsertionMode.AFTER_HEAD:
1654
- case InsertionMode.IN_BODY:
1655
- case InsertionMode.IN_TABLE:
1656
- case InsertionMode.IN_CAPTION:
1657
- case InsertionMode.IN_COLUMN_GROUP:
1658
- case InsertionMode.IN_TABLE_BODY:
1659
- case InsertionMode.IN_ROW:
1660
- case InsertionMode.IN_CELL:
1661
- case InsertionMode.IN_SELECT:
1662
- case InsertionMode.IN_SELECT_IN_TABLE:
1663
- case InsertionMode.IN_TEMPLATE:
1664
- case InsertionMode.IN_FRAMESET:
1665
- case InsertionMode.AFTER_FRAMESET: {
1666
- appendComment(this, token);
1667
- break;
1668
- }
1669
- case InsertionMode.IN_TABLE_TEXT: {
1670
- tokenInTableText(this, token);
1671
- break;
1672
- }
1673
- case InsertionMode.AFTER_BODY: {
1674
- appendCommentToRootHtmlElement(this, token);
1675
- break;
1676
- }
1677
- case InsertionMode.AFTER_AFTER_BODY:
1678
- case InsertionMode.AFTER_AFTER_FRAMESET: {
1679
- appendCommentToDocument(this, token);
1680
- break;
1681
- }
1682
- default:
1683
- }
1684
- }
1685
- /** @internal */
1686
- onDoctype(token) {
1687
- this.skipNextNewLine = false;
1688
- switch (this.insertionMode) {
1689
- case InsertionMode.INITIAL: {
1690
- doctypeInInitialMode(this, token);
1691
- break;
1692
- }
1693
- case InsertionMode.BEFORE_HEAD:
1694
- case InsertionMode.IN_HEAD:
1695
- case InsertionMode.IN_HEAD_NO_SCRIPT:
1696
- case InsertionMode.AFTER_HEAD: {
1697
- this._err(token, ERR.misplacedDoctype);
1698
- break;
1699
- }
1700
- case InsertionMode.IN_TABLE_TEXT: {
1701
- tokenInTableText(this, token);
1702
- break;
1703
- }
1704
- default:
1705
- }
1706
- }
1707
- /** @internal */
1708
- onStartTag(token) {
1709
- this.skipNextNewLine = false;
1710
- this.currentToken = token;
1711
- this._processStartTag(token);
1712
- if (token.selfClosing && !token.ackSelfClosing) {
1713
- this._err(token, ERR.nonVoidHtmlElementStartTagWithTrailingSolidus);
1714
- }
1715
- }
1716
- /**
1717
- * Processes a given start tag.
1718
- *
1719
- * `onStartTag` checks if a self-closing tag was recognized. When a token
1720
- * is moved inbetween multiple insertion modes, this check for self-closing
1721
- * could lead to false positives. To avoid this, `_processStartTag` is used
1722
- * for nested calls.
1723
- *
1724
- * @param token The token to process.
1725
- * @protected
1726
- */
1727
- _processStartTag(token) {
1728
- if (this.shouldProcessStartTagTokenInForeignContent(token)) {
1729
- startTagInForeignContent(this, token);
1730
- } else {
1731
- this._startTagOutsideForeignContent(token);
1732
- }
1733
- }
1734
- /** @protected */
1735
- _startTagOutsideForeignContent(token) {
1736
- switch (this.insertionMode) {
1737
- case InsertionMode.INITIAL: {
1738
- tokenInInitialMode(this, token);
1739
- break;
1740
- }
1741
- case InsertionMode.BEFORE_HTML: {
1742
- startTagBeforeHtml(this, token);
1743
- break;
1744
- }
1745
- case InsertionMode.BEFORE_HEAD: {
1746
- startTagBeforeHead(this, token);
1747
- break;
1748
- }
1749
- case InsertionMode.IN_HEAD: {
1750
- startTagInHead(this, token);
1751
- break;
1752
- }
1753
- case InsertionMode.IN_HEAD_NO_SCRIPT: {
1754
- startTagInHeadNoScript(this, token);
1755
- break;
1756
- }
1757
- case InsertionMode.AFTER_HEAD: {
1758
- startTagAfterHead(this, token);
1759
- break;
1760
- }
1761
- case InsertionMode.IN_BODY: {
1762
- startTagInBody(this, token);
1763
- break;
1764
- }
1765
- case InsertionMode.IN_TABLE: {
1766
- startTagInTable(this, token);
1767
- break;
1768
- }
1769
- case InsertionMode.IN_TABLE_TEXT: {
1770
- tokenInTableText(this, token);
1771
- break;
1772
- }
1773
- case InsertionMode.IN_CAPTION: {
1774
- startTagInCaption(this, token);
1775
- break;
1776
- }
1777
- case InsertionMode.IN_COLUMN_GROUP: {
1778
- startTagInColumnGroup(this, token);
1779
- break;
1780
- }
1781
- case InsertionMode.IN_TABLE_BODY: {
1782
- startTagInTableBody(this, token);
1783
- break;
1784
- }
1785
- case InsertionMode.IN_ROW: {
1786
- startTagInRow(this, token);
1787
- break;
1788
- }
1789
- case InsertionMode.IN_CELL: {
1790
- startTagInCell(this, token);
1791
- break;
1792
- }
1793
- case InsertionMode.IN_SELECT: {
1794
- startTagInSelect(this, token);
1795
- break;
1796
- }
1797
- case InsertionMode.IN_SELECT_IN_TABLE: {
1798
- startTagInSelectInTable(this, token);
1799
- break;
1800
- }
1801
- case InsertionMode.IN_TEMPLATE: {
1802
- startTagInTemplate(this, token);
1803
- break;
1804
- }
1805
- case InsertionMode.AFTER_BODY: {
1806
- startTagAfterBody(this, token);
1807
- break;
1808
- }
1809
- case InsertionMode.IN_FRAMESET: {
1810
- startTagInFrameset(this, token);
1811
- break;
1812
- }
1813
- case InsertionMode.AFTER_FRAMESET: {
1814
- startTagAfterFrameset(this, token);
1815
- break;
1816
- }
1817
- case InsertionMode.AFTER_AFTER_BODY: {
1818
- startTagAfterAfterBody(this, token);
1819
- break;
1820
- }
1821
- case InsertionMode.AFTER_AFTER_FRAMESET: {
1822
- startTagAfterAfterFrameset(this, token);
1823
- break;
1824
- }
1825
- default:
1826
- }
1827
- }
1828
- /** @internal */
1829
- onEndTag(token) {
1830
- this.skipNextNewLine = false;
1831
- this.currentToken = token;
1832
- if (this.currentNotInHTML) {
1833
- endTagInForeignContent(this, token);
1834
- } else {
1835
- this._endTagOutsideForeignContent(token);
1836
- }
1837
- }
1838
- /** @protected */
1839
- _endTagOutsideForeignContent(token) {
1840
- switch (this.insertionMode) {
1841
- case InsertionMode.INITIAL: {
1842
- tokenInInitialMode(this, token);
1843
- break;
1844
- }
1845
- case InsertionMode.BEFORE_HTML: {
1846
- endTagBeforeHtml(this, token);
1847
- break;
1848
- }
1849
- case InsertionMode.BEFORE_HEAD: {
1850
- endTagBeforeHead(this, token);
1851
- break;
1852
- }
1853
- case InsertionMode.IN_HEAD: {
1854
- endTagInHead(this, token);
1855
- break;
1856
- }
1857
- case InsertionMode.IN_HEAD_NO_SCRIPT: {
1858
- endTagInHeadNoScript(this, token);
1859
- break;
1860
- }
1861
- case InsertionMode.AFTER_HEAD: {
1862
- endTagAfterHead(this, token);
1863
- break;
1864
- }
1865
- case InsertionMode.IN_BODY: {
1866
- endTagInBody(this, token);
1867
- break;
1868
- }
1869
- case InsertionMode.TEXT: {
1870
- endTagInText(this, token);
1871
- break;
1872
- }
1873
- case InsertionMode.IN_TABLE: {
1874
- endTagInTable(this, token);
1875
- break;
1876
- }
1877
- case InsertionMode.IN_TABLE_TEXT: {
1878
- tokenInTableText(this, token);
1879
- break;
1880
- }
1881
- case InsertionMode.IN_CAPTION: {
1882
- endTagInCaption(this, token);
1883
- break;
1884
- }
1885
- case InsertionMode.IN_COLUMN_GROUP: {
1886
- endTagInColumnGroup(this, token);
1887
- break;
1888
- }
1889
- case InsertionMode.IN_TABLE_BODY: {
1890
- endTagInTableBody(this, token);
1891
- break;
1892
- }
1893
- case InsertionMode.IN_ROW: {
1894
- endTagInRow(this, token);
1895
- break;
1896
- }
1897
- case InsertionMode.IN_CELL: {
1898
- endTagInCell(this, token);
1899
- break;
1900
- }
1901
- case InsertionMode.IN_SELECT: {
1902
- endTagInSelect(this, token);
1903
- break;
1904
- }
1905
- case InsertionMode.IN_SELECT_IN_TABLE: {
1906
- endTagInSelectInTable(this, token);
1907
- break;
1908
- }
1909
- case InsertionMode.IN_TEMPLATE: {
1910
- endTagInTemplate(this, token);
1911
- break;
1912
- }
1913
- case InsertionMode.AFTER_BODY: {
1914
- endTagAfterBody(this, token);
1915
- break;
1916
- }
1917
- case InsertionMode.IN_FRAMESET: {
1918
- endTagInFrameset(this, token);
1919
- break;
1920
- }
1921
- case InsertionMode.AFTER_FRAMESET: {
1922
- endTagAfterFrameset(this, token);
1923
- break;
1924
- }
1925
- case InsertionMode.AFTER_AFTER_BODY: {
1926
- tokenAfterAfterBody(this, token);
1927
- break;
1928
- }
1929
- default:
1930
- }
1931
- }
1932
- /** @internal */
1933
- onEof(token) {
1934
- switch (this.insertionMode) {
1935
- case InsertionMode.INITIAL: {
1936
- tokenInInitialMode(this, token);
1937
- break;
1938
- }
1939
- case InsertionMode.BEFORE_HTML: {
1940
- tokenBeforeHtml(this, token);
1941
- break;
1942
- }
1943
- case InsertionMode.BEFORE_HEAD: {
1944
- tokenBeforeHead(this, token);
1945
- break;
1946
- }
1947
- case InsertionMode.IN_HEAD: {
1948
- tokenInHead(this, token);
1949
- break;
1950
- }
1951
- case InsertionMode.IN_HEAD_NO_SCRIPT: {
1952
- tokenInHeadNoScript(this, token);
1953
- break;
1954
- }
1955
- case InsertionMode.AFTER_HEAD: {
1956
- tokenAfterHead(this, token);
1957
- break;
1958
- }
1959
- case InsertionMode.IN_BODY:
1960
- case InsertionMode.IN_TABLE:
1961
- case InsertionMode.IN_CAPTION:
1962
- case InsertionMode.IN_COLUMN_GROUP:
1963
- case InsertionMode.IN_TABLE_BODY:
1964
- case InsertionMode.IN_ROW:
1965
- case InsertionMode.IN_CELL:
1966
- case InsertionMode.IN_SELECT:
1967
- case InsertionMode.IN_SELECT_IN_TABLE: {
1968
- eofInBody(this, token);
1969
- break;
1970
- }
1971
- case InsertionMode.TEXT: {
1972
- eofInText(this, token);
1973
- break;
1974
- }
1975
- case InsertionMode.IN_TABLE_TEXT: {
1976
- tokenInTableText(this, token);
1977
- break;
1978
- }
1979
- case InsertionMode.IN_TEMPLATE: {
1980
- eofInTemplate(this, token);
1981
- break;
1982
- }
1983
- case InsertionMode.AFTER_BODY:
1984
- case InsertionMode.IN_FRAMESET:
1985
- case InsertionMode.AFTER_FRAMESET:
1986
- case InsertionMode.AFTER_AFTER_BODY:
1987
- case InsertionMode.AFTER_AFTER_FRAMESET: {
1988
- stopParsing(this, token);
1989
- break;
1990
- }
1991
- default:
1992
- }
1993
- }
1994
- /** @internal */
1995
- onWhitespaceCharacter(token) {
1996
- if (this.skipNextNewLine) {
1997
- this.skipNextNewLine = false;
1998
- if (token.chars.charCodeAt(0) === CODE_POINTS.LINE_FEED) {
1999
- if (token.chars.length === 1) {
2000
- return;
2001
- }
2002
- token.chars = token.chars.substr(1);
2003
- }
2004
- }
2005
- if (this.tokenizer.inForeignNode) {
2006
- this._insertCharacters(token);
2007
- return;
2008
- }
2009
- switch (this.insertionMode) {
2010
- case InsertionMode.IN_HEAD:
2011
- case InsertionMode.IN_HEAD_NO_SCRIPT:
2012
- case InsertionMode.AFTER_HEAD:
2013
- case InsertionMode.TEXT:
2014
- case InsertionMode.IN_COLUMN_GROUP:
2015
- case InsertionMode.IN_SELECT:
2016
- case InsertionMode.IN_SELECT_IN_TABLE:
2017
- case InsertionMode.IN_FRAMESET:
2018
- case InsertionMode.AFTER_FRAMESET: {
2019
- this._insertCharacters(token);
2020
- break;
2021
- }
2022
- case InsertionMode.IN_BODY:
2023
- case InsertionMode.IN_CAPTION:
2024
- case InsertionMode.IN_CELL:
2025
- case InsertionMode.IN_TEMPLATE:
2026
- case InsertionMode.AFTER_BODY:
2027
- case InsertionMode.AFTER_AFTER_BODY:
2028
- case InsertionMode.AFTER_AFTER_FRAMESET: {
2029
- whitespaceCharacterInBody(this, token);
2030
- break;
2031
- }
2032
- case InsertionMode.IN_TABLE:
2033
- case InsertionMode.IN_TABLE_BODY:
2034
- case InsertionMode.IN_ROW: {
2035
- characterInTable(this, token);
2036
- break;
2037
- }
2038
- case InsertionMode.IN_TABLE_TEXT: {
2039
- whitespaceCharacterInTableText(this, token);
2040
- break;
2041
- }
2042
- default:
2043
- }
2044
- }
2045
- };
2046
- function aaObtainFormattingElementEntry(p, token) {
2047
- let formattingElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(token.tagName);
2048
- if (formattingElementEntry) {
2049
- if (!p.openElements.contains(formattingElementEntry.element)) {
2050
- p.activeFormattingElements.removeEntry(formattingElementEntry);
2051
- formattingElementEntry = null;
2052
- } else if (!p.openElements.hasInScope(token.tagID)) {
2053
- formattingElementEntry = null;
2054
- }
2055
- } else {
2056
- genericEndTagInBody(p, token);
2057
- }
2058
- return formattingElementEntry;
2059
- }
2060
- function aaObtainFurthestBlock(p, formattingElementEntry) {
2061
- let furthestBlock = null;
2062
- let idx = p.openElements.stackTop;
2063
- for (; idx >= 0; idx--) {
2064
- const element = p.openElements.items[idx];
2065
- if (element === formattingElementEntry.element) {
2066
- break;
2067
- }
2068
- if (p._isSpecialElement(element, p.openElements.tagIDs[idx])) {
2069
- furthestBlock = element;
2070
- }
2071
- }
2072
- if (!furthestBlock) {
2073
- p.openElements.shortenToLength(Math.max(idx, 0));
2074
- p.activeFormattingElements.removeEntry(formattingElementEntry);
2075
- }
2076
- return furthestBlock;
2077
- }
2078
- function aaInnerLoop(p, furthestBlock, formattingElement) {
2079
- let lastElement = furthestBlock;
2080
- let nextElement = p.openElements.getCommonAncestor(furthestBlock);
2081
- for (let i = 0, element = nextElement; element !== formattingElement; i++, element = nextElement) {
2082
- nextElement = p.openElements.getCommonAncestor(element);
2083
- const elementEntry = p.activeFormattingElements.getElementEntry(element);
2084
- const counterOverflow = elementEntry && i >= AA_INNER_LOOP_ITER;
2085
- const shouldRemoveFromOpenElements = !elementEntry || counterOverflow;
2086
- if (shouldRemoveFromOpenElements) {
2087
- if (counterOverflow) {
2088
- p.activeFormattingElements.removeEntry(elementEntry);
2089
- }
2090
- p.openElements.remove(element);
2091
- } else {
2092
- element = aaRecreateElementFromEntry(p, elementEntry);
2093
- if (lastElement === furthestBlock) {
2094
- p.activeFormattingElements.bookmark = elementEntry;
2095
- }
2096
- p.treeAdapter.detachNode(lastElement);
2097
- p.treeAdapter.appendChild(element, lastElement);
2098
- lastElement = element;
2099
- }
2100
- }
2101
- return lastElement;
2102
- }
2103
- function aaRecreateElementFromEntry(p, elementEntry) {
2104
- const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);
2105
- const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);
2106
- p.openElements.replace(elementEntry.element, newElement);
2107
- elementEntry.element = newElement;
2108
- return newElement;
2109
- }
2110
- function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) {
2111
- const tn = p.treeAdapter.getTagName(commonAncestor);
2112
- const tid = getTagID(tn);
2113
- if (p._isElementCausesFosterParenting(tid)) {
2114
- p._fosterParentElement(lastElement);
2115
- } else {
2116
- const ns = p.treeAdapter.getNamespaceURI(commonAncestor);
2117
- if (tid === TAG_ID.TEMPLATE && ns === NS.HTML) {
2118
- commonAncestor = p.treeAdapter.getTemplateContent(commonAncestor);
2119
- }
2120
- p.treeAdapter.appendChild(commonAncestor, lastElement);
2121
- }
2122
- }
2123
- function aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) {
2124
- const ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element);
2125
- const { token } = formattingElementEntry;
2126
- const newElement = p.treeAdapter.createElement(token.tagName, ns, token.attrs);
2127
- p._adoptNodes(furthestBlock, newElement);
2128
- p.treeAdapter.appendChild(furthestBlock, newElement);
2129
- p.activeFormattingElements.insertElementAfterBookmark(newElement, token);
2130
- p.activeFormattingElements.removeEntry(formattingElementEntry);
2131
- p.openElements.remove(formattingElementEntry.element);
2132
- p.openElements.insertAfter(furthestBlock, newElement, token.tagID);
2133
- }
2134
- function callAdoptionAgency(p, token) {
2135
- for (let i = 0; i < AA_OUTER_LOOP_ITER; i++) {
2136
- const formattingElementEntry = aaObtainFormattingElementEntry(p, token);
2137
- if (!formattingElementEntry) {
2138
- break;
2139
- }
2140
- const furthestBlock = aaObtainFurthestBlock(p, formattingElementEntry);
2141
- if (!furthestBlock) {
2142
- break;
2143
- }
2144
- p.activeFormattingElements.bookmark = formattingElementEntry;
2145
- const lastElement = aaInnerLoop(p, furthestBlock, formattingElementEntry.element);
2146
- const commonAncestor = p.openElements.getCommonAncestor(formattingElementEntry.element);
2147
- p.treeAdapter.detachNode(lastElement);
2148
- if (commonAncestor)
2149
- aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement);
2150
- aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry);
2151
- }
2152
- }
2153
- function appendComment(p, token) {
2154
- p._appendCommentNode(token, p.openElements.currentTmplContentOrNode);
2155
- }
2156
- function appendCommentToRootHtmlElement(p, token) {
2157
- p._appendCommentNode(token, p.openElements.items[0]);
2158
- }
2159
- function appendCommentToDocument(p, token) {
2160
- p._appendCommentNode(token, p.document);
2161
- }
2162
- function stopParsing(p, token) {
2163
- p.stopped = true;
2164
- if (token.location) {
2165
- const target = p.fragmentContext ? 0 : 2;
2166
- for (let i = p.openElements.stackTop; i >= target; i--) {
2167
- p._setEndLocation(p.openElements.items[i], token);
2168
- }
2169
- if (!p.fragmentContext && p.openElements.stackTop >= 0) {
2170
- const htmlElement = p.openElements.items[0];
2171
- const htmlLocation = p.treeAdapter.getNodeSourceCodeLocation(htmlElement);
2172
- if (htmlLocation && !htmlLocation.endTag) {
2173
- p._setEndLocation(htmlElement, token);
2174
- if (p.openElements.stackTop >= 1) {
2175
- const bodyElement = p.openElements.items[1];
2176
- const bodyLocation = p.treeAdapter.getNodeSourceCodeLocation(bodyElement);
2177
- if (bodyLocation && !bodyLocation.endTag) {
2178
- p._setEndLocation(bodyElement, token);
2179
- }
2180
- }
2181
- }
2182
- }
2183
- }
2184
- }
2185
- function doctypeInInitialMode(p, token) {
2186
- p._setDocumentType(token);
2187
- const mode = token.forceQuirks ? DOCUMENT_MODE.QUIRKS : getDocumentMode(token);
2188
- if (!isConforming(token)) {
2189
- p._err(token, ERR.nonConformingDoctype);
2190
- }
2191
- p.treeAdapter.setDocumentMode(p.document, mode);
2192
- p.insertionMode = InsertionMode.BEFORE_HTML;
2193
- }
2194
- function tokenInInitialMode(p, token) {
2195
- p._err(token, ERR.missingDoctype, true);
2196
- p.treeAdapter.setDocumentMode(p.document, DOCUMENT_MODE.QUIRKS);
2197
- p.insertionMode = InsertionMode.BEFORE_HTML;
2198
- p._processToken(token);
2199
- }
2200
- function startTagBeforeHtml(p, token) {
2201
- if (token.tagID === TAG_ID.HTML) {
2202
- p._insertElement(token, NS.HTML);
2203
- p.insertionMode = InsertionMode.BEFORE_HEAD;
2204
- } else {
2205
- tokenBeforeHtml(p, token);
2206
- }
2207
- }
2208
- function endTagBeforeHtml(p, token) {
2209
- const tn = token.tagID;
2210
- if (tn === TAG_ID.HTML || tn === TAG_ID.HEAD || tn === TAG_ID.BODY || tn === TAG_ID.BR) {
2211
- tokenBeforeHtml(p, token);
2212
- }
2213
- }
2214
- function tokenBeforeHtml(p, token) {
2215
- p._insertFakeRootElement();
2216
- p.insertionMode = InsertionMode.BEFORE_HEAD;
2217
- p._processToken(token);
2218
- }
2219
- function startTagBeforeHead(p, token) {
2220
- switch (token.tagID) {
2221
- case TAG_ID.HTML: {
2222
- startTagInBody(p, token);
2223
- break;
2224
- }
2225
- case TAG_ID.HEAD: {
2226
- p._insertElement(token, NS.HTML);
2227
- p.headElement = p.openElements.current;
2228
- p.insertionMode = InsertionMode.IN_HEAD;
2229
- break;
2230
- }
2231
- default: {
2232
- tokenBeforeHead(p, token);
2233
- }
2234
- }
2235
- }
2236
- function endTagBeforeHead(p, token) {
2237
- const tn = token.tagID;
2238
- if (tn === TAG_ID.HEAD || tn === TAG_ID.BODY || tn === TAG_ID.HTML || tn === TAG_ID.BR) {
2239
- tokenBeforeHead(p, token);
2240
- } else {
2241
- p._err(token, ERR.endTagWithoutMatchingOpenElement);
2242
- }
2243
- }
2244
- function tokenBeforeHead(p, token) {
2245
- p._insertFakeElement(TAG_NAMES.HEAD, TAG_ID.HEAD);
2246
- p.headElement = p.openElements.current;
2247
- p.insertionMode = InsertionMode.IN_HEAD;
2248
- p._processToken(token);
2249
- }
2250
- function startTagInHead(p, token) {
2251
- switch (token.tagID) {
2252
- case TAG_ID.HTML: {
2253
- startTagInBody(p, token);
2254
- break;
2255
- }
2256
- case TAG_ID.BASE:
2257
- case TAG_ID.BASEFONT:
2258
- case TAG_ID.BGSOUND:
2259
- case TAG_ID.LINK:
2260
- case TAG_ID.META: {
2261
- p._appendElement(token, NS.HTML);
2262
- token.ackSelfClosing = true;
2263
- break;
2264
- }
2265
- case TAG_ID.TITLE: {
2266
- p._switchToTextParsing(token, TokenizerMode.RCDATA);
2267
- break;
2268
- }
2269
- case TAG_ID.NOSCRIPT: {
2270
- if (p.options.scriptingEnabled) {
2271
- p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
2272
- } else {
2273
- p._insertElement(token, NS.HTML);
2274
- p.insertionMode = InsertionMode.IN_HEAD_NO_SCRIPT;
2275
- }
2276
- break;
2277
- }
2278
- case TAG_ID.NOFRAMES:
2279
- case TAG_ID.STYLE: {
2280
- p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
2281
- break;
2282
- }
2283
- case TAG_ID.SCRIPT: {
2284
- p._switchToTextParsing(token, TokenizerMode.SCRIPT_DATA);
2285
- break;
2286
- }
2287
- case TAG_ID.TEMPLATE: {
2288
- p._insertTemplate(token);
2289
- p.activeFormattingElements.insertMarker();
2290
- p.framesetOk = false;
2291
- p.insertionMode = InsertionMode.IN_TEMPLATE;
2292
- p.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
2293
- break;
2294
- }
2295
- case TAG_ID.HEAD: {
2296
- p._err(token, ERR.misplacedStartTagForHeadElement);
2297
- break;
2298
- }
2299
- default: {
2300
- tokenInHead(p, token);
2301
- }
2302
- }
2303
- }
2304
- function endTagInHead(p, token) {
2305
- switch (token.tagID) {
2306
- case TAG_ID.HEAD: {
2307
- p.openElements.pop();
2308
- p.insertionMode = InsertionMode.AFTER_HEAD;
2309
- break;
2310
- }
2311
- case TAG_ID.BODY:
2312
- case TAG_ID.BR:
2313
- case TAG_ID.HTML: {
2314
- tokenInHead(p, token);
2315
- break;
2316
- }
2317
- case TAG_ID.TEMPLATE: {
2318
- templateEndTagInHead(p, token);
2319
- break;
2320
- }
2321
- default: {
2322
- p._err(token, ERR.endTagWithoutMatchingOpenElement);
2323
- }
2324
- }
2325
- }
2326
- function templateEndTagInHead(p, token) {
2327
- if (p.openElements.tmplCount > 0) {
2328
- p.openElements.generateImpliedEndTagsThoroughly();
2329
- if (p.openElements.currentTagId !== TAG_ID.TEMPLATE) {
2330
- p._err(token, ERR.closingOfElementWithOpenChildElements);
2331
- }
2332
- p.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE);
2333
- p.activeFormattingElements.clearToLastMarker();
2334
- p.tmplInsertionModeStack.shift();
2335
- p._resetInsertionMode();
2336
- } else {
2337
- p._err(token, ERR.endTagWithoutMatchingOpenElement);
2338
- }
2339
- }
2340
- function tokenInHead(p, token) {
2341
- p.openElements.pop();
2342
- p.insertionMode = InsertionMode.AFTER_HEAD;
2343
- p._processToken(token);
2344
- }
2345
- function startTagInHeadNoScript(p, token) {
2346
- switch (token.tagID) {
2347
- case TAG_ID.HTML: {
2348
- startTagInBody(p, token);
2349
- break;
2350
- }
2351
- case TAG_ID.BASEFONT:
2352
- case TAG_ID.BGSOUND:
2353
- case TAG_ID.HEAD:
2354
- case TAG_ID.LINK:
2355
- case TAG_ID.META:
2356
- case TAG_ID.NOFRAMES:
2357
- case TAG_ID.STYLE: {
2358
- startTagInHead(p, token);
2359
- break;
2360
- }
2361
- case TAG_ID.NOSCRIPT: {
2362
- p._err(token, ERR.nestedNoscriptInHead);
2363
- break;
2364
- }
2365
- default: {
2366
- tokenInHeadNoScript(p, token);
2367
- }
2368
- }
2369
- }
2370
- function endTagInHeadNoScript(p, token) {
2371
- switch (token.tagID) {
2372
- case TAG_ID.NOSCRIPT: {
2373
- p.openElements.pop();
2374
- p.insertionMode = InsertionMode.IN_HEAD;
2375
- break;
2376
- }
2377
- case TAG_ID.BR: {
2378
- tokenInHeadNoScript(p, token);
2379
- break;
2380
- }
2381
- default: {
2382
- p._err(token, ERR.endTagWithoutMatchingOpenElement);
2383
- }
2384
- }
2385
- }
2386
- function tokenInHeadNoScript(p, token) {
2387
- const errCode = token.type === TokenType.EOF ? ERR.openElementsLeftAfterEof : ERR.disallowedContentInNoscriptInHead;
2388
- p._err(token, errCode);
2389
- p.openElements.pop();
2390
- p.insertionMode = InsertionMode.IN_HEAD;
2391
- p._processToken(token);
2392
- }
2393
- function startTagAfterHead(p, token) {
2394
- switch (token.tagID) {
2395
- case TAG_ID.HTML: {
2396
- startTagInBody(p, token);
2397
- break;
2398
- }
2399
- case TAG_ID.BODY: {
2400
- p._insertElement(token, NS.HTML);
2401
- p.framesetOk = false;
2402
- p.insertionMode = InsertionMode.IN_BODY;
2403
- break;
2404
- }
2405
- case TAG_ID.FRAMESET: {
2406
- p._insertElement(token, NS.HTML);
2407
- p.insertionMode = InsertionMode.IN_FRAMESET;
2408
- break;
2409
- }
2410
- case TAG_ID.BASE:
2411
- case TAG_ID.BASEFONT:
2412
- case TAG_ID.BGSOUND:
2413
- case TAG_ID.LINK:
2414
- case TAG_ID.META:
2415
- case TAG_ID.NOFRAMES:
2416
- case TAG_ID.SCRIPT:
2417
- case TAG_ID.STYLE:
2418
- case TAG_ID.TEMPLATE:
2419
- case TAG_ID.TITLE: {
2420
- p._err(token, ERR.abandonedHeadElementChild);
2421
- p.openElements.push(p.headElement, TAG_ID.HEAD);
2422
- startTagInHead(p, token);
2423
- p.openElements.remove(p.headElement);
2424
- break;
2425
- }
2426
- case TAG_ID.HEAD: {
2427
- p._err(token, ERR.misplacedStartTagForHeadElement);
2428
- break;
2429
- }
2430
- default: {
2431
- tokenAfterHead(p, token);
2432
- }
2433
- }
2434
- }
2435
- function endTagAfterHead(p, token) {
2436
- switch (token.tagID) {
2437
- case TAG_ID.BODY:
2438
- case TAG_ID.HTML:
2439
- case TAG_ID.BR: {
2440
- tokenAfterHead(p, token);
2441
- break;
2442
- }
2443
- case TAG_ID.TEMPLATE: {
2444
- templateEndTagInHead(p, token);
2445
- break;
2446
- }
2447
- default: {
2448
- p._err(token, ERR.endTagWithoutMatchingOpenElement);
2449
- }
2450
- }
2451
- }
2452
- function tokenAfterHead(p, token) {
2453
- p._insertFakeElement(TAG_NAMES.BODY, TAG_ID.BODY);
2454
- p.insertionMode = InsertionMode.IN_BODY;
2455
- modeInBody(p, token);
2456
- }
2457
- function modeInBody(p, token) {
2458
- switch (token.type) {
2459
- case TokenType.CHARACTER: {
2460
- characterInBody(p, token);
2461
- break;
2462
- }
2463
- case TokenType.WHITESPACE_CHARACTER: {
2464
- whitespaceCharacterInBody(p, token);
2465
- break;
2466
- }
2467
- case TokenType.COMMENT: {
2468
- appendComment(p, token);
2469
- break;
2470
- }
2471
- case TokenType.START_TAG: {
2472
- startTagInBody(p, token);
2473
- break;
2474
- }
2475
- case TokenType.END_TAG: {
2476
- endTagInBody(p, token);
2477
- break;
2478
- }
2479
- case TokenType.EOF: {
2480
- eofInBody(p, token);
2481
- break;
2482
- }
2483
- default:
2484
- }
2485
- }
2486
- function whitespaceCharacterInBody(p, token) {
2487
- p._reconstructActiveFormattingElements();
2488
- p._insertCharacters(token);
2489
- }
2490
- function characterInBody(p, token) {
2491
- p._reconstructActiveFormattingElements();
2492
- p._insertCharacters(token);
2493
- p.framesetOk = false;
2494
- }
2495
- function htmlStartTagInBody(p, token) {
2496
- if (p.openElements.tmplCount === 0) {
2497
- p.treeAdapter.adoptAttributes(p.openElements.items[0], token.attrs);
2498
- }
2499
- }
2500
- function bodyStartTagInBody(p, token) {
2501
- const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
2502
- if (bodyElement && p.openElements.tmplCount === 0) {
2503
- p.framesetOk = false;
2504
- p.treeAdapter.adoptAttributes(bodyElement, token.attrs);
2505
- }
2506
- }
2507
- function framesetStartTagInBody(p, token) {
2508
- const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
2509
- if (p.framesetOk && bodyElement) {
2510
- p.treeAdapter.detachNode(bodyElement);
2511
- p.openElements.popAllUpToHtmlElement();
2512
- p._insertElement(token, NS.HTML);
2513
- p.insertionMode = InsertionMode.IN_FRAMESET;
2514
- }
2515
- }
2516
- function addressStartTagInBody(p, token) {
2517
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
2518
- p._closePElement();
2519
- }
2520
- p._insertElement(token, NS.HTML);
2521
- }
2522
- function numberedHeaderStartTagInBody(p, token) {
2523
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
2524
- p._closePElement();
2525
- }
2526
- if (p.openElements.currentTagId !== void 0 && NUMBERED_HEADERS.has(p.openElements.currentTagId)) {
2527
- p.openElements.pop();
2528
- }
2529
- p._insertElement(token, NS.HTML);
2530
- }
2531
- function preStartTagInBody(p, token) {
2532
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
2533
- p._closePElement();
2534
- }
2535
- p._insertElement(token, NS.HTML);
2536
- p.skipNextNewLine = true;
2537
- p.framesetOk = false;
2538
- }
2539
- function formStartTagInBody(p, token) {
2540
- const inTemplate = p.openElements.tmplCount > 0;
2541
- if (!p.formElement || inTemplate) {
2542
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
2543
- p._closePElement();
2544
- }
2545
- p._insertElement(token, NS.HTML);
2546
- if (!inTemplate) {
2547
- p.formElement = p.openElements.current;
2548
- }
2549
- }
2550
- }
2551
- function listItemStartTagInBody(p, token) {
2552
- p.framesetOk = false;
2553
- const tn = token.tagID;
2554
- for (let i = p.openElements.stackTop; i >= 0; i--) {
2555
- const elementId = p.openElements.tagIDs[i];
2556
- if (tn === TAG_ID.LI && elementId === TAG_ID.LI || (tn === TAG_ID.DD || tn === TAG_ID.DT) && (elementId === TAG_ID.DD || elementId === TAG_ID.DT)) {
2557
- p.openElements.generateImpliedEndTagsWithExclusion(elementId);
2558
- p.openElements.popUntilTagNamePopped(elementId);
2559
- break;
2560
- }
2561
- if (elementId !== TAG_ID.ADDRESS && elementId !== TAG_ID.DIV && elementId !== TAG_ID.P && p._isSpecialElement(p.openElements.items[i], elementId)) {
2562
- break;
2563
- }
2564
- }
2565
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
2566
- p._closePElement();
2567
- }
2568
- p._insertElement(token, NS.HTML);
2569
- }
2570
- function plaintextStartTagInBody(p, token) {
2571
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
2572
- p._closePElement();
2573
- }
2574
- p._insertElement(token, NS.HTML);
2575
- p.tokenizer.state = TokenizerMode.PLAINTEXT;
2576
- }
2577
- function buttonStartTagInBody(p, token) {
2578
- if (p.openElements.hasInScope(TAG_ID.BUTTON)) {
2579
- p.openElements.generateImpliedEndTags();
2580
- p.openElements.popUntilTagNamePopped(TAG_ID.BUTTON);
2581
- }
2582
- p._reconstructActiveFormattingElements();
2583
- p._insertElement(token, NS.HTML);
2584
- p.framesetOk = false;
2585
- }
2586
- function aStartTagInBody(p, token) {
2587
- const activeElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(TAG_NAMES.A);
2588
- if (activeElementEntry) {
2589
- callAdoptionAgency(p, token);
2590
- p.openElements.remove(activeElementEntry.element);
2591
- p.activeFormattingElements.removeEntry(activeElementEntry);
2592
- }
2593
- p._reconstructActiveFormattingElements();
2594
- p._insertElement(token, NS.HTML);
2595
- p.activeFormattingElements.pushElement(p.openElements.current, token);
2596
- }
2597
- function bStartTagInBody(p, token) {
2598
- p._reconstructActiveFormattingElements();
2599
- p._insertElement(token, NS.HTML);
2600
- p.activeFormattingElements.pushElement(p.openElements.current, token);
2601
- }
2602
- function nobrStartTagInBody(p, token) {
2603
- p._reconstructActiveFormattingElements();
2604
- if (p.openElements.hasInScope(TAG_ID.NOBR)) {
2605
- callAdoptionAgency(p, token);
2606
- p._reconstructActiveFormattingElements();
2607
- }
2608
- p._insertElement(token, NS.HTML);
2609
- p.activeFormattingElements.pushElement(p.openElements.current, token);
2610
- }
2611
- function appletStartTagInBody(p, token) {
2612
- p._reconstructActiveFormattingElements();
2613
- p._insertElement(token, NS.HTML);
2614
- p.activeFormattingElements.insertMarker();
2615
- p.framesetOk = false;
2616
- }
2617
- function tableStartTagInBody(p, token) {
2618
- if (p.treeAdapter.getDocumentMode(p.document) !== DOCUMENT_MODE.QUIRKS && p.openElements.hasInButtonScope(TAG_ID.P)) {
2619
- p._closePElement();
2620
- }
2621
- p._insertElement(token, NS.HTML);
2622
- p.framesetOk = false;
2623
- p.insertionMode = InsertionMode.IN_TABLE;
2624
- }
2625
- function areaStartTagInBody(p, token) {
2626
- p._reconstructActiveFormattingElements();
2627
- p._appendElement(token, NS.HTML);
2628
- p.framesetOk = false;
2629
- token.ackSelfClosing = true;
2630
- }
2631
- function isHiddenInput(token) {
2632
- const inputType = getTokenAttr(token, ATTRS.TYPE);
2633
- return inputType != null && inputType.toLowerCase() === HIDDEN_INPUT_TYPE;
2634
- }
2635
- function inputStartTagInBody(p, token) {
2636
- p._reconstructActiveFormattingElements();
2637
- p._appendElement(token, NS.HTML);
2638
- if (!isHiddenInput(token)) {
2639
- p.framesetOk = false;
2640
- }
2641
- token.ackSelfClosing = true;
2642
- }
2643
- function paramStartTagInBody(p, token) {
2644
- p._appendElement(token, NS.HTML);
2645
- token.ackSelfClosing = true;
2646
- }
2647
- function hrStartTagInBody(p, token) {
2648
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
2649
- p._closePElement();
2650
- }
2651
- p._appendElement(token, NS.HTML);
2652
- p.framesetOk = false;
2653
- token.ackSelfClosing = true;
2654
- }
2655
- function imageStartTagInBody(p, token) {
2656
- token.tagName = TAG_NAMES.IMG;
2657
- token.tagID = TAG_ID.IMG;
2658
- areaStartTagInBody(p, token);
2659
- }
2660
- function textareaStartTagInBody(p, token) {
2661
- p._insertElement(token, NS.HTML);
2662
- p.skipNextNewLine = true;
2663
- p.tokenizer.state = TokenizerMode.RCDATA;
2664
- p.originalInsertionMode = p.insertionMode;
2665
- p.framesetOk = false;
2666
- p.insertionMode = InsertionMode.TEXT;
2667
- }
2668
- function xmpStartTagInBody(p, token) {
2669
- if (p.openElements.hasInButtonScope(TAG_ID.P)) {
2670
- p._closePElement();
2671
- }
2672
- p._reconstructActiveFormattingElements();
2673
- p.framesetOk = false;
2674
- p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
2675
- }
2676
- function iframeStartTagInBody(p, token) {
2677
- p.framesetOk = false;
2678
- p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
2679
- }
2680
- function rawTextStartTagInBody(p, token) {
2681
- p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
2682
- }
2683
- function selectStartTagInBody(p, token) {
2684
- p._reconstructActiveFormattingElements();
2685
- p._insertElement(token, NS.HTML);
2686
- p.framesetOk = false;
2687
- p.insertionMode = p.insertionMode === InsertionMode.IN_TABLE || p.insertionMode === InsertionMode.IN_CAPTION || p.insertionMode === InsertionMode.IN_TABLE_BODY || p.insertionMode === InsertionMode.IN_ROW || p.insertionMode === InsertionMode.IN_CELL ? InsertionMode.IN_SELECT_IN_TABLE : InsertionMode.IN_SELECT;
2688
- }
2689
- function optgroupStartTagInBody(p, token) {
2690
- if (p.openElements.currentTagId === TAG_ID.OPTION) {
2691
- p.openElements.pop();
2692
- }
2693
- p._reconstructActiveFormattingElements();
2694
- p._insertElement(token, NS.HTML);
2695
- }
2696
- function rbStartTagInBody(p, token) {
2697
- if (p.openElements.hasInScope(TAG_ID.RUBY)) {
2698
- p.openElements.generateImpliedEndTags();
2699
- }
2700
- p._insertElement(token, NS.HTML);
2701
- }
2702
- function rtStartTagInBody(p, token) {
2703
- if (p.openElements.hasInScope(TAG_ID.RUBY)) {
2704
- p.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.RTC);
2705
- }
2706
- p._insertElement(token, NS.HTML);
2707
- }
2708
- function mathStartTagInBody(p, token) {
2709
- p._reconstructActiveFormattingElements();
2710
- adjustTokenMathMLAttrs(token);
2711
- adjustTokenXMLAttrs(token);
2712
- if (token.selfClosing) {
2713
- p._appendElement(token, NS.MATHML);
2714
- } else {
2715
- p._insertElement(token, NS.MATHML);
2716
- }
2717
- token.ackSelfClosing = true;
2718
- }
2719
- function svgStartTagInBody(p, token) {
2720
- p._reconstructActiveFormattingElements();
2721
- adjustTokenSVGAttrs(token);
2722
- adjustTokenXMLAttrs(token);
2723
- if (token.selfClosing) {
2724
- p._appendElement(token, NS.SVG);
2725
- } else {
2726
- p._insertElement(token, NS.SVG);
2727
- }
2728
- token.ackSelfClosing = true;
2729
- }
2730
- function genericStartTagInBody(p, token) {
2731
- p._reconstructActiveFormattingElements();
2732
- p._insertElement(token, NS.HTML);
2733
- }
2734
- function startTagInBody(p, token) {
2735
- switch (token.tagID) {
2736
- case TAG_ID.I:
2737
- case TAG_ID.S:
2738
- case TAG_ID.B:
2739
- case TAG_ID.U:
2740
- case TAG_ID.EM:
2741
- case TAG_ID.TT:
2742
- case TAG_ID.BIG:
2743
- case TAG_ID.CODE:
2744
- case TAG_ID.FONT:
2745
- case TAG_ID.SMALL:
2746
- case TAG_ID.STRIKE:
2747
- case TAG_ID.STRONG: {
2748
- bStartTagInBody(p, token);
2749
- break;
2750
- }
2751
- case TAG_ID.A: {
2752
- aStartTagInBody(p, token);
2753
- break;
2754
- }
2755
- case TAG_ID.H1:
2756
- case TAG_ID.H2:
2757
- case TAG_ID.H3:
2758
- case TAG_ID.H4:
2759
- case TAG_ID.H5:
2760
- case TAG_ID.H6: {
2761
- numberedHeaderStartTagInBody(p, token);
2762
- break;
2763
- }
2764
- case TAG_ID.P:
2765
- case TAG_ID.DL:
2766
- case TAG_ID.OL:
2767
- case TAG_ID.UL:
2768
- case TAG_ID.DIV:
2769
- case TAG_ID.DIR:
2770
- case TAG_ID.NAV:
2771
- case TAG_ID.MAIN:
2772
- case TAG_ID.MENU:
2773
- case TAG_ID.ASIDE:
2774
- case TAG_ID.CENTER:
2775
- case TAG_ID.FIGURE:
2776
- case TAG_ID.FOOTER:
2777
- case TAG_ID.HEADER:
2778
- case TAG_ID.HGROUP:
2779
- case TAG_ID.DIALOG:
2780
- case TAG_ID.DETAILS:
2781
- case TAG_ID.ADDRESS:
2782
- case TAG_ID.ARTICLE:
2783
- case TAG_ID.SEARCH:
2784
- case TAG_ID.SECTION:
2785
- case TAG_ID.SUMMARY:
2786
- case TAG_ID.FIELDSET:
2787
- case TAG_ID.BLOCKQUOTE:
2788
- case TAG_ID.FIGCAPTION: {
2789
- addressStartTagInBody(p, token);
2790
- break;
2791
- }
2792
- case TAG_ID.LI:
2793
- case TAG_ID.DD:
2794
- case TAG_ID.DT: {
2795
- listItemStartTagInBody(p, token);
2796
- break;
2797
- }
2798
- case TAG_ID.BR:
2799
- case TAG_ID.IMG:
2800
- case TAG_ID.WBR:
2801
- case TAG_ID.AREA:
2802
- case TAG_ID.EMBED:
2803
- case TAG_ID.KEYGEN: {
2804
- areaStartTagInBody(p, token);
2805
- break;
2806
- }
2807
- case TAG_ID.HR: {
2808
- hrStartTagInBody(p, token);
2809
- break;
2810
- }
2811
- case TAG_ID.RB:
2812
- case TAG_ID.RTC: {
2813
- rbStartTagInBody(p, token);
2814
- break;
2815
- }
2816
- case TAG_ID.RT:
2817
- case TAG_ID.RP: {
2818
- rtStartTagInBody(p, token);
2819
- break;
2820
- }
2821
- case TAG_ID.PRE:
2822
- case TAG_ID.LISTING: {
2823
- preStartTagInBody(p, token);
2824
- break;
2825
- }
2826
- case TAG_ID.XMP: {
2827
- xmpStartTagInBody(p, token);
2828
- break;
2829
- }
2830
- case TAG_ID.SVG: {
2831
- svgStartTagInBody(p, token);
2832
- break;
2833
- }
2834
- case TAG_ID.HTML: {
2835
- htmlStartTagInBody(p, token);
2836
- break;
2837
- }
2838
- case TAG_ID.BASE:
2839
- case TAG_ID.LINK:
2840
- case TAG_ID.META:
2841
- case TAG_ID.STYLE:
2842
- case TAG_ID.TITLE:
2843
- case TAG_ID.SCRIPT:
2844
- case TAG_ID.BGSOUND:
2845
- case TAG_ID.BASEFONT:
2846
- case TAG_ID.TEMPLATE: {
2847
- startTagInHead(p, token);
2848
- break;
2849
- }
2850
- case TAG_ID.BODY: {
2851
- bodyStartTagInBody(p, token);
2852
- break;
2853
- }
2854
- case TAG_ID.FORM: {
2855
- formStartTagInBody(p, token);
2856
- break;
2857
- }
2858
- case TAG_ID.NOBR: {
2859
- nobrStartTagInBody(p, token);
2860
- break;
2861
- }
2862
- case TAG_ID.MATH: {
2863
- mathStartTagInBody(p, token);
2864
- break;
2865
- }
2866
- case TAG_ID.TABLE: {
2867
- tableStartTagInBody(p, token);
2868
- break;
2869
- }
2870
- case TAG_ID.INPUT: {
2871
- inputStartTagInBody(p, token);
2872
- break;
2873
- }
2874
- case TAG_ID.PARAM:
2875
- case TAG_ID.TRACK:
2876
- case TAG_ID.SOURCE: {
2877
- paramStartTagInBody(p, token);
2878
- break;
2879
- }
2880
- case TAG_ID.IMAGE: {
2881
- imageStartTagInBody(p, token);
2882
- break;
2883
- }
2884
- case TAG_ID.BUTTON: {
2885
- buttonStartTagInBody(p, token);
2886
- break;
2887
- }
2888
- case TAG_ID.APPLET:
2889
- case TAG_ID.OBJECT:
2890
- case TAG_ID.MARQUEE: {
2891
- appletStartTagInBody(p, token);
2892
- break;
2893
- }
2894
- case TAG_ID.IFRAME: {
2895
- iframeStartTagInBody(p, token);
2896
- break;
2897
- }
2898
- case TAG_ID.SELECT: {
2899
- selectStartTagInBody(p, token);
2900
- break;
2901
- }
2902
- case TAG_ID.OPTION:
2903
- case TAG_ID.OPTGROUP: {
2904
- optgroupStartTagInBody(p, token);
2905
- break;
2906
- }
2907
- case TAG_ID.NOEMBED:
2908
- case TAG_ID.NOFRAMES: {
2909
- rawTextStartTagInBody(p, token);
2910
- break;
2911
- }
2912
- case TAG_ID.FRAMESET: {
2913
- framesetStartTagInBody(p, token);
2914
- break;
2915
- }
2916
- case TAG_ID.TEXTAREA: {
2917
- textareaStartTagInBody(p, token);
2918
- break;
2919
- }
2920
- case TAG_ID.NOSCRIPT: {
2921
- if (p.options.scriptingEnabled) {
2922
- rawTextStartTagInBody(p, token);
2923
- } else {
2924
- genericStartTagInBody(p, token);
2925
- }
2926
- break;
2927
- }
2928
- case TAG_ID.PLAINTEXT: {
2929
- plaintextStartTagInBody(p, token);
2930
- break;
2931
- }
2932
- case TAG_ID.COL:
2933
- case TAG_ID.TH:
2934
- case TAG_ID.TD:
2935
- case TAG_ID.TR:
2936
- case TAG_ID.HEAD:
2937
- case TAG_ID.FRAME:
2938
- case TAG_ID.TBODY:
2939
- case TAG_ID.TFOOT:
2940
- case TAG_ID.THEAD:
2941
- case TAG_ID.CAPTION:
2942
- case TAG_ID.COLGROUP: {
2943
- break;
2944
- }
2945
- default: {
2946
- genericStartTagInBody(p, token);
2947
- }
2948
- }
2949
- }
2950
- function bodyEndTagInBody(p, token) {
2951
- if (p.openElements.hasInScope(TAG_ID.BODY)) {
2952
- p.insertionMode = InsertionMode.AFTER_BODY;
2953
- if (p.options.sourceCodeLocationInfo) {
2954
- const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
2955
- if (bodyElement) {
2956
- p._setEndLocation(bodyElement, token);
2957
- }
2958
- }
2959
- }
2960
- }
2961
- function htmlEndTagInBody(p, token) {
2962
- if (p.openElements.hasInScope(TAG_ID.BODY)) {
2963
- p.insertionMode = InsertionMode.AFTER_BODY;
2964
- endTagAfterBody(p, token);
2965
- }
2966
- }
2967
- function addressEndTagInBody(p, token) {
2968
- const tn = token.tagID;
2969
- if (p.openElements.hasInScope(tn)) {
2970
- p.openElements.generateImpliedEndTags();
2971
- p.openElements.popUntilTagNamePopped(tn);
2972
- }
2973
- }
2974
- function formEndTagInBody(p) {
2975
- const inTemplate = p.openElements.tmplCount > 0;
2976
- const { formElement } = p;
2977
- if (!inTemplate) {
2978
- p.formElement = null;
2979
- }
2980
- if ((formElement || inTemplate) && p.openElements.hasInScope(TAG_ID.FORM)) {
2981
- p.openElements.generateImpliedEndTags();
2982
- if (inTemplate) {
2983
- p.openElements.popUntilTagNamePopped(TAG_ID.FORM);
2984
- } else if (formElement) {
2985
- p.openElements.remove(formElement);
2986
- }
2987
- }
2988
- }
2989
- function pEndTagInBody(p) {
2990
- if (!p.openElements.hasInButtonScope(TAG_ID.P)) {
2991
- p._insertFakeElement(TAG_NAMES.P, TAG_ID.P);
2992
- }
2993
- p._closePElement();
2994
- }
2995
- function liEndTagInBody(p) {
2996
- if (p.openElements.hasInListItemScope(TAG_ID.LI)) {
2997
- p.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.LI);
2998
- p.openElements.popUntilTagNamePopped(TAG_ID.LI);
2999
- }
3000
- }
3001
- function ddEndTagInBody(p, token) {
3002
- const tn = token.tagID;
3003
- if (p.openElements.hasInScope(tn)) {
3004
- p.openElements.generateImpliedEndTagsWithExclusion(tn);
3005
- p.openElements.popUntilTagNamePopped(tn);
3006
- }
3007
- }
3008
- function numberedHeaderEndTagInBody(p) {
3009
- if (p.openElements.hasNumberedHeaderInScope()) {
3010
- p.openElements.generateImpliedEndTags();
3011
- p.openElements.popUntilNumberedHeaderPopped();
3012
- }
3013
- }
3014
- function appletEndTagInBody(p, token) {
3015
- const tn = token.tagID;
3016
- if (p.openElements.hasInScope(tn)) {
3017
- p.openElements.generateImpliedEndTags();
3018
- p.openElements.popUntilTagNamePopped(tn);
3019
- p.activeFormattingElements.clearToLastMarker();
3020
- }
3021
- }
3022
- function brEndTagInBody(p) {
3023
- p._reconstructActiveFormattingElements();
3024
- p._insertFakeElement(TAG_NAMES.BR, TAG_ID.BR);
3025
- p.openElements.pop();
3026
- p.framesetOk = false;
3027
- }
3028
- function genericEndTagInBody(p, token) {
3029
- const tn = token.tagName;
3030
- const tid = token.tagID;
3031
- for (let i = p.openElements.stackTop; i > 0; i--) {
3032
- const element = p.openElements.items[i];
3033
- const elementId = p.openElements.tagIDs[i];
3034
- if (tid === elementId && (tid !== TAG_ID.UNKNOWN || p.treeAdapter.getTagName(element) === tn)) {
3035
- p.openElements.generateImpliedEndTagsWithExclusion(tid);
3036
- if (p.openElements.stackTop >= i)
3037
- p.openElements.shortenToLength(i);
3038
- break;
3039
- }
3040
- if (p._isSpecialElement(element, elementId)) {
3041
- break;
3042
- }
3043
- }
3044
- }
3045
- function endTagInBody(p, token) {
3046
- switch (token.tagID) {
3047
- case TAG_ID.A:
3048
- case TAG_ID.B:
3049
- case TAG_ID.I:
3050
- case TAG_ID.S:
3051
- case TAG_ID.U:
3052
- case TAG_ID.EM:
3053
- case TAG_ID.TT:
3054
- case TAG_ID.BIG:
3055
- case TAG_ID.CODE:
3056
- case TAG_ID.FONT:
3057
- case TAG_ID.NOBR:
3058
- case TAG_ID.SMALL:
3059
- case TAG_ID.STRIKE:
3060
- case TAG_ID.STRONG: {
3061
- callAdoptionAgency(p, token);
3062
- break;
3063
- }
3064
- case TAG_ID.P: {
3065
- pEndTagInBody(p);
3066
- break;
3067
- }
3068
- case TAG_ID.DL:
3069
- case TAG_ID.UL:
3070
- case TAG_ID.OL:
3071
- case TAG_ID.DIR:
3072
- case TAG_ID.DIV:
3073
- case TAG_ID.NAV:
3074
- case TAG_ID.PRE:
3075
- case TAG_ID.MAIN:
3076
- case TAG_ID.MENU:
3077
- case TAG_ID.ASIDE:
3078
- case TAG_ID.BUTTON:
3079
- case TAG_ID.CENTER:
3080
- case TAG_ID.FIGURE:
3081
- case TAG_ID.FOOTER:
3082
- case TAG_ID.HEADER:
3083
- case TAG_ID.HGROUP:
3084
- case TAG_ID.DIALOG:
3085
- case TAG_ID.ADDRESS:
3086
- case TAG_ID.ARTICLE:
3087
- case TAG_ID.DETAILS:
3088
- case TAG_ID.SEARCH:
3089
- case TAG_ID.SECTION:
3090
- case TAG_ID.SUMMARY:
3091
- case TAG_ID.LISTING:
3092
- case TAG_ID.FIELDSET:
3093
- case TAG_ID.BLOCKQUOTE:
3094
- case TAG_ID.FIGCAPTION: {
3095
- addressEndTagInBody(p, token);
3096
- break;
3097
- }
3098
- case TAG_ID.LI: {
3099
- liEndTagInBody(p);
3100
- break;
3101
- }
3102
- case TAG_ID.DD:
3103
- case TAG_ID.DT: {
3104
- ddEndTagInBody(p, token);
3105
- break;
3106
- }
3107
- case TAG_ID.H1:
3108
- case TAG_ID.H2:
3109
- case TAG_ID.H3:
3110
- case TAG_ID.H4:
3111
- case TAG_ID.H5:
3112
- case TAG_ID.H6: {
3113
- numberedHeaderEndTagInBody(p);
3114
- break;
3115
- }
3116
- case TAG_ID.BR: {
3117
- brEndTagInBody(p);
3118
- break;
3119
- }
3120
- case TAG_ID.BODY: {
3121
- bodyEndTagInBody(p, token);
3122
- break;
3123
- }
3124
- case TAG_ID.HTML: {
3125
- htmlEndTagInBody(p, token);
3126
- break;
3127
- }
3128
- case TAG_ID.FORM: {
3129
- formEndTagInBody(p);
3130
- break;
3131
- }
3132
- case TAG_ID.APPLET:
3133
- case TAG_ID.OBJECT:
3134
- case TAG_ID.MARQUEE: {
3135
- appletEndTagInBody(p, token);
3136
- break;
3137
- }
3138
- case TAG_ID.TEMPLATE: {
3139
- templateEndTagInHead(p, token);
3140
- break;
3141
- }
3142
- default: {
3143
- genericEndTagInBody(p, token);
3144
- }
3145
- }
3146
- }
3147
- function eofInBody(p, token) {
3148
- if (p.tmplInsertionModeStack.length > 0) {
3149
- eofInTemplate(p, token);
3150
- } else {
3151
- stopParsing(p, token);
3152
- }
3153
- }
3154
- function endTagInText(p, token) {
3155
- var _a;
3156
- if (token.tagID === TAG_ID.SCRIPT) {
3157
- (_a = p.scriptHandler) === null || _a === void 0 ? void 0 : _a.call(p, p.openElements.current);
3158
- }
3159
- p.openElements.pop();
3160
- p.insertionMode = p.originalInsertionMode;
3161
- }
3162
- function eofInText(p, token) {
3163
- p._err(token, ERR.eofInElementThatCanContainOnlyText);
3164
- p.openElements.pop();
3165
- p.insertionMode = p.originalInsertionMode;
3166
- p.onEof(token);
3167
- }
3168
- function characterInTable(p, token) {
3169
- if (p.openElements.currentTagId !== void 0 && TABLE_STRUCTURE_TAGS.has(p.openElements.currentTagId)) {
3170
- p.pendingCharacterTokens.length = 0;
3171
- p.hasNonWhitespacePendingCharacterToken = false;
3172
- p.originalInsertionMode = p.insertionMode;
3173
- p.insertionMode = InsertionMode.IN_TABLE_TEXT;
3174
- switch (token.type) {
3175
- case TokenType.CHARACTER: {
3176
- characterInTableText(p, token);
3177
- break;
3178
- }
3179
- case TokenType.WHITESPACE_CHARACTER: {
3180
- whitespaceCharacterInTableText(p, token);
3181
- break;
3182
- }
3183
- }
3184
- } else {
3185
- tokenInTable(p, token);
3186
- }
3187
- }
3188
- function captionStartTagInTable(p, token) {
3189
- p.openElements.clearBackToTableContext();
3190
- p.activeFormattingElements.insertMarker();
3191
- p._insertElement(token, NS.HTML);
3192
- p.insertionMode = InsertionMode.IN_CAPTION;
3193
- }
3194
- function colgroupStartTagInTable(p, token) {
3195
- p.openElements.clearBackToTableContext();
3196
- p._insertElement(token, NS.HTML);
3197
- p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
3198
- }
3199
- function colStartTagInTable(p, token) {
3200
- p.openElements.clearBackToTableContext();
3201
- p._insertFakeElement(TAG_NAMES.COLGROUP, TAG_ID.COLGROUP);
3202
- p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
3203
- startTagInColumnGroup(p, token);
3204
- }
3205
- function tbodyStartTagInTable(p, token) {
3206
- p.openElements.clearBackToTableContext();
3207
- p._insertElement(token, NS.HTML);
3208
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
3209
- }
3210
- function tdStartTagInTable(p, token) {
3211
- p.openElements.clearBackToTableContext();
3212
- p._insertFakeElement(TAG_NAMES.TBODY, TAG_ID.TBODY);
3213
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
3214
- startTagInTableBody(p, token);
3215
- }
3216
- function tableStartTagInTable(p, token) {
3217
- if (p.openElements.hasInTableScope(TAG_ID.TABLE)) {
3218
- p.openElements.popUntilTagNamePopped(TAG_ID.TABLE);
3219
- p._resetInsertionMode();
3220
- p._processStartTag(token);
3221
- }
3222
- }
3223
- function inputStartTagInTable(p, token) {
3224
- if (isHiddenInput(token)) {
3225
- p._appendElement(token, NS.HTML);
3226
- } else {
3227
- tokenInTable(p, token);
3228
- }
3229
- token.ackSelfClosing = true;
3230
- }
3231
- function formStartTagInTable(p, token) {
3232
- if (!p.formElement && p.openElements.tmplCount === 0) {
3233
- p._insertElement(token, NS.HTML);
3234
- p.formElement = p.openElements.current;
3235
- p.openElements.pop();
3236
- }
3237
- }
3238
- function startTagInTable(p, token) {
3239
- switch (token.tagID) {
3240
- case TAG_ID.TD:
3241
- case TAG_ID.TH:
3242
- case TAG_ID.TR: {
3243
- tdStartTagInTable(p, token);
3244
- break;
3245
- }
3246
- case TAG_ID.STYLE:
3247
- case TAG_ID.SCRIPT:
3248
- case TAG_ID.TEMPLATE: {
3249
- startTagInHead(p, token);
3250
- break;
3251
- }
3252
- case TAG_ID.COL: {
3253
- colStartTagInTable(p, token);
3254
- break;
3255
- }
3256
- case TAG_ID.FORM: {
3257
- formStartTagInTable(p, token);
3258
- break;
3259
- }
3260
- case TAG_ID.TABLE: {
3261
- tableStartTagInTable(p, token);
3262
- break;
3263
- }
3264
- case TAG_ID.TBODY:
3265
- case TAG_ID.TFOOT:
3266
- case TAG_ID.THEAD: {
3267
- tbodyStartTagInTable(p, token);
3268
- break;
3269
- }
3270
- case TAG_ID.INPUT: {
3271
- inputStartTagInTable(p, token);
3272
- break;
3273
- }
3274
- case TAG_ID.CAPTION: {
3275
- captionStartTagInTable(p, token);
3276
- break;
3277
- }
3278
- case TAG_ID.COLGROUP: {
3279
- colgroupStartTagInTable(p, token);
3280
- break;
3281
- }
3282
- default: {
3283
- tokenInTable(p, token);
3284
- }
3285
- }
3286
- }
3287
- function endTagInTable(p, token) {
3288
- switch (token.tagID) {
3289
- case TAG_ID.TABLE: {
3290
- if (p.openElements.hasInTableScope(TAG_ID.TABLE)) {
3291
- p.openElements.popUntilTagNamePopped(TAG_ID.TABLE);
3292
- p._resetInsertionMode();
3293
- }
3294
- break;
3295
- }
3296
- case TAG_ID.TEMPLATE: {
3297
- templateEndTagInHead(p, token);
3298
- break;
3299
- }
3300
- case TAG_ID.BODY:
3301
- case TAG_ID.CAPTION:
3302
- case TAG_ID.COL:
3303
- case TAG_ID.COLGROUP:
3304
- case TAG_ID.HTML:
3305
- case TAG_ID.TBODY:
3306
- case TAG_ID.TD:
3307
- case TAG_ID.TFOOT:
3308
- case TAG_ID.TH:
3309
- case TAG_ID.THEAD:
3310
- case TAG_ID.TR: {
3311
- break;
3312
- }
3313
- default: {
3314
- tokenInTable(p, token);
3315
- }
3316
- }
3317
- }
3318
- function tokenInTable(p, token) {
3319
- const savedFosterParentingState = p.fosterParentingEnabled;
3320
- p.fosterParentingEnabled = true;
3321
- modeInBody(p, token);
3322
- p.fosterParentingEnabled = savedFosterParentingState;
3323
- }
3324
- function whitespaceCharacterInTableText(p, token) {
3325
- p.pendingCharacterTokens.push(token);
3326
- }
3327
- function characterInTableText(p, token) {
3328
- p.pendingCharacterTokens.push(token);
3329
- p.hasNonWhitespacePendingCharacterToken = true;
3330
- }
3331
- function tokenInTableText(p, token) {
3332
- let i = 0;
3333
- if (p.hasNonWhitespacePendingCharacterToken) {
3334
- for (; i < p.pendingCharacterTokens.length; i++) {
3335
- tokenInTable(p, p.pendingCharacterTokens[i]);
3336
- }
3337
- } else {
3338
- for (; i < p.pendingCharacterTokens.length; i++) {
3339
- p._insertCharacters(p.pendingCharacterTokens[i]);
3340
- }
3341
- }
3342
- p.insertionMode = p.originalInsertionMode;
3343
- p._processToken(token);
3344
- }
3345
- var TABLE_VOID_ELEMENTS = /* @__PURE__ */ new Set([TAG_ID.CAPTION, TAG_ID.COL, TAG_ID.COLGROUP, TAG_ID.TBODY, TAG_ID.TD, TAG_ID.TFOOT, TAG_ID.TH, TAG_ID.THEAD, TAG_ID.TR]);
3346
- function startTagInCaption(p, token) {
3347
- const tn = token.tagID;
3348
- if (TABLE_VOID_ELEMENTS.has(tn)) {
3349
- if (p.openElements.hasInTableScope(TAG_ID.CAPTION)) {
3350
- p.openElements.generateImpliedEndTags();
3351
- p.openElements.popUntilTagNamePopped(TAG_ID.CAPTION);
3352
- p.activeFormattingElements.clearToLastMarker();
3353
- p.insertionMode = InsertionMode.IN_TABLE;
3354
- startTagInTable(p, token);
3355
- }
3356
- } else {
3357
- startTagInBody(p, token);
3358
- }
3359
- }
3360
- function endTagInCaption(p, token) {
3361
- const tn = token.tagID;
3362
- switch (tn) {
3363
- case TAG_ID.CAPTION:
3364
- case TAG_ID.TABLE: {
3365
- if (p.openElements.hasInTableScope(TAG_ID.CAPTION)) {
3366
- p.openElements.generateImpliedEndTags();
3367
- p.openElements.popUntilTagNamePopped(TAG_ID.CAPTION);
3368
- p.activeFormattingElements.clearToLastMarker();
3369
- p.insertionMode = InsertionMode.IN_TABLE;
3370
- if (tn === TAG_ID.TABLE) {
3371
- endTagInTable(p, token);
3372
- }
3373
- }
3374
- break;
3375
- }
3376
- case TAG_ID.BODY:
3377
- case TAG_ID.COL:
3378
- case TAG_ID.COLGROUP:
3379
- case TAG_ID.HTML:
3380
- case TAG_ID.TBODY:
3381
- case TAG_ID.TD:
3382
- case TAG_ID.TFOOT:
3383
- case TAG_ID.TH:
3384
- case TAG_ID.THEAD:
3385
- case TAG_ID.TR: {
3386
- break;
3387
- }
3388
- default: {
3389
- endTagInBody(p, token);
3390
- }
3391
- }
3392
- }
3393
- function startTagInColumnGroup(p, token) {
3394
- switch (token.tagID) {
3395
- case TAG_ID.HTML: {
3396
- startTagInBody(p, token);
3397
- break;
3398
- }
3399
- case TAG_ID.COL: {
3400
- p._appendElement(token, NS.HTML);
3401
- token.ackSelfClosing = true;
3402
- break;
3403
- }
3404
- case TAG_ID.TEMPLATE: {
3405
- startTagInHead(p, token);
3406
- break;
3407
- }
3408
- default: {
3409
- tokenInColumnGroup(p, token);
3410
- }
3411
- }
3412
- }
3413
- function endTagInColumnGroup(p, token) {
3414
- switch (token.tagID) {
3415
- case TAG_ID.COLGROUP: {
3416
- if (p.openElements.currentTagId === TAG_ID.COLGROUP) {
3417
- p.openElements.pop();
3418
- p.insertionMode = InsertionMode.IN_TABLE;
3419
- }
3420
- break;
3421
- }
3422
- case TAG_ID.TEMPLATE: {
3423
- templateEndTagInHead(p, token);
3424
- break;
3425
- }
3426
- case TAG_ID.COL: {
3427
- break;
3428
- }
3429
- default: {
3430
- tokenInColumnGroup(p, token);
3431
- }
3432
- }
3433
- }
3434
- function tokenInColumnGroup(p, token) {
3435
- if (p.openElements.currentTagId === TAG_ID.COLGROUP) {
3436
- p.openElements.pop();
3437
- p.insertionMode = InsertionMode.IN_TABLE;
3438
- p._processToken(token);
3439
- }
3440
- }
3441
- function startTagInTableBody(p, token) {
3442
- switch (token.tagID) {
3443
- case TAG_ID.TR: {
3444
- p.openElements.clearBackToTableBodyContext();
3445
- p._insertElement(token, NS.HTML);
3446
- p.insertionMode = InsertionMode.IN_ROW;
3447
- break;
3448
- }
3449
- case TAG_ID.TH:
3450
- case TAG_ID.TD: {
3451
- p.openElements.clearBackToTableBodyContext();
3452
- p._insertFakeElement(TAG_NAMES.TR, TAG_ID.TR);
3453
- p.insertionMode = InsertionMode.IN_ROW;
3454
- startTagInRow(p, token);
3455
- break;
3456
- }
3457
- case TAG_ID.CAPTION:
3458
- case TAG_ID.COL:
3459
- case TAG_ID.COLGROUP:
3460
- case TAG_ID.TBODY:
3461
- case TAG_ID.TFOOT:
3462
- case TAG_ID.THEAD: {
3463
- if (p.openElements.hasTableBodyContextInTableScope()) {
3464
- p.openElements.clearBackToTableBodyContext();
3465
- p.openElements.pop();
3466
- p.insertionMode = InsertionMode.IN_TABLE;
3467
- startTagInTable(p, token);
3468
- }
3469
- break;
3470
- }
3471
- default: {
3472
- startTagInTable(p, token);
3473
- }
3474
- }
3475
- }
3476
- function endTagInTableBody(p, token) {
3477
- const tn = token.tagID;
3478
- switch (token.tagID) {
3479
- case TAG_ID.TBODY:
3480
- case TAG_ID.TFOOT:
3481
- case TAG_ID.THEAD: {
3482
- if (p.openElements.hasInTableScope(tn)) {
3483
- p.openElements.clearBackToTableBodyContext();
3484
- p.openElements.pop();
3485
- p.insertionMode = InsertionMode.IN_TABLE;
3486
- }
3487
- break;
3488
- }
3489
- case TAG_ID.TABLE: {
3490
- if (p.openElements.hasTableBodyContextInTableScope()) {
3491
- p.openElements.clearBackToTableBodyContext();
3492
- p.openElements.pop();
3493
- p.insertionMode = InsertionMode.IN_TABLE;
3494
- endTagInTable(p, token);
3495
- }
3496
- break;
3497
- }
3498
- case TAG_ID.BODY:
3499
- case TAG_ID.CAPTION:
3500
- case TAG_ID.COL:
3501
- case TAG_ID.COLGROUP:
3502
- case TAG_ID.HTML:
3503
- case TAG_ID.TD:
3504
- case TAG_ID.TH:
3505
- case TAG_ID.TR: {
3506
- break;
3507
- }
3508
- default: {
3509
- endTagInTable(p, token);
3510
- }
3511
- }
3512
- }
3513
- function startTagInRow(p, token) {
3514
- switch (token.tagID) {
3515
- case TAG_ID.TH:
3516
- case TAG_ID.TD: {
3517
- p.openElements.clearBackToTableRowContext();
3518
- p._insertElement(token, NS.HTML);
3519
- p.insertionMode = InsertionMode.IN_CELL;
3520
- p.activeFormattingElements.insertMarker();
3521
- break;
3522
- }
3523
- case TAG_ID.CAPTION:
3524
- case TAG_ID.COL:
3525
- case TAG_ID.COLGROUP:
3526
- case TAG_ID.TBODY:
3527
- case TAG_ID.TFOOT:
3528
- case TAG_ID.THEAD:
3529
- case TAG_ID.TR: {
3530
- if (p.openElements.hasInTableScope(TAG_ID.TR)) {
3531
- p.openElements.clearBackToTableRowContext();
3532
- p.openElements.pop();
3533
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
3534
- startTagInTableBody(p, token);
3535
- }
3536
- break;
3537
- }
3538
- default: {
3539
- startTagInTable(p, token);
3540
- }
3541
- }
3542
- }
3543
- function endTagInRow(p, token) {
3544
- switch (token.tagID) {
3545
- case TAG_ID.TR: {
3546
- if (p.openElements.hasInTableScope(TAG_ID.TR)) {
3547
- p.openElements.clearBackToTableRowContext();
3548
- p.openElements.pop();
3549
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
3550
- }
3551
- break;
3552
- }
3553
- case TAG_ID.TABLE: {
3554
- if (p.openElements.hasInTableScope(TAG_ID.TR)) {
3555
- p.openElements.clearBackToTableRowContext();
3556
- p.openElements.pop();
3557
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
3558
- endTagInTableBody(p, token);
3559
- }
3560
- break;
3561
- }
3562
- case TAG_ID.TBODY:
3563
- case TAG_ID.TFOOT:
3564
- case TAG_ID.THEAD: {
3565
- if (p.openElements.hasInTableScope(token.tagID) || p.openElements.hasInTableScope(TAG_ID.TR)) {
3566
- p.openElements.clearBackToTableRowContext();
3567
- p.openElements.pop();
3568
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
3569
- endTagInTableBody(p, token);
3570
- }
3571
- break;
3572
- }
3573
- case TAG_ID.BODY:
3574
- case TAG_ID.CAPTION:
3575
- case TAG_ID.COL:
3576
- case TAG_ID.COLGROUP:
3577
- case TAG_ID.HTML:
3578
- case TAG_ID.TD:
3579
- case TAG_ID.TH: {
3580
- break;
3581
- }
3582
- default: {
3583
- endTagInTable(p, token);
3584
- }
3585
- }
3586
- }
3587
- function startTagInCell(p, token) {
3588
- const tn = token.tagID;
3589
- if (TABLE_VOID_ELEMENTS.has(tn)) {
3590
- if (p.openElements.hasInTableScope(TAG_ID.TD) || p.openElements.hasInTableScope(TAG_ID.TH)) {
3591
- p._closeTableCell();
3592
- startTagInRow(p, token);
3593
- }
3594
- } else {
3595
- startTagInBody(p, token);
3596
- }
3597
- }
3598
- function endTagInCell(p, token) {
3599
- const tn = token.tagID;
3600
- switch (tn) {
3601
- case TAG_ID.TD:
3602
- case TAG_ID.TH: {
3603
- if (p.openElements.hasInTableScope(tn)) {
3604
- p.openElements.generateImpliedEndTags();
3605
- p.openElements.popUntilTagNamePopped(tn);
3606
- p.activeFormattingElements.clearToLastMarker();
3607
- p.insertionMode = InsertionMode.IN_ROW;
3608
- }
3609
- break;
3610
- }
3611
- case TAG_ID.TABLE:
3612
- case TAG_ID.TBODY:
3613
- case TAG_ID.TFOOT:
3614
- case TAG_ID.THEAD:
3615
- case TAG_ID.TR: {
3616
- if (p.openElements.hasInTableScope(tn)) {
3617
- p._closeTableCell();
3618
- endTagInRow(p, token);
3619
- }
3620
- break;
3621
- }
3622
- case TAG_ID.BODY:
3623
- case TAG_ID.CAPTION:
3624
- case TAG_ID.COL:
3625
- case TAG_ID.COLGROUP:
3626
- case TAG_ID.HTML: {
3627
- break;
3628
- }
3629
- default: {
3630
- endTagInBody(p, token);
3631
- }
3632
- }
3633
- }
3634
- function startTagInSelect(p, token) {
3635
- switch (token.tagID) {
3636
- case TAG_ID.HTML: {
3637
- startTagInBody(p, token);
3638
- break;
3639
- }
3640
- case TAG_ID.OPTION: {
3641
- if (p.openElements.currentTagId === TAG_ID.OPTION) {
3642
- p.openElements.pop();
3643
- }
3644
- p._insertElement(token, NS.HTML);
3645
- break;
3646
- }
3647
- case TAG_ID.OPTGROUP: {
3648
- if (p.openElements.currentTagId === TAG_ID.OPTION) {
3649
- p.openElements.pop();
3650
- }
3651
- if (p.openElements.currentTagId === TAG_ID.OPTGROUP) {
3652
- p.openElements.pop();
3653
- }
3654
- p._insertElement(token, NS.HTML);
3655
- break;
3656
- }
3657
- case TAG_ID.HR: {
3658
- if (p.openElements.currentTagId === TAG_ID.OPTION) {
3659
- p.openElements.pop();
3660
- }
3661
- if (p.openElements.currentTagId === TAG_ID.OPTGROUP) {
3662
- p.openElements.pop();
3663
- }
3664
- p._appendElement(token, NS.HTML);
3665
- token.ackSelfClosing = true;
3666
- break;
3667
- }
3668
- case TAG_ID.INPUT:
3669
- case TAG_ID.KEYGEN:
3670
- case TAG_ID.TEXTAREA:
3671
- case TAG_ID.SELECT: {
3672
- if (p.openElements.hasInSelectScope(TAG_ID.SELECT)) {
3673
- p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
3674
- p._resetInsertionMode();
3675
- if (token.tagID !== TAG_ID.SELECT) {
3676
- p._processStartTag(token);
3677
- }
3678
- }
3679
- break;
3680
- }
3681
- case TAG_ID.SCRIPT:
3682
- case TAG_ID.TEMPLATE: {
3683
- startTagInHead(p, token);
3684
- break;
3685
- }
3686
- default:
3687
- }
3688
- }
3689
- function endTagInSelect(p, token) {
3690
- switch (token.tagID) {
3691
- case TAG_ID.OPTGROUP: {
3692
- if (p.openElements.stackTop > 0 && p.openElements.currentTagId === TAG_ID.OPTION && p.openElements.tagIDs[p.openElements.stackTop - 1] === TAG_ID.OPTGROUP) {
3693
- p.openElements.pop();
3694
- }
3695
- if (p.openElements.currentTagId === TAG_ID.OPTGROUP) {
3696
- p.openElements.pop();
3697
- }
3698
- break;
3699
- }
3700
- case TAG_ID.OPTION: {
3701
- if (p.openElements.currentTagId === TAG_ID.OPTION) {
3702
- p.openElements.pop();
3703
- }
3704
- break;
3705
- }
3706
- case TAG_ID.SELECT: {
3707
- if (p.openElements.hasInSelectScope(TAG_ID.SELECT)) {
3708
- p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
3709
- p._resetInsertionMode();
3710
- }
3711
- break;
3712
- }
3713
- case TAG_ID.TEMPLATE: {
3714
- templateEndTagInHead(p, token);
3715
- break;
3716
- }
3717
- default:
3718
- }
3719
- }
3720
- function startTagInSelectInTable(p, token) {
3721
- const tn = token.tagID;
3722
- if (tn === TAG_ID.CAPTION || tn === TAG_ID.TABLE || tn === TAG_ID.TBODY || tn === TAG_ID.TFOOT || tn === TAG_ID.THEAD || tn === TAG_ID.TR || tn === TAG_ID.TD || tn === TAG_ID.TH) {
3723
- p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
3724
- p._resetInsertionMode();
3725
- p._processStartTag(token);
3726
- } else {
3727
- startTagInSelect(p, token);
3728
- }
3729
- }
3730
- function endTagInSelectInTable(p, token) {
3731
- const tn = token.tagID;
3732
- if (tn === TAG_ID.CAPTION || tn === TAG_ID.TABLE || tn === TAG_ID.TBODY || tn === TAG_ID.TFOOT || tn === TAG_ID.THEAD || tn === TAG_ID.TR || tn === TAG_ID.TD || tn === TAG_ID.TH) {
3733
- if (p.openElements.hasInTableScope(tn)) {
3734
- p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
3735
- p._resetInsertionMode();
3736
- p.onEndTag(token);
3737
- }
3738
- } else {
3739
- endTagInSelect(p, token);
3740
- }
3741
- }
3742
- function startTagInTemplate(p, token) {
3743
- switch (token.tagID) {
3744
- // First, handle tags that can start without a mode change
3745
- case TAG_ID.BASE:
3746
- case TAG_ID.BASEFONT:
3747
- case TAG_ID.BGSOUND:
3748
- case TAG_ID.LINK:
3749
- case TAG_ID.META:
3750
- case TAG_ID.NOFRAMES:
3751
- case TAG_ID.SCRIPT:
3752
- case TAG_ID.STYLE:
3753
- case TAG_ID.TEMPLATE:
3754
- case TAG_ID.TITLE: {
3755
- startTagInHead(p, token);
3756
- break;
3757
- }
3758
- // Re-process the token in the appropriate mode
3759
- case TAG_ID.CAPTION:
3760
- case TAG_ID.COLGROUP:
3761
- case TAG_ID.TBODY:
3762
- case TAG_ID.TFOOT:
3763
- case TAG_ID.THEAD: {
3764
- p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE;
3765
- p.insertionMode = InsertionMode.IN_TABLE;
3766
- startTagInTable(p, token);
3767
- break;
3768
- }
3769
- case TAG_ID.COL: {
3770
- p.tmplInsertionModeStack[0] = InsertionMode.IN_COLUMN_GROUP;
3771
- p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
3772
- startTagInColumnGroup(p, token);
3773
- break;
3774
- }
3775
- case TAG_ID.TR: {
3776
- p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE_BODY;
3777
- p.insertionMode = InsertionMode.IN_TABLE_BODY;
3778
- startTagInTableBody(p, token);
3779
- break;
3780
- }
3781
- case TAG_ID.TD:
3782
- case TAG_ID.TH: {
3783
- p.tmplInsertionModeStack[0] = InsertionMode.IN_ROW;
3784
- p.insertionMode = InsertionMode.IN_ROW;
3785
- startTagInRow(p, token);
3786
- break;
3787
- }
3788
- default: {
3789
- p.tmplInsertionModeStack[0] = InsertionMode.IN_BODY;
3790
- p.insertionMode = InsertionMode.IN_BODY;
3791
- startTagInBody(p, token);
3792
- }
3793
- }
3794
- }
3795
- function endTagInTemplate(p, token) {
3796
- if (token.tagID === TAG_ID.TEMPLATE) {
3797
- templateEndTagInHead(p, token);
3798
- }
3799
- }
3800
- function eofInTemplate(p, token) {
3801
- if (p.openElements.tmplCount > 0) {
3802
- p.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE);
3803
- p.activeFormattingElements.clearToLastMarker();
3804
- p.tmplInsertionModeStack.shift();
3805
- p._resetInsertionMode();
3806
- p.onEof(token);
3807
- } else {
3808
- stopParsing(p, token);
3809
- }
3810
- }
3811
- function startTagAfterBody(p, token) {
3812
- if (token.tagID === TAG_ID.HTML) {
3813
- startTagInBody(p, token);
3814
- } else {
3815
- tokenAfterBody(p, token);
3816
- }
3817
- }
3818
- function endTagAfterBody(p, token) {
3819
- var _a;
3820
- if (token.tagID === TAG_ID.HTML) {
3821
- if (!p.fragmentContext) {
3822
- p.insertionMode = InsertionMode.AFTER_AFTER_BODY;
3823
- }
3824
- if (p.options.sourceCodeLocationInfo && p.openElements.tagIDs[0] === TAG_ID.HTML) {
3825
- p._setEndLocation(p.openElements.items[0], token);
3826
- const bodyElement = p.openElements.items[1];
3827
- if (bodyElement && !((_a = p.treeAdapter.getNodeSourceCodeLocation(bodyElement)) === null || _a === void 0 ? void 0 : _a.endTag)) {
3828
- p._setEndLocation(bodyElement, token);
3829
- }
3830
- }
3831
- } else {
3832
- tokenAfterBody(p, token);
3833
- }
3834
- }
3835
- function tokenAfterBody(p, token) {
3836
- p.insertionMode = InsertionMode.IN_BODY;
3837
- modeInBody(p, token);
3838
- }
3839
- function startTagInFrameset(p, token) {
3840
- switch (token.tagID) {
3841
- case TAG_ID.HTML: {
3842
- startTagInBody(p, token);
3843
- break;
3844
- }
3845
- case TAG_ID.FRAMESET: {
3846
- p._insertElement(token, NS.HTML);
3847
- break;
3848
- }
3849
- case TAG_ID.FRAME: {
3850
- p._appendElement(token, NS.HTML);
3851
- token.ackSelfClosing = true;
3852
- break;
3853
- }
3854
- case TAG_ID.NOFRAMES: {
3855
- startTagInHead(p, token);
3856
- break;
3857
- }
3858
- default:
3859
- }
3860
- }
3861
- function endTagInFrameset(p, token) {
3862
- if (token.tagID === TAG_ID.FRAMESET && !p.openElements.isRootHtmlElementCurrent()) {
3863
- p.openElements.pop();
3864
- if (!p.fragmentContext && p.openElements.currentTagId !== TAG_ID.FRAMESET) {
3865
- p.insertionMode = InsertionMode.AFTER_FRAMESET;
3866
- }
3867
- }
3868
- }
3869
- function startTagAfterFrameset(p, token) {
3870
- switch (token.tagID) {
3871
- case TAG_ID.HTML: {
3872
- startTagInBody(p, token);
3873
- break;
3874
- }
3875
- case TAG_ID.NOFRAMES: {
3876
- startTagInHead(p, token);
3877
- break;
3878
- }
3879
- default:
3880
- }
3881
- }
3882
- function endTagAfterFrameset(p, token) {
3883
- if (token.tagID === TAG_ID.HTML) {
3884
- p.insertionMode = InsertionMode.AFTER_AFTER_FRAMESET;
3885
- }
3886
- }
3887
- function startTagAfterAfterBody(p, token) {
3888
- if (token.tagID === TAG_ID.HTML) {
3889
- startTagInBody(p, token);
3890
- } else {
3891
- tokenAfterAfterBody(p, token);
3892
- }
3893
- }
3894
- function tokenAfterAfterBody(p, token) {
3895
- p.insertionMode = InsertionMode.IN_BODY;
3896
- modeInBody(p, token);
3897
- }
3898
- function startTagAfterAfterFrameset(p, token) {
3899
- switch (token.tagID) {
3900
- case TAG_ID.HTML: {
3901
- startTagInBody(p, token);
3902
- break;
3903
- }
3904
- case TAG_ID.NOFRAMES: {
3905
- startTagInHead(p, token);
3906
- break;
3907
- }
3908
- default:
3909
- }
3910
- }
3911
- function nullCharacterInForeignContent(p, token) {
3912
- token.chars = REPLACEMENT_CHARACTER;
3913
- p._insertCharacters(token);
3914
- }
3915
- function characterInForeignContent(p, token) {
3916
- p._insertCharacters(token);
3917
- p.framesetOk = false;
3918
- }
3919
- function popUntilHtmlOrIntegrationPoint(p) {
3920
- while (p.treeAdapter.getNamespaceURI(p.openElements.current) !== NS.HTML && p.openElements.currentTagId !== void 0 && !p._isIntegrationPoint(p.openElements.currentTagId, p.openElements.current)) {
3921
- p.openElements.pop();
3922
- }
3923
- }
3924
- function startTagInForeignContent(p, token) {
3925
- if (causesExit(token)) {
3926
- popUntilHtmlOrIntegrationPoint(p);
3927
- p._startTagOutsideForeignContent(token);
3928
- } else {
3929
- const current = p._getAdjustedCurrentElement();
3930
- const currentNs = p.treeAdapter.getNamespaceURI(current);
3931
- if (currentNs === NS.MATHML) {
3932
- adjustTokenMathMLAttrs(token);
3933
- } else if (currentNs === NS.SVG) {
3934
- adjustTokenSVGTagName(token);
3935
- adjustTokenSVGAttrs(token);
3936
- }
3937
- adjustTokenXMLAttrs(token);
3938
- if (token.selfClosing) {
3939
- p._appendElement(token, currentNs);
3940
- } else {
3941
- p._insertElement(token, currentNs);
3942
- }
3943
- token.ackSelfClosing = true;
3944
- }
3945
- }
3946
- function endTagInForeignContent(p, token) {
3947
- if (token.tagID === TAG_ID.P || token.tagID === TAG_ID.BR) {
3948
- popUntilHtmlOrIntegrationPoint(p);
3949
- p._endTagOutsideForeignContent(token);
3950
- return;
3951
- }
3952
- for (let i = p.openElements.stackTop; i > 0; i--) {
3953
- const element = p.openElements.items[i];
3954
- if (p.treeAdapter.getNamespaceURI(element) === NS.HTML) {
3955
- p._endTagOutsideForeignContent(token);
3956
- break;
3957
- }
3958
- const tagName = p.treeAdapter.getTagName(element);
3959
- if (tagName.toLowerCase() === token.tagName) {
3960
- token.tagName = tagName;
3961
- p.openElements.shortenToLength(i);
3962
- break;
3963
- }
3964
- }
3965
- }
3966
-
3967
- export {
3968
- defaultTreeAdapter,
3969
- Parser
3970
- };