@socialgen_user/socialgen 0.0.0-stage → 2.0.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 (655) hide show
  1. package/.output/nitro.json +15 -0
  2. package/.output/public/_nuxt/CM9bCtzQ.js +1 -0
  3. package/.output/public/_nuxt/CQBXt-Xj.js +4 -0
  4. package/.output/public/_nuxt/DGzMDps5.js +1 -0
  5. package/.output/public/_nuxt/DKdpYrB7.js +1 -0
  6. package/.output/public/_nuxt/DoO7LZEh.js +1 -0
  7. package/.output/public/_nuxt/NcMxVlo_.js +1 -0
  8. package/.output/public/_nuxt/_LypH0D7.js +1 -0
  9. package/.output/public/_nuxt/_mode_.XsuGEG0A.css +1 -0
  10. package/.output/public/_nuxt/builds/latest.json +1 -0
  11. package/.output/public/_nuxt/builds/meta/a8a06f55-e1a4-4d58-a8ac-5c8f3e91d730.json +1 -0
  12. package/.output/public/_nuxt/error-404.DL_4WIao.css +1 -0
  13. package/.output/public/_nuxt/error-500.I1Dtv2V5.css +1 -0
  14. package/.output/public/_nuxt/pages.Df3hoeGN.css +1 -0
  15. package/.output/public/audio/cyber_future_tech.mp3 +0 -0
  16. package/.output/public/audio/dark_phonk_pulse.mp3 +0 -0
  17. package/.output/public/audio/deep_finance_groove.mp3 +0 -0
  18. package/.output/public/audio/lofi_viral_study.mp3 +0 -0
  19. package/.output/public/audio/motivation_cinematic.mp3 +0 -0
  20. package/.output/public/videos/cyber_blue.mp4 +0 -0
  21. package/.output/public/videos/cyber_matrix_stream.mp4 +0 -0
  22. package/.output/public/videos/cyber_pulse.mp4 +0 -0
  23. package/.output/public/videos/dark_luxury_particles.mp4 +0 -0
  24. package/.output/public/videos/default_bg.mp4 +0 -0
  25. package/.output/public/videos/emerald_flow.mp4 +0 -0
  26. package/.output/public/videos/financial_pulse_flow.mp4 +0 -0
  27. package/.output/public/videos/neon_cyber_grid.mp4 +0 -0
  28. package/.output/server/chunks/_/error-500.mjs +19 -0
  29. package/.output/server/chunks/_/error-500.mjs.map +1 -0
  30. package/.output/server/chunks/_/nitro.mjs +5712 -0
  31. package/.output/server/chunks/_/nitro.mjs.map +1 -0
  32. package/.output/server/chunks/_/storage.mjs +44 -0
  33. package/.output/server/chunks/_/storage.mjs.map +1 -0
  34. package/.output/server/chunks/_/topicMatrix.mjs +147 -0
  35. package/.output/server/chunks/_/topicMatrix.mjs.map +1 -0
  36. package/.output/server/chunks/build/TableCard-Cvso4Mm4.mjs +399 -0
  37. package/.output/server/chunks/build/TableCard-Cvso4Mm4.mjs.map +1 -0
  38. package/.output/server/chunks/build/_mode_-MljTmkD8.mjs +65 -0
  39. package/.output/server/chunks/build/_mode_-MljTmkD8.mjs.map +1 -0
  40. package/.output/server/chunks/build/_mode_-styles.CcOMAYS9.mjs +8 -0
  41. package/.output/server/chunks/build/_mode_-styles.CcOMAYS9.mjs.map +1 -0
  42. package/.output/server/chunks/build/client.precomputed.mjs +4 -0
  43. package/.output/server/chunks/build/client.precomputed.mjs.map +1 -0
  44. package/.output/server/chunks/build/entry-styles.BUuHzwjd.mjs +8 -0
  45. package/.output/server/chunks/build/entry-styles.BUuHzwjd.mjs.map +1 -0
  46. package/.output/server/chunks/build/error-404-D7pndyXD.mjs +403 -0
  47. package/.output/server/chunks/build/error-404-D7pndyXD.mjs.map +1 -0
  48. package/.output/server/chunks/build/error-404-styles.ir-5M2eu.mjs +8 -0
  49. package/.output/server/chunks/build/error-404-styles.ir-5M2eu.mjs.map +1 -0
  50. package/.output/server/chunks/build/error-500-D0twnCBi.mjs +76 -0
  51. package/.output/server/chunks/build/error-500-D0twnCBi.mjs.map +1 -0
  52. package/.output/server/chunks/build/error-500-styles.DiQTnuqt.mjs +8 -0
  53. package/.output/server/chunks/build/error-500-styles.DiQTnuqt.mjs.map +1 -0
  54. package/.output/server/chunks/build/index-styles.CQioNwpv.mjs +8 -0
  55. package/.output/server/chunks/build/index-styles.CQioNwpv.mjs.map +1 -0
  56. package/.output/server/chunks/build/pages-BIiRN2UV.mjs +599 -0
  57. package/.output/server/chunks/build/pages-BIiRN2UV.mjs.map +1 -0
  58. package/.output/server/chunks/build/server.mjs +1115 -0
  59. package/.output/server/chunks/build/server.mjs.map +1 -0
  60. package/.output/server/chunks/build/styles.mjs +11 -0
  61. package/.output/server/chunks/build/styles.mjs.map +1 -0
  62. package/.output/server/chunks/build/v3-CmUYmHkx.mjs +22 -0
  63. package/.output/server/chunks/build/v3-CmUYmHkx.mjs.map +1 -0
  64. package/.output/server/chunks/routes/api/auto-topic.post.mjs +263 -0
  65. package/.output/server/chunks/routes/api/auto-topic.post.mjs.map +1 -0
  66. package/.output/server/chunks/routes/api/copy-prompt.get.mjs +125 -0
  67. package/.output/server/chunks/routes/api/copy-prompt.get.mjs.map +1 -0
  68. package/.output/server/chunks/routes/api/download.get.mjs +35 -0
  69. package/.output/server/chunks/routes/api/download.get.mjs.map +1 -0
  70. package/.output/server/chunks/routes/api/files/_...path_.get.mjs +36 -0
  71. package/.output/server/chunks/routes/api/files/_...path_.get.mjs.map +1 -0
  72. package/.output/server/chunks/routes/api/generate.post.mjs +441 -0
  73. package/.output/server/chunks/routes/api/generate.post.mjs.map +1 -0
  74. package/.output/server/chunks/routes/api/media.get.mjs +48 -0
  75. package/.output/server/chunks/routes/api/media.get.mjs.map +1 -0
  76. package/.output/server/chunks/routes/api/open-folder.post.mjs +29 -0
  77. package/.output/server/chunks/routes/api/open-folder.post.mjs.map +1 -0
  78. package/.output/server/chunks/routes/api/render-data.get.mjs +34 -0
  79. package/.output/server/chunks/routes/api/render-data.get.mjs.map +1 -0
  80. package/.output/server/chunks/routes/api/status.get.mjs +26 -0
  81. package/.output/server/chunks/routes/api/status.get.mjs.map +1 -0
  82. package/.output/server/chunks/routes/api/upload-media.post.mjs +75 -0
  83. package/.output/server/chunks/routes/api/upload-media.post.mjs.map +1 -0
  84. package/.output/server/chunks/routes/renderer.mjs +462 -0
  85. package/.output/server/chunks/routes/renderer.mjs.map +1 -0
  86. package/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
  87. package/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
  88. package/.output/server/index.mjs +39 -0
  89. package/.output/server/index.mjs.map +1 -0
  90. package/.output/server/node_modules/.nitro/entities@6.0.1/dist/esm/decode-codepoint.js +72 -0
  91. package/.output/server/node_modules/.nitro/entities@6.0.1/dist/esm/decode.js +497 -0
  92. package/.output/server/node_modules/.nitro/entities@6.0.1/dist/esm/escape.js +117 -0
  93. package/.output/server/node_modules/.nitro/entities@6.0.1/dist/esm/generated/decode-data-html.js +7 -0
  94. package/.output/server/node_modules/.nitro/entities@6.0.1/dist/esm/generated/decode-data-xml.js +7 -0
  95. package/.output/server/node_modules/.nitro/entities@6.0.1/dist/esm/package.json +3 -0
  96. package/.output/server/node_modules/.nitro/entities@6.0.1/package.json +118 -0
  97. package/.output/server/node_modules/.nitro/entities@7.0.1/dist/commonjs/decode-codepoint.js +77 -0
  98. package/.output/server/node_modules/.nitro/entities@7.0.1/dist/commonjs/decode.js +568 -0
  99. package/.output/server/node_modules/.nitro/entities@7.0.1/dist/commonjs/generated/decode-data-html.js +7 -0
  100. package/.output/server/node_modules/.nitro/entities@7.0.1/dist/commonjs/generated/decode-data-xml.js +7 -0
  101. package/.output/server/node_modules/.nitro/entities@7.0.1/dist/commonjs/internal/bin-trie-flags.js +21 -0
  102. package/.output/server/node_modules/.nitro/entities@7.0.1/dist/commonjs/internal/decode-shared.js +31 -0
  103. package/.output/server/node_modules/.nitro/entities@7.0.1/dist/commonjs/package.json +3 -0
  104. package/.output/server/node_modules/.nitro/entities@7.0.1/package.json +120 -0
  105. package/.output/server/node_modules/.nitro/minimatch@5.1.9/lib/path.js +4 -0
  106. package/.output/server/node_modules/.nitro/minimatch@5.1.9/minimatch.js +996 -0
  107. package/.output/server/node_modules/.nitro/minimatch@5.1.9/package.json +35 -0
  108. package/.output/server/node_modules/.nitro/minimatch@9.0.9/dist/commonjs/assert-valid-pattern.js +14 -0
  109. package/.output/server/node_modules/.nitro/minimatch@9.0.9/dist/commonjs/ast.js +747 -0
  110. package/.output/server/node_modules/.nitro/minimatch@9.0.9/dist/commonjs/brace-expressions.js +152 -0
  111. package/.output/server/node_modules/.nitro/minimatch@9.0.9/dist/commonjs/escape.js +22 -0
  112. package/.output/server/node_modules/.nitro/minimatch@9.0.9/dist/commonjs/index.js +1023 -0
  113. package/.output/server/node_modules/.nitro/minimatch@9.0.9/dist/commonjs/package.json +3 -0
  114. package/.output/server/node_modules/.nitro/minimatch@9.0.9/dist/commonjs/unescape.js +24 -0
  115. package/.output/server/node_modules/.nitro/minimatch@9.0.9/package.json +82 -0
  116. package/.output/server/node_modules/.nitro/readable-stream@2.3.8/lib/_stream_duplex.js +131 -0
  117. package/.output/server/node_modules/.nitro/readable-stream@2.3.8/lib/_stream_passthrough.js +47 -0
  118. package/.output/server/node_modules/.nitro/readable-stream@2.3.8/lib/_stream_readable.js +1019 -0
  119. package/.output/server/node_modules/.nitro/readable-stream@2.3.8/lib/_stream_transform.js +214 -0
  120. package/.output/server/node_modules/.nitro/readable-stream@2.3.8/lib/_stream_writable.js +685 -0
  121. package/.output/server/node_modules/.nitro/readable-stream@2.3.8/lib/internal/streams/BufferList.js +78 -0
  122. package/.output/server/node_modules/.nitro/readable-stream@2.3.8/lib/internal/streams/destroy.js +84 -0
  123. package/.output/server/node_modules/.nitro/readable-stream@2.3.8/lib/internal/streams/stream.js +1 -0
  124. package/.output/server/node_modules/.nitro/readable-stream@2.3.8/package.json +52 -0
  125. package/.output/server/node_modules/.nitro/readable-stream@2.3.8/passthrough.js +1 -0
  126. package/.output/server/node_modules/.nitro/readable-stream@2.3.8/readable.js +19 -0
  127. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/shims/process.js +19 -0
  128. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/add-abort-signal.js +52 -0
  129. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/buffer_list.js +157 -0
  130. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/compose.js +194 -0
  131. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/destroy.js +290 -0
  132. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/duplex.js +143 -0
  133. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/duplexify.js +378 -0
  134. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/end-of-stream.js +286 -0
  135. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/from.js +98 -0
  136. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/legacy.js +94 -0
  137. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/operators.js +457 -0
  138. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/passthrough.js +39 -0
  139. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/pipeline.js +471 -0
  140. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/readable.js +1290 -0
  141. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/state.js +39 -0
  142. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/transform.js +180 -0
  143. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/utils.js +327 -0
  144. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/streams/writable.js +819 -0
  145. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/internal/validators.js +530 -0
  146. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/ours/errors.js +343 -0
  147. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/ours/index.js +65 -0
  148. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/ours/primordials.js +124 -0
  149. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/ours/util/inspect.js +55 -0
  150. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/ours/util.js +148 -0
  151. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/stream/promises.js +43 -0
  152. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/lib/stream.js +143 -0
  153. package/.output/server/node_modules/.nitro/readable-stream@4.8.0/package.json +89 -0
  154. package/.output/server/node_modules/.nitro/safe-buffer@5.1.2/index.js +62 -0
  155. package/.output/server/node_modules/.nitro/safe-buffer@5.1.2/package.json +37 -0
  156. package/.output/server/node_modules/.nitro/safe-buffer@5.2.1/index.js +65 -0
  157. package/.output/server/node_modules/.nitro/safe-buffer@5.2.1/package.json +51 -0
  158. package/.output/server/node_modules/.nitro/string_decoder@1.1.1/lib/string_decoder.js +296 -0
  159. package/.output/server/node_modules/.nitro/string_decoder@1.1.1/package.json +31 -0
  160. package/.output/server/node_modules/.nitro/string_decoder@1.3.0/lib/string_decoder.js +296 -0
  161. package/.output/server/node_modules/.nitro/string_decoder@1.3.0/package.json +34 -0
  162. package/.output/server/node_modules/@babel/parser/lib/index.js +14990 -0
  163. package/.output/server/node_modules/@babel/parser/package.json +50 -0
  164. package/.output/server/node_modules/@google/genai/dist/node/index.mjs +32052 -0
  165. package/.output/server/node_modules/@google/genai/package.json +175 -0
  166. package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6806 -0
  167. package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
  168. package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +729 -0
  169. package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
  170. package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1460 -0
  171. package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  172. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/api.js +2 -0
  173. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/app.js +2 -0
  174. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/component.js +2 -0
  175. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/context.js +2 -0
  176. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/hooks.js +2 -0
  177. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/index.js +22 -0
  178. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/api/util.js +2 -0
  179. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/const.js +5 -0
  180. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/env.js +17 -0
  181. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/index.js +45 -0
  182. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/plugin.js +2 -0
  183. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/proxy.js +111 -0
  184. package/.output/server/node_modules/@vue/devtools-api/lib/cjs/time.js +28 -0
  185. package/.output/server/node_modules/@vue/devtools-api/package.json +37 -0
  186. package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1937 -0
  187. package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
  188. package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +7260 -0
  189. package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
  190. package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1932 -0
  191. package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
  192. package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +951 -0
  193. package/.output/server/node_modules/@vue/server-renderer/package.json +53 -0
  194. package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +657 -0
  195. package/.output/server/node_modules/@vue/shared/package.json +47 -0
  196. package/.output/server/node_modules/abort-controller/dist/abort-controller.js +127 -0
  197. package/.output/server/node_modules/abort-controller/package.json +97 -0
  198. package/.output/server/node_modules/agent-base/dist/helpers.js +66 -0
  199. package/.output/server/node_modules/agent-base/dist/index.js +178 -0
  200. package/.output/server/node_modules/agent-base/package.json +46 -0
  201. package/.output/server/node_modules/archiver/index.js +84 -0
  202. package/.output/server/node_modules/archiver/lib/core.js +974 -0
  203. package/.output/server/node_modules/archiver/lib/error.js +40 -0
  204. package/.output/server/node_modules/archiver/lib/plugins/json.js +110 -0
  205. package/.output/server/node_modules/archiver/lib/plugins/tar.js +167 -0
  206. package/.output/server/node_modules/archiver/lib/plugins/zip.js +120 -0
  207. package/.output/server/node_modules/archiver/package.json +60 -0
  208. package/.output/server/node_modules/archiver-utils/file.js +209 -0
  209. package/.output/server/node_modules/archiver-utils/index.js +155 -0
  210. package/.output/server/node_modules/archiver-utils/package.json +48 -0
  211. package/.output/server/node_modules/async/dist/async.js +6061 -0
  212. package/.output/server/node_modules/async/package.json +75 -0
  213. package/.output/server/node_modules/b4a/index.js +193 -0
  214. package/.output/server/node_modules/b4a/package.json +54 -0
  215. package/.output/server/node_modules/balanced-match/index.js +62 -0
  216. package/.output/server/node_modules/balanced-match/package.json +48 -0
  217. package/.output/server/node_modules/base64-js/index.js +150 -0
  218. package/.output/server/node_modules/base64-js/package.json +47 -0
  219. package/.output/server/node_modules/bignumber.js/bignumber.js +2922 -0
  220. package/.output/server/node_modules/bignumber.js/package.json +60 -0
  221. package/.output/server/node_modules/brace-expansion/index.js +633 -0
  222. package/.output/server/node_modules/brace-expansion/package.json +52 -0
  223. package/.output/server/node_modules/buffer-crc32/dist/index.cjs +306 -0
  224. package/.output/server/node_modules/buffer-crc32/package.json +54 -0
  225. package/.output/server/node_modules/buffer-equal-constant-time/index.js +41 -0
  226. package/.output/server/node_modules/buffer-equal-constant-time/package.json +21 -0
  227. package/.output/server/node_modules/compress-commons/lib/archivers/archive-entry.js +16 -0
  228. package/.output/server/node_modules/compress-commons/lib/archivers/archive-output-stream.js +118 -0
  229. package/.output/server/node_modules/compress-commons/lib/archivers/zip/constants.js +71 -0
  230. package/.output/server/node_modules/compress-commons/lib/archivers/zip/general-purpose-bit.js +101 -0
  231. package/.output/server/node_modules/compress-commons/lib/archivers/zip/unix-stat.js +53 -0
  232. package/.output/server/node_modules/compress-commons/lib/archivers/zip/util.js +74 -0
  233. package/.output/server/node_modules/compress-commons/lib/archivers/zip/zip-archive-entry.js +413 -0
  234. package/.output/server/node_modules/compress-commons/lib/archivers/zip/zip-archive-output-stream.js +437 -0
  235. package/.output/server/node_modules/compress-commons/lib/compress-commons.js +13 -0
  236. package/.output/server/node_modules/compress-commons/lib/util/index.js +27 -0
  237. package/.output/server/node_modules/compress-commons/package.json +46 -0
  238. package/.output/server/node_modules/core-util-is/lib/util.js +107 -0
  239. package/.output/server/node_modules/core-util-is/package.json +38 -0
  240. package/.output/server/node_modules/crc-32/crc32.js +115 -0
  241. package/.output/server/node_modules/crc-32/package.json +67 -0
  242. package/.output/server/node_modules/crc32-stream/lib/crc32-stream.js +48 -0
  243. package/.output/server/node_modules/crc32-stream/lib/deflate-crc32-stream.js +62 -0
  244. package/.output/server/node_modules/crc32-stream/lib/index.js +14 -0
  245. package/.output/server/node_modules/crc32-stream/package.json +45 -0
  246. package/.output/server/node_modules/data-uri-to-buffer/dist/index.js +53 -0
  247. package/.output/server/node_modules/data-uri-to-buffer/package.json +62 -0
  248. package/.output/server/node_modules/debug/package.json +64 -0
  249. package/.output/server/node_modules/debug/src/browser.js +272 -0
  250. package/.output/server/node_modules/debug/src/common.js +292 -0
  251. package/.output/server/node_modules/debug/src/index.js +10 -0
  252. package/.output/server/node_modules/debug/src/node.js +263 -0
  253. package/.output/server/node_modules/devalue/index.js +17 -0
  254. package/.output/server/node_modules/devalue/package.json +39 -0
  255. package/.output/server/node_modules/devalue/src/base64.js +60 -0
  256. package/.output/server/node_modules/devalue/src/constants.js +12 -0
  257. package/.output/server/node_modules/devalue/src/operations.js +221 -0
  258. package/.output/server/node_modules/devalue/src/parse.js +279 -0
  259. package/.output/server/node_modules/devalue/src/stringify.js +433 -0
  260. package/.output/server/node_modules/devalue/src/uneval.js +698 -0
  261. package/.output/server/node_modules/devalue/src/utils.js +190 -0
  262. package/.output/server/node_modules/ecdsa-sig-formatter/package.json +46 -0
  263. package/.output/server/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js +187 -0
  264. package/.output/server/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js +23 -0
  265. package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  266. package/.output/server/node_modules/estree-walker/package.json +37 -0
  267. package/.output/server/node_modules/event-target-shim/dist/event-target-shim.js +871 -0
  268. package/.output/server/node_modules/event-target-shim/package.json +82 -0
  269. package/.output/server/node_modules/events-universal/default.js +1 -0
  270. package/.output/server/node_modules/events-universal/package.json +39 -0
  271. package/.output/server/node_modules/extend/index.js +117 -0
  272. package/.output/server/node_modules/extend/package.json +42 -0
  273. package/.output/server/node_modules/fast-fifo/fixed-size.js +39 -0
  274. package/.output/server/node_modules/fast-fifo/index.js +48 -0
  275. package/.output/server/node_modules/fast-fifo/package.json +28 -0
  276. package/.output/server/node_modules/fetch-blob/file.js +49 -0
  277. package/.output/server/node_modules/fetch-blob/from.js +100 -0
  278. package/.output/server/node_modules/fetch-blob/index.js +250 -0
  279. package/.output/server/node_modules/fetch-blob/package.json +56 -0
  280. package/.output/server/node_modules/fetch-blob/streams.cjs +51 -0
  281. package/.output/server/node_modules/formdata-polyfill/esm.min.js +40 -0
  282. package/.output/server/node_modules/formdata-polyfill/package.json +50 -0
  283. package/.output/server/node_modules/gaxios/build/cjs/src/common.js +311 -0
  284. package/.output/server/node_modules/gaxios/build/cjs/src/gaxios.js +564 -0
  285. package/.output/server/node_modules/gaxios/build/cjs/src/index.js +48 -0
  286. package/.output/server/node_modules/gaxios/build/cjs/src/interceptor.js +22 -0
  287. package/.output/server/node_modules/gaxios/build/cjs/src/retry.js +165 -0
  288. package/.output/server/node_modules/gaxios/build/cjs/src/util.cjs +16 -0
  289. package/.output/server/node_modules/gaxios/package.json +105 -0
  290. package/.output/server/node_modules/gcp-metadata/build/src/gcp-residency.js +114 -0
  291. package/.output/server/node_modules/gcp-metadata/build/src/index.js +402 -0
  292. package/.output/server/node_modules/gcp-metadata/package.json +77 -0
  293. package/.output/server/node_modules/glob/dist/commonjs/glob.js +247 -0
  294. package/.output/server/node_modules/glob/dist/commonjs/has-magic.js +27 -0
  295. package/.output/server/node_modules/glob/dist/commonjs/ignore.js +119 -0
  296. package/.output/server/node_modules/glob/dist/commonjs/index.js +68 -0
  297. package/.output/server/node_modules/glob/dist/commonjs/package.json +3 -0
  298. package/.output/server/node_modules/glob/dist/commonjs/pattern.js +219 -0
  299. package/.output/server/node_modules/glob/dist/commonjs/processor.js +301 -0
  300. package/.output/server/node_modules/glob/dist/commonjs/walker.js +387 -0
  301. package/.output/server/node_modules/glob/package.json +99 -0
  302. package/.output/server/node_modules/google-auth-library/build/src/auth/authclient.js +286 -0
  303. package/.output/server/node_modules/google-auth-library/build/src/auth/awsclient.js +154 -0
  304. package/.output/server/node_modules/google-auth-library/build/src/auth/awsrequestsigner.js +213 -0
  305. package/.output/server/node_modules/google-auth-library/build/src/auth/baseexternalclient.js +477 -0
  306. package/.output/server/node_modules/google-auth-library/build/src/auth/certificatesubjecttokensupplier.js +223 -0
  307. package/.output/server/node_modules/google-auth-library/build/src/auth/computeclient.js +118 -0
  308. package/.output/server/node_modules/google-auth-library/build/src/auth/defaultawssecuritycredentialssupplier.js +199 -0
  309. package/.output/server/node_modules/google-auth-library/build/src/auth/downscopedclient.js +273 -0
  310. package/.output/server/node_modules/google-auth-library/build/src/auth/envDetect.js +97 -0
  311. package/.output/server/node_modules/google-auth-library/build/src/auth/executable-response.js +178 -0
  312. package/.output/server/node_modules/google-auth-library/build/src/auth/externalAccountAuthorizedUserClient.js +233 -0
  313. package/.output/server/node_modules/google-auth-library/build/src/auth/externalclient.js +68 -0
  314. package/.output/server/node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.js +84 -0
  315. package/.output/server/node_modules/google-auth-library/build/src/auth/gdchclient.js +307 -0
  316. package/.output/server/node_modules/google-auth-library/build/src/auth/googleauth.js +921 -0
  317. package/.output/server/node_modules/google-auth-library/build/src/auth/iam.js +44 -0
  318. package/.output/server/node_modules/google-auth-library/build/src/auth/identitypoolclient.js +131 -0
  319. package/.output/server/node_modules/google-auth-library/build/src/auth/idtokenclient.js +56 -0
  320. package/.output/server/node_modules/google-auth-library/build/src/auth/impersonated.js +197 -0
  321. package/.output/server/node_modules/google-auth-library/build/src/auth/jwtaccess.js +201 -0
  322. package/.output/server/node_modules/google-auth-library/build/src/auth/jwtclient.js +301 -0
  323. package/.output/server/node_modules/google-auth-library/build/src/auth/loginticket.js +60 -0
  324. package/.output/server/node_modules/google-auth-library/build/src/auth/oauth2client.js +820 -0
  325. package/.output/server/node_modules/google-auth-library/build/src/auth/oauth2common.js +189 -0
  326. package/.output/server/node_modules/google-auth-library/build/src/auth/passthrough.js +60 -0
  327. package/.output/server/node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js +220 -0
  328. package/.output/server/node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.js +174 -0
  329. package/.output/server/node_modules/google-auth-library/build/src/auth/refreshclient.js +160 -0
  330. package/.output/server/node_modules/google-auth-library/build/src/auth/stscredentials.js +107 -0
  331. package/.output/server/node_modules/google-auth-library/build/src/auth/urlsubjecttokensupplier.js +71 -0
  332. package/.output/server/node_modules/google-auth-library/build/src/crypto/browser/crypto.js +127 -0
  333. package/.output/server/node_modules/google-auth-library/build/src/crypto/crypto.js +54 -0
  334. package/.output/server/node_modules/google-auth-library/build/src/crypto/node/crypto.js +88 -0
  335. package/.output/server/node_modules/google-auth-library/build/src/crypto/shared.js +32 -0
  336. package/.output/server/node_modules/google-auth-library/build/src/gtoken/errorWithCode.js +25 -0
  337. package/.output/server/node_modules/google-auth-library/build/src/gtoken/getCredentials.js +132 -0
  338. package/.output/server/node_modules/google-auth-library/build/src/gtoken/getToken.js +66 -0
  339. package/.output/server/node_modules/google-auth-library/build/src/gtoken/googleToken.js +125 -0
  340. package/.output/server/node_modules/google-auth-library/build/src/gtoken/jwsSign.js +54 -0
  341. package/.output/server/node_modules/google-auth-library/build/src/gtoken/revokeToken.js +34 -0
  342. package/.output/server/node_modules/google-auth-library/build/src/gtoken/tokenHandler.js +97 -0
  343. package/.output/server/node_modules/google-auth-library/build/src/index.js +88 -0
  344. package/.output/server/node_modules/google-auth-library/build/src/shared.cjs +22 -0
  345. package/.output/server/node_modules/google-auth-library/build/src/util.js +176 -0
  346. package/.output/server/node_modules/google-auth-library/package.json +90 -0
  347. package/.output/server/node_modules/google-logging-utils/build/src/colours.js +81 -0
  348. package/.output/server/node_modules/google-logging-utils/build/src/index.js +31 -0
  349. package/.output/server/node_modules/google-logging-utils/build/src/logging-utils.js +437 -0
  350. package/.output/server/node_modules/google-logging-utils/package.json +45 -0
  351. package/.output/server/node_modules/graceful-fs/clone.js +23 -0
  352. package/.output/server/node_modules/graceful-fs/graceful-fs.js +448 -0
  353. package/.output/server/node_modules/graceful-fs/legacy-streams.js +118 -0
  354. package/.output/server/node_modules/graceful-fs/package.json +52 -0
  355. package/.output/server/node_modules/graceful-fs/polyfills.js +355 -0
  356. package/.output/server/node_modules/has-flag/index.js +8 -0
  357. package/.output/server/node_modules/has-flag/package.json +46 -0
  358. package/.output/server/node_modules/hookable/dist/index.mjs +257 -0
  359. package/.output/server/node_modules/hookable/package.json +54 -0
  360. package/.output/server/node_modules/https-proxy-agent/dist/index.js +180 -0
  361. package/.output/server/node_modules/https-proxy-agent/dist/parse-proxy-response.js +101 -0
  362. package/.output/server/node_modules/https-proxy-agent/package.json +50 -0
  363. package/.output/server/node_modules/inherits/inherits.js +9 -0
  364. package/.output/server/node_modules/inherits/inherits_browser.js +27 -0
  365. package/.output/server/node_modules/inherits/package.json +29 -0
  366. package/.output/server/node_modules/is-stream/index.js +28 -0
  367. package/.output/server/node_modules/is-stream/package.json +42 -0
  368. package/.output/server/node_modules/isarray/index.js +5 -0
  369. package/.output/server/node_modules/isarray/package.json +45 -0
  370. package/.output/server/node_modules/json-bigint/index.js +12 -0
  371. package/.output/server/node_modules/json-bigint/lib/parse.js +443 -0
  372. package/.output/server/node_modules/json-bigint/lib/stringify.js +384 -0
  373. package/.output/server/node_modules/json-bigint/package.json +34 -0
  374. package/.output/server/node_modules/jwa/index.js +266 -0
  375. package/.output/server/node_modules/jwa/package.json +37 -0
  376. package/.output/server/node_modules/jws/index.js +22 -0
  377. package/.output/server/node_modules/jws/lib/data-stream.js +55 -0
  378. package/.output/server/node_modules/jws/lib/sign-stream.js +83 -0
  379. package/.output/server/node_modules/jws/lib/tostring.js +10 -0
  380. package/.output/server/node_modules/jws/lib/verify-stream.js +125 -0
  381. package/.output/server/node_modules/jws/package.json +34 -0
  382. package/.output/server/node_modules/lazystream/lib/lazystream.js +54 -0
  383. package/.output/server/node_modules/lazystream/package.json +46 -0
  384. package/.output/server/node_modules/lodash/_Hash.js +32 -0
  385. package/.output/server/node_modules/lodash/_ListCache.js +32 -0
  386. package/.output/server/node_modules/lodash/_Map.js +7 -0
  387. package/.output/server/node_modules/lodash/_MapCache.js +32 -0
  388. package/.output/server/node_modules/lodash/_Set.js +7 -0
  389. package/.output/server/node_modules/lodash/_SetCache.js +27 -0
  390. package/.output/server/node_modules/lodash/_Symbol.js +6 -0
  391. package/.output/server/node_modules/lodash/_apply.js +21 -0
  392. package/.output/server/node_modules/lodash/_arrayIncludes.js +17 -0
  393. package/.output/server/node_modules/lodash/_arrayIncludesWith.js +22 -0
  394. package/.output/server/node_modules/lodash/_arrayLikeKeys.js +49 -0
  395. package/.output/server/node_modules/lodash/_arrayMap.js +21 -0
  396. package/.output/server/node_modules/lodash/_arrayPush.js +20 -0
  397. package/.output/server/node_modules/lodash/_assocIndexOf.js +21 -0
  398. package/.output/server/node_modules/lodash/_baseDifference.js +67 -0
  399. package/.output/server/node_modules/lodash/_baseFindIndex.js +24 -0
  400. package/.output/server/node_modules/lodash/_baseFlatten.js +38 -0
  401. package/.output/server/node_modules/lodash/_baseGetTag.js +28 -0
  402. package/.output/server/node_modules/lodash/_baseIndexOf.js +20 -0
  403. package/.output/server/node_modules/lodash/_baseIsArguments.js +18 -0
  404. package/.output/server/node_modules/lodash/_baseIsNaN.js +12 -0
  405. package/.output/server/node_modules/lodash/_baseIsNative.js +47 -0
  406. package/.output/server/node_modules/lodash/_baseIsTypedArray.js +60 -0
  407. package/.output/server/node_modules/lodash/_baseKeysIn.js +33 -0
  408. package/.output/server/node_modules/lodash/_baseRest.js +17 -0
  409. package/.output/server/node_modules/lodash/_baseSetToString.js +22 -0
  410. package/.output/server/node_modules/lodash/_baseTimes.js +20 -0
  411. package/.output/server/node_modules/lodash/_baseUnary.js +14 -0
  412. package/.output/server/node_modules/lodash/_baseUniq.js +72 -0
  413. package/.output/server/node_modules/lodash/_cacheHas.js +13 -0
  414. package/.output/server/node_modules/lodash/_coreJsData.js +6 -0
  415. package/.output/server/node_modules/lodash/_createSet.js +19 -0
  416. package/.output/server/node_modules/lodash/_defineProperty.js +11 -0
  417. package/.output/server/node_modules/lodash/_freeGlobal.js +4 -0
  418. package/.output/server/node_modules/lodash/_getMapData.js +18 -0
  419. package/.output/server/node_modules/lodash/_getNative.js +17 -0
  420. package/.output/server/node_modules/lodash/_getPrototype.js +6 -0
  421. package/.output/server/node_modules/lodash/_getRawTag.js +46 -0
  422. package/.output/server/node_modules/lodash/_getValue.js +13 -0
  423. package/.output/server/node_modules/lodash/_hashClear.js +15 -0
  424. package/.output/server/node_modules/lodash/_hashDelete.js +17 -0
  425. package/.output/server/node_modules/lodash/_hashGet.js +30 -0
  426. package/.output/server/node_modules/lodash/_hashHas.js +23 -0
  427. package/.output/server/node_modules/lodash/_hashSet.js +23 -0
  428. package/.output/server/node_modules/lodash/_isFlattenable.js +20 -0
  429. package/.output/server/node_modules/lodash/_isIndex.js +25 -0
  430. package/.output/server/node_modules/lodash/_isIterateeCall.js +30 -0
  431. package/.output/server/node_modules/lodash/_isKeyable.js +15 -0
  432. package/.output/server/node_modules/lodash/_isMasked.js +20 -0
  433. package/.output/server/node_modules/lodash/_isPrototype.js +18 -0
  434. package/.output/server/node_modules/lodash/_listCacheClear.js +13 -0
  435. package/.output/server/node_modules/lodash/_listCacheDelete.js +35 -0
  436. package/.output/server/node_modules/lodash/_listCacheGet.js +19 -0
  437. package/.output/server/node_modules/lodash/_listCacheHas.js +16 -0
  438. package/.output/server/node_modules/lodash/_listCacheSet.js +26 -0
  439. package/.output/server/node_modules/lodash/_mapCacheClear.js +21 -0
  440. package/.output/server/node_modules/lodash/_mapCacheDelete.js +18 -0
  441. package/.output/server/node_modules/lodash/_mapCacheGet.js +16 -0
  442. package/.output/server/node_modules/lodash/_mapCacheHas.js +16 -0
  443. package/.output/server/node_modules/lodash/_mapCacheSet.js +22 -0
  444. package/.output/server/node_modules/lodash/_nativeCreate.js +6 -0
  445. package/.output/server/node_modules/lodash/_nativeKeysIn.js +20 -0
  446. package/.output/server/node_modules/lodash/_nodeUtil.js +30 -0
  447. package/.output/server/node_modules/lodash/_objectToString.js +22 -0
  448. package/.output/server/node_modules/lodash/_overArg.js +15 -0
  449. package/.output/server/node_modules/lodash/_overRest.js +36 -0
  450. package/.output/server/node_modules/lodash/_root.js +9 -0
  451. package/.output/server/node_modules/lodash/_setCacheAdd.js +19 -0
  452. package/.output/server/node_modules/lodash/_setCacheHas.js +14 -0
  453. package/.output/server/node_modules/lodash/_setToArray.js +18 -0
  454. package/.output/server/node_modules/lodash/_setToString.js +14 -0
  455. package/.output/server/node_modules/lodash/_shortOut.js +37 -0
  456. package/.output/server/node_modules/lodash/_strictIndexOf.js +23 -0
  457. package/.output/server/node_modules/lodash/_toSource.js +26 -0
  458. package/.output/server/node_modules/lodash/constant.js +26 -0
  459. package/.output/server/node_modules/lodash/defaults.js +64 -0
  460. package/.output/server/node_modules/lodash/difference.js +33 -0
  461. package/.output/server/node_modules/lodash/eq.js +37 -0
  462. package/.output/server/node_modules/lodash/flatten.js +22 -0
  463. package/.output/server/node_modules/lodash/identity.js +21 -0
  464. package/.output/server/node_modules/lodash/isArguments.js +36 -0
  465. package/.output/server/node_modules/lodash/isArray.js +26 -0
  466. package/.output/server/node_modules/lodash/isArrayLike.js +33 -0
  467. package/.output/server/node_modules/lodash/isArrayLikeObject.js +33 -0
  468. package/.output/server/node_modules/lodash/isBuffer.js +38 -0
  469. package/.output/server/node_modules/lodash/isFunction.js +37 -0
  470. package/.output/server/node_modules/lodash/isLength.js +35 -0
  471. package/.output/server/node_modules/lodash/isObject.js +31 -0
  472. package/.output/server/node_modules/lodash/isObjectLike.js +29 -0
  473. package/.output/server/node_modules/lodash/isPlainObject.js +62 -0
  474. package/.output/server/node_modules/lodash/isTypedArray.js +27 -0
  475. package/.output/server/node_modules/lodash/keysIn.js +32 -0
  476. package/.output/server/node_modules/lodash/noop.js +17 -0
  477. package/.output/server/node_modules/lodash/package.json +19 -0
  478. package/.output/server/node_modules/lodash/stubFalse.js +18 -0
  479. package/.output/server/node_modules/lodash/union.js +26 -0
  480. package/.output/server/node_modules/lru-cache/dist/commonjs/index.js +1546 -0
  481. package/.output/server/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  482. package/.output/server/node_modules/lru-cache/package.json +116 -0
  483. package/.output/server/node_modules/lucide-vue-next/dist/cjs/lucide-vue-next.js +21273 -0
  484. package/.output/server/node_modules/lucide-vue-next/package.json +64 -0
  485. package/.output/server/node_modules/minipass/dist/commonjs/index.js +1038 -0
  486. package/.output/server/node_modules/minipass/dist/commonjs/package.json +3 -0
  487. package/.output/server/node_modules/minipass/package.json +77 -0
  488. package/.output/server/node_modules/ms/index.js +162 -0
  489. package/.output/server/node_modules/ms/package.json +38 -0
  490. package/.output/server/node_modules/node-domexception/index.js +16 -0
  491. package/.output/server/node_modules/node-domexception/package.json +29 -0
  492. package/.output/server/node_modules/node-fetch/package.json +131 -0
  493. package/.output/server/node_modules/node-fetch/src/body.js +397 -0
  494. package/.output/server/node_modules/node-fetch/src/errors/abort-error.js +10 -0
  495. package/.output/server/node_modules/node-fetch/src/errors/base.js +17 -0
  496. package/.output/server/node_modules/node-fetch/src/errors/fetch-error.js +26 -0
  497. package/.output/server/node_modules/node-fetch/src/headers.js +267 -0
  498. package/.output/server/node_modules/node-fetch/src/index.js +417 -0
  499. package/.output/server/node_modules/node-fetch/src/request.js +313 -0
  500. package/.output/server/node_modules/node-fetch/src/response.js +160 -0
  501. package/.output/server/node_modules/node-fetch/src/utils/get-search.js +9 -0
  502. package/.output/server/node_modules/node-fetch/src/utils/is-redirect.js +11 -0
  503. package/.output/server/node_modules/node-fetch/src/utils/is.js +87 -0
  504. package/.output/server/node_modules/node-fetch/src/utils/multipart-parser.js +432 -0
  505. package/.output/server/node_modules/node-fetch/src/utils/referrer.js +340 -0
  506. package/.output/server/node_modules/normalize-path/index.js +35 -0
  507. package/.output/server/node_modules/normalize-path/package.json +77 -0
  508. package/.output/server/node_modules/p-retry/index.js +85 -0
  509. package/.output/server/node_modules/p-retry/package.json +51 -0
  510. package/.output/server/node_modules/parse5/dist/common/doctype.js +114 -0
  511. package/.output/server/node_modules/parse5/dist/common/error-codes.js +63 -0
  512. package/.output/server/node_modules/parse5/dist/common/foreign-content.js +228 -0
  513. package/.output/server/node_modules/parse5/dist/common/html.js +523 -0
  514. package/.output/server/node_modules/parse5/dist/common/token.js +20 -0
  515. package/.output/server/node_modules/parse5/dist/common/unicode.js +62 -0
  516. package/.output/server/node_modules/parse5/dist/index.js +42 -0
  517. package/.output/server/node_modules/parse5/dist/parser/formatting-element-list.js +110 -0
  518. package/.output/server/node_modules/parse5/dist/parser/index.js +3245 -0
  519. package/.output/server/node_modules/parse5/dist/parser/open-element-stack.js +324 -0
  520. package/.output/server/node_modules/parse5/dist/serializer/index.js +168 -0
  521. package/.output/server/node_modules/parse5/dist/tokenizer/index.js +2710 -0
  522. package/.output/server/node_modules/parse5/dist/tokenizer/preprocessor.js +196 -0
  523. package/.output/server/node_modules/parse5/dist/tree-adapters/default.js +173 -0
  524. package/.output/server/node_modules/parse5/package.json +50 -0
  525. package/.output/server/node_modules/path-scurry/dist/commonjs/index.js +2014 -0
  526. package/.output/server/node_modules/path-scurry/dist/commonjs/package.json +3 -0
  527. package/.output/server/node_modules/path-scurry/package.json +89 -0
  528. package/.output/server/node_modules/playwright/index.mjs +18 -0
  529. package/.output/server/node_modules/playwright/package.json +50 -0
  530. package/.output/server/node_modules/playwright-core/browsers.json +52 -0
  531. package/.output/server/node_modules/playwright-core/index.js +17 -0
  532. package/.output/server/node_modules/playwright-core/index.mjs +28 -0
  533. package/.output/server/node_modules/playwright-core/lib/bootstrap.js +149 -0
  534. package/.output/server/node_modules/playwright-core/lib/coreBundle.js +78764 -0
  535. package/.output/server/node_modules/playwright-core/lib/utilsBundle.js +92408 -0
  536. package/.output/server/node_modules/playwright-core/package.json +34 -0
  537. package/.output/server/node_modules/process/index.js +2 -0
  538. package/.output/server/node_modules/process/package.json +27 -0
  539. package/.output/server/node_modules/process-nextick-args/index.js +45 -0
  540. package/.output/server/node_modules/process-nextick-args/package.json +25 -0
  541. package/.output/server/node_modules/readdir-glob/index.js +243 -0
  542. package/.output/server/node_modules/readdir-glob/package.json +43 -0
  543. package/.output/server/node_modules/retry/index.js +1 -0
  544. package/.output/server/node_modules/retry/lib/retry.js +100 -0
  545. package/.output/server/node_modules/retry/lib/retry_operation.js +162 -0
  546. package/.output/server/node_modules/retry/package.json +36 -0
  547. package/.output/server/node_modules/source-map-js/lib/array-set.js +123 -0
  548. package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +136 -0
  549. package/.output/server/node_modules/source-map-js/lib/base64.js +68 -0
  550. package/.output/server/node_modules/source-map-js/lib/binary-search.js +115 -0
  551. package/.output/server/node_modules/source-map-js/lib/mapping-list.js +84 -0
  552. package/.output/server/node_modules/source-map-js/lib/quick-sort.js +211 -0
  553. package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1314 -0
  554. package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +486 -0
  555. package/.output/server/node_modules/source-map-js/lib/source-node.js +446 -0
  556. package/.output/server/node_modules/source-map-js/lib/util.js +613 -0
  557. package/.output/server/node_modules/source-map-js/package.json +78 -0
  558. package/.output/server/node_modules/source-map-js/source-map.js +10 -0
  559. package/.output/server/node_modules/streamx/index.js +1314 -0
  560. package/.output/server/node_modules/streamx/lib/errors.js +47 -0
  561. package/.output/server/node_modules/streamx/package.json +51 -0
  562. package/.output/server/node_modules/supports-color/index.js +135 -0
  563. package/.output/server/node_modules/supports-color/package.json +53 -0
  564. package/.output/server/node_modules/tar-stream/constants.js +14 -0
  565. package/.output/server/node_modules/tar-stream/extract.js +418 -0
  566. package/.output/server/node_modules/tar-stream/headers.js +322 -0
  567. package/.output/server/node_modules/tar-stream/index.js +2 -0
  568. package/.output/server/node_modules/tar-stream/pack.js +287 -0
  569. package/.output/server/node_modules/tar-stream/package.json +50 -0
  570. package/.output/server/node_modules/text-decoder/index.js +64 -0
  571. package/.output/server/node_modules/text-decoder/lib/pass-through-decoder.js +19 -0
  572. package/.output/server/node_modules/text-decoder/lib/utf8-decoder.js +185 -0
  573. package/.output/server/node_modules/text-decoder/package.json +39 -0
  574. package/.output/server/node_modules/ufo/dist/index.mjs +645 -0
  575. package/.output/server/node_modules/ufo/package.json +48 -0
  576. package/.output/server/node_modules/unhead/dist/index.mjs +9 -0
  577. package/.output/server/node_modules/unhead/dist/plugins.mjs +103 -0
  578. package/.output/server/node_modules/unhead/dist/scripts.mjs +30 -0
  579. package/.output/server/node_modules/unhead/dist/server.mjs +191 -0
  580. package/.output/server/node_modules/unhead/dist/shared/unhead.0TIQaUam.mjs +244 -0
  581. package/.output/server/node_modules/unhead/dist/shared/unhead.AtIkjM2B.mjs +166 -0
  582. package/.output/server/node_modules/unhead/dist/shared/unhead.AvDFlk_u.mjs +39 -0
  583. package/.output/server/node_modules/unhead/dist/shared/unhead.B0o2oYhg.mjs +317 -0
  584. package/.output/server/node_modules/unhead/dist/shared/unhead.BYvz9V1x.mjs +43 -0
  585. package/.output/server/node_modules/unhead/dist/shared/unhead.ByHeIeZd.mjs +184 -0
  586. package/.output/server/node_modules/unhead/dist/shared/unhead.C-69jnXc.mjs +44 -0
  587. package/.output/server/node_modules/unhead/dist/shared/unhead.ChXiQvI8.mjs +76 -0
  588. package/.output/server/node_modules/unhead/dist/shared/unhead.DWXHYkPf.mjs +366 -0
  589. package/.output/server/node_modules/unhead/dist/shared/unhead.h_KkEIE6.mjs +196 -0
  590. package/.output/server/node_modules/unhead/dist/shared/unhead.ylJpsHyA.mjs +255 -0
  591. package/.output/server/node_modules/unhead/dist/utils.mjs +5 -0
  592. package/.output/server/node_modules/unhead/package.json +106 -0
  593. package/.output/server/node_modules/util-deprecate/node.js +6 -0
  594. package/.output/server/node_modules/util-deprecate/package.json +27 -0
  595. package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
  596. package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  597. package/.output/server/node_modules/vue/index.js +7 -0
  598. package/.output/server/node_modules/vue/index.mjs +1 -0
  599. package/.output/server/node_modules/vue/package.json +112 -0
  600. package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
  601. package/.output/server/node_modules/vue-bundle-renderer/dist/dependencies-VCG-RX19.mjs +118 -0
  602. package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +673 -0
  603. package/.output/server/node_modules/vue-bundle-renderer/package.json +66 -0
  604. package/.output/server/node_modules/vue-router/dist/devtools-C3Hva4Qk.mjs +1220 -0
  605. package/.output/server/node_modules/vue-router/dist/vue-router.mjs +1561 -0
  606. package/.output/server/node_modules/vue-router/package.json +156 -0
  607. package/.output/server/node_modules/vue-router/vue-router.node.mjs +2 -0
  608. package/.output/server/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +4737 -0
  609. package/.output/server/node_modules/web-streams-polyfill/package.json +83 -0
  610. package/.output/server/node_modules/ws/lib/buffer-util.js +142 -0
  611. package/.output/server/node_modules/ws/lib/constants.js +19 -0
  612. package/.output/server/node_modules/ws/lib/event-target.js +292 -0
  613. package/.output/server/node_modules/ws/lib/extension.js +203 -0
  614. package/.output/server/node_modules/ws/lib/limiter.js +55 -0
  615. package/.output/server/node_modules/ws/lib/permessage-deflate.js +530 -0
  616. package/.output/server/node_modules/ws/lib/receiver.js +751 -0
  617. package/.output/server/node_modules/ws/lib/sender.js +610 -0
  618. package/.output/server/node_modules/ws/lib/stream.js +161 -0
  619. package/.output/server/node_modules/ws/lib/subprotocol.js +62 -0
  620. package/.output/server/node_modules/ws/lib/validation.js +152 -0
  621. package/.output/server/node_modules/ws/lib/websocket-server.js +565 -0
  622. package/.output/server/node_modules/ws/lib/websocket.js +1471 -0
  623. package/.output/server/node_modules/ws/package.json +74 -0
  624. package/.output/server/node_modules/ws/wrapper.mjs +21 -0
  625. package/.output/server/node_modules/zip-stream/index.js +187 -0
  626. package/.output/server/node_modules/zip-stream/package.json +49 -0
  627. package/.output/server/node_modules/zod/index.js +4 -0
  628. package/.output/server/node_modules/zod/package.json +118 -0
  629. package/.output/server/node_modules/zod/v3/ZodError.js +133 -0
  630. package/.output/server/node_modules/zod/v3/errors.js +9 -0
  631. package/.output/server/node_modules/zod/v3/external.js +6 -0
  632. package/.output/server/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  633. package/.output/server/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  634. package/.output/server/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  635. package/.output/server/node_modules/zod/v3/helpers/util.js +133 -0
  636. package/.output/server/node_modules/zod/v3/locales/en.js +109 -0
  637. package/.output/server/node_modules/zod/v3/types.js +3693 -0
  638. package/.output/server/package.json +99 -0
  639. package/README.md +81 -2
  640. package/bin/cli.js +138 -0
  641. package/data/history.json +17 -0
  642. package/package.json +39 -4
  643. package/public/audio/cyber_future_tech.mp3 +0 -0
  644. package/public/audio/dark_phonk_pulse.mp3 +0 -0
  645. package/public/audio/deep_finance_groove.mp3 +0 -0
  646. package/public/audio/lofi_viral_study.mp3 +0 -0
  647. package/public/audio/motivation_cinematic.mp3 +0 -0
  648. package/public/videos/cyber_blue.mp4 +0 -0
  649. package/public/videos/cyber_matrix_stream.mp4 +0 -0
  650. package/public/videos/cyber_pulse.mp4 +0 -0
  651. package/public/videos/dark_luxury_particles.mp4 +0 -0
  652. package/public/videos/default_bg.mp4 +0 -0
  653. package/public/videos/emerald_flow.mp4 +0 -0
  654. package/public/videos/financial_pulse_flow.mp4 +0 -0
  655. package/public/videos/neon_cyber_grid.mp4 +0 -0
