reactive-md 0.9.0 → 0.9.2

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 (338) hide show
  1. package/CHANGELOG-ch.md +333 -306
  2. package/CHANGELOG.md +334 -307
  3. package/CONTRIBUTING-ch.md +22 -22
  4. package/CONTRIBUTING.md +22 -22
  5. package/README-ch.md +431 -431
  6. package/README-en.md +431 -431
  7. package/README.md +429 -429
  8. package/SECURITY-ch.md +83 -83
  9. package/SECURITY.md +83 -83
  10. package/THIRD_PARTY_NOTICES.md +111 -1
  11. package/bin/reactive-md.mjs +39 -39
  12. package/cli/args.mjs +263 -263
  13. package/cli/assets.mjs +395 -395
  14. package/cli/build.mjs +445 -444
  15. package/cli/check.mjs +444 -444
  16. package/cli/document.mjs +130 -130
  17. package/cli/errors.mjs +61 -61
  18. package/cli/fs-utils.mjs +133 -133
  19. package/cli/glob.mjs +203 -203
  20. package/cli/help.mjs +323 -323
  21. package/cli/init.mjs +1577 -1577
  22. package/cli/lint.mjs +177 -177
  23. package/cli/main.mjs +65 -65
  24. package/cli/migrate.mjs +368 -368
  25. package/cli/package-loader.mjs +41 -41
  26. package/cli/package.mjs +211 -211
  27. package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-BuqgJZEY.js} +11 -11
  28. package/dist-library/LocalDocumentViewCore-DXE0I0Qc.js +9830 -0
  29. package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +275 -0
  30. package/dist-library/{authoring-Co_TiE-P.js → authoring-Ci_KzJ0q.js} +87 -67
  31. package/dist-library/{compile-LhpTKqCR.js → compile-Dx6Uw3D9.js} +11 -11
  32. package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-DDDdvuLy.js} +2618 -1846
  33. package/dist-library/compiler-dxLPB9Ym.js +86 -0
  34. package/dist-library/{component-state-BBJ08vML.js → component-state-BRwvTV0d.js} +15 -14
  35. package/dist-library/component-state-CwKX_SN5.js +763 -0
  36. package/dist-library/{config-BUo-8O5C.js → config-DXLvctiZ.js} +68 -66
  37. package/dist-library/config-validation-D3D7Dy2J.js +586 -0
  38. package/dist-library/{controls-BWiLLtBO.js → controls-DoZyLCrV.js} +2434 -2410
  39. package/dist-library/{coordinate-BSl6enWV.js → coordinate-B1VFK9fd.js} +108 -107
  40. package/dist-library/{data-table-DfvytZKQ.js → data-table-8-3F15Jf.js} +69 -66
  41. package/dist-library/{default-components-BwQf0oP-.js → default-components-s21NevON.js} +29 -28
  42. package/dist-library/{display-lw3BT1TA.js → display-B_uutKkN.js} +1 -1
  43. package/dist-library/{config-validation-C5kJYk-J.js → document-theme-C8J6UyNO.js} +241 -731
  44. package/dist-library/export-CIAIPBov.js +370 -0
  45. package/dist-library/{gallery-B8kSt1oI.js → gallery-Dv1rOvL0.js} +151 -147
  46. package/dist-library/html-Cr4CBwAH.js +758 -0
  47. package/dist-library/identity-BUx0Q_-d.js +40 -0
  48. package/dist-library/{incremental-D_6vwAAE.js → incremental-9nx92u9c.js} +407 -143
  49. package/dist-library/layout-BBB2VF0S.js +562 -0
  50. package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-DMZ5wd3t.js} +3 -3
  51. package/dist-library/observability-4KqXhIEU.js +421 -0
  52. package/dist-library/observability-core-Bcu7vpnl.js +24 -0
  53. package/dist-library/options-BBp9IcHm.js +121 -0
  54. package/dist-library/{package-core-D0POW4Gd.js → package-core-K5xesGqy.js} +30 -29
  55. package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-CBA1-hdG.js} +3332 -3840
  56. package/dist-library/{plugin-packs-B1XPWcFs.js → plugin-packs-Bh1HhLym.js} +3 -2
  57. package/dist-library/preset-core-DeZPA8IE.js +1298 -0
  58. package/dist-library/react-0DCh-Mar.js +7 -0
  59. package/dist-library/reactive-md-authoring.js +28 -30
  60. package/dist-library/reactive-md-build.js +99 -61
  61. package/dist-library/reactive-md-compiler-standard.js +10 -9
  62. package/dist-library/reactive-md-compiler.js +3 -3
  63. package/dist-library/reactive-md-default-packs.js +3 -2
  64. package/dist-library/reactive-md-default-preset.js +3 -2
  65. package/dist-library/reactive-md-export.js +4 -4
  66. package/dist-library/reactive-md-minimal-preset.js +2 -2
  67. package/dist-library/reactive-md-minimal-react-preset.js +3 -3
  68. package/dist-library/reactive-md-observability.js +4 -0
  69. package/dist-library/reactive-md-pdf.js +127 -3
  70. package/dist-library/reactive-md-plugin-chart.js +3 -3
  71. package/dist-library/reactive-md-plugin-data.js +5 -5
  72. package/dist-library/reactive-md-plugin-diagram.js +4 -4
  73. package/dist-library/reactive-md-plugin-forms.js +4 -4
  74. package/dist-library/reactive-md-plugin-gallery.js +3 -3
  75. package/dist-library/reactive-md-plugin-navigation.js +3 -3
  76. package/dist-library/reactive-md-plugin-network.js +119 -116
  77. package/dist-library/reactive-md-plugin-plot.js +4 -4
  78. package/dist-library/reactive-md-print.css +304 -304
  79. package/dist-library/reactive-md-react-minimal.js +4 -4
  80. package/dist-library/reactive-md-react-server.js +6 -6
  81. package/dist-library/reactive-md-react-unstyled.js +11 -12
  82. package/dist-library/reactive-md-react.js +11 -12
  83. package/dist-library/reactive-md-runtime-browser.js +2 -1
  84. package/dist-library/reactive-md-runtime.js +4 -3
  85. package/dist-library/reactive-md-sdk.js +8 -7
  86. package/dist-library/reactive-md-standalone-configured.js +2 -2
  87. package/dist-library/reactive-md-standalone-host.js +2 -2
  88. package/dist-library/reactive-md-testing-browser.js +2 -2
  89. package/dist-library/reactive-md-testing-react.js +6 -6
  90. package/dist-library/reactive-md-testing.js +5 -5
  91. package/dist-library/reactive-md.js +649 -373
  92. package/dist-library/{registry-05JiqmEp.js → registry-D6OGkOcX.js} +3 -3
  93. package/dist-library/{registry-core-Bbad9Bm2.js → registry-core-C9xOunaw.js} +1 -1
  94. package/dist-library/{resources-IeJomeUT.js → resources-B0x_w3s9.js} +71 -46
  95. package/dist-library/{runtime-B2fxeveq.js → runtime-BDnnimPA.js} +17 -16
  96. package/dist-library/{runtime-CuOyRe9f.js → runtime-BpQdZmFI.js} +269 -263
  97. package/dist-library/{schema-C-AeByPp.js → schema-BryM_VRW.js} +14 -14
  98. package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-ChslheKs.js} +499 -158
  99. package/dist-library/{session-core-BGka5D1J.js → session-core-dxQCJBNa.js} +171 -156
  100. package/dist-library/{shareable-jkGi2g6y.js → shareable-B8xMoGEa.js} +265 -297
  101. package/dist-library/types/authoring/catalog.d.ts +1 -2
  102. package/dist-library/types/build/diagnostics.d.ts +1 -1
  103. package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
  104. package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
  105. package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
  106. package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
  107. package/dist-library/types/local/compilation/compiler.d.ts +3 -3
  108. package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
  109. package/dist-library/types/local/compilation/streaming.d.ts +27 -0
  110. package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
  111. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
  112. package/dist-library/types/local/configuration/options-core.d.ts +1 -2
  113. package/dist-library/types/local/configuration/options.d.ts +1 -0
  114. package/dist-library/types/local/css/author-css.d.ts +66 -0
  115. package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
  116. package/dist-library/types/local/html/html.d.ts +39 -3
  117. package/dist-library/types/local/index.d.ts +7 -1
  118. package/dist-library/types/local/observability-codes.d.ts +2 -0
  119. package/dist-library/types/local/observability-core.d.ts +25 -0
  120. package/dist-library/types/local/observability-messages.d.ts +6 -0
  121. package/dist-library/types/local/observability.d.ts +43 -0
  122. package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
  123. package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
  124. package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
  125. package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
  126. package/dist-library/types/local/parsing/parser-internals.d.ts +2 -1
  127. package/dist-library/types/local/parsing/parser.d.ts +2 -2
  128. package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
  129. package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
  130. package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
  131. package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
  132. package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
  133. package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
  134. package/dist-library/types/local/transport/worker.d.ts +79 -5
  135. package/dist-library/types/local/types.d.ts +60 -16
  136. package/dist-library/types/observability.d.ts +7 -0
  137. package/dist-library/types/react/component-api.d.ts +10 -1
  138. package/dist-library/types/react/component-utils.d.ts +9 -1
  139. package/dist-library/types/react/sdk-core.d.ts +4 -1
  140. package/dist-library/types/shareable.d.ts +5 -4
  141. package/dist-library/types/standalone/prepare.d.ts +1 -1
  142. package/dist-library/types/standalone/session-core.d.ts +3 -2
  143. package/dist-library/{types-BFC5rzC4.js → types-Ib5kSScP.js} +1 -1
  144. package/dist-library/types-daDo2c_w.js +3 -0
  145. package/dist-library/{validation-BlDL2uD9.js → validation-B3RI0xOk.js} +218 -200
  146. package/dist-library/version-DAxuGOG2.js +147 -0
  147. package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-_rcd5HUv.js} +6 -5
  148. package/dist-library/{visuals-BkYRmYGO.js → visuals-DkDhNdEZ.js} +24191 -24190
  149. package/dist-standalone/reactive-md-standalone.js +124 -117
  150. package/docs/README-ch.md +101 -94
  151. package/docs/README.md +101 -94
  152. package/docs/compatibility/api-stability-ch.md +25 -0
  153. package/docs/compatibility/api-stability-en.md +25 -0
  154. package/docs/compatibility/compatibility-ch.md +146 -129
  155. package/docs/compatibility/compatibility-en.md +146 -129
  156. package/docs/compatibility/compatibility-manifest.schema.json +161 -0
  157. package/docs/compatibility/deprecation-ch.md +21 -0
  158. package/docs/compatibility/deprecation-en.md +21 -0
  159. package/docs/compatibility/source-versioning-ch.md +162 -162
  160. package/docs/compatibility/source-versioning-en.md +162 -162
  161. package/docs/compatibility/support-matrix-ch.md +108 -0
  162. package/docs/compatibility/support-matrix-en.md +108 -0
  163. package/docs/development/component-development-ch.md +66 -66
  164. package/docs/development/component-development-en.md +66 -66
  165. package/docs/development/component-development-reference-ch.md +253 -253
  166. package/docs/development/component-development-reference-en.md +238 -238
  167. package/docs/development/component-protocol-ch.md +748 -748
  168. package/docs/development/component-protocol-en.md +750 -750
  169. package/docs/development/extension-tutorial-ch.md +308 -308
  170. package/docs/development/extension-tutorial-en.md +308 -308
  171. package/docs/development/performance-overview-ch.md +422 -422
  172. package/docs/development/performance-overview-en.md +422 -422
  173. package/docs/guides/local-guide-ch.md +532 -532
  174. package/docs/guides/local-guide-en.md +532 -532
  175. package/docs/integration/author-tools-ch.md +64 -64
  176. package/docs/integration/author-tools-en.md +64 -64
  177. package/docs/integration/compiler-ch.md +49 -47
  178. package/docs/integration/compiler-en.md +36 -34
  179. package/docs/integration/directory-discovery-en.md +1 -1
  180. package/docs/integration/editor-ch.md +295 -295
  181. package/docs/integration/editor-en.md +303 -303
  182. package/docs/integration/extension-sdk-ch.md +394 -394
  183. package/docs/integration/extension-sdk-en.md +379 -379
  184. package/docs/integration/local-integration-ch.md +646 -524
  185. package/docs/integration/local-integration-en.md +662 -540
  186. package/docs/integration/shareable-export-ch.md +307 -305
  187. package/docs/integration/shareable-export-en.md +309 -307
  188. package/docs/reference/diagnostics-counting-ch.md +104 -104
  189. package/docs/reference/diagnostics-counting-en.md +104 -104
  190. package/docs/reference/html-compatibility-ch.md +93 -140
  191. package/docs/reference/html-compatibility-en.md +95 -140
  192. package/docs/reference/local-interaction-syntax-ch.md +724 -724
  193. package/docs/reference/local-interaction-syntax-en.md +722 -722
  194. package/docs/reference/public-api-ch.md +39 -7
  195. package/docs/reference/public-api-en.md +39 -7
  196. package/docs/reference/theme-protocol-ch.md +198 -198
  197. package/docs/reference/theme-protocol-en.md +217 -217
  198. package/docs/releases/release-0.4.0-ch.md +91 -91
  199. package/docs/releases/release-0.4.0-en.md +91 -91
  200. package/docs/releases/release-0.4.1-ch.md +25 -25
  201. package/docs/releases/release-0.4.1-en.md +25 -25
  202. package/docs/releases/release-0.5.0-ch.md +43 -43
  203. package/docs/releases/release-0.5.0-en.md +43 -43
  204. package/docs/releases/release-0.5.1-ch.md +41 -41
  205. package/docs/releases/release-0.5.1-en.md +41 -41
  206. package/docs/releases/release-0.5.2-ch.md +37 -37
  207. package/docs/releases/release-0.5.2-en.md +37 -37
  208. package/docs/releases/release-0.5.3-ch.md +26 -26
  209. package/docs/releases/release-0.5.3-en.md +26 -26
  210. package/docs/releases/release-0.6.0-ch.md +59 -59
  211. package/docs/releases/release-0.6.0-en.md +59 -59
  212. package/docs/releases/release-0.6.1-ch.md +29 -29
  213. package/docs/releases/release-0.6.1-en.md +29 -29
  214. package/docs/releases/release-0.7.0-ch.md +86 -86
  215. package/docs/releases/release-0.7.0-en.md +86 -86
  216. package/docs/releases/release-0.9.1-ch.md +29 -0
  217. package/docs/releases/release-0.9.1-en.md +29 -0
  218. package/docs/releases/release-0.9.2-ch.md +33 -0
  219. package/docs/releases/release-0.9.2-en.md +33 -0
  220. package/examples/component-package/README-ch.md +101 -101
  221. package/examples/component-package/README.md +133 -133
  222. package/examples/conformance/README-ch.md +55 -55
  223. package/examples/conformance/README.md +55 -55
  224. package/examples/conformance/component-protocol-1.json +482 -482
  225. package/examples/conformance/component-protocol-1.schema.json +76 -76
  226. package/examples/conformance/local-draft-1.json +50 -50
  227. package/examples/conformance/local-draft-2.json +212 -212
  228. package/examples/game-2048-package/LICENSE +21 -21
  229. package/examples/game-2048-package/NOTICES.md +11 -11
  230. package/examples/game-2048-package/README-ch.md +91 -91
  231. package/examples/game-2048-package/README.md +98 -98
  232. package/examples/game-2048-package/package.json +35 -35
  233. package/examples/game-2048-package/sample/document.reactive.md +17 -17
  234. package/examples/game-2048-package/scripts/build-export.mjs +44 -44
  235. package/examples/game-2048-package/scripts/build.mjs +130 -130
  236. package/examples/game-2048-package/scripts/verify.mjs +180 -180
  237. package/examples/game-2048-package/src/component.css +161 -161
  238. package/examples/game-2048-package/src/components.tsx +326 -326
  239. package/examples/game-2048-package/src/game-engine.ts +228 -228
  240. package/examples/game-2048-package/src/harness.tsx +34 -34
  241. package/examples/game-2048-package/src/manifest.ts +85 -85
  242. package/examples/game-2048-package/src/node-entry.ts +30 -30
  243. package/examples/game-2048-package/src/sample.ts +4 -4
  244. package/examples/game-2048-package/tsconfig.json +15 -15
  245. package/examples/integration/README-ch.md +82 -63
  246. package/examples/integration/README.md +82 -63
  247. package/examples/integration/core/index.mjs +32 -32
  248. package/examples/integration/extension-sdk/README-ch.md +24 -24
  249. package/examples/integration/extension-sdk/README.md +24 -24
  250. package/examples/integration/streaming/index.html +48 -0
  251. package/examples/integration/streaming/main.js +175 -0
  252. package/examples/integration/streaming/package.json +13 -0
  253. package/examples/integration/streaming/worker.js +3 -0
  254. package/examples/integration/worker/index.html +19 -19
  255. package/examples/integration/worker/main.js +61 -61
  256. package/examples/integration/worker/package.json +13 -13
  257. package/examples/integration/worker/worker.js +3 -3
  258. package/examples/local/README-ch.md +76 -76
  259. package/examples/local/README.md +76 -76
  260. package/examples/local/charts.reactive.md +73 -73
  261. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  262. package/examples/local/recipes/invoice.reactive.md +36 -36
  263. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  264. package/examples/local/recipes/workshop.reactive.md +33 -33
  265. package/examples/local/showcase/README-ch.md +22 -22
  266. package/examples/local/showcase/README.md +31 -31
  267. package/examples/local/showcase/explore.reactive.md +102 -102
  268. package/examples/local/showcase/flow.reactive.md +86 -86
  269. package/examples/local/showcase/forms.reactive.md +126 -126
  270. package/examples/local/showcase/functions.reactive.md +119 -119
  271. package/examples/local/showcase/layout.reactive.md +100 -100
  272. package/examples/local/showcase/statistics.reactive.md +108 -108
  273. package/examples/local/showcase/tasks.reactive.md +89 -89
  274. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  275. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  276. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  277. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  278. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  279. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  280. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  281. package/examples/minimal-extension/README-ch.md +78 -78
  282. package/examples/minimal-extension/README.md +78 -78
  283. package/examples/minimal-extension/index.html +15 -15
  284. package/examples/minimal-extension/package.json +26 -26
  285. package/examples/minimal-extension/sample/document.reactive.md +10 -10
  286. package/examples/minimal-extension/scripts/build.mjs +32 -32
  287. package/examples/minimal-extension/scripts/export.mjs +72 -72
  288. package/examples/minimal-extension/scripts/test-node.mjs +75 -75
  289. package/examples/minimal-extension/src/extension.tsx +90 -90
  290. package/examples/minimal-extension/src/preview.tsx +12 -12
  291. package/examples/minimal-extension/src/source.ts +4 -4
  292. package/examples/minimal-extension/tsconfig.json +14 -14
  293. package/examples/sci-fi-theme/README-ch.md +133 -133
  294. package/examples/sci-fi-theme/README.md +148 -148
  295. package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
  296. package/examples/sci-fi-theme/demo/demo.css +638 -638
  297. package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
  298. package/examples/sci-fi-theme/demo/index.html +13 -13
  299. package/examples/sci-fi-theme/demo/main.tsx +215 -215
  300. package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
  301. package/examples/sci-fi-theme/docs/design-system.md +474 -474
  302. package/examples/sci-fi-theme/package.json +28 -28
  303. package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
  304. package/examples/sci-fi-theme/src/components.css +2370 -2370
  305. package/examples/sci-fi-theme/src/index.ts +6 -6
  306. package/examples/sci-fi-theme/src/notch.css +142 -142
  307. package/examples/sci-fi-theme/src/sci-fi.css +7 -7
  308. package/examples/sci-fi-theme/src/theme.ts +39 -39
  309. package/examples/sci-fi-theme/tsconfig.json +20 -20
  310. package/examples/sci-fi-theme/vite.config.ts +24 -24
  311. package/examples/tetris-package/LICENSE +21 -21
  312. package/examples/tetris-package/NOTICES.md +11 -11
  313. package/examples/tetris-package/README-ch.md +91 -91
  314. package/examples/tetris-package/README.md +95 -95
  315. package/examples/tetris-package/package.json +35 -35
  316. package/examples/tetris-package/sample/document.reactive.md +16 -16
  317. package/examples/tetris-package/scripts/build-export.mjs +44 -44
  318. package/examples/tetris-package/scripts/build.mjs +130 -130
  319. package/examples/tetris-package/scripts/verify.mjs +173 -173
  320. package/examples/tetris-package/src/component.css +145 -145
  321. package/examples/tetris-package/src/components.tsx +334 -334
  322. package/examples/tetris-package/src/harness.tsx +34 -34
  323. package/examples/tetris-package/src/manifests.ts +93 -93
  324. package/examples/tetris-package/src/node-entry.ts +16 -16
  325. package/examples/tetris-package/src/sample.ts +4 -4
  326. package/examples/tetris-package/src/tetris-engine.ts +325 -325
  327. package/examples/tetris-package/tsconfig.json +15 -15
  328. package/package.json +12 -1
  329. package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
  330. package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
  331. package/dist-library/compiler-DfGbQhyD.js +0 -62
  332. package/dist-library/component-state-BoLCGee4.js +0 -801
  333. package/dist-library/component-utils-BvHL8VGt.js +0 -298
  334. package/dist-library/export-C7IDW9ul.js +0 -311
  335. package/dist-library/layout-C22VjZh0.js +0 -542
  336. package/dist-library/options-CdSKOi7p.js +0 -116
  337. package/dist-library/preset-core-CKc5YXSM.js +0 -1443
  338. package/dist-library/react-LY5qsVeP.js +0 -7
