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
@@ -1,15 +1,205 @@
1
1
  import { r as e } from "./latex-1w7aQgD5.js";
2
- import "./preset-core-CKc5YXSM.js";
3
- import { t } from "./compile-LhpTKqCR.js";
4
- import { s as n } from "./compiler-core-DTxY-qYz.js";
5
- import { n as r } from "./display-lw3BT1TA.js";
6
- import { i, n as a, r as o } from "./parser-standard-OToYcOBL.js";
7
- import { s } from "./config-BUo-8O5C.js";
8
- import { n as c, t as l } from "./options-CdSKOi7p.js";
9
- import { n as u } from "./compiler-DfGbQhyD.js";
10
- import { c as d, r as f } from "./schema-C-AeByPp.js";
2
+ import "./version-DAxuGOG2.js";
3
+ import { t } from "./compile-Dx6Uw3D9.js";
4
+ import { d as n, f as r } from "./compiler-core-DDDdvuLy.js";
5
+ import { n as i } from "./display-B_uutKkN.js";
6
+ import { i as a, n as o, r as s } from "./parser-standard-CBA1-hdG.js";
7
+ import { s as c } from "./config-DXLvctiZ.js";
8
+ import { r as l, t as u } from "./options-BBp9IcHm.js";
9
+ import { n as d } from "./compiler-dxLPB9Ym.js";
10
+ import { c as f, r as p } from "./schema-BryM_VRW.js";
11
+ function m(e, t) {
12
+ if (typeof t != "string" || t.length > 1e6) return !0;
13
+ if (e.severity !== "error") return !1;
14
+ let n = e.code, r = (e) => n === e || n.startsWith(`${e}.`);
15
+ return r("local.options") || r("local.budget") || r("local.version") || r("local.html") || r("local.parse") || r("local.security") || r("local.config") || r("local.registry") || r("local.capability");
16
+ }
17
+ function h(e, t) {
18
+ let n = e.filter((e) => !m(e, t)), r = [];
19
+ for (let i of e) m(i, t) && (i.code === "local.html" && n.some((e) => e.range.start === i.range.start && e.range.end === i.range.end) ? n.push(i) : r.push(i));
20
+ return {
21
+ definite: r,
22
+ transient: n
23
+ };
24
+ }
25
+ function g(e) {
26
+ return `${e.code}:${e.range.start}:${e.range.end}`;
27
+ }
28
+ function _(e, t) {
29
+ return e.range.start - t.range.start || e.range.end - t.range.end || e.line - t.line || e.column - t.column || (e.code < t.code ? -1 : +(e.code > t.code));
30
+ }
31
+ function v(e) {
32
+ let t = /* @__PURE__ */ new Map();
33
+ for (let n of e) for (let e of n) {
34
+ let n = g(e);
35
+ t.has(n) || t.set(n, e);
36
+ }
37
+ return [...t.values()].sort(_);
38
+ }
39
+ function y(e, t) {
40
+ let n = t.filter((e) => e.code !== "local.author.unclosed"), r = t.filter((e) => e.code === "local.author.unclosed"), i = new Set(n.map(g));
41
+ return {
42
+ diagnostics: n,
43
+ transientDiagnostics: v([...e, r]).filter((e) => !i.has(g(e)))
44
+ };
45
+ }
46
+ function b(e, t) {
47
+ if (e.length !== t.length) return !1;
48
+ for (let n = 0; n < e.length; n += 1) if (e[n].start !== t[n].start || e[n].end !== t[n].end) return !1;
49
+ return !0;
50
+ }
51
+ function x(e, t) {
52
+ return e.length === 1 && e[0].start === 0 && e[0].end === t;
53
+ }
54
+ function S(e, t, n) {
55
+ for (let r of e) if (r.range.start <= t && r.range.end >= n) return r;
56
+ }
57
+ function C(e, t, n) {
58
+ let r = t.length, i = Math.max(0, Math.min(r, e.range.start)), a = S(n, i, Math.max(i, Math.min(r, e.range.end)));
59
+ if (a) return {
60
+ start: a.range.start,
61
+ end: a.range.end
62
+ };
63
+ let o = i;
64
+ for (; o > 0 && t[o - 1] !== "\n";) --o;
65
+ let s = i;
66
+ for (; s < r && t[s] !== "\n";) s += 1;
67
+ return s < r && (s += 1), s > o ? {
68
+ start: o,
69
+ end: s
70
+ } : {
71
+ start: i,
72
+ end: r
73
+ };
74
+ }
75
+ function w(e, t) {
76
+ let n = t;
77
+ for (let t of e) t.range.start < n && (n = t.range.start);
78
+ return n;
79
+ }
80
+ function T(e, t, n, i, a) {
81
+ let o = [...e];
82
+ for (let e of t) o.push(C(e, i, n?.nodes ?? []));
83
+ let s = r(o, i.length), c = w(t, i.length);
84
+ return a && (s = r([...s, {
85
+ start: c,
86
+ end: i.length
87
+ }], i.length)), b(s, e) && (s = r([...e, {
88
+ start: c,
89
+ end: i.length
90
+ }], i.length)), s;
91
+ }
92
+ function E(e, t) {
93
+ for (let [n, r] of Object.entries(t)) typeof r == "number" && Number.isFinite(r) && (e[n] = (e[n] ?? 0) + r);
94
+ }
95
+ function ee(e, t, n) {
96
+ let r = [], i = [], a = {}, o, s = 0;
97
+ for (let c = 1; c <= 6; c += 1) {
98
+ s = c, o = d(e, t, n, r), E(a, o.timings);
99
+ let l = o.result;
100
+ if (l.ok) {
101
+ let e = y(i, l.diagnostics);
102
+ return {
103
+ result: {
104
+ ...l,
105
+ status: "partial",
106
+ ...e
107
+ },
108
+ ...o.parsed ? { parsed: o.parsed } : {},
109
+ transientDiagnostics: e.transientDiagnostics,
110
+ literalRanges: [...r],
111
+ attempts: s,
112
+ timings: a
113
+ };
114
+ }
115
+ let { definite: u, transient: f } = h(l.diagnostics, e);
116
+ if (u.length > 0) {
117
+ let e = v([...i, f]);
118
+ return {
119
+ result: {
120
+ ok: !1,
121
+ diagnostics: u,
122
+ ...l.recoveries ? { recoveries: [...l.recoveries] } : {},
123
+ status: "failed",
124
+ transientDiagnostics: e
125
+ },
126
+ ...o.parsed ? { parsed: o.parsed } : {},
127
+ transientDiagnostics: e,
128
+ literalRanges: [...r],
129
+ attempts: s,
130
+ timings: a
131
+ };
132
+ }
133
+ if (i.push(f), c === 6) break;
134
+ let p = T(r, f, o.parsed, e, c >= 5);
135
+ if (b(p, r)) break;
136
+ r = p, x(r, e.length);
137
+ }
138
+ if (typeof e == "string" && e.length <= 1e6 && !x(r, e.length)) {
139
+ let o = [{
140
+ start: 0,
141
+ end: e.length
142
+ }], c = d(e, t, n, o);
143
+ if (E(a, c.timings), s += 1, c.result.ok) {
144
+ let e = y(i, c.result.diagnostics);
145
+ return {
146
+ result: {
147
+ ...c.result,
148
+ status: "partial",
149
+ ...e
150
+ },
151
+ ...c.parsed ? { parsed: c.parsed } : {},
152
+ transientDiagnostics: e.transientDiagnostics,
153
+ literalRanges: o,
154
+ attempts: s,
155
+ timings: a
156
+ };
157
+ }
158
+ let { definite: l, transient: u } = h(c.result.diagnostics, e), f = v([...i, u]);
159
+ if (l.length > 0) return {
160
+ result: {
161
+ ok: !1,
162
+ diagnostics: l,
163
+ ...c.result.recoveries ? { recoveries: [...c.result.recoveries] } : {},
164
+ status: "failed",
165
+ transientDiagnostics: f
166
+ },
167
+ ...c.parsed ? { parsed: c.parsed } : {},
168
+ transientDiagnostics: f,
169
+ literalRanges: o,
170
+ attempts: s,
171
+ timings: a
172
+ };
173
+ r = o;
174
+ }
175
+ let c = o, l = v(i);
176
+ return {
177
+ result: {
178
+ ok: !1,
179
+ diagnostics: c !== void 0 && c.result.ok === !1 && c.result.diagnostics.length > 0 ? [...c.result.diagnostics] : l.length > 0 ? l : [{
180
+ code: "local.parse",
181
+ message: "The streaming snapshot could not be compiled.",
182
+ severity: "error",
183
+ range: {
184
+ start: 0,
185
+ end: 0
186
+ },
187
+ line: 1,
188
+ column: 1
189
+ }],
190
+ ...c?.result.recoveries ? { recoveries: [...c.result.recoveries] } : {},
191
+ status: "failed",
192
+ transientDiagnostics: l
193
+ },
194
+ ...c?.parsed ? { parsed: c.parsed } : {},
195
+ transientDiagnostics: l,
196
+ literalRanges: [...r],
197
+ attempts: s,
198
+ timings: a
199
+ };
200
+ }
11
201
  // src/local/compilation/session/semantic-cache.ts
