reactive-md 0.9.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/CHANGELOG-ch.md +34 -0
  2. package/CHANGELOG.md +34 -0
  3. package/README-ch.md +7 -7
  4. package/README-en.md +7 -7
  5. package/README.md +7 -7
  6. package/THIRD_PARTY_NOTICES.md +0 -57
  7. package/cli/help.mjs +6 -4
  8. package/cli/init.mjs +1 -1
  9. package/cli/migrate.mjs +1 -1
  10. package/dist-library/{LocalDocumentView-D6zQkTkt.js → LocalDocumentView-CP2QG86k.js} +46 -44
  11. package/dist-library/{LocalDocumentViewCore-CmJhemcA.js → LocalDocumentViewCore-Cd6yMEkg.js} +284 -265
  12. package/dist-library/{LocalReactiveDocumentCore-lAKOGAZ7.js → LocalReactiveDocumentCore-VuYpZqdn.js} +7 -7
  13. package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
  14. package/dist-library/authoring-Bwu_zCWs.js +768 -0
  15. package/dist-library/choice-values-BItGjPD2.js +58 -0
  16. package/dist-library/compile-B35rfzKr.js +1742 -0
  17. package/dist-library/{compile-cache-key-6GgpETz_.js → compile-cache-key-D21X2Obx.js} +5 -5
  18. package/dist-library/{compiler-DLkKUK4t.js → compiler-DBwLawMZ.js} +4 -4
  19. package/dist-library/{compiler-core-Niqhp9wV.js → compiler-core-kkDiQ1RK.js} +3146 -2055
  20. package/dist-library/{component-kernel-IG4wOO0i.js → component-kernel-CsJSabHX.js} +42 -26
  21. package/dist-library/{component-state-Ht-hOK0W.js → component-state-Da0G8Ajc.js} +1 -1
  22. package/dist-library/{component-utils-eSj5IdG4.js → component-utils-ZM3jUJNy.js} +80 -79
  23. package/dist-library/conditional-branches-CIhJXasR.js +17 -0
  24. package/dist-library/{config-validation-Cpol91_M.js → config-validation-DbmsWAEV.js} +165 -152
  25. package/dist-library/{controls-B-CLSK8Q.js → controls-DRy5rzzN.js} +271 -228
  26. package/dist-library/{coordinate-PyLPMIQK.js → coordinate-c54pHfgf.js} +29 -29
  27. package/dist-library/data-table-CSAkm1eU.js +290 -0
  28. package/dist-library/data-table-model-DruztQFt.js +391 -0
  29. package/dist-library/{data-visuals-_Z7QqYTk.js → data-visuals-rZQUeQM0.js} +14 -14
  30. package/dist-library/{default-components-jugH7Ubr.js → default-components-B-39etG9.js} +233 -71
  31. package/dist-library/{default-config-DIrRpuQz.js → default-config-CCa8rm2k.js} +236 -216
  32. package/dist-library/default-options-By16CVw1.js +131 -0
  33. package/dist-library/{default-registry-BlloaZi7.js → default-registry-DXJy66xj.js} +3 -3
  34. package/dist-library/{default-schema-Ch-Vznpm.js → default-schema-CeYiEW1K.js} +3 -3
  35. package/dist-library/display-Bb6hAG5T.js +2065 -0
  36. package/dist-library/{document-theme-DBAfnk7y.js → document-theme-CJvN-nC1.js} +190 -3
  37. package/dist-library/{export-heVBqgxA.js → export-BSV4E0jv.js} +105 -106
  38. package/dist-library/font-aliases-CKYjwn4o.js +4 -0
  39. package/dist-library/{gallery-Q6VPS2ep.js → gallery-DM2yTVZJ.js} +1 -1
  40. package/dist-library/{html-CCnvzan1.js → html-CY9mC3Sr.js} +5 -5
  41. package/dist-library/{incremental-Bzvh8_lB.js → incremental-B-wW4H3F.js} +251 -245
  42. package/dist-library/{display-y4v9v0Qd.js → katex-4ukd4ZxT.js} +1555 -3618
  43. package/dist-library/layout-CPQggKxk.js +592 -0
  44. package/dist-library/{layout-BnfDeUNy.js → layout-CaDWsDof.js} +1 -1
  45. package/dist-library/{math-view-B0jthpRw.js → math-view-CyGTS6kv.js} +1 -1
  46. package/dist-library/{mount-preset-C_i37FvY.js → mount-preset-DtrCX4G8.js} +4 -4
  47. package/dist-library/{numeric-sliders-CkWS0-ja.js → numeric-sliders-BmJ1LCLx.js} +190 -190
  48. package/dist-library/{observability-CYLuvFfL.js → observability-BVQ16ByQ.js} +5 -4
  49. package/dist-library/{package-core-9UK5ZdqB.js → package-core-Cu_r_qs7.js} +7 -6
  50. package/dist-library/{parser-9yNJxGip.js → parser-BHl9Lxbw.js} +2 -2
  51. package/dist-library/{parser-standard-BPIy4HOu.js → parser-standard-DDAKv_DZ.js} +247 -247
  52. package/dist-library/{plugin-packs-CZb46nuv.js → plugin-packs-CkI0floL.js} +3 -3
  53. package/dist-library/{preset-core-BW3NWZJ9.js → preset-core-BKPbH_Nv.js} +377 -306
  54. package/dist-library/{props-pJRrfDc6.js → props-0iDqxlTk.js} +56 -61
  55. package/dist-library/{react-BSo0o998.js → react-74jdGBmu.js} +2 -2
  56. package/dist-library/reactive-md-authoring.js +277 -269
  57. package/dist-library/reactive-md-build.js +327 -33
  58. package/dist-library/reactive-md-compiler-session.js +3 -3
  59. package/dist-library/reactive-md-compiler-standard.js +10 -10
  60. package/dist-library/reactive-md-compiler.js +3 -3
  61. package/dist-library/reactive-md-contracts.js +4 -4
  62. package/dist-library/reactive-md-default-packs.js +4 -3
  63. package/dist-library/reactive-md-default-preset.js +3 -3
  64. package/dist-library/reactive-md-export.js +6 -6
  65. package/dist-library/reactive-md-minimal-preset.js +3 -2
  66. package/dist-library/reactive-md-minimal-react-preset.js +18 -17
  67. package/dist-library/reactive-md-minimal.css +1 -1
  68. package/dist-library/reactive-md-observability.js +2 -2
  69. package/dist-library/reactive-md-pack-style-manifest.js +8 -0
  70. package/dist-library/reactive-md-plugin-chart.js +13 -9
  71. package/dist-library/reactive-md-plugin-data.js +4 -4
  72. package/dist-library/reactive-md-plugin-diagram.js +3 -3
  73. package/dist-library/reactive-md-plugin-forms.js +5 -5
  74. package/dist-library/reactive-md-plugin-gallery.js +3 -3
  75. package/dist-library/reactive-md-plugin-navigation.js +10 -10
  76. package/dist-library/reactive-md-plugin-network.js +5 -5
  77. package/dist-library/reactive-md-plugin-plot.js +4 -4
  78. package/dist-library/reactive-md-react-component-accordion.js +3 -3
  79. package/dist-library/reactive-md-react-component-alert.js +3 -3
  80. package/dist-library/reactive-md-react-component-anchor.js +3 -3
  81. package/dist-library/reactive-md-react-component-badge.js +3 -3
  82. package/dist-library/reactive-md-react-component-card.js +3 -3
  83. package/dist-library/reactive-md-react-component-chart.js +2 -2
  84. package/dist-library/reactive-md-react-component-checkbox.js +2 -2
  85. package/dist-library/reactive-md-react-component-checklist.js +2 -2
  86. package/dist-library/reactive-md-react-component-choices.js +2 -2
  87. package/dist-library/reactive-md-react-component-column.js +1 -1
  88. package/dist-library/reactive-md-react-component-coordinate.js +2 -2
  89. package/dist-library/reactive-md-react-component-counter.js +2 -2
  90. package/dist-library/reactive-md-react-component-data-table.js +2 -2
  91. package/dist-library/reactive-md-react-component-date.js +2 -2
  92. package/dist-library/reactive-md-react-component-diagram.js +2 -2
  93. package/dist-library/reactive-md-react-component-disclosure.js +3 -3
  94. package/dist-library/reactive-md-react-component-edge.js +1 -1
  95. package/dist-library/reactive-md-react-component-else.js +10 -0
  96. package/dist-library/reactive-md-react-component-gallery-item.js +2 -2
  97. package/dist-library/reactive-md-react-component-gallery.js +2 -2
  98. package/dist-library/reactive-md-react-component-grid.js +3 -3
  99. package/dist-library/reactive-md-react-component-if.js +3 -3
  100. package/dist-library/reactive-md-react-component-input.js +2 -2
  101. package/dist-library/reactive-md-react-component-jump.js +3 -3
  102. package/dist-library/reactive-md-react-component-multi-select.js +2 -2
  103. package/dist-library/reactive-md-react-component-node.js +2 -2
  104. package/dist-library/reactive-md-react-component-number.js +2 -2
  105. package/dist-library/reactive-md-react-component-option.js +1 -1
  106. package/dist-library/reactive-md-react-component-panel.js +3 -3
  107. package/dist-library/reactive-md-react-component-plot.js +2 -2
  108. package/dist-library/reactive-md-react-component-progress.js +2 -2
  109. package/dist-library/reactive-md-react-component-quiz.js +2 -2
  110. package/dist-library/reactive-md-react-component-radio-group.js +2 -2
  111. package/dist-library/reactive-md-react-component-range-slider.js +2 -2
  112. package/dist-library/reactive-md-react-component-section.js +3 -3
  113. package/dist-library/reactive-md-react-component-select.js +2 -2
  114. package/dist-library/reactive-md-react-component-slider.js +2 -2
  115. package/dist-library/reactive-md-react-component-step.js +3 -3
  116. package/dist-library/reactive-md-react-component-steps.js +3 -3
  117. package/dist-library/reactive-md-react-component-tab.js +3 -3
  118. package/dist-library/reactive-md-react-component-table.js +2 -2
  119. package/dist-library/reactive-md-react-component-tabs.js +3 -3
  120. package/dist-library/reactive-md-react-component-text.js +3 -3
  121. package/dist-library/reactive-md-react-component-textarea.js +2 -2
  122. package/dist-library/reactive-md-react-component-timeline.js +2 -2
  123. package/dist-library/reactive-md-react-component-timer.js +2 -2
  124. package/dist-library/reactive-md-react-component-toggle.js +2 -2
  125. package/dist-library/reactive-md-react-component-tooltip.js +3 -3
  126. package/dist-library/reactive-md-react-component-validation.js +3 -3
  127. package/dist-library/reactive-md-react-minimal.js +4 -4
  128. package/dist-library/reactive-md-react-pack-controls.js +4 -4
  129. package/dist-library/reactive-md-react-pack-data.js +3 -3
  130. package/dist-library/reactive-md-react-pack-layout.js +25 -24
  131. package/dist-library/reactive-md-react-pack-visuals.js +2 -2
  132. package/dist-library/reactive-md-react-packed.js +6 -6
  133. package/dist-library/reactive-md-react-server.js +37 -36
  134. package/dist-library/reactive-md-react-static-server.js +2 -2
  135. package/dist-library/reactive-md-react-static.js +1 -1
  136. package/dist-library/reactive-md-react-unstyled.js +12 -12
  137. package/dist-library/reactive-md-react.js +12 -12
  138. package/dist-library/reactive-md-scan.js +1 -1
  139. package/dist-library/reactive-md-sdk.js +23 -9
  140. package/dist-library/reactive-md-standalone-configured.js +2 -2
  141. package/dist-library/reactive-md-standalone-host.js +2 -2
  142. package/dist-library/reactive-md-testing-browser.js +2 -2
  143. package/dist-library/reactive-md-testing-react.js +6 -6
  144. package/dist-library/reactive-md-testing.js +6 -6
  145. package/dist-library/reactive-md-vite.js +25 -9
  146. package/dist-library/reactive-md-worker-pool.js +3 -3
  147. package/dist-library/reactive-md.css +1 -1
  148. package/dist-library/reactive-md.js +52 -43
  149. package/dist-library/{registry-core-CziAIP5P.js → registry-core-DxEaxhJ6.js} +3 -2
  150. package/dist-library/{render-nodes-DKjg_TR1.js → render-nodes-B6j6Ip5I.js} +766 -731
  151. package/dist-library/{requirements-DhIkxAbl.js → requirements-C56sFIEs.js} +2 -2
  152. package/dist-library/{resources-B_nbROgj.js → resources-6VaNgk-h.js} +2 -2
  153. package/dist-library/rmd-pack-layout.css +9 -0
  154. package/dist-library/rmd-pack-resource-layout.css +9 -0
  155. package/dist-library/runtime-BHeuLOv_.js +1369 -0
  156. package/dist-library/{runtime-requirement-C4-vNcf5.js → runtime-requirement-DzPO8raU.js} +166 -163
  157. package/dist-library/{schema-core-4sd1Vu7V.js → schema-core-CDXfxdID.js} +24 -1
  158. package/dist-library/{sdk-core-BLsW9cCy.js → sdk-core-CnE-n0Z7.js} +469 -314
  159. package/dist-library/{session-core-DLBRPV7f.js → session-core-C071yQwV.js} +140 -127
  160. package/dist-library/{validation-XXlb-spV.js → sha256-utf16-Bmandi_H.js} +392 -315
  161. package/dist-library/shareable-CHCDnl6j.js +844 -0
  162. package/dist-library/types/authoring/catalog.d.ts +3 -1
  163. package/dist-library/types/authoring/index.d.ts +1 -1
  164. package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
  165. package/dist-library/types/components/chart/default-chart.d.ts +7 -0
  166. package/dist-library/types/components/entries/else.d.ts +3 -0
  167. package/dist-library/types/components/layout/layout.d.ts +5 -0
  168. package/dist-library/types/components/shared/visuals.d.ts +1 -1
  169. package/dist-library/types/components/table/data-table-model.d.ts +95 -2
  170. package/dist-library/types/components/table/data-table.d.ts +2 -2
  171. package/dist-library/types/contracts/component-kernel.d.ts +5 -0
  172. package/dist-library/types/contracts/font-aliases.d.ts +18 -0
  173. package/dist-library/types/contracts/number-literal.d.ts +2 -0
  174. package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
  175. package/dist-library/types/export/index.d.ts +4 -1
  176. package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
  177. package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
  178. package/dist-library/types/local/compilation/compiler-expressions.d.ts +12 -1
  179. package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
  180. package/dist-library/types/local/compilation/compiler-structure.d.ts +8 -2
  181. package/dist-library/types/local/compilation/compiler-tables.d.ts +1 -0
  182. package/dist-library/types/local/compilation/compiler-validation.d.ts +11 -0
  183. package/dist-library/types/local/compilation/compiler-values.d.ts +1 -2
  184. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +173 -2
  185. package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
  186. package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
  187. package/dist-library/types/local/evaluation/computations.d.ts +13 -5
  188. package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
  189. package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
  190. package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
  191. package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
  192. package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
  193. package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
  194. package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
  195. package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
  196. package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
  197. package/dist-library/types/local/evaluation/validation.d.ts +8 -6
  198. package/dist-library/types/local/index.d.ts +4 -3
  199. package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
  200. package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
  201. package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
  202. package/dist-library/types/local/runtime/runtime.d.ts +3 -1
  203. package/dist-library/types/local/runtime/state.d.ts +30 -15
  204. package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
  205. package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
  206. package/dist-library/types/local/source/authoring.d.ts +10 -0
  207. package/dist-library/types/local/source/source-migration.d.ts +1 -0
  208. package/dist-library/types/local/types.d.ts +33 -2
  209. package/dist-library/types/react/component-api.d.ts +21 -2
  210. package/dist-library/types/react/component-utils.d.ts +11 -0
  211. package/dist-library/types/react/font-aliases.d.ts +2 -0
  212. package/dist-library/types/react/package-core.d.ts +3 -0
  213. package/dist-library/types/react/rendering/document/validation-state.d.ts +1 -1
  214. package/dist-library/types/react/rendering/document/view-revision.d.ts +3 -12
  215. package/dist-library/types/react/rendering/table/data-table.d.ts +1 -1
  216. package/dist-library/types/react/sdk-core.d.ts +3 -1
  217. package/dist-library/types/sdk/assembly.d.ts +3 -0
  218. package/dist-library/types/sdk/font.d.ts +13 -0
  219. package/dist-library/types/sdk/index.d.ts +1 -0
  220. package/dist-library/types/sdk/theme.d.ts +5 -0
  221. package/dist-library/types/sdk/types.d.ts +6 -0
  222. package/dist-library/types/sdk/version.d.ts +1 -1
  223. package/dist-library/types/shareable.d.ts +15 -3
  224. package/dist-library/types/standalone/prepare.d.ts +4 -2
  225. package/dist-library/types/standalone/session-core.d.ts +4 -1
  226. package/dist-library/types/vite/index.d.ts +3 -0
  227. package/dist-library/types/vite/registration.d.ts +1 -0
  228. package/dist-library/{types-Bza88SGK.js → types-B4qG8J4S.js} +1 -1
  229. package/dist-library/types-FYhRWRn9.js +3 -0
  230. package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
  231. package/dist-library/validation-DRuW0Wl9.js +433 -0
  232. package/dist-library/{version-B0G1699c.js → version-4wzhbvDG.js} +1 -1
  233. package/dist-library/{visual-helpers-CRmaqCHX.js → visual-helpers-UU6xiL8g.js} +3 -3
  234. package/dist-library/visuals-7xzoL9ql.js +49340 -0
  235. package/dist-library/{worker-D6WMV8xJ.js → worker-3ldRjOEG.js} +9 -9
  236. package/dist-standalone/reactive-md-standalone.css +1 -1
  237. package/dist-standalone/reactive-md-standalone.js +128 -368
  238. package/docs/README-ch.md +3 -1
  239. package/docs/README.md +3 -1
  240. package/docs/compatibility/api-stability-ch.md +1 -1
  241. package/docs/compatibility/api-stability-en.md +1 -1
  242. package/docs/compatibility/compatibility-ch.md +15 -15
  243. package/docs/compatibility/compatibility-en.md +15 -15
  244. package/docs/compatibility/compatibility-manifest.schema.json +3 -2
  245. package/docs/compatibility/deprecation-ch.md +2 -2
  246. package/docs/compatibility/deprecation-en.md +2 -2
  247. package/docs/compatibility/source-versioning-ch.md +22 -14
  248. package/docs/compatibility/source-versioning-en.md +22 -13
  249. package/docs/compatibility/support-matrix-ch.md +4 -3
  250. package/docs/compatibility/support-matrix-en.md +4 -3
  251. package/docs/development/component-development-ch.md +2 -2
  252. package/docs/development/component-development-en.md +2 -2
  253. package/docs/development/component-protocol-ch.md +18 -18
  254. package/docs/development/component-protocol-en.md +14 -14
  255. package/docs/guides/local-guide-ch.md +109 -20
  256. package/docs/guides/local-guide-en.md +109 -20
  257. package/docs/integration/author-tools-ch.md +1 -1
  258. package/docs/integration/author-tools-en.md +1 -1
  259. package/docs/integration/editor-ch.md +3 -3
  260. package/docs/integration/editor-en.md +3 -3
  261. package/docs/integration/extension-sdk-ch.md +29 -3
  262. package/docs/integration/extension-sdk-en.md +29 -3
  263. package/docs/integration/local-integration-ch.md +3 -3
  264. package/docs/integration/local-integration-en.md +3 -3
  265. package/docs/integration/pdf-export-ch.md +42 -0
  266. package/docs/integration/pdf-export-en.md +42 -0
  267. package/docs/integration/shareable-export-ch.md +11 -19
  268. package/docs/integration/shareable-export-en.md +11 -19
  269. package/docs/reference/diagnostics-counting-ch.md +24 -1
  270. package/docs/reference/diagnostics-counting-en.md +24 -1
  271. package/docs/reference/local-interaction-syntax-ch.md +222 -33
  272. package/docs/reference/local-interaction-syntax-en.md +220 -31
  273. package/docs/reference/public-api-ch.md +24 -18
  274. package/docs/reference/public-api-en.md +24 -18
  275. package/docs/reference/theme-protocol-ch.md +1 -1
  276. package/docs/reference/theme-protocol-en.md +1 -1
  277. package/docs/releases/release-0.10.0-ch.md +45 -0
  278. package/docs/releases/release-0.10.0-en.md +45 -0
  279. package/examples/conformance/README-ch.md +3 -3
  280. package/examples/conformance/README.md +3 -3
  281. package/examples/conformance/local-draft-4.json +441 -0
  282. package/examples/integration/README-ch.md +3 -3
  283. package/examples/integration/README.md +3 -3
  284. package/examples/integration/chat-session/package.json +1 -1
  285. package/examples/local/README-ch.md +1 -1
  286. package/examples/local/README.md +1 -1
  287. package/package.json +6 -1
  288. package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +0 -143
  289. package/dist-library/authoring-B14SsOXZ.js +0 -893
  290. package/dist-library/compile-D50B5_Ww.js +0 -1249
  291. package/dist-library/computations-CffoW7Ff.js +0 -340
  292. package/dist-library/data-table-Kv_ZA2Z2.js +0 -297
  293. package/dist-library/default-options-DU5dxuU6.js +0 -125
  294. package/dist-library/layout-BfUzzO2b.js +0 -553
  295. package/dist-library/runtime-CuJndKqK.js +0 -1289
  296. package/dist-library/shareable-C6mUerpQ.js +0 -817
  297. package/dist-library/types-daDo2c_w.js +0 -3
  298. package/dist-library/use-hydrated-W-laKPhY.js +0 -22975
  299. package/dist-library/visuals-CoVSjVD8.js +0 -49159