@@ -0,0 +1,758 @@
1
+ import { l as e } from "./document-theme-C8J6UyNO.js";
2
+ import { A as t, M as n, j as r } from "./validation-B3RI0xOk.js";
3
+ import { S as i, T as a, w as o, x as s } from "./config-validation-D3D7Dy2J.js";
4
+ import { a as c, c as l, l as u, o as d } from "./parser-standard-CBA1-hdG.js";
5
+ // src/local/html/html.ts
6
+ var f = "http://www.w3.org/1999/xhtml", p = /* @__PURE__ */ new Set([
7
+ "b",
8
+ "strong",
9
+ "i",
10
+ "em",
11
+ "s",
12
+ "del",
13
+ "u",
14
+ "mark",
15
+ "sup",
16
+ "sub",
17
+ "br",
18
+ "hr",
19
+ "p",
20
+ "h1",
21
+ "h2",
22
+ "h3",
23
+ "h4",
24
+ "h5",
25
+ "h6",
26
+ "div",
27
+ "span",
28
+ "details",
29
+ "summary",
30
+ "blockquote",
31
+ "code",
32
+ "pre",
33
+ "ul",
34
+ "ol",
35
+ "li",
36
+ "a",
37
+ "img",
38
+ ...r
39
+ ]), m = /* @__PURE__ */ new Set([
40
+ "html",
41
+ "head",
42
+ "body"
43
+ ]), h = /* @__PURE__ */ new Set([
44
+ "frameset",
45
+ "frame",
46
+ "noframes",
47
+ "applet"
48
+ ]), ee = /* @__PURE__ */ new Set([
49
+ "animate",
50
+ "animatemotion",
51
+ "animatetransform",
52
+ "set",
53
+ "discard"
54
+ ]), te = /* @__PURE__ */ new Set(/* @__PURE__ */ "alignment-baseline.baseline-shift.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-rendering.cursor.direction.display.dominant-baseline.fill.fill-opacity.fill-rule.filter.flood-color.flood-opacity.font.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.glyph-orientation-horizontal.glyph-orientation-vertical.image-rendering.kerning.letter-spacing.lighting-color.marker.marker-end.marker-mid.marker-start.mask.opacity.overflow.paint-order.pointer-events.shape-rendering.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.text-anchor.text-decoration.text-rendering.transform-origin.unicode-bidi.vector-effect.visibility.word-spacing.writing-mode".split(".")), g = /* @__PURE__ */ new Set([
55
+ "id",
56
+ "class",
57
+ "title",
58
+ "lang",
59
+ "dir"
60
+ ]), _ = /* @__PURE__ */ new Set([
61
+ "align",
62
+ "bgcolor",
63
+ "background",
64
+ "face",
65
+ "text",
66
+ "link",
67
+ "alink",
68
+ "vlink",
69
+ "border",
70
+ "cellpadding",
71
+ "cellspacing",
72
+ "frame",
73
+ "rules",
74
+ "hspace",
75
+ "vspace"
76
+ ]), v = {
77
+ a: i,
78
+ img: /* @__PURE__ */ new Set([
79
+ "src",
80
+ "alt",
81
+ "width",
82
+ "height"
83
+ ]),
84
+ ol: /* @__PURE__ */ new Set(["start"]),
85
+ details: /* @__PURE__ */ new Set(["open"]),
86
+ ...t,
87
+ script: /* @__PURE__ */ new Set([
88
+ "type",
89
+ "src",
90
+ "async",
91
+ "defer",
92
+ "nomodule",
93
+ "crossorigin",
94
+ "integrity",
95
+ "referrerpolicy"
96
+ ]),
97
+ style: /* @__PURE__ */ new Set(["type", "media"]),
98
+ link: /* @__PURE__ */ new Set([
99
+ "rel",
100
+ "href",
101
+ "type",
102
+ "media",
103
+ "crossorigin",
104
+ "integrity",
105
+ "referrerpolicy",
106
+ "disabled"
107
+ ])
108
+ }, y = {
109
+ href: "link",
110
+ action: "form",
111
+ formaction: "form",
112
+ poster: "image",
113
+ background: "image",
114
+ data: "frame",
115
+ src: "source",
116
+ cite: "link",
117
+ longdesc: "link"
118
+ }, ne = 4, re = 32, b = 64, x = class extends Error {
119
+ start;
120
+ end;
121
+ limit;
122
+ constructor(e, t, n) {
123
+ super(`Syntax nodes exceed the limit of ${n}.`), this.start = e, this.end = t, this.limit = n, this.name = "HtmlBudgetError";
124
+ }
125
+ };
126
+ function S(e) {
127
+ let t = [0];
128
+ for (let n = 0; n < e.length; n += 1) e[n] === "\n" && t.push(n + 1);
129
+ return t;
130
+ }
131
+ function C(e, t, n) {
132
+ let r = e.source.length, i = Math.max(0, Math.min(r, t)), a = Math.max(i, Math.min(r, Math.max(i, n))), o = 0, s = e.lines.starts.length - 1;
133
+ for (; o < s;) {
134
+ let t = Math.ceil((o + s) / 2);
135
+ e.lines.starts[t] <= i ? o = t : s = t - 1;
136
+ }
137
+ return {
138
+ start: i,
139
+ end: a,
140
+ line: o + 1,
141
+ column: i - e.lines.starts[o] + 1
142
+ };
143
+ }
144
+ function w(t, n, r, i, a, o) {
145
+ if (t.diagnostics.length >= 100) return;
146
+ let s = C(t, i, a), c = e(o?.key ?? n, o?.params);
147
+ t.diagnostics.push({
148
+ code: n,
149
+ message: r,
150
+ severity: "warning",
151
+ range: {
152
+ start: s.start,
153
+ end: s.end
154
+ },
155
+ line: s.line,
156
+ column: s.column,
157
+ messageKey: c.key,
158
+ ...c.params ? { params: c.params } : {}
159
+ });
160
+ }
161
+ function T(e, t) {
162
+ let n = e.sourceCodeLocation, r = n && Number.isInteger(n.startOffset) ? n.startOffset : 0, i = n && Number.isInteger(n.endOffset) ? n.endOffset : r;
163
+ return {
164
+ start: Math.max(0, Math.min(t.source.length, r)),
165
+ end: Math.max(0, Math.min(t.source.length, i))
166
+ };
167
+ }
168
+ function ie(e, t, n) {
169
+ let r = e.sourceCodeLocation?.attrs, i = r && (r[t.name] ?? (t.prefix ? r[`${t.prefix}:${t.name}`] : void 0));
170
+ return i && Number.isInteger(i.startOffset) && Number.isInteger(i.endOffset) ? {
171
+ start: i.startOffset,
172
+ end: i.endOffset
173
+ } : T(e, n);
174
+ }
175
+ function E(e, t, n) {
176
+ if (e.budget.nodes += 1, e.budget.nodes > e.maxNodes) throw new x(t, n, e.maxNodes);
177
+ }
178
+ function D(e, t) {
179
+ let n = T(e, t);
180
+ return t.source.slice(n.start, n.end).replace(/\u0000/g, "�");
181
+ }
182
+ function O(e) {
183
+ return u.createTextNode(e.replace(/\u0000/g, "�"));
184
+ }
185
+ function ae(e) {
186
+ return e.replace(/[\u0000- \u007f-\u009f]+/g, "");
187
+ }
188
+ function oe(e) {
189
+ let t = /^([a-z][a-z0-9+.-]*):/i.exec(ae(e));
190
+ return t ? t[1].toLowerCase() : null;
191
+ }
192
+ function se(e, t) {
193
+ let n = e.trim();
194
+ if (n === "") return !0;
195
+ let r = oe(n);
196
+ return r === null ? !0 : r === "javascript" || r === "vbscript" ? !1 : r === "data" ? t === "image" && /^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/i.test(n.replace(/\s+/g, "")) : r === "http" || r === "https" || t === "link" && (r === "mailto" || r === "tel");
197
+ }
198
+ function k(e) {
199
+ return Object.hasOwn(y, e) || e === "xlink:href";
200
+ }
201
+ function A(e, t) {
202
+ return (e === "href" || e === "xlink:href") && t === "image" ? "image" : e === "href" && t === "base" ? "source" : e === "xlink:href" ? "link" : e === "src" ? t === "img" || t === "image" ? "image" : t === "iframe" || t === "frame" || t === "embed" ? "frame" : t === "audio" || t === "video" || t === "source" || t === "track" ? "media" : "source" : y[e] ?? "source";
203
+ }
204
+ function j(e, t) {
205
+ return g.has(t) || t.startsWith("aria-") || t.startsWith("data-") ? !0 : v[e]?.has(t) ?? !1;
206
+ }
207
+ function M(e) {
208
+ return /^on[a-z]/i.test(e);
209
+ }
210
+ function N(e, t) {
211
+ return te.has(e) ? !0 : t && _.has(e);
212
+ }
213
+ function P(e) {
214
+ return [...e.enableJavaScript ? ["allow-scripts"] : [], ...e.enableExtendedHtml ? ["allow-forms"] : []].join(" ");
215
+ }
216
+ function ce(e, t) {
217
+ return e.split(/\s+/).filter(Boolean).filter((e) => {
218
+ let n = e.toLowerCase();
219
+ return n === "allow-same-origin" || n === "allow-top-navigation" || n === "allow-top-navigation-by-user-activation" || n === "allow-parent-navigation" || n === "allow-popups" || n === "allow-popups-to-escape-sandbox" || n === "allow-modals" || n === "allow-downloads" || n === "allow-orientation-lock" || n === "allow-pointer-lock" || n === "allow-presentation" ? !1 : n === "allow-forms" ? t.enableExtendedHtml : n === "allow-scripts" && t.enableJavaScript;
220
+ }).join(" ");
221
+ }
222
+ function F(e, t) {
223
+ for (let n of e.childNodes) if (u.isElementNode(n) && n.tagName.toLowerCase() === t) return n;
224
+ return null;
225
+ }
226
+ function I(e) {
227
+ let t = "";
228
+ for (let n of e.childNodes) t += l(n, { scriptingEnabled: !1 });
229
+ return t;
230
+ }
231
+ function L(e) {
232
+ return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
233
+ }
234
+ function R(e, t, n = !1) {
235
+ let r = e.enableExtendedHtml, i = t === void 0 ? r ? [
236
+ "about:",
237
+ "data:",
238
+ "blob:"
239
+ ] : [] : ["about:", ...B(t)];
240
+ return [
241
+ "default-src 'none'",
242
+ n ? "base-uri 'none'" : r ? "base-uri 'self' http: https:" : "base-uri 'none'",
243
+ n ? "form-action 'none'" : r ? "form-action http: https:" : "form-action 'none'",
244
+ "object-src 'none'",
245
+ "connect-src 'none'",
246
+ "media-src 'none'",
247
+ "font-src data:",
248
+ "img-src data:",
249
+ e.enableCss ? "style-src 'unsafe-inline'" : "style-src 'none'",
250
+ e.enableJavaScript ? "script-src 'unsafe-inline'" : "script-src 'none'",
251
+ i.length === 0 ? "frame-src 'none'" : `frame-src ${i.join(" ")}`
252
+ ].join("; ");
253
+ }
254
+ function z(e) {
255
+ if (typeof e != "string") return null;
256
+ let t = /^https:\/\/([a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*)(?::([0-9]{1,5}))?\/?$/i.exec(e.trim());
257
+ if (!t) return null;
258
+ let n = t[2] ? Number(t[2]) : 443;
259
+ if (!Number.isInteger(n) || n < 1 || n > 65535) return null;
260
+ let r = t[1].toLowerCase();
261
+ return n === 443 ? `https://${r}` : `https://${r}:${n}`;
262
+ }
263
+ function B(e) {
264
+ let t = [];
265
+ if (!Array.isArray(e)) return t;
266
+ for (let n of e.slice(0, re)) {
267
+ let e = z(n);
268
+ e && !t.includes(e) && t.push(e);
269
+ }
270
+ return t;
271
+ }
272
+ function V(e) {
273
+ return new Set(B(e ?? []));
274
+ }
275
+ function H(e, t) {
276
+ let n = e.trim();
277
+ if (/^about:blank$/i.test(n)) return !0;
278
+ if (n === "") return !1;
279
+ let r;
280
+ try {
281
+ r = new URL(n);
282
+ } catch {
283
+ return !1;
284
+ }
285
+ if (r.protocol !== "https:" || r.username !== "" || r.password !== "") return !1;
286
+ let i = z(r.origin);
287
+ return i !== null && t.has(i);
288
+ }
289
+ var U = 65536;
290
+ function W(e) {
291
+ let t = e.trim();
292
+ if (!/^data:/i.test(t)) return;
293
+ if (t.length > U) return null;
294
+ let n = t.indexOf(",");
295
+ if (n < 0) return null;
296
+ let r = t.slice(5, n).toLowerCase(), i = t.slice(n + 1), a = r.endsWith(";base64"), o = (a ? r.slice(0, -7) : r).split(";")[0].trim();
297
+ if (o !== "text/html" && o !== "application/xhtml+xml") return null;
298
+ let s;
299
+ try {
300
+ if (a) {
301
+ let e = atob(i.replace(/\s+/g, "")), t = new Uint8Array(e.length);
302
+ for (let n = 0; n < e.length; n += 1) t[n] = e.charCodeAt(n);
303
+ s = new TextDecoder().decode(t);
304
+ } else s = decodeURIComponent(i);
305
+ } catch {
306
+ return null;
307
+ }
308
+ return s.length > U ? null : s;
309
+ }
310
+ function G(e, t) {
311
+ let n = F(t, "html"), r = n ? F(n, "head") : null, i = n ? F(n, "body") : null, a = r ? I(r) : "", o = I(i || n || t);
312
+ e.bodyFallbacks.length > 0 && (o = e.bodyFallbacks.map((e) => l(O(e), { scriptingEnabled: !1 })).join("") + o);
313
+ let s = L(R(e.policy, e.frameOrigins ? [...e.frameOrigins] : void 0, e.fragment)), c = (e) => (e?.attrs ?? []).map((e) => ` ${e.prefix ? `${e.prefix}:` : ""}${e.name}="${L(e.value)}"`).join("");
314
+ return `<!doctype html><html${c(n)}><head${c(r)}><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${s}">${a}</head><body${c(i)}>${o}</body></html>`;
315
+ }
316
+ function K(e) {
317
+ let t = e.source.replace(/\u0000/g, "�").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
318
+ return `<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${L(R(e.policy, e.frameOrigins ? [...e.frameOrigins] : void 0, e.fragment))}"></head><body><pre data-local-html-fallback="document">\n${t}</pre></body></html>`;
319
+ }
320
+ function q(e, t, n) {
321
+ if (t.depth >= ne) return "";
322
+ let r = t.diagnostics.length, i = () => (Z(t, r), w(t, "local.html.fallback", "Native HTML was safely converted to inert source text.", n.start, n.end), K({
323
+ ...t,
324
+ source: e
325
+ })), a;
326
+ try {
327
+ a = c(e, {
328
+ scriptingEnabled: !1,
329
+ sourceCodeLocationInfo: !0
330
+ });
331
+ } catch {
332
+ return i();
333
+ }
334
+ let o = {
335
+ ...t,
336
+ source: e,
337
+ lines: { starts: S(e) },
338
+ depth: t.depth + 1,
339
+ bodyFallbacks: []
340
+ };
341
+ try {
342
+ let e = F(a, "html");
343
+ if (e) {
344
+ let n = t.diagnostics.length;
345
+ if (!J(e, "html", !0, o)) return Z(o, n), K(o);
346
+ Q(e, o, !1);
347
+ }
348
+ return G(o, a);
349
+ } catch (e) {
350
+ if (e instanceof x) throw e;
351
+ return i();
352
+ }
353
+ }
354
+ function J(e, t, i, c) {
355
+ e.sourceCodeLocation;
356
+ let l = [], u = !1, d = !0;
357
+ for (let a of e.attrs) {
358
+ let f = a.name.toLowerCase(), p = a.prefix ? `${a.prefix}:${a.name}` : a.name, m = ie(e, a, c);
359
+ if (i && r.has(t) && !n(f, a.value)) {
360
+ d = !1, w(c, "local.html.table", `Invalid value for ${f} on native HTML <${t}>.`, m.start, m.end, {
361
+ key: "html.table.value",
362
+ params: {
363
+ name: f,
364
+ tag: t
365
+ }
366
+ });
367
+ continue;
368
+ }
369
+ if (i && f === "align" && s.has(t)) {
370
+ let e = o(a.value);
371
+ e ? l.push({
372
+ ...a,
373
+ value: e
374
+ }) : (d = !1, w(c, "local.html.attribute", "HTML attribute align requires left, center, right or justify.", m.start, m.end, {
375
+ key: "local.html.attribute",
376
+ params: {
377
+ name: p,
378
+ tag: t
379
+ }
380
+ }));
381
+ continue;
382
+ }
383
+ if (M(f)) {
384
+ if (!c.policy.enableJavaScript) {
385
+ w(c, "local.html.capability", `Author event handler attribute ${p} was disabled by the compile options.`, m.start, m.end, {
386
+ key: "local.html.capability",
387
+ params: { feature: "event handlers" }
388
+ });
389
+ continue;
390
+ }
391
+ l.push(a);
392
+ continue;
393
+ }
394
+ if (f === "style" || N(f, i)) {
395
+ if (!c.policy.enableCss) {
396
+ w(c, "local.html.capability", `Author style attribute ${p} was disabled by the compile options.`, m.start, m.end, {
397
+ key: "local.html.capability",
398
+ params: { feature: "CSS" }
399
+ });
400
+ continue;
401
+ }
402
+ l.push(a);
403
+ continue;
404
+ }
405
+ if (f === "srcset" || f === "imagesrcset") {
406
+ w(c, "local.html.unsafe-url", `Unsafe URL in attribute ${p} was removed.`, m.start, m.end, {
407
+ key: "local.html.unsafe-url",
408
+ params: { name: p }
409
+ });
410
+ continue;
411
+ }
412
+ if (f === "srcdoc" && t === "iframe") {
413
+ if (l.some((e) => e.name === "srcdoc")) continue;
414
+ let e = q(a.value, c, m);
415
+ if (e === "") continue;
416
+ a.value = e, l.push(a);
417
+ continue;
418
+ }
419
+ if (f === "sandbox" && t === "iframe") {
420
+ a.value = ce(a.value, c.policy), u = !0, l.push(a);
421
+ continue;
422
+ }
423
+ let h = c.frameOrigins;
424
+ if (h !== void 0 && t === "iframe") {
425
+ if (f === "allow" || f === "allowfullscreen" || f === "allowpaymentrequest") {
426
+ w(c, "local.html.capability", `Author frame permission ${p} was disabled.`, m.start, m.end, {
427
+ key: "local.html.capability",
428
+ params: { feature: "frame permission" }
429
+ });
430
+ continue;
431
+ }
432
+ if (f === "src") {
433
+ let e = W(a.value);
434
+ if (e === null) {
435
+ w(c, "local.html.unsafe-url", `Unsafe frame source in attribute ${p} was removed.`, m.start, m.end, {
436
+ key: "local.html.unsafe-url",
437
+ params: { name: p }
438
+ });
439
+ continue;
440
+ }
441
+ if (e !== void 0) {
442
+ if (l.some((e) => e.name === "srcdoc")) continue;
443
+ let t = q(e, c, m);
444
+ if (t === "") continue;
445
+ l.push({
446
+ name: "srcdoc",
447
+ value: t
448
+ });
449
+ continue;
450
+ }
451
+ if (!H(a.value, h)) {
452
+ w(c, "local.html.unsafe-url", `Remote frame source ${p} is not an allowed origin.`, m.start, m.end, {
453
+ key: "local.html.unsafe-url",
454
+ params: { name: p }
455
+ });
456
+ continue;
457
+ }
458
+ l.push(a);
459
+ continue;
460
+ }
461
+ }
462
+ k(f) && !se(a.value, A(f, t)) ? w(c, "local.html.unsafe-url", `Unsafe URL in attribute ${p} was removed.`, m.start, m.end, {
463
+ key: "local.html.unsafe-url",
464
+ params: { name: p }
465
+ }) : f === "target" && /^_(?:top|parent)$/i.test(a.value.trim()) ? w(c, "local.html.capability", `Navigation target ${a.value} was disabled.`, m.start, m.end, {
466
+ key: "local.html.capability",
467
+ params: { feature: "top-level navigation" }
468
+ }) : !c.policy.enableExtendedHtml && !j(t, f) ? (d = !1, w(c, "local.html.attribute", `HTML attribute ${p} on <${t}> is not supported; the element is shown as source.`, m.start, m.end, {
469
+ key: "local.html.attribute",
470
+ params: {
471
+ name: p,
472
+ tag: t
473
+ }
474
+ })) : l.push(a);
475
+ }
476
+ if (t === "iframe" && !u && l.push({
477
+ name: "sandbox",
478
+ value: P(c.policy)
479
+ }), t === "a") {
480
+ let e = l.find((e) => e.name.toLowerCase() === "target")?.value, t = l.find((e) => e.name.toLowerCase() === "rel"), n = a(t?.value, e);
481
+ n !== void 0 && (t ? t.value = n : l.push({
482
+ name: "rel",
483
+ value: n
484
+ }));
485
+ }
486
+ return e.attrs = l, d;
487
+ }
488
+ function le(e, t, n) {
489
+ let r = t.diagnostics.length, i = T(e, t);
490
+ E(t, i.start, i.end);
491
+ let a = e.tagName.toLowerCase(), o = e.namespaceURI === f;
492
+ if (h.has(a)) return t.fragment ? (w(t, "local.html.fallback", `HTML element <${a}> cannot be rendered in an extended fragment; it is shown as source.`, i.start, i.end, { key: "html.fallback" }), X(e, t, n, r)) : (t.bodyFallbacks.push(D(e, t)), w(t, "local.html.fallback", `HTML element <${a}> requires enableExtendedHtml in this mode; it is shown as source.`, i.start, i.end, {
493
+ key: "local.html.extended",
494
+ params: { name: a }
495
+ }), []);
496
+ if (t.fragment && a === "base") return w(t, "local.html.capability", "Author HTML base was disabled in an extended fragment.", i.start, i.end, {
497
+ key: "local.html.capability",
498
+ params: { feature: "document base" }
499
+ }), [];
500
+ if (!o && !t.policy.enableCss && ee.has(a)) return w(t, "local.html.capability", `Author animation <${a}> was disabled by the compile options.`, i.start, i.end, {
501
+ key: "local.html.capability",
502
+ params: { feature: "animation" }
503
+ }), [];
504
+ if (a === "script") return t.policy.enableJavaScript ? J(e, a, o, t) ? [e] : X(e, t, n, r) : (w(t, "local.html.capability", "Author JavaScript was disabled by the compile options.", i.start, i.end, {
505
+ key: "local.html.capability",
506
+ params: { feature: "JavaScript" }
507
+ }), []);
508
+ if (a === "style") return t.policy.enableCss ? J(e, a, o, t) ? [e] : X(e, t, n, r) : (w(t, "local.html.capability", "Author CSS was disabled by the compile options.", i.start, i.end, {
509
+ key: "local.html.capability",
510
+ params: { feature: "CSS" }
511
+ }), []);
512
+ if (a === "link") return (e.attrs.find((e) => e.name.toLowerCase() === "rel")?.value.toLowerCase() ?? "").split(/\s+/).includes("stylesheet") ? t.policy.enableCss ? J(e, a, o, t) ? [e] : X(e, t, n, r) : (w(t, "local.html.capability", "Author CSS was disabled by the compile options.", i.start, i.end, {
513
+ key: "local.html.capability",
514
+ params: { feature: "CSS" }
515
+ }), []) : t.policy.enableExtendedHtml ? J(e, a, o, t) ? [e] : X(e, t, n, r) : Y(e, t);
516
+ if (a === "meta") {
517
+ if (!t.policy.enableExtendedHtml) return Y(e, t);
518
+ let s = e.attrs.find((e) => e.name.toLowerCase() === "http-equiv")?.value.trim().toLowerCase() ?? "";
519
+ return s === "refresh" || s === "content-security-policy" || s === "set-cookie" ? (w(t, "local.html.capability", `Author metadata ${s} was disabled.`, i.start, i.end, {
520
+ key: "local.html.capability",
521
+ params: { feature: "document metadata" }
522
+ }), []) : J(e, a, o, t) ? [e] : X(e, t, n, r);
523
+ }
524
+ return (a === "title" || a === "html" || a === "head" || a === "body") && !t.policy.enableExtendedHtml && a === "title" || !(o && (p.has(a) || m.has(a)) || t.policy.enableExtendedHtml) ? Y(e, t, n) : J(e, a, o, t) ? a === "template" ? (Q(u.getTemplateContent(e), t, !1), [e]) : (Q(e, t, n), [e]) : X(e, t, n, r);
525
+ }
526
+ function Y(e, t, n = !1) {
527
+ let r = t.diagnostics.length, i = e.tagName.toLowerCase(), a = T(e, t);
528
+ return w(t, "local.html.extended", `HTML element <${i}> requires enableExtendedHtml in this mode; it is shown as source.`, a.start, a.end, {
529
+ key: "local.html.extended",
530
+ params: { name: i }
531
+ }), X(e, t, n, r);
532
+ }
533
+ function X(e, t, n, r) {
534
+ return Z(t, r), n ? (t.bodyFallbacks.push(D(e, t)), []) : [O(D(e, t))];
535
+ }
536
+ function Z(e, t) {
537
+ for (let n of e.diagnostics.slice(t)) n.severity === "warning" && (n.code = "local.html.fallback");
538
+ }
539
+ function Q(e, t, n) {
540
+ let r = [];
541
+ for (let i of e.childNodes) if (u.isTextNode(i)) E(t, 0, 0), r.push(i);
542
+ else if (u.isCommentNode(i)) E(t, 0, 0), r.push(i);
543
+ else if (!u.isDocumentTypeNode(i) && u.isElementNode(i)) {
544
+ let e = i.tagName.toLowerCase(), a = n || e === "head";
545
+ r.push(...le(i, t, a));
546
+ }
547
+ e.childNodes = r;
548
+ }
549
+ function ue(e, t, n, r) {
550
+ let i = [], a = {
551
+ policy: t,
552
+ source: e,
553
+ lines: { starts: S(e) },
554
+ diagnostics: i,
555
+ maxNodes: n,
556
+ depth: 0,
557
+ ...r === void 0 ? {} : { frameOrigins: V(r) },
558
+ budget: { nodes: 0 },
559
+ bodyFallbacks: [],
560
+ stopped: !1
561
+ }, o;
562
+ try {
563
+ o = c(e, {
564
+ scriptingEnabled: !1,
565
+ sourceCodeLocationInfo: !0
566
+ });
567
+ } catch (e) {
568
+ return {
569
+ markup: K(a),
570
+ diagnostics: [{
571
+ code: "local.parse",
572
+ message: `Cannot parse the HTML document: ${e instanceof Error ? e.message : String(e)}`,
573
+ severity: "error",
574
+ range: {
575
+ start: 0,
576
+ end: 0
577
+ },
578
+ line: 1,
579
+ column: 1,
580
+ messageKey: "local.parse.document",
581
+ params: { detail: e instanceof Error ? e.message : String(e) }
582
+ }]
583
+ };
584
+ }
585
+ try {
586
+ let e = F(o, "html");
587
+ if (e) {
588
+ let t = a.diagnostics.length;
589
+ if (!J(e, "html", !0, a)) return Z(a, t), {
590
+ markup: K(a),
591
+ diagnostics: i
592
+ };
593
+ Q(e, a, !1);
594
+ } else Q(o, a, !1);
595
+ return {
596
+ markup: G(a, o),
597
+ diagnostics: i
598
+ };
599
+ } catch (e) {
600
+ if (e instanceof x) {
601
+ let t = C(a, e.start, e.end);
602
+ return {
603
+ markup: K(a),
604
+ diagnostics: [{
605
+ code: "local.budget",
606
+ message: e.message,
607
+ severity: "error",
608
+ range: {
609
+ start: t.start,
610
+ end: t.end
611
+ },
612
+ line: t.line,
613
+ column: t.column,
614
+ messageKey: "local.budget.nodes",
615
+ params: { limit: e.limit }
616
+ }]
617
+ };
618
+ }
619
+ return {
620
+ markup: K(a),
621
+ diagnostics: [{
622
+ code: "local.parse",
623
+ message: `Cannot parse the HTML document: ${e instanceof Error ? e.message : String(e)}`,
624
+ severity: "error",
625
+ range: {
626
+ start: 0,
627
+ end: 0
628
+ },
629
+ line: 1,
630
+ column: 1,
631
+ messageKey: "local.parse.document",
632
+ params: { detail: e instanceof Error ? e.message : String(e) }
633
+ }]
634
+ };
635
+ }
636
+ }
637
+ var $ = /* @__PURE__ */ new Set([
638
+ ...p,
639
+ "dl",
640
+ "dt",
641
+ "dd",
642
+ "section",
643
+ "figure",
644
+ "figcaption"
645
+ ]), de = /* @__PURE__ */ new Set([
646
+ "class",
647
+ "title",
648
+ "lang",
649
+ "dir",
650
+ "role",
651
+ "alt",
652
+ "open",
653
+ "start",
654
+ "rowspan",
655
+ "colspan",
656
+ "scope"
657
+ ]);
658
+ function fe(e) {
659
+ let t = [...e.childNodes];
660
+ for (; t.length;) {
661
+ let e = t.pop();
662
+ if (!(u.isTextNode(e) || u.isCommentNode(e))) {
663
+ if (!u.isElementNode(e) || e.namespaceURI !== f || !$.has(e.tagName) || e.attrs.some((e) => e.namespace || !de.has(e.name) && !/^aria-[a-z-]+$/.test(e.name))) return !1;
664
+ for (let n of e.childNodes) t.push(n);
665
+ }
666
+ }
667
+ return !0;
668
+ }
669
+ function pe(e, t) {
670
+ let n = [{
671
+ node: e,
672
+ depth: 0
673
+ }];
674
+ for (; n.length > 0;) {
675
+ let { node: e, depth: r } = n.pop();
676
+ for (let i of e.childNodes) {
677
+ if (!u.isElementNode(i)) continue;
678
+ if (r + 1 > t) return !0;
679
+ let e = i.tagName.toLowerCase() === "template" ? u.getTemplateContent(i) : i;
680
+ n.push({
681
+ node: e,
682
+ depth: r + 1
683
+ });
684
+ }
685
+ }
686
+ return !1;
687
+ }
688
+ function me(e, t, n, r) {
689
+ let i = [];
690
+ if (typeof e != "string" || e.trim() === "") return {
691
+ markup: "",
692
+ diagnostics: i
693
+ };
694
+ let a = {
695
+ policy: t,
696
+ source: e,
697
+ lines: { starts: S(e) },
698
+ diagnostics: i,
699
+ maxNodes: n,
700
+ depth: 0,
701
+ fragment: !0,
702
+ ...r === void 0 ? {} : { frameOrigins: V(r) },
703
+ budget: { nodes: 0 },
704
+ bodyFallbacks: [],
705
+ stopped: !1
706
+ }, o;
707
+ try {
708
+ o = d(e, {
709
+ scriptingEnabled: !1,
710
+ sourceCodeLocationInfo: !0
711
+ });
712
+ } catch (e) {
713
+ let t = e instanceof Error ? e.message : String(e);
714
+ return w(a, "local.parse", `Cannot parse the HTML fragment: ${t}`, 0, 0, {
715
+ key: "local.parse.document",
716
+ params: { detail: t }
717
+ }), { diagnostics: i };
718
+ }
719
+ if (pe(o, b)) return { diagnostics: [{
720
+ code: "local.budget",
721
+ message: `HTML fragment exceeds ${b} nested element levels.`,
722
+ severity: "error",
723
+ range: {
724
+ start: 0,
725
+ end: e.length
726
+ },
727
+ line: 1,
728
+ column: 1,
729
+ messageKey: "local.budget.nodes",
730
+ params: { limit: b }
731
+ }] };
732
+ try {
733
+ return Q(o, a, !1), {
734
+ markup: a.bodyFallbacks.map((e) => l(O(e), { scriptingEnabled: !1 })).join("") + I(o),
735
+ inlineSafe: fe(o),
736
+ diagnostics: i
737
+ };
738
+ } catch (e) {
739
+ if (e instanceof x) {
740
+ let t = C(a, e.start, e.end);
741
+ return { diagnostics: [{
742
+ code: "local.budget",
743
+ message: e.message,
744
+ severity: "error",
745
+ range: {
746
+ start: t.start,
747
+ end: t.end
748
+ },
749
+ line: t.line,
750
+ column: t.column,
751
+ messageKey: "local.budget.nodes",
752
+ params: { limit: e.limit }
753
+ }] };
754
+ }
755
+ return { diagnostics: i };
756
+ }
757
+ }
758
+ export { me as i, P as n, ue as r, R as t };