@@ -0,0 +1,2710 @@
1
+ import { Preprocessor } from './preprocessor.js';
2
+ import { CODE_POINTS as $, SEQUENCES as $$, REPLACEMENT_CHARACTER, isSurrogate, isUndefinedCodePoint, isControlCodePoint, } from '../common/unicode.js';
3
+ import { TokenType, getTokenAttr, } from '../common/token.js';
4
+ import { htmlDecodeTree, EntityDecoder, DecodingMode } from 'entities/decode';
5
+ import { ERR } from '../common/error-codes.js';
6
+ import { TAG_ID, getTagID } from '../common/html.js';
7
+ //States
8
+ var State;
9
+ (function (State) {
10
+ State[State["DATA"] = 0] = "DATA";
11
+ State[State["RCDATA"] = 1] = "RCDATA";
12
+ State[State["RAWTEXT"] = 2] = "RAWTEXT";
13
+ State[State["SCRIPT_DATA"] = 3] = "SCRIPT_DATA";
14
+ State[State["PLAINTEXT"] = 4] = "PLAINTEXT";
15
+ State[State["TAG_OPEN"] = 5] = "TAG_OPEN";
16
+ State[State["END_TAG_OPEN"] = 6] = "END_TAG_OPEN";
17
+ State[State["TAG_NAME"] = 7] = "TAG_NAME";
18
+ State[State["RCDATA_LESS_THAN_SIGN"] = 8] = "RCDATA_LESS_THAN_SIGN";
19
+ State[State["RCDATA_END_TAG_OPEN"] = 9] = "RCDATA_END_TAG_OPEN";
20
+ State[State["RCDATA_END_TAG_NAME"] = 10] = "RCDATA_END_TAG_NAME";
21
+ State[State["RAWTEXT_LESS_THAN_SIGN"] = 11] = "RAWTEXT_LESS_THAN_SIGN";
22
+ State[State["RAWTEXT_END_TAG_OPEN"] = 12] = "RAWTEXT_END_TAG_OPEN";
23
+ State[State["RAWTEXT_END_TAG_NAME"] = 13] = "RAWTEXT_END_TAG_NAME";
24
+ State[State["SCRIPT_DATA_LESS_THAN_SIGN"] = 14] = "SCRIPT_DATA_LESS_THAN_SIGN";
25
+ State[State["SCRIPT_DATA_END_TAG_OPEN"] = 15] = "SCRIPT_DATA_END_TAG_OPEN";
26
+ State[State["SCRIPT_DATA_END_TAG_NAME"] = 16] = "SCRIPT_DATA_END_TAG_NAME";
27
+ State[State["SCRIPT_DATA_ESCAPE_START"] = 17] = "SCRIPT_DATA_ESCAPE_START";
28
+ State[State["SCRIPT_DATA_ESCAPE_START_DASH"] = 18] = "SCRIPT_DATA_ESCAPE_START_DASH";
29
+ State[State["SCRIPT_DATA_ESCAPED"] = 19] = "SCRIPT_DATA_ESCAPED";
30
+ State[State["SCRIPT_DATA_ESCAPED_DASH"] = 20] = "SCRIPT_DATA_ESCAPED_DASH";
31
+ State[State["SCRIPT_DATA_ESCAPED_DASH_DASH"] = 21] = "SCRIPT_DATA_ESCAPED_DASH_DASH";
32
+ State[State["SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN"] = 22] = "SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN";
33
+ State[State["SCRIPT_DATA_ESCAPED_END_TAG_OPEN"] = 23] = "SCRIPT_DATA_ESCAPED_END_TAG_OPEN";
34
+ State[State["SCRIPT_DATA_ESCAPED_END_TAG_NAME"] = 24] = "SCRIPT_DATA_ESCAPED_END_TAG_NAME";
35
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPE_START"] = 25] = "SCRIPT_DATA_DOUBLE_ESCAPE_START";
36
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPED"] = 26] = "SCRIPT_DATA_DOUBLE_ESCAPED";
37
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPED_DASH"] = 27] = "SCRIPT_DATA_DOUBLE_ESCAPED_DASH";
38
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH"] = 28] = "SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH";
39
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN"] = 29] = "SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN";
40
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPE_END"] = 30] = "SCRIPT_DATA_DOUBLE_ESCAPE_END";
41
+ State[State["BEFORE_ATTRIBUTE_NAME"] = 31] = "BEFORE_ATTRIBUTE_NAME";
42
+ State[State["ATTRIBUTE_NAME"] = 32] = "ATTRIBUTE_NAME";
43
+ State[State["AFTER_ATTRIBUTE_NAME"] = 33] = "AFTER_ATTRIBUTE_NAME";
44
+ State[State["BEFORE_ATTRIBUTE_VALUE"] = 34] = "BEFORE_ATTRIBUTE_VALUE";
45
+ State[State["ATTRIBUTE_VALUE_DOUBLE_QUOTED"] = 35] = "ATTRIBUTE_VALUE_DOUBLE_QUOTED";
46
+ State[State["ATTRIBUTE_VALUE_SINGLE_QUOTED"] = 36] = "ATTRIBUTE_VALUE_SINGLE_QUOTED";
47
+ State[State["ATTRIBUTE_VALUE_UNQUOTED"] = 37] = "ATTRIBUTE_VALUE_UNQUOTED";
48
+ State[State["AFTER_ATTRIBUTE_VALUE_QUOTED"] = 38] = "AFTER_ATTRIBUTE_VALUE_QUOTED";
49
+ State[State["SELF_CLOSING_START_TAG"] = 39] = "SELF_CLOSING_START_TAG";
50
+ State[State["BOGUS_COMMENT"] = 40] = "BOGUS_COMMENT";
51
+ State[State["MARKUP_DECLARATION_OPEN"] = 41] = "MARKUP_DECLARATION_OPEN";
52
+ State[State["COMMENT_START"] = 42] = "COMMENT_START";
53
+ State[State["COMMENT_START_DASH"] = 43] = "COMMENT_START_DASH";
54
+ State[State["COMMENT"] = 44] = "COMMENT";
55
+ State[State["COMMENT_LESS_THAN_SIGN"] = 45] = "COMMENT_LESS_THAN_SIGN";
56
+ State[State["COMMENT_LESS_THAN_SIGN_BANG"] = 46] = "COMMENT_LESS_THAN_SIGN_BANG";
57
+ State[State["COMMENT_LESS_THAN_SIGN_BANG_DASH"] = 47] = "COMMENT_LESS_THAN_SIGN_BANG_DASH";
58
+ State[State["COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH"] = 48] = "COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH";
59
+ State[State["COMMENT_END_DASH"] = 49] = "COMMENT_END_DASH";
60
+ State[State["COMMENT_END"] = 50] = "COMMENT_END";
61
+ State[State["COMMENT_END_BANG"] = 51] = "COMMENT_END_BANG";
62
+ State[State["DOCTYPE"] = 52] = "DOCTYPE";
63
+ State[State["BEFORE_DOCTYPE_NAME"] = 53] = "BEFORE_DOCTYPE_NAME";
64
+ State[State["DOCTYPE_NAME"] = 54] = "DOCTYPE_NAME";
65
+ State[State["AFTER_DOCTYPE_NAME"] = 55] = "AFTER_DOCTYPE_NAME";
66
+ State[State["AFTER_DOCTYPE_PUBLIC_KEYWORD"] = 56] = "AFTER_DOCTYPE_PUBLIC_KEYWORD";
67
+ State[State["BEFORE_DOCTYPE_PUBLIC_IDENTIFIER"] = 57] = "BEFORE_DOCTYPE_PUBLIC_IDENTIFIER";
68
+ State[State["DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED"] = 58] = "DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED";
69
+ State[State["DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED"] = 59] = "DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED";
70
+ State[State["AFTER_DOCTYPE_PUBLIC_IDENTIFIER"] = 60] = "AFTER_DOCTYPE_PUBLIC_IDENTIFIER";
71
+ State[State["BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS"] = 61] = "BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS";
72
+ State[State["AFTER_DOCTYPE_SYSTEM_KEYWORD"] = 62] = "AFTER_DOCTYPE_SYSTEM_KEYWORD";
73
+ State[State["BEFORE_DOCTYPE_SYSTEM_IDENTIFIER"] = 63] = "BEFORE_DOCTYPE_SYSTEM_IDENTIFIER";
74
+ State[State["DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED"] = 64] = "DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED";
75
+ State[State["DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED"] = 65] = "DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED";
76
+ State[State["AFTER_DOCTYPE_SYSTEM_IDENTIFIER"] = 66] = "AFTER_DOCTYPE_SYSTEM_IDENTIFIER";
77
+ State[State["BOGUS_DOCTYPE"] = 67] = "BOGUS_DOCTYPE";
78
+ State[State["CDATA_SECTION"] = 68] = "CDATA_SECTION";
79
+ State[State["CDATA_SECTION_BRACKET"] = 69] = "CDATA_SECTION_BRACKET";
80
+ State[State["CDATA_SECTION_END"] = 70] = "CDATA_SECTION_END";
81
+ State[State["CHARACTER_REFERENCE"] = 71] = "CHARACTER_REFERENCE";
82
+ State[State["AMBIGUOUS_AMPERSAND"] = 72] = "AMBIGUOUS_AMPERSAND";
83
+ })(State || (State = {}));
84
+ //Tokenizer initial states for different modes
85
+ export const TokenizerMode = {
86
+ DATA: State.DATA,
87
+ RCDATA: State.RCDATA,
88
+ RAWTEXT: State.RAWTEXT,
89
+ SCRIPT_DATA: State.SCRIPT_DATA,
90
+ PLAINTEXT: State.PLAINTEXT,
91
+ CDATA_SECTION: State.CDATA_SECTION,
92
+ };
93
+ //Utils
94
+ //OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline
95
+ //this functions if they will be situated in another module due to context switch.
96
+ //Always perform inlining check before modifying this functions ('node --trace-inlining').
97
+ function isAsciiDigit(cp) {
98
+ return cp >= $.DIGIT_0 && cp <= $.DIGIT_9;
99
+ }
100
+ function isAsciiUpper(cp) {
101
+ return cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_Z;
102
+ }
103
+ function isAsciiLower(cp) {
104
+ return cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_Z;
105
+ }
106
+ function isAsciiLetter(cp) {
107
+ return isAsciiLower(cp) || isAsciiUpper(cp);
108
+ }
109
+ function isAsciiAlphaNumeric(cp) {
110
+ return isAsciiLetter(cp) || isAsciiDigit(cp);
111
+ }
112
+ function toAsciiLower(cp) {
113
+ return cp + 32;
114
+ }
115
+ function isWhitespace(cp) {
116
+ return cp === $.SPACE || cp === $.LINE_FEED || cp === $.TABULATION || cp === $.FORM_FEED;
117
+ }
118
+ function isScriptDataDoubleEscapeSequenceEnd(cp) {
119
+ return isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN;
120
+ }
121
+ function getErrorForNumericCharacterReference(code) {
122
+ if (code === $.NULL) {
123
+ return ERR.nullCharacterReference;
124
+ }
125
+ else if (code > 1114111) {
126
+ return ERR.characterReferenceOutsideUnicodeRange;
127
+ }
128
+ else if (isSurrogate(code)) {
129
+ return ERR.surrogateCharacterReference;
130
+ }
131
+ else if (isUndefinedCodePoint(code)) {
132
+ return ERR.noncharacterCharacterReference;
133
+ }
134
+ else if (isControlCodePoint(code) || code === $.CARRIAGE_RETURN) {
135
+ return ERR.controlCharacterReference;
136
+ }
137
+ return null;
138
+ }
139
+ //Tokenizer
140
+ export class Tokenizer {
141
+ constructor(options, handler) {
142
+ this.options = options;
143
+ this.handler = handler;
144
+ this.paused = false;
145
+ /** Ensures that the parsing loop isn't run multiple times at once. */
146
+ this.inLoop = false;
147
+ /**
148
+ * Indicates that the current adjusted node exists, is not an element in the HTML namespace,
149
+ * and that it is not an integration point for either MathML or HTML.
150
+ *
151
+ * @see {@link https://html.spec.whatwg.org/multipage/parsing.html#tree-construction}
152
+ */
153
+ this.inForeignNode = false;
154
+ this.lastStartTagName = '';
155
+ this.active = false;
156
+ this.state = State.DATA;
157
+ this.returnState = State.DATA;
158
+ this.entityStartPos = 0;
159
+ this.consumedAfterSnapshot = -1;
160
+ this.currentCharacterToken = null;
161
+ this.currentToken = null;
162
+ this.currentAttr = { name: '', value: '' };
163
+ this.preprocessor = new Preprocessor(handler);
164
+ this.currentLocation = this.getCurrentLocation(-1);
165
+ this.entityDecoder = new EntityDecoder(htmlDecodeTree, (cp, consumed) => {
166
+ // Note: Set `pos` _before_ flushing, as flushing might drop
167
+ // the current chunk and invalidate `entityStartPos`.
168
+ this.preprocessor.pos = this.entityStartPos + consumed - 1;
169
+ this._flushCodePointConsumedAsCharacterReference(cp);
170
+ }, handler.onParseError
171
+ ? {
172
+ missingSemicolonAfterCharacterReference: () => {
173
+ this._err(ERR.missingSemicolonAfterCharacterReference, 1);
174
+ },
175
+ absenceOfDigitsInNumericCharacterReference: (consumed) => {
176
+ this._err(ERR.absenceOfDigitsInNumericCharacterReference, this.entityStartPos - this.preprocessor.pos + consumed);
177
+ },
178
+ validateNumericCharacterReference: (code) => {
179
+ const error = getErrorForNumericCharacterReference(code);
180
+ if (error)
181
+ this._err(error, 1);
182
+ },
183
+ }
184
+ : undefined);
185
+ }
186
+ //Errors
187
+ _err(code, cpOffset = 0) {
188
+ var _a, _b;
189
+ (_b = (_a = this.handler).onParseError) === null || _b === void 0 ? void 0 : _b.call(_a, this.preprocessor.getError(code, cpOffset));
190
+ }
191
+ // NOTE: `offset` may never run across line boundaries.
192
+ getCurrentLocation(offset) {
193
+ if (!this.options.sourceCodeLocationInfo) {
194
+ return null;
195
+ }
196
+ return {
197
+ startLine: this.preprocessor.line,
198
+ startCol: this.preprocessor.col - offset,
199
+ startOffset: this.preprocessor.offset - offset,
200
+ endLine: -1,
201
+ endCol: -1,
202
+ endOffset: -1,
203
+ };
204
+ }
205
+ _runParsingLoop() {
206
+ if (this.inLoop)
207
+ return;
208
+ this.inLoop = true;
209
+ while (this.active && !this.paused) {
210
+ this.consumedAfterSnapshot = 0;
211
+ const cp = this._consume();
212
+ if (!this._ensureHibernation()) {
213
+ this._callState(cp);
214
+ }
215
+ }
216
+ this.inLoop = false;
217
+ }
218
+ //API
219
+ pause() {
220
+ this.paused = true;
221
+ }
222
+ resume(writeCallback) {
223
+ if (!this.paused) {
224
+ throw new Error('Parser was already resumed');
225
+ }
226
+ this.paused = false;
227
+ // Necessary for synchronous resume.
228
+ if (this.inLoop)
229
+ return;
230
+ this._runParsingLoop();
231
+ if (!this.paused) {
232
+ writeCallback === null || writeCallback === void 0 ? void 0 : writeCallback();
233
+ }
234
+ }
235
+ write(chunk, isLastChunk, writeCallback) {
236
+ this.active = true;
237
+ this.preprocessor.write(chunk, isLastChunk);
238
+ this._runParsingLoop();
239
+ if (!this.paused) {
240
+ writeCallback === null || writeCallback === void 0 ? void 0 : writeCallback();
241
+ }
242
+ }
243
+ insertHtmlAtCurrentPos(chunk) {
244
+ this.active = true;
245
+ this.preprocessor.insertHtmlAtCurrentPos(chunk);
246
+ this._runParsingLoop();
247
+ }
248
+ //Hibernation
249
+ _ensureHibernation() {
250
+ if (this.preprocessor.endOfChunkHit) {
251
+ this.preprocessor.retreat(this.consumedAfterSnapshot);
252
+ this.consumedAfterSnapshot = 0;
253
+ this.active = false;
254
+ return true;
255
+ }
256
+ return false;
257
+ }
258
+ //Consumption
259
+ _consume() {
260
+ this.consumedAfterSnapshot++;
261
+ return this.preprocessor.advance();
262
+ }
263
+ _advanceBy(count) {
264
+ this.consumedAfterSnapshot += count;
265
+ for (let i = 0; i < count; i++) {
266
+ this.preprocessor.advance();
267
+ }
268
+ }
269
+ _consumeSequenceIfMatch(pattern, caseSensitive) {
270
+ if (this.preprocessor.startsWith(pattern, caseSensitive)) {
271
+ // We will already have consumed one character before calling this method.
272
+ this._advanceBy(pattern.length - 1);
273
+ return true;
274
+ }
275
+ return false;
276
+ }
277
+ //Token creation
278
+ _createStartTagToken() {
279
+ this.currentToken = {
280
+ type: TokenType.START_TAG,
281
+ tagName: '',
282
+ tagID: TAG_ID.UNKNOWN,
283
+ selfClosing: false,
284
+ ackSelfClosing: false,
285
+ attrs: [],
286
+ location: this.getCurrentLocation(1),
287
+ };
288
+ }
289
+ _createEndTagToken() {
290
+ this.currentToken = {
291
+ type: TokenType.END_TAG,
292
+ tagName: '',
293
+ tagID: TAG_ID.UNKNOWN,
294
+ selfClosing: false,
295
+ ackSelfClosing: false,
296
+ attrs: [],
297
+ location: this.getCurrentLocation(2),
298
+ };
299
+ }
300
+ _createCommentToken(offset) {
301
+ this.currentToken = {
302
+ type: TokenType.COMMENT,
303
+ data: '',
304
+ location: this.getCurrentLocation(offset),
305
+ };
306
+ }
307
+ _createDoctypeToken(initialName) {
308
+ this.currentToken = {
309
+ type: TokenType.DOCTYPE,
310
+ name: initialName,
311
+ forceQuirks: false,
312
+ publicId: null,
313
+ systemId: null,
314
+ location: this.currentLocation,
315
+ };
316
+ }
317
+ _createCharacterToken(type, chars) {
318
+ this.currentCharacterToken = {
319
+ type,
320
+ chars,
321
+ location: this.currentLocation,
322
+ };
323
+ }
324
+ //Tag attributes
325
+ _createAttr(attrNameFirstCh) {
326
+ this.currentAttr = {
327
+ name: attrNameFirstCh,
328
+ value: '',
329
+ };
330
+ this.currentLocation = this.getCurrentLocation(0);
331
+ }
332
+ _leaveAttrName() {
333
+ var _a;
334
+ var _b;
335
+ const token = this.currentToken;
336
+ if (getTokenAttr(token, this.currentAttr.name) === null) {
337
+ token.attrs.push(this.currentAttr);
338
+ if (token.location && this.currentLocation) {
339
+ const attrLocations = ((_a = (_b = token.location).attrs) !== null && _a !== void 0 ? _a : (_b.attrs = Object.create(null)));
340
+ attrLocations[this.currentAttr.name] = this.currentLocation;
341
+ // Set end location
342
+ this._leaveAttrValue();
343
+ }
344
+ }
345
+ else {
346
+ this._err(ERR.duplicateAttribute);
347
+ }
348
+ }
349
+ _leaveAttrValue() {
350
+ if (this.currentLocation) {
351
+ this.currentLocation.endLine = this.preprocessor.line;
352
+ this.currentLocation.endCol = this.preprocessor.col;
353
+ this.currentLocation.endOffset = this.preprocessor.offset;
354
+ }
355
+ }
356
+ //Token emission
357
+ prepareToken(ct) {
358
+ this._emitCurrentCharacterToken(ct.location);
359
+ this.currentToken = null;
360
+ if (ct.location) {
361
+ ct.location.endLine = this.preprocessor.line;
362
+ ct.location.endCol = this.preprocessor.col + 1;
363
+ ct.location.endOffset = this.preprocessor.offset + 1;
364
+ }
365
+ this.currentLocation = this.getCurrentLocation(-1);
366
+ }
367
+ emitCurrentTagToken() {
368
+ const ct = this.currentToken;
369
+ this.prepareToken(ct);
370
+ ct.tagID = getTagID(ct.tagName);
371
+ if (ct.type === TokenType.START_TAG) {
372
+ this.lastStartTagName = ct.tagName;
373
+ this.handler.onStartTag(ct);
374
+ }
375
+ else {
376
+ if (ct.attrs.length > 0) {
377
+ this._err(ERR.endTagWithAttributes);
378
+ }
379
+ if (ct.selfClosing) {
380
+ this._err(ERR.endTagWithTrailingSolidus);
381
+ }
382
+ this.handler.onEndTag(ct);
383
+ }
384
+ this.preprocessor.dropParsedChunk();
385
+ }
386
+ emitCurrentComment(ct) {
387
+ this.prepareToken(ct);
388
+ this.handler.onComment(ct);
389
+ this.preprocessor.dropParsedChunk();
390
+ }
391
+ emitCurrentDoctype(ct) {
392
+ this.prepareToken(ct);
393
+ this.handler.onDoctype(ct);
394
+ this.preprocessor.dropParsedChunk();
395
+ }
396
+ _emitCurrentCharacterToken(nextLocation) {
397
+ if (this.currentCharacterToken) {
398
+ //NOTE: if we have a pending character token, make it's end location equal to the
399
+ //current token's start location.
400
+ if (nextLocation && this.currentCharacterToken.location) {
401
+ this.currentCharacterToken.location.endLine = nextLocation.startLine;
402
+ this.currentCharacterToken.location.endCol = nextLocation.startCol;
403
+ this.currentCharacterToken.location.endOffset = nextLocation.startOffset;
404
+ }
405
+ switch (this.currentCharacterToken.type) {
406
+ case TokenType.CHARACTER: {
407
+ this.handler.onCharacter(this.currentCharacterToken);
408
+ break;
409
+ }
410
+ case TokenType.NULL_CHARACTER: {
411
+ this.handler.onNullCharacter(this.currentCharacterToken);
412
+ break;
413
+ }
414
+ case TokenType.WHITESPACE_CHARACTER: {
415
+ this.handler.onWhitespaceCharacter(this.currentCharacterToken);
416
+ break;
417
+ }
418
+ }
419
+ this.currentCharacterToken = null;
420
+ }
421
+ }
422
+ _emitEOFToken() {
423
+ const location = this.getCurrentLocation(0);
424
+ if (location) {
425
+ location.endLine = location.startLine;
426
+ location.endCol = location.startCol;
427
+ location.endOffset = location.startOffset;
428
+ }
429
+ this._emitCurrentCharacterToken(location);
430
+ this.handler.onEof({ type: TokenType.EOF, location });
431
+ this.active = false;
432
+ }
433
+ //Characters emission
434
+ //OPTIMIZATION: The specification uses only one type of character token (one token per character).
435
+ //This causes a huge memory overhead and a lot of unnecessary parser loops. parse5 uses 3 groups of characters.
436
+ //If we have a sequence of characters that belong to the same group, the parser can process it
437
+ //as a single solid character token.
438
+ //So, there are 3 types of character tokens in parse5:
439
+ //1)TokenType.NULL_CHARACTER - \u0000-character sequences (e.g. '\u0000\u0000\u0000')
440
+ //2)TokenType.WHITESPACE_CHARACTER - any whitespace/new-line character sequences (e.g. '\n \r\t \f')
441
+ //3)TokenType.CHARACTER - any character sequence which don't belong to groups 1 and 2 (e.g. 'abcdef1234@@#$%^')
442
+ _appendCharToCurrentCharacterToken(type, ch) {
443
+ if (this.currentCharacterToken) {
444
+ if (this.currentCharacterToken.type === type) {
445
+ this.currentCharacterToken.chars += ch;
446
+ return;
447
+ }
448
+ else {
449
+ this.currentLocation = this.getCurrentLocation(0);
450
+ this._emitCurrentCharacterToken(this.currentLocation);
451
+ this.preprocessor.dropParsedChunk();
452
+ }
453
+ }
454
+ this._createCharacterToken(type, ch);
455
+ }
456
+ _emitCodePoint(cp) {
457
+ const type = isWhitespace(cp)
458
+ ? TokenType.WHITESPACE_CHARACTER
459
+ : cp === $.NULL
460
+ ? TokenType.NULL_CHARACTER
461
+ : TokenType.CHARACTER;
462
+ this._appendCharToCurrentCharacterToken(type, String.fromCodePoint(cp));
463
+ }
464
+ //NOTE: used when we emit characters explicitly.
465
+ //This is always for non-whitespace and non-null characters, which allows us to avoid additional checks.
466
+ _emitChars(ch) {
467
+ this._appendCharToCurrentCharacterToken(TokenType.CHARACTER, ch);
468
+ }
469
+ // Character reference helpers
470
+ _startCharacterReference() {
471
+ this.returnState = this.state;
472
+ this.state = State.CHARACTER_REFERENCE;
473
+ this.entityStartPos = this.preprocessor.pos;
474
+ this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute() ? DecodingMode.Attribute : DecodingMode.Legacy);
475
+ }
476
+ _isCharacterReferenceInAttribute() {
477
+ return (this.returnState === State.ATTRIBUTE_VALUE_DOUBLE_QUOTED ||
478
+ this.returnState === State.ATTRIBUTE_VALUE_SINGLE_QUOTED ||
479
+ this.returnState === State.ATTRIBUTE_VALUE_UNQUOTED);
480
+ }
481
+ _flushCodePointConsumedAsCharacterReference(cp) {
482
+ if (this._isCharacterReferenceInAttribute()) {
483
+ this.currentAttr.value += String.fromCodePoint(cp);
484
+ }
485
+ else {
486
+ this._emitCodePoint(cp);
487
+ }
488
+ }
489
+ // Calling states this way turns out to be much faster than any other approach.
490
+ _callState(cp) {
491
+ switch (this.state) {
492
+ case State.DATA: {
493
+ this._stateData(cp);
494
+ break;
495
+ }
496
+ case State.RCDATA: {
497
+ this._stateRcdata(cp);
498
+ break;
499
+ }
500
+ case State.RAWTEXT: {
501
+ this._stateRawtext(cp);
502
+ break;
503
+ }
504
+ case State.SCRIPT_DATA: {
505
+ this._stateScriptData(cp);
506
+ break;
507
+ }
508
+ case State.PLAINTEXT: {
509
+ this._statePlaintext(cp);
510
+ break;
511
+ }
512
+ case State.TAG_OPEN: {
513
+ this._stateTagOpen(cp);
514
+ break;
515
+ }
516
+ case State.END_TAG_OPEN: {
517
+ this._stateEndTagOpen(cp);
518
+ break;
519
+ }
520
+ case State.TAG_NAME: {
521
+ this._stateTagName(cp);
522
+ break;
523
+ }
524
+ case State.RCDATA_LESS_THAN_SIGN: {
525
+ this._stateRcdataLessThanSign(cp);
526
+ break;
527
+ }
528
+ case State.RCDATA_END_TAG_OPEN: {
529
+ this._stateRcdataEndTagOpen(cp);
530
+ break;
531
+ }
532
+ case State.RCDATA_END_TAG_NAME: {
533
+ this._stateRcdataEndTagName(cp);
534
+ break;
535
+ }
536
+ case State.RAWTEXT_LESS_THAN_SIGN: {
537
+ this._stateRawtextLessThanSign(cp);
538
+ break;
539
+ }
540
+ case State.RAWTEXT_END_TAG_OPEN: {
541
+ this._stateRawtextEndTagOpen(cp);
542
+ break;
543
+ }
544
+ case State.RAWTEXT_END_TAG_NAME: {
545
+ this._stateRawtextEndTagName(cp);
546
+ break;
547
+ }
548
+ case State.SCRIPT_DATA_LESS_THAN_SIGN: {
549
+ this._stateScriptDataLessThanSign(cp);
550
+ break;
551
+ }
552
+ case State.SCRIPT_DATA_END_TAG_OPEN: {
553
+ this._stateScriptDataEndTagOpen(cp);
554
+ break;
555
+ }
556
+ case State.SCRIPT_DATA_END_TAG_NAME: {
557
+ this._stateScriptDataEndTagName(cp);
558
+ break;
559
+ }
560
+ case State.SCRIPT_DATA_ESCAPE_START: {
561
+ this._stateScriptDataEscapeStart(cp);
562
+ break;
563
+ }
564
+ case State.SCRIPT_DATA_ESCAPE_START_DASH: {
565
+ this._stateScriptDataEscapeStartDash(cp);
566
+ break;
567
+ }
568
+ case State.SCRIPT_DATA_ESCAPED: {
569
+ this._stateScriptDataEscaped(cp);
570
+ break;
571
+ }
572
+ case State.SCRIPT_DATA_ESCAPED_DASH: {
573
+ this._stateScriptDataEscapedDash(cp);
574
+ break;
575
+ }
576
+ case State.SCRIPT_DATA_ESCAPED_DASH_DASH: {
577
+ this._stateScriptDataEscapedDashDash(cp);
578
+ break;
579
+ }
580
+ case State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN: {
581
+ this._stateScriptDataEscapedLessThanSign(cp);
582
+ break;
583
+ }
584
+ case State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN: {
585
+ this._stateScriptDataEscapedEndTagOpen(cp);
586
+ break;
587
+ }
588
+ case State.SCRIPT_DATA_ESCAPED_END_TAG_NAME: {
589
+ this._stateScriptDataEscapedEndTagName(cp);
590
+ break;
591
+ }
592
+ case State.SCRIPT_DATA_DOUBLE_ESCAPE_START: {
593
+ this._stateScriptDataDoubleEscapeStart(cp);
594
+ break;
595
+ }
596
+ case State.SCRIPT_DATA_DOUBLE_ESCAPED: {
597
+ this._stateScriptDataDoubleEscaped(cp);
598
+ break;
599
+ }
600
+ case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH: {
601
+ this._stateScriptDataDoubleEscapedDash(cp);
602
+ break;
603
+ }
604
+ case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH: {
605
+ this._stateScriptDataDoubleEscapedDashDash(cp);
606
+ break;
607
+ }
608
+ case State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN: {
609
+ this._stateScriptDataDoubleEscapedLessThanSign(cp);
610
+ break;
611
+ }
612
+ case State.SCRIPT_DATA_DOUBLE_ESCAPE_END: {
613
+ this._stateScriptDataDoubleEscapeEnd(cp);
614
+ break;
615
+ }
616
+ case State.BEFORE_ATTRIBUTE_NAME: {
617
+ this._stateBeforeAttributeName(cp);
618
+ break;
619
+ }
620
+ case State.ATTRIBUTE_NAME: {
621
+ this._stateAttributeName(cp);
622
+ break;
623
+ }
624
+ case State.AFTER_ATTRIBUTE_NAME: {
625
+ this._stateAfterAttributeName(cp);
626
+ break;
627
+ }
628
+ case State.BEFORE_ATTRIBUTE_VALUE: {
629
+ this._stateBeforeAttributeValue(cp);
630
+ break;
631
+ }
632
+ case State.ATTRIBUTE_VALUE_DOUBLE_QUOTED: {
633
+ this._stateAttributeValueDoubleQuoted(cp);
634
+ break;
635
+ }
636
+ case State.ATTRIBUTE_VALUE_SINGLE_QUOTED: {
637
+ this._stateAttributeValueSingleQuoted(cp);
638
+ break;
639
+ }
640
+ case State.ATTRIBUTE_VALUE_UNQUOTED: {
641
+ this._stateAttributeValueUnquoted(cp);
642
+ break;
643
+ }
644
+ case State.AFTER_ATTRIBUTE_VALUE_QUOTED: {
645
+ this._stateAfterAttributeValueQuoted(cp);
646
+ break;
647
+ }
648
+ case State.SELF_CLOSING_START_TAG: {
649
+ this._stateSelfClosingStartTag(cp);
650
+ break;
651
+ }
652
+ case State.BOGUS_COMMENT: {
653
+ this._stateBogusComment(cp);
654
+ break;
655
+ }
656
+ case State.MARKUP_DECLARATION_OPEN: {
657
+ this._stateMarkupDeclarationOpen(cp);
658
+ break;
659
+ }
660
+ case State.COMMENT_START: {
661
+ this._stateCommentStart(cp);
662
+ break;
663
+ }
664
+ case State.COMMENT_START_DASH: {
665
+ this._stateCommentStartDash(cp);
666
+ break;
667
+ }
668
+ case State.COMMENT: {
669
+ this._stateComment(cp);
670
+ break;
671
+ }
672
+ case State.COMMENT_LESS_THAN_SIGN: {
673
+ this._stateCommentLessThanSign(cp);
674
+ break;
675
+ }
676
+ case State.COMMENT_LESS_THAN_SIGN_BANG: {
677
+ this._stateCommentLessThanSignBang(cp);
678
+ break;
679
+ }
680
+ case State.COMMENT_LESS_THAN_SIGN_BANG_DASH: {
681
+ this._stateCommentLessThanSignBangDash(cp);
682
+ break;
683
+ }
684
+ case State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH: {
685
+ this._stateCommentLessThanSignBangDashDash(cp);
686
+ break;
687
+ }
688
+ case State.COMMENT_END_DASH: {
689
+ this._stateCommentEndDash(cp);
690
+ break;
691
+ }
692
+ case State.COMMENT_END: {
693
+ this._stateCommentEnd(cp);
694
+ break;
695
+ }
696
+ case State.COMMENT_END_BANG: {
697
+ this._stateCommentEndBang(cp);
698
+ break;
699
+ }
700
+ case State.DOCTYPE: {
701
+ this._stateDoctype(cp);
702
+ break;
703
+ }
704
+ case State.BEFORE_DOCTYPE_NAME: {
705
+ this._stateBeforeDoctypeName(cp);
706
+ break;
707
+ }
708
+ case State.DOCTYPE_NAME: {
709
+ this._stateDoctypeName(cp);
710
+ break;
711
+ }
712
+ case State.AFTER_DOCTYPE_NAME: {
713
+ this._stateAfterDoctypeName(cp);
714
+ break;
715
+ }
716
+ case State.AFTER_DOCTYPE_PUBLIC_KEYWORD: {
717
+ this._stateAfterDoctypePublicKeyword(cp);
718
+ break;
719
+ }
720
+ case State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER: {
721
+ this._stateBeforeDoctypePublicIdentifier(cp);
722
+ break;
723
+ }
724
+ case State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED: {
725
+ this._stateDoctypePublicIdentifierDoubleQuoted(cp);
726
+ break;
727
+ }
728
+ case State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED: {
729
+ this._stateDoctypePublicIdentifierSingleQuoted(cp);
730
+ break;
731
+ }
732
+ case State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER: {
733
+ this._stateAfterDoctypePublicIdentifier(cp);
734
+ break;
735
+ }
736
+ case State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS: {
737
+ this._stateBetweenDoctypePublicAndSystemIdentifiers(cp);
738
+ break;
739
+ }
740
+ case State.AFTER_DOCTYPE_SYSTEM_KEYWORD: {
741
+ this._stateAfterDoctypeSystemKeyword(cp);
742
+ break;
743
+ }
744
+ case State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER: {
745
+ this._stateBeforeDoctypeSystemIdentifier(cp);
746
+ break;
747
+ }
748
+ case State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED: {
749
+ this._stateDoctypeSystemIdentifierDoubleQuoted(cp);
750
+ break;
751
+ }
752
+ case State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED: {
753
+ this._stateDoctypeSystemIdentifierSingleQuoted(cp);
754
+ break;
755
+ }
756
+ case State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER: {
757
+ this._stateAfterDoctypeSystemIdentifier(cp);
758
+ break;
759
+ }
760
+ case State.BOGUS_DOCTYPE: {
761
+ this._stateBogusDoctype(cp);
762
+ break;
763
+ }
764
+ case State.CDATA_SECTION: {
765
+ this._stateCdataSection(cp);
766
+ break;
767
+ }
768
+ case State.CDATA_SECTION_BRACKET: {
769
+ this._stateCdataSectionBracket(cp);
770
+ break;
771
+ }
772
+ case State.CDATA_SECTION_END: {
773
+ this._stateCdataSectionEnd(cp);
774
+ break;
775
+ }
776
+ case State.CHARACTER_REFERENCE: {
777
+ this._stateCharacterReference();
778
+ break;
779
+ }
780
+ case State.AMBIGUOUS_AMPERSAND: {
781
+ this._stateAmbiguousAmpersand(cp);
782
+ break;
783
+ }
784
+ default: {
785
+ throw new Error('Unknown state');
786
+ }
787
+ }
788
+ }
789
+ // State machine
790
+ // Data state
791
+ //------------------------------------------------------------------
792
+ _stateData(cp) {
793
+ switch (cp) {
794
+ case $.LESS_THAN_SIGN: {
795
+ this.state = State.TAG_OPEN;
796
+ break;
797
+ }
798
+ case $.AMPERSAND: {
799
+ this._startCharacterReference();
800
+ break;
801
+ }
802
+ case $.NULL: {
803
+ this._err(ERR.unexpectedNullCharacter);
804
+ this._emitCodePoint(cp);
805
+ break;
806
+ }
807
+ case $.EOF: {
808
+ this._emitEOFToken();
809
+ break;
810
+ }
811
+ default: {
812
+ this._emitCodePoint(cp);
813
+ }
814
+ }
815
+ }
816
+ // RCDATA state
817
+ //------------------------------------------------------------------
818
+ _stateRcdata(cp) {
819
+ switch (cp) {
820
+ case $.AMPERSAND: {
821
+ this._startCharacterReference();
822
+ break;
823
+ }
824
+ case $.LESS_THAN_SIGN: {
825
+ this.state = State.RCDATA_LESS_THAN_SIGN;
826
+ break;
827
+ }
828
+ case $.NULL: {
829
+ this._err(ERR.unexpectedNullCharacter);
830
+ this._emitChars(REPLACEMENT_CHARACTER);
831
+ break;
832
+ }
833
+ case $.EOF: {
834
+ this._emitEOFToken();
835
+ break;
836
+ }
837
+ default: {
838
+ this._emitCodePoint(cp);
839
+ }
840
+ }
841
+ }
842
+ // RAWTEXT state
843
+ //------------------------------------------------------------------
844
+ _stateRawtext(cp) {
845
+ switch (cp) {
846
+ case $.LESS_THAN_SIGN: {
847
+ this.state = State.RAWTEXT_LESS_THAN_SIGN;
848
+ break;
849
+ }
850
+ case $.NULL: {
851
+ this._err(ERR.unexpectedNullCharacter);
852
+ this._emitChars(REPLACEMENT_CHARACTER);
853
+ break;
854
+ }
855
+ case $.EOF: {
856
+ this._emitEOFToken();
857
+ break;
858
+ }
859
+ default: {
860
+ this._emitCodePoint(cp);
861
+ }
862
+ }
863
+ }
864
+ // Script data state
865
+ //------------------------------------------------------------------
866
+ _stateScriptData(cp) {
867
+ switch (cp) {
868
+ case $.LESS_THAN_SIGN: {
869
+ this.state = State.SCRIPT_DATA_LESS_THAN_SIGN;
870
+ break;
871
+ }
872
+ case $.NULL: {
873
+ this._err(ERR.unexpectedNullCharacter);
874
+ this._emitChars(REPLACEMENT_CHARACTER);
875
+ break;
876
+ }
877
+ case $.EOF: {
878
+ this._emitEOFToken();
879
+ break;
880
+ }
881
+ default: {
882
+ this._emitCodePoint(cp);
883
+ }
884
+ }
885
+ }
886
+ // PLAINTEXT state
887
+ //------------------------------------------------------------------
888
+ _statePlaintext(cp) {
889
+ switch (cp) {
890
+ case $.NULL: {
891
+ this._err(ERR.unexpectedNullCharacter);
892
+ this._emitChars(REPLACEMENT_CHARACTER);
893
+ break;
894
+ }
895
+ case $.EOF: {
896
+ this._emitEOFToken();
897
+ break;
898
+ }
899
+ default: {
900
+ this._emitCodePoint(cp);
901
+ }
902
+ }
903
+ }
904
+ // Tag open state
905
+ //------------------------------------------------------------------
906
+ _stateTagOpen(cp) {
907
+ if (isAsciiLetter(cp)) {
908
+ this._createStartTagToken();
909
+ this.state = State.TAG_NAME;
910
+ this._stateTagName(cp);
911
+ }
912
+ else
913
+ switch (cp) {
914
+ case $.EXCLAMATION_MARK: {
915
+ this.state = State.MARKUP_DECLARATION_OPEN;
916
+ break;
917
+ }
918
+ case $.SOLIDUS: {
919
+ this.state = State.END_TAG_OPEN;
920
+ break;
921
+ }
922
+ case $.QUESTION_MARK: {
923
+ this._err(ERR.unexpectedQuestionMarkInsteadOfTagName);
924
+ this._createCommentToken(1);
925
+ this.state = State.BOGUS_COMMENT;
926
+ this._stateBogusComment(cp);
927
+ break;
928
+ }
929
+ case $.EOF: {
930
+ this._err(ERR.eofBeforeTagName);
931
+ this._emitChars('<');
932
+ this._emitEOFToken();
933
+ break;
934
+ }
935
+ default: {
936
+ this._err(ERR.invalidFirstCharacterOfTagName);
937
+ this._emitChars('<');
938
+ this.state = State.DATA;
939
+ this._stateData(cp);
940
+ }
941
+ }
942
+ }
943
+ // End tag open state
944
+ //------------------------------------------------------------------
945
+ _stateEndTagOpen(cp) {
946
+ if (isAsciiLetter(cp)) {
947
+ this._createEndTagToken();
948
+ this.state = State.TAG_NAME;
949
+ this._stateTagName(cp);
950
+ }
951
+ else
952
+ switch (cp) {
953
+ case $.GREATER_THAN_SIGN: {
954
+ this._err(ERR.missingEndTagName);
955
+ this.state = State.DATA;
956
+ break;
957
+ }
958
+ case $.EOF: {
959
+ this._err(ERR.eofBeforeTagName);
960
+ this._emitChars('</');
961
+ this._emitEOFToken();
962
+ break;
963
+ }
964
+ default: {
965
+ this._err(ERR.invalidFirstCharacterOfTagName);
966
+ this._createCommentToken(2);
967
+ this.state = State.BOGUS_COMMENT;
968
+ this._stateBogusComment(cp);
969
+ }
970
+ }
971
+ }
972
+ // Tag name state
973
+ //------------------------------------------------------------------
974
+ _stateTagName(cp) {
975
+ const token = this.currentToken;
976
+ switch (cp) {
977
+ case $.SPACE:
978
+ case $.LINE_FEED:
979
+ case $.TABULATION:
980
+ case $.FORM_FEED: {
981
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
982
+ break;
983
+ }
984
+ case $.SOLIDUS: {
985
+ this.state = State.SELF_CLOSING_START_TAG;
986
+ break;
987
+ }
988
+ case $.GREATER_THAN_SIGN: {
989
+ this.state = State.DATA;
990
+ this.emitCurrentTagToken();
991
+ break;
992
+ }
993
+ case $.NULL: {
994
+ this._err(ERR.unexpectedNullCharacter);
995
+ token.tagName += REPLACEMENT_CHARACTER;
996
+ break;
997
+ }
998
+ case $.EOF: {
999
+ this._err(ERR.eofInTag);
1000
+ this._emitEOFToken();
1001
+ break;
1002
+ }
1003
+ default: {
1004
+ token.tagName += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);
1005
+ }
1006
+ }
1007
+ }
1008
+ // RCDATA less-than sign state
1009
+ //------------------------------------------------------------------
1010
+ _stateRcdataLessThanSign(cp) {
1011
+ if (cp === $.SOLIDUS) {
1012
+ this.state = State.RCDATA_END_TAG_OPEN;
1013
+ }
1014
+ else {
1015
+ this._emitChars('<');
1016
+ this.state = State.RCDATA;
1017
+ this._stateRcdata(cp);
1018
+ }
1019
+ }
1020
+ // RCDATA end tag open state
1021
+ //------------------------------------------------------------------
1022
+ _stateRcdataEndTagOpen(cp) {
1023
+ if (isAsciiLetter(cp)) {
1024
+ this.state = State.RCDATA_END_TAG_NAME;
1025
+ this._stateRcdataEndTagName(cp);
1026
+ }
1027
+ else {
1028
+ this._emitChars('</');
1029
+ this.state = State.RCDATA;
1030
+ this._stateRcdata(cp);
1031
+ }
1032
+ }
1033
+ handleSpecialEndTag(_cp) {
1034
+ if (!this.preprocessor.startsWith(this.lastStartTagName, false)) {
1035
+ return !this._ensureHibernation();
1036
+ }
1037
+ this._createEndTagToken();
1038
+ const token = this.currentToken;
1039
+ token.tagName = this.lastStartTagName;
1040
+ const cp = this.preprocessor.peek(this.lastStartTagName.length);
1041
+ switch (cp) {
1042
+ case $.SPACE:
1043
+ case $.LINE_FEED:
1044
+ case $.TABULATION:
1045
+ case $.FORM_FEED: {
1046
+ this._advanceBy(this.lastStartTagName.length);
1047
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
1048
+ return false;
1049
+ }
1050
+ case $.SOLIDUS: {
1051
+ this._advanceBy(this.lastStartTagName.length);
1052
+ this.state = State.SELF_CLOSING_START_TAG;
1053
+ return false;
1054
+ }
1055
+ case $.GREATER_THAN_SIGN: {
1056
+ this._advanceBy(this.lastStartTagName.length);
1057
+ this.emitCurrentTagToken();
1058
+ this.state = State.DATA;
1059
+ return false;
1060
+ }
1061
+ default: {
1062
+ return !this._ensureHibernation();
1063
+ }
1064
+ }
1065
+ }
1066
+ // RCDATA end tag name state
1067
+ //------------------------------------------------------------------
1068
+ _stateRcdataEndTagName(cp) {
1069
+ if (this.handleSpecialEndTag(cp)) {
1070
+ this._emitChars('</');
1071
+ this.state = State.RCDATA;
1072
+ this._stateRcdata(cp);
1073
+ }
1074
+ }
1075
+ // RAWTEXT less-than sign state
1076
+ //------------------------------------------------------------------
1077
+ _stateRawtextLessThanSign(cp) {
1078
+ if (cp === $.SOLIDUS) {
1079
+ this.state = State.RAWTEXT_END_TAG_OPEN;
1080
+ }
1081
+ else {
1082
+ this._emitChars('<');
1083
+ this.state = State.RAWTEXT;
1084
+ this._stateRawtext(cp);
1085
+ }
1086
+ }
1087
+ // RAWTEXT end tag open state
1088
+ //------------------------------------------------------------------
1089
+ _stateRawtextEndTagOpen(cp) {
1090
+ if (isAsciiLetter(cp)) {
1091
+ this.state = State.RAWTEXT_END_TAG_NAME;
1092
+ this._stateRawtextEndTagName(cp);
1093
+ }
1094
+ else {
1095
+ this._emitChars('</');
1096
+ this.state = State.RAWTEXT;
1097
+ this._stateRawtext(cp);
1098
+ }
1099
+ }
1100
+ // RAWTEXT end tag name state
1101
+ //------------------------------------------------------------------
1102
+ _stateRawtextEndTagName(cp) {
1103
+ if (this.handleSpecialEndTag(cp)) {
1104
+ this._emitChars('</');
1105
+ this.state = State.RAWTEXT;
1106
+ this._stateRawtext(cp);
1107
+ }
1108
+ }
1109
+ // Script data less-than sign state
1110
+ //------------------------------------------------------------------
1111
+ _stateScriptDataLessThanSign(cp) {
1112
+ switch (cp) {
1113
+ case $.SOLIDUS: {
1114
+ this.state = State.SCRIPT_DATA_END_TAG_OPEN;
1115
+ break;
1116
+ }
1117
+ case $.EXCLAMATION_MARK: {
1118
+ this.state = State.SCRIPT_DATA_ESCAPE_START;
1119
+ this._emitChars('<!');
1120
+ break;
1121
+ }
1122
+ default: {
1123
+ this._emitChars('<');
1124
+ this.state = State.SCRIPT_DATA;
1125
+ this._stateScriptData(cp);
1126
+ }
1127
+ }
1128
+ }
1129
+ // Script data end tag open state
1130
+ //------------------------------------------------------------------
1131
+ _stateScriptDataEndTagOpen(cp) {
1132
+ if (isAsciiLetter(cp)) {
1133
+ this.state = State.SCRIPT_DATA_END_TAG_NAME;
1134
+ this._stateScriptDataEndTagName(cp);
1135
+ }
1136
+ else {
1137
+ this._emitChars('</');
1138
+ this.state = State.SCRIPT_DATA;
1139
+ this._stateScriptData(cp);
1140
+ }
1141
+ }
1142
+ // Script data end tag name state
1143
+ //------------------------------------------------------------------
1144
+ _stateScriptDataEndTagName(cp) {
1145
+ if (this.handleSpecialEndTag(cp)) {
1146
+ this._emitChars('</');
1147
+ this.state = State.SCRIPT_DATA;
1148
+ this._stateScriptData(cp);
1149
+ }
1150
+ }
1151
+ // Script data escape start state
1152
+ //------------------------------------------------------------------
1153
+ _stateScriptDataEscapeStart(cp) {
1154
+ if (cp === $.HYPHEN_MINUS) {
1155
+ this.state = State.SCRIPT_DATA_ESCAPE_START_DASH;
1156
+ this._emitChars('-');
1157
+ }
1158
+ else {
1159
+ this.state = State.SCRIPT_DATA;
1160
+ this._stateScriptData(cp);
1161
+ }
1162
+ }
1163
+ // Script data escape start dash state
1164
+ //------------------------------------------------------------------
1165
+ _stateScriptDataEscapeStartDash(cp) {
1166
+ if (cp === $.HYPHEN_MINUS) {
1167
+ this.state = State.SCRIPT_DATA_ESCAPED_DASH_DASH;
1168
+ this._emitChars('-');
1169
+ }
1170
+ else {
1171
+ this.state = State.SCRIPT_DATA;
1172
+ this._stateScriptData(cp);
1173
+ }
1174
+ }
1175
+ // Script data escaped state
1176
+ //------------------------------------------------------------------
1177
+ _stateScriptDataEscaped(cp) {
1178
+ switch (cp) {
1179
+ case $.HYPHEN_MINUS: {
1180
+ this.state = State.SCRIPT_DATA_ESCAPED_DASH;
1181
+ this._emitChars('-');
1182
+ break;
1183
+ }
1184
+ case $.LESS_THAN_SIGN: {
1185
+ this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
1186
+ break;
1187
+ }
1188
+ case $.NULL: {
1189
+ this._err(ERR.unexpectedNullCharacter);
1190
+ this._emitChars(REPLACEMENT_CHARACTER);
1191
+ break;
1192
+ }
1193
+ case $.EOF: {
1194
+ this._err(ERR.eofInScriptHtmlCommentLikeText);
1195
+ this._emitEOFToken();
1196
+ break;
1197
+ }
1198
+ default: {
1199
+ this._emitCodePoint(cp);
1200
+ }
1201
+ }
1202
+ }
1203
+ // Script data escaped dash state
1204
+ //------------------------------------------------------------------
1205
+ _stateScriptDataEscapedDash(cp) {
1206
+ switch (cp) {
1207
+ case $.HYPHEN_MINUS: {
1208
+ this.state = State.SCRIPT_DATA_ESCAPED_DASH_DASH;
1209
+ this._emitChars('-');
1210
+ break;
1211
+ }
1212
+ case $.LESS_THAN_SIGN: {
1213
+ this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
1214
+ break;
1215
+ }
1216
+ case $.NULL: {
1217
+ this._err(ERR.unexpectedNullCharacter);
1218
+ this.state = State.SCRIPT_DATA_ESCAPED;
1219
+ this._emitChars(REPLACEMENT_CHARACTER);
1220
+ break;
1221
+ }
1222
+ case $.EOF: {
1223
+ this._err(ERR.eofInScriptHtmlCommentLikeText);
1224
+ this._emitEOFToken();
1225
+ break;
1226
+ }
1227
+ default: {
1228
+ this.state = State.SCRIPT_DATA_ESCAPED;
1229
+ this._emitCodePoint(cp);
1230
+ }
1231
+ }
1232
+ }
1233
+ // Script data escaped dash dash state
1234
+ //------------------------------------------------------------------
1235
+ _stateScriptDataEscapedDashDash(cp) {
1236
+ switch (cp) {
1237
+ case $.HYPHEN_MINUS: {
1238
+ this._emitChars('-');
1239
+ break;
1240
+ }
1241
+ case $.LESS_THAN_SIGN: {
1242
+ this.state = State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
1243
+ break;
1244
+ }
1245
+ case $.GREATER_THAN_SIGN: {
1246
+ this.state = State.SCRIPT_DATA;
1247
+ this._emitChars('>');
1248
+ break;
1249
+ }
1250
+ case $.NULL: {
1251
+ this._err(ERR.unexpectedNullCharacter);
1252
+ this.state = State.SCRIPT_DATA_ESCAPED;
1253
+ this._emitChars(REPLACEMENT_CHARACTER);
1254
+ break;
1255
+ }
1256
+ case $.EOF: {
1257
+ this._err(ERR.eofInScriptHtmlCommentLikeText);
1258
+ this._emitEOFToken();
1259
+ break;
1260
+ }
1261
+ default: {
1262
+ this.state = State.SCRIPT_DATA_ESCAPED;
1263
+ this._emitCodePoint(cp);
1264
+ }
1265
+ }
1266
+ }
1267
+ // Script data escaped less-than sign state
1268
+ //------------------------------------------------------------------
1269
+ _stateScriptDataEscapedLessThanSign(cp) {
1270
+ if (cp === $.SOLIDUS) {
1271
+ this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN;
1272
+ }
1273
+ else if (isAsciiLetter(cp)) {
1274
+ this._emitChars('<');
1275
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_START;
1276
+ this._stateScriptDataDoubleEscapeStart(cp);
1277
+ }
1278
+ else {
1279
+ this._emitChars('<');
1280
+ this.state = State.SCRIPT_DATA_ESCAPED;
1281
+ this._stateScriptDataEscaped(cp);
1282
+ }
1283
+ }
1284
+ // Script data escaped end tag open state
1285
+ //------------------------------------------------------------------
1286
+ _stateScriptDataEscapedEndTagOpen(cp) {
1287
+ if (isAsciiLetter(cp)) {
1288
+ this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_NAME;
1289
+ this._stateScriptDataEscapedEndTagName(cp);
1290
+ }
1291
+ else {
1292
+ this._emitChars('</');
1293
+ this.state = State.SCRIPT_DATA_ESCAPED;
1294
+ this._stateScriptDataEscaped(cp);
1295
+ }
1296
+ }
1297
+ // Script data escaped end tag name state
1298
+ //------------------------------------------------------------------
1299
+ _stateScriptDataEscapedEndTagName(cp) {
1300
+ if (this.handleSpecialEndTag(cp)) {
1301
+ this._emitChars('</');
1302
+ this.state = State.SCRIPT_DATA_ESCAPED;
1303
+ this._stateScriptDataEscaped(cp);
1304
+ }
1305
+ }
1306
+ // Script data double escape start state
1307
+ //------------------------------------------------------------------
1308
+ _stateScriptDataDoubleEscapeStart(cp) {
1309
+ if (this.preprocessor.startsWith($$.SCRIPT, false) &&
1310
+ isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek($$.SCRIPT.length))) {
1311
+ this._emitCodePoint(cp);
1312
+ for (let i = 0; i < $$.SCRIPT.length; i++) {
1313
+ this._emitCodePoint(this._consume());
1314
+ }
1315
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
1316
+ }
1317
+ else if (!this._ensureHibernation()) {
1318
+ this.state = State.SCRIPT_DATA_ESCAPED;
1319
+ this._stateScriptDataEscaped(cp);
1320
+ }
1321
+ }
1322
+ // Script data double escaped state
1323
+ //------------------------------------------------------------------
1324
+ _stateScriptDataDoubleEscaped(cp) {
1325
+ switch (cp) {
1326
+ case $.HYPHEN_MINUS: {
1327
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH;
1328
+ this._emitChars('-');
1329
+ break;
1330
+ }
1331
+ case $.LESS_THAN_SIGN: {
1332
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
1333
+ this._emitChars('<');
1334
+ break;
1335
+ }
1336
+ case $.NULL: {
1337
+ this._err(ERR.unexpectedNullCharacter);
1338
+ this._emitChars(REPLACEMENT_CHARACTER);
1339
+ break;
1340
+ }
1341
+ case $.EOF: {
1342
+ this._err(ERR.eofInScriptHtmlCommentLikeText);
1343
+ this._emitEOFToken();
1344
+ break;
1345
+ }
1346
+ default: {
1347
+ this._emitCodePoint(cp);
1348
+ }
1349
+ }
1350
+ }
1351
+ // Script data double escaped dash state
1352
+ //------------------------------------------------------------------
1353
+ _stateScriptDataDoubleEscapedDash(cp) {
1354
+ switch (cp) {
1355
+ case $.HYPHEN_MINUS: {
1356
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH;
1357
+ this._emitChars('-');
1358
+ break;
1359
+ }
1360
+ case $.LESS_THAN_SIGN: {
1361
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
1362
+ this._emitChars('<');
1363
+ break;
1364
+ }
1365
+ case $.NULL: {
1366
+ this._err(ERR.unexpectedNullCharacter);
1367
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
1368
+ this._emitChars(REPLACEMENT_CHARACTER);
1369
+ break;
1370
+ }
1371
+ case $.EOF: {
1372
+ this._err(ERR.eofInScriptHtmlCommentLikeText);
1373
+ this._emitEOFToken();
1374
+ break;
1375
+ }
1376
+ default: {
1377
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
1378
+ this._emitCodePoint(cp);
1379
+ }
1380
+ }
1381
+ }
1382
+ // Script data double escaped dash dash state
1383
+ //------------------------------------------------------------------
1384
+ _stateScriptDataDoubleEscapedDashDash(cp) {
1385
+ switch (cp) {
1386
+ case $.HYPHEN_MINUS: {
1387
+ this._emitChars('-');
1388
+ break;
1389
+ }
1390
+ case $.LESS_THAN_SIGN: {
1391
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
1392
+ this._emitChars('<');
1393
+ break;
1394
+ }
1395
+ case $.GREATER_THAN_SIGN: {
1396
+ this.state = State.SCRIPT_DATA;
1397
+ this._emitChars('>');
1398
+ break;
1399
+ }
1400
+ case $.NULL: {
1401
+ this._err(ERR.unexpectedNullCharacter);
1402
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
1403
+ this._emitChars(REPLACEMENT_CHARACTER);
1404
+ break;
1405
+ }
1406
+ case $.EOF: {
1407
+ this._err(ERR.eofInScriptHtmlCommentLikeText);
1408
+ this._emitEOFToken();
1409
+ break;
1410
+ }
1411
+ default: {
1412
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
1413
+ this._emitCodePoint(cp);
1414
+ }
1415
+ }
1416
+ }
1417
+ // Script data double escaped less-than sign state
1418
+ //------------------------------------------------------------------
1419
+ _stateScriptDataDoubleEscapedLessThanSign(cp) {
1420
+ if (cp === $.SOLIDUS) {
1421
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_END;
1422
+ this._emitChars('/');
1423
+ }
1424
+ else {
1425
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
1426
+ this._stateScriptDataDoubleEscaped(cp);
1427
+ }
1428
+ }
1429
+ // Script data double escape end state
1430
+ //------------------------------------------------------------------
1431
+ _stateScriptDataDoubleEscapeEnd(cp) {
1432
+ if (this.preprocessor.startsWith($$.SCRIPT, false) &&
1433
+ isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek($$.SCRIPT.length))) {
1434
+ this._emitCodePoint(cp);
1435
+ for (let i = 0; i < $$.SCRIPT.length; i++) {
1436
+ this._emitCodePoint(this._consume());
1437
+ }
1438
+ this.state = State.SCRIPT_DATA_ESCAPED;
1439
+ }
1440
+ else if (!this._ensureHibernation()) {
1441
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
1442
+ this._stateScriptDataDoubleEscaped(cp);
1443
+ }
1444
+ }
1445
+ // Before attribute name state
1446
+ //------------------------------------------------------------------
1447
+ _stateBeforeAttributeName(cp) {
1448
+ switch (cp) {
1449
+ case $.SPACE:
1450
+ case $.LINE_FEED:
1451
+ case $.TABULATION:
1452
+ case $.FORM_FEED: {
1453
+ // Ignore whitespace
1454
+ break;
1455
+ }
1456
+ case $.SOLIDUS:
1457
+ case $.GREATER_THAN_SIGN:
1458
+ case $.EOF: {
1459
+ this.state = State.AFTER_ATTRIBUTE_NAME;
1460
+ this._stateAfterAttributeName(cp);
1461
+ break;
1462
+ }
1463
+ case $.EQUALS_SIGN: {
1464
+ this._err(ERR.unexpectedEqualsSignBeforeAttributeName);
1465
+ this._createAttr('=');
1466
+ this.state = State.ATTRIBUTE_NAME;
1467
+ break;
1468
+ }
1469
+ default: {
1470
+ this._createAttr('');
1471
+ this.state = State.ATTRIBUTE_NAME;
1472
+ this._stateAttributeName(cp);
1473
+ }
1474
+ }
1475
+ }
1476
+ // Attribute name state
1477
+ //------------------------------------------------------------------
1478
+ _stateAttributeName(cp) {
1479
+ switch (cp) {
1480
+ case $.SPACE:
1481
+ case $.LINE_FEED:
1482
+ case $.TABULATION:
1483
+ case $.FORM_FEED:
1484
+ case $.SOLIDUS:
1485
+ case $.GREATER_THAN_SIGN:
1486
+ case $.EOF: {
1487
+ this._leaveAttrName();
1488
+ this.state = State.AFTER_ATTRIBUTE_NAME;
1489
+ this._stateAfterAttributeName(cp);
1490
+ break;
1491
+ }
1492
+ case $.EQUALS_SIGN: {
1493
+ this._leaveAttrName();
1494
+ this.state = State.BEFORE_ATTRIBUTE_VALUE;
1495
+ break;
1496
+ }
1497
+ case $.QUOTATION_MARK:
1498
+ case $.APOSTROPHE:
1499
+ case $.LESS_THAN_SIGN: {
1500
+ this._err(ERR.unexpectedCharacterInAttributeName);
1501
+ this.currentAttr.name += String.fromCodePoint(cp);
1502
+ break;
1503
+ }
1504
+ case $.NULL: {
1505
+ this._err(ERR.unexpectedNullCharacter);
1506
+ this.currentAttr.name += REPLACEMENT_CHARACTER;
1507
+ break;
1508
+ }
1509
+ default: {
1510
+ this.currentAttr.name += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);
1511
+ }
1512
+ }
1513
+ }
1514
+ // After attribute name state
1515
+ //------------------------------------------------------------------
1516
+ _stateAfterAttributeName(cp) {
1517
+ switch (cp) {
1518
+ case $.SPACE:
1519
+ case $.LINE_FEED:
1520
+ case $.TABULATION:
1521
+ case $.FORM_FEED: {
1522
+ // Ignore whitespace
1523
+ break;
1524
+ }
1525
+ case $.SOLIDUS: {
1526
+ this.state = State.SELF_CLOSING_START_TAG;
1527
+ break;
1528
+ }
1529
+ case $.EQUALS_SIGN: {
1530
+ this.state = State.BEFORE_ATTRIBUTE_VALUE;
1531
+ break;
1532
+ }
1533
+ case $.GREATER_THAN_SIGN: {
1534
+ this.state = State.DATA;
1535
+ this.emitCurrentTagToken();
1536
+ break;
1537
+ }
1538
+ case $.EOF: {
1539
+ this._err(ERR.eofInTag);
1540
+ this._emitEOFToken();
1541
+ break;
1542
+ }
1543
+ default: {
1544
+ this._createAttr('');
1545
+ this.state = State.ATTRIBUTE_NAME;
1546
+ this._stateAttributeName(cp);
1547
+ }
1548
+ }
1549
+ }
1550
+ // Before attribute value state
1551
+ //------------------------------------------------------------------
1552
+ _stateBeforeAttributeValue(cp) {
1553
+ switch (cp) {
1554
+ case $.SPACE:
1555
+ case $.LINE_FEED:
1556
+ case $.TABULATION:
1557
+ case $.FORM_FEED: {
1558
+ // Ignore whitespace
1559
+ break;
1560
+ }
1561
+ case $.QUOTATION_MARK: {
1562
+ this.state = State.ATTRIBUTE_VALUE_DOUBLE_QUOTED;
1563
+ break;
1564
+ }
1565
+ case $.APOSTROPHE: {
1566
+ this.state = State.ATTRIBUTE_VALUE_SINGLE_QUOTED;
1567
+ break;
1568
+ }
1569
+ case $.GREATER_THAN_SIGN: {
1570
+ this._err(ERR.missingAttributeValue);
1571
+ this.state = State.DATA;
1572
+ this.emitCurrentTagToken();
1573
+ break;
1574
+ }
1575
+ default: {
1576
+ this.state = State.ATTRIBUTE_VALUE_UNQUOTED;
1577
+ this._stateAttributeValueUnquoted(cp);
1578
+ }
1579
+ }
1580
+ }
1581
+ // Attribute value (double-quoted) state
1582
+ //------------------------------------------------------------------
1583
+ _stateAttributeValueDoubleQuoted(cp) {
1584
+ switch (cp) {
1585
+ case $.QUOTATION_MARK: {
1586
+ this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;
1587
+ break;
1588
+ }
1589
+ case $.AMPERSAND: {
1590
+ this._startCharacterReference();
1591
+ break;
1592
+ }
1593
+ case $.NULL: {
1594
+ this._err(ERR.unexpectedNullCharacter);
1595
+ this.currentAttr.value += REPLACEMENT_CHARACTER;
1596
+ break;
1597
+ }
1598
+ case $.EOF: {
1599
+ this._err(ERR.eofInTag);
1600
+ this._emitEOFToken();
1601
+ break;
1602
+ }
1603
+ default: {
1604
+ this.currentAttr.value += String.fromCodePoint(cp);
1605
+ }
1606
+ }
1607
+ }
1608
+ // Attribute value (single-quoted) state
1609
+ //------------------------------------------------------------------
1610
+ _stateAttributeValueSingleQuoted(cp) {
1611
+ switch (cp) {
1612
+ case $.APOSTROPHE: {
1613
+ this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;
1614
+ break;
1615
+ }
1616
+ case $.AMPERSAND: {
1617
+ this._startCharacterReference();
1618
+ break;
1619
+ }
1620
+ case $.NULL: {
1621
+ this._err(ERR.unexpectedNullCharacter);
1622
+ this.currentAttr.value += REPLACEMENT_CHARACTER;
1623
+ break;
1624
+ }
1625
+ case $.EOF: {
1626
+ this._err(ERR.eofInTag);
1627
+ this._emitEOFToken();
1628
+ break;
1629
+ }
1630
+ default: {
1631
+ this.currentAttr.value += String.fromCodePoint(cp);
1632
+ }
1633
+ }
1634
+ }
1635
+ // Attribute value (unquoted) state
1636
+ //------------------------------------------------------------------
1637
+ _stateAttributeValueUnquoted(cp) {
1638
+ switch (cp) {
1639
+ case $.SPACE:
1640
+ case $.LINE_FEED:
1641
+ case $.TABULATION:
1642
+ case $.FORM_FEED: {
1643
+ this._leaveAttrValue();
1644
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
1645
+ break;
1646
+ }
1647
+ case $.AMPERSAND: {
1648
+ this._startCharacterReference();
1649
+ break;
1650
+ }
1651
+ case $.GREATER_THAN_SIGN: {
1652
+ this._leaveAttrValue();
1653
+ this.state = State.DATA;
1654
+ this.emitCurrentTagToken();
1655
+ break;
1656
+ }
1657
+ case $.NULL: {
1658
+ this._err(ERR.unexpectedNullCharacter);
1659
+ this.currentAttr.value += REPLACEMENT_CHARACTER;
1660
+ break;
1661
+ }
1662
+ case $.QUOTATION_MARK:
1663
+ case $.APOSTROPHE:
1664
+ case $.LESS_THAN_SIGN:
1665
+ case $.EQUALS_SIGN:
1666
+ case $.GRAVE_ACCENT: {
1667
+ this._err(ERR.unexpectedCharacterInUnquotedAttributeValue);
1668
+ this.currentAttr.value += String.fromCodePoint(cp);
1669
+ break;
1670
+ }
1671
+ case $.EOF: {
1672
+ this._err(ERR.eofInTag);
1673
+ this._emitEOFToken();
1674
+ break;
1675
+ }
1676
+ default: {
1677
+ this.currentAttr.value += String.fromCodePoint(cp);
1678
+ }
1679
+ }
1680
+ }
1681
+ // After attribute value (quoted) state
1682
+ //------------------------------------------------------------------
1683
+ _stateAfterAttributeValueQuoted(cp) {
1684
+ switch (cp) {
1685
+ case $.SPACE:
1686
+ case $.LINE_FEED:
1687
+ case $.TABULATION:
1688
+ case $.FORM_FEED: {
1689
+ this._leaveAttrValue();
1690
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
1691
+ break;
1692
+ }
1693
+ case $.SOLIDUS: {
1694
+ this._leaveAttrValue();
1695
+ this.state = State.SELF_CLOSING_START_TAG;
1696
+ break;
1697
+ }
1698
+ case $.GREATER_THAN_SIGN: {
1699
+ this._leaveAttrValue();
1700
+ this.state = State.DATA;
1701
+ this.emitCurrentTagToken();
1702
+ break;
1703
+ }
1704
+ case $.EOF: {
1705
+ this._err(ERR.eofInTag);
1706
+ this._emitEOFToken();
1707
+ break;
1708
+ }
1709
+ default: {
1710
+ this._err(ERR.missingWhitespaceBetweenAttributes);
1711
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
1712
+ this._stateBeforeAttributeName(cp);
1713
+ }
1714
+ }
1715
+ }
1716
+ // Self-closing start tag state
1717
+ //------------------------------------------------------------------
1718
+ _stateSelfClosingStartTag(cp) {
1719
+ switch (cp) {
1720
+ case $.GREATER_THAN_SIGN: {
1721
+ const token = this.currentToken;
1722
+ token.selfClosing = true;
1723
+ this.state = State.DATA;
1724
+ this.emitCurrentTagToken();
1725
+ break;
1726
+ }
1727
+ case $.EOF: {
1728
+ this._err(ERR.eofInTag);
1729
+ this._emitEOFToken();
1730
+ break;
1731
+ }
1732
+ default: {
1733
+ this._err(ERR.unexpectedSolidusInTag);
1734
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
1735
+ this._stateBeforeAttributeName(cp);
1736
+ }
1737
+ }
1738
+ }
1739
+ // Bogus comment state
1740
+ //------------------------------------------------------------------
1741
+ _stateBogusComment(cp) {
1742
+ const token = this.currentToken;
1743
+ switch (cp) {
1744
+ case $.GREATER_THAN_SIGN: {
1745
+ this.state = State.DATA;
1746
+ this.emitCurrentComment(token);
1747
+ break;
1748
+ }
1749
+ case $.EOF: {
1750
+ this.emitCurrentComment(token);
1751
+ this._emitEOFToken();
1752
+ break;
1753
+ }
1754
+ case $.NULL: {
1755
+ this._err(ERR.unexpectedNullCharacter);
1756
+ token.data += REPLACEMENT_CHARACTER;
1757
+ break;
1758
+ }
1759
+ default: {
1760
+ token.data += String.fromCodePoint(cp);
1761
+ }
1762
+ }
1763
+ }
1764
+ // Markup declaration open state
1765
+ //------------------------------------------------------------------
1766
+ _stateMarkupDeclarationOpen(cp) {
1767
+ if (this._consumeSequenceIfMatch($$.DASH_DASH, true)) {
1768
+ this._createCommentToken($$.DASH_DASH.length + 1);
1769
+ this.state = State.COMMENT_START;
1770
+ }
1771
+ else if (this._consumeSequenceIfMatch($$.DOCTYPE, false)) {
1772
+ // NOTE: Doctypes tokens are created without fixed offsets. We keep track of the moment a doctype *might* start here.
1773
+ this.currentLocation = this.getCurrentLocation($$.DOCTYPE.length + 1);
1774
+ this.state = State.DOCTYPE;
1775
+ }
1776
+ else if (this._consumeSequenceIfMatch($$.CDATA_START, true)) {
1777
+ if (this.inForeignNode) {
1778
+ this.state = State.CDATA_SECTION;
1779
+ }
1780
+ else {
1781
+ this._err(ERR.cdataInHtmlContent);
1782
+ this._createCommentToken($$.CDATA_START.length + 1);
1783
+ this.currentToken.data = '[CDATA[';
1784
+ this.state = State.BOGUS_COMMENT;
1785
+ }
1786
+ }
1787
+ //NOTE: Sequence lookups can be abrupted by hibernation. In that case, lookup
1788
+ //results are no longer valid and we will need to start over.
1789
+ else if (!this._ensureHibernation()) {
1790
+ this._err(ERR.incorrectlyOpenedComment);
1791
+ this._createCommentToken(2);
1792
+ this.state = State.BOGUS_COMMENT;
1793
+ this._stateBogusComment(cp);
1794
+ }
1795
+ }
1796
+ // Comment start state
1797
+ //------------------------------------------------------------------
1798
+ _stateCommentStart(cp) {
1799
+ switch (cp) {
1800
+ case $.HYPHEN_MINUS: {
1801
+ this.state = State.COMMENT_START_DASH;
1802
+ break;
1803
+ }
1804
+ case $.GREATER_THAN_SIGN: {
1805
+ this._err(ERR.abruptClosingOfEmptyComment);
1806
+ this.state = State.DATA;
1807
+ const token = this.currentToken;
1808
+ this.emitCurrentComment(token);
1809
+ break;
1810
+ }
1811
+ default: {
1812
+ this.state = State.COMMENT;
1813
+ this._stateComment(cp);
1814
+ }
1815
+ }
1816
+ }
1817
+ // Comment start dash state
1818
+ //------------------------------------------------------------------
1819
+ _stateCommentStartDash(cp) {
1820
+ const token = this.currentToken;
1821
+ switch (cp) {
1822
+ case $.HYPHEN_MINUS: {
1823
+ this.state = State.COMMENT_END;
1824
+ break;
1825
+ }
1826
+ case $.GREATER_THAN_SIGN: {
1827
+ this._err(ERR.abruptClosingOfEmptyComment);
1828
+ this.state = State.DATA;
1829
+ this.emitCurrentComment(token);
1830
+ break;
1831
+ }
1832
+ case $.EOF: {
1833
+ this._err(ERR.eofInComment);
1834
+ this.emitCurrentComment(token);
1835
+ this._emitEOFToken();
1836
+ break;
1837
+ }
1838
+ default: {
1839
+ token.data += '-';
1840
+ this.state = State.COMMENT;
1841
+ this._stateComment(cp);
1842
+ }
1843
+ }
1844
+ }
1845
+ // Comment state
1846
+ //------------------------------------------------------------------
1847
+ _stateComment(cp) {
1848
+ const token = this.currentToken;
1849
+ switch (cp) {
1850
+ case $.HYPHEN_MINUS: {
1851
+ this.state = State.COMMENT_END_DASH;
1852
+ break;
1853
+ }
1854
+ case $.LESS_THAN_SIGN: {
1855
+ token.data += '<';
1856
+ this.state = State.COMMENT_LESS_THAN_SIGN;
1857
+ break;
1858
+ }
1859
+ case $.NULL: {
1860
+ this._err(ERR.unexpectedNullCharacter);
1861
+ token.data += REPLACEMENT_CHARACTER;
1862
+ break;
1863
+ }
1864
+ case $.EOF: {
1865
+ this._err(ERR.eofInComment);
1866
+ this.emitCurrentComment(token);
1867
+ this._emitEOFToken();
1868
+ break;
1869
+ }
1870
+ default: {
1871
+ token.data += String.fromCodePoint(cp);
1872
+ }
1873
+ }
1874
+ }
1875
+ // Comment less-than sign state
1876
+ //------------------------------------------------------------------
1877
+ _stateCommentLessThanSign(cp) {
1878
+ const token = this.currentToken;
1879
+ switch (cp) {
1880
+ case $.EXCLAMATION_MARK: {
1881
+ token.data += '!';
1882
+ this.state = State.COMMENT_LESS_THAN_SIGN_BANG;
1883
+ break;
1884
+ }
1885
+ case $.LESS_THAN_SIGN: {
1886
+ token.data += '<';
1887
+ break;
1888
+ }
1889
+ default: {
1890
+ this.state = State.COMMENT;
1891
+ this._stateComment(cp);
1892
+ }
1893
+ }
1894
+ }
1895
+ // Comment less-than sign bang state
1896
+ //------------------------------------------------------------------
1897
+ _stateCommentLessThanSignBang(cp) {
1898
+ if (cp === $.HYPHEN_MINUS) {
1899
+ this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH;
1900
+ }
1901
+ else {
1902
+ this.state = State.COMMENT;
1903
+ this._stateComment(cp);
1904
+ }
1905
+ }
1906
+ // Comment less-than sign bang dash state
1907
+ //------------------------------------------------------------------
1908
+ _stateCommentLessThanSignBangDash(cp) {
1909
+ if (cp === $.HYPHEN_MINUS) {
1910
+ this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH;
1911
+ }
1912
+ else {
1913
+ this.state = State.COMMENT_END_DASH;
1914
+ this._stateCommentEndDash(cp);
1915
+ }
1916
+ }
1917
+ // Comment less-than sign bang dash dash state
1918
+ //------------------------------------------------------------------
1919
+ _stateCommentLessThanSignBangDashDash(cp) {
1920
+ if (cp !== $.GREATER_THAN_SIGN && cp !== $.EOF) {
1921
+ this._err(ERR.nestedComment);
1922
+ }
1923
+ this.state = State.COMMENT_END;
1924
+ this._stateCommentEnd(cp);
1925
+ }
1926
+ // Comment end dash state
1927
+ //------------------------------------------------------------------
1928
+ _stateCommentEndDash(cp) {
1929
+ const token = this.currentToken;
1930
+ switch (cp) {
1931
+ case $.HYPHEN_MINUS: {
1932
+ this.state = State.COMMENT_END;
1933
+ break;
1934
+ }
1935
+ case $.EOF: {
1936
+ this._err(ERR.eofInComment);
1937
+ this.emitCurrentComment(token);
1938
+ this._emitEOFToken();
1939
+ break;
1940
+ }
1941
+ default: {
1942
+ token.data += '-';
1943
+ this.state = State.COMMENT;
1944
+ this._stateComment(cp);
1945
+ }
1946
+ }
1947
+ }
1948
+ // Comment end state
1949
+ //------------------------------------------------------------------
1950
+ _stateCommentEnd(cp) {
1951
+ const token = this.currentToken;
1952
+ switch (cp) {
1953
+ case $.GREATER_THAN_SIGN: {
1954
+ this.state = State.DATA;
1955
+ this.emitCurrentComment(token);
1956
+ break;
1957
+ }
1958
+ case $.EXCLAMATION_MARK: {
1959
+ this.state = State.COMMENT_END_BANG;
1960
+ break;
1961
+ }
1962
+ case $.HYPHEN_MINUS: {
1963
+ token.data += '-';
1964
+ break;
1965
+ }
1966
+ case $.EOF: {
1967
+ this._err(ERR.eofInComment);
1968
+ this.emitCurrentComment(token);
1969
+ this._emitEOFToken();
1970
+ break;
1971
+ }
1972
+ default: {
1973
+ token.data += '--';
1974
+ this.state = State.COMMENT;
1975
+ this._stateComment(cp);
1976
+ }
1977
+ }
1978
+ }
1979
+ // Comment end bang state
1980
+ //------------------------------------------------------------------
1981
+ _stateCommentEndBang(cp) {
1982
+ const token = this.currentToken;
1983
+ switch (cp) {
1984
+ case $.HYPHEN_MINUS: {
1985
+ token.data += '--!';
1986
+ this.state = State.COMMENT_END_DASH;
1987
+ break;
1988
+ }
1989
+ case $.GREATER_THAN_SIGN: {
1990
+ this._err(ERR.incorrectlyClosedComment);
1991
+ this.state = State.DATA;
1992
+ this.emitCurrentComment(token);
1993
+ break;
1994
+ }
1995
+ case $.EOF: {
1996
+ this._err(ERR.eofInComment);
1997
+ this.emitCurrentComment(token);
1998
+ this._emitEOFToken();
1999
+ break;
2000
+ }
2001
+ default: {
2002
+ token.data += '--!';
2003
+ this.state = State.COMMENT;
2004
+ this._stateComment(cp);
2005
+ }
2006
+ }
2007
+ }
2008
+ // DOCTYPE state
2009
+ //------------------------------------------------------------------
2010
+ _stateDoctype(cp) {
2011
+ switch (cp) {
2012
+ case $.SPACE:
2013
+ case $.LINE_FEED:
2014
+ case $.TABULATION:
2015
+ case $.FORM_FEED: {
2016
+ this.state = State.BEFORE_DOCTYPE_NAME;
2017
+ break;
2018
+ }
2019
+ case $.GREATER_THAN_SIGN: {
2020
+ this.state = State.BEFORE_DOCTYPE_NAME;
2021
+ this._stateBeforeDoctypeName(cp);
2022
+ break;
2023
+ }
2024
+ case $.EOF: {
2025
+ this._err(ERR.eofInDoctype);
2026
+ this._createDoctypeToken(null);
2027
+ const token = this.currentToken;
2028
+ token.forceQuirks = true;
2029
+ this.emitCurrentDoctype(token);
2030
+ this._emitEOFToken();
2031
+ break;
2032
+ }
2033
+ default: {
2034
+ this._err(ERR.missingWhitespaceBeforeDoctypeName);
2035
+ this.state = State.BEFORE_DOCTYPE_NAME;
2036
+ this._stateBeforeDoctypeName(cp);
2037
+ }
2038
+ }
2039
+ }
2040
+ // Before DOCTYPE name state
2041
+ //------------------------------------------------------------------
2042
+ _stateBeforeDoctypeName(cp) {
2043
+ if (isAsciiUpper(cp)) {
2044
+ this._createDoctypeToken(String.fromCharCode(toAsciiLower(cp)));
2045
+ this.state = State.DOCTYPE_NAME;
2046
+ }
2047
+ else
2048
+ switch (cp) {
2049
+ case $.SPACE:
2050
+ case $.LINE_FEED:
2051
+ case $.TABULATION:
2052
+ case $.FORM_FEED: {
2053
+ // Ignore whitespace
2054
+ break;
2055
+ }
2056
+ case $.NULL: {
2057
+ this._err(ERR.unexpectedNullCharacter);
2058
+ this._createDoctypeToken(REPLACEMENT_CHARACTER);
2059
+ this.state = State.DOCTYPE_NAME;
2060
+ break;
2061
+ }
2062
+ case $.GREATER_THAN_SIGN: {
2063
+ this._err(ERR.missingDoctypeName);
2064
+ this._createDoctypeToken(null);
2065
+ const token = this.currentToken;
2066
+ token.forceQuirks = true;
2067
+ this.emitCurrentDoctype(token);
2068
+ this.state = State.DATA;
2069
+ break;
2070
+ }
2071
+ case $.EOF: {
2072
+ this._err(ERR.eofInDoctype);
2073
+ this._createDoctypeToken(null);
2074
+ const token = this.currentToken;
2075
+ token.forceQuirks = true;
2076
+ this.emitCurrentDoctype(token);
2077
+ this._emitEOFToken();
2078
+ break;
2079
+ }
2080
+ default: {
2081
+ this._createDoctypeToken(String.fromCodePoint(cp));
2082
+ this.state = State.DOCTYPE_NAME;
2083
+ }
2084
+ }
2085
+ }
2086
+ // DOCTYPE name state
2087
+ //------------------------------------------------------------------
2088
+ _stateDoctypeName(cp) {
2089
+ const token = this.currentToken;
2090
+ switch (cp) {
2091
+ case $.SPACE:
2092
+ case $.LINE_FEED:
2093
+ case $.TABULATION:
2094
+ case $.FORM_FEED: {
2095
+ this.state = State.AFTER_DOCTYPE_NAME;
2096
+ break;
2097
+ }
2098
+ case $.GREATER_THAN_SIGN: {
2099
+ this.state = State.DATA;
2100
+ this.emitCurrentDoctype(token);
2101
+ break;
2102
+ }
2103
+ case $.NULL: {
2104
+ this._err(ERR.unexpectedNullCharacter);
2105
+ token.name += REPLACEMENT_CHARACTER;
2106
+ break;
2107
+ }
2108
+ case $.EOF: {
2109
+ this._err(ERR.eofInDoctype);
2110
+ token.forceQuirks = true;
2111
+ this.emitCurrentDoctype(token);
2112
+ this._emitEOFToken();
2113
+ break;
2114
+ }
2115
+ default: {
2116
+ token.name += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);
2117
+ }
2118
+ }
2119
+ }
2120
+ // After DOCTYPE name state
2121
+ //------------------------------------------------------------------
2122
+ _stateAfterDoctypeName(cp) {
2123
+ const token = this.currentToken;
2124
+ switch (cp) {
2125
+ case $.SPACE:
2126
+ case $.LINE_FEED:
2127
+ case $.TABULATION:
2128
+ case $.FORM_FEED: {
2129
+ // Ignore whitespace
2130
+ break;
2131
+ }
2132
+ case $.GREATER_THAN_SIGN: {
2133
+ this.state = State.DATA;
2134
+ this.emitCurrentDoctype(token);
2135
+ break;
2136
+ }
2137
+ case $.EOF: {
2138
+ this._err(ERR.eofInDoctype);
2139
+ token.forceQuirks = true;
2140
+ this.emitCurrentDoctype(token);
2141
+ this._emitEOFToken();
2142
+ break;
2143
+ }
2144
+ default: {
2145
+ if (this._consumeSequenceIfMatch($$.PUBLIC, false)) {
2146
+ this.state = State.AFTER_DOCTYPE_PUBLIC_KEYWORD;
2147
+ }
2148
+ else if (this._consumeSequenceIfMatch($$.SYSTEM, false)) {
2149
+ this.state = State.AFTER_DOCTYPE_SYSTEM_KEYWORD;
2150
+ }
2151
+ //NOTE: sequence lookup can be abrupted by hibernation. In that case lookup
2152
+ //results are no longer valid and we will need to start over.
2153
+ else if (!this._ensureHibernation()) {
2154
+ this._err(ERR.invalidCharacterSequenceAfterDoctypeName);
2155
+ token.forceQuirks = true;
2156
+ this.state = State.BOGUS_DOCTYPE;
2157
+ this._stateBogusDoctype(cp);
2158
+ }
2159
+ }
2160
+ }
2161
+ }
2162
+ // After DOCTYPE public keyword state
2163
+ //------------------------------------------------------------------
2164
+ _stateAfterDoctypePublicKeyword(cp) {
2165
+ const token = this.currentToken;
2166
+ switch (cp) {
2167
+ case $.SPACE:
2168
+ case $.LINE_FEED:
2169
+ case $.TABULATION:
2170
+ case $.FORM_FEED: {
2171
+ this.state = State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;
2172
+ break;
2173
+ }
2174
+ case $.QUOTATION_MARK: {
2175
+ this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);
2176
+ token.publicId = '';
2177
+ this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;
2178
+ break;
2179
+ }
2180
+ case $.APOSTROPHE: {
2181
+ this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);
2182
+ token.publicId = '';
2183
+ this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;
2184
+ break;
2185
+ }
2186
+ case $.GREATER_THAN_SIGN: {
2187
+ this._err(ERR.missingDoctypePublicIdentifier);
2188
+ token.forceQuirks = true;
2189
+ this.state = State.DATA;
2190
+ this.emitCurrentDoctype(token);
2191
+ break;
2192
+ }
2193
+ case $.EOF: {
2194
+ this._err(ERR.eofInDoctype);
2195
+ token.forceQuirks = true;
2196
+ this.emitCurrentDoctype(token);
2197
+ this._emitEOFToken();
2198
+ break;
2199
+ }
2200
+ default: {
2201
+ this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);
2202
+ token.forceQuirks = true;
2203
+ this.state = State.BOGUS_DOCTYPE;
2204
+ this._stateBogusDoctype(cp);
2205
+ }
2206
+ }
2207
+ }
2208
+ // Before DOCTYPE public identifier state
2209
+ //------------------------------------------------------------------
2210
+ _stateBeforeDoctypePublicIdentifier(cp) {
2211
+ const token = this.currentToken;
2212
+ switch (cp) {
2213
+ case $.SPACE:
2214
+ case $.LINE_FEED:
2215
+ case $.TABULATION:
2216
+ case $.FORM_FEED: {
2217
+ // Ignore whitespace
2218
+ break;
2219
+ }
2220
+ case $.QUOTATION_MARK: {
2221
+ token.publicId = '';
2222
+ this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;
2223
+ break;
2224
+ }
2225
+ case $.APOSTROPHE: {
2226
+ token.publicId = '';
2227
+ this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;
2228
+ break;
2229
+ }
2230
+ case $.GREATER_THAN_SIGN: {
2231
+ this._err(ERR.missingDoctypePublicIdentifier);
2232
+ token.forceQuirks = true;
2233
+ this.state = State.DATA;
2234
+ this.emitCurrentDoctype(token);
2235
+ break;
2236
+ }
2237
+ case $.EOF: {
2238
+ this._err(ERR.eofInDoctype);
2239
+ token.forceQuirks = true;
2240
+ this.emitCurrentDoctype(token);
2241
+ this._emitEOFToken();
2242
+ break;
2243
+ }
2244
+ default: {
2245
+ this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);
2246
+ token.forceQuirks = true;
2247
+ this.state = State.BOGUS_DOCTYPE;
2248
+ this._stateBogusDoctype(cp);
2249
+ }
2250
+ }
2251
+ }
2252
+ // DOCTYPE public identifier (double-quoted) state
2253
+ //------------------------------------------------------------------
2254
+ _stateDoctypePublicIdentifierDoubleQuoted(cp) {
2255
+ const token = this.currentToken;
2256
+ switch (cp) {
2257
+ case $.QUOTATION_MARK: {
2258
+ this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;
2259
+ break;
2260
+ }
2261
+ case $.NULL: {
2262
+ this._err(ERR.unexpectedNullCharacter);
2263
+ token.publicId += REPLACEMENT_CHARACTER;
2264
+ break;
2265
+ }
2266
+ case $.GREATER_THAN_SIGN: {
2267
+ this._err(ERR.abruptDoctypePublicIdentifier);
2268
+ token.forceQuirks = true;
2269
+ this.emitCurrentDoctype(token);
2270
+ this.state = State.DATA;
2271
+ break;
2272
+ }
2273
+ case $.EOF: {
2274
+ this._err(ERR.eofInDoctype);
2275
+ token.forceQuirks = true;
2276
+ this.emitCurrentDoctype(token);
2277
+ this._emitEOFToken();
2278
+ break;
2279
+ }
2280
+ default: {
2281
+ token.publicId += String.fromCodePoint(cp);
2282
+ }
2283
+ }
2284
+ }
2285
+ // DOCTYPE public identifier (single-quoted) state
2286
+ //------------------------------------------------------------------
2287
+ _stateDoctypePublicIdentifierSingleQuoted(cp) {
2288
+ const token = this.currentToken;
2289
+ switch (cp) {
2290
+ case $.APOSTROPHE: {
2291
+ this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;
2292
+ break;
2293
+ }
2294
+ case $.NULL: {
2295
+ this._err(ERR.unexpectedNullCharacter);
2296
+ token.publicId += REPLACEMENT_CHARACTER;
2297
+ break;
2298
+ }
2299
+ case $.GREATER_THAN_SIGN: {
2300
+ this._err(ERR.abruptDoctypePublicIdentifier);
2301
+ token.forceQuirks = true;
2302
+ this.emitCurrentDoctype(token);
2303
+ this.state = State.DATA;
2304
+ break;
2305
+ }
2306
+ case $.EOF: {
2307
+ this._err(ERR.eofInDoctype);
2308
+ token.forceQuirks = true;
2309
+ this.emitCurrentDoctype(token);
2310
+ this._emitEOFToken();
2311
+ break;
2312
+ }
2313
+ default: {
2314
+ token.publicId += String.fromCodePoint(cp);
2315
+ }
2316
+ }
2317
+ }
2318
+ // After DOCTYPE public identifier state
2319
+ //------------------------------------------------------------------
2320
+ _stateAfterDoctypePublicIdentifier(cp) {
2321
+ const token = this.currentToken;
2322
+ switch (cp) {
2323
+ case $.SPACE:
2324
+ case $.LINE_FEED:
2325
+ case $.TABULATION:
2326
+ case $.FORM_FEED: {
2327
+ this.state = State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;
2328
+ break;
2329
+ }
2330
+ case $.GREATER_THAN_SIGN: {
2331
+ this.state = State.DATA;
2332
+ this.emitCurrentDoctype(token);
2333
+ break;
2334
+ }
2335
+ case $.QUOTATION_MARK: {
2336
+ this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
2337
+ token.systemId = '';
2338
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
2339
+ break;
2340
+ }
2341
+ case $.APOSTROPHE: {
2342
+ this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
2343
+ token.systemId = '';
2344
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
2345
+ break;
2346
+ }
2347
+ case $.EOF: {
2348
+ this._err(ERR.eofInDoctype);
2349
+ token.forceQuirks = true;
2350
+ this.emitCurrentDoctype(token);
2351
+ this._emitEOFToken();
2352
+ break;
2353
+ }
2354
+ default: {
2355
+ this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
2356
+ token.forceQuirks = true;
2357
+ this.state = State.BOGUS_DOCTYPE;
2358
+ this._stateBogusDoctype(cp);
2359
+ }
2360
+ }
2361
+ }
2362
+ // Between DOCTYPE public and system identifiers state
2363
+ //------------------------------------------------------------------
2364
+ _stateBetweenDoctypePublicAndSystemIdentifiers(cp) {
2365
+ const token = this.currentToken;
2366
+ switch (cp) {
2367
+ case $.SPACE:
2368
+ case $.LINE_FEED:
2369
+ case $.TABULATION:
2370
+ case $.FORM_FEED: {
2371
+ // Ignore whitespace
2372
+ break;
2373
+ }
2374
+ case $.GREATER_THAN_SIGN: {
2375
+ this.emitCurrentDoctype(token);
2376
+ this.state = State.DATA;
2377
+ break;
2378
+ }
2379
+ case $.QUOTATION_MARK: {
2380
+ token.systemId = '';
2381
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
2382
+ break;
2383
+ }
2384
+ case $.APOSTROPHE: {
2385
+ token.systemId = '';
2386
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
2387
+ break;
2388
+ }
2389
+ case $.EOF: {
2390
+ this._err(ERR.eofInDoctype);
2391
+ token.forceQuirks = true;
2392
+ this.emitCurrentDoctype(token);
2393
+ this._emitEOFToken();
2394
+ break;
2395
+ }
2396
+ default: {
2397
+ this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
2398
+ token.forceQuirks = true;
2399
+ this.state = State.BOGUS_DOCTYPE;
2400
+ this._stateBogusDoctype(cp);
2401
+ }
2402
+ }
2403
+ }
2404
+ // After DOCTYPE system keyword state
2405
+ //------------------------------------------------------------------
2406
+ _stateAfterDoctypeSystemKeyword(cp) {
2407
+ const token = this.currentToken;
2408
+ switch (cp) {
2409
+ case $.SPACE:
2410
+ case $.LINE_FEED:
2411
+ case $.TABULATION:
2412
+ case $.FORM_FEED: {
2413
+ this.state = State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;
2414
+ break;
2415
+ }
2416
+ case $.QUOTATION_MARK: {
2417
+ this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);
2418
+ token.systemId = '';
2419
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
2420
+ break;
2421
+ }
2422
+ case $.APOSTROPHE: {
2423
+ this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);
2424
+ token.systemId = '';
2425
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
2426
+ break;
2427
+ }
2428
+ case $.GREATER_THAN_SIGN: {
2429
+ this._err(ERR.missingDoctypeSystemIdentifier);
2430
+ token.forceQuirks = true;
2431
+ this.state = State.DATA;
2432
+ this.emitCurrentDoctype(token);
2433
+ break;
2434
+ }
2435
+ case $.EOF: {
2436
+ this._err(ERR.eofInDoctype);
2437
+ token.forceQuirks = true;
2438
+ this.emitCurrentDoctype(token);
2439
+ this._emitEOFToken();
2440
+ break;
2441
+ }
2442
+ default: {
2443
+ this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
2444
+ token.forceQuirks = true;
2445
+ this.state = State.BOGUS_DOCTYPE;
2446
+ this._stateBogusDoctype(cp);
2447
+ }
2448
+ }
2449
+ }
2450
+ // Before DOCTYPE system identifier state
2451
+ //------------------------------------------------------------------
2452
+ _stateBeforeDoctypeSystemIdentifier(cp) {
2453
+ const token = this.currentToken;
2454
+ switch (cp) {
2455
+ case $.SPACE:
2456
+ case $.LINE_FEED:
2457
+ case $.TABULATION:
2458
+ case $.FORM_FEED: {
2459
+ // Ignore whitespace
2460
+ break;
2461
+ }
2462
+ case $.QUOTATION_MARK: {
2463
+ token.systemId = '';
2464
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
2465
+ break;
2466
+ }
2467
+ case $.APOSTROPHE: {
2468
+ token.systemId = '';
2469
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
2470
+ break;
2471
+ }
2472
+ case $.GREATER_THAN_SIGN: {
2473
+ this._err(ERR.missingDoctypeSystemIdentifier);
2474
+ token.forceQuirks = true;
2475
+ this.state = State.DATA;
2476
+ this.emitCurrentDoctype(token);
2477
+ break;
2478
+ }
2479
+ case $.EOF: {
2480
+ this._err(ERR.eofInDoctype);
2481
+ token.forceQuirks = true;
2482
+ this.emitCurrentDoctype(token);
2483
+ this._emitEOFToken();
2484
+ break;
2485
+ }
2486
+ default: {
2487
+ this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
2488
+ token.forceQuirks = true;
2489
+ this.state = State.BOGUS_DOCTYPE;
2490
+ this._stateBogusDoctype(cp);
2491
+ }
2492
+ }
2493
+ }
2494
+ // DOCTYPE system identifier (double-quoted) state
2495
+ //------------------------------------------------------------------
2496
+ _stateDoctypeSystemIdentifierDoubleQuoted(cp) {
2497
+ const token = this.currentToken;
2498
+ switch (cp) {
2499
+ case $.QUOTATION_MARK: {
2500
+ this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;
2501
+ break;
2502
+ }
2503
+ case $.NULL: {
2504
+ this._err(ERR.unexpectedNullCharacter);
2505
+ token.systemId += REPLACEMENT_CHARACTER;
2506
+ break;
2507
+ }
2508
+ case $.GREATER_THAN_SIGN: {
2509
+ this._err(ERR.abruptDoctypeSystemIdentifier);
2510
+ token.forceQuirks = true;
2511
+ this.emitCurrentDoctype(token);
2512
+ this.state = State.DATA;
2513
+ break;
2514
+ }
2515
+ case $.EOF: {
2516
+ this._err(ERR.eofInDoctype);
2517
+ token.forceQuirks = true;
2518
+ this.emitCurrentDoctype(token);
2519
+ this._emitEOFToken();
2520
+ break;
2521
+ }
2522
+ default: {
2523
+ token.systemId += String.fromCodePoint(cp);
2524
+ }
2525
+ }
2526
+ }
2527
+ // DOCTYPE system identifier (single-quoted) state
2528
+ //------------------------------------------------------------------
2529
+ _stateDoctypeSystemIdentifierSingleQuoted(cp) {
2530
+ const token = this.currentToken;
2531
+ switch (cp) {
2532
+ case $.APOSTROPHE: {
2533
+ this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;
2534
+ break;
2535
+ }
2536
+ case $.NULL: {
2537
+ this._err(ERR.unexpectedNullCharacter);
2538
+ token.systemId += REPLACEMENT_CHARACTER;
2539
+ break;
2540
+ }
2541
+ case $.GREATER_THAN_SIGN: {
2542
+ this._err(ERR.abruptDoctypeSystemIdentifier);
2543
+ token.forceQuirks = true;
2544
+ this.emitCurrentDoctype(token);
2545
+ this.state = State.DATA;
2546
+ break;
2547
+ }
2548
+ case $.EOF: {
2549
+ this._err(ERR.eofInDoctype);
2550
+ token.forceQuirks = true;
2551
+ this.emitCurrentDoctype(token);
2552
+ this._emitEOFToken();
2553
+ break;
2554
+ }
2555
+ default: {
2556
+ token.systemId += String.fromCodePoint(cp);
2557
+ }
2558
+ }
2559
+ }
2560
+ // After DOCTYPE system identifier state
2561
+ //------------------------------------------------------------------
2562
+ _stateAfterDoctypeSystemIdentifier(cp) {
2563
+ const token = this.currentToken;
2564
+ switch (cp) {
2565
+ case $.SPACE:
2566
+ case $.LINE_FEED:
2567
+ case $.TABULATION:
2568
+ case $.FORM_FEED: {
2569
+ // Ignore whitespace
2570
+ break;
2571
+ }
2572
+ case $.GREATER_THAN_SIGN: {
2573
+ this.emitCurrentDoctype(token);
2574
+ this.state = State.DATA;
2575
+ break;
2576
+ }
2577
+ case $.EOF: {
2578
+ this._err(ERR.eofInDoctype);
2579
+ token.forceQuirks = true;
2580
+ this.emitCurrentDoctype(token);
2581
+ this._emitEOFToken();
2582
+ break;
2583
+ }
2584
+ default: {
2585
+ this._err(ERR.unexpectedCharacterAfterDoctypeSystemIdentifier);
2586
+ this.state = State.BOGUS_DOCTYPE;
2587
+ this._stateBogusDoctype(cp);
2588
+ }
2589
+ }
2590
+ }
2591
+ // Bogus DOCTYPE state
2592
+ //------------------------------------------------------------------
2593
+ _stateBogusDoctype(cp) {
2594
+ const token = this.currentToken;
2595
+ switch (cp) {
2596
+ case $.GREATER_THAN_SIGN: {
2597
+ this.emitCurrentDoctype(token);
2598
+ this.state = State.DATA;
2599
+ break;
2600
+ }
2601
+ case $.NULL: {
2602
+ this._err(ERR.unexpectedNullCharacter);
2603
+ break;
2604
+ }
2605
+ case $.EOF: {
2606
+ this.emitCurrentDoctype(token);
2607
+ this._emitEOFToken();
2608
+ break;
2609
+ }
2610
+ default:
2611
+ // Do nothing
2612
+ }
2613
+ }
2614
+ // CDATA section state
2615
+ //------------------------------------------------------------------
2616
+ _stateCdataSection(cp) {
2617
+ switch (cp) {
2618
+ case $.RIGHT_SQUARE_BRACKET: {
2619
+ this.state = State.CDATA_SECTION_BRACKET;
2620
+ break;
2621
+ }
2622
+ case $.EOF: {
2623
+ this._err(ERR.eofInCdata);
2624
+ this._emitEOFToken();
2625
+ break;
2626
+ }
2627
+ default: {
2628
+ this._emitCodePoint(cp);
2629
+ }
2630
+ }
2631
+ }
2632
+ // CDATA section bracket state
2633
+ //------------------------------------------------------------------
2634
+ _stateCdataSectionBracket(cp) {
2635
+ if (cp === $.RIGHT_SQUARE_BRACKET) {
2636
+ this.state = State.CDATA_SECTION_END;
2637
+ }
2638
+ else {
2639
+ this._emitChars(']');
2640
+ this.state = State.CDATA_SECTION;
2641
+ this._stateCdataSection(cp);
2642
+ }
2643
+ }
2644
+ // CDATA section end state
2645
+ //------------------------------------------------------------------
2646
+ _stateCdataSectionEnd(cp) {
2647
+ switch (cp) {
2648
+ case $.GREATER_THAN_SIGN: {
2649
+ this.state = State.DATA;
2650
+ break;
2651
+ }
2652
+ case $.RIGHT_SQUARE_BRACKET: {
2653
+ this._emitChars(']');
2654
+ break;
2655
+ }
2656
+ default: {
2657
+ this._emitChars(']]');
2658
+ this.state = State.CDATA_SECTION;
2659
+ this._stateCdataSection(cp);
2660
+ }
2661
+ }
2662
+ }
2663
+ // Character reference state
2664
+ //------------------------------------------------------------------
2665
+ _stateCharacterReference() {
2666
+ let length = this.entityDecoder.write(this.preprocessor.html, this.preprocessor.pos);
2667
+ if (length < 0) {
2668
+ if (this.preprocessor.lastChunkWritten) {
2669
+ length = this.entityDecoder.end();
2670
+ }
2671
+ else {
2672
+ // Wait for the rest of the entity.
2673
+ this.active = false;
2674
+ // Mark the entire buffer as read.
2675
+ this.preprocessor.pos = this.preprocessor.html.length - 1;
2676
+ this.consumedAfterSnapshot = 0;
2677
+ this.preprocessor.endOfChunkHit = true;
2678
+ return;
2679
+ }
2680
+ }
2681
+ if (length === 0) {
2682
+ // This was not a valid entity. Go back to the beginning, and
2683
+ // figure out what to do.
2684
+ this.preprocessor.pos = this.entityStartPos;
2685
+ this._flushCodePointConsumedAsCharacterReference($.AMPERSAND);
2686
+ this.state =
2687
+ !this._isCharacterReferenceInAttribute() && isAsciiAlphaNumeric(this.preprocessor.peek(1))
2688
+ ? State.AMBIGUOUS_AMPERSAND
2689
+ : this.returnState;
2690
+ }
2691
+ else {
2692
+ // We successfully parsed an entity. Switch to the return state.
2693
+ this.state = this.returnState;
2694
+ }
2695
+ }
2696
+ // Ambiguos ampersand state
2697
+ //------------------------------------------------------------------
2698
+ _stateAmbiguousAmpersand(cp) {
2699
+ if (isAsciiAlphaNumeric(cp)) {
2700
+ this._flushCodePointConsumedAsCharacterReference(cp);
2701
+ }
2702
+ else {
2703
+ if (cp === $.SEMICOLON) {
2704
+ this._err(ERR.unknownNamedCharacterReference);
2705
+ }
2706
+ this.state = this.returnState;
2707
+ this._callState(cp);
2708
+ }
2709
+ }
2710
+ }