reactive-md 0.9.2 → 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 (638) hide show
  1. package/CHANGELOG-ch.md +397 -333
  2. package/CHANGELOG.md +398 -334
  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 +0 -57
  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 -445
  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 +325 -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-CP2QG86k.js +114 -0
  28. package/dist-library/{LocalDocumentViewCore-DXE0I0Qc.js → LocalDocumentViewCore-Cd6yMEkg.js} +379 -9445
  29. package/dist-library/LocalReactiveDocumentCore-VuYpZqdn.js +283 -0
  30. package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
  31. package/dist-library/authoring-Bwu_zCWs.js +768 -0
  32. package/dist-library/chart-B1TUtzm-.js +3 -0
  33. package/dist-library/choice-values-BItGjPD2.js +58 -0
  34. package/dist-library/color-values-r8Wf7ALn.js +6 -0
  35. package/dist-library/compile-B35rfzKr.js +1742 -0
  36. package/dist-library/compile-cache-key-D21X2Obx.js +28 -0
  37. package/dist-library/compiler-DBwLawMZ.js +98 -0
  38. package/dist-library/{compiler-core-DDDdvuLy.js → compiler-core-kkDiQ1RK.js} +4202 -3496
  39. package/dist-library/component-kernel-CsJSabHX.js +372 -0
  40. package/dist-library/{component-state-BRwvTV0d.js → component-state-Da0G8Ajc.js} +1 -1
  41. package/dist-library/component-utils-ZM3jUJNy.js +339 -0
  42. package/dist-library/conditional-branches-CIhJXasR.js +17 -0
  43. package/dist-library/config-validation-DbmsWAEV.js +469 -0
  44. package/dist-library/controls-DRy5rzzN.js +5970 -0
  45. package/dist-library/controls-DWlx-AQl.js +3 -0
  46. package/dist-library/{coordinate-B1VFK9fd.js → coordinate-c54pHfgf.js} +89 -89
  47. package/dist-library/data-BtFlkJzp.js +3 -0
  48. package/dist-library/data-table-CSAkm1eU.js +290 -0
  49. package/dist-library/data-table-model-DruztQFt.js +391 -0
  50. package/dist-library/data-visuals-rZQUeQM0.js +384 -0
  51. package/dist-library/{default-components-s21NevON.js → default-components-B-39etG9.js} +518 -355
  52. package/dist-library/{config-DXLvctiZ.js → default-config-CCa8rm2k.js} +265 -230
  53. package/dist-library/default-options-By16CVw1.js +131 -0
  54. package/dist-library/{registry-D6OGkOcX.js → default-registry-DXJy66xj.js} +4 -4
  55. package/dist-library/default-schema-CeYiEW1K.js +33 -0
  56. package/dist-library/diagram-BLepzI8l.js +3 -0
  57. package/dist-library/display-Bb6hAG5T.js +2065 -0
  58. package/dist-library/dist-Cueh1Psp.js +4761 -0
  59. package/dist-library/{document-theme-C8J6UyNO.js → document-theme-CJvN-nC1.js} +246 -4
  60. package/dist-library/{export-CIAIPBov.js → export-BSV4E0jv.js} +135 -135
  61. package/dist-library/font-aliases-CKYjwn4o.js +4 -0
  62. package/dist-library/gallery-BC6FYTqw.js +3 -0
  63. package/dist-library/{gallery-Dv1rOvL0.js → gallery-DM2yTVZJ.js} +1 -1
  64. package/dist-library/{html-Cr4CBwAH.js → html-CY9mC3Sr.js} +49 -48
  65. package/dist-library/{incremental-9nx92u9c.js → incremental-B-wW4H3F.js} +537 -384
  66. package/dist-library/{display-B_uutKkN.js → katex-4ukd4ZxT.js} +1555 -3618
  67. package/dist-library/layout-CPQggKxk.js +592 -0
  68. package/dist-library/layout-CaDWsDof.js +3 -0
  69. package/dist-library/limits-CFERRrlC.js +10 -0
  70. package/dist-library/localization-COdJ6lw2.js +6 -0
  71. package/dist-library/mafs-CnzDC5CR.js +3 -0
  72. package/dist-library/math-view-CyGTS6kv.js +20 -0
  73. package/dist-library/motion-tokens-Czk0RDmS.js +283 -0
  74. package/dist-library/mount-preset-DtrCX4G8.js +24 -0
  75. package/dist-library/numeric-sliders-BmJ1LCLx.js +542 -0
  76. package/dist-library/{observability-4KqXhIEU.js → observability-BVQ16ByQ.js} +125 -43
  77. package/dist-library/package-core-Cu_r_qs7.js +128 -0
  78. package/dist-library/parser-BHl9Lxbw.js +8 -0
  79. package/dist-library/parser-standard-DDAKv_DZ.js +4872 -0
  80. package/dist-library/plugin-packs-CkI0floL.js +19 -0
  81. package/dist-library/preset-core-BKPbH_Nv.js +1371 -0
  82. package/dist-library/props-0iDqxlTk.js +174 -0
  83. package/dist-library/react-74jdGBmu.js +32 -0
  84. package/dist-library/reactive-md-authoring.js +315 -296
  85. package/dist-library/reactive-md-build.js +334 -43
  86. package/dist-library/reactive-md-compiler-session.js +4 -0
  87. package/dist-library/reactive-md-compiler-standard.js +10 -10
  88. package/dist-library/reactive-md-compiler.js +3 -3
  89. package/dist-library/reactive-md-contracts.js +6 -0
  90. package/dist-library/reactive-md-default-packs.js +32 -15
  91. package/dist-library/reactive-md-default-preset.js +7 -7
  92. package/dist-library/reactive-md-export.js +6 -5
  93. package/dist-library/reactive-md-minimal-preset.js +3 -2
  94. package/dist-library/reactive-md-minimal-react-preset.js +26 -23
  95. package/dist-library/reactive-md-minimal.css +1 -1
  96. package/dist-library/reactive-md-observability.js +125 -3
  97. package/dist-library/reactive-md-pack-style-manifest.js +805 -0
  98. package/dist-library/reactive-md-plugin-chart.js +14 -9
  99. package/dist-library/reactive-md-plugin-data.js +8 -8
  100. package/dist-library/reactive-md-plugin-diagram.js +7 -6
  101. package/dist-library/reactive-md-plugin-forms.js +14 -13
  102. package/dist-library/reactive-md-plugin-gallery.js +6 -5
  103. package/dist-library/reactive-md-plugin-navigation.js +8 -8
  104. package/dist-library/reactive-md-plugin-network.js +13 -13
  105. package/dist-library/reactive-md-plugin-plot.js +7 -6
  106. package/dist-library/reactive-md-print.css +304 -304
  107. package/dist-library/reactive-md-react-component-accordion.js +10 -0
  108. package/dist-library/reactive-md-react-component-alert.js +10 -0
  109. package/dist-library/reactive-md-react-component-anchor.js +10 -0
  110. package/dist-library/reactive-md-react-component-badge.js +10 -0
  111. package/dist-library/reactive-md-react-component-card.js +10 -0
  112. package/dist-library/reactive-md-react-component-chart.js +22 -0
  113. package/dist-library/reactive-md-react-component-checkbox.js +10 -0
  114. package/dist-library/reactive-md-react-component-checklist.js +10 -0
  115. package/dist-library/reactive-md-react-component-choices.js +10 -0
  116. package/dist-library/reactive-md-react-component-column.js +6 -0
  117. package/dist-library/reactive-md-react-component-coordinate.js +21 -0
  118. package/dist-library/reactive-md-react-component-counter.js +10 -0
  119. package/dist-library/reactive-md-react-component-data-table.js +14 -0
  120. package/dist-library/reactive-md-react-component-date.js +10 -0
  121. package/dist-library/reactive-md-react-component-diagram.js +22 -0
  122. package/dist-library/reactive-md-react-component-disclosure.js +10 -0
  123. package/dist-library/reactive-md-react-component-edge.js +22 -0
  124. package/dist-library/reactive-md-react-component-else.js +10 -0
  125. package/dist-library/reactive-md-react-component-gallery-item.js +10 -0
  126. package/dist-library/reactive-md-react-component-gallery.js +10 -0
  127. package/dist-library/reactive-md-react-component-grid.js +10 -0
  128. package/dist-library/reactive-md-react-component-if.js +10 -0
  129. package/dist-library/reactive-md-react-component-input.js +10 -0
  130. package/dist-library/reactive-md-react-component-jump.js +10 -0
  131. package/dist-library/reactive-md-react-component-multi-select.js +10 -0
  132. package/dist-library/reactive-md-react-component-node.js +22 -0
  133. package/dist-library/reactive-md-react-component-number.js +10 -0
  134. package/dist-library/reactive-md-react-component-option.js +10 -0
  135. package/dist-library/reactive-md-react-component-panel.js +10 -0
  136. package/dist-library/reactive-md-react-component-plot.js +26 -0
  137. package/dist-library/reactive-md-react-component-progress.js +10 -0
  138. package/dist-library/reactive-md-react-component-quiz.js +10 -0
  139. package/dist-library/reactive-md-react-component-radio-group.js +10 -0
  140. package/dist-library/reactive-md-react-component-range-slider.js +10 -0
  141. package/dist-library/reactive-md-react-component-section.js +10 -0
  142. package/dist-library/reactive-md-react-component-select.js +10 -0
  143. package/dist-library/reactive-md-react-component-slider.js +10 -0
  144. package/dist-library/reactive-md-react-component-step.js +10 -0
  145. package/dist-library/reactive-md-react-component-steps.js +10 -0
  146. package/dist-library/reactive-md-react-component-tab.js +10 -0
  147. package/dist-library/reactive-md-react-component-table.js +14 -0
  148. package/dist-library/reactive-md-react-component-tabs.js +10 -0
  149. package/dist-library/reactive-md-react-component-text.js +10 -0
  150. package/dist-library/reactive-md-react-component-textarea.js +10 -0
  151. package/dist-library/reactive-md-react-component-timeline.js +14 -0
  152. package/dist-library/reactive-md-react-component-timer.js +10 -0
  153. package/dist-library/reactive-md-react-component-toggle.js +10 -0
  154. package/dist-library/reactive-md-react-component-tooltip.js +10 -0
  155. package/dist-library/reactive-md-react-component-validation.js +10 -0
  156. package/dist-library/reactive-md-react-minimal.js +4 -4
  157. package/dist-library/reactive-md-react-pack-controls.js +44 -0
  158. package/dist-library/reactive-md-react-pack-data.js +21 -0
  159. package/dist-library/reactive-md-react-pack-layout.js +37 -0
  160. package/dist-library/reactive-md-react-pack-visuals.js +43 -0
  161. package/dist-library/reactive-md-react-packed.js +50 -0
  162. package/dist-library/reactive-md-react-server.js +29 -27
  163. package/dist-library/reactive-md-react-static-server.js +24 -0
  164. package/dist-library/reactive-md-react-static.js +1 -0
  165. package/dist-library/reactive-md-react-unstyled.js +15 -12
  166. package/dist-library/reactive-md-react.js +15 -12
  167. package/dist-library/reactive-md-scan.js +1 -0
  168. package/dist-library/reactive-md-sdk.js +23 -9
  169. package/dist-library/reactive-md-standalone-configured.js +2 -2
  170. package/dist-library/reactive-md-standalone-host.js +2 -2
  171. package/dist-library/reactive-md-testing-browser.js +2 -2
  172. package/dist-library/reactive-md-testing-react.js +32 -32
  173. package/dist-library/reactive-md-testing.js +12 -12
  174. package/dist-library/reactive-md-vite.js +25 -9
  175. package/dist-library/reactive-md-worker-pool.js +401 -0
  176. package/dist-library/reactive-md.css +1 -1
  177. package/dist-library/reactive-md.js +97 -1554
  178. package/dist-library/registry-core-DxEaxhJ6.js +126 -0
  179. package/dist-library/render-nodes-B6j6Ip5I.js +9404 -0
  180. package/dist-library/requirements-C56sFIEs.js +157 -0
  181. package/dist-library/resources-6VaNgk-h.js +74 -0
  182. package/dist-library/rmd-pack-controls.css +1032 -0
  183. package/dist-library/rmd-pack-data.css +724 -0
  184. package/dist-library/rmd-pack-layout.css +1834 -0
  185. package/dist-library/rmd-pack-resource-chart.css +300 -0
  186. package/dist-library/rmd-pack-resource-controls.css +781 -0
  187. package/dist-library/rmd-pack-resource-data-visuals.css +501 -0
  188. package/dist-library/rmd-pack-resource-diagram.css +106 -0
  189. package/dist-library/rmd-pack-resource-gallery.css +346 -0
  190. package/dist-library/rmd-pack-resource-graphics.css +516 -0
  191. package/dist-library/rmd-pack-resource-layout.css +1489 -0
  192. package/dist-library/rmd-pack-resource-mafs-core.css +124 -0
  193. package/dist-library/rmd-pack-resource-mafs.css +129 -0
  194. package/dist-library/rmd-pack-resource-visual-base.css +224 -0
  195. package/dist-library/rmd-pack-visuals.css +1394 -0
  196. package/dist-library/runtime-BHeuLOv_.js +1369 -0
  197. package/dist-library/runtime-requirement-DzPO8raU.js +772 -0
  198. package/dist-library/schema-core-CDXfxdID.js +155 -0
  199. package/dist-library/sdk-core-CnE-n0Z7.js +1295 -0
  200. package/dist-library/{session-core-dxQCJBNa.js → session-core-C071yQwV.js} +147 -133
  201. package/dist-library/sha256-utf16-Bmandi_H.js +937 -0
  202. package/dist-library/shareable-CHCDnl6j.js +844 -0
  203. package/dist-library/shared-bTzN-F4g.js +3 -0
  204. package/dist-library/structural-views-30-YD_TJ.js +11 -0
  205. package/dist-library/table-surface-CfZn_tk-.js +13 -0
  206. package/dist-library/types/assemblies/compile-cache-key.d.ts +11 -0
  207. package/dist-library/types/assemblies/default-config.d.ts +35 -0
  208. package/dist-library/types/{local/configuration/options.d.ts → assemblies/default-options.d.ts} +4 -4
  209. package/dist-library/types/assemblies/default-registry.d.ts +18 -0
  210. package/dist-library/types/{local/configuration/schema.d.ts → assemblies/default-schema.d.ts} +4 -4
  211. package/dist-library/types/authoring/catalog.d.ts +14 -2
  212. package/dist-library/types/authoring/extensions.d.ts +1 -1
  213. package/dist-library/types/authoring/index.d.ts +4 -4
  214. package/dist-library/types/authoring/templates.d.ts +1 -1
  215. package/dist-library/types/compiler/index.d.ts +1 -0
  216. package/dist-library/types/compiler/session.d.ts +19 -0
  217. package/dist-library/types/compiler/standard.d.ts +1 -0
  218. package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
  219. package/dist-library/types/components/chart/default-chart.d.ts +7 -0
  220. package/dist-library/types/components/entries/accordion.d.ts +3 -0
  221. package/dist-library/types/components/entries/alert.d.ts +3 -0
  222. package/dist-library/types/components/entries/anchor.d.ts +3 -0
  223. package/dist-library/types/components/entries/badge.d.ts +3 -0
  224. package/dist-library/types/components/entries/card.d.ts +3 -0
  225. package/dist-library/types/components/entries/chart.d.ts +3 -0
  226. package/dist-library/types/components/entries/checkbox.d.ts +3 -0
  227. package/dist-library/types/components/entries/checklist.d.ts +3 -0
  228. package/dist-library/types/components/entries/choices.d.ts +3 -0
  229. package/dist-library/types/components/entries/column.d.ts +3 -0
  230. package/dist-library/types/components/entries/coordinate.d.ts +3 -0
  231. package/dist-library/types/components/entries/counter.d.ts +3 -0
  232. package/dist-library/types/components/entries/data-table.d.ts +3 -0
  233. package/dist-library/types/components/entries/date.d.ts +3 -0
  234. package/dist-library/types/components/entries/diagram.d.ts +3 -0
  235. package/dist-library/types/components/entries/disclosure.d.ts +3 -0
  236. package/dist-library/types/components/entries/edge.d.ts +3 -0
  237. package/dist-library/types/components/entries/else.d.ts +3 -0
  238. package/dist-library/types/components/entries/gallery-item.d.ts +3 -0
  239. package/dist-library/types/components/entries/gallery.d.ts +3 -0
  240. package/dist-library/types/components/entries/grid.d.ts +3 -0
  241. package/dist-library/types/components/entries/if.d.ts +3 -0
  242. package/dist-library/types/components/entries/input.d.ts +3 -0
  243. package/dist-library/types/components/entries/jump.d.ts +3 -0
  244. package/dist-library/types/components/entries/multi-select.d.ts +3 -0
  245. package/dist-library/types/components/entries/node.d.ts +3 -0
  246. package/dist-library/types/components/entries/number.d.ts +3 -0
  247. package/dist-library/types/components/entries/option.d.ts +3 -0
  248. package/dist-library/types/components/entries/panel.d.ts +3 -0
  249. package/dist-library/types/components/entries/plot.d.ts +3 -0
  250. package/dist-library/types/components/entries/progress.d.ts +3 -0
  251. package/dist-library/types/components/entries/quiz.d.ts +3 -0
  252. package/dist-library/types/components/entries/radio-group.d.ts +3 -0
  253. package/dist-library/types/components/entries/range-slider.d.ts +3 -0
  254. package/dist-library/types/components/entries/section.d.ts +3 -0
  255. package/dist-library/types/components/entries/select.d.ts +3 -0
  256. package/dist-library/types/components/entries/slider.d.ts +3 -0
  257. package/dist-library/types/components/entries/step.d.ts +3 -0
  258. package/dist-library/types/components/entries/steps.d.ts +3 -0
  259. package/dist-library/types/components/entries/tab.d.ts +3 -0
  260. package/dist-library/types/components/entries/table.d.ts +3 -0
  261. package/dist-library/types/components/entries/tabs.d.ts +3 -0
  262. package/dist-library/types/components/entries/text.d.ts +3 -0
  263. package/dist-library/types/components/entries/textarea.d.ts +3 -0
  264. package/dist-library/types/components/entries/timeline.d.ts +3 -0
  265. package/dist-library/types/components/entries/timer.d.ts +3 -0
  266. package/dist-library/types/components/entries/toggle.d.ts +3 -0
  267. package/dist-library/types/components/entries/tooltip.d.ts +3 -0
  268. package/dist-library/types/components/entries/validation.d.ts +3 -0
  269. package/dist-library/types/components/layout/layout.d.ts +6 -3
  270. package/dist-library/types/components/layout/structural-views.d.ts +3 -0
  271. package/dist-library/types/components/mount-preset.d.ts +2 -0
  272. package/dist-library/types/components/packs/controls.d.ts +2 -0
  273. package/dist-library/types/components/packs/data.d.ts +2 -0
  274. package/dist-library/types/components/packs/layout.d.ts +2 -0
  275. package/dist-library/types/components/packs/visuals.d.ts +2 -0
  276. package/dist-library/types/components/shared/data-visuals.d.ts +3 -0
  277. package/dist-library/types/components/shared/table-surface.d.ts +10 -0
  278. package/dist-library/types/components/shared/visual-helpers.d.ts +24 -0
  279. package/dist-library/types/components/shared/visuals.d.ts +1 -3
  280. package/dist-library/types/components/table/data-table-model.d.ts +141 -0
  281. package/dist-library/types/components/table/data-table.d.ts +3 -50
  282. package/dist-library/types/{local/configuration → contracts}/component-kernel.d.ts +9 -2
  283. package/dist-library/types/contracts/font-aliases.d.ts +18 -0
  284. package/dist-library/types/contracts/index.d.ts +8 -0
  285. package/dist-library/types/{local/configuration → contracts}/limits.d.ts +9 -1
  286. package/dist-library/types/contracts/localization.d.ts +6 -0
  287. package/dist-library/types/contracts/number-literal.d.ts +2 -0
  288. package/dist-library/types/contracts/runtime-types.d.ts +19 -0
  289. package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
  290. package/dist-library/types/export/index.d.ts +4 -1
  291. package/dist-library/types/local/compilation/cache-version.d.ts +1 -0
  292. package/dist-library/types/local/compilation/compile-status.d.ts +2 -0
  293. package/dist-library/types/local/compilation/compiler-bindings.d.ts +1 -1
  294. package/dist-library/types/local/compilation/compiler-capabilities.d.ts +4 -1
  295. package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
  296. package/dist-library/types/local/compilation/compiler-core.d.ts +1 -1
  297. package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
  298. package/dist-library/types/local/compilation/compiler-embedding.d.ts +20 -0
  299. package/dist-library/types/local/compilation/compiler-expressions.d.ts +17 -5
  300. package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
  301. package/dist-library/types/local/compilation/compiler-structure.d.ts +9 -3
  302. package/dist-library/types/local/compilation/compiler-tables.d.ts +4 -2
  303. package/dist-library/types/local/compilation/compiler-validation.d.ts +14 -7
  304. package/dist-library/types/local/compilation/compiler-values.d.ts +2 -3
  305. package/dist-library/types/local/compilation/compiler.d.ts +1 -1
  306. package/dist-library/types/local/compilation/component-usage.d.ts +2 -0
  307. package/dist-library/types/local/compilation/runtime-requirement.d.ts +3 -0
  308. package/dist-library/types/local/compilation/session/incremental.d.ts +5 -1
  309. package/dist-library/types/local/compilation/streaming.d.ts +1 -1
  310. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +228 -2
  311. package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
  312. package/dist-library/types/local/configuration/embedding.d.ts +4 -0
  313. package/dist-library/types/local/configuration/kernel-value-rules.d.ts +1 -1
  314. package/dist-library/types/local/configuration/options-core.d.ts +8 -2
  315. package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
  316. package/dist-library/types/local/evaluation/computations.d.ts +13 -5
  317. package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
  318. package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
  319. package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
  320. package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
  321. package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
  322. package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
  323. package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
  324. package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
  325. package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
  326. package/dist-library/types/local/evaluation/validation.d.ts +8 -6
  327. package/dist-library/types/local/index.d.ts +10 -4
  328. package/dist-library/types/local/observability-core.d.ts +20 -1
  329. package/dist-library/types/local/observability.d.ts +2 -0
  330. package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
  331. package/dist-library/types/local/parsing/parse-budget.d.ts +18 -2
  332. package/dist-library/types/local/parsing/parser-region.d.ts +13 -2
  333. package/dist-library/types/local/parsing/parser-tags.d.ts +6 -1
  334. package/dist-library/types/local/parsing/rmd-recovery.d.ts +8 -0
  335. package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
  336. package/dist-library/types/local/performance-report.d.ts +70 -0
  337. package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
  338. package/dist-library/types/local/runtime/runtime-pool.d.ts +14 -0
  339. package/dist-library/types/local/runtime/runtime.d.ts +3 -1
  340. package/dist-library/types/local/runtime/state.d.ts +30 -15
  341. package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
  342. package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
  343. package/dist-library/types/local/source/authoring.d.ts +10 -0
  344. package/dist-library/types/local/source/source-migration.d.ts +1 -0
  345. package/dist-library/types/local/transport/worker-handler.d.ts +3 -0
  346. package/dist-library/types/local/transport/worker-job.d.ts +12 -2
  347. package/dist-library/types/local/transport/worker-pool.d.ts +68 -0
  348. package/dist-library/types/local/transport/worker.d.ts +14 -0
  349. package/dist-library/types/local/types.d.ts +70 -27
  350. package/dist-library/types/observability.d.ts +1 -0
  351. package/dist-library/types/presets/default-semantics.d.ts +1 -1
  352. package/dist-library/types/presets/identity.d.ts +1 -8
  353. package/dist-library/types/presets/pack-style-entry.d.ts +3 -0
  354. package/dist-library/types/presets/pack-style-manifest.d.ts +11 -0
  355. package/dist-library/types/react/component-api.d.ts +24 -4
  356. package/dist-library/types/react/component-loader.d.ts +61 -0
  357. package/dist-library/types/react/component-primitives.d.ts +5 -5
  358. package/dist-library/types/react/component-utils.d.ts +11 -0
  359. package/dist-library/types/react/font-aliases.d.ts +2 -0
  360. package/dist-library/types/react/index.d.ts +9 -5
  361. package/dist-library/types/react/localization.d.ts +5 -6
  362. package/dist-library/types/react/minimal.d.ts +2 -2
  363. package/dist-library/types/react/package-core.d.ts +6 -0
  364. package/dist-library/types/react/packed.d.ts +17 -0
  365. package/dist-library/types/react/render-lifecycle.d.ts +9 -0
  366. package/dist-library/types/{local → react}/rendering/document/ExtendedHtmlFragment.d.ts +1 -1
  367. package/dist-library/types/{local → react}/rendering/document/LocalDocumentViewCore.d.ts +11 -4
  368. package/dist-library/types/react/rendering/document/LocalPooledDocumentView.d.ts +8 -0
  369. package/dist-library/types/react/rendering/document/LocalReactiveDocumentCore.d.ts +6 -0
  370. package/dist-library/types/react/rendering/document/LocalStaticDocumentView.d.ts +18 -0
  371. package/dist-library/types/react/rendering/document/StaticExternalSlot.d.ts +25 -0
  372. package/dist-library/types/react/rendering/document/StaticHostData.d.ts +14 -0
  373. package/dist-library/types/{local → react}/rendering/document/render-nodes.d.ts +8 -8
  374. package/dist-library/types/react/rendering/document/static-runtime.d.ts +11 -0
  375. package/dist-library/types/{local → react}/rendering/document/use-author-script.d.ts +2 -2
  376. package/dist-library/types/{local → react}/rendering/document/validation-state.d.ts +3 -3
  377. package/dist-library/types/{local → react}/rendering/document/view-render-context.d.ts +40 -8
  378. package/dist-library/types/{local → react}/rendering/document/view-revision.d.ts +5 -14
  379. package/dist-library/types/{local → react}/rendering/render-types.d.ts +5 -5
  380. package/dist-library/types/react/rendering/table/data-table.d.ts +5 -0
  381. package/dist-library/types/{local → react}/rendering/table/table-numeric-columns.d.ts +3 -3
  382. package/dist-library/types/react/sdk-core.d.ts +15 -4
  383. package/dist-library/types/react/sdk.d.ts +2 -1
  384. package/dist-library/types/react/server.d.ts +3 -10
  385. package/dist-library/types/react/static-server.d.ts +12 -0
  386. package/dist-library/types/scan/index.d.ts +15 -0
  387. package/dist-library/types/sdk/assembly.d.ts +3 -0
  388. package/dist-library/types/sdk/config.d.ts +2 -35
  389. package/dist-library/types/sdk/default-identity.d.ts +3 -0
  390. package/dist-library/types/sdk/font.d.ts +13 -0
  391. package/dist-library/types/sdk/index.d.ts +2 -1
  392. package/dist-library/types/sdk/preset.d.ts +9 -0
  393. package/dist-library/types/sdk/props.d.ts +8 -3
  394. package/dist-library/types/sdk/registry-core.d.ts +2 -2
  395. package/dist-library/types/sdk/registry.d.ts +2 -18
  396. package/dist-library/types/sdk/theme.d.ts +5 -0
  397. package/dist-library/types/sdk/types.d.ts +8 -2
  398. package/dist-library/types/sdk/version.d.ts +2 -0
  399. package/dist-library/types/shareable.d.ts +15 -3
  400. package/dist-library/types/standalone/prepare.d.ts +4 -2
  401. package/dist-library/types/standalone/session-core.d.ts +5 -2
  402. package/dist-library/types/vite/index.d.ts +3 -0
  403. package/dist-library/types/vite/registration.d.ts +1 -0
  404. package/dist-library/{types-Ib5kSScP.js → types-B4qG8J4S.js} +1 -1
  405. package/dist-library/types-FYhRWRn9.js +3 -0
  406. package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
  407. package/dist-library/validation-DRuW0Wl9.js +433 -0
  408. package/dist-library/{version-DAxuGOG2.js → version-4wzhbvDG.js} +24 -33
  409. package/dist-library/visual-frame-y5RFhJ0_.js +19 -0
  410. package/dist-library/visual-helpers-UU6xiL8g.js +75 -0
  411. package/dist-library/visuals-7xzoL9ql.js +49340 -0
  412. package/dist-library/visuals-CdHezgh5.js +3 -0
  413. package/dist-library/worker-3ldRjOEG.js +1632 -0
  414. package/dist-standalone/reactive-md-standalone.css +1 -1
  415. package/dist-standalone/reactive-md-standalone.js +127 -366
  416. package/docs/README-ch.md +104 -101
  417. package/docs/README.md +104 -101
  418. package/docs/compatibility/api-stability-ch.md +1 -1
  419. package/docs/compatibility/api-stability-en.md +1 -1
  420. package/docs/compatibility/compatibility-ch.md +146 -146
  421. package/docs/compatibility/compatibility-en.md +146 -146
  422. package/docs/compatibility/compatibility-manifest.schema.json +3 -2
  423. package/docs/compatibility/deprecation-ch.md +2 -2
  424. package/docs/compatibility/deprecation-en.md +2 -2
  425. package/docs/compatibility/source-versioning-ch.md +170 -162
  426. package/docs/compatibility/source-versioning-en.md +171 -162
  427. package/docs/compatibility/support-matrix-ch.md +4 -3
  428. package/docs/compatibility/support-matrix-en.md +4 -3
  429. package/docs/development/component-development-ch.md +66 -66
  430. package/docs/development/component-development-en.md +66 -66
  431. package/docs/development/component-development-reference-ch.md +269 -253
  432. package/docs/development/component-development-reference-en.md +254 -238
  433. package/docs/development/component-protocol-ch.md +768 -748
  434. package/docs/development/component-protocol-en.md +770 -750
  435. package/docs/development/extension-tutorial-ch.md +308 -308
  436. package/docs/development/extension-tutorial-en.md +308 -308
  437. package/docs/development/performance-overview-ch.md +422 -422
  438. package/docs/development/performance-overview-en.md +422 -422
  439. package/docs/guides/local-guide-ch.md +621 -532
  440. package/docs/guides/local-guide-en.md +621 -532
  441. package/docs/integration/author-tools-ch.md +66 -64
  442. package/docs/integration/author-tools-en.md +66 -64
  443. package/docs/integration/compiler-ch.md +90 -49
  444. package/docs/integration/compiler-en.md +77 -36
  445. package/docs/integration/directory-discovery-en.md +1 -1
  446. package/docs/integration/editor-ch.md +295 -295
  447. package/docs/integration/editor-en.md +303 -303
  448. package/docs/integration/extension-sdk-ch.md +424 -394
  449. package/docs/integration/extension-sdk-en.md +409 -379
  450. package/docs/integration/local-integration-ch.md +648 -646
  451. package/docs/integration/local-integration-en.md +664 -662
  452. package/docs/integration/pdf-export-ch.md +42 -0
  453. package/docs/integration/pdf-export-en.md +42 -0
  454. package/docs/integration/shareable-export-ch.md +299 -307
  455. package/docs/integration/shareable-export-en.md +301 -309
  456. package/docs/reference/diagnostics-counting-ch.md +127 -104
  457. package/docs/reference/diagnostics-counting-en.md +127 -104
  458. package/docs/reference/html-compatibility-ch.md +93 -93
  459. package/docs/reference/html-compatibility-en.md +95 -95
  460. package/docs/reference/local-interaction-syntax-ch.md +913 -724
  461. package/docs/reference/local-interaction-syntax-en.md +911 -722
  462. package/docs/reference/public-api-ch.md +134 -21
  463. package/docs/reference/public-api-en.md +134 -21
  464. package/docs/reference/theme-protocol-ch.md +198 -198
  465. package/docs/reference/theme-protocol-en.md +217 -217
  466. package/docs/releases/release-0.10.0-ch.md +45 -0
  467. package/docs/releases/release-0.10.0-en.md +45 -0
  468. package/docs/releases/release-0.4.0-ch.md +91 -91
  469. package/docs/releases/release-0.4.0-en.md +91 -91
  470. package/docs/releases/release-0.4.1-ch.md +25 -25
  471. package/docs/releases/release-0.4.1-en.md +25 -25
  472. package/docs/releases/release-0.5.0-ch.md +43 -43
  473. package/docs/releases/release-0.5.0-en.md +43 -43
  474. package/docs/releases/release-0.5.1-ch.md +41 -41
  475. package/docs/releases/release-0.5.1-en.md +41 -41
  476. package/docs/releases/release-0.5.2-ch.md +37 -37
  477. package/docs/releases/release-0.5.2-en.md +37 -37
  478. package/docs/releases/release-0.5.3-ch.md +26 -26
  479. package/docs/releases/release-0.5.3-en.md +26 -26
  480. package/docs/releases/release-0.6.0-ch.md +59 -59
  481. package/docs/releases/release-0.6.0-en.md +59 -59
  482. package/docs/releases/release-0.6.1-ch.md +29 -29
  483. package/docs/releases/release-0.6.1-en.md +29 -29
  484. package/docs/releases/release-0.7.0-ch.md +86 -86
  485. package/docs/releases/release-0.7.0-en.md +86 -86
  486. package/docs/releases/release-0.9.3-ch.md +45 -0
  487. package/docs/releases/release-0.9.3-en.md +45 -0
  488. package/examples/component-package/README-ch.md +101 -101
  489. package/examples/component-package/README.md +133 -133
  490. package/examples/conformance/README-ch.md +55 -55
  491. package/examples/conformance/README.md +55 -55
  492. package/examples/conformance/component-protocol-1.json +482 -482
  493. package/examples/conformance/component-protocol-1.schema.json +76 -76
  494. package/examples/conformance/local-draft-1.json +50 -50
  495. package/examples/conformance/local-draft-2.json +212 -212
  496. package/examples/conformance/local-draft-4.json +441 -0
  497. package/examples/game-2048-package/LICENSE +21 -21
  498. package/examples/game-2048-package/NOTICES.md +11 -11
  499. package/examples/game-2048-package/README-ch.md +91 -91
  500. package/examples/game-2048-package/README.md +98 -98
  501. package/examples/game-2048-package/package.json +35 -35
  502. package/examples/game-2048-package/sample/document.reactive.md +17 -17
  503. package/examples/game-2048-package/scripts/build-export.mjs +44 -44
  504. package/examples/game-2048-package/scripts/build.mjs +130 -130
  505. package/examples/game-2048-package/scripts/verify.mjs +180 -180
  506. package/examples/game-2048-package/src/component.css +161 -161
  507. package/examples/game-2048-package/src/components.tsx +326 -326
  508. package/examples/game-2048-package/src/game-engine.ts +228 -228
  509. package/examples/game-2048-package/src/harness.tsx +34 -34
  510. package/examples/game-2048-package/src/manifest.ts +85 -85
  511. package/examples/game-2048-package/src/node-entry.ts +30 -30
  512. package/examples/game-2048-package/src/sample.ts +4 -4
  513. package/examples/game-2048-package/tsconfig.json +15 -15
  514. package/examples/integration/README-ch.md +114 -82
  515. package/examples/integration/README.md +114 -82
  516. package/examples/integration/chat-session/index.mjs +91 -0
  517. package/examples/integration/chat-session/package.json +10 -0
  518. package/examples/integration/core/index.mjs +32 -32
  519. package/examples/integration/extension-sdk/README-ch.md +24 -24
  520. package/examples/integration/extension-sdk/README.md +24 -24
  521. package/examples/integration/static-embed/embed.mjs +44 -0
  522. package/examples/integration/static-embed/index.html +12 -0
  523. package/examples/integration/static-embed/main.mjs +24 -0
  524. package/examples/integration/static-embed/references.mjs +5 -0
  525. package/examples/integration/static-embed/render.mjs +10 -0
  526. package/examples/integration/worker/index.html +19 -19
  527. package/examples/integration/worker/main.js +61 -61
  528. package/examples/integration/worker/package.json +13 -13
  529. package/examples/integration/worker/worker.js +3 -3
  530. package/examples/local/README-ch.md +76 -76
  531. package/examples/local/README.md +76 -76
  532. package/examples/local/charts.reactive.md +73 -73
  533. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  534. package/examples/local/recipes/invoice.reactive.md +36 -36
  535. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  536. package/examples/local/recipes/workshop.reactive.md +33 -33
  537. package/examples/local/showcase/README-ch.md +22 -22
  538. package/examples/local/showcase/README.md +31 -31
  539. package/examples/local/showcase/explore.reactive.md +102 -102
  540. package/examples/local/showcase/flow.reactive.md +86 -86
  541. package/examples/local/showcase/forms.reactive.md +126 -126
  542. package/examples/local/showcase/functions.reactive.md +119 -119
  543. package/examples/local/showcase/layout.reactive.md +100 -100
  544. package/examples/local/showcase/statistics.reactive.md +108 -108
  545. package/examples/local/showcase/tasks.reactive.md +89 -89
  546. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  547. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  548. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  549. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  550. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  551. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  552. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  553. package/examples/minimal-extension/README-ch.md +78 -78
  554. package/examples/minimal-extension/README.md +78 -78
  555. package/examples/minimal-extension/index.html +15 -15
  556. package/examples/minimal-extension/package.json +26 -26
  557. package/examples/minimal-extension/sample/document.reactive.md +10 -10
  558. package/examples/minimal-extension/scripts/build.mjs +32 -32
  559. package/examples/minimal-extension/scripts/export.mjs +72 -72
  560. package/examples/minimal-extension/scripts/test-node.mjs +75 -75
  561. package/examples/minimal-extension/src/extension.tsx +90 -90
  562. package/examples/minimal-extension/src/preview.tsx +12 -12
  563. package/examples/minimal-extension/src/source.ts +4 -4
  564. package/examples/minimal-extension/tsconfig.json +14 -14
  565. package/examples/sci-fi-theme/README-ch.md +133 -133
  566. package/examples/sci-fi-theme/README.md +148 -148
  567. package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
  568. package/examples/sci-fi-theme/demo/demo.css +638 -638
  569. package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
  570. package/examples/sci-fi-theme/demo/index.html +13 -13
  571. package/examples/sci-fi-theme/demo/main.tsx +215 -215
  572. package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
  573. package/examples/sci-fi-theme/docs/design-system.md +474 -474
  574. package/examples/sci-fi-theme/package.json +28 -28
  575. package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
  576. package/examples/sci-fi-theme/src/components.css +2370 -2370
  577. package/examples/sci-fi-theme/src/index.ts +6 -6
  578. package/examples/sci-fi-theme/src/notch.css +142 -142
  579. package/examples/sci-fi-theme/src/sci-fi.css +7 -7
  580. package/examples/sci-fi-theme/src/theme.ts +39 -39
  581. package/examples/sci-fi-theme/tsconfig.json +20 -20
  582. package/examples/sci-fi-theme/vite.config.ts +24 -24
  583. package/examples/tetris-package/LICENSE +21 -21
  584. package/examples/tetris-package/NOTICES.md +11 -11
  585. package/examples/tetris-package/README-ch.md +91 -91
  586. package/examples/tetris-package/README.md +95 -95
  587. package/examples/tetris-package/package.json +35 -35
  588. package/examples/tetris-package/sample/document.reactive.md +16 -16
  589. package/examples/tetris-package/scripts/build-export.mjs +44 -44
  590. package/examples/tetris-package/scripts/build.mjs +130 -130
  591. package/examples/tetris-package/scripts/verify.mjs +173 -173
  592. package/examples/tetris-package/src/component.css +145 -145
  593. package/examples/tetris-package/src/components.tsx +334 -334
  594. package/examples/tetris-package/src/harness.tsx +34 -34
  595. package/examples/tetris-package/src/manifests.ts +93 -93
  596. package/examples/tetris-package/src/node-entry.ts +16 -16
  597. package/examples/tetris-package/src/sample.ts +4 -4
  598. package/examples/tetris-package/src/tetris-engine.ts +325 -325
  599. package/examples/tetris-package/tsconfig.json +15 -15
  600. package/package.json +66 -2
  601. package/dist-library/LocalDocumentView-BuqgJZEY.js +0 -109
  602. package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +0 -275
  603. package/dist-library/authoring-Ci_KzJ0q.js +0 -892
  604. package/dist-library/compile-Dx6Uw3D9.js +0 -1249
  605. package/dist-library/compiler-dxLPB9Ym.js +0 -86
  606. package/dist-library/config-validation-D3D7Dy2J.js +0 -586
  607. package/dist-library/controls-DoZyLCrV.js +0 -6740
  608. package/dist-library/data-table-8-3F15Jf.js +0 -296
  609. package/dist-library/layout-BBB2VF0S.js +0 -562
  610. package/dist-library/mount-preset-DMZ5wd3t.js +0 -13
  611. package/dist-library/options-BBp9IcHm.js +0 -121
  612. package/dist-library/package-core-K5xesGqy.js +0 -117
  613. package/dist-library/parser-standard-CBA1-hdG.js +0 -9630
  614. package/dist-library/plugin-packs-Bh1HhLym.js +0 -19
  615. package/dist-library/preset-core-DeZPA8IE.js +0 -1298
  616. package/dist-library/props-sJ8vk0cr.js +0 -183
  617. package/dist-library/react-0DCh-Mar.js +0 -7
  618. package/dist-library/registry-core-C9xOunaw.js +0 -479
  619. package/dist-library/resources-B0x_w3s9.js +0 -229
  620. package/dist-library/runtime-BpQdZmFI.js +0 -1288
  621. package/dist-library/schema-BryM_VRW.js +0 -40
  622. package/dist-library/sdk-core-ChslheKs.js +0 -1167
  623. package/dist-library/shareable-B8xMoGEa.js +0 -814
  624. package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +0 -6
  625. package/dist-library/types/local/rendering/table/data-table.d.ts +0 -13
  626. package/dist-library/types-daDo2c_w.js +0 -3
  627. package/dist-library/validation-B3RI0xOk.js +0 -1123
  628. package/dist-library/visual-frame-_rcd5HUv.js +0 -48
  629. package/dist-library/visuals-DkDhNdEZ.js +0 -72572
  630. /package/dist-library/types/{local/configuration → contracts}/color-values.d.ts +0 -0
  631. /package/dist-library/types/{local/html → contracts}/html-names.d.ts +0 -0
  632. /package/dist-library/types/{local/configuration → contracts}/schema-core.d.ts +0 -0
  633. /package/dist-library/types/{local → react}/rendering/code/code-block.d.ts +0 -0
  634. /package/dist-library/types/{local → react}/rendering/code/code-languages.d.ts +0 -0
  635. /package/dist-library/types/{local → react}/rendering/document/LocalDocumentView.d.ts +0 -0
  636. /package/dist-library/types/{local → react}/rendering/document/use-color-scheme.d.ts +0 -0
  637. /package/dist-library/types/{local → react}/rendering/image/image-view.d.ts +0 -0
  638. /package/dist-library/types/{local → react}/rendering/math-view.d.ts +0 -0