12
- var p = () => ({
202
+ var D = () => ({
13
203
  expressionsCompiled: 0,
14
204
  expressionsReused: 0,
15
205
  typesInferred: 0,
@@ -22,18 +212,18 @@ var p = () => ({
22
212
  formulasReused: 0,
23
213
  displaysInspected: 0,
24
214
  displaysReused: 0
25
- }), m = class {
215
+ }), te = class {
26
216
  capacity;
27
217
  maxWeight;
28
218
  key;
29
219
  values = /* @__PURE__ */ new Map();
30
220
  weight = 0;
31
- counts = p();
221
+ counts = D();
32
222
  constructor(e = 16384, t = 8e6) {
33
223
  this.capacity = e, this.maxWeight = t;
34
224
  }
35
225
  begin(e) {
36
- this.key !== e && (this.clear(), this.key = e), this.counts = p();
226
+ this.key !== e && (this.clear(), this.key = e), this.counts = D();
37
227
  }
38
228
  get stats() {
39
229
  return {
@@ -42,7 +232,7 @@ var p = () => ({
42
232
  };
43
233
  }
44
234
  clear() {
45
- this.values.clear(), this.weight = 0, this.key = void 0, this.counts = p();
235
+ this.values.clear(), this.weight = 0, this.key = void 0, this.counts = D();
46
236
  }
47
237
  get(e) {
48
238
  let t = this.values.get(e);
@@ -91,16 +281,16 @@ var p = () => ({
91
281
  return this.counts.formulasCompiled++, this.put(n, i), i;
92
282
  }
93
283
  display(e, t) {
94
- let n = "display:" + JSON.stringify([e, t]), i = this.get(n);
95
- if (i) return this.counts.displaysReused++, i;
96
- let a = r(e, t);
284
+ let n = "display:" + JSON.stringify([e, t]), r = this.get(n);
285
+ if (r) return this.counts.displaysReused++, r;
286
+ let a = i(e, t);
97
287
  return this.counts.displaysInspected++, this.put(n, a), a;
98
288
  }
99
- }, h = 128, g = 512, _ = 32, v = 131072, y = (e) => JSON.parse(JSON.stringify(e));
100
- function b(e) {
289
+ }, ne = 128, re = 512, ie = 32, ae = 131072, O = (e) => JSON.parse(JSON.stringify(e));
290
+ function oe(e) {
101
291
  return typeof e == "object" && !!e && e.strict === !1;
102
292
  }
103
- var x = class {
293
+ var k = class {
104
294
  limit;
105
295
  byteLimit;
106
296
  entries = /* @__PURE__ */ new Map();
@@ -128,13 +318,13 @@ var x = class {
128
318
  clear() {
129
319
  this.entries.clear(), this.bytes = 0;
130
320
  }
131
- }, S = class {
321
+ }, se = class {
132
322
  disposed = !1;
133
323
  optionKey;
134
324
  recoveryMode;
135
- plans = new x(h, 524288);
136
- inline = new x(g, 262144);
137
- trees = new x(_, 524288);
325
+ plans = new k(ne, 524288);
326
+ inline = new k(re, 262144);
327
+ trees = new k(ie, 524288);
138
328
  counts = {
139
329
  hits: 0,
140
330
  misses: 0,
@@ -145,10 +335,10 @@ var x = class {
145
335
  reusedItemNodes: 0,
146
336
  reusedAst: 0
147
337
  };
148
- parse(e, t, n, r) {
338
+ parse(e, t, n, r, i) {
149
339
  if (this.disposed) throw Error("Local parse session is disposed");
150
- let i = l(t), a = b(t);
151
- return (i !== this.optionKey || a !== this.recoveryMode) && (this.optionKey = i, this.recoveryMode = a, this.reset()), d(e, t, n, this, r);
340
+ let a = u(t), o = oe(t);
341
+ return (a !== this.optionKey || o !== this.recoveryMode) && (this.optionKey = a, this.recoveryMode = o, this.reset()), i && i.length > 0 ? f(e, t, n, void 0, void 0, i) : f(e, t, n, this, r);
152
342
  }
153
343
  clear() {
154
344
  this.optionKey = void 0, this.recoveryMode = void 0, this.reset();
@@ -193,9 +383,9 @@ var x = class {
193
383
  return this.lookup(this.inline, e);
194
384
  }
195
385
  writeInline(e, t) {
196
- e.length > v || this.inline.write(y(e), t?.map((e) => ({
386
+ e.length > ae || this.inline.write(O(e), t?.map((e) => ({
197
387
  ...e,
198
- value: y(e.value)
388
+ value: O(e.value)
199
389
  })));
200
390
  }
201
391
  notePlanReuse() {
@@ -217,8 +407,8 @@ var x = class {
217
407
  let r = e.read(t);
218
408
  return r.hit ? (this.counts.hits += 1, n && (this.counts.reusedAst += 1)) : this.counts.misses += 1, r;
219
409
  }
220
- }, C = /* @__PURE__ */ new WeakSet();
221
- function w(e, t) {
410
+ }, A = /* @__PURE__ */ new WeakSet();
411
+ function j(e, t) {
222
412
  let n = 0, r = 0, i = /* @__PURE__ */ new WeakMap(), a = [], o = (e, t, n) => {
223
413
  e && (Object.defineProperty(e.output, t, {
224
414
  value: n,
@@ -229,7 +419,7 @@ function w(e, t) {
229
419
  }, s = (e, t, r, o) => {
230
420
  if (typeof t != "object" || !t) return t;
231
421
  if (e === t) return n++, e;
232
- if (e === void 0 && C.has(t)) return n++, t;
422
+ if (e === void 0 && A.has(t)) return n++, t;
233
423
  if (i.has(t)) return i.get(t);
234
424
  let s = Array.isArray(t), c = typeof e == "object" && e && Array.isArray(e) === s ? e : void 0, l = Object.keys(t), u = c ? Object.keys(c) : [], d = s ? Array(t.length) : {};
235
425
  i.set(t, d);
@@ -256,7 +446,7 @@ function w(e, t) {
256
446
  }
257
447
  a.pop();
258
448
  let t;
259
- e.equal ? (t = e.before, n++) : (r++, t = Object.isFrozen(e.after) ? Object.freeze(e.output) : e.output, C.add(t)), i.set(e.after, t), e.parent ? o(e.parent, e.key, t) : c = t;
449
+ e.equal ? (t = e.before, n++) : (r++, t = Object.isFrozen(e.after) ? Object.freeze(e.output) : e.output, A.add(t)), i.set(e.after, t), e.parent ? o(e.parent, e.key, t) : c = t;
260
450
  }
261
451
  return {
262
452
  value: c,
@@ -264,7 +454,7 @@ function w(e, t) {
264
454
  created: r
265
455
  };
266
456
  }
267
- function T(e, t) {
457
+ function ce(e, t) {
268
458
  if (!e?.ok || !t.ok) return 0;
269
459
  let n = /* @__PURE__ */ new Set(), r = [...e.document.nodes];
270
460
  for (; r.length;) {
@@ -279,7 +469,7 @@ function T(e, t) {
279
469
  return i;
280
470
  }
281
471
  // src/local/compilation/session/row-reuse.ts
282
- function E(e) {
472
+ function M(e) {
283
473
  if (e.nodes.length !== 1) return;
284
474
  let t = e.nodes[0], n, r;
285
475
  if (t.type === "list") n = "item", r = "listItem";
@@ -305,25 +495,25 @@ function E(e) {
305
495
  rows: a
306
496
  };
307
497
  }
308
- function D(e, t) {
498
+ function N(e, t) {
309
499
  if (e === t) return !0;
310
500
  if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
311
501
  let n = Object.keys(e), r = Object.keys(t);
312
502
  if (n.length !== r.length) return !1;
313
- for (let r of n) if (!Object.hasOwn(t, r) || !D(e[r], t[r])) return !1;
503
+ for (let r of n) if (!Object.hasOwn(t, r) || !N(e[r], t[r])) return !1;
314
504
  return !0;
315
505
  }
316
- function O(e, t, n, r) {
506
+ function P(e, t, n, r) {
317
507
  if (e.type !== t.type || e.range.start - n !== t.range.start - r || e.range.end - n !== t.range.end - r) return !1;
318
508
  let i = Object.keys(e), a = Object.keys(t);
319
509
  if (i.length !== a.length) return !1;
320
- for (let n of i) if (n !== "id" && n !== "range" && n !== "children" && (!Object.hasOwn(t, n) || !D(e[n], t[n]))) return !1;
510
+ for (let n of i) if (n !== "id" && n !== "range" && n !== "children" && (!Object.hasOwn(t, n) || !N(e[n], t[n]))) return !1;
321
511
  let o = e.children ?? [], s = t.children ?? [];
322
512
  if (o.length !== s.length) return !1;
323
- for (let e = 0; e < o.length; e++) if (!O(o[e], s[e], n, r)) return !1;
513
+ for (let e = 0; e < o.length; e++) if (!P(o[e], s[e], n, r)) return !1;
324
514
  return !0;
325
515
  }
326
- function k(e, t) {
516
+ function F(e, t) {
327
517
  let n = {
328
518
  ...e,
329
519
  range: {
@@ -331,14 +521,14 @@ function k(e, t) {
331
521
  end: e.range.end + t
332
522
  }
333
523
  };
334
- return e.attrs && (n.attrs = { ...e.attrs }), e.align && (n.align = [...e.align]), e.children && (n.children = e.children.map((e) => k(e, t))), n;
524
+ return e.attrs && (n.attrs = { ...e.attrs }), e.align && (n.align = [...e.align]), e.children && (n.children = e.children.map((e) => F(e, t))), n;
335
525
  }
336
- function A(e, t) {
337
- if (t.add(e.id), e.children) for (let n of e.children) A(n, t);
526
+ function I(e, t) {
527
+ if (t.add(e.id), e.children) for (let n of e.children) I(n, t);
338
528
  }
339
- function j(e, t) {
529
+ function le(e, t) {
340
530
  if (!e) return;
341
- let n = E(e), r = E(t);
531
+ let n = M(e), r = M(t);
342
532
  if (!n || !r || n.kind !== r.kind) return;
343
533
  let i = n.rows, a = r.rows, o = Math.min(i.length, a.length), s = 0;
344
534
  for (; s < o && i[s].text === a[s].text;) s += 1;
@@ -349,9 +539,9 @@ function j(e, t) {
349
539
  let n;
350
540
  if (t < s ? n = t : t >= a.length - c && (n = i.length - (a.length - t)), n === void 0) return e.node;
351
541
  let r = i[n];
352
- if (!O(r.node, e.node, r.node.range.start, e.node.range.start)) return e.node;
353
- let o = e.node.range.start - r.node.range.start, d = o === 0 ? r.node : k(r.node, o);
354
- return u += 1, A(d, l), d;
542
+ if (!P(r.node, e.node, r.node.range.start, e.node.range.start)) return e.node;
543
+ let o = e.node.range.start - r.node.range.start, d = o === 0 ? r.node : F(r.node, o);
544
+ return u += 1, I(d, l), d;
355
545
  });
356
546
  if (!u) return;
357
547
  let f = {
@@ -367,14 +557,44 @@ function j(e, t) {
367
557
  };
368
558
  }
369
559
  // src/local/compilation/session/incremental.ts
370
- function M(e) {
560
+ function L(e) {
371
561
  return typeof e == "object" && !!e && e.strict === !1;
372
562
  }
373
- function N(e) {
563
+ function R(e) {
374
564
  return Object.hasOwn(e, "recoveries") && e.recoveries !== void 0;
375
565
  }
376
- var P = o.configure(a), F = "\n\n<!-- incremental-boundary -->\n\n";
377
- function I(e) {
566
+ function z(e) {
567
+ return e === "streaming" || e === "final" ? e : void 0;
568
+ }
569
+ function ue() {
570
+ return {
571
+ ok: !1,
572
+ status: "failed",
573
+ diagnostics: [{
574
+ code: "local.options.invalid",
575
+ message: "Compile option sourcePhase must be \"streaming\" or \"final\".",
576
+ severity: "error",
577
+ range: {
578
+ start: 0,
579
+ end: 0
580
+ },
581
+ line: 1,
582
+ column: 1,
583
+ messageKey: "local.options.invalid.source-phase",
584
+ phase: "host",
585
+ recoverable: !1
586
+ }]
587
+ };
588
+ }
589
+ function de(e) {
590
+ try {
591
+ return typeof e == "object" && e ? z(e.sourcePhase) : void 0;
592
+ } catch {
593
+ return;
594
+ }
595
+ }
596
+ var B = s.configure(o), V = "\n\n<!-- incremental-boundary -->\n\n";
597
+ function H(e) {
378
598
  let t = [], n = [...e].reverse();
379
599
  for (; n.length;) {
380
600
  let e = n.pop();
@@ -382,7 +602,7 @@ function I(e) {
382
602
  }
383
603
  return t;
384
604
  }
385
- function L(e, t, n) {
605
+ function U(e, t, n) {
386
606
  return t === 0 && !n ? e : e.map((e) => ({
387
607
  ...e,
388
608
  id: n?.get(e.id) ?? e.id,
@@ -392,18 +612,22 @@ function L(e, t, n) {
392
612
  },
393
613
  ...e.attrs ? { attrs: { ...e.attrs } } : {},
394
614
  ...e.align ? { align: [...e.align] } : {},
395
- ...e.children ? { children: L(e.children, t, n) } : {}
615
+ ...e.children ? { children: U(e.children, t, n) } : {}
396
616
  }));
397
617
  }
398
- function R(e, t, n) {
618
+ function W(e, t, n) {
399
619
  let r = Object.create(null);
400
- for (let i of I(e)) r[n?.get(i.id) ?? i.id] = t.dependencies?.[i.id] ?? null;
620
+ for (let i of H(e)) r[n?.get(i.id) ?? i.id] = t.dependencies?.[i.id] ?? null;
401
621
  return r;
402
622
  }
403
- function z(e) {
623
+ function G(e) {
404
624
  let t = !1;
405
- for (let n of I([e])) {
625
+ for (let n of H([e])) {
406
626
  if ([
627
+ "authorCss",
628
+ "authorJavaScript",
629
+ "extendedHtmlRaw"
630
+ ].includes(n.type) || n.attrs && (Object.hasOwn(n.attrs, "css") || Object.hasOwn(n.attrs, "action-id")) || [
407
631
  "definition",
408
632
  "footnoteDefinition",
409
633
  "footnoteReference",
@@ -411,19 +635,19 @@ function z(e) {
411
635
  "imageReference"
412
636
  ].includes(n.type) || n.type === "hostComponent" || n.type === "htmlDocument" || n.type === "fallback") return "unsupported";
413
637
  if (n.type === "component") {
414
- if (["anchor", "jump"].includes(n.name ?? "") || !f(n.name ?? "")) return "unsupported";
638
+ if (["anchor", "jump"].includes(n.name ?? "") || !p(n.name ?? "")) return "unsupported";
415
639
  t = !0;
416
640
  }
417
641
  n.type === "comment" && (t = !0);
418
642
  }
419
643
  return t ? "context" : "fragment";
420
644
  }
421
- function B(e, t) {
645
+ function K(e, t) {
422
646
  let n = "", r = 0;
423
647
  for (let i of t) n += e.slice(r, i.from) + i.text.replace(/[^\r\n]/g, " "), r = i.to;
424
648
  return n + e.slice(r);
425
649
  }
426
- function V(e, t, n) {
650
+ function q(e, t, n) {
427
651
  let r = e.cursor();
428
652
  do
429
653
  if (r.name === "LinkReference") return null;
@@ -442,14 +666,14 @@ function V(e, t, n) {
442
666
  }
443
667
  return i;
444
668
  }
445
- function H(e) {
669
+ function J(e) {
446
670
  return /\r(?!\n)/.test(e);
447
671
  }
448
- function U(e, t) {
672
+ function fe(e, t) {
449
673
  for (; t > 0 && e[t - 1] !== "\n" && e[t - 1] !== "\r";) t--;
450
674
  return t;
451
675
  }
452
- function W(e, t) {
676
+ function Y(e, t) {
453
677
  let n = new Set(t.map((e) => e.from));
454
678
  for (let r of t) {
455
679
  let t = r.to;
@@ -464,7 +688,7 @@ function W(e, t) {
464
688
  }
465
689
  return !1;
466
690
  }
467
- function G(e, t, n, r) {
691
+ function X(e, t, n, r) {
468
692
  if (e.type !== n.type || e.range.start + t !== n.range.start + r || e.range.end + t !== n.range.end + r) return !1;
469
693
  let i = 0;
470
694
  for (let [a, o] of Object.entries(e)) {
@@ -474,13 +698,13 @@ function G(e, t, n, r) {
474
698
  if (a === "children") {
475
699
  let n = o, i = e;
476
700
  if (!i || n.length !== i.length) return !1;
477
- for (let e = 0; e < n.length; e++) if (!G(n[e], t, i[e], r)) return !1;
701
+ for (let e = 0; e < n.length; e++) if (!X(n[e], t, i[e], r)) return !1;
478
702
  } else if (o !== e && JSON.stringify(o) !== JSON.stringify(e)) return !1;
479
703
  }
480
704
  for (let [e, t] of Object.entries(n)) t !== void 0 && e !== "id" && e !== "range" && i--;
481
705
  return i === 0;
482
706
  }
483
- function K(e, t) {
707
+ function Z(e, t) {
484
708
  let n = 0, r = e.length, i = t.length;
485
709
  for (; n < r && n < i && e.charCodeAt(n) === t.charCodeAt(n);) n++;
486
710
  for (; r > n && i > n && e.charCodeAt(r - 1) === t.charCodeAt(i - 1);) r--, i--;
@@ -491,19 +715,19 @@ function K(e, t) {
491
715
  delta: i - r
492
716
  };
493
717
  }
494
- function q(e, t) {
718
+ function Q(e, t) {
495
719
  let n = e.parsed?.plans;
496
720
  if (n?.length) {
497
721
  for (let e of n) if (e.source === t) return e.rows;
498
722
  if (n.length === 1) return n[0].rows;
499
723
  }
500
724
  }
501
- var J = class {
725
+ var $ = class {
502
726
  disposed = !1;
503
727
  snapshot = null;
504
728
  deferred = null;
505
- parseSession = new S();
506
- semantic = new m();
729
+ parseSession = new se();
730
+ semantic = new te();
507
731
  services = {
508
732
  parser: this.parseSession,
509
733
  semantic: this.semantic
@@ -511,6 +735,7 @@ var J = class {
511
735
  shared = null;
512
736
  sharedKey;
513
737
  sharedMode;
738
+ streamingCache = null;
514
739
  epoch = 0;
515
740
  cacheBuilds = 0;
516
741
  serial = 0;
@@ -527,25 +752,64 @@ var J = class {
527
752
  cacheBuilds: this.cacheBuilds
528
753
  };
529
754
  }
530
- compile(e, t) {
531
- let r = this.compileShared(e, t), i = performance.now(), a = n(r);
755
+ compile(e, t, r) {
756
+ let i = this.compileShared(e, t, r), a = performance.now(), o = n(i);
532
757
  return this.lastStats = {
533
758
  ...this.lastStats,
534
759
  stages: {
535
760
  ...this.lastStats.stages,
536
- publicSnapshotMs: performance.now() - i
761
+ publicSnapshotMs: performance.now() - a
537
762
  }
538
- }, a;
763
+ }, o;
539
764
  }
540
- compileShared(e, t) {
765
+ compileShared(e, t, n) {
541
766
  if (this.disposed) throw Error("Local compile session is disposed");
767
+ if (n !== void 0 && z(n) === void 0) return ue();
768
+ let r = z(n) ?? de(t);
769
+ return r === "streaming" ? this.compileStreaming(e, t) : r === "final" ? this.compileFinal(e, t) : this.compileFinalOrLegacy(e, t);
770
+ }
771
+ compileFinal(e, t) {
772
+ let n = this.compileFinalOrLegacy(e, t);
773
+ return n.ok ? {
774
+ ...n,
775
+ status: R(n) ? "recovered" : "valid"
776
+ } : {
777
+ ...n,
778
+ status: "failed"
779
+ };
780
+ }
781
+ compileStreaming(e, t) {
782
+ let n = l(t).ok, r = u(t), i = this.streamingCache;
783
+ if (n && i !== null && i.source === e && i.key === r) return this.lastStats = {
784
+ mode: "streaming",
785
+ totalBlocks: i.blocks,
786
+ compiledBlocks: 0,
787
+ reusedBlocks: 0,
788
+ compiledCharacters: 0
789
+ }, i.result;
790
+ let a = ee(e, t, this.services), o = a.parsed?.nodes.length ?? 0;
791
+ return this.lastStats = {
792
+ mode: "streaming",
793
+ totalBlocks: o,
794
+ compiledBlocks: o,
795
+ reusedBlocks: 0,
796
+ compiledCharacters: typeof e == "string" ? e.length : 0,
797
+ stages: a.timings
798
+ }, n && (this.streamingCache = {
799
+ source: e,
800
+ key: r,
801
+ result: a.result,
802
+ blocks: o
803
+ }), a.result;
804
+ }
805
+ compileFinalOrLegacy(e, t) {
542
806
  this.epoch++;
543
- let n = l(t), r = M(t);
807
+ let n = u(t), r = L(t);
544
808
  (n !== this.sharedKey || r !== this.sharedMode) && (this.shared = null, this.sharedKey = n, this.sharedMode = r);
545
- let i = this.compileCore(e, t), a = performance.now(), o = this.shared, s = w(o ?? void 0, i).value;
809
+ let i = this.compileCore(e, t), a = performance.now(), o = this.shared, s = j(o ?? void 0, i).value;
546
810
  return this.shared = s, this.lastStats = {
547
811
  ...this.lastStats,
548
- sharedNodes: T(o, s),
812
+ sharedNodes: ce(o, s),
549
813
  parse: this.parseSession.stats,
550
814
  semantic: this.lastStats.semantic ?? this.semantic.stats,
551
815
  stages: {
@@ -557,8 +821,8 @@ var J = class {
557
821
  compileCore(e, t) {
558
822
  if (this.disposed) throw Error("Local compile session is disposed");
559
823
  this.cacheBuilds = 0;
560
- let r = l(t), i = c(t), a = M(t), o = a ? "recovery-reference" : "initial", d = !1, f = this.deferred;
561
- if (this.deferred = null, !a && f && f.key === r && i.ok && !i.htmlActive && typeof e == "string" && e.length <= 1e6) {
824
+ let r = u(t), i = l(t), a = L(t), o = a ? "recovery-reference" : "initial", s = !1, f = this.deferred;
825
+ if (this.deferred = null, !a && f && f.key === r && i.ok && typeof e == "string" && e.length <= 1e6) {
562
826
  if (e === f.source) return this.deferred = f, this.lastStats = {
563
827
  mode: "cached",
564
828
  totalBlocks: this.lastStats.totalBlocks,
@@ -566,16 +830,16 @@ var J = class {
566
830
  reusedBlocks: this.lastStats.totalBlocks,
567
831
  compiledCharacters: 0
568
832
  }, f.tracked.result;
569
- d = !0, o = "scope-or-boundary";
570
- let n = K(f.source, e), i = (e) => n.from <= e.end && n.oldTo >= e.start, a = f.tracked.parsed;
571
- if (a && !/[`\\~]/.test(f.source.slice(n.from, n.oldTo) + e.slice(n.from, n.newTo)) && !a.nodes.some((e) => i(e.range) && z(e) !== "fragment") && ![a.versionDeclaration?.range, a.themeRange].some((e) => e && i(e))) try {
833
+ s = !0, o = "scope-or-boundary";
834
+ let n = Z(f.source, e), i = (e) => n.from <= e.end && n.oldTo >= e.start, a = f.tracked.parsed;
835
+ if (a && !/[`\\~]/.test(f.source.slice(n.from, n.oldTo) + e.slice(n.from, n.newTo)) && !a.nodes.some((e) => i(e.range) && G(e) !== "fragment") && ![a.versionDeclaration?.range, a.themeRange].some((e) => e && i(e))) try {
572
836
  this.snapshot = this.seed(f.source, r, f.tracked, t);
573
837
  } catch {
574
838
  this.snapshot = null;
575
839
  }
576
840
  } else f && (o = a ? "recovery-reference" : "options-or-limits");
577
841
  let p = this.snapshot;
578
- if (!a && p && p.key === r && i.ok && !i.htmlActive && typeof e == "string" && e.length <= 1e6) {
842
+ if (!a && p && p.key === r && i.ok && typeof e == "string" && e.length <= 1e6) {
579
843
  if (e === p.source) return this.lastStats = {
580
844
  mode: "cached",
581
845
  totalBlocks: p.blocks.length,
@@ -588,10 +852,10 @@ var J = class {
588
852
  n = this.update(p, e, t, i.maxSyntaxNodes);
589
853
  } catch {}
590
854
  if (n) return this.snapshot = n, this.publish(n);
591
- o = "scope-or-boundary", d = !0;
855
+ o = "scope-or-boundary", s = !0;
592
856
  } else p && (o = a ? "recovery-reference" : "options-or-limits");
593
857
  this.snapshot = null;
594
- let m = u(e, t, this.services);
858
+ let m = d(e, t, this.services);
595
859
  if (this.lastStats = {
596
860
  mode: "full",
597
861
  totalBlocks: m.parsed?.nodes.length ?? 0,
@@ -601,13 +865,13 @@ var J = class {
601
865
  fallbackReason: o,
602
866
  semantic: m.semantic,
603
867
  stages: m.timings
604
- }, !a && m.result.ok && m.result.diagnostics.length === 0 && !N(m.result) && i.ok && !i.htmlActive && r !== "invalid") {
605
- if (d) {
868
+ }, !a && m.result.ok && !m.result.document.capabilities && m.result.diagnostics.length === 0 && !R(m.result) && i.ok && r !== "invalid") {
869
+ if (s) {
606
870
  let i = t === void 0 ? void 0 : n(t), a = i;
607
871
  if (i?.config !== void 0) try {
608
872
  a = {
609
873
  ...i,
610
- config: s(i.config)
874
+ config: c(i.config)
611
875
  };
612
876
  } catch {}
613
877
  this.deferred = {
@@ -626,8 +890,8 @@ var J = class {
626
890
  return this.snapshot ? this.publish(this.snapshot) : m.result;
627
891
  }
628
892
  seed(e, t, n, r, i) {
629
- if (this.cacheBuilds++, !n.result.ok || !n.parsed || N(n.result) || e.includes("[^") || e.includes("") || H(e)) return null;
630
- let a = n.parsed.nodes, o = a.map(z), s = a.length === 1 && o[0] === "fragment" && (a[0].type === "list" || a[0].type === "table");
893
+ if (this.cacheBuilds++, !n.result.ok || !n.parsed || R(n.result) || e.includes("[^") || e.includes("") || J(e)) return null;
894
+ let a = n.parsed.nodes, o = a.map(G), s = a.length === 1 && o[0] === "fragment" && (a[0].type === "list" || a[0].type === "table");
631
895
  if (o.includes("unsupported") || !s && o.filter((e) => e === "fragment").length < 2) return null;
632
896
  let c = {
633
897
  ...n.result.document,
@@ -645,7 +909,7 @@ var J = class {
645
909
  origin: n.range.start,
646
910
  text: e.slice(n.range.start, n.range.end),
647
911
  nodes: t,
648
- dependencies: R(t, c),
912
+ dependencies: W(t, c),
649
913
  cost: 0
650
914
  });
651
915
  }
@@ -659,10 +923,10 @@ var J = class {
659
923
  dependencies: {},
660
924
  cost: 0
661
925
  });
662
- if (u.sort((e, t) => e.from - t.from), W(e, u)) return null;
663
- let f = B(e, u);
926
+ if (u.sort((e, t) => e.from - t.from), Y(e, u)) return null;
927
+ let f = K(e, u);
664
928
  if (f.includes("<")) return null;
665
- let p = i ?? P.parse(f), m = V(p, u, f);
929
+ let p = i ?? B.parse(f), m = q(p, u, f);
666
930
  if (!m) return null;
667
931
  let h = [], g = 0;
668
932
  for (let t of m) {
@@ -673,20 +937,20 @@ var J = class {
673
937
  r.push(e), g++;
674
938
  }
675
939
  if (!r.length) return null;
676
- let i = r.flatMap((e) => l.has(e.id) ? [l.get(e.id)] : []), a = I(i).length, o = e.slice(t.start, t.end);
940
+ let i = r.flatMap((e) => l.has(e.id) ? [l.get(e.id)] : []), a = H(i).length, o = e.slice(t.start, t.end);
677
941
  h.push({
678
942
  from: t.start,
679
943
  to: t.end,
680
944
  origin: t.start,
681
945
  text: o,
682
946
  nodes: i,
683
- dependencies: R(i, c),
947
+ dependencies: W(i, c),
684
948
  cost: a,
685
- rowPlans: q(n, o)
949
+ rowPlans: Q(n, o)
686
950
  });
687
951
  }
688
952
  if (g !== d.length) return null;
689
- let _ = u.length ? u.map((e) => e.text).join(F) + F : "", v = _ ? this.parseSession.parse(_, r) : null;
953
+ let _ = u.length ? u.map((e) => e.text).join(V) + V : "", v = _ ? this.parseSession.parse(_, r) : null;
690
954
  if (v?.diagnostics.length) return null;
691
955
  let y = (n.parsed.syntaxNodes ?? 0) - h.reduce((e, t) => e + t.cost, 0);
692
956
  return y < 0 ? null : (c.nodes = [], c.source = "", delete c.dependencies, {
@@ -702,13 +966,13 @@ var J = class {
702
966
  });
703
967
  }
704
968
  update(e, t, n, r) {
705
- if (t.includes("[^") || t.includes("") || H(t)) return null;
706
- let a = K(e.source, t);
707
- if (/[`\\~]/.test(e.source.slice(a.from, a.oldTo) + t.slice(a.from, a.newTo))) return null;
969
+ if (t.includes("[^") || t.includes("") || J(t)) return null;
970
+ let i = Z(e.source, t);
971
+ if (/[`\\~]/.test(e.source.slice(i.from, i.oldTo) + t.slice(i.from, i.newTo))) return null;
708
972
  let o = [];
709
973
  for (let n of e.context) {
710
- if (a.from <= n.to && a.oldTo >= n.from) return null;
711
- let e = n.from >= a.oldTo ? a.delta : 0, r = {
974
+ if (i.from <= n.to && i.oldTo >= n.from) return null;
975
+ let e = n.from >= i.oldTo ? i.delta : 0, r = {
712
976
  ...n,
713
977
  from: n.from + e,
714
978
  to: n.to + e
@@ -716,38 +980,38 @@ var J = class {
716
980
  if (t.slice(r.from, r.to) !== n.text) return null;
717
981
  o.push(r);
718
982
  }
719
- if (W(t, o)) return null;
720
- let s = i.applyChanges(i.addTree(e.tree), [{
721
- fromA: a.from,
722
- toA: a.oldTo,
723
- fromB: a.from,
724
- toB: a.newTo
725
- }], 0), c = B(t, o);
983
+ if (Y(t, o)) return null;
984
+ let s = a.applyChanges(a.addTree(e.tree), [{
985
+ fromA: i.from,
986
+ toA: i.oldTo,
987
+ fromB: i.from,
988
+ toB: i.newTo
989
+ }], 0), c = K(t, o);
726
990
  if (c.includes("<")) return null;
727
- let l = P.parse(c, s), d = V(l, o, c);
728
- if (!d) return null;
991
+ let l = B.parse(c, s), u = q(l, o, c);
992
+ if (!u) return null;
729
993
  let f = new Map(e.blocks.map((e) => [`${e.from}:${e.to}`, e])), p = [], m = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), g = 0, _ = 0, v = 0, y = e.contextCost;
730
- for (let i of d) {
731
- let o = i.start >= a.newTo ? a.delta : 0, s = i.end <= a.from || i.start >= a.newTo ? f.get(`${i.start - o}:${i.end - o}`) : void 0, c = t.slice(i.start, i.end);
994
+ for (let a of u) {
995
+ let o = a.start >= i.newTo ? i.delta : 0, s = a.end <= i.from || a.start >= i.newTo ? f.get(`${a.start - o}:${a.end - o}`) : void 0, c = t.slice(a.start, a.end);
732
996
  if (s && s.text === c) {
733
997
  p.push({
734
998
  ...s,
735
- from: i.start,
736
- to: i.end
999
+ from: a.start,
1000
+ to: a.end
737
1001
  }), g++, y += s.cost;
738
- for (let e of I(s.nodes)) m.add(e.id);
1002
+ for (let e of H(s.nodes)) m.add(e.id);
739
1003
  } else {
740
1004
  let t = e.prefix.length, r = e.blocks.find((e) => {
741
- let t = e.from >= a.oldTo ? e.from + a.delta : e.from, n = e.to >= a.oldTo ? e.to + a.delta : e.to;
742
- return t < i.end && n > i.start;
1005
+ let t = e.from >= i.oldTo ? e.from + i.delta : e.from, n = e.to >= i.oldTo ? e.to + i.delta : e.to;
1006
+ return t < a.end && n > a.start;
743
1007
  }), o = r?.rowPlans ? {
744
1008
  ...this.services,
745
1009
  rowPlans: r.rowPlans
746
- } : this.services, s = u(e.prefix + c, n, o);
747
- if (v += t + c.length, _++, !s.result.ok || s.result.diagnostics.length || !s.parsed || N(s.result)) return null;
1010
+ } : this.services, s = d(e.prefix + c, n, o);
1011
+ if (v += t + c.length, _++, !s.result.ok || s.result.diagnostics.length || !s.parsed || R(s.result)) return null;
748
1012
  let l = s.parsed.nodes.filter((e) => e.range.start >= t);
749
- if (!l.length || l.some((e) => z(e) !== "fragment")) return null;
750
- let d = s.result.document.nodes.filter((e) => e.range.start >= t), f = new Map(I(d).map((e) => [e.id, `incremental-${++this.serial}-${e.id}`])), g = L(d, 0, f), b = r ? j({
1013
+ if (!l.length || l.some((e) => G(e) !== "fragment")) return null;
1014
+ let u = s.result.document.nodes.filter((e) => e.range.start >= t), f = new Map(H(u).map((e) => [e.id, `incremental-${++this.serial}-${e.id}`])), g = U(u, 0, f), b = r ? le({
751
1015
  text: r.text,
752
1016
  origin: r.origin,
753
1017
  nodes: r.nodes
@@ -763,29 +1027,29 @@ var J = class {
763
1027
  }
764
1028
  }
765
1029
  let x = b?.nodes ?? g, S = (s.parsed.syntaxNodes ?? 0) - e.prefixCost;
766
- if (S < I(x).length) return null;
767
- let C = R(d, s.result.document, f), w = Object.create(null);
768
- for (let e of I(x)) w[e.id] = C[e.id] ?? null;
1030
+ if (S < H(x).length) return null;
1031
+ let C = W(u, s.result.document, f), w = Object.create(null);
1032
+ for (let e of H(x)) w[e.id] = C[e.id] ?? null;
769
1033
  if (b && r) {
770
1034
  let e = r.nodes[0]?.id, t = g[0]?.id;
771
1035
  for (let n of b.reusedIds) w[n] = n === e && t !== void 0 ? C[t] ?? null : r.dependencies[n] ?? null, m.add(n);
772
1036
  for (let e = 0; e < b.reused; e++) this.parseSession.noteRowReuse(b.kind);
773
1037
  }
774
1038
  let T = {
775
- from: i.start,
776
- to: i.end,
1039
+ from: a.start,
1040
+ to: a.end,
777
1041
  origin: t,
778
1042
  text: c,
779
1043
  nodes: x,
780
1044
  dependencies: w,
781
1045
  cost: S,
782
- rowPlans: q(s, c)
1046
+ rowPlans: Q(s, c)
783
1047
  };
784
1048
  p.push(T), h.add(T), y += S;
785
1049
  }
786
1050
  if (y > r) return null;
787
1051
  }
788
- return y > r || !this.sameBoundaries(t, p, o, h, a, n) ? null : (this.lastStats = {
1052
+ return y > r || !this.sameBoundaries(t, p, o, h, i, n) ? null : (this.lastStats = {
789
1053
  mode: "incremental",
790
1054
  totalBlocks: p.length,
791
1055
  compiledBlocks: _,
@@ -819,7 +1083,7 @@ var J = class {
819
1083
  delta: a
820
1084
  });
821
1085
  }
822
- let i = r[0], l = r[r.length - 1], u = "node" in i ? Math.max(s[t].from, U(e, i.node.range.start + i.delta)) : i.from, d = "node" in l ? l.node.range.end + l.delta : l.to, f = s.slice(t, n + 2).flatMap((e) => e.rowPlans ? [e.rowPlans] : []), p = f.length < 2 ? f[0] : {
1086
+ let i = r[0], l = r[r.length - 1], u = "node" in i ? Math.max(s[t].from, fe(e, i.node.range.start + i.delta)) : i.from, d = "node" in l ? l.node.range.end + l.delta : l.to, f = s.slice(t, n + 2).flatMap((e) => e.rowPlans ? [e.rowPlans] : []), p = f.length < 2 ? f[0] : {
823
1087
  has: (e) => f.some((t) => t.has(e)),
824
1088
  get: (e) => f.find((t) => t.has(e))?.get(e)
825
1089
  }, m = this.parseSession.parse(e.slice(u, d), a, void 0, p);
@@ -827,7 +1091,7 @@ var J = class {
827
1091
  for (let e = 0; e < r.length; e++) {
828
1092
  let t = r[e], n = m.nodes[e];
829
1093
  if ("node" in t) {
830
- if (!G(n, u, t.node, t.delta)) return !1;
1094
+ if (!X(n, u, t.node, t.delta)) return !1;
831
1095
  } else if (n.range.start + u !== t.from || n.range.end + u !== t.to) return !1;
832
1096
  }
833
1097
  t = n;
@@ -841,7 +1105,7 @@ var J = class {
841
1105
  t.nodes = r.flatMap((e) => {
842
1106
  let t = e.from - e.origin;
843
1107
  if (e.publication?.delta === t) return e.publication.nodes;
844
- let n = w(e.publication?.nodes ?? e.nodes.map((e) => i.get(e.id)).filter((e) => !!e), L(e.nodes, t)).value;
1108
+ let n = j(e.publication?.nodes ?? e.nodes.map((e) => i.get(e.id)).filter((e) => !!e), U(e.nodes, t)).value;
845
1109
  return e.publication = {
846
1110
  delta: t,
847
1111
  nodes: n
@@ -895,7 +1159,7 @@ var J = class {
895
1159
  if (await t(), !i() || !n.tracked.result.ok || !n.tracked.parsed) return !1;
896
1160
  let a = [], o = n.tracked.parsed.nodes;
897
1161
  for (let e = 0; e < o.length; e++) {
898
- let r = o[e], s = z(r);
1162
+ let r = o[e], s = G(r);
899
1163
  if (s === "unsupported" || (s === "context" && a.push({
900
1164
  from: r.range.start,
901
1165
  to: r.range.end,
@@ -916,9 +1180,9 @@ var J = class {
916
1180
  cost: 0
917
1181
  });
918
1182
  a.sort((e, t) => e.from - t.from);
919
- let s = B(n.source, a);
1183
+ let s = K(n.source, a);
920
1184
  if (s.includes("<")) return !1;
921
- let c = P.startParse(s), l = null;
1185
+ let c = B.startParse(s), l = null;
922
1186
  for (; !l;) if (l = c.advance(), !l && (await t(), !i())) return !1;
923
1187
  if (await t(), !i()) return !1;
924
1188
  let u = this.cacheBuilds;
@@ -932,13 +1196,13 @@ var J = class {
932
1196
  }
933
1197
  }
934
1198
  clear() {
935
- this.epoch++, this.snapshot = null, this.deferred = null, this.serial = 0, this.cacheBuilds = 0, this.shared = null, this.sharedKey = void 0, this.sharedMode = void 0, this.parseSession.clear(), this.semantic.clear();
1199
+ this.epoch++, this.snapshot = null, this.deferred = null, this.serial = 0, this.cacheBuilds = 0, this.shared = null, this.sharedKey = void 0, this.sharedMode = void 0, this.streamingCache = null, this.parseSession.clear(), this.semantic.clear();
936
1200
  }
937
1201
  dispose() {
938
1202
  this.clear(), this.parseSession.dispose(), this.disposed = !0;
939
1203
  }
940
1204
  };
941
- function Y() {
942
- return new J();
1205
+ function pe() {
1206
+ return new $();
943
1207
  }
944
- export { Y as n, J as t };
1208
+ export { pe as n, $ as t };