@@ -1,48 +1,50 @@
1
- import { u as e } from "./document-theme-DBAfnk7y.js";
2
- import { O as t } from "./preset-core-BW3NWZJ9.js";
3
- import { i as n } from "./props-pJRrfDc6.js";
4
- import { s as r } from "./default-config-DIrRpuQz.js";
5
- import { r as i, t as a } from "./observability-core-Bcu7vpnl.js";
6
- import { S as o } from "./component-state-CwKX_SN5.js";
7
- import { i as s, n as c, o as l, s as u } from "./identity-BUx0Q_-d.js";
8
- import { t as d } from "./runtime-BDnnimPA.js";
9
- import { r as f } from "./requirements-DhIkxAbl.js";
10
- import p, { Component as m, createElement as h, useCallback as g, useEffect as _, useLayoutEffect as v, useRef as y, useSyncExternalStore as b } from "react";
11
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
1
+ import { u as e } from "./document-theme-CJvN-nC1.js";
2
+ import { a as t, d as n, i as r } from "./choice-values-BItGjPD2.js";
3
+ import { O as i } from "./preset-core-BKPbH_Nv.js";
4
+ import { i as a } from "./props-0iDqxlTk.js";
5
+ import { n as o } from "./conditional-branches-CIhJXasR.js";
6
+ import { s } from "./default-config-CCa8rm2k.js";
7
+ import { r as c, t as l } from "./observability-core-Bcu7vpnl.js";
8
+ import { S as u } from "./component-state-CwKX_SN5.js";
9
+ import { i as d, n as f, o as p, s as m } from "./identity-BUx0Q_-d.js";
10
+ import { t as h } from "./runtime-BDnnimPA.js";
11
+ import { r as g } from "./requirements-C56sFIEs.js";
12
+ import _, { Component as v, createElement as y, useCallback as b, useEffect as x, useLayoutEffect as ee, useRef as S, useSyncExternalStore as te } from "react";
13
+ import { Fragment as ne, jsx as C, jsxs as w } from "react/jsx-runtime";
12
14
  // src/react/component-api.tsx
