reactive-md 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/CHANGELOG-ch.md +333 -319
  2. package/CHANGELOG.md +334 -320
  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/bin/reactive-md.mjs +39 -39
  11. package/cli/args.mjs +263 -263
  12. package/cli/assets.mjs +395 -395
  13. package/cli/build.mjs +445 -445
  14. package/cli/check.mjs +444 -444
  15. package/cli/document.mjs +130 -130
  16. package/cli/errors.mjs +61 -61
  17. package/cli/fs-utils.mjs +133 -133
  18. package/cli/glob.mjs +203 -203
  19. package/cli/help.mjs +323 -323
  20. package/cli/init.mjs +1577 -1577
  21. package/cli/lint.mjs +177 -177
  22. package/cli/main.mjs +65 -65
  23. package/cli/migrate.mjs +368 -368
  24. package/cli/package-loader.mjs +41 -41
  25. package/cli/package.mjs +211 -211
  26. package/dist-library/{LocalDocumentView-sthUP0ct.js → LocalDocumentView-BuqgJZEY.js} +11 -11
  27. package/dist-library/{LocalDocumentViewCore-GiWV3bey.js → LocalDocumentViewCore-DXE0I0Qc.js} +210 -209
  28. package/dist-library/{LocalReactiveDocumentCore-ZjQSGyHE.js → LocalReactiveDocumentCore-CWBe4Mm5.js} +8 -8
  29. package/dist-library/{authoring-Dsune4Hy.js → authoring-Ci_KzJ0q.js} +53 -53
  30. package/dist-library/{compile-wUv8KEge.js → compile-Dx6Uw3D9.js} +11 -11
  31. package/dist-library/{compiler-core-As_m-MNm.js → compiler-core-DDDdvuLy.js} +883 -818
  32. package/dist-library/compiler-dxLPB9Ym.js +86 -0
  33. package/dist-library/{component-state-C52ZFJGl.js → component-state-BRwvTV0d.js} +15 -14
  34. package/dist-library/component-state-CwKX_SN5.js +763 -0
  35. package/dist-library/{config-BadfhjdP.js → config-DXLvctiZ.js} +68 -66
  36. package/dist-library/config-validation-D3D7Dy2J.js +586 -0
  37. package/dist-library/{controls-CcT6n7k_.js → controls-DoZyLCrV.js} +3 -3
  38. package/dist-library/{coordinate-CWS9p5q_.js → coordinate-B1VFK9fd.js} +2 -2
  39. package/dist-library/{data-table-Bgccxd7h.js → data-table-8-3F15Jf.js} +3 -3
  40. package/dist-library/{default-components-BwQf0oP-.js → default-components-s21NevON.js} +29 -28
  41. package/dist-library/{display-B-VhqVND.js → display-B_uutKkN.js} +1 -1
  42. package/dist-library/{config-validation-F47AcE6o.js → document-theme-C8J6UyNO.js} +193 -731
  43. package/dist-library/{export-BqVmTXm8.js → export-CIAIPBov.js} +35 -34
  44. package/dist-library/{gallery-CY6mTx8i.js → gallery-Dv1rOvL0.js} +1 -1
  45. package/dist-library/{html-CNT4KD-2.js → html-Cr4CBwAH.js} +42 -41
  46. package/dist-library/identity-BUx0Q_-d.js +40 -0
  47. package/dist-library/{incremental-Dv0FSp_U.js → incremental-9nx92u9c.js} +12 -10
  48. package/dist-library/{layout-C0YlEPGr.js → layout-BBB2VF0S.js} +1 -1
  49. package/dist-library/{mount-preset-KxvtKgJb.js → mount-preset-DMZ5wd3t.js} +3 -3
  50. package/dist-library/observability-4KqXhIEU.js +421 -0
  51. package/dist-library/observability-core-Bcu7vpnl.js +24 -0
  52. package/dist-library/{options-1aDLK7JY.js → options-BBp9IcHm.js} +4 -4
  53. package/dist-library/{package-core-WFK1RhAZ.js → package-core-K5xesGqy.js} +30 -29
  54. package/dist-library/{parser-standard-Yuf3A_VI.js → parser-standard-CBA1-hdG.js} +352 -352
  55. package/dist-library/{plugin-packs-B1XPWcFs.js → plugin-packs-Bh1HhLym.js} +3 -2
  56. package/dist-library/preset-core-DeZPA8IE.js +1298 -0
  57. package/dist-library/react-0DCh-Mar.js +7 -0
  58. package/dist-library/reactive-md-authoring.js +19 -19
  59. package/dist-library/reactive-md-build.js +48 -10
  60. package/dist-library/reactive-md-compiler-standard.js +6 -6
  61. package/dist-library/reactive-md-compiler.js +3 -3
  62. package/dist-library/reactive-md-default-packs.js +3 -2
  63. package/dist-library/reactive-md-default-preset.js +3 -2
  64. package/dist-library/reactive-md-export.js +4 -4
  65. package/dist-library/reactive-md-minimal-preset.js +2 -2
  66. package/dist-library/reactive-md-minimal-react-preset.js +3 -3
  67. package/dist-library/reactive-md-observability.js +4 -0
  68. package/dist-library/reactive-md-plugin-chart.js +3 -3
  69. package/dist-library/reactive-md-plugin-data.js +5 -5
  70. package/dist-library/reactive-md-plugin-diagram.js +4 -4
  71. package/dist-library/reactive-md-plugin-forms.js +4 -4
  72. package/dist-library/reactive-md-plugin-gallery.js +3 -3
  73. package/dist-library/reactive-md-plugin-navigation.js +3 -3
  74. package/dist-library/reactive-md-plugin-network.js +4 -3
  75. package/dist-library/reactive-md-plugin-plot.js +4 -4
  76. package/dist-library/reactive-md-print.css +304 -304
  77. package/dist-library/reactive-md-react-minimal.js +4 -4
  78. package/dist-library/reactive-md-react-server.js +6 -6
  79. package/dist-library/reactive-md-react-unstyled.js +11 -11
  80. package/dist-library/reactive-md-react.js +11 -11
  81. package/dist-library/reactive-md-runtime-browser.js +2 -1
  82. package/dist-library/reactive-md-runtime.js +4 -3
  83. package/dist-library/reactive-md-sdk.js +8 -7
  84. package/dist-library/reactive-md-standalone-configured.js +2 -2
  85. package/dist-library/reactive-md-standalone-host.js +2 -2
  86. package/dist-library/reactive-md-testing-browser.js +2 -2
  87. package/dist-library/reactive-md-testing-react.js +6 -6
  88. package/dist-library/reactive-md-testing.js +5 -5
  89. package/dist-library/reactive-md.js +556 -367
  90. package/dist-library/{registry-B9NGct4d.js → registry-D6OGkOcX.js} +3 -3
  91. package/dist-library/{registry-core-Bbad9Bm2.js → registry-core-C9xOunaw.js} +1 -1
  92. package/dist-library/{resources-D2GDQS0p.js → resources-B0x_w3s9.js} +71 -46
  93. package/dist-library/{runtime-B2fxeveq.js → runtime-BDnnimPA.js} +17 -16
  94. package/dist-library/{runtime-kcA7bG7G.js → runtime-BpQdZmFI.js} +311 -305
  95. package/dist-library/{schema-BufhKUSM.js → schema-BryM_VRW.js} +14 -14
  96. package/dist-library/{sdk-core-BoJT1SIt.js → sdk-core-ChslheKs.js} +33 -32
  97. package/dist-library/{session-core-nmJHuR9c.js → session-core-dxQCJBNa.js} +15 -14
  98. package/dist-library/{shareable-DpbE-59H.js → shareable-B8xMoGEa.js} +179 -176
  99. package/dist-library/types/build/diagnostics.d.ts +1 -1
  100. package/dist-library/types/local/index.d.ts +6 -0
  101. package/dist-library/types/local/observability-codes.d.ts +2 -0
  102. package/dist-library/types/local/observability-core.d.ts +25 -0
  103. package/dist-library/types/local/observability-messages.d.ts +6 -0
  104. package/dist-library/types/local/observability.d.ts +43 -0
  105. package/dist-library/types/local/parsing/parser-internals.d.ts +2 -1
  106. package/dist-library/types/local/transport/worker.d.ts +52 -1
  107. package/dist-library/types/local/types.d.ts +8 -0
  108. package/dist-library/types/observability.d.ts +7 -0
  109. package/dist-library/{types-BeNtPqdY.js → types-Ib5kSScP.js} +1 -1
  110. package/dist-library/types-daDo2c_w.js +3 -0
  111. package/dist-library/{validation-BEBA_HvS.js → validation-B3RI0xOk.js} +251 -249
  112. package/dist-library/version-DAxuGOG2.js +147 -0
  113. package/dist-library/{visual-frame-CyV1FXzs.js → visual-frame-_rcd5HUv.js} +1 -1
  114. package/dist-library/{visuals-BZbZYA7w.js → visuals-DkDhNdEZ.js} +17 -17
  115. package/dist-standalone/reactive-md-standalone.js +118 -118
  116. package/docs/README-ch.md +101 -95
  117. package/docs/README.md +101 -95
  118. package/docs/compatibility/api-stability-ch.md +25 -0
  119. package/docs/compatibility/api-stability-en.md +25 -0
  120. package/docs/compatibility/compatibility-ch.md +146 -129
  121. package/docs/compatibility/compatibility-en.md +146 -129
  122. package/docs/compatibility/compatibility-manifest.schema.json +161 -0
  123. package/docs/compatibility/deprecation-ch.md +21 -0
  124. package/docs/compatibility/deprecation-en.md +21 -0
  125. package/docs/compatibility/source-versioning-ch.md +162 -162
  126. package/docs/compatibility/source-versioning-en.md +162 -162
  127. package/docs/compatibility/support-matrix-ch.md +108 -0
  128. package/docs/compatibility/support-matrix-en.md +108 -0
  129. package/docs/development/component-development-ch.md +66 -66
  130. package/docs/development/component-development-en.md +66 -66
  131. package/docs/development/component-development-reference-ch.md +253 -253
  132. package/docs/development/component-development-reference-en.md +238 -238
  133. package/docs/development/component-protocol-ch.md +748 -748
  134. package/docs/development/component-protocol-en.md +750 -750
  135. package/docs/development/extension-tutorial-ch.md +308 -308
  136. package/docs/development/extension-tutorial-en.md +308 -308
  137. package/docs/development/performance-overview-ch.md +422 -422
  138. package/docs/development/performance-overview-en.md +422 -422
  139. package/docs/guides/local-guide-ch.md +532 -532
  140. package/docs/guides/local-guide-en.md +532 -532
  141. package/docs/integration/author-tools-ch.md +64 -64
  142. package/docs/integration/author-tools-en.md +64 -64
  143. package/docs/integration/compiler-ch.md +49 -49
  144. package/docs/integration/compiler-en.md +36 -36
  145. package/docs/integration/directory-discovery-en.md +1 -1
  146. package/docs/integration/editor-ch.md +295 -295
  147. package/docs/integration/editor-en.md +303 -303
  148. package/docs/integration/extension-sdk-ch.md +394 -394
  149. package/docs/integration/extension-sdk-en.md +379 -379
  150. package/docs/integration/local-integration-ch.md +646 -646
  151. package/docs/integration/local-integration-en.md +662 -662
  152. package/docs/integration/shareable-export-ch.md +307 -307
  153. package/docs/integration/shareable-export-en.md +309 -309
  154. package/docs/reference/diagnostics-counting-ch.md +104 -104
  155. package/docs/reference/diagnostics-counting-en.md +104 -104
  156. package/docs/reference/html-compatibility-ch.md +93 -93
  157. package/docs/reference/html-compatibility-en.md +95 -95
  158. package/docs/reference/local-interaction-syntax-ch.md +724 -724
  159. package/docs/reference/local-interaction-syntax-en.md +722 -722
  160. package/docs/reference/public-api-ch.md +33 -4
  161. package/docs/reference/public-api-en.md +33 -4
  162. package/docs/reference/theme-protocol-ch.md +198 -198
  163. package/docs/reference/theme-protocol-en.md +217 -217
  164. package/docs/releases/release-0.4.0-ch.md +91 -91
  165. package/docs/releases/release-0.4.0-en.md +91 -91
  166. package/docs/releases/release-0.4.1-ch.md +25 -25
  167. package/docs/releases/release-0.4.1-en.md +25 -25
  168. package/docs/releases/release-0.5.0-ch.md +43 -43
  169. package/docs/releases/release-0.5.0-en.md +43 -43
  170. package/docs/releases/release-0.5.1-ch.md +41 -41
  171. package/docs/releases/release-0.5.1-en.md +41 -41
  172. package/docs/releases/release-0.5.2-ch.md +37 -37
  173. package/docs/releases/release-0.5.2-en.md +37 -37
  174. package/docs/releases/release-0.5.3-ch.md +26 -26
  175. package/docs/releases/release-0.5.3-en.md +26 -26
  176. package/docs/releases/release-0.6.0-ch.md +59 -59
  177. package/docs/releases/release-0.6.0-en.md +59 -59
  178. package/docs/releases/release-0.6.1-ch.md +29 -29
  179. package/docs/releases/release-0.6.1-en.md +29 -29
  180. package/docs/releases/release-0.7.0-ch.md +86 -86
  181. package/docs/releases/release-0.7.0-en.md +86 -86
  182. package/docs/releases/release-0.9.2-ch.md +33 -0
  183. package/docs/releases/release-0.9.2-en.md +33 -0
  184. package/examples/component-package/README-ch.md +101 -101
  185. package/examples/component-package/README.md +133 -133
  186. package/examples/conformance/README-ch.md +55 -55
  187. package/examples/conformance/README.md +55 -55
  188. package/examples/conformance/component-protocol-1.json +482 -482
  189. package/examples/conformance/component-protocol-1.schema.json +76 -76
  190. package/examples/conformance/local-draft-1.json +50 -50
  191. package/examples/conformance/local-draft-2.json +212 -212
  192. package/examples/game-2048-package/LICENSE +21 -21
  193. package/examples/game-2048-package/NOTICES.md +11 -11
  194. package/examples/game-2048-package/README-ch.md +91 -91
  195. package/examples/game-2048-package/README.md +98 -98
  196. package/examples/game-2048-package/package.json +35 -35
  197. package/examples/game-2048-package/sample/document.reactive.md +17 -17
  198. package/examples/game-2048-package/scripts/build-export.mjs +44 -44
  199. package/examples/game-2048-package/scripts/build.mjs +130 -130
  200. package/examples/game-2048-package/scripts/verify.mjs +180 -180
  201. package/examples/game-2048-package/src/component.css +161 -161
  202. package/examples/game-2048-package/src/components.tsx +326 -326
  203. package/examples/game-2048-package/src/game-engine.ts +228 -228
  204. package/examples/game-2048-package/src/harness.tsx +34 -34
  205. package/examples/game-2048-package/src/manifest.ts +85 -85
  206. package/examples/game-2048-package/src/node-entry.ts +30 -30
  207. package/examples/game-2048-package/src/sample.ts +4 -4
  208. package/examples/game-2048-package/tsconfig.json +15 -15
  209. package/examples/integration/README-ch.md +82 -82
  210. package/examples/integration/README.md +82 -82
  211. package/examples/integration/core/index.mjs +32 -32
  212. package/examples/integration/extension-sdk/README-ch.md +24 -24
  213. package/examples/integration/extension-sdk/README.md +24 -24
  214. package/examples/integration/worker/index.html +19 -19
  215. package/examples/integration/worker/main.js +61 -61
  216. package/examples/integration/worker/package.json +13 -13
  217. package/examples/integration/worker/worker.js +3 -3
  218. package/examples/local/README-ch.md +76 -76
  219. package/examples/local/README.md +76 -76
  220. package/examples/local/charts.reactive.md +73 -73
  221. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  222. package/examples/local/recipes/invoice.reactive.md +36 -36
  223. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  224. package/examples/local/recipes/workshop.reactive.md +33 -33
  225. package/examples/local/showcase/README-ch.md +22 -22
  226. package/examples/local/showcase/README.md +31 -31
  227. package/examples/local/showcase/explore.reactive.md +102 -102
  228. package/examples/local/showcase/flow.reactive.md +86 -86
  229. package/examples/local/showcase/forms.reactive.md +126 -126
  230. package/examples/local/showcase/functions.reactive.md +119 -119
  231. package/examples/local/showcase/layout.reactive.md +100 -100
  232. package/examples/local/showcase/statistics.reactive.md +108 -108
  233. package/examples/local/showcase/tasks.reactive.md +89 -89
  234. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  235. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  236. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  237. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  238. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  239. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  240. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  241. package/examples/minimal-extension/README-ch.md +78 -78
  242. package/examples/minimal-extension/README.md +78 -78
  243. package/examples/minimal-extension/index.html +15 -15
  244. package/examples/minimal-extension/package.json +26 -26
  245. package/examples/minimal-extension/sample/document.reactive.md +10 -10
  246. package/examples/minimal-extension/scripts/build.mjs +32 -32
  247. package/examples/minimal-extension/scripts/export.mjs +72 -72
  248. package/examples/minimal-extension/scripts/test-node.mjs +75 -75
  249. package/examples/minimal-extension/src/extension.tsx +90 -90
  250. package/examples/minimal-extension/src/preview.tsx +12 -12
  251. package/examples/minimal-extension/src/source.ts +4 -4
  252. package/examples/minimal-extension/tsconfig.json +14 -14
  253. package/examples/sci-fi-theme/README-ch.md +133 -133
  254. package/examples/sci-fi-theme/README.md +148 -148
  255. package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
  256. package/examples/sci-fi-theme/demo/demo.css +638 -638
  257. package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
  258. package/examples/sci-fi-theme/demo/index.html +13 -13
  259. package/examples/sci-fi-theme/demo/main.tsx +215 -215
  260. package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
  261. package/examples/sci-fi-theme/docs/design-system.md +474 -474
  262. package/examples/sci-fi-theme/package.json +28 -28
  263. package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
  264. package/examples/sci-fi-theme/src/components.css +2370 -2370
  265. package/examples/sci-fi-theme/src/index.ts +6 -6
  266. package/examples/sci-fi-theme/src/notch.css +142 -142
  267. package/examples/sci-fi-theme/src/sci-fi.css +7 -7
  268. package/examples/sci-fi-theme/src/theme.ts +39 -39
  269. package/examples/sci-fi-theme/tsconfig.json +20 -20
  270. package/examples/sci-fi-theme/vite.config.ts +24 -24
  271. package/examples/tetris-package/LICENSE +21 -21
  272. package/examples/tetris-package/NOTICES.md +11 -11
  273. package/examples/tetris-package/README-ch.md +91 -91
  274. package/examples/tetris-package/README.md +95 -95
  275. package/examples/tetris-package/package.json +35 -35
  276. package/examples/tetris-package/sample/document.reactive.md +16 -16
  277. package/examples/tetris-package/scripts/build-export.mjs +44 -44
  278. package/examples/tetris-package/scripts/build.mjs +130 -130
  279. package/examples/tetris-package/scripts/verify.mjs +173 -173
  280. package/examples/tetris-package/src/component.css +145 -145
  281. package/examples/tetris-package/src/components.tsx +334 -334
  282. package/examples/tetris-package/src/harness.tsx +34 -34
  283. package/examples/tetris-package/src/manifests.ts +93 -93
  284. package/examples/tetris-package/src/node-entry.ts +16 -16
  285. package/examples/tetris-package/src/sample.ts +4 -4
  286. package/examples/tetris-package/src/tetris-engine.ts +325 -325
  287. package/examples/tetris-package/tsconfig.json +15 -15
  288. package/package.json +7 -1
  289. package/dist-library/compiler-eOfcinZs.js +0 -62
  290. package/dist-library/component-state-BoLCGee4.js +0 -801
  291. package/dist-library/preset-core-CKc5YXSM.js +0 -1443
  292. package/dist-library/react-D5iGiUdL.js +0 -7