@@ -0,0 +1,1369 @@
1
+ import { E as e } from "./limits-CFERRrlC.js";
2
+ import { _ as t, l as n, o as r, y as i } from "./document-theme-CJvN-nC1.js";
3
+ import { _ as a, a as o, b as s, o as c, r as l, t as u, x as d } from "./compile-B35rfzKr.js";
4
+ import { i as f, n as p, r as m, t as h } from "./choice-values-BItGjPD2.js";
5
+ import { a as g, c as _, f as v, g as y, i as b, n as x, o as S, p as C, r as ee, t as w, v as T } from "./validation-DRuW0Wl9.js";
6
+ import { n as te, t as E } from "./types-FYhRWRn9.js";
7
+ import { t as D } from "./component-kernel-CsJSabHX.js";
8
+ import { t as O } from "./default-registry-DXJy66xj.js";
9
+ import { x as ne } from "./component-state-CwKX_SN5.js";
10
+ import { i as re, t as ie } from "./identity-BUx0Q_-d.js";
11
+ import { n as ae } from "./runtime-BDnnimPA.js";
12
+ // src/local/runtime/runtime-values.ts
13
+ function k(e, t) {
14
+ return e.attrs?.[t];
15
+ }
16
+ function oe(e, t) {
17
+ let n = k(e, t);
18
+ if (n === "true") return !0;
19
+ if (n === "false") return !1;
20
+ }
21
+ function se(e, t) {
22
+ let n = k(e, t);
23
+ if (n === void 0) return;
24
+ let r = Number(n);
25
+ return Number.isFinite(r) ? r : void 0;
26
+ }
27
+ function A(e) {
28
+ return t(e);
29
+ }
30
+ function j(e, t) {
31
+ return {
32
+ ok: !1,
33
+ detail: n(e, t)
34
+ };
35
+ }
36
+ function M(e, t) {
37
+ if (t !== void 0) return k(e, t);
38
+ }
39
+ function N(e, t) {
40
+ if (t !== void 0) return se(e, t);
41
+ }
42
+ function ce(t, n, r, i = {}) {
43
+ for (let a of r) if (a.kind === "date") {
44
+ if (!D(n)) return j("local.runtime.value.date-invalid");
45
+ let e = i.required ?? (a.required !== void 0 && oe(t, a.required) === !0);
46
+ if (n === "" && e) return j("local.runtime.value.date-required");
47
+ let r = i.min ?? M(t, a.min), o = i.max ?? M(t, a.max);
48
+ if (n !== "" && r && n < r) return j("local.runtime.value.date-earlier", { min: r });
49
+ if (n !== "" && o && n > o) return j("local.runtime.value.date-later", { max: o });
50
+ } else if (a.kind === "required") {
51
+ let e = i.required ?? oe(t, a.required) === !0;
52
+ if (n === "" && e) return j("local.runtime.value.field-required");
53
+ } else if (a.kind === "length") {
54
+ let e = A(n), r = N(t, a.min), i = N(t, a.max);
55
+ if (r !== void 0 && r > 0 && n !== "" && e < r) return j("local.runtime.value.min-length", { min: r });
56
+ if (i !== void 0 && e > i) return j("local.runtime.value.max-length", { max: i });
57
+ } else if (a.kind === "email" && (M(t, a.type) ?? "text") === a.value && n !== "") {
58
+ if (n.length > 254) return j("local.runtime.value.email-length", { limit: 254 });
59
+ if (!e(n)) return j("local.runtime.value.email-invalid");
60
+ }
61
+ return {
62
+ ok: !0,
63
+ value: n
64
+ };
65
+ }
66
+ var P = /* @__PURE__ */ new Map();
67
+ function F(e) {
68
+ if (!e.name) return I;
69
+ let t = P.get(e.name);
70
+ if (t !== void 0) return t ?? I;
71
+ let n = O(e.name), r = n ? T(n) : I;
72
+ return P.set(e.name, n ? r : null), r;
73
+ }
74
+ var I = Object.freeze([]);
75
+ function L(e, t, n, i, a, o = !1) {
76
+ switch (e.type) {
77
+ case "number": {
78
+ if (typeof n != "number" || !Number.isFinite(n)) return j("local.runtime.value.finite-number", { name: e.name });
79
+ let r = e.step ?? 1, a = e.min ?? 0;
80
+ for (let r of t) {
81
+ let t = i(r, "min");
82
+ if (t.present && !t.ok) return j("local.runtime.value.constraint", {
83
+ name: e.name,
84
+ attribute: "min"
85
+ });
86
+ if (t.present && t.ok) {
87
+ if (typeof t.value != "number" || !Number.isFinite(t.value)) return j("local.runtime.value.constraint", {
88
+ name: e.name,
89
+ attribute: "min"
90
+ });
91
+ if (a = t.value, n < t.value) return j("local.runtime.value.min", {
92
+ name: e.name,
93
+ min: t.value
94
+ });
95
+ }
96
+ let o = i(r, "max");
97
+ if (o.present && !o.ok) return j("local.runtime.value.constraint", {
98
+ name: e.name,
99
+ attribute: "max"
100
+ });
101
+ if (o.present && o.ok) {
102
+ if (typeof o.value != "number" || !Number.isFinite(o.value)) return j("local.runtime.value.constraint", {
103
+ name: e.name,
104
+ attribute: "max"
105
+ });
106
+ if (n > o.value) return j("local.runtime.value.max", {
107
+ name: e.name,
108
+ max: o.value
109
+ });
110
+ }
111
+ if (t.present && t.ok && o.present && o.ok && typeof t.value == "number" && typeof o.value == "number" && t.value > o.value) return j("local.runtime.value.constraint-range", { name: e.name });
112
+ }
113
+ return e.min !== void 0 && n < e.min ? j("local.runtime.value.min", {
114
+ name: e.name,
115
+ min: e.min
116
+ }) : e.max !== void 0 && n > e.max ? j("local.runtime.value.max", {
117
+ name: e.name,
118
+ max: e.max
119
+ }) : r > 0 && !ue(n, a, r) ? j("local.runtime.value.step", {
120
+ name: e.name,
121
+ step: r,
122
+ base: a
123
+ }) : {
124
+ ok: !0,
125
+ value: n
126
+ };
127
+ }
128
+ case "boolean": return typeof n == "boolean" ? {
129
+ ok: !0,
130
+ value: n
131
+ } : j("local.runtime.value.boolean", { name: e.name });
132
+ case "string": {
133
+ if (typeof n != "string") return j("local.runtime.value.string", { name: e.name });
134
+ let s = d(n);
135
+ if (s) return j("local.runtime.value.budget", {
136
+ name: e.name,
137
+ detail: r(s),
138
+ detailKey: s.key,
139
+ ...s.params
140
+ });
141
+ for (let r of t) {
142
+ let t = a?.get(r.id) ?? (o ? F(r) : I);
143
+ if (!t.length) continue;
144
+ let s = {};
145
+ for (let n of t) {
146
+ if (n.kind === "date") {
147
+ for (let t of ["min", "max"]) {
148
+ if (n[t] === void 0) continue;
149
+ let a = i(r, t);
150
+ if (a.present) {
151
+ if (!a.ok || typeof a.value != "string" || !D(a.value)) return j("local.runtime.value.constraint-date", {
152
+ name: e.name,
153
+ attribute: t
154
+ });
155
+ s[t] = a.value;
156
+ }
157
+ }
158
+ let t = s.min ?? M(r, n.min), a = s.max ?? M(r, n.max);
159
+ if (t && a && D(t) && D(a) && t > a) return j("local.runtime.value.constraint-range", { name: e.name });
160
+ }
161
+ if ((n.kind === "date" || n.kind === "required" ? n.required : void 0) !== void 0) {
162
+ let t = i(r, "required");
163
+ if (t.present) {
164
+ if (!t.ok || typeof t.value != "boolean") return j("local.runtime.value.constraint", {
165
+ name: e.name,
166
+ attribute: "required"
167
+ });
168
+ s.required = t.value;
169
+ }
170
+ }
171
+ }
172
+ let c = ce(r, n, t, s);
173
+ if (!c.ok) return c;
174
+ }
175
+ return e.options?.length && !e.options.includes(n) ? j("local.runtime.value.option", {
176
+ value: n,
177
+ options: e.options.join(", ")
178
+ }) : {
179
+ ok: !0,
180
+ value: n
181
+ };
182
+ }
183
+ case "array": {
184
+ if (!Array.isArray(n)) return j("local.runtime.value.array", { name: e.name });
185
+ let t = d(n);
186
+ if (t) return j("local.runtime.value.budget", {
187
+ name: e.name,
188
+ detail: r(t),
189
+ detailKey: t.key,
190
+ ...t.params
191
+ });
192
+ for (let t of n) if (typeof t != "string") return j("local.runtime.value.array-members", { name: e.name });
193
+ if (e.family === "collection") return e.maxItems !== void 0 && n.length > e.maxItems ? j("local.runtime.value.max-items", {
194
+ name: e.name,
195
+ max: e.maxItems
196
+ }) : {
197
+ ok: !0,
198
+ value: n.slice()
199
+ };
200
+ let i = /* @__PURE__ */ new Set();
201
+ for (let t of n) {
202
+ if (e.options && !e.options.includes(t)) return j("local.runtime.value.checklist-option", { value: t });
203
+ i.add(t);
204
+ }
205
+ let a = e.options ? e.options.filter((e) => i.has(e)) : [...i];
206
+ return e.maxItems !== void 0 && a.length > e.maxItems ? j("local.runtime.value.max-items", {
207
+ name: e.name,
208
+ max: e.maxItems
209
+ }) : {
210
+ ok: !0,
211
+ value: a
212
+ };
213
+ }
214
+ case "number-array": {
215
+ if (!Array.isArray(n)) return j("local.runtime.value.number-array", { name: e.name });
216
+ let t = d(n);
217
+ if (t) return j("local.runtime.value.budget", {
218
+ name: e.name,
219
+ detail: r(t),
220
+ detailKey: t.key,
221
+ ...t.params
222
+ });
223
+ for (let t of n) if (typeof t != "number" || !Number.isFinite(t)) return j("local.runtime.value.number-array-members", { name: e.name });
224
+ return e.maxItems !== void 0 && n.length > e.maxItems ? j("local.runtime.value.max-items", {
225
+ name: e.name,
226
+ max: e.maxItems
227
+ }) : {
228
+ ok: !0,
229
+ value: n.slice()
230
+ };
231
+ }
232
+ case "null": return n === null ? {
233
+ ok: !0,
234
+ value: n
235
+ } : j("local.runtime.value.null", { name: e.name });
236
+ }
237
+ return j("local.runtime.value.unsupported-type", { name: e.name });
238
+ }
239
+ function R(e) {
240
+ return e instanceof a ? e : new a("expression-eval", e instanceof Error ? e.message : String(e), 0);
241
+ }
242
+ function le(e, t) {
243
+ switch (e) {
244
+ case "string": {
245
+ if (typeof t != "string") return {
246
+ ok: !1,
247
+ key: "local.runtime.external-value",
248
+ params: { kind: "string" }
249
+ };
250
+ let e = d(t);
251
+ return e ? {
252
+ ok: !1,
253
+ key: "local.runtime.external-budget",
254
+ params: {
255
+ detailKey: e.key,
256
+ ...e.params ?? {}
257
+ }
258
+ } : {
259
+ ok: !0,
260
+ value: t
261
+ };
262
+ }
263
+ case "number": return typeof t == "number" && Number.isFinite(t) ? {
264
+ ok: !0,
265
+ value: t
266
+ } : {
267
+ ok: !1,
268
+ key: "local.runtime.external-value",
269
+ params: { kind: "number" }
270
+ };
271
+ case "boolean": return typeof t == "boolean" ? {
272
+ ok: !0,
273
+ value: t
274
+ } : {
275
+ ok: !1,
276
+ key: "local.runtime.external-value",
277
+ params: { kind: "boolean" }
278
+ };
279
+ case "array": {
280
+ if (!Array.isArray(t)) return {
281
+ ok: !1,
282
+ key: "local.runtime.external-value",
283
+ params: { kind: "string-array" }
284
+ };
285
+ for (let e of t) if (typeof e != "string") return {
286
+ ok: !1,
287
+ key: "local.runtime.external-value",
288
+ params: { kind: "string-array" }
289
+ };
290
+ let e = d(t);
291
+ return e ? {
292
+ ok: !1,
293
+ key: "local.runtime.external-budget",
294
+ params: {
295
+ detailKey: e.key,
296
+ ...e.params ?? {}
297
+ }
298
+ } : {
299
+ ok: !0,
300
+ value: t.slice()
301
+ };
302
+ }
303
+ case "number-array": {
304
+ if (!Array.isArray(t)) return {
305
+ ok: !1,
306
+ key: "local.runtime.external-value",
307
+ params: { kind: "number-array" }
308
+ };
309
+ for (let e of t) if (typeof e != "number" || !Number.isFinite(e)) return {
310
+ ok: !1,
311
+ key: "local.runtime.external-value",
312
+ params: { kind: "number-array" }
313
+ };
314
+ let e = d(t);
315
+ return e ? {
316
+ ok: !1,
317
+ key: "local.runtime.external-budget",
318
+ params: {
319
+ detailKey: e.key,
320
+ ...e.params ?? {}
321
+ }
322
+ } : {
323
+ ok: !0,
324
+ value: t.slice()
325
+ };
326
+ }
327
+ default: return {
328
+ ok: !1,
329
+ key: "local.runtime.external-value",
330
+ params: { kind: String(e) }
331
+ };
332
+ }
333
+ }
334
+ var z = 1e-9;
335
+ function B(e) {
336
+ return Array.isArray(e) ? e.slice() : e;
337
+ }
338
+ function ue(e, t, n) {
339
+ let r = (e - t) / n;
340
+ return Math.abs(r - Math.round(r)) <= z * Math.max(1, Math.abs(r));
341
+ }
342
+ function V(e, t, n, i) {
343
+ let a = Math.max(0, Math.min(e.source.length, t.range.start)), o = e.source.slice(0, a).split("\n");
344
+ return {
345
+ code: n,
346
+ message: r(i),
347
+ severity: "error",
348
+ range: {
349
+ start: a,
350
+ end: Math.max(a + 1, Math.min(e.source.length, t.range.end))
351
+ },
352
+ line: o.length,
353
+ column: (o.at(-1) ?? "").length + 1,
354
+ messageKey: i.key,
355
+ phase: "runtime",
356
+ recoverable: !0,
357
+ ...i.params ? { params: i.params } : {}
358
+ };
359
+ }
360
+ function H(e, t, n) {
361
+ return {
362
+ code: e,
363
+ message: t,
364
+ severity: "error",
365
+ range: {
366
+ start: 0,
367
+ end: 0
368
+ },
369
+ line: 1,
370
+ column: 1,
371
+ phase: "runtime",
372
+ recoverable: !0,
373
+ ...n ? {
374
+ messageKey: n.key,
375
+ ...n.params ? { params: n.params } : {}
376
+ } : {}
377
+ };
378
+ }
379
+ // src/local/runtime/runtime-document.ts
380
+ function U(e, t) {
381
+ let n = e.document.bindings[t];
382
+ if (!n) return;
383
+ let { nodeIds: r, owner: i, ...a } = n, o = (e.controls.get(t) ?? []).map((t) => {
384
+ let n = e.document.dynamicConstraints?.[t.id] ?? {};
385
+ return {
386
+ name: t.name ?? null,
387
+ attrs: t.attrs ?? {},
388
+ dynamic: Object.fromEntries(Object.entries(n).map(([e, t]) => [e, t ? {
389
+ source: t.source,
390
+ numeric: t.numeric ?? null
391
+ } : null])),
392
+ rules: e.valueRules.get(t.id) ?? null
393
+ };
394
+ });
395
+ return JSON.stringify({
396
+ facts: a,
397
+ legacy: e.legacyValueRules,
398
+ controls: o
399
+ });
400
+ }
401
+ function W(e, t) {
402
+ let n = t.get(e);
403
+ if (n) return {
404
+ expression: n,
405
+ error: null
406
+ };
407
+ try {
408
+ let n = u(e);
409
+ if (t.size >= 200) {
410
+ let e = t.keys().next().value;
411
+ e !== void 0 && t.delete(e);
412
+ }
413
+ return t.set(e, n), {
414
+ expression: n,
415
+ error: null
416
+ };
417
+ } catch (e) {
418
+ return {
419
+ expression: null,
420
+ error: R(e)
421
+ };
422
+ }
423
+ }
424
+ function de(e, t) {
425
+ let n = /* @__PURE__ */ new Map();
426
+ for (let t of i(e.nodes)) n.set(t.id, t);
427
+ let c = {}, l = /* @__PURE__ */ new Map();
428
+ for (let [t, i] of Object.entries(e.bindings)) {
429
+ let e = d(i.initial);
430
+ if (e) throw new a("expression-budget", `Parameter "${t}": ${r(e)}`, 0);
431
+ c[t] = B(i.initial);
432
+ let o = [];
433
+ for (let e of i.nodeIds) {
434
+ let t = n.get(e);
435
+ t && o.push(t);
436
+ }
437
+ l.set(t, o);
438
+ }
439
+ let u = /* @__PURE__ */ new Map();
440
+ for (let [t, n] of Object.entries(e.bindingSlots ?? {})) u.set(t, { ...n });
441
+ let f = y(e), p = new Map(Object.entries(f?.valueRules ?? {})), m = f === void 0, h = /* @__PURE__ */ new Map();
442
+ if (f) for (let e of f.slotRelations) {
443
+ let t = u.get(e.nodeId), n = t?.[e.lower], r = t?.[e.upper];
444
+ if (!n || !r) continue;
445
+ let i = h.get(e.nodeId) ?? [];
446
+ i.push({
447
+ lower: n,
448
+ upper: r
449
+ }), h.set(e.nodeId, i);
450
+ }
451
+ else for (let [e, t] of u) t.start && t.end && h.set(e, [{
452
+ lower: t.start,
453
+ upper: t.end
454
+ }]);
455
+ let _ = /* @__PURE__ */ new Map();
456
+ for (let [t, n] of Object.entries(e.bindings)) for (let e of n.nodeIds) {
457
+ if (u.has(e)) continue;
458
+ let n = _.get(e);
459
+ (n === void 0 || n.startsWith("@") && !t.startsWith("@")) && _.set(e, t);
460
+ }
461
+ let v = Object.freeze(Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort()), b = /* @__PURE__ */ new Map();
462
+ for (let [e, t] of u) for (let n of Object.values(t)) {
463
+ if (n.startsWith("@")) continue;
464
+ let t = b.get(n) ?? /* @__PURE__ */ new Set();
465
+ t.add(e), b.set(n, t);
466
+ }
467
+ let x = e.computations ?? {}, ee = Object.keys(x), w = /* @__PURE__ */ new Map();
468
+ for (let [e, n] of Object.entries(x)) {
469
+ if (n.kind === "const" && Object.hasOwn(n, "value")) continue;
470
+ let r = W(n.source, t);
471
+ r.expression && w.set(e, r.expression);
472
+ }
473
+ let { order: T, cyclic: te } = C(x), E = o(), D = {}, O = /* @__PURE__ */ new Map();
474
+ for (let e of T) {
475
+ let t = x[e];
476
+ if (!t || t.kind !== "const") continue;
477
+ if (Object.hasOwn(t, "value")) {
478
+ let n = t.value, r = s(n);
479
+ if (r) {
480
+ O.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
481
+ continue;
482
+ }
483
+ D[e] = B(n);
484
+ continue;
485
+ }
486
+ let n = w.get(e);
487
+ if (!n) O.set(e, new a("expression-eval", `Constant "${e}" cannot be evaluated.`, 0));
488
+ else try {
489
+ let t = n.evaluate({ ...D }, E), r = s(t);
490
+ if (r) {
491
+ O.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
492
+ continue;
493
+ }
494
+ D[e] = B(t);
495
+ } catch (t) {
496
+ O.set(e, R(t));
497
+ }
498
+ }
499
+ let ne = /* @__PURE__ */ new Map();
500
+ for (let e of te) ne.set(e, new a("expression-cycle", `Computation "${e}" is part of a dependency cycle.`, 0));
501
+ let re = [];
502
+ if (Array.isArray(e.validations)) for (let n of e.validations) {
503
+ if (!g(n)) continue;
504
+ let e = W(n.expression, t);
505
+ re.push({
506
+ rule: n,
507
+ expression: e.expression,
508
+ error: e.error
509
+ });
510
+ }
511
+ return {
512
+ document: e,
513
+ nodeIndex: n,
514
+ controls: l,
515
+ slotKeys: u,
516
+ publicNames: v,
517
+ publicSlotOwners: b,
518
+ initial: c,
519
+ valueRules: p,
520
+ legacyValueRules: m,
521
+ slotRelations: h,
522
+ bindingByNode: _,
523
+ computationMetadata: x,
524
+ computationNames: ee,
525
+ computationOrder: T,
526
+ cyclicComputations: te,
527
+ computationExpressions: w,
528
+ constValues: D,
529
+ constErrors: O,
530
+ cycleErrors: ne,
531
+ validationRules: re,
532
+ validationLineStarts: S(typeof e.source == "string" ? e.source : "")
533
+ };
534
+ }
535
+ function fe(e) {
536
+ return !e || e.syntax !== "local" ? "createLocalRuntime requires a local interaction document." : e.syntaxVersion !== void 0 && e.syntaxVersion !== "local-draft-4" || e.versionDeclaration && e.versionDeclaration.version !== "local-draft-4" ? `createLocalRuntime requires ${E}; migrate the source before constructing a runtime.` : null;
537
+ }
538
+ function G(e, t) {
539
+ return (e.controls.get(t.name) ?? [])[0] ?? (t.owner ? e.nodeIndex.get(t.owner) : void 0) ?? (t.nodeIds[0] ? e.nodeIndex.get(t.nodeIds[0]) : void 0);
540
+ }
541
+ function K(e, t, n) {
542
+ let i = G(e, t);
543
+ return i ? V(e.document, i, "local.runtime.value", n) : H("local.runtime.value", r(n));
544
+ }
545
+ function q(e, t, n) {
546
+ let r = e.slotRelations.get(t);
547
+ return r?.length ? r.some(({ lower: e, upper: t }) => {
548
+ let r = n[e], i = n[t];
549
+ return typeof r == "number" && typeof i == "number" && r > i;
550
+ }) : !1;
551
+ }
552
+ function pe(e, t) {
553
+ let i = e.nodeIndex.get(t);
554
+ return i ? V(e.document, i, "local.runtime.value", n("local.runtime.value.range-order")) : H("local.runtime.value", r(n("local.runtime.value.range-order")));
555
+ }
556
+ // src/local/runtime/retention.ts
557
+ function me(e) {
558
+ let t = /* @__PURE__ */ new Map();
559
+ for (let n of i(e.nodes)) t.set(n.id, n);
560
+ return t;
561
+ }
562
+ function J(e, t, n) {
563
+ let r = e.bindingSlots?.[t.id];
564
+ return r !== void 0 && Object.values(r).includes(n);
565
+ }
566
+ function he(e, t, n) {
567
+ let r = t.name ? O(t.name) : void 0;
568
+ if (r?.bindings) {
569
+ let i = e.bindingSlots?.[t.id];
570
+ for (let [e, a] of Object.entries(r.bindings)) if (t.attrs?.[a.bind] === n || e !== "value" && i?.[e] === n) return a.retain === !1 ? void 0 : a.initial;
571
+ } else if (t.attrs?.bind === n || J(e, t, n)) return "initial";
572
+ }
573
+ function ge(e) {
574
+ let t = me(e), n = y(e), r = new Set(n?.retentionExclusions ?? []), i = /* @__PURE__ */ new Map();
575
+ for (let [a, o] of Object.entries(e.bindings)) {
576
+ let s = o.nodeIds.flatMap((e) => {
577
+ let n = t.get(e);
578
+ return n ? [n] : [];
579
+ });
580
+ if (!s.length || a.startsWith("@") || r.has(a)) continue;
581
+ let c;
582
+ if (n === void 0) {
583
+ let t = s.map((t) => he(e, t, a));
584
+ if (t.some((e) => e === void 0)) continue;
585
+ c = t;
586
+ } else {
587
+ let e = n.bindingAttributes?.[a]?.initial ?? "initial";
588
+ c = s.map(() => e);
589
+ }
590
+ let l = s.flatMap((e, t) => Object.hasOwn(e.attrs ?? {}, c[t]) ? [e.attrs[c[t]]] : []).sort();
591
+ i.set(a, {
592
+ type: o.type,
593
+ initialDefinition: JSON.stringify([o.initial, l])
594
+ });
595
+ }
596
+ return i;
597
+ }
598
+ function Y(e, t) {
599
+ return Object.freeze({
600
+ name: e,
601
+ reason: t
602
+ });
603
+ }
604
+ function _e(e) {
605
+ let t = ge(e.previous), n = ge(e.next), r = {}, i = [], a = [];
606
+ for (let o of Object.keys(e.state).sort()) {
607
+ if (o.startsWith("@")) {
608
+ a.push(Y(o, "internal"));
609
+ continue;
610
+ }
611
+ if (!Object.hasOwn(e.previous.bindings, o) || !Object.hasOwn(e.next.bindings, o)) {
612
+ a.push(Y(o, "unknown"));
613
+ continue;
614
+ }
615
+ let s = t.get(o), c = n.get(o);
616
+ if (!s || !c) {
617
+ a.push(Y(o, "unretainable"));
618
+ continue;
619
+ }
620
+ if (s.type !== c.type) {
621
+ a.push(Y(o, "type"));
622
+ continue;
623
+ }
624
+ if (s.initialDefinition !== c.initialDefinition) {
625
+ a.push(Y(o, "initial"));
626
+ continue;
627
+ }
628
+ let l = e.state[o];
629
+ r[o] = Array.isArray(l) ? Object.freeze([...l]) : l, i.push(o);
630
+ }
631
+ return Object.freeze({
632
+ values: Object.freeze(r),
633
+ retained: Object.freeze(i),
634
+ dropped: Object.freeze(a)
635
+ });
636
+ }
637
+ function ve(e, t, n) {
638
+ return Object.freeze({
639
+ retained: Object.freeze([...e]),
640
+ dropped: Object.freeze(t.map((e) => Object.freeze({ ...e }))),
641
+ diagnostics: Object.freeze([...n])
642
+ });
643
+ }
644
+ function ye(e, t) {
645
+ let n = Object.keys(t.values).sort();
646
+ if (!e.setParameters(t.values).length) return ve(n, t.dropped, []);
647
+ let r = [], i = n, a = [];
648
+ for (; i.length;) {
649
+ let n = [];
650
+ a = [];
651
+ for (let o of i) {
652
+ let i = e.setParameter(o, t.values[o]);
653
+ i.length ? (n.push(o), a.push(...i)) : r.push(o);
654
+ }
655
+ if (n.length === i.length) break;
656
+ i = n;
657
+ }
658
+ r.sort();
659
+ let o = [...t.dropped, ...i.map((e) => Y(e, "invalid"))];
660
+ return o.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)), ve(r, o, a);
661
+ }
662
+ // src/local/runtime/runtime-migration.ts
663
+ function be(e, t, n, r, i) {
664
+ let a = _e({
665
+ previous: e.document,
666
+ state: t,
667
+ next: n
668
+ }), o = {}, s = n.macroConfigKey !== void 0 && n.macroConfigKey === e.document.macroConfigKey && n.source === e.document.source;
669
+ for (let [e, r] of Object.entries(n.bindings)) o[e] = B(s && e.startsWith("@macro:") && Object.hasOwn(t, e) ? t[e] : r.initial);
670
+ let c = /* @__PURE__ */ new Map();
671
+ for (let e of a.dropped) c.set(e.name, Object.freeze({ ...e }));
672
+ let l = [], u = {}, d = [], f = /* @__PURE__ */ new Set(), p, m = (n) => {
673
+ let o = e.document.bindings[n], s = e.controls.get(n) ?? [];
674
+ return !o || !s.some((t) => e.document.dynamicConstraints?.[t.id]) || (p ??= i({}, e, t), L(o, s, a.values[n], p, e.valueRules, e.legacyValueRules).ok) ? !1 : U(e, n) === U(r, n);
675
+ };
676
+ for (let e of a.retained) {
677
+ let t = n.bindings[e];
678
+ if (!t) continue;
679
+ if (m(e)) {
680
+ f.add(e), u[e] = B(a.values[e]), d.push(e);
681
+ continue;
682
+ }
683
+ let s = L(t, r.controls.get(e) ?? [], a.values[e], i(a.values, r, o), r.valueRules, r.legacyValueRules);
684
+ s.ok ? (u[e] = B(s.value), d.push(e)) : (l.push(K(r, t, s.detail)), c.set(e, Object.freeze({
685
+ name: e,
686
+ reason: "invalid"
687
+ })));
688
+ }
689
+ let h = {
690
+ ...o,
691
+ ...u
692
+ }, g = /* @__PURE__ */ new Set();
693
+ for (let e of d) for (let t of r.publicSlotOwners.get(e) ?? []) g.add(t);
694
+ let _ = !1;
695
+ for (let e of [...g].sort()) if (q(r, e, h)) {
696
+ _ = !0;
697
+ break;
698
+ }
699
+ let v;
700
+ if (!_) Object.assign(o, u), v = d;
701
+ else {
702
+ v = [];
703
+ for (let e of d) {
704
+ let t = o[e];
705
+ o[e] = u[e];
706
+ let n = !1;
707
+ for (let t of [...r.publicSlotOwners.get(e) ?? []].sort()) q(r, t, o) && (l.push(pe(r, t)), n = !0);
708
+ n ? (o[e] = t, c.set(e, Object.freeze({
709
+ name: e,
710
+ reason: "invalid"
711
+ }))) : v.push(e);
712
+ }
713
+ }
714
+ for (let [e, t] of r.slotRelations) if (q(r, e, o)) {
715
+ for (let e of t) for (let t of [e.lower, e.upper]) {
716
+ let e = n.bindings[t];
717
+ if (!e) continue;
718
+ o[t] = B(e.initial);
719
+ let r = v.indexOf(t);
720
+ r >= 0 && v.splice(r, 1), c.set(t, Object.freeze({
721
+ name: t,
722
+ reason: "invalid"
723
+ }));
724
+ }
725
+ if (l.push(pe(r, e)), q(r, e, o)) return {
726
+ values: {},
727
+ retained: [],
728
+ dropped: [],
729
+ diagnostics: []
730
+ };
731
+ }
732
+ let y = !0;
733
+ for (; y;) {
734
+ let e = i({}, r, o), t = [];
735
+ for (let i of v) {
736
+ if (f.has(i)) continue;
737
+ let a = n.bindings[i], s = L(a, r.controls.get(i) ?? [], o[i], e, r.valueRules, r.legacyValueRules);
738
+ s.ok || (l.push(K(r, a, s.detail)), t.push(i));
739
+ }
740
+ for (let e of t) o[e] = B(n.bindings[e].initial), v.splice(v.indexOf(e), 1), c.set(e, Object.freeze({
741
+ name: e,
742
+ reason: "invalid"
743
+ }));
744
+ y = t.length > 0;
745
+ }
746
+ let b = [...c.values()].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name));
747
+ return v.sort(), {
748
+ values: o,
749
+ retained: v,
750
+ dropped: b,
751
+ diagnostics: l
752
+ };
753
+ }
754
+ // src/local/runtime/runtime-choices.ts
755
+ function xe(e, t, n, r) {
756
+ try {
757
+ if (e.kind === "options") {
758
+ let i = n(e.source);
759
+ return i ? f(i.evaluate(t, r)) : null;
760
+ }
761
+ let i = e.staticKeys[0], a = e.staticKeys.every((e) => i && e.length === i.length && e.every((e, t) => e === i?.[t]));
762
+ for (let o of e.sources) {
763
+ let e = n(o.rows)?.evaluate(t, r), s = n(o.key);
764
+ if (!e || !s) return null;
765
+ if (!Array.isArray(e) || e.length > o.maxRows) return [];
766
+ let c = /* @__PURE__ */ new Set();
767
+ for (let [n, i] of e.entries()) {
768
+ let e = h(s.evaluate(p(i, n, s.dependencies, (e) => t[e]), r));
769
+ if (e === null || c.has(e)) return [];
770
+ c.add(e);
771
+ }
772
+ let l = [...c];
773
+ i && (l.length !== i.length || l.some((e, t) => e !== i?.[t])) && (a = !1), i ??= l;
774
+ }
775
+ return a ? [...i ?? []] : [];
776
+ } catch {
777
+ return null;
778
+ }
779
+ }
780
+ function Se(e, t, n, r, i) {
781
+ if (r === null) return i && n !== "" && (!Array.isArray(n) || n.length !== 0) ? { ok: !1 } : {
782
+ ok: !0,
783
+ value: n
784
+ };
785
+ if (!i && t.kind === "options") return {
786
+ ok: !0,
787
+ value: m(r, n, e.type === "array", e.maxItems) ?? n
788
+ };
789
+ if (e.type === "array") {
790
+ let t = new Set(Array.isArray(n) ? n : []), a = r.filter((e) => t.has(e));
791
+ return i && a.length !== t.size ? { ok: !1 } : {
792
+ ok: !0,
793
+ value: a.slice(0, e.maxItems ?? a.length)
794
+ };
795
+ }
796
+ let a = t.kind === "rows" ? "" : r[0] ?? "";
797
+ return typeof n == "string" && (n === a || r.includes(n)) ? {
798
+ ok: !0,
799
+ value: n
800
+ } : i ? { ok: !1 } : {
801
+ ok: !0,
802
+ value: a
803
+ };
804
+ }
805
+ // src/local/runtime/runtime.ts
806
+ function Ce(e) {
807
+ return {
808
+ ...e,
809
+ range: { ...e.range },
810
+ ...e.details ? { details: { ...e.details } } : {}
811
+ };
812
+ }
813
+ function X(e, t) {
814
+ return Array.isArray(e) || Array.isArray(t) ? !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((e, n) => e === t[n]) : e === t;
815
+ }
816
+ function we(e) {
817
+ for (let [t, n] of Object.entries(e)) Array.isArray(n) && !Object.isFrozen(n) && (e[t] = Object.freeze([...n]));
818
+ return Object.freeze(e);
819
+ }
820
+ var Z = /* @__PURE__ */ new WeakMap();
821
+ function Q(e, t) {
822
+ let n = Z.get(e);
823
+ if (n) return n.restore(t);
824
+ let r = Object.entries(t);
825
+ if (r.some(([e]) => e.startsWith("@"))) throw TypeError("Private state restoration requires a runtime created by createLocalRuntime.");
826
+ let i = e.getParameters(), a = new Set(e.document.choiceConstraints?.map((e) => e.binding)), o = new Set(Object.values(e.document.bindingSlots ?? {}).flatMap((e) => Object.values(e)));
827
+ return e.setParameters(Object.fromEntries(r.filter(([e, t]) => a.has(e) || o.has(e) || !X(i[e], t))));
828
+ }
829
+ function $(e) {
830
+ return Object.freeze({
831
+ ok: e.ok,
832
+ changed: e.changed,
833
+ revision: e.revision,
834
+ retained: Object.freeze([...e.retained]),
835
+ dropped: Object.freeze(e.dropped.map((e) => Object.freeze({ ...e }))),
836
+ diagnostics: Object.freeze([...e.diagnostics])
837
+ });
838
+ }
839
+ function Te(e, t, n) {
840
+ let r = Z.get(e);
841
+ if (!r) throw TypeError("updateLocalRuntime requires a runtime created by createLocalRuntime.");
842
+ return r.update(t, n?.notify !== !1);
843
+ }
844
+ function Ee(e) {
845
+ Z.get(e)?.notify();
846
+ }
847
+ function De(e, t, n) {
848
+ return Z.get(e)?.bindNetworkExternals(t, n) ?? (() => {});
849
+ }
850
+ function Oe(e, t) {
851
+ let s = fe(e);
852
+ if (s) throw Error(s);
853
+ let f = t?.services === void 0, p = ne(t?.network), m = /* @__PURE__ */ new Map(), h = re(e.source), g = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), S = de(e, y), C = () => S, T = () => {
854
+ let e = /* @__PURE__ */ new Set();
855
+ for (let n of i(S.document.nodes)) n.name !== void 0 && e.add(ie({
856
+ documentId: t?.documentId,
857
+ sourceDigest: h,
858
+ nodeId: n.id,
859
+ stateKey: n.attrs?.["state-key"]
860
+ }));
861
+ return e;
862
+ }, E = t?.services ?? ae({
863
+ documentId: t?.documentId,
864
+ sourceDigest: h,
865
+ randomSeed: t?.randomSeed,
866
+ componentState: t?.componentState,
867
+ ...t?.componentStateStorage === void 0 ? {} : { componentStateStorage: t.componentStateStorage },
868
+ ...t?.componentStateWriteDelayMs === void 0 ? {} : { componentStateWriteDelayMs: t.componentStateWriteDelayMs },
869
+ ...t?.configKey === void 0 ? {} : { configKey: t.configKey },
870
+ ...t?.legacyConfigKeys === void 0 ? {} : { legacyConfigKeys: t.legacyConfigKeys },
871
+ ...f ? { knownStateKeys: T } : {}
872
+ }), D = {}, O = /* @__PURE__ */ new Map();
873
+ for (let [n, r] of Object.entries(e.externals ?? {})) {
874
+ let e = t?.externalValues?.[n];
875
+ if (e === void 0) continue;
876
+ let i = le(r.type, e);
877
+ i.ok && (D[n] = i.value);
878
+ }
879
+ let k = (e, t) => {
880
+ let n = {};
881
+ for (let [r, i] of Object.entries(e.document.externals ?? {})) {
882
+ if (!Object.hasOwn(t, r)) continue;
883
+ let e = le(i.type, t[r]);
884
+ e.ok && (n[r] = e.value);
885
+ }
886
+ return n;
887
+ }, oe = (e) => {
888
+ let t = k(e, D);
889
+ for (let n of O.keys()) Object.assign(t, k(e, n));
890
+ return t;
891
+ }, se = (e, t, n, r, i) => {
892
+ let a = r.document.dynamicConstraints?.[e.id]?.[t];
893
+ if (!a) return { present: !1 };
894
+ let o = W(a.source, y);
895
+ if (!o.expression) return {
896
+ present: !0,
897
+ ok: !1
898
+ };
899
+ try {
900
+ let e = o.expression.evaluate(n, i), t = a.numeric;
901
+ return t && (typeof e != "number" || !Number.isFinite(e) || t.integer === !0 && !Number.isInteger(e) || t.min !== void 0 && e < t.min || t.max !== void 0 && e > t.max) ? {
902
+ present: !0,
903
+ ok: !1
904
+ } : {
905
+ present: !0,
906
+ ok: !0,
907
+ value: e
908
+ };
909
+ } catch {
910
+ return {
911
+ present: !0,
912
+ ok: !1
913
+ };
914
+ }
915
+ }, A = S.initial, j = 0, M = {}, N = {}, ce = {
916
+ revision: 0,
917
+ state: we({})
918
+ }, P = !1, F = null, I = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Map(), z = () => {
919
+ if (P) throw Error("The local interaction runtime has been disposed.");
920
+ };
921
+ function ue(e, t) {
922
+ if (!t.startsWith("@") && Object.hasOwn(e.document.bindings, t)) return Object.hasOwn(A, t) ? A[t] : void 0;
923
+ }
924
+ let U = (e, t, n) => {
925
+ let r = oe(e), i = /* @__PURE__ */ new Map();
926
+ for (let t of Object.keys(e.document.externals ?? {})) Object.hasOwn(r, t) || i.set(t, new a("external-missing", "External data \"" + t + "\" is not available.", 0));
927
+ let o = {
928
+ ...t,
929
+ ...r
930
+ }, s = {}, c = { ...o }, l = i;
931
+ if (e.computationNames.length > 0) {
932
+ let t = v(e.computationMetadata, e.computationOrder, e.computationExpressions, o, e.constValues, i, n);
933
+ s = t.values, c = t.environment, l = [...e.constErrors, ...e.cycleErrors];
934
+ }
935
+ for (let [e, t] of l) Object.hasOwn(c, e) || Object.defineProperty(c, e, {
936
+ enumerable: !0,
937
+ configurable: !0,
938
+ get() {
939
+ throw t;
940
+ }
941
+ });
942
+ return {
943
+ environment: c,
944
+ snapshotState: {
945
+ ...o,
946
+ ...s
947
+ }
948
+ };
949
+ }, G = (e, t, r = [], i = o()) => {
950
+ let a = t, s, c = [], l = new Set(r);
951
+ for (let r of e.document.choiceConstraints ?? []) {
952
+ let o = r.binding;
953
+ if (!Object.hasOwn(e.document.bindings, o)) continue;
954
+ let u = e.document.bindings[o];
955
+ s ??= U(e, a, i);
956
+ let d = xe(r, s.environment, (e) => W(e, y).expression, i), f = Se(u, r, a[o], d, l.has(o));
957
+ f.ok ? X(f.value, a[o]) || (a === t && (a = { ...t }), a[o] = f.value, e.computationNames.length ? s = void 0 : (s.environment[o] = f.value, s.snapshotState[o] = f.value)) : c.push(K(e, u, n(d === null ? "local.runtime.choice.unavailable" : "local.runtime.choice.member")));
958
+ }
959
+ return {
960
+ values: a,
961
+ layer: s ?? U(e, a, i),
962
+ diagnostics: c,
963
+ stage: i
964
+ };
965
+ }, me = ({ values: e, layer: t }) => {
966
+ A = e, M = t.environment, N = t.snapshotState;
967
+ }, J = (e, t = C(), n = A) => {
968
+ let r;
969
+ return (i, a) => t.document.dynamicConstraints?.[i.id]?.[a] ? (r ??= G(t, {
970
+ ...n,
971
+ ...e
972
+ }, Object.keys(e)), se(i, a, r.layer.environment, t, r.stage)) : { present: !1 };
973
+ }, he = () => {
974
+ ce = {
975
+ revision: j,
976
+ state: we(N)
977
+ };
978
+ }, ge = () => {
979
+ for (let e of I) e();
980
+ }, Y = (e, t) => {
981
+ let n = G(C(), e, t);
982
+ return n.diagnostics.length ? n.diagnostics : (t && n.values !== e && Object.keys(n.values).every((e) => X(A[e], n.values[e])) || (me(n), j += 1, he(), ge()), []);
983
+ }, _e = () => {
984
+ Y(A);
985
+ }, ve = (e, t = D) => {
986
+ if (z(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setExternalValues requires an object of external values.");
987
+ let i = [], a = {}, o = Object.keys(e).sort();
988
+ for (let t of o) {
989
+ if (t === "__proto__") {
990
+ i.push(H("local.runtime.external", "External names cannot be \"__proto__\"."));
991
+ continue;
992
+ }
993
+ let o = C().document.externals ?? {}, s = Object.hasOwn(o, t) ? o[t] : void 0;
994
+ if (!s) {
995
+ let e = n("local.runtime.external", { name: t });
996
+ i.push(H("local.runtime.external", r(e), e));
997
+ continue;
998
+ }
999
+ let c = le(s.type, e[t]);
1000
+ if (c.ok) a[t] = c.value;
1001
+ else {
1002
+ let e = n(c.key, {
1003
+ name: t,
1004
+ ...c.params ?? {}
1005
+ });
1006
+ i.push(H("local.runtime.external", r(e), e));
1007
+ }
1008
+ }
1009
+ return i.length ? i : (o.some((e) => !X(t[e], a[e])) && (Object.assign(t, a), _e()), []);
1010
+ }, ye = (e, t) => {
1011
+ if (P) return () => {};
1012
+ let n = {}, r = e.bindExternalValues((e) => {
1013
+ if (P || !O.has(n)) return;
1014
+ let r = ve(e, n);
1015
+ r.length && t?.(r);
1016
+ });
1017
+ return r ? (O.set(n, r), () => {
1018
+ O.delete(n) && (r(), !P && Object.keys(n).length && _e());
1019
+ }) : () => {};
1020
+ }, Q = (e, t = !1) => {
1021
+ z();
1022
+ let n = C(), r = [], i = {}, a = Object.keys(e).sort(), o = J(e);
1023
+ for (let s of a) {
1024
+ if (s === "__proto__") {
1025
+ r.push(H("local.runtime.parameter", "Parameter names cannot be \"__proto__\"."));
1026
+ continue;
1027
+ }
1028
+ if (!t && s.startsWith("@")) {
1029
+ r.push(H("local.runtime.parameter", `Internal parameter "${s}" cannot be written by name.`));
1030
+ continue;
1031
+ }
1032
+ if (!Object.hasOwn(n.document.bindings, s)) {
1033
+ r.push(H("local.runtime.parameter", `Unknown parameter "${s}".`));
1034
+ continue;
1035
+ }
1036
+ let a = n.document.bindings[s], c = n.controls.get(s) ?? [];
1037
+ if (t && X(A[s], e[s]) && (e[s] === "" && a.initial === "" || c.every((e) => !n.document.dynamicConstraints?.[e.id]))) {
1038
+ i[s] = A[s];
1039
+ continue;
1040
+ }
1041
+ let l = L(a, c, e[s], o, n.valueRules, n.legacyValueRules);
1042
+ l.ok ? i[s] = B(l.value) : r.push(K(n, a, l.detail));
1043
+ }
1044
+ if (r.length) return r;
1045
+ if (!a.some((e) => !X(A[e], i[e]))) return [];
1046
+ let s = {
1047
+ ...A,
1048
+ ...i
1049
+ }, c = /* @__PURE__ */ new Set();
1050
+ for (let e of a) {
1051
+ let r = t ? n.document.bindings[e].nodeIds : n.publicSlotOwners.get(e) ?? [];
1052
+ for (let e of r) n.slotKeys.has(e) && c.add(e);
1053
+ }
1054
+ for (let e of [...c].sort()) q(n, e, s) && r.push(pe(n, e));
1055
+ return r.length ? r : Y(s, a);
1056
+ }, Te = (e) => {
1057
+ let t = g.get(e);
1058
+ if (!t) {
1059
+ if (t = u(e), g.size >= 200) {
1060
+ let e = g.keys().next().value;
1061
+ e !== void 0 && g.delete(e);
1062
+ }
1063
+ g.set(e, t);
1064
+ }
1065
+ return t;
1066
+ }, Ee = () => {
1067
+ let e = o(), t = C(), n = [], r = typeof t.document.source == "string" ? t.document.source : "";
1068
+ for (let i of t.validationRules) {
1069
+ if (i.error) {
1070
+ n.push(_(r, t.validationLineStarts, i.rule, w, b(`Validation expression is invalid: ${i.error.message}`)));
1071
+ continue;
1072
+ }
1073
+ if (!i.expression) continue;
1074
+ let a;
1075
+ try {
1076
+ a = i.expression.evaluate(M, e);
1077
+ } catch (e) {
1078
+ n.push(_(r, t.validationLineStarts, i.rule, w, b(`Validation expression failed: ${e instanceof Error ? e.message : String(e)}`)));
1079
+ continue;
1080
+ }
1081
+ typeof a == "boolean" ? a || n.push(_(r, t.validationLineStarts, i.rule, x, De(i.rule.message, e))) : n.push(_(r, t.validationLineStarts, i.rule, w, "Validation expression must evaluate to a boolean."));
1082
+ }
1083
+ return n;
1084
+ }, De = (e, t) => {
1085
+ let n;
1086
+ try {
1087
+ n = l(e, M, t);
1088
+ } catch {
1089
+ n = ee;
1090
+ }
1091
+ return b(n);
1092
+ }, Oe = (e, t) => {
1093
+ if (z(), e === S.document) return $({
1094
+ ok: !0,
1095
+ changed: !1,
1096
+ revision: j,
1097
+ retained: [],
1098
+ dropped: [],
1099
+ diagnostics: []
1100
+ });
1101
+ if (fe(e)) return $({
1102
+ ok: !1,
1103
+ changed: !1,
1104
+ revision: j,
1105
+ retained: [],
1106
+ dropped: [],
1107
+ diagnostics: []
1108
+ });
1109
+ let n;
1110
+ try {
1111
+ n = de(e, y);
1112
+ } catch {
1113
+ return $({
1114
+ ok: !1,
1115
+ changed: !1,
1116
+ revision: j,
1117
+ retained: [],
1118
+ dropped: [],
1119
+ diagnostics: []
1120
+ });
1121
+ }
1122
+ let r = be(S, A, e, n, J);
1123
+ if (Object.keys(r.values).length === 0 && Object.keys(e.bindings).length > 0) return $({
1124
+ ok: !1,
1125
+ changed: !1,
1126
+ revision: j,
1127
+ retained: [],
1128
+ dropped: [],
1129
+ diagnostics: []
1130
+ });
1131
+ let i;
1132
+ try {
1133
+ i = G(n, r.values);
1134
+ } catch {
1135
+ return $({
1136
+ ok: !1,
1137
+ changed: !1,
1138
+ revision: j,
1139
+ retained: [],
1140
+ dropped: [],
1141
+ diagnostics: []
1142
+ });
1143
+ }
1144
+ for (let e of [D, ...O.keys()]) {
1145
+ let t = k(n, e);
1146
+ for (let t of Object.keys(e)) delete e[t];
1147
+ Object.assign(e, t);
1148
+ }
1149
+ if (S = n, me(i), F = null, j += 1, he(), t) for (let e of I) e();
1150
+ let a = r.retained.filter((e) => X(r.values[e], A[e])), o = r.retained.filter((e) => !X(r.values[e], A[e])), s = [...r.dropped, ...o.map((e) => ({
1151
+ name: e,
1152
+ reason: "invalid"
1153
+ }))];
1154
+ return $({
1155
+ ok: !0,
1156
+ changed: !0,
1157
+ revision: j,
1158
+ retained: a,
1159
+ dropped: s.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)),
1160
+ diagnostics: r.diagnostics
1161
+ });
1162
+ }, ke = (e) => {
1163
+ let t = /* @__PURE__ */ new Set();
1164
+ for (let n of i([e])) t.add(n.id);
1165
+ return t;
1166
+ }, Ae = {
1167
+ network: p.network,
1168
+ get document() {
1169
+ return S.document;
1170
+ },
1171
+ services: E,
1172
+ snapshot() {
1173
+ return z(), ce;
1174
+ },
1175
+ get(e, t) {
1176
+ z();
1177
+ let n = C(), r = n.nodeIndex.get(e.id);
1178
+ if (!r) return null;
1179
+ let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ?? te(r) : n.slotKeys.get(r.id)?.[t];
1180
+ return i && Object.hasOwn(A, i) ? B(A[i]) : null;
1181
+ },
1182
+ set(e, t, r) {
1183
+ z();
1184
+ let i = C(), a = i.nodeIndex.get(e.id);
1185
+ if (!a) return [V(i.document, e, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
1186
+ let o = i.slotKeys.get(a.id), s;
1187
+ if (r === void 0) {
1188
+ if (o && !o.value) return [V(i.document, a, "local.runtime.binding", n("local.runtime.binding.needs-slot"))];
1189
+ s = o?.value ?? i.bindingByNode.get(a.id) ?? te(a);
1190
+ } else if (s = o?.[r], !s) return [V(i.document, a, "local.runtime.binding", n("local.runtime.binding.unknown-slot", { slot: r }))];
1191
+ let c = Object.hasOwn(i.document.bindings, s) ? i.document.bindings[s] : void 0;
1192
+ if (!c) return [V(i.document, a, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
1193
+ let l = L(c, i.controls.get(s) ?? [], t, J({ [s]: t }), i.valueRules, i.legacyValueRules);
1194
+ if (!l.ok) return [V(i.document, a, "local.runtime.value", l.detail)];
1195
+ let u = B(l.value);
1196
+ if (X(A[s], u)) return [];
1197
+ let d = {
1198
+ ...A,
1199
+ [s]: u
1200
+ };
1201
+ return q(i, a.id, d) ? [V(i.document, a, "local.runtime.value", n("local.runtime.value.range-order"))] : Y(d, [s]);
1202
+ },
1203
+ setMany(e, t) {
1204
+ z();
1205
+ let r = C(), i = r.nodeIndex.get(e.id);
1206
+ if (!i) return [V(r.document, e, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
1207
+ let a = r.slotKeys.get(i.id);
1208
+ if (!a) return [V(r.document, i, "local.runtime.binding", n("local.runtime.binding.no-multi-slot"))];
1209
+ let o = Object.entries(t);
1210
+ if (!o.length) return [];
1211
+ let s = { ...A }, c = Object.fromEntries(o.map(([e, t]) => [a[e], t])), l = J(c, r);
1212
+ for (let [e, t] of o) {
1213
+ let o = a[e];
1214
+ if (!o || !Object.hasOwn(r.document.bindings, o)) return [V(r.document, i, "local.runtime.binding", n("local.runtime.binding.unknown-slot", { slot: e }))];
1215
+ let c = L(r.document.bindings[o], r.controls.get(o) ?? [], t, l, r.valueRules, r.legacyValueRules);
1216
+ if (!c.ok) return [V(r.document, i, "local.runtime.value", c.detail)];
1217
+ s[o] = B(c.value);
1218
+ }
1219
+ return q(r, i.id, s) ? [V(r.document, i, "local.runtime.value", n("local.runtime.value.range-order"))] : o.every(([e, t]) => X(A[a[e]], t)) ? [] : Y(s, o.map(([e]) => a[e]));
1220
+ },
1221
+ parameterNames() {
1222
+ return z(), C().publicNames;
1223
+ },
1224
+ getParameter(e) {
1225
+ z();
1226
+ let t = ue(C(), e);
1227
+ return t === void 0 ? void 0 : B(t);
1228
+ },
1229
+ getParameters() {
1230
+ z();
1231
+ let e = C(), t = {};
1232
+ for (let n of e.publicNames) {
1233
+ let e = A[n];
1234
+ t[n] = Array.isArray(e) ? Object.freeze([...e]) : e;
1235
+ }
1236
+ return Object.freeze(t);
1237
+ },
1238
+ readSubmissionFields(e) {
1239
+ z();
1240
+ let t = C(), n = /* @__PURE__ */ new Map(), r = o(), i = (e, n) => se(e, n, M, t, r);
1241
+ if (e.length === 0) return {
1242
+ ok: !1,
1243
+ field: "",
1244
+ reason: "unavailable"
1245
+ };
1246
+ for (let r of e) {
1247
+ let e = ue(t, r);
1248
+ if (e === void 0 || n.has(r)) return {
1249
+ ok: !1,
1250
+ field: r,
1251
+ reason: "unavailable"
1252
+ };
1253
+ let a = L(t.document.bindings[r], t.controls.get(r) ?? [], e, i, t.valueRules, t.legacyValueRules);
1254
+ if (!a.ok) {
1255
+ let e = a.detail.key;
1256
+ return {
1257
+ ok: !1,
1258
+ field: r,
1259
+ reason: e === "local.runtime.value.field-required" || e === "local.runtime.value.date-required" ? "required" : "invalid"
1260
+ };
1261
+ }
1262
+ n.set(r, e);
1263
+ }
1264
+ let a = Object.create(null);
1265
+ for (let [e, r] of n) {
1266
+ for (let [n, i] of m.get(e) ?? []) {
1267
+ if (!t.controls.get(e)?.some((e) => e.id === i)) continue;
1268
+ let a = n(B(r));
1269
+ if (a) return {
1270
+ ok: !1,
1271
+ field: e,
1272
+ reason: a
1273
+ };
1274
+ }
1275
+ a[e] = Array.isArray(r) ? Object.freeze([...r]) : r;
1276
+ }
1277
+ return {
1278
+ ok: !0,
1279
+ payload: Object.freeze(a)
1280
+ };
1281
+ },
1282
+ registerSubmissionField(e, t) {
1283
+ if (P) return () => {};
1284
+ let n = C(), r = n.slotKeys.get(e.id)?.value ?? n.bindingByNode.get(e.id);
1285
+ if (!r || r.startsWith("@")) return () => {};
1286
+ let i = m.get(r);
1287
+ return i || m.set(r, i = /* @__PURE__ */ new Map()), i.set(t, e.id), () => {
1288
+ i.delete(t), i.size === 0 && m.get(r) === i && m.delete(r);
1289
+ };
1290
+ },
1291
+ setParameter(e, t) {
1292
+ z();
1293
+ let n = Object.create(null);
1294
+ return n[e] = t, Q(n);
1295
+ },
1296
+ setParameters(e) {
1297
+ if (z(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setParameters requires an object of parameter values.");
1298
+ return Q(e);
1299
+ },
1300
+ getExternal(e) {
1301
+ if (z(), Object.hasOwn(C().document.externals ?? {}, e) && Object.hasOwn(N, e)) return B(N[e]);
1302
+ },
1303
+ getExternalValues() {
1304
+ z();
1305
+ let e = {};
1306
+ for (let [t, n] of Object.entries(oe(C()))) e[t] = Array.isArray(n) ? Object.freeze([...n]) : n;
1307
+ return Object.freeze(e);
1308
+ },
1309
+ setExternalValues(e) {
1310
+ return ve(e);
1311
+ },
1312
+ evaluate(e) {
1313
+ z();
1314
+ let t = Te(e).evaluate(M, c() ?? o());
1315
+ return Array.isArray(t) ? t.slice() : t;
1316
+ },
1317
+ validate() {
1318
+ if (z(), F && F.revision === j) return F.diagnostics.map(Ce);
1319
+ let e = Ee();
1320
+ return F = {
1321
+ revision: j,
1322
+ diagnostics: e
1323
+ }, e.map(Ce);
1324
+ },
1325
+ text(e) {
1326
+ return z(), l(e, M, c() ?? o());
1327
+ },
1328
+ reset(e) {
1329
+ z();
1330
+ let t = C(), n = t.nodeIndex.get(e.id);
1331
+ if (!n) return;
1332
+ let i = ke(n), o = { ...A };
1333
+ for (let [e, n] of Object.entries(t.document.bindings)) {
1334
+ if (!(t.controls.get(e) ?? []).some((e) => i.has(e.id))) continue;
1335
+ let s = d(n.initial);
1336
+ if (s) throw new a("expression-budget", `Parameter "${e}": ${r(s)}`, 0);
1337
+ o[e] = B(n.initial);
1338
+ }
1339
+ for (let e of i) R.set(e, (R.get(e) ?? 0) + 1);
1340
+ Y(o);
1341
+ },
1342
+ resetToken(e) {
1343
+ z();
1344
+ let t = C().nodeIndex.get(e.id);
1345
+ return t ? R.get(t.id) ?? 0 : 0;
1346
+ },
1347
+ subscribe(e) {
1348
+ return z(), I.add(e), () => {
1349
+ I.delete(e);
1350
+ };
1351
+ },
1352
+ dispose() {
1353
+ if (!P) {
1354
+ P = !0, p.dispose();
1355
+ for (let e of O.values()) e();
1356
+ O.clear(), m.clear(), E.state.flush(), f && E.scheduler.dispose(), I.clear(), g.clear(), y.clear(), S.computationExpressions.clear(), S.constErrors.clear(), S.cycleErrors.clear(), S.validationRules.length = 0, R.clear();
1357
+ }
1358
+ }
1359
+ };
1360
+ return Z.set(Ae, {
1361
+ update: Oe,
1362
+ restore: (e) => Q(e, !0),
1363
+ bindNetworkExternals: ye,
1364
+ notify() {
1365
+ if (!P) for (let e of I) e();
1366
+ }
1367
+ }), me(G(C(), A)), he(), ye(p), Ae;
1368
+ }
1369
+ export { Te as a, Q as i, Oe as n, ye as o, Ee as r, _e as s, De as t };