13
- var w = Symbol("reactive-md.content-node");
15
+ var re = Symbol("reactive-md.content-node");
14
16
  function T(e) {
15
- return e[w];
17
+ return e[re];
16
18
  }
17
19
  function E(e, t) {
18
- return Object.defineProperty(e, w, {
20
+ return Object.defineProperty(e, re, {
19
21
  value: t,
20
22
  enumerable: !1,
21
23
  configurable: !1,
22
24
  writable: !1
23
25
  }), Object.freeze(e);
24
26
  }
25
- var D = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
26
- function O(e) {
27
+ var ie = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
28
+ function ae(e) {
27
29
  return e === null ? "" : typeof e == "string" ? e : typeof e == "number" ? Number.isFinite(e) ? String(e) : null : typeof e == "boolean" ? e ? "true" : "false" : null;
28
30
  }
29
- function k(e) {
31
+ function D(e) {
30
32
  if (!Number.isFinite(e)) return "—";
31
33
  if (Object.is(e, -0)) return "0";
32
34
  let t = Math.abs(e);
33
35
  return t >= 0xe8d4a51000 || t > 0 && t < 1e-4 ? e.toExponential(3).replace(/(\.\d*?)0+e/, "$1e").replace(/\.e/, "e") : Number(e.toFixed(6)).toString();
34
36
  }
35
- function A(e) {
37
+ function O(e) {
36
38
  return Array.isArray(e) ? Object.freeze(e.slice()) : e === void 0 ? null : e;
37
39
  }
38
- function j(e) {
40
+ function oe(e) {
39
41
  return Array.isArray(e) ? e.slice() : e;
40
42
  }
41
- function ee(e, t, r, i, a) {
43
+ function se(e, t, n, r, i) {
42
44
  try {
43
45
  return {
44
46
  ok: !0,
45
- value: n(e, t, r, i, a)
47
+ value: a(e, t, n, r, i)
46
48
  };
47
49
  } catch (e) {
48
50
  return {
@@ -51,16 +53,72 @@ function ee(e, t, r, i, a) {
51
53
  };
52
54
  }
53
55
  }
54
- var te = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap();
55
- function ne(e) {
56
- M.delete(ae(e));
56
+ var k = Object.freeze({
57
+ ok: !0,
58
+ value: null
59
+ }), ce = Object.freeze({
60
+ ok: !0,
61
+ value: !0
62
+ }), le = Object.freeze({
63
+ ok: !0,
64
+ value: !1
65
+ });
66
+ function A(e, t, n) {
67
+ return e?.type === "component" && e.name === t && n(t)?.id === `reactive-md/${t}`;
57
68
  }
58
- var N = /* @__PURE__ */ new WeakMap(), re = 4096, ie = 512;
59
- function ae(e) {
60
- let t = F.get(e);
61
- return t || (t = Object.freeze({}), F.set(e, t)), t;
69
+ function ue(e, t, n) {
70
+ let r = se(t, "when", e.attrs?.when, n, e.literalAttributes === !0 || e.macroLiteralAttrs?.includes("when") === !0);
71
+ return r.ok ? r.value === !0 ? ce : r.value === !1 ? le : r : r;
72
+ }
73
+ function j(e, t, n) {
74
+ let r = /* @__PURE__ */ new Map(), i = t("if"), a = t("else");
75
+ if (i?.id !== "reactive-md/if" || a?.id !== "reactive-md/else") return r;
76
+ for (let s = 0; s < e.length; s += 1) {
77
+ let c = e[s];
78
+ if (!A(c, "if", t)) continue;
79
+ let l = o(e, s);
80
+ if (!A(e[l], "else", t)) continue;
81
+ let u = [c];
82
+ for (; A(e[l], "else", t);) {
83
+ let t = e[l];
84
+ if (u.push(t), s = l, t.attrs?.when === void 0) break;
85
+ l = o(e, l);
86
+ }
87
+ let d;
88
+ u.forEach((e, t) => r.set(e, () => {
89
+ if (!d) {
90
+ let e = !0;
91
+ d = u.map((t, r) => {
92
+ if (!e) return {
93
+ condition: k,
94
+ selection: !1
95
+ };
96
+ if (r > 0 && t.attrs?.when === void 0) return {
97
+ condition: k,
98
+ selection: !0
99
+ };
100
+ let o = ue(t, r === 0 ? i : a, n), s = o.ok && typeof o.value == "boolean" ? o.value : null;
101
+ return e = s === !1, {
102
+ condition: o,
103
+ selection: s
104
+ };
105
+ });
106
+ }
107
+ return d[t];
108
+ }));
109
+ }
110
+ return r;
111
+ }
112
+ var de = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap();
113
+ function fe(e) {
114
+ M.delete(P(e));
115
+ }
116
+ var N = /* @__PURE__ */ new WeakMap(), pe = 4096, me = 512;
117
+ function P(e) {
118
+ let t = I.get(e);
119
+ return t || (t = Object.freeze({}), I.set(e, t)), t;
62
120
  }
63
- function oe(e, t, n) {
121
+ function he(e, t, n) {
64
122
  let { environment: r, node: i } = e, a = r.positionOf?.(i.range.start) ?? {
65
123
  line: 1,
66
124
  column: 1
@@ -77,7 +135,7 @@ function oe(e, t, n) {
77
135
  column: a.column
78
136
  };
79
137
  }
80
- function se(e, t, n) {
138
+ function ge(e, t, n) {
81
139
  if (n.length === 0) return;
82
140
  if (typeof window > "u") {
83
141
  e.report(n);
@@ -92,7 +150,7 @@ function se(e, t, n) {
92
150
  let i = r;
93
151
  i.report = e.report;
94
152
  for (let e of n) {
95
- if (i.diagnostics.length >= ie) break;
153
+ if (i.diagnostics.length >= me) break;
96
154
  i.diagnostics.push(e);
97
155
  }
98
156
  if (i.scheduled) return;
@@ -104,72 +162,98 @@ function se(e, t, n) {
104
162
  };
105
163
  typeof queueMicrotask == "function" ? queueMicrotask(a) : setTimeout(a, 0);
106
164
  }
107
- function ce(e, t, n, r) {
165
+ function _e(e, n, r, i, a) {
108
166
  if (!e) return {};
109
- let i = t ?? {}, a = {}, o = r?.environment.mode === "static" && typeof window > "u", s = r !== void 0, c = r ? ae(n) : null, l = null;
110
- if (r && c && s) {
111
- let e = o ? M : te;
112
- l = e.get(c) ?? null, l ? l.size > re && l.clear() : (l = /* @__PURE__ */ new Map(), e.set(c, l));
167
+ let o = n ?? {}, s = {}, c = i?.environment.mode === "static" && typeof window > "u", l = i !== void 0, u = i ? P(r) : null, d = null;
168
+ if (i && u && l) {
169
+ let e = c ? M : de;
170
+ d = e.get(u) ?? null, d ? d.size > pe && d.clear() : (d = /* @__PURE__ */ new Map(), e.set(u, d));
113
171
  }
114
- let u = [];
115
- for (let t of Object.keys(e.props)) {
116
- let o = Object.hasOwn(i, t) && typeof i[t] == "string" ? i[t] : void 0, s = ee(e, t, o, n, r?.node.literalAttributes === !0);
117
- if (s.ok) a[t] = s.value, r && l && l.delete(`${r.node.id}\u0000${t}`);
118
- else if (a[t] = null, r) {
119
- if (l) {
120
- let e = `${r.node.id}\u0000${t}`, n = `${o ?? ""}\u0000${s.error instanceof Error ? s.error.message : String(s.error)}`;
121
- if (l.get(e) === n) continue;
122
- l.set(e, n);
172
+ let f = [];
173
+ for (let n of Object.keys(e.props)) {
174
+ let c = Object.hasOwn(o, n) && typeof o[n] == "string" ? o[n] : void 0;
175
+ if (n === "options" && t(e) && c !== void 0) {
176
+ s[n] = z(e, c, r), i && d && d.delete(`${i.node.id}\u0000${n}`);
177
+ continue;
178
+ }
179
+ let l = n === "when" ? a : void 0;
180
+ if (typeof l == "function") {
181
+ let e;
182
+ Object.defineProperty(s, n, {
183
+ enumerable: !0,
184
+ get() {
185
+ let t = e ??= l();
186
+ return t.ok ? t.value : null;
187
+ }
188
+ });
189
+ continue;
190
+ }
191
+ let u = l ?? se(e, n, c, r, i?.node.literalAttributes === !0 || i?.node.macroLiteralAttrs?.includes(n) === !0);
192
+ if (u.ok) s[n] = u.value, i && d && d.delete(`${i.node.id}\u0000${n}`);
193
+ else if (s[n] = null, i) {
194
+ if (d) {
195
+ let e = `${i.node.id}\u0000${n}`, t = `${c ?? ""}\u0000${u.error instanceof Error ? u.error.message : String(u.error)}`;
196
+ if (d.get(e) === t) continue;
197
+ d.set(e, t);
123
198
  }
124
- u.push(oe(r, t, s.error));
199
+ f.push(he(i, n, u.error));
125
200
  }
126
201
  }
127
- return r && c && se(r.environment, c, u), a;
202
+ return i && u && ge(i.environment, u, f), s;
128
203
  }
129
- function le(e) {
204
+ function ve(e) {
130
205
  return e?.bindings ?? {};
131
206
  }
132
- function P(e, t, n, r) {
133
- let i = r.get(e);
134
- if (i) return i;
135
- let a = e.type === "component" || e.type === "hostComponent", o = a ? t.definitionFor(e.name ?? "") : void 0, s = Object.freeze(a ? ce(o, e.attrs, t.runtime, {
207
+ function F(e, t, n, r, i) {
208
+ let a = r.get(e);
209
+ if (a) return a;
210
+ let o = e.type === "component" || e.type === "hostComponent", s = o ? t.definitionFor(e.name ?? "") : void 0, c = Object.freeze(o ? _e(s, e.attrs, t.runtime, {
136
211
  environment: t,
137
212
  node: e
138
- }) : {}), c = (e.children ?? []).map((e) => P(e, t, n, r)), l = null;
139
- if (a) try {
140
- l = A(t.runtime.get(e));
213
+ }, i ?? (A(e, "else", t.definitionFor) ? k : void 0)) : {}), l = e.children ?? [], u = j(l, t.definitionFor, t.runtime), d = l.map((e) => {
214
+ let i = u.get(e);
215
+ return F(e, t, n, r, i ? () => i().condition : A(e, "if", t.definitionFor) ? () => ue(e, t.definitionFor("if"), t.runtime) : void 0);
216
+ }), f = null;
217
+ if (o) try {
218
+ f = O(t.runtime.get(e));
141
219
  } catch {
142
- l = null;
220
+ f = null;
143
221
  }
144
222
  else if (e.type === "interpolation") try {
145
- l = A(t.runtime.evaluate(e.value ?? ""));
223
+ f = O(t.runtime.evaluate(e.value ?? ""));
146
224
  } catch {
147
- l = null;
225
+ f = null;
148
226
  }
149
- let u = E({
227
+ let p = E({
150
228
  id: e.id,
151
- kind: a ? "component" : e.type,
152
- name: a ? e.name ?? "" : "",
153
- ...a && o ? { form: o.form } : {},
154
- props: s,
229
+ kind: o ? "component" : e.type,
230
+ name: o ? e.name ?? "" : "",
231
+ ...o && s ? { form: s.form } : {},
232
+ props: c,
155
233
  attrs: Object.freeze({ ...e.attrs ?? {} }),
156
- value: l,
234
+ value: f,
157
235
  text: typeof e.value == "string" ? e.value : "",
236
+ ...e.macroMathScope ? { macroMathScope: e.macroMathScope } : {},
158
237
  ...e.lang === void 0 ? e.type === "math" || e.type === "inlineMath" ? { format: e.type } : {} : { format: e.lang },
159
238
  visible: n,
160
- children: Object.freeze(c),
239
+ children: Object.freeze(d),
161
240
  range: Object.freeze({
162
241
  start: e.range.start,
163
242
  end: e.range.end
164
243
  })
165
244
  }, e);
166
- return r.set(e, u), u;
245
+ return r.set(e, p), p;
167
246
  }
168
- var F = /* @__PURE__ */ new WeakMap();
169
- function ue(e, t, n) {
170
- let r = t === "static", i = F.get(e);
171
- i || (i = Object.freeze({}), F.set(e, i));
172
- let a = T, o = (e) => (e.length > 0 && n(e), e), s = (e, t) => {
247
+ var I = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap();
248
+ function ye(e, t) {
249
+ if (n(t) !== void 0) {
250
+ let n = L.get(e)?.document?.computations?.[t];
251
+ if (n?.kind === "const" && Array.isArray(n.value)) return n.value;
252
+ }
253
+ return e.evaluate(t);
254
+ }
255
+ function be(e, t, n) {
256
+ let r = t === "static", i = P(e), a = T, o = (e) => (e.length > 0 && n(e), e), s = (e, t) => {
173
257
  let n = {
174
258
  start: e.range.start,
175
259
  end: e.range.end
@@ -182,16 +266,15 @@ function ue(e, t, n) {
182
266
  line: 1,
183
267
  column: 1
184
268
  }];
185
- };
186
- return Object.freeze({
269
+ }, c = Object.freeze({
187
270
  identity: i,
188
271
  get(t, n) {
189
- return A(e.get(a(t), n === "value" ? void 0 : n));
272
+ return O(e.get(a(t), n === "value" ? void 0 : n));
190
273
  },
191
274
  set(t, n, i) {
192
275
  if (r) return s(t, /* @__PURE__ */ Error("Runtime is read-only in static mode."));
193
276
  try {
194
- return o(e.set(a(t), j(n), i === "value" ? void 0 : i));
277
+ return o(e.set(a(t), oe(n), i === "value" ? void 0 : i));
195
278
  } catch (e) {
196
279
  return s(t, e);
197
280
  }
@@ -200,7 +283,7 @@ function ue(e, t, n) {
200
283
  if (r) return s(t, /* @__PURE__ */ Error("Runtime is read-only in static mode."));
201
284
  try {
202
285
  let r = {};
203
- for (let [e, t] of Object.entries(n)) r[e] = j(t);
286
+ for (let [e, t] of Object.entries(n)) r[e] = oe(t);
204
287
  return o(e.setMany(a(t), r));
205
288
  } catch (e) {
206
289
  return s(t, e);
@@ -219,12 +302,12 @@ function ue(e, t, n) {
219
302
  }
220
303
  },
221
304
  evaluate(t) {
222
- return A(e.evaluate(t));
305
+ return O(e.evaluate(t));
223
306
  },
224
307
  snapshot() {
225
308
  try {
226
309
  let t = e.snapshot(), n = {};
227
- for (let [e, r] of Object.entries(t.state)) n[e] = A(r);
310
+ for (let [e, r] of Object.entries(t.state)) n[e] = O(r);
228
311
  return {
229
312
  revision: t.revision,
230
313
  state: Object.freeze(n)
@@ -267,8 +350,9 @@ function ue(e, t, n) {
267
350
  }
268
351
  }
269
352
  });
353
+ return L.set(c, e), c;
270
354
  }
271
- function de(e, t, n, r) {
355
+ function xe(e, t, n, r) {
272
356
  return Object.freeze({
273
357
  get: () => {
274
358
  try {
@@ -290,28 +374,98 @@ function de(e, t, n, r) {
290
374
  }
291
375
  });
292
376
  }
293
- function fe(e, t) {
294
- let n = [], r = e.children, i = t.definitionFor(e.name), a = i?.rules?.find((e) => e.kind === "options-body"), o = a?.kind === "options-body" ? a.child : i?.structure?.child ?? "option", s = a?.kind === "options-body" ? a.valueAttribute : i?.structure?.valueAttribute ?? "value", c = 0;
295
- for (let i of r) {
296
- if (i.kind !== "component" || i.name !== o) continue;
297
- let r = T(i), a = i.attrs[s] ?? `option-${c + 1}`;
298
- c += 1;
299
- let l = t.renderToText(r.children) || i.attrs[s] || "";
300
- n.push(Object.freeze({
377
+ var Se = /^\s*\{\{([\s\S]*)\}\}\s*$/, R = Object.freeze({}), Ce = Object.freeze({});
378
+ function z(e, n, i) {
379
+ if (!t(e) || n === void 0) return null;
380
+ let a = Se.exec(n);
381
+ if (!a) return null;
382
+ let o;
383
+ try {
384
+ o = i.evaluate(a[1]);
385
+ } catch {
386
+ return null;
387
+ }
388
+ return r(o);
389
+ }
390
+ function we(e, t, n, r) {
391
+ let i = `${e.id}:option:${r}`, a = `${i}:text`, { start: o, end: s } = e.range, c = {
392
+ id: a,
393
+ type: "text",
394
+ value: n,
395
+ range: {
396
+ start: o,
397
+ end: s
398
+ }
399
+ }, l = E({
400
+ id: a,
401
+ kind: "text",
402
+ name: "",
403
+ props: R,
404
+ attrs: Ce,
405
+ value: null,
406
+ text: n,
407
+ visible: e.visible,
408
+ children: Object.freeze([]),
409
+ range: Object.freeze({
410
+ start: o,
411
+ end: s
412
+ })
413
+ }, c), u = {
414
+ id: i,
415
+ type: "component",
416
+ name: "option",
417
+ attrs: { value: n },
418
+ children: [c],
419
+ range: {
420
+ start: o,
421
+ end: s
422
+ }
423
+ }, d = E({
424
+ id: i,
425
+ kind: "component",
426
+ name: "option",
427
+ props: R,
428
+ attrs: Object.freeze({ value: n }),
429
+ value: null,
430
+ text: "",
431
+ visible: e.visible,
432
+ children: Object.freeze([l]),
433
+ range: Object.freeze({
434
+ start: o,
435
+ end: s
436
+ })
437
+ }, u);
438
+ return Object.freeze({
439
+ value: n,
440
+ content: d,
441
+ label: n,
442
+ render: () => t.renderInline(u.children, e.visible)
443
+ });
444
+ }
445
+ function Te(e, n) {
446
+ let r = n.definitionFor(e.name);
447
+ if (t(r) && e.attrs.options !== void 0) return (z(r, e.attrs.options, n.runtime) ?? []).map((t, r) => we(e, n, t, r));
448
+ let i = [], a = e.children, o = r?.rules?.find((e) => e.kind === "options-body"), s = o?.kind === "options-body" ? o.child : r?.structure?.child ?? "option", c = o?.kind === "options-body" ? o.valueAttribute : r?.structure?.valueAttribute ?? "value", l = 0;
449
+ for (let t of a) {
450
+ if (t.kind !== "component" || t.name !== s) continue;
451
+ let r = T(t), a = t.attrs[c] ?? `option-${l + 1}`;
452
+ l += 1;
453
+ let o = n.renderToText(r.children) || t.attrs[c] || "";
454
+ i.push(Object.freeze({
301
455
  value: a,
302
- content: i,
303
- label: l,
304
- render: () => t.renderInline(r.children, e.visible)
456
+ content: t,
457
+ label: o,
458
+ render: () => n.renderInline(r.children, e.visible)
305
459
  }));
306
460
  }
307
- return n;
461
+ return i;
308
462
  }
309
- function I(e, t) {
463
+ function B(e, t) {
310
464
  let n = e.children ?? [], r = n.filter((e) => !(e.type === "text" && !(e.value ?? "").trim())), i, a = "empty", o = "", s = null, c = null;
311
465
  if (r.length === 1 && r[0].type === "interpolation") try {
312
466
  i = t.runtime.evaluate(r[0].value ?? "");
313
- let e = O(i);
314
- i === null ? (a = "null", o = "") : typeof i == "string" ? (a = "string", o = i) : typeof i == "number" ? Number.isFinite(i) ? (a = "number", o = k(i), s = i) : (a = "error", o = t.locale === "zh" ? "无法计算" : "Cannot compute", c = t.locale === "zh" ? "结果不是有限数字" : "Result is not a finite number") : typeof i == "boolean" ? (a = "boolean", o = i ? "true" : "false") : (a = "array", o = e ?? "", c = t.locale === "zh" ? "数组需要先用 len 等函数转换" : "Arrays must first be converted with a function such as len");
467
+ let e = ae(i);
468
+ i === null ? (a = "null", o = "") : typeof i == "string" ? (a = "string", o = i) : typeof i == "number" ? Number.isFinite(i) ? (a = "number", o = D(i), s = i) : (a = "error", o = t.locale === "zh" ? "无法计算" : "Cannot compute", c = t.locale === "zh" ? "结果不是有限数字" : "Result is not a finite number") : typeof i == "boolean" ? (a = "boolean", o = i ? "true" : "false") : (a = "array", o = e ?? "", c = t.locale === "zh" ? "数组需要先用 len 等函数转换" : "Arrays must first be converted with a function such as len");
315
469
  } catch (e) {
316
470
  a = "error", o = t.locale === "zh" ? "无法计算" : "Cannot compute", c = e instanceof Error ? e.message : String(e);
317
471
  }
@@ -319,7 +473,7 @@ function I(e, t) {
319
473
  let e = "", l = null, u = (n) => {
320
474
  for (let r of n ?? []) if (r.type === "text" || r.type === "inlineCode" || r.type === "code") e += r.value ?? "";
321
475
  else if (r.type === "interpolation") try {
322
- let n = O(t.runtime.evaluate(r.value ?? ""));
476
+ let n = ae(t.runtime.evaluate(r.value ?? ""));
323
477
  n === null ? l ??= t.locale === "zh" ? "数组需要先用 len 等函数转换" : "Arrays must first be converted with a function such as len" : e += n;
324
478
  } catch (n) {
325
479
  l ??= n instanceof Error ? n.message : String(n), e += t.locale === "zh" ? "无法计算" : "Cannot compute";
@@ -328,7 +482,7 @@ function I(e, t) {
328
482
  };
329
483
  u(n);
330
484
  let d = r.length > 0 && r.every((e) => e.type === "text"), f = e.trim();
331
- if (d && D.test(f)) {
485
+ if (d && ie.test(f)) {
332
486
  let t = Number(f);
333
487
  Number.isFinite(t) && (a = "number", o = e, s = t, i = t);
334
488
  }
@@ -343,118 +497,118 @@ function I(e, t) {
343
497
  render: () => t.renderInline(n, !0)
344
498
  });
345
499
  }
346
- function pe(e, t) {
500
+ function Ee(e, t) {
347
501
  let n = e.children.find((e) => e.kind === "table");
348
502
  if (!n) return null;
349
503
  let r = (T(n).children ?? []).filter((e) => e.type === "tableRow");
350
504
  if (r.length === 0) return null;
351
- let i = (r[0].children ?? []).map((e) => I(e, t));
505
+ let i = (r[0].children ?? []).map((e) => B(e, t));
352
506
  return Object.freeze({
353
507
  header: Object.freeze(i),
354
508
  headerText: Object.freeze(i.map((e) => e.error ? t.locale === "zh" ? "无法计算" : "Cannot compute" : e.text)),
355
509
  rows: Object.freeze(r.slice(1).map((e, n) => Object.freeze({
356
510
  index: n,
357
- cells: Object.freeze((e.children ?? []).map((e) => I(e, t)))
511
+ cells: Object.freeze((e.children ?? []).map((e) => B(e, t)))
358
512
  })))
359
513
  });
360
514
  }
361
- function me(e, t) {
515
+ function De(e, t) {
362
516
  let n = e["state-key"];
363
- return l(typeof n == "string" ? n : t["state-key"]);
517
+ return p(typeof n == "string" ? n : t["state-key"]);
364
518
  }
365
- function he(e) {
519
+ function Oe(e) {
366
520
  try {
367
521
  return e.document.source;
368
522
  } catch {
369
523
  return "";
370
524
  }
371
525
  }
372
- var L = /* @__PURE__ */ new WeakMap();
373
- function ge(e) {
526
+ var V = /* @__PURE__ */ new WeakMap();
527
+ function ke(e) {
374
528
  if (e.services !== void 0) return e.services;
375
- let t = L.get(e);
376
- return t === void 0 && (t = d({ sourceDigest: s(he(e)) }), L.set(e, t)), t;
529
+ let t = V.get(e);
530
+ return t === void 0 && (t = h({ sourceDigest: d(Oe(e)) }), V.set(e, t)), t;
377
531
  }
378
- function _e(e, t) {
379
- let n = t.definitionFor(e.name ?? ""), r = /* @__PURE__ */ new Map(), i = P(e, t, t.visible, r), a = ue(t.runtime, t.mode, t.report), s = t.services ?? ge(t.runtime), l = n?.id ?? e.name ?? e.type, d = me(i.props, i.attrs), f = null, p = () => (f === null && (f = s.state.handle({
532
+ function Ae(e, t, n) {
533
+ let r = t.definitionFor(e.name ?? ""), i = /* @__PURE__ */ new Map(), a = F(e, t, t.visible, i, n), o = be(t.runtime, t.mode, t.report), s = t.services ?? ke(t.runtime), c = r?.id ?? e.name ?? e.type, l = De(a.props, a.attrs), d = null, p = () => (d === null && (d = s.state.handle({
380
534
  nodeId: e.id,
381
- component: l,
382
- componentVersion: n?.version ?? "0.0.0",
383
- stateKey: d,
535
+ component: c,
536
+ componentVersion: r?.version ?? "0.0.0",
537
+ stateKey: l,
384
538
  stateVersion: 0
385
- })), f), m = typeof i.props.seed == "number" && Number.isFinite(i.props.seed) ? i.props.seed : void 0, h = u({
386
- explicitSeed: m,
539
+ })), d), h = typeof a.props.seed == "number" && Number.isFinite(a.props.seed) ? a.props.seed : void 0, g = m({
540
+ explicitSeed: h,
387
541
  documentSeed: s.randomSeed,
388
- componentId: l,
542
+ componentId: c,
389
543
  nodeId: e.id,
390
- stateKey: d
391
- }), g = Object.freeze({
392
- network: t.mode === "static" ? o : t.network ?? t.runtime.network ?? o,
544
+ stateKey: l
545
+ }), _ = Object.freeze({
546
+ network: t.mode === "static" ? u : t.network ?? t.runtime.network ?? u,
393
547
  random: Object.freeze({
394
- seed: h,
395
- derive: (e) => c(h, e)
548
+ seed: g,
549
+ derive: (e) => f(g, e)
396
550
  }),
397
551
  clock: s.clock,
398
552
  scheduler: s.scheduler,
399
553
  get state() {
400
554
  return p();
401
555
  }
402
- }), _ = t.mode === "static", v = le(n), y = {};
403
- for (let e of Object.keys(v)) y[e] = de(a, i, e, _);
404
- let b = y.value ?? Object.freeze({
556
+ }), v = t.mode === "static", y = ve(r), b = {};
557
+ for (let e of Object.keys(y)) b[e] = xe(o, a, e, v);
558
+ let x = b.value ?? Object.freeze({
405
559
  get: () => null,
406
560
  set: () => ({
407
561
  ok: !1,
408
562
  diagnostics: []
409
563
  })
410
- }), x = Object.freeze({
564
+ }), ee = Object.freeze({
411
565
  render: () => t.renderChildren(e.children, t.visible),
412
566
  inline: () => t.renderInline(e.children, t.visible),
413
567
  text: () => t.renderToText(e.children),
414
- items: () => i.children,
568
+ items: () => a.children,
415
569
  renderItems: (e, n) => t.renderChildren(e.map((e) => T(e)), n ?? t.visible),
416
570
  renderInlineItems: (e, n) => t.renderInline(e.map((e) => T(e)), n ?? t.visible),
417
571
  textOf: (e) => t.renderToText(e.map((e) => T(e))),
418
- options: () => fe(i, t),
419
- table: () => pe(i, t),
420
- math: () => i.children.filter((e) => e.kind === "math" || e.kind === "inlineMath")
572
+ options: () => Te(a, t),
573
+ table: () => Ee(a, t),
574
+ math: () => a.children.filter((e) => e.kind === "math" || e.kind === "inlineMath")
421
575
  }), S = Object.freeze({
422
- value: b,
423
- slots: Object.freeze(y),
424
- isReadOnly: _,
576
+ value: x,
577
+ slots: Object.freeze(b),
578
+ isReadOnly: v,
425
579
  get(e = "value") {
426
- let t = y[e];
580
+ let t = b[e];
427
581
  return t ? t.get() : null;
428
582
  },
429
583
  set(e, t) {
430
- let n = y[e];
584
+ let n = b[e];
431
585
  return n ? n.set(t) : {
432
586
  ok: !1,
433
587
  diagnostics: [{
434
588
  code: "local.extension.binding",
435
- message: `Component <${i.name || i.id}> has no binding slot "${e}".`,
589
+ message: `Component <${a.name || a.id}> has no binding slot "${e}".`,
436
590
  severity: "error",
437
- range: i.range,
591
+ range: a.range,
438
592
  line: 1,
439
593
  column: 1
440
594
  }]
441
595
  };
442
596
  },
443
597
  setMany(e) {
444
- if (_) return {
598
+ if (v) return {
445
599
  ok: !1,
446
600
  diagnostics: []
447
601
  };
448
- let t = a.setMany(i, e);
602
+ let t = o.setMany(a, e);
449
603
  return {
450
604
  ok: t.length === 0,
451
605
  diagnostics: t
452
606
  };
453
607
  }
454
- }), C = Object.freeze({
608
+ }), te = Object.freeze({
455
609
  fieldFor: (e) => t.validationFieldFor(T(e)),
456
610
  hintFor: (e) => t.validationHintFor(T(e))
457
- }), w = Object.freeze({
611
+ }), ne = Object.freeze({
458
612
  targetId: (e) => t.targetId(e),
459
613
  anchorId: () => t.anchorId(e),
460
614
  allowed: (e) => t.jumpAllowed(e),
@@ -462,7 +616,7 @@ function _e(e, t) {
462
616
  let n = t.targetId(e);
463
617
  return n === void 0 ? "missing" : t.jumpTo(n);
464
618
  }
465
- }), E = Object.freeze({
619
+ }), C = Object.freeze({
466
620
  resolve(e, n) {
467
621
  if (!e) return null;
468
622
  let r = e.trim();
@@ -480,7 +634,7 @@ function _e(e, t) {
480
634
  }
481
635
  },
482
636
  image(e) {
483
- let n = E.resolve(e, "image");
637
+ let n = C.resolve(e, "image");
484
638
  if (!n) return null;
485
639
  if (!t.imageResolver) return n;
486
640
  try {
@@ -490,24 +644,24 @@ function _e(e, t) {
490
644
  return null;
491
645
  }
492
646
  }
493
- }), D = Object.freeze({
647
+ }), w = Object.freeze({
494
648
  locale: t.locale,
495
649
  t: (e, n) => t.locale === "zh" ? n : e,
496
- formatNumber: k
650
+ formatNumber: D
497
651
  });
498
652
  return Object.freeze({
499
- props: i.props,
653
+ props: a.props,
500
654
  authorStyle: t.authorStyle,
501
655
  authorStyleText: t.authorStyleText,
502
656
  dispatchAuthorAction: t.dispatchAuthorAction,
503
- content: i,
504
- services: g,
657
+ content: a,
658
+ services: _,
505
659
  bindings: S,
506
- children: x,
507
- runtime: a,
660
+ children: ee,
661
+ runtime: o,
508
662
  instance: Object.freeze({
509
663
  id: e.id,
510
- componentId: n?.id ?? e.name ?? "",
664
+ componentId: r?.id ?? e.name ?? "",
511
665
  range: Object.freeze({
512
666
  start: e.range.start,
513
667
  end: e.range.end
@@ -518,26 +672,26 @@ function _e(e, t) {
518
672
  disabled: t.disabled,
519
673
  disabledInvalid: t.disabledInvalid,
520
674
  resetToken: t.resetToken,
521
- validation: C,
675
+ validation: te,
522
676
  source: Object.freeze({ attributes: (n) => t.sourceAttributes(n ? T(n) : e, e.name) }),
523
- navigation: w,
524
- url: E,
525
- locale: D,
677
+ navigation: ne,
678
+ url: C,
679
+ locale: w,
526
680
  report: t.report
527
681
  });
528
682
  }
529
- var ve = [
683
+ var je = [
530
684
  "interactive",
531
685
  "static",
532
686
  "ssr",
533
687
  "offline"
534
688
  ];
535
- function ye(e) {
689
+ function Me(e) {
536
690
  let t = e.capabilities;
537
691
  if (t === void 0) return;
538
692
  if (typeof t != "object" || !t || Array.isArray(t)) throw TypeError("Component capabilities must be an object.");
539
693
  let n = {};
540
- for (let e of ve) {
694
+ for (let e of je) {
541
695
  let r = t[e];
542
696
  if (r !== void 0) {
543
697
  if (typeof r != "boolean") throw TypeError(`Component capability "${e}" must be a boolean.`);
@@ -546,7 +700,7 @@ function ye(e) {
546
700
  }
547
701
  return n;
548
702
  }
549
- function be(e, t, n) {
703
+ function Ne(e, t, n) {
550
704
  if (t) {
551
705
  if (typeof n.render != "function") throw TypeError("defineReactComponent requires a render function.");
552
706
  if (n.renderStatic !== void 0 && typeof n.renderStatic != "function") throw TypeError("defineReactComponent renderStatic must be a function.");
@@ -555,30 +709,30 @@ function be(e, t, n) {
555
709
  if (t.interactive === !1 && t.offline === !0 && t.static !== !0) throw TypeError(`Component "${e.id ?? ""}" declares offline output without any renderable implementation.`);
556
710
  }
557
711
  }
558
- function xe(e) {
712
+ function Pe(e) {
559
713
  if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("defineReactComponent requires a component definition object.");
560
714
  return e;
561
715
  }
562
- function R(e, n) {
563
- let r = xe(e);
564
- if (!n || typeof n != "object") throw TypeError("defineReactComponent requires an implementation object.");
565
- be(r, ye(r), n);
566
- let i;
716
+ function H(e, t) {
717
+ let n = Pe(e);
718
+ if (!t || typeof t != "object") throw TypeError("defineReactComponent requires an implementation object.");
719
+ Ne(n, Me(n), t);
720
+ let r;
567
721
  try {
568
- i = t(r);
722
+ r = i(n);
569
723
  } catch (e) {
570
- throw TypeError(`Cannot bind a React implementation to component "${r.id}": ${e instanceof Error ? e.message : String(e)}`);
724
+ throw TypeError(`Cannot bind a React implementation to component "${n.id}": ${e instanceof Error ? e.message : String(e)}`);
571
725
  }
572
726
  return Object.freeze({
573
- definition: r,
574
- digest: i,
575
- render: n.render,
576
- ...n.renderStatic === void 0 ? {} : { renderStatic: n.renderStatic }
727
+ definition: n,
728
+ digest: r,
729
+ render: t.render,
730
+ ...t.renderStatic === void 0 ? {} : { renderStatic: t.renderStatic }
577
731
  });
578
732
  }
579
733
  // src/react/component-loader.ts
580
- var z = Object.freeze({ status: "loading" }), B = Object.freeze({ status: "failed" }), V = () => globalThis.performance?.now() ?? Date.now(), Se = (e) => Math.max(0, Math.round(V() - e));
581
- function H(e, t) {
734
+ var U = Object.freeze({ status: "loading" }), W = Object.freeze({ status: "failed" }), G = () => globalThis.performance?.now() ?? Date.now(), Fe = (e) => Math.max(0, Math.round(G() - e));
735
+ function Ie(e, t) {
582
736
  return JSON.stringify([
583
737
  e.traceId ?? t,
584
738
  e.documentId,
@@ -586,7 +740,7 @@ function H(e, t) {
586
740
  e.sourcePhase
587
741
  ]);
588
742
  }
589
- var U = class {
743
+ var Le = class {
590
744
  resolver;
591
745
  identityFor;
592
746
  validate;
@@ -600,22 +754,22 @@ var U = class {
600
754
  return t || (t = this.identityFor(e), this.identities.set(e, t)), t;
601
755
  }
602
756
  snapshot(e) {
603
- return this.entries.get(this.identity(e))?.state ?? z;
757
+ return this.entries.get(this.identity(e))?.state ?? U;
604
758
  }
605
759
  serverSnapshot() {
606
- return z;
760
+ return U;
607
761
  }
608
762
  subscribe(e, t, n) {
609
763
  let r = this.identity(e), i = n?.observer?.onTrace ? n : void 0, a = this.entries.get(r);
610
764
  a ? (a.subscribers.set(t, i), a.abort && i && this.observeWait(e, a, t, i), a.observation && (a.observation.peakSubscribers = Math.max(a.observation.peakSubscribers, a.subscribers.size))) : (a = {
611
- state: z,
765
+ state: U,
612
766
  subscribers: /* @__PURE__ */ new Map([[t, i]])
613
767
  }, this.entries.set(r, a), this.start(r, e, a));
614
768
  let o = a;
615
769
  return () => {
616
770
  let e = o.observation, n = i?.observer;
617
771
  if (e && n) {
618
- let r = e.waits.get(n), a = H(i, e.id), s = r?.get(a);
772
+ let r = e.waits.get(n), a = Ie(i, e.id), s = r?.get(a);
619
773
  r && s?.subscribers.delete(t) && !s.subscribers.size && queueMicrotask(() => {
620
774
  o.observation !== e || s.subscribers.size || r.get(a) !== s || (r.delete(a), r.size || e.waits.delete(n), s.finish("cancelled"));
621
775
  });
@@ -633,31 +787,31 @@ var U = class {
633
787
  }
634
788
  }
635
789
  observeWait(e, t, n, r) {
636
- let o = r.observer, s = t.observation ??= {
637
- id: a(),
790
+ let i = r.observer, a = t.observation ??= {
791
+ id: l(),
638
792
  peakSubscribers: t.subscribers.size,
639
793
  waits: /* @__PURE__ */ new Map()
640
- }, c = s.waits.get(o);
641
- c || (c = /* @__PURE__ */ new Map(), s.waits.set(o, c));
642
- let l = H(r, s.id), u = c.get(l);
794
+ }, o = a.waits.get(i);
795
+ o || (o = /* @__PURE__ */ new Map(), a.waits.set(i, o));
796
+ let s = Ie(r, a.id), u = o.get(s);
643
797
  if (!u) {
644
- let { traceId: t = s.id, documentId: n, sourceRevision: a, sourcePhase: d } = r, f = V();
798
+ let { traceId: t = a.id, documentId: n, sourceRevision: l, sourcePhase: d } = r, f = G();
645
799
  u = {
646
800
  subscribers: /* @__PURE__ */ new Set(),
647
- finish: (r) => i(o, {
801
+ finish: (r) => c(i, {
648
802
  type: "component-load-wait-end",
649
803
  traceId: t,
650
804
  documentId: n,
651
- sourceRevision: a,
805
+ sourceRevision: l,
652
806
  sourcePhase: d,
653
- loadId: s.id,
807
+ loadId: a.id,
654
808
  timestamp: Date.now(),
655
809
  status: r,
656
810
  componentName: e.name,
657
811
  componentVersion: e.version,
658
- durationMs: Se(f)
812
+ durationMs: Fe(f)
659
813
  })
660
- }, c.set(l, u);
814
+ }, o.set(s, u);
661
815
  }
662
816
  u.subscribers.add(n);
663
817
  }
@@ -666,44 +820,44 @@ var U = class {
666
820
  if (e.observation = void 0, n?.finishRequest?.(t), n) for (let e of n.waits.values()) for (let n of e.values()) n.finish(n.subscribers.size ? t : "cancelled");
667
821
  }
668
822
  start(e, t, n, r) {
669
- let a = new AbortController();
670
- n.abort = a, n.state = z;
823
+ let i = new AbortController();
824
+ n.abort = i, n.state = U;
671
825
  for (let [e, r] of n.subscribers) r && this.observeWait(t, n, e, r);
672
- let o = (t) => {
673
- if (this.entries.get(e) === n && n.abort === a) {
826
+ let a = (t) => {
827
+ if (this.entries.get(e) === n && n.abort === i) {
674
828
  n.abort = void 0, n.state = t, this.finishObservation(n, t.status === "ready" ? "ok" : "failed");
675
829
  for (let e of n.subscribers.keys()) e();
676
830
  }
677
831
  };
678
832
  Promise.resolve().then(() => {
679
- if (a.signal.aborted || !n.subscribers.size) return null;
833
+ if (i.signal.aborted || !n.subscribers.size) return null;
680
834
  let e = n.observation;
681
835
  if (e) {
682
- let a = r?.observer?.onTrace ? r : void 0;
683
- if (!a) {
836
+ let i = r?.observer?.onTrace ? r : void 0;
837
+ if (!i) {
684
838
  for (let e of n.subscribers.values()) if (e?.observer?.onTrace) {
685
- a = e;
839
+ i = e;
686
840
  break;
687
841
  }
688
842
  }
689
- if (a?.observer) {
690
- let { observer: n, traceId: r = e.id, documentId: o, sourceRevision: s, sourcePhase: c } = a, l = {
843
+ if (i?.observer) {
844
+ let { observer: n, traceId: r = e.id, documentId: a, sourceRevision: o, sourcePhase: s } = i, l = {
691
845
  traceId: r,
692
- documentId: o,
693
- sourceRevision: s,
694
- sourcePhase: c,
846
+ documentId: a,
847
+ sourceRevision: o,
848
+ sourcePhase: s,
695
849
  loadId: e.id,
696
850
  componentName: t.name,
697
851
  componentVersion: t.version
698
- }, u = V();
699
- e.finishRequest = (t) => i(n, {
852
+ }, u = G();
853
+ e.finishRequest = (t) => c(n, {
700
854
  ...l,
701
855
  type: "component-load-end",
702
856
  timestamp: Date.now(),
703
857
  status: t,
704
858
  subscribers: e.peakSubscribers,
705
- durationMs: Se(u)
706
- }), i(n, {
859
+ durationMs: Fe(u)
860
+ }), c(n, {
707
861
  ...l,
708
862
  type: "component-load-start",
709
863
  timestamp: Date.now()
@@ -713,25 +867,25 @@ var U = class {
713
867
  return this.resolver({
714
868
  name: t.name,
715
869
  definition: t,
716
- signal: a.signal
870
+ signal: i.signal
717
871
  });
718
872
  }).then((e) => {
719
- if (!e || a.signal.aborted) {
720
- o(B);
873
+ if (!e || i.signal.aborted) {
874
+ a(W);
721
875
  return;
722
876
  }
723
877
  let n = this.validate(t, e);
724
- o(n === null ? B : {
878
+ a(n === null ? W : {
725
879
  status: "ready",
726
880
  component: n
727
881
  });
728
- }).catch(() => o(B));
882
+ }).catch(() => a(W));
729
883
  }
730
- }, Ce = class extends U {
884
+ }, Re = class extends Le {
731
885
  resolveSync;
732
886
  synchronous = /* @__PURE__ */ new WeakMap();
733
- constructor(e, n) {
734
- super(e, (e) => `${e.id}\0${e.version}\0${t(e)}`, W), this.resolveSync = n;
887
+ constructor(e, t) {
888
+ super(e, (e) => `${e.id}\0${e.version}\0${i(e)}`, ze), this.resolveSync = t;
735
889
  }
736
890
  synchronousImplementation(e) {
737
891
  if (!this.resolveSync) return null;
@@ -743,49 +897,49 @@ var U = class {
743
897
  name: e.name,
744
898
  definition: e
745
899
  });
746
- t && (n = W(e, t));
900
+ t && (n = ze(e, t));
747
901
  } catch {}
748
902
  return this.synchronous.set(e, n), n;
749
903
  }
750
904
  };
751
- function W(e, n) {
752
- let r = t(e);
753
- return n.digest === r && t(n.definition) === r ? R(e, n) : null;
905
+ function ze(e, t) {
906
+ let n = i(e);
907
+ return t.digest === n && i(t.definition) === n ? H(e, t) : null;
754
908
  }
755
909
  // src/react/render-lifecycle.tsx
756
- var G = () => globalThis.performance?.now() ?? Date.now(), K = (e, t) => Math.max(0, Math.round(t - e));
757
- function q({ trace: e, component: t }) {
758
- let n = y(e);
910
+ var K = () => globalThis.performance?.now() ?? Date.now(), q = (e, t) => Math.max(0, Math.round(t - e));
911
+ function Be({ trace: e, component: t }) {
912
+ let n = S(e);
759
913
  n.current = e;
760
- let r = e.observer?.onTrace ? G() : void 0, o = y(e.sourcePhase), s = y(void 0), c = y(void 0);
761
- return v(() => {
914
+ let r = e.observer?.onTrace ? K() : void 0, i = S(e.sourcePhase), a = S(void 0), o = S(void 0);
915
+ return ee(() => {
762
916
  if (e.observer?.onTrace) return () => {
763
- c.current = G();
917
+ o.current = K();
764
918
  };
765
- }, [e.observer, t]), _(() => {
919
+ }, [e.observer, t]), x(() => {
766
920
  let e = n.current;
767
921
  if (!e.observer?.onTrace || r === void 0) return;
768
- let o = e.traceId ?? a();
769
- s.current = o;
770
- let l = typeof p.captureOwnerStack == "function" ? "development" : "production", u = G(), d = {
771
- traceId: o,
772
- environment: l,
922
+ let i = e.traceId ?? l();
923
+ a.current = i;
924
+ let s = typeof _.captureOwnerStack == "function" ? "development" : "production", u = K(), d = {
925
+ traceId: i,
926
+ environment: s,
773
927
  componentName: t?.name,
774
928
  componentVersion: t?.version
775
929
  };
776
- return i(e.observer, {
930
+ return c(e.observer, {
777
931
  ...d,
778
932
  type: "render-mount",
779
933
  timestamp: Date.now(),
780
934
  documentId: e.documentId,
781
935
  sourceRevision: e.sourceRevision,
782
936
  sourcePhase: e.sourcePhase,
783
- durationMs: K(r, u)
937
+ durationMs: q(r, u)
784
938
  }), () => {
785
- let t = n.current, r = G(), a = K(u, r), s = c.current === void 0 ? void 0 : K(c.current, r);
786
- c.current = void 0, i(e.observer, {
939
+ let t = n.current, r = K(), a = q(u, r), s = o.current === void 0 ? void 0 : q(o.current, r);
940
+ o.current = void 0, c(e.observer, {
787
941
  ...d,
788
- traceId: t.traceId ?? o,
942
+ traceId: t.traceId ?? i,
789
943
  type: "render-unmount",
790
944
  timestamp: Date.now(),
791
945
  mountedMs: a,
@@ -796,13 +950,13 @@ function q({ trace: e, component: t }) {
796
950
  sourcePhase: t.sourcePhase
797
951
  });
798
952
  };
799
- }, [e.observer, t]), _(() => {
800
- let n = o.current;
801
- o.current = e.sourcePhase, n === "streaming" && e.sourcePhase === "final" && e.observer?.onTrace && i(e.observer, {
953
+ }, [e.observer, t]), x(() => {
954
+ let n = i.current;
955
+ i.current = e.sourcePhase, n === "streaming" && e.sourcePhase === "final" && e.observer?.onTrace && c(e.observer, {
802
956
  type: "render-retained",
803
- traceId: e.traceId ?? s.current ?? a(),
957
+ traceId: e.traceId ?? a.current ?? l(),
804
958
  timestamp: Date.now(),
805
- environment: typeof p.captureOwnerStack == "function" ? "development" : "production",
959
+ environment: typeof _.captureOwnerStack == "function" ? "development" : "production",
806
960
  documentId: e.documentId,
807
961
  sourceRevision: e.sourceRevision,
808
962
  sourcePhase: e.sourcePhase,
@@ -812,12 +966,12 @@ function q({ trace: e, component: t }) {
812
966
  }, [e, t]), null;
813
967
  }
814
968
  // src/react/sdk-core.tsx
815
- function we(e) {
969
+ function Ve(e) {
816
970
  if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("defineReactComponent requires a component definition object.");
817
971
  return e;
818
972
  }
819
973
  var J = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap();
820
- function Te(e) {
974
+ function He(e) {
821
975
  let t = J.get(e);
822
976
  if (t) return t;
823
977
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
@@ -828,7 +982,7 @@ function Te(e) {
828
982
  });
829
983
  return J.set(e, i), i;
830
984
  }
831
- function Ee(e) {
985
+ function Ue(e) {
832
986
  if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("createReactConfig components must be LocalReactComponent values.");
833
987
  let t = e;
834
988
  if (!t.definition || typeof t.definition != "object") throw TypeError("A React component is missing its manifest definition.");
@@ -836,17 +990,17 @@ function Ee(e) {
836
990
  if (t.renderStatic !== void 0 && typeof t.renderStatic != "function") throw TypeError("A React component renderStatic must be a function.");
837
991
  return t;
838
992
  }
839
- function X(e, n, i, a) {
840
- let o = r(e), s = n?.components;
841
- if (!Array.isArray(s)) throw TypeError("createReactConfig requires a components array.");
842
- let c = n?.presets ?? [];
993
+ function We(e, t, n, r) {
994
+ let a = s(e), o = t?.components;
995
+ if (!Array.isArray(o)) throw TypeError("createReactConfig requires a components array.");
996
+ let c = t?.presets ?? [];
843
997
  if (!Array.isArray(c)) throw TypeError("createReactConfig presets must be an array.");
844
- let l = [], u = [], d = /* @__PURE__ */ new Set(), f = (e, n) => {
845
- let r = Ee(e), i = we(r.definition), a = t(i);
846
- if (r.digest !== a) throw TypeError(`React component "${i.id}" from ${n} has a stale digest; create it with defineReactComponent.`);
847
- return l.push(r), r;
998
+ let l = [], u = [], d = /* @__PURE__ */ new Set(), f = (e, t) => {
999
+ let n = Ue(e), r = Ve(n.definition), a = i(r);
1000
+ if (n.digest !== a) throw TypeError(`React component "${r.id}" from ${t} has a stale digest; create it with defineReactComponent.`);
1001
+ return l.push(n), n;
848
1002
  };
849
- for (let e of i) {
1003
+ for (let e of n) {
850
1004
  let t = f(e, "the default React preset");
851
1005
  d.add(t);
852
1006
  }
@@ -854,56 +1008,57 @@ function X(e, n, i, a) {
854
1008
  if (!e || typeof e != "object" || !Array.isArray(e.components)) throw TypeError("createReactConfig preset must expose a components array.");
855
1009
  for (let t of e.components) u.push(f(t, `preset "${e.id ?? ""}"`));
856
1010
  }
857
- for (let e of s) u.push(f(e, "components"));
1011
+ for (let e of o) u.push(f(e, "components"));
858
1012
  let p = [], m = [], h = /* @__PURE__ */ new Map();
859
- for (let e of o.registry) {
860
- let n = t(e), r = l.filter((t) => t.definition.id === e.id && t.definition.name === e.name && t.definition.version === e.version && t.digest === n);
861
- if (r.length === 0) {
1013
+ for (let e of a.registry) {
1014
+ let t = i(e), n = l.filter((n) => n.definition.id === e.id && n.definition.name === e.name && n.definition.version === e.version && n.digest === t);
1015
+ if (n.length === 0) {
862
1016
  if (l.some((t) => t.definition.id === e.id)) throw TypeError(`React component "${e.id}@${e.version}" does not match the installed manifest contract.`);
863
- a ? h.set(e.name, e) : m.push(`${e.id}@${e.version}`);
864
- } else {
865
- if (r.length > 1) throw TypeError(`Component id "${e.id}" has more than one matching React implementation.`);
866
- p.push(r[0]);
1017
+ r ? h.set(e.name, e) : m.push(`${e.id}@${e.version}`);
1018
+ continue;
867
1019
  }
1020
+ let a = e.id === "reactive-md/column" && n.every((e) => e.render === n[0].render && e.renderStatic === n[0].renderStatic);
1021
+ if (n.length > 1 && !a) throw TypeError(`Component id "${e.id}" has more than one matching React implementation.`);
1022
+ p.push(n[0]);
868
1023
  }
869
1024
  if (m.length > 0) {
870
- let e = new Set(o.registry.map((e) => e.id)), t = [...new Set(u.filter((t) => !e.has(t.definition.id)).map((e) => `${e.definition.id}@${e.definition.version}`))];
1025
+ let e = new Set(a.registry.map((e) => e.id)), t = [...new Set(u.filter((t) => !e.has(t.definition.id)).map((e) => `${e.definition.id}@${e.definition.version}`))];
871
1026
  throw TypeError(`createReactConfig is missing implementations for: ${m.join(", ")}.` + (t.length === 0 ? "" : ` Supplied implementation(s) ${t.join(", ")} are not declared by this local config.`));
872
1027
  }
873
- let g = new Map(p.map((e) => [e.definition.id, e])), _ = new Map(p.map((e) => [e.definition.name, e])), v = p.filter((e) => !d.has(e)), y = Object.freeze(o.themes.slice()), b = Object.freeze({
1028
+ let g = new Map(p.map((e) => [e.definition.id, e])), _ = new Map(p.map((e) => [e.definition.name, e])), v = p.filter((e) => !d.has(e)), y = Object.freeze(a.themes.slice()), b = Object.freeze({
874
1029
  byName: new Map(_),
875
1030
  byId: new Map(g)
876
1031
  }), x = Object.freeze({
877
- config: o,
1032
+ config: a,
878
1033
  components: Object.freeze(v),
879
1034
  implementations: Object.freeze(p),
880
1035
  themes: y,
881
- hostRenderer: Le(b)
1036
+ hostRenderer: et(b)
882
1037
  });
883
- return J.set(x, b), a && Y.set(x, {
884
- loader: new Ce(a.resolver, a.resolveSync),
1038
+ return J.set(x, b), r && Y.set(x, {
1039
+ loader: new Re(r.resolver, r.resolveSync),
885
1040
  definitions: h
886
1041
  }), x;
887
1042
  }
888
- function De(e, t, n) {
1043
+ function Ge(e, t, n) {
889
1044
  if (typeof t?.resolver != "function") throw TypeError("A deferred React config requires a resolver.");
890
1045
  if (t.resolveSync !== void 0 && typeof t.resolveSync != "function") throw TypeError("resolveSync must be a function.");
891
- return X(e, t, n, t);
1046
+ return We(e, t, n, t);
892
1047
  }
893
- var Z = class extends Error {
1048
+ var X = class extends Error {
894
1049
  componentName;
895
1050
  constructor(e) {
896
1051
  super(`No React implementation is registered for <${e}>.`), this.name = "LocalReactExtensionMissingError", this.componentName = e;
897
1052
  }
898
1053
  };
899
- function Oe(e) {
1054
+ function Ke(e) {
900
1055
  try {
901
1056
  return e.snapshot().revision;
902
1057
  } catch {
903
1058
  return 0;
904
1059
  }
905
1060
  }
906
- function ke(e, t) {
1061
+ function Z(e, t) {
907
1062
  if (typeof e != "string" || e.length === 0) return {
908
1063
  line: 1,
909
1064
  column: 1
@@ -915,8 +1070,8 @@ function ke(e, t) {
915
1070
  column: n - i + 1
916
1071
  };
917
1072
  }
918
- function Ae(e, t, n, r, i) {
919
- let { line: a, column: o } = ke(r, n.start);
1073
+ function qe(e, t, n, r, i) {
1074
+ let { line: a, column: o } = Z(r, n.start);
920
1075
  return {
921
1076
  code: e,
922
1077
  message: `Component <${t}> failed: ${i instanceof Error ? i.message : String(i)}`,
@@ -929,21 +1084,21 @@ function Ae(e, t, n, r, i) {
929
1084
  column: o
930
1085
  };
931
1086
  }
932
- var je = class extends m {
1087
+ var Je = class extends v {
933
1088
  state = { failed: !1 };
934
1089
  static getDerivedStateFromError() {
935
1090
  return { failed: !0 };
936
1091
  }
937
1092
  componentDidCatch(e) {
938
1093
  try {
939
- this.props.report([Ae("local.extension.render", this.props.name, this.props.range, this.props.source, e)]);
1094
+ this.props.report([qe("local.extension.render", this.props.name, this.props.range, this.props.source, e)]);
940
1095
  } catch {}
941
1096
  }
942
1097
  componentDidUpdate(e) {
943
1098
  this.state.failed && e.revision !== this.props.revision && this.setState({ failed: !1 });
944
1099
  }
945
1100
  render() {
946
- return this.state.failed ? h("span", {
1101
+ return this.state.failed ? y("span", {
947
1102
  className: "local-host-component local-host-unavailable local-sdk-unavailable",
948
1103
  "data-local-host-component": this.props.name,
949
1104
  "data-local-host-reason": "error",
@@ -956,10 +1111,10 @@ var je = class extends m {
956
1111
  }, `Component <${this.props.name}> is unavailable here.`) : this.props.children;
957
1112
  }
958
1113
  };
959
- function Me({ implementation: e, node: t, environment: n }) {
1114
+ function Ye({ implementation: e, node: t, environment: n }) {
960
1115
  let r = e.definition.id.startsWith("reactive-md/"), i = n.mode === "static" ? "static" : "interactive";
961
1116
  if (!r && !e.definition.capabilities[i]) throw Error(`Component ${e.definition.id} does not support ${i} rendering.`);
962
- let a = _e(t, {
1117
+ let a = Ae(t, {
963
1118
  runtime: n.runtime,
964
1119
  authorStyle: n.authorStyle,
965
1120
  authorStyleText: n.authorStyleText,
@@ -986,46 +1141,46 @@ function Me({ implementation: e, node: t, environment: n }) {
986
1141
  jumpTo: n.jumpTo,
987
1142
  urlPolicy: n.urlPolicy,
988
1143
  imageResolver: n.imageResolver
989
- }), o = n.mode === "static" && e.renderStatic ? e.renderStatic : e.render, s = h(o, a);
990
- return n.trace?.observer?.onTrace ? /* @__PURE__ */ C(x, { children: [s, /* @__PURE__ */ S(q, {
1144
+ }, n.branchCondition), o = n.mode === "static" && e.renderStatic ? e.renderStatic : e.render, s = y(o, a);
1145
+ return n.trace?.observer?.onTrace ? /* @__PURE__ */ w(ne, { children: [s, /* @__PURE__ */ C(Be, {
991
1146
  trace: n.trace,
992
1147
  component: e.definition
993
1148
  })] }) : s;
994
1149
  }
995
1150
  function Q(e, t, n, r) {
996
1151
  let i = t.name ?? "", a = r ?? e.byName.get(i);
997
- if (!a) throw new Z(i);
1152
+ if (!a) throw new X(i);
998
1153
  let o;
999
1154
  try {
1000
1155
  o = n.runtime.document.source;
1001
1156
  } catch {
1002
1157
  o = void 0;
1003
1158
  }
1004
- let s = h(Me, {
1159
+ let s = y(Ye, {
1005
1160
  implementation: a,
1006
1161
  node: t,
1007
1162
  environment: n
1008
1163
  });
1009
- return a.definition.id.startsWith("reactive-md/") ? s : h(je, {
1164
+ return a.definition.id.startsWith("reactive-md/") ? s : y(Je, {
1010
1165
  name: i,
1011
1166
  nodeId: t.id,
1012
- revision: Oe(n.runtime),
1167
+ revision: Ke(n.runtime),
1013
1168
  range: t.range,
1014
1169
  source: o,
1015
1170
  report: n.report
1016
1171
  }, s);
1017
1172
  }
1018
- var Ne = /* @__PURE__ */ new WeakMap();
1019
- function Pe({ loader: t, index: n, definition: r, node: i, environment: a }) {
1020
- let o = a.trace, s = g((e) => t.subscribe(r, e, o), [
1173
+ var Xe = /* @__PURE__ */ new WeakMap();
1174
+ function Ze({ loader: t, index: n, definition: r, node: i, environment: a }) {
1175
+ let o = a.trace, s = b((e) => t.subscribe(r, e, o), [
1021
1176
  t,
1022
1177
  r,
1023
1178
  o
1024
- ]), c = g(() => t.snapshot(r), [t, r]), l = b(s, c, t.serverSnapshot), u = a.runtime.document, d = l.status === "loading", f = d ? "local.extension.load" : "local.extension.load-failed", p = e(f, a.locale) ?? f;
1025
- if (_(() => {
1179
+ ]), c = b(() => t.snapshot(r), [t, r]), l = te(s, c, t.serverSnapshot), u = a.runtime.document, d = l.status === "loading", f = d ? "local.extension.load" : "local.extension.load-failed", p = e(f, a.locale) ?? f;
1180
+ if (x(() => {
1026
1181
  if (l.status === "ready") return;
1027
- let e = Ne.get(u);
1028
- e || (e = /* @__PURE__ */ new Set(), Ne.set(u, e));
1182
+ let e = Xe.get(u);
1183
+ e || (e = /* @__PURE__ */ new Set(), Xe.set(u, e));
1029
1184
  let t = `${o?.sourceRevision ?? ""}:${r.id}:${r.version}:${f}`;
1030
1185
  e.size >= 64 || e.has(t) || (e.add(t), a.report([{
1031
1186
  code: f,
@@ -1033,7 +1188,7 @@ function Pe({ loader: t, index: n, definition: r, node: i, environment: a }) {
1033
1188
  messageKey: f,
1034
1189
  severity: "warning",
1035
1190
  range: i.range,
1036
- ...ke(u.source, i.range.start),
1191
+ ...Z(u.source, i.range.start),
1037
1192
  phase: "host",
1038
1193
  recoverable: !0
1039
1194
  }]));
@@ -1048,40 +1203,40 @@ function Pe({ loader: t, index: n, definition: r, node: i, environment: a }) {
1048
1203
  i
1049
1204
  ]), l.status === "ready") return Q(n, i, a, l.component);
1050
1205
  let m = a.locale === "zh" ? "重试" : "Retry";
1051
- return /* @__PURE__ */ C("span", {
1206
+ return /* @__PURE__ */ w("span", {
1052
1207
  className: "local-component-loading",
1053
1208
  "data-rmd-component-load": l.status,
1054
1209
  role: "status",
1055
- children: [p, !d && /* @__PURE__ */ S("button", {
1210
+ children: [p, !d && /* @__PURE__ */ C("button", {
1056
1211
  type: "button",
1057
1212
  onClick: () => t.retry(r, o),
1058
1213
  children: m
1059
1214
  })]
1060
1215
  });
1061
1216
  }
1062
- function Fe(e) {
1063
- let n = Te(e), r = Y.get(e);
1064
- return (e, i) => {
1065
- let a = e.name ?? "", o = r?.definitions.get(a);
1066
- if (!r || !o) return Q(n, e, i);
1067
- let s = i.runtime.document.componentDefinitions?.find((e) => e.name === a);
1068
- if (!s || s.id !== o.id || s.version !== o.version || t(s) !== t(o)) throw new Z(a);
1069
- let c = r.loader.synchronousImplementation(o);
1070
- return c ? Q(n, e, i, c) : /* @__PURE__ */ S(Pe, {
1071
- loader: r.loader,
1072
- index: n,
1217
+ function Qe(e) {
1218
+ let t = He(e), n = Y.get(e);
1219
+ return (e, r) => {
1220
+ let a = e.name ?? "", o = n?.definitions.get(a);
1221
+ if (!n || !o) return Q(t, e, r);
1222
+ let s = r.runtime.document.componentDefinitions?.find((e) => e.name === a);
1223
+ if (!s || s.id !== o.id || s.version !== o.version || i(s) !== i(o)) throw new X(a);
1224
+ let c = n.loader.synchronousImplementation(o);
1225
+ return c ? Q(t, e, r, c) : /* @__PURE__ */ C(Ze, {
1226
+ loader: n.loader,
1227
+ index: t,
1073
1228
  definition: o,
1074
1229
  node: e,
1075
- environment: i
1230
+ environment: r
1076
1231
  });
1077
1232
  };
1078
1233
  }
1079
- function Ie(e) {
1234
+ function $e(e) {
1080
1235
  let t = "";
1081
- for (let n of e ?? []) n.type === "text" || n.type === "inlineCode" || n.type === "code" || n.type === "rawBody" ? t += n.value ?? "" : n.type === "math" || n.type === "inlineMath" || n.type === "image" ? t += n.value ?? n.alt ?? "" : t += Ie(n.children);
1236
+ for (let n of e ?? []) n.type === "text" || n.type === "inlineCode" || n.type === "code" || n.type === "rawBody" ? t += n.value ?? "" : n.type === "math" || n.type === "inlineMath" || n.type === "image" ? t += n.value ?? n.alt ?? "" : t += $e(n.children);
1082
1237
  return t;
1083
1238
  }
1084
- function Le(e) {
1239
+ function et(e) {
1085
1240
  return (t, n, r) => Q(e, t, {
1086
1241
  runtime: r.runtime,
1087
1242
  mode: r.mode,
@@ -1092,7 +1247,7 @@ function Le(e) {
1092
1247
  locale: "en",
1093
1248
  renderChildren: (e, t) => r.render(e, t),
1094
1249
  renderInline: (e, t) => r.render(e, t),
1095
- renderToText: (e) => Ie(e),
1250
+ renderToText: (e) => $e(e),
1096
1251
  report: (e) => r.report(e),
1097
1252
  definitionFor: (t) => e.byName.get(t)?.definition,
1098
1253
  validationField: () => ({ invalid: !1 }),
@@ -1104,16 +1259,16 @@ function Le(e) {
1104
1259
  jumpTo: () => "missing"
1105
1260
  });
1106
1261
  }
1107
- function Re(e, t) {
1108
- let n = f(t, e.config);
1262
+ function tt(e, t) {
1263
+ let n = g(t, e.config);
1109
1264
  if (n.length || !t || typeof t != "object") return n;
1110
1265
  let r = t.components;
1111
1266
  if (!Array.isArray(r)) return n;
1112
- let i = Te(e), a = Y.get(e);
1267
+ let i = He(e), a = Y.get(e);
1113
1268
  for (let e of r) !i.byId.has(e.id) && a?.definitions.get(e.name)?.id !== e.id && n.push({
1114
1269
  code: "local.extension.renderer-missing",
1115
1270
  severity: "error",
1116
- message: new Z(e.name).message,
1271
+ message: new X(e.name).message,
1117
1272
  range: {
1118
1273
  start: 0,
1119
1274
  end: 0
@@ -1125,10 +1280,10 @@ function Re(e, t) {
1125
1280
  }
1126
1281
  function $(e, t, n) {
1127
1282
  try {
1128
- e.report([Ae("local.extension.event", e.instance.componentId, e.instance.range, n, t)]);
1283
+ e.report([qe("local.extension.event", e.instance.componentId, e.instance.range, n, t)]);
1129
1284
  } catch {}
1130
1285
  }
1131
- function ze(e, t, n) {
1286
+ function nt(e, t, n) {
1132
1287
  return (...r) => {
1133
1288
  try {
1134
1289
  t(...r);
@@ -1137,4 +1292,4 @@ function ze(e, t, n) {
1137
1292
  }
1138
1293
  };
1139
1294
  }
1140
- export { $ as a, q as c, R as d, k as f, Fe as i, U as l, De as n, ze as o, X as r, Re as s, Z as t, ne as u };
1295
+ export { $ as a, Be as c, j as d, H as f, ye as h, Qe as i, Le as l, A as m, Ge as n, nt as o, D as p, We as r, tt as s, X as t, fe as u };