@@ -1,121 +1,123 @@
1
- import { dt as e } from "./preset-core-CKc5YXSM.js";
2
- import { B as t, H as n, P as r, j as i } from "./config-validation-F47AcE6o.js";
3
- import { a, c as o, r as s, s as c, t as l } from "./compile-wUv8KEge.js";
4
- import { C as u, S as d, a as f, c as p, h as m, i as h, l as g, n as _, o as v, p as y, r as b, t as x, u as S } from "./validation-BEBA_HvS.js";
5
- import { i as C } from "./registry-core-Bbad9Bm2.js";
6
- import { t as w } from "./registry-B9NGct4d.js";
7
- import { A as ee, C as te, b as T } from "./component-state-BoLCGee4.js";
8
- import { n as E } from "./runtime-B2fxeveq.js";
1
+ import { j as e } from "./version-DAxuGOG2.js";
2
+ import { _ as t, l as n, o as r, y as i } from "./document-theme-C8J6UyNO.js";
3
+ import { a, c as o, r as s, s as c, t as l } from "./compile-Dx6Uw3D9.js";
4
+ import { a as u, c as d, h as f, i as p, l as ee, n as m, o as h, p as g, r as _, t as v, u as y } from "./validation-B3RI0xOk.js";
5
+ import { n as b, t as x } from "./types-daDo2c_w.js";
6
+ import { i as S } from "./registry-core-C9xOunaw.js";
7
+ import { t as C } from "./registry-D6OGkOcX.js";
8
+ import { x as te } from "./component-state-CwKX_SN5.js";
9
+ import { i as ne, t as w } from "./identity-BUx0Q_-d.js";
10
+ import { n as T } from "./runtime-BDnnimPA.js";
9
11
  // src/local/runtime/runtime-values.ts
10
- function D(e, t) {
12
+ function E(e, t) {
11
13
  return e.attrs?.[t];
12
14
  }
13
- function O(e, t) {
14
- let n = D(e, t);
15
+ function D(e, t) {
16
+ let n = E(e, t);
15
17
  if (n === "true") return !0;
16
18
  if (n === "false") return !1;
17
19
  }
18
- function k(e, t) {
19
- let n = D(e, t);
20
+ function O(e, t) {
21
+ let n = E(e, t);
20
22
  if (n === void 0) return;
21
23
  let r = Number(n);
22
24
  return Number.isFinite(r) ? r : void 0;
23
25
  }
24
- function A(e) {
26
+ function k(e) {
25
27
  return t(e);
26
28
  }
27
- function j(e, t) {
29
+ function A(e, t) {
28
30
  return {
29
31
  ok: !1,
30
- detail: r(e, t)
32
+ detail: n(e, t)
31
33
  };
32
34
  }
33
- function M(e, t) {
34
- if (t !== void 0) return D(e, t);
35
+ function j(e, t) {
36
+ if (t !== void 0) return E(e, t);
35
37
  }
36
- function N(e, t) {
37
- if (t !== void 0) return k(e, t);
38
+ function M(e, t) {
39
+ if (t !== void 0) return O(e, t);
38
40
  }
39
- function P(t, n, r, i = {}) {
41
+ function N(t, n, r, i = {}) {
40
42
  for (let a of r) if (a.kind === "date") {
41
- if (!C(n)) return j("local.runtime.value.date-invalid");
42
- let e = i.required ?? (a.required !== void 0 && O(t, a.required) === !0);
43
- if (n === "" && e) return j("local.runtime.value.date-required");
44
- let r = i.min ?? M(t, a.min), o = i.max ?? M(t, a.max);
45
- if (n !== "" && r && n < r) return j("local.runtime.value.date-earlier", { min: r });
46
- if (n !== "" && o && n > o) return j("local.runtime.value.date-later", { max: o });
43
+ if (!S(n)) return A("local.runtime.value.date-invalid");
44
+ let e = i.required ?? (a.required !== void 0 && D(t, a.required) === !0);
45
+ if (n === "" && e) return A("local.runtime.value.date-required");
46
+ let r = i.min ?? j(t, a.min), o = i.max ?? j(t, a.max);
47
+ if (n !== "" && r && n < r) return A("local.runtime.value.date-earlier", { min: r });
48
+ if (n !== "" && o && n > o) return A("local.runtime.value.date-later", { max: o });
47
49
  } else if (a.kind === "required") {
48
- let e = i.required ?? O(t, a.required) === !0;
49
- if (n === "" && e) return j("local.runtime.value.field-required");
50
+ let e = i.required ?? D(t, a.required) === !0;
51
+ if (n === "" && e) return A("local.runtime.value.field-required");
50
52
  } else if (a.kind === "length") {
51
- let e = A(n), r = N(t, a.min), i = N(t, a.max);
52
- if (r !== void 0 && r > 0 && n !== "" && e < r) return j("local.runtime.value.min-length", { min: r });
53
- if (i !== void 0 && e > i) return j("local.runtime.value.max-length", { max: i });
54
- } else if (a.kind === "email" && (M(t, a.type) ?? "text") === a.value && n !== "") {
55
- if (n.length > 254) return j("local.runtime.value.email-length", { limit: 254 });
56
- if (!e(n)) return j("local.runtime.value.email-invalid");
53
+ let e = k(n), r = M(t, a.min), i = M(t, a.max);
54
+ if (r !== void 0 && r > 0 && n !== "" && e < r) return A("local.runtime.value.min-length", { min: r });
55
+ if (i !== void 0 && e > i) return A("local.runtime.value.max-length", { max: i });
56
+ } else if (a.kind === "email" && (j(t, a.type) ?? "text") === a.value && n !== "") {
57
+ if (n.length > 254) return A("local.runtime.value.email-length", { limit: 254 });
58
+ if (!e(n)) return A("local.runtime.value.email-invalid");
57
59
  }
58
60
  return {
59
61
  ok: !0,
60
62
  value: n
61
63
  };
62
64
  }
63
- var F = /* @__PURE__ */ new Map();
64
- function I(e) {
65
- if (!e.name) return L;
66
- let t = F.get(e.name);
67
- if (t !== void 0) return t ?? L;
68
- let n = w(e.name), r = n ? m(n) : L;
69
- return F.set(e.name, n ? r : null), r;
65
+ var P = /* @__PURE__ */ new Map();
66
+ function F(e) {
67
+ if (!e.name) return I;
68
+ let t = P.get(e.name);
69
+ if (t !== void 0) return t ?? I;
70
+ let n = C(e.name), r = n ? f(n) : I;
71
+ return P.set(e.name, n ? r : null), r;
70
72
  }
71
- var L = Object.freeze([]);
72
- function R(e, t, n, r, a, s = !1) {
73
+ var I = Object.freeze([]);
74
+ function L(e, t, n, i, a, s = !1) {
73
75
  switch (e.type) {
74
76
  case "number": {
75
- if (typeof n != "number" || !Number.isFinite(n)) return j("local.runtime.value.finite-number", { name: e.name });
76
- let i = e.step ?? 1, a = e.min ?? 0;
77
- for (let i of t) {
78
- let t = r(i, "min");
79
- if (t.present && !t.ok) return j("local.runtime.value.constraint", {
77
+ if (typeof n != "number" || !Number.isFinite(n)) return A("local.runtime.value.finite-number", { name: e.name });
78
+ let r = e.step ?? 1, a = e.min ?? 0;
79
+ for (let r of t) {
80
+ let t = i(r, "min");
81
+ if (t.present && !t.ok) return A("local.runtime.value.constraint", {
80
82
  name: e.name,
81
83
  attribute: "min"
82
84
  });
83
85
  if (t.present && t.ok) {
84
- if (typeof t.value != "number" || !Number.isFinite(t.value)) return j("local.runtime.value.constraint", {
86
+ if (typeof t.value != "number" || !Number.isFinite(t.value)) return A("local.runtime.value.constraint", {
85
87
  name: e.name,
86
88
  attribute: "min"
87
89
  });
88
- if (a = t.value, n < t.value) return j("local.runtime.value.min", {
90
+ if (a = t.value, n < t.value) return A("local.runtime.value.min", {
89
91
  name: e.name,
90
92
  min: t.value
91
93
  });
92
94
  }
93
- let o = r(i, "max");
94
- if (o.present && !o.ok) return j("local.runtime.value.constraint", {
95
+ let o = i(r, "max");
96
+ if (o.present && !o.ok) return A("local.runtime.value.constraint", {
95
97
  name: e.name,
96
98
  attribute: "max"
97
99
  });
98
100
  if (o.present && o.ok) {
99
- if (typeof o.value != "number" || !Number.isFinite(o.value)) return j("local.runtime.value.constraint", {
101
+ if (typeof o.value != "number" || !Number.isFinite(o.value)) return A("local.runtime.value.constraint", {
100
102
  name: e.name,
101
103
  attribute: "max"
102
104
  });
103
- if (n > o.value) return j("local.runtime.value.max", {
105
+ if (n > o.value) return A("local.runtime.value.max", {
104
106
  name: e.name,
105
107
  max: o.value
106
108
  });
107
109
  }
108
- 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 });
110
+ if (t.present && t.ok && o.present && o.ok && typeof t.value == "number" && typeof o.value == "number" && t.value > o.value) return A("local.runtime.value.constraint-range", { name: e.name });
109
111
  }
110
- return e.min !== void 0 && n < e.min ? j("local.runtime.value.min", {
112
+ return e.min !== void 0 && n < e.min ? A("local.runtime.value.min", {
111
113
  name: e.name,
112
114
  min: e.min
113
- }) : e.max !== void 0 && n > e.max ? j("local.runtime.value.max", {
115
+ }) : e.max !== void 0 && n > e.max ? A("local.runtime.value.max", {
114
116
  name: e.name,
115
117
  max: e.max
116
- }) : i > 0 && !V(n, a, i) ? j("local.runtime.value.step", {
118
+ }) : r > 0 && !V(n, a, r) ? A("local.runtime.value.step", {
117
119
  name: e.name,
118
- step: i,
120
+ step: r,
119
121
  base: a
120
122
  }) : {
121
123
  ok: !0,
@@ -125,40 +127,40 @@ function R(e, t, n, r, a, s = !1) {
125
127
  case "boolean": return typeof n == "boolean" ? {
126
128
  ok: !0,
127
129
  value: n
128
- } : j("local.runtime.value.boolean", { name: e.name });
130
+ } : A("local.runtime.value.boolean", { name: e.name });
129
131
  case "string": {
130
- if (typeof n != "string") return j("local.runtime.value.string", { name: e.name });
132
+ if (typeof n != "string") return A("local.runtime.value.string", { name: e.name });
131
133
  let c = o(n);
132
- if (c) return j("local.runtime.value.budget", {
134
+ if (c) return A("local.runtime.value.budget", {
133
135
  name: e.name,
134
- detail: i(c),
136
+ detail: r(c),
135
137
  detailKey: c.key,
136
138
  ...c.params
137
139
  });
138
- for (let i of t) {
139
- let t = a?.get(i.id) ?? (s ? I(i) : L);
140
+ for (let r of t) {
141
+ let t = a?.get(r.id) ?? (s ? F(r) : I);
140
142
  if (!t.length) continue;
141
143
  let o = {};
142
144
  for (let n of t) {
143
145
  if (n.kind === "date") {
144
146
  for (let t of ["min", "max"]) {
145
147
  if (n[t] === void 0) continue;
146
- let a = r(i, t);
148
+ let a = i(r, t);
147
149
  if (a.present) {
148
- if (!a.ok || typeof a.value != "string" || !C(a.value)) return j("local.runtime.value.constraint-date", {
150
+ if (!a.ok || typeof a.value != "string" || !S(a.value)) return A("local.runtime.value.constraint-date", {
149
151
  name: e.name,
150
152
  attribute: t
151
153
  });
152
154
  o[t] = a.value;
153
155
  }
154
156
  }
155
- let t = o.min ?? M(i, n.min), a = o.max ?? M(i, n.max);
156
- if (t && a && C(t) && C(a) && t > a) return j("local.runtime.value.constraint-range", { name: e.name });
157
+ let t = o.min ?? j(r, n.min), a = o.max ?? j(r, n.max);
158
+ if (t && a && S(t) && S(a) && t > a) return A("local.runtime.value.constraint-range", { name: e.name });
157
159
  }
158
160
  if ((n.kind === "date" || n.kind === "required" ? n.required : void 0) !== void 0) {
159
- let t = r(i, "required");
161
+ let t = i(r, "required");
160
162
  if (t.present) {
161
- if (!t.ok || typeof t.value != "boolean") return j("local.runtime.value.constraint", {
163
+ if (!t.ok || typeof t.value != "boolean") return A("local.runtime.value.constraint", {
162
164
  name: e.name,
163
165
  attribute: "required"
164
166
  });
@@ -166,10 +168,10 @@ function R(e, t, n, r, a, s = !1) {
166
168
  }
167
169
  }
168
170
  }
169
- let c = P(i, n, t, o);
171
+ let c = N(r, n, t, o);
170
172
  if (!c.ok) return c;
171
173
  }
172
- return e.options?.length && !e.options.includes(n) ? j("local.runtime.value.option", {
174
+ return e.options?.length && !e.options.includes(n) ? A("local.runtime.value.option", {
173
175
  value: n,
174
176
  options: e.options.join(", ")
175
177
  }) : {
@@ -178,29 +180,29 @@ function R(e, t, n, r, a, s = !1) {
178
180
  };
179
181
  }
180
182
  case "array": {
181
- if (!Array.isArray(n)) return j("local.runtime.value.array", { name: e.name });
183
+ if (!Array.isArray(n)) return A("local.runtime.value.array", { name: e.name });
182
184
  let t = o(n);
183
- if (t) return j("local.runtime.value.budget", {
185
+ if (t) return A("local.runtime.value.budget", {
184
186
  name: e.name,
185
- detail: i(t),
187
+ detail: r(t),
186
188
  detailKey: t.key,
187
189
  ...t.params
188
190
  });
189
- for (let t of n) if (typeof t != "string") return j("local.runtime.value.array-members", { name: e.name });
190
- if (e.family === "collection") return e.maxItems !== void 0 && n.length > e.maxItems ? j("local.runtime.value.max-items", {
191
+ for (let t of n) if (typeof t != "string") return A("local.runtime.value.array-members", { name: e.name });
192
+ if (e.family === "collection") return e.maxItems !== void 0 && n.length > e.maxItems ? A("local.runtime.value.max-items", {
191
193
  name: e.name,
192
194
  max: e.maxItems
193
195
  }) : {
194
196
  ok: !0,
195
197
  value: n.slice()
196
198
  };
197
- let r = /* @__PURE__ */ new Set();
199
+ let i = /* @__PURE__ */ new Set();
198
200
  for (let t of n) {
199
- if (e.options && !e.options.includes(t)) return j("local.runtime.value.checklist-option", { value: t });
200
- r.add(t);
201
+ if (e.options && !e.options.includes(t)) return A("local.runtime.value.checklist-option", { value: t });
202
+ i.add(t);
201
203
  }
202
- let a = e.options ? e.options.filter((e) => r.has(e)) : [...r];
203
- return e.maxItems !== void 0 && a.length > e.maxItems ? j("local.runtime.value.max-items", {
204
+ let a = e.options ? e.options.filter((e) => i.has(e)) : [...i];
205
+ return e.maxItems !== void 0 && a.length > e.maxItems ? A("local.runtime.value.max-items", {
204
206
  name: e.name,
205
207
  max: e.maxItems
206
208
  }) : {
@@ -209,16 +211,16 @@ function R(e, t, n, r, a, s = !1) {
209
211
  };
210
212
  }
211
213
  case "number-array": {
212
- if (!Array.isArray(n)) return j("local.runtime.value.number-array", { name: e.name });
214
+ if (!Array.isArray(n)) return A("local.runtime.value.number-array", { name: e.name });
213
215
  let t = o(n);
214
- if (t) return j("local.runtime.value.budget", {
216
+ if (t) return A("local.runtime.value.budget", {
215
217
  name: e.name,
216
- detail: i(t),
218
+ detail: r(t),
217
219
  detailKey: t.key,
218
220
  ...t.params
219
221
  });
220
- for (let t of n) if (typeof t != "number" || !Number.isFinite(t)) return j("local.runtime.value.number-array-members", { name: e.name });
221
- return e.maxItems !== void 0 && n.length > e.maxItems ? j("local.runtime.value.max-items", {
222
+ for (let t of n) if (typeof t != "number" || !Number.isFinite(t)) return A("local.runtime.value.number-array-members", { name: e.name });
223
+ return e.maxItems !== void 0 && n.length > e.maxItems ? A("local.runtime.value.max-items", {
222
224
  name: e.name,
223
225
  max: e.maxItems
224
226
  }) : {
@@ -229,11 +231,11 @@ function R(e, t, n, r, a, s = !1) {
229
231
  case "null": return n === null ? {
230
232
  ok: !0,
231
233
  value: n
232
- } : j("local.runtime.value.null", { name: e.name });
234
+ } : A("local.runtime.value.null", { name: e.name });
233
235
  }
234
- return j("local.runtime.value.unsupported-type", { name: e.name });
236
+ return A("local.runtime.value.unsupported-type", { name: e.name });
235
237
  }
236
- function ne(e) {
238
+ function R(e) {
237
239
  return e instanceof a ? e : new a("expression-eval", e instanceof Error ? e.message : String(e), 0);
238
240
  }
239
241
  function re(e, t) {
@@ -336,11 +338,11 @@ function V(e, t, n) {
336
338
  let r = (e - t) / n;
337
339
  return Math.abs(r - Math.round(r)) <= z * Math.max(1, Math.abs(r));
338
340
  }
339
- function H(e, t, n, r) {
341
+ function H(e, t, n, i) {
340
342
  let a = Math.max(0, Math.min(e.source.length, t.range.start)), o = e.source.slice(0, a).split("\n");
341
343
  return {
342
344
  code: n,
343
- message: i(r),
345
+ message: r(i),
344
346
  severity: "error",
345
347
  range: {
346
348
  start: a,
@@ -348,8 +350,10 @@ function H(e, t, n, r) {
348
350
  },
349
351
  line: o.length,
350
352
  column: (o.at(-1) ?? "").length + 1,
351
- messageKey: r.key,
352
- ...r.params ? { params: r.params } : {}
353
+ messageKey: i.key,
354
+ phase: "runtime",
355
+ recoverable: !0,
356
+ ...i.params ? { params: i.params } : {}
353
357
  };
354
358
  }
355
359
  function U(e, t, n) {
@@ -363,6 +367,8 @@ function U(e, t, n) {
363
367
  },
364
368
  line: 1,
365
369
  column: 1,
370
+ phase: "runtime",
371
+ recoverable: !0,
366
372
  ...n ? {
367
373
  messageKey: n.key,
368
374
  ...n.params ? { params: n.params } : {}
@@ -410,91 +416,91 @@ function ie(e, t) {
410
416
  } catch (e) {
411
417
  return {
412
418
  expression: null,
413
- error: ne(e)
419
+ error: R(e)
414
420
  };
415
421
  }
416
422
  }
417
423
  function ae(e, t) {
418
- let r = /* @__PURE__ */ new Map();
419
- for (let t of n(e.nodes)) r.set(t.id, t);
424
+ let n = /* @__PURE__ */ new Map();
425
+ for (let t of i(e.nodes)) n.set(t.id, t);
420
426
  let s = {}, l = /* @__PURE__ */ new Map();
421
- for (let [t, n] of Object.entries(e.bindings)) {
422
- let e = o(n.initial);
423
- if (e) throw new a("expression-budget", `Parameter "${t}": ${i(e)}`, 0);
424
- s[t] = B(n.initial);
427
+ for (let [t, i] of Object.entries(e.bindings)) {
428
+ let e = o(i.initial);
429
+ if (e) throw new a("expression-budget", `Parameter "${t}": ${r(e)}`, 0);
430
+ s[t] = B(i.initial);
425
431
  let c = [];
426
- for (let e of n.nodeIds) {
427
- let t = r.get(e);
432
+ for (let e of i.nodeIds) {
433
+ let t = n.get(e);
428
434
  t && c.push(t);
429
435
  }
430
436
  l.set(t, c);
431
437
  }
432
- let u = /* @__PURE__ */ new Map();
433
- for (let [t, n] of Object.entries(e.bindingSlots ?? {})) u.set(t, { ...n });
434
- let d = y(e), p = new Map(Object.entries(d?.valueRules ?? {})), m = d === void 0, h = /* @__PURE__ */ new Map();
435
- if (d) for (let e of d.slotRelations) {
436
- let t = u.get(e.nodeId), n = t?.[e.lower], r = t?.[e.upper];
438
+ let d = /* @__PURE__ */ new Map();
439
+ for (let [t, n] of Object.entries(e.bindingSlots ?? {})) d.set(t, { ...n });
440
+ let f = g(e), p = new Map(Object.entries(f?.valueRules ?? {})), ee = f === void 0, m = /* @__PURE__ */ new Map();
441
+ if (f) for (let e of f.slotRelations) {
442
+ let t = d.get(e.nodeId), n = t?.[e.lower], r = t?.[e.upper];
437
443
  if (!n || !r) continue;
438
- let i = h.get(e.nodeId) ?? [];
444
+ let i = m.get(e.nodeId) ?? [];
439
445
  i.push({
440
446
  lower: n,
441
447
  upper: r
442
- }), h.set(e.nodeId, i);
448
+ }), m.set(e.nodeId, i);
443
449
  }
444
- else for (let [e, t] of u) t.start && t.end && h.set(e, [{
450
+ else for (let [e, t] of d) t.start && t.end && m.set(e, [{
445
451
  lower: t.start,
446
452
  upper: t.end
447
453
  }]);
448
- let g = /* @__PURE__ */ new Map();
454
+ let _ = /* @__PURE__ */ new Map();
449
455
  for (let [t, n] of Object.entries(e.bindings)) for (let e of n.nodeIds) {
450
- if (u.has(e)) continue;
451
- let n = g.get(e);
452
- (n === void 0 || n.startsWith("@") && !t.startsWith("@")) && g.set(e, t);
456
+ if (d.has(e)) continue;
457
+ let n = _.get(e);
458
+ (n === void 0 || n.startsWith("@") && !t.startsWith("@")) && _.set(e, t);
453
459
  }
454
- let _ = Object.freeze(Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort()), b = /* @__PURE__ */ new Map();
455
- for (let [e, t] of u) for (let n of Object.values(t)) {
460
+ let v = Object.freeze(Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort()), b = /* @__PURE__ */ new Map();
461
+ for (let [e, t] of d) for (let n of Object.values(t)) {
456
462
  if (n.startsWith("@")) continue;
457
463
  let t = b.get(n) ?? /* @__PURE__ */ new Set();
458
464
  t.add(e), b.set(n, t);
459
465
  }
460
- let x = e.computations ?? {}, C = Object.keys(x), w = /* @__PURE__ */ new Map();
466
+ let x = e.computations ?? {}, S = Object.keys(x), C = /* @__PURE__ */ new Map();
461
467
  for (let [e, n] of Object.entries(x)) {
462
468
  let r = ie(n.source, t);
463
- r.expression && w.set(e, r.expression);
469
+ r.expression && C.set(e, r.expression);
464
470
  }
465
- let { order: ee, cyclic: te } = S(x), T = {}, E = /* @__PURE__ */ new Map();
466
- for (let e of ee) {
471
+ let { order: te, cyclic: ne } = y(x), w = {}, T = /* @__PURE__ */ new Map();
472
+ for (let e of te) {
467
473
  let t = x[e];
468
474
  if (!t || t.kind !== "const") continue;
469
475
  if (Object.hasOwn(t, "value")) {
470
476
  let n = t.value, r = c(n);
471
477
  if (r) {
472
- E.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
478
+ T.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
473
479
  continue;
474
480
  }
475
- T[e] = B(n);
481
+ w[e] = B(n);
476
482
  continue;
477
483
  }
478
- let n = w.get(e);
479
- if (!n) E.set(e, new a("expression-eval", `Constant "${e}" cannot be evaluated.`, 0));
484
+ let n = C.get(e);
485
+ if (!n) T.set(e, new a("expression-eval", `Constant "${e}" cannot be evaluated.`, 0));
480
486
  else try {
481
- let t = n.evaluate({ ...T }), r = c(t);
487
+ let t = n.evaluate({ ...w }), r = c(t);
482
488
  if (r) {
483
- E.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
489
+ T.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
484
490
  continue;
485
491
  }
486
- T[e] = B(t);
492
+ w[e] = B(t);
487
493
  } catch (t) {
488
- E.set(e, ne(t));
494
+ T.set(e, R(t));
489
495
  }
490
496
  }
491
- let D = /* @__PURE__ */ new Map();
492
- for (let e of te) D.set(e, new a("expression-cycle", `Computation "${e}" is part of a dependency cycle.`, 0));
493
- let O = [];
497
+ let E = /* @__PURE__ */ new Map();
498
+ for (let e of ne) E.set(e, new a("expression-cycle", `Computation "${e}" is part of a dependency cycle.`, 0));
499
+ let D = [];
494
500
  if (Array.isArray(e.validations)) for (let n of e.validations) {
495
- if (!f(n)) continue;
501
+ if (!u(n)) continue;
496
502
  let e = ie(n.expression, t);
497
- O.push({
503
+ D.push({
498
504
  rule: n,
499
505
  expression: e.expression,
500
506
  error: e.error
@@ -502,37 +508,37 @@ function ae(e, t) {
502
508
  }
503
509
  return {
504
510
  document: e,
505
- nodeIndex: r,
511
+ nodeIndex: n,
506
512
  controls: l,
507
- slotKeys: u,
508
- publicNames: _,
513
+ slotKeys: d,
514
+ publicNames: v,
509
515
  publicSlotOwners: b,
510
516
  initial: s,
511
517
  valueRules: p,
512
- legacyValueRules: m,
513
- slotRelations: h,
514
- bindingByNode: g,
518
+ legacyValueRules: ee,
519
+ slotRelations: m,
520
+ bindingByNode: _,
515
521
  computationMetadata: x,
516
- computationNames: C,
517
- computationOrder: ee,
518
- cyclicComputations: te,
519
- computationExpressions: w,
520
- constValues: T,
521
- constErrors: E,
522
- cycleErrors: D,
523
- validationRules: O,
524
- validationLineStarts: v(typeof e.source == "string" ? e.source : "")
522
+ computationNames: S,
523
+ computationOrder: te,
524
+ cyclicComputations: ne,
525
+ computationExpressions: C,
526
+ constValues: w,
527
+ constErrors: T,
528
+ cycleErrors: E,
529
+ validationRules: D,
530
+ validationLineStarts: h(typeof e.source == "string" ? e.source : "")
525
531
  };
526
532
  }
527
533
  function oe(e) {
528
- return !e || e.syntax !== "local" ? "createLocalRuntime requires a local interaction document." : e.syntaxVersion !== void 0 && e.syntaxVersion !== "local-draft-3" || e.versionDeclaration && e.versionDeclaration.version !== "local-draft-3" ? `createLocalRuntime requires ${d}; migrate the source before constructing a runtime.` : null;
534
+ return !e || e.syntax !== "local" ? "createLocalRuntime requires a local interaction document." : e.syntaxVersion !== void 0 && e.syntaxVersion !== "local-draft-3" || e.versionDeclaration && e.versionDeclaration.version !== "local-draft-3" ? `createLocalRuntime requires ${x}; migrate the source before constructing a runtime.` : null;
529
535
  }
530
536
  function G(e, t) {
531
537
  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);
532
538
  }
533
539
  function se(e, t, n) {
534
- let r = G(e, t);
535
- return r ? H(e.document, r, "local.runtime.value", n) : U("local.runtime.value", i(n));
540
+ let i = G(e, t);
541
+ return i ? H(e.document, i, "local.runtime.value", n) : U("local.runtime.value", r(n));
536
542
  }
537
543
  function K(e, t, n) {
538
544
  let r = e.slotRelations.get(t);
@@ -542,13 +548,13 @@ function K(e, t, n) {
542
548
  }) : !1;
543
549
  }
544
550
  function ce(e, t) {
545
- let n = e.nodeIndex.get(t);
546
- return n ? H(e.document, n, "local.runtime.value", r("local.runtime.value.range-order")) : U("local.runtime.value", i(r("local.runtime.value.range-order")));
551
+ let i = e.nodeIndex.get(t);
552
+ return i ? H(e.document, i, "local.runtime.value", n("local.runtime.value.range-order")) : U("local.runtime.value", r(n("local.runtime.value.range-order")));
547
553
  }
548
554
  // src/local/runtime/retention.ts
549
555
  function q(e) {
550
556
  let t = /* @__PURE__ */ new Map();
551
- for (let r of n(e.nodes)) t.set(r.id, r);
557
+ for (let n of i(e.nodes)) t.set(n.id, n);
552
558
  return t;
553
559
  }
554
560
  function le(e, t, n) {
@@ -556,14 +562,14 @@ function le(e, t, n) {
556
562
  return r !== void 0 && Object.values(r).includes(n);
557
563
  }
558
564
  function J(e, t, n) {
559
- let r = t.name ? w(t.name) : void 0;
565
+ let r = t.name ? C(t.name) : void 0;
560
566
  if (r?.bindings) {
561
567
  let i = e.bindingSlots?.[t.id];
562
568
  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;
563
569
  } else if (t.attrs?.bind === n || le(e, t, n)) return "initial";
564
570
  }
565
571
  function Y(e) {
566
- let t = q(e), n = y(e), r = new Set(n?.retentionExclusions ?? []), i = /* @__PURE__ */ new Map();
572
+ let t = q(e), n = g(e), r = new Set(n?.retentionExclusions ?? []), i = /* @__PURE__ */ new Map();
567
573
  for (let [a, o] of Object.entries(e.bindings)) {
568
574
  let s = o.nodeIds.flatMap((e) => {
569
575
  let n = t.get(e);
@@ -663,7 +669,7 @@ function de(e, t, n, r, i) {
663
669
  for (let e of a.dropped) s.set(e.name, Object.freeze({ ...e }));
664
670
  let c = [], l = {}, u = [], d = /* @__PURE__ */ new Set(), f, p = (n) => {
665
671
  let o = e.document.bindings[n], s = e.controls.get(n) ?? [];
666
- return !o || !s.some((t) => e.document.dynamicConstraints?.[t.id]) || (f ??= i({}, e, t), R(o, s, a.values[n], f, e.valueRules, e.legacyValueRules).ok) ? !1 : W(e, n) === W(r, n);
672
+ return !o || !s.some((t) => e.document.dynamicConstraints?.[t.id]) || (f ??= i({}, e, t), L(o, s, a.values[n], f, e.valueRules, e.legacyValueRules).ok) ? !1 : W(e, n) === W(r, n);
667
673
  };
668
674
  for (let e of a.retained) {
669
675
  let t = n.bindings[e];
@@ -672,26 +678,26 @@ function de(e, t, n, r, i) {
672
678
  d.add(e), l[e] = B(a.values[e]), u.push(e);
673
679
  continue;
674
680
  }
675
- let f = R(t, r.controls.get(e) ?? [], a.values[e], i(a.values, r, o), r.valueRules, r.legacyValueRules);
681
+ let f = L(t, r.controls.get(e) ?? [], a.values[e], i(a.values, r, o), r.valueRules, r.legacyValueRules);
676
682
  f.ok ? (l[e] = B(f.value), u.push(e)) : (c.push(se(r, t, f.detail)), s.set(e, Object.freeze({
677
683
  name: e,
678
684
  reason: "invalid"
679
685
  })));
680
686
  }
681
- let m = {
687
+ let ee = {
682
688
  ...o,
683
689
  ...l
684
- }, h = /* @__PURE__ */ new Set();
685
- for (let e of u) for (let t of r.publicSlotOwners.get(e) ?? []) h.add(t);
686
- let g = !1;
687
- for (let e of [...h].sort()) if (K(r, e, m)) {
688
- g = !0;
690
+ }, m = /* @__PURE__ */ new Set();
691
+ for (let e of u) for (let t of r.publicSlotOwners.get(e) ?? []) m.add(t);
692
+ let h = !1;
693
+ for (let e of [...m].sort()) if (K(r, e, ee)) {
694
+ h = !0;
689
695
  break;
690
696
  }
691
- let _;
692
- if (!g) Object.assign(o, l), _ = u;
697
+ let g;
698
+ if (!h) Object.assign(o, l), g = u;
693
699
  else {
694
- _ = [];
700
+ g = [];
695
701
  for (let e of u) {
696
702
  let t = o[e];
697
703
  o[e] = l[e];
@@ -700,7 +706,7 @@ function de(e, t, n, r, i) {
700
706
  n ? (o[e] = t, s.set(e, Object.freeze({
701
707
  name: e,
702
708
  reason: "invalid"
703
- }))) : _.push(e);
709
+ }))) : g.push(e);
704
710
  }
705
711
  }
706
712
  for (let [e, t] of r.slotRelations) if (K(r, e, o)) {
@@ -708,8 +714,8 @@ function de(e, t, n, r, i) {
708
714
  let e = n.bindings[t];
709
715
  if (!e) continue;
710
716
  o[t] = B(e.initial);
711
- let r = _.indexOf(t);
712
- r >= 0 && _.splice(r, 1), s.set(t, Object.freeze({
717
+ let r = g.indexOf(t);
718
+ r >= 0 && g.splice(r, 1), s.set(t, Object.freeze({
713
719
  name: t,
714
720
  reason: "invalid"
715
721
  }));
@@ -721,25 +727,25 @@ function de(e, t, n, r, i) {
721
727
  diagnostics: []
722
728
  };
723
729
  }
724
- let v = !0;
725
- for (; v;) {
730
+ let _ = !0;
731
+ for (; _;) {
726
732
  let e = i({}, r, o), t = [];
727
- for (let i of _) {
733
+ for (let i of g) {
728
734
  if (d.has(i)) continue;
729
- let a = n.bindings[i], s = R(a, r.controls.get(i) ?? [], o[i], e, r.valueRules, r.legacyValueRules);
735
+ let a = n.bindings[i], s = L(a, r.controls.get(i) ?? [], o[i], e, r.valueRules, r.legacyValueRules);
730
736
  s.ok || (c.push(se(r, a, s.detail)), t.push(i));
731
737
  }
732
- for (let e of t) o[e] = B(n.bindings[e].initial), _.splice(_.indexOf(e), 1), s.set(e, Object.freeze({
738
+ for (let e of t) o[e] = B(n.bindings[e].initial), g.splice(g.indexOf(e), 1), s.set(e, Object.freeze({
733
739
  name: e,
734
740
  reason: "invalid"
735
741
  }));
736
- v = t.length > 0;
742
+ _ = t.length > 0;
737
743
  }
738
- let y = [...s.values()].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name));
739
- return _.sort(), {
744
+ let v = [...s.values()].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name));
745
+ return g.sort(), {
740
746
  values: o,
741
- retained: _,
742
- dropped: y,
747
+ retained: g,
748
+ dropped: v,
743
749
  diagnostics: c
744
750
  };
745
751
  }
@@ -782,33 +788,33 @@ function ve(e, t, n) {
782
788
  function ye(e, t) {
783
789
  let c = oe(e);
784
790
  if (c) throw Error(c);
785
- let d = t?.services === void 0, f = ee(t?.network), m = /* @__PURE__ */ new Map(), v = te(e.source), y = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), C = ae(e, S), w = () => C, D = () => {
791
+ let u = t?.services === void 0, f = te(t?.network), h = /* @__PURE__ */ new Map(), g = ne(e.source), y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), S = ae(e, x), C = () => S, E = () => {
786
792
  let e = /* @__PURE__ */ new Set();
787
- for (let r of n(C.document.nodes)) r.name !== void 0 && e.add(T({
793
+ for (let n of i(S.document.nodes)) n.name !== void 0 && e.add(w({
788
794
  documentId: t?.documentId,
789
- sourceDigest: v,
790
- nodeId: r.id,
791
- stateKey: r.attrs?.["state-key"]
795
+ sourceDigest: g,
796
+ nodeId: n.id,
797
+ stateKey: n.attrs?.["state-key"]
792
798
  }));
793
799
  return e;
794
- }, O = t?.services ?? E({
800
+ }, D = t?.services ?? T({
795
801
  documentId: t?.documentId,
796
- sourceDigest: v,
802
+ sourceDigest: g,
797
803
  randomSeed: t?.randomSeed,
798
804
  componentState: t?.componentState,
799
805
  ...t?.componentStateStorage === void 0 ? {} : { componentStateStorage: t.componentStateStorage },
800
806
  ...t?.componentStateWriteDelayMs === void 0 ? {} : { componentStateWriteDelayMs: t.componentStateWriteDelayMs },
801
807
  ...t?.configKey === void 0 ? {} : { configKey: t.configKey },
802
808
  ...t?.legacyConfigKeys === void 0 ? {} : { legacyConfigKeys: t.legacyConfigKeys },
803
- ...d ? { knownStateKeys: D } : {}
804
- }), k = {}, A = /* @__PURE__ */ new Map();
809
+ ...u ? { knownStateKeys: E } : {}
810
+ }), O = {}, k = /* @__PURE__ */ new Map();
805
811
  for (let [n, r] of Object.entries(e.externals ?? {})) {
806
812
  let e = t?.externalValues?.[n];
807
813
  if (e === void 0) continue;
808
814
  let i = re(r.type, e);
809
- i.ok && (k[n] = i.value);
815
+ i.ok && (O[n] = i.value);
810
816
  }
811
- let j = (e, t) => {
817
+ let A = (e, t) => {
812
818
  let n = {};
813
819
  for (let [r, i] of Object.entries(e.document.externals ?? {})) {
814
820
  if (!Object.hasOwn(t, r)) continue;
@@ -816,14 +822,14 @@ function ye(e, t) {
816
822
  e.ok && (n[r] = e.value);
817
823
  }
818
824
  return n;
819
- }, M = (e) => {
820
- let t = j(e, k);
821
- for (let n of A.keys()) Object.assign(t, j(e, n));
825
+ }, j = (e) => {
826
+ let t = A(e, O);
827
+ for (let n of k.keys()) Object.assign(t, A(e, n));
822
828
  return t;
823
- }, N = (e, t, n, r = w()) => {
829
+ }, M = (e, t, n, r = C()) => {
824
830
  let i = r.document.dynamicConstraints?.[e.id]?.[t];
825
831
  if (!i) return { present: !1 };
826
- let a = ie(i.source, S);
832
+ let a = ie(i.source, x);
827
833
  if (!a.expression) return {
828
834
  present: !0,
829
835
  ok: !1
@@ -844,21 +850,21 @@ function ye(e, t) {
844
850
  ok: !1
845
851
  };
846
852
  }
847
- }, P = C.initial, F = 0, I = {}, L = {}, ne = {
853
+ }, N = S.initial, P = 0, F = {}, I = {}, R = {
848
854
  revision: 0,
849
855
  state: me({})
850
856
  }, z = !1, V = null, W = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Map(), q = () => {
851
857
  if (z) throw Error("The local interaction runtime has been disposed.");
852
858
  };
853
859
  function le(e, t) {
854
- if (!t.startsWith("@") && Object.hasOwn(e.document.bindings, t)) return Object.hasOwn(P, t) ? P[t] : void 0;
860
+ if (!t.startsWith("@") && Object.hasOwn(e.document.bindings, t)) return Object.hasOwn(N, t) ? N[t] : void 0;
855
861
  }
856
862
  let J = (e, t) => {
857
- let n = M(e), r = /* @__PURE__ */ new Map();
863
+ let n = j(e), r = /* @__PURE__ */ new Map();
858
864
  for (let t of Object.keys(e.document.externals ?? {})) Object.hasOwn(n, t) || r.set(t, new a("external-missing", "External data \"" + t + "\" is not available.", 0));
859
865
  let i = {}, o = /* @__PURE__ */ new Map();
860
866
  if (e.computationNames.length > 0) {
861
- let a = g(e.computationMetadata, e.computationOrder, e.computationExpressions, {
867
+ let a = ee(e.computationMetadata, e.computationOrder, e.computationExpressions, {
862
868
  ...t,
863
869
  ...n
864
870
  }, e.constValues, r);
@@ -886,63 +892,63 @@ function ye(e, t) {
886
892
  snapshotState: c
887
893
  };
888
894
  }, Y = () => {
889
- let e = J(w(), P);
890
- I = e.environment, L = e.snapshotState;
891
- }, X = (e, t = w(), n = P) => {
895
+ let e = J(C(), N);
896
+ F = e.environment, I = e.snapshotState;
897
+ }, X = (e, t = C(), n = N) => {
892
898
  let r;
893
899
  return (i, a) => t.document.dynamicConstraints?.[i.id]?.[a] ? (r ??= J(t, {
894
900
  ...n,
895
901
  ...e
896
- }).environment, N(i, a, r, t)) : { present: !1 };
902
+ }).environment, M(i, a, r, t)) : { present: !1 };
897
903
  }, Z = () => {
898
- ne = {
899
- revision: F,
900
- state: me(L)
904
+ R = {
905
+ revision: P,
906
+ state: me(I)
901
907
  };
902
908
  }, ue = () => {
903
909
  for (let e of W) e();
904
910
  }, Q = (e) => {
905
- P = e, F += 1, Y(), Z(), ue();
911
+ N = e, P += 1, Y(), Z(), ue();
906
912
  }, ge = () => {
907
- F += 1, Y(), Z(), ue();
908
- }, _e = (e, t = k) => {
913
+ P += 1, Y(), Z(), ue();
914
+ }, _e = (e, t = O) => {
909
915
  if (q(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setExternalValues requires an object of external values.");
910
- let n = [], a = {}, o = Object.keys(e).sort();
916
+ let i = [], a = {}, o = Object.keys(e).sort();
911
917
  for (let t of o) {
912
918
  if (t === "__proto__") {
913
- n.push(U("local.runtime.external", "External names cannot be \"__proto__\"."));
919
+ i.push(U("local.runtime.external", "External names cannot be \"__proto__\"."));
914
920
  continue;
915
921
  }
916
- let o = w().document.externals ?? {}, s = Object.hasOwn(o, t) ? o[t] : void 0;
922
+ let o = C().document.externals ?? {}, s = Object.hasOwn(o, t) ? o[t] : void 0;
917
923
  if (!s) {
918
- let e = r("local.runtime.external", { name: t });
919
- n.push(U("local.runtime.external", i(e), e));
924
+ let e = n("local.runtime.external", { name: t });
925
+ i.push(U("local.runtime.external", r(e), e));
920
926
  continue;
921
927
  }
922
928
  let c = re(s.type, e[t]);
923
929
  if (c.ok) a[t] = c.value;
924
930
  else {
925
- let e = r(c.key, {
931
+ let e = n(c.key, {
926
932
  name: t,
927
933
  ...c.params ?? {}
928
934
  });
929
- n.push(U("local.runtime.external", i(e), e));
935
+ i.push(U("local.runtime.external", r(e), e));
930
936
  }
931
937
  }
932
- return n.length ? n : (o.some((e) => !pe(t[e], a[e])) && (Object.assign(t, a), ge()), []);
938
+ return i.length ? i : (o.some((e) => !pe(t[e], a[e])) && (Object.assign(t, a), ge()), []);
933
939
  }, ve = (e, t) => {
934
940
  if (z) return () => {};
935
941
  let n = {}, r = e.bindExternalValues((e) => {
936
- if (z || !A.has(n)) return;
942
+ if (z || !k.has(n)) return;
937
943
  let r = _e(e, n);
938
944
  r.length && t?.(r);
939
945
  });
940
- return r ? (A.set(n, r), () => {
941
- A.delete(n) && (r(), !z && Object.keys(n).length && ge());
946
+ return r ? (k.set(n, r), () => {
947
+ k.delete(n) && (r(), !z && Object.keys(n).length && ge());
942
948
  }) : () => {};
943
949
  }, ye = (e) => {
944
950
  q();
945
- let t = w(), n = [], r = {}, i = Object.keys(e).sort(), a = X(e);
951
+ let t = C(), n = [], r = {}, i = Object.keys(e).sort(), a = X(e);
946
952
  for (let o of i) {
947
953
  if (o === "__proto__") {
948
954
  n.push(U("local.runtime.parameter", "Parameter names cannot be \"__proto__\"."));
@@ -956,13 +962,13 @@ function ye(e, t) {
956
962
  n.push(U("local.runtime.parameter", `Unknown parameter "${o}".`));
957
963
  continue;
958
964
  }
959
- let i = t.document.bindings[o], s = R(i, t.controls.get(o) ?? [], e[o], a, t.valueRules, t.legacyValueRules);
965
+ let i = t.document.bindings[o], s = L(i, t.controls.get(o) ?? [], e[o], a, t.valueRules, t.legacyValueRules);
960
966
  s.ok ? r[o] = B(s.value) : n.push(se(t, i, s.detail));
961
967
  }
962
968
  if (n.length) return n;
963
- if (!i.some((e) => !pe(P[e], r[e]))) return [];
969
+ if (!i.some((e) => !pe(N[e], r[e]))) return [];
964
970
  let o = {
965
- ...P,
971
+ ...N,
966
972
  ...r
967
973
  }, s = /* @__PURE__ */ new Set();
968
974
  for (let e of i) for (let n of t.publicSlotOwners.get(e) ?? []) s.add(n);
@@ -979,36 +985,36 @@ function ye(e, t) {
979
985
  }
980
986
  return t;
981
987
  }, xe = () => {
982
- let e = w(), t = [], n = typeof e.document.source == "string" ? e.document.source : "";
988
+ let e = C(), t = [], n = typeof e.document.source == "string" ? e.document.source : "";
983
989
  for (let r of e.validationRules) {
984
990
  if (r.error) {
985
- t.push(p(n, e.validationLineStarts, r.rule.range, x, h(`Validation expression is invalid: ${r.error.message}`)));
991
+ t.push(d(n, e.validationLineStarts, r.rule.range, v, p(`Validation expression is invalid: ${r.error.message}`)));
986
992
  continue;
987
993
  }
988
994
  if (!r.expression) continue;
989
995
  let i;
990
996
  try {
991
- i = r.expression.evaluate(I);
997
+ i = r.expression.evaluate(F);
992
998
  } catch (i) {
993
- t.push(p(n, e.validationLineStarts, r.rule.range, x, h(`Validation expression failed: ${i instanceof Error ? i.message : String(i)}`)));
999
+ t.push(d(n, e.validationLineStarts, r.rule.range, v, p(`Validation expression failed: ${i instanceof Error ? i.message : String(i)}`)));
994
1000
  continue;
995
1001
  }
996
- typeof i == "boolean" ? i || t.push(p(n, e.validationLineStarts, r.rule.range, _, Se(r.rule.message))) : t.push(p(n, e.validationLineStarts, r.rule.range, x, "Validation expression must evaluate to a boolean."));
1002
+ typeof i == "boolean" ? i || t.push(d(n, e.validationLineStarts, r.rule.range, m, Se(r.rule.message))) : t.push(d(n, e.validationLineStarts, r.rule.range, v, "Validation expression must evaluate to a boolean."));
997
1003
  }
998
1004
  return t;
999
1005
  }, Se = (e) => {
1000
1006
  let t;
1001
1007
  try {
1002
- t = s(e, I);
1008
+ t = s(e, F);
1003
1009
  } catch {
1004
- t = b;
1010
+ t = _;
1005
1011
  }
1006
- return h(t);
1012
+ return p(t);
1007
1013
  }, Ce = (e, t) => {
1008
- if (q(), e === C.document) return $({
1014
+ if (q(), e === S.document) return $({
1009
1015
  ok: !0,
1010
1016
  changed: !1,
1011
- revision: F,
1017
+ revision: P,
1012
1018
  retained: [],
1013
1019
  dropped: [],
1014
1020
  diagnostics: []
@@ -1016,29 +1022,29 @@ function ye(e, t) {
1016
1022
  if (oe(e)) return $({
1017
1023
  ok: !1,
1018
1024
  changed: !1,
1019
- revision: F,
1025
+ revision: P,
1020
1026
  retained: [],
1021
1027
  dropped: [],
1022
1028
  diagnostics: []
1023
1029
  });
1024
1030
  let n;
1025
1031
  try {
1026
- n = ae(e, S);
1032
+ n = ae(e, x);
1027
1033
  } catch {
1028
1034
  return $({
1029
1035
  ok: !1,
1030
1036
  changed: !1,
1031
- revision: F,
1037
+ revision: P,
1032
1038
  retained: [],
1033
1039
  dropped: [],
1034
1040
  diagnostics: []
1035
1041
  });
1036
1042
  }
1037
- let r = de(C, P, e, n, X);
1043
+ let r = de(S, N, e, n, X);
1038
1044
  if (Object.keys(r.values).length === 0 && Object.keys(e.bindings).length > 0) return $({
1039
1045
  ok: !1,
1040
1046
  changed: !1,
1041
- revision: F,
1047
+ revision: P,
1042
1048
  retained: [],
1043
1049
  dropped: [],
1044
1050
  diagnostics: []
@@ -1050,108 +1056,108 @@ function ye(e, t) {
1050
1056
  return $({
1051
1057
  ok: !1,
1052
1058
  changed: !1,
1053
- revision: F,
1059
+ revision: P,
1054
1060
  retained: [],
1055
1061
  dropped: [],
1056
1062
  diagnostics: []
1057
1063
  });
1058
1064
  }
1059
- for (let e of [k, ...A.keys()]) {
1060
- let t = j(n, e);
1065
+ for (let e of [O, ...k.keys()]) {
1066
+ let t = A(n, e);
1061
1067
  for (let t of Object.keys(e)) delete e[t];
1062
1068
  Object.assign(e, t);
1063
1069
  }
1064
- if (C = n, P = r.values, I = i.environment, L = i.snapshotState, V = null, F += 1, Z(), t) for (let e of W) e();
1070
+ if (S = n, N = r.values, F = i.environment, I = i.snapshotState, V = null, P += 1, Z(), t) for (let e of W) e();
1065
1071
  return $({
1066
1072
  ok: !0,
1067
1073
  changed: !0,
1068
- revision: F,
1074
+ revision: P,
1069
1075
  retained: r.retained,
1070
1076
  dropped: r.dropped,
1071
1077
  diagnostics: r.diagnostics
1072
1078
  });
1073
1079
  }, we = (e) => {
1074
1080
  let t = /* @__PURE__ */ new Set();
1075
- for (let r of n([e])) t.add(r.id);
1081
+ for (let n of i([e])) t.add(n.id);
1076
1082
  return t;
1077
1083
  }, Te = {
1078
1084
  network: f.network,
1079
1085
  get document() {
1080
- return C.document;
1086
+ return S.document;
1081
1087
  },
1082
- services: O,
1088
+ services: D,
1083
1089
  snapshot() {
1084
- return q(), ne;
1090
+ return q(), R;
1085
1091
  },
1086
1092
  get(e, t) {
1087
1093
  q();
1088
- let n = w(), r = n.nodeIndex.get(e.id);
1094
+ let n = C(), r = n.nodeIndex.get(e.id);
1089
1095
  if (!r) return null;
1090
- let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ?? u(r) : n.slotKeys.get(r.id)?.[t];
1091
- return i && Object.hasOwn(P, i) ? B(P[i]) : null;
1096
+ let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ?? b(r) : n.slotKeys.get(r.id)?.[t];
1097
+ return i && Object.hasOwn(N, i) ? B(N[i]) : null;
1092
1098
  },
1093
- set(e, t, n) {
1099
+ set(e, t, r) {
1094
1100
  q();
1095
- let i = w(), a = i.nodeIndex.get(e.id);
1096
- if (!a) return [H(i.document, e, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
1101
+ let i = C(), a = i.nodeIndex.get(e.id);
1102
+ if (!a) return [H(i.document, e, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
1097
1103
  let o = i.slotKeys.get(a.id), s;
1098
- if (n === void 0) {
1099
- if (o && !o.value) return [H(i.document, a, "local.runtime.binding", r("local.runtime.binding.needs-slot"))];
1100
- s = o?.value ?? i.bindingByNode.get(a.id) ?? u(a);
1101
- } else if (s = o?.[n], !s) return [H(i.document, a, "local.runtime.binding", r("local.runtime.binding.unknown-slot", { slot: n }))];
1104
+ if (r === void 0) {
1105
+ if (o && !o.value) return [H(i.document, a, "local.runtime.binding", n("local.runtime.binding.needs-slot"))];
1106
+ s = o?.value ?? i.bindingByNode.get(a.id) ?? b(a);
1107
+ } else if (s = o?.[r], !s) return [H(i.document, a, "local.runtime.binding", n("local.runtime.binding.unknown-slot", { slot: r }))];
1102
1108
  let c = Object.hasOwn(i.document.bindings, s) ? i.document.bindings[s] : void 0;
1103
- if (!c) return [H(i.document, a, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
1104
- let l = R(c, i.controls.get(s) ?? [], t, X({ [s]: t }), i.valueRules, i.legacyValueRules);
1109
+ if (!c) return [H(i.document, a, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
1110
+ let l = L(c, i.controls.get(s) ?? [], t, X({ [s]: t }), i.valueRules, i.legacyValueRules);
1105
1111
  if (!l.ok) return [H(i.document, a, "local.runtime.value", l.detail)];
1106
- let d = B(l.value);
1107
- if (pe(P[s], d)) return [];
1108
- let f = {
1109
- ...P,
1110
- [s]: d
1112
+ let u = B(l.value);
1113
+ if (pe(N[s], u)) return [];
1114
+ let d = {
1115
+ ...N,
1116
+ [s]: u
1111
1117
  };
1112
- return K(i, a.id, f) ? [H(i.document, a, "local.runtime.value", r("local.runtime.value.range-order"))] : (Q(f), []);
1118
+ return K(i, a.id, d) ? [H(i.document, a, "local.runtime.value", n("local.runtime.value.range-order"))] : (Q(d), []);
1113
1119
  },
1114
1120
  setMany(e, t) {
1115
1121
  q();
1116
- let n = w(), i = n.nodeIndex.get(e.id);
1117
- if (!i) return [H(n.document, e, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
1118
- let a = n.slotKeys.get(i.id);
1119
- if (!a) return [H(n.document, i, "local.runtime.binding", r("local.runtime.binding.no-multi-slot"))];
1122
+ let r = C(), i = r.nodeIndex.get(e.id);
1123
+ if (!i) return [H(r.document, e, "local.runtime.binding", n("local.runtime.binding.no-writable"))];
1124
+ let a = r.slotKeys.get(i.id);
1125
+ if (!a) return [H(r.document, i, "local.runtime.binding", n("local.runtime.binding.no-multi-slot"))];
1120
1126
  let o = Object.entries(t);
1121
1127
  if (!o.length) return [];
1122
- let s = { ...P }, c = J(n, {
1123
- ...P,
1128
+ let s = { ...N }, c = J(r, {
1129
+ ...N,
1124
1130
  ...Object.fromEntries(o.map(([e, t]) => [a[e], t]))
1125
1131
  }).environment;
1126
1132
  for (let [e, t] of o) {
1127
1133
  let o = a[e];
1128
- if (!o || !Object.hasOwn(n.document.bindings, o)) return [H(n.document, i, "local.runtime.binding", r("local.runtime.binding.unknown-slot", { slot: e }))];
1129
- let l = R(n.document.bindings[o], n.controls.get(o) ?? [], t, (e, t) => N(e, t, c), n.valueRules, n.legacyValueRules);
1130
- if (!l.ok) return [H(n.document, i, "local.runtime.value", l.detail)];
1134
+ if (!o || !Object.hasOwn(r.document.bindings, o)) return [H(r.document, i, "local.runtime.binding", n("local.runtime.binding.unknown-slot", { slot: e }))];
1135
+ let l = L(r.document.bindings[o], r.controls.get(o) ?? [], t, (e, t) => M(e, t, c), r.valueRules, r.legacyValueRules);
1136
+ if (!l.ok) return [H(r.document, i, "local.runtime.value", l.detail)];
1131
1137
  s[o] = B(l.value);
1132
1138
  }
1133
- return K(n, i.id, s) ? [H(n.document, i, "local.runtime.value", r("local.runtime.value.range-order"))] : (o.every(([e, t]) => pe(P[a[e]], t)) || Q(s), []);
1139
+ return K(r, i.id, s) ? [H(r.document, i, "local.runtime.value", n("local.runtime.value.range-order"))] : (o.every(([e, t]) => pe(N[a[e]], t)) || Q(s), []);
1134
1140
  },
1135
1141
  parameterNames() {
1136
- return q(), w().publicNames;
1142
+ return q(), C().publicNames;
1137
1143
  },
1138
1144
  getParameter(e) {
1139
1145
  q();
1140
- let t = le(w(), e);
1146
+ let t = le(C(), e);
1141
1147
  return t === void 0 ? void 0 : B(t);
1142
1148
  },
1143
1149
  getParameters() {
1144
1150
  q();
1145
- let e = w(), t = {};
1151
+ let e = C(), t = {};
1146
1152
  for (let n of e.publicNames) {
1147
- let e = P[n];
1153
+ let e = N[n];
1148
1154
  t[n] = Array.isArray(e) ? Object.freeze([...e]) : e;
1149
1155
  }
1150
1156
  return Object.freeze(t);
1151
1157
  },
1152
1158
  readSubmissionFields(e) {
1153
1159
  q();
1154
- let t = w(), n = /* @__PURE__ */ new Map(), r = (e, n) => N(e, n, I, t);
1160
+ let t = C(), n = /* @__PURE__ */ new Map(), r = (e, n) => M(e, n, F, t);
1155
1161
  if (e.length === 0) return {
1156
1162
  ok: !1,
1157
1163
  field: "",
@@ -1164,7 +1170,7 @@ function ye(e, t) {
1164
1170
  field: i,
1165
1171
  reason: "unavailable"
1166
1172
  };
1167
- let a = R(t.document.bindings[i], t.controls.get(i) ?? [], e, r, t.valueRules, t.legacyValueRules);
1173
+ let a = L(t.document.bindings[i], t.controls.get(i) ?? [], e, r, t.valueRules, t.legacyValueRules);
1168
1174
  if (!a.ok) {
1169
1175
  let e = a.detail.key;
1170
1176
  return {
@@ -1177,7 +1183,7 @@ function ye(e, t) {
1177
1183
  }
1178
1184
  let i = Object.create(null);
1179
1185
  for (let [e, r] of n) {
1180
- for (let [n, i] of m.get(e) ?? []) {
1186
+ for (let [n, i] of h.get(e) ?? []) {
1181
1187
  if (!t.controls.get(e)?.some((e) => e.id === i)) continue;
1182
1188
  let a = n(B(r));
1183
1189
  if (a) return {
@@ -1195,11 +1201,11 @@ function ye(e, t) {
1195
1201
  },
1196
1202
  registerSubmissionField(e, t) {
1197
1203
  if (z) return () => {};
1198
- let n = w(), r = n.slotKeys.get(e.id)?.value ?? n.bindingByNode.get(e.id);
1204
+ let n = C(), r = n.slotKeys.get(e.id)?.value ?? n.bindingByNode.get(e.id);
1199
1205
  if (!r || r.startsWith("@")) return () => {};
1200
- let i = m.get(r);
1201
- return i || m.set(r, i = /* @__PURE__ */ new Map()), i.set(t, e.id), () => {
1202
- i.delete(t), i.size === 0 && m.get(r) === i && m.delete(r);
1206
+ let i = h.get(r);
1207
+ return i || h.set(r, i = /* @__PURE__ */ new Map()), i.set(t, e.id), () => {
1208
+ i.delete(t), i.size === 0 && h.get(r) === i && h.delete(r);
1203
1209
  };
1204
1210
  },
1205
1211
  setParameter(e, t) {
@@ -1212,12 +1218,12 @@ function ye(e, t) {
1212
1218
  return ye(e);
1213
1219
  },
1214
1220
  getExternal(e) {
1215
- if (q(), Object.hasOwn(w().document.externals ?? {}, e) && Object.hasOwn(L, e)) return B(L[e]);
1221
+ if (q(), Object.hasOwn(C().document.externals ?? {}, e) && Object.hasOwn(I, e)) return B(I[e]);
1216
1222
  },
1217
1223
  getExternalValues() {
1218
1224
  q();
1219
1225
  let e = {};
1220
- for (let [t, n] of Object.entries(M(w()))) e[t] = Array.isArray(n) ? Object.freeze([...n]) : n;
1226
+ for (let [t, n] of Object.entries(j(C()))) e[t] = Array.isArray(n) ? Object.freeze([...n]) : n;
1221
1227
  return Object.freeze(e);
1222
1228
  },
1223
1229
  setExternalValues(e) {
@@ -1225,37 +1231,37 @@ function ye(e, t) {
1225
1231
  },
1226
1232
  evaluate(e) {
1227
1233
  q();
1228
- let t = be(e).evaluate(I);
1234
+ let t = be(e).evaluate(F);
1229
1235
  return Array.isArray(t) ? t.slice() : t;
1230
1236
  },
1231
1237
  validate() {
1232
- if (q(), V && V.revision === F) return V.diagnostics.map(fe);
1238
+ if (q(), V && V.revision === P) return V.diagnostics.map(fe);
1233
1239
  let e = xe();
1234
1240
  return V = {
1235
- revision: F,
1241
+ revision: P,
1236
1242
  diagnostics: e
1237
1243
  }, e.map(fe);
1238
1244
  },
1239
1245
  text(e) {
1240
- return q(), s(e, I);
1246
+ return q(), s(e, F);
1241
1247
  },
1242
1248
  reset(e) {
1243
1249
  q();
1244
- let t = w(), n = t.nodeIndex.get(e.id);
1250
+ let t = C(), n = t.nodeIndex.get(e.id);
1245
1251
  if (!n) return;
1246
- let r = we(n), s = { ...P };
1252
+ let i = we(n), s = { ...N };
1247
1253
  for (let [e, n] of Object.entries(t.document.bindings)) {
1248
- if (!(t.controls.get(e) ?? []).some((e) => r.has(e.id))) continue;
1254
+ if (!(t.controls.get(e) ?? []).some((e) => i.has(e.id))) continue;
1249
1255
  let c = o(n.initial);
1250
- if (c) throw new a("expression-budget", `Parameter "${e}": ${i(c)}`, 0);
1256
+ if (c) throw new a("expression-budget", `Parameter "${e}": ${r(c)}`, 0);
1251
1257
  s[e] = B(n.initial);
1252
1258
  }
1253
- for (let e of r) G.set(e, (G.get(e) ?? 0) + 1);
1259
+ for (let e of i) G.set(e, (G.get(e) ?? 0) + 1);
1254
1260
  Q(s);
1255
1261
  },
1256
1262
  resetToken(e) {
1257
1263
  q();
1258
- let t = w().nodeIndex.get(e.id);
1264
+ let t = C().nodeIndex.get(e.id);
1259
1265
  return t ? G.get(t.id) ?? 0 : 0;
1260
1266
  },
1261
1267
  subscribe(e) {
@@ -1266,8 +1272,8 @@ function ye(e, t) {
1266
1272
  dispose() {
1267
1273
  if (!z) {
1268
1274
  z = !0, f.dispose();
1269
- for (let e of A.values()) e();
1270
- A.clear(), m.clear(), O.state.flush(), d && O.scheduler.dispose(), W.clear(), y.clear(), S.clear(), C.computationExpressions.clear(), C.constErrors.clear(), C.cycleErrors.clear(), C.validationRules.length = 0, G.clear();
1275
+ for (let e of k.values()) e();
1276
+ k.clear(), h.clear(), D.state.flush(), u && D.scheduler.dispose(), W.clear(), y.clear(), x.clear(), S.computationExpressions.clear(), S.constErrors.clear(), S.cycleErrors.clear(), S.validationRules.length = 0, G.clear();
1271
1277
  }
1272
1278
  }
1273
1279
  };