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,6 +1,6 @@
1
- import { B as e, F as t, G as n, I as r, J as i, K as a, M as o, N as s, O as c, U as l, it as u, j as d, k as f, n as p, r as m } from "./preset-core-CKc5YXSM.js";
1
+ import { w as e } from "./version-DAxuGOG2.js";
2
2
  // src/local/source/source-context.ts
3
- function ee(e, t) {
3
+ function t(e, t) {
4
4
  let n = e[t];
5
5
  if (n !== "`" && n !== "~") return;
6
6
  let r = 0;
@@ -10,98 +10,98 @@ function ee(e, t) {
10
10
  length: r
11
11
  } : void 0;
12
12
  }
13
- function h(e) {
13
+ function n(e) {
14
14
  if (!e.length) return {
15
15
  lines: [],
16
16
  maxMarkdownDepth: 0,
17
17
  potentialDepth: 0,
18
18
  fenceSpans: []
19
19
  };
20
- let t = [0];
21
- for (let n = 0; n < e.length; n++) {
22
- let r = e[n];
23
- r === "\r" ? (e[n + 1] === "\n" && n++, t.push(n + 1)) : r === "\n" && t.push(n + 1);
20
+ let n = [0];
21
+ for (let t = 0; t < e.length; t++) {
22
+ let r = e[t];
23
+ r === "\r" ? (e[t + 1] === "\n" && t++, n.push(t + 1)) : r === "\n" && n.push(t + 1);
24
24
  }
25
- let n = [], r = [], i = [], a = null, o = !1, s = 0, c = 0;
26
- for (let l = 0; l < t.length; l++) {
27
- let u = t[l], d = l + 1 < t.length ? t[l + 1] : e.length;
28
- for (; d > u && (e[d - 1] === "\r" || e[d - 1] === "\n");) d--;
29
- let f = e.slice(u, d), p = u, m = 0;
30
- for (; p < d;) {
31
- for (; e[p] === " " || e[p] === " ";) m += e[p] === " " ? 4 : 1, p++;
32
- if (e[p] === ">") {
33
- m++, p++;
25
+ let r = [], i = [], a = [], o = null, s = !1, c = 0, l = 0;
26
+ for (let u = 0; u < n.length; u++) {
27
+ let d = n[u], f = u + 1 < n.length ? n[u + 1] : e.length;
28
+ for (; f > d && (e[f - 1] === "\r" || e[f - 1] === "\n");) f--;
29
+ let p = e.slice(d, f), m = d, h = 0;
30
+ for (; m < f;) {
31
+ for (; e[m] === " " || e[m] === " ";) h += e[m] === " " ? 4 : 1, m++;
32
+ if (e[m] === ">") {
33
+ h++, m++;
34
34
  continue;
35
35
  }
36
- let t = /^(?:[-+*]|\d{1,9}[.)])(?=[ \t])/.exec(e.slice(p, d));
37
- if (t) m++, p += t[0].length;
36
+ let t = /^(?:[-+*]|\d{1,9}[.)])(?=[ \t])/.exec(e.slice(m, f));
37
+ if (t) h++, m += t[0].length;
38
38
  else break;
39
39
  }
40
- c = Math.max(c, m);
41
- let h = l === 0 && e.charCodeAt(0) === 65279 ? u + 1 : u, g = 0;
42
- for (; e[h + g] === " " || e[h + g] === " ";) g++;
43
- let _ = /^[ \t]*$/.test(e.slice(h, d)), v = h;
44
- for (let t = 0; t < 3 && e[v] === " "; t++) v++;
45
- let y = !1;
46
- if (a) {
47
- let t = e.slice(v, d), n = ee(t, 0);
48
- if (n && n.char === a.char && n.length >= a.length && /^[ \t]*$/.test(t.slice(n.length))) {
49
- a = null;
50
- let e = r[r.length - 1];
51
- e && (e.to = d);
40
+ l = Math.max(l, h);
41
+ let g = u === 0 && e.charCodeAt(0) === 65279 ? d + 1 : d, _ = 0;
42
+ for (; e[g + _] === " " || e[g + _] === " ";) _++;
43
+ let v = /^[ \t]*$/.test(e.slice(g, f)), y = g;
44
+ for (let t = 0; t < 3 && e[y] === " "; t++) y++;
45
+ let b = !1;
46
+ if (o) {
47
+ let n = e.slice(y, f), r = t(n, 0);
48
+ if (r && r.char === o.char && r.length >= o.length && /^[ \t]*$/.test(n.slice(r.length))) {
49
+ o = null;
50
+ let e = i[i.length - 1];
51
+ e && (e.to = f);
52
52
  }
53
- y = !0;
53
+ b = !0;
54
54
  } else {
55
- let t = e.slice(v, d), n = ee(t, 0);
56
- n && (n.char !== "`" || t.indexOf("`", n.length) < 0) && (a = {
57
- char: n.char,
58
- length: n.length
59
- }, y = !0, r.push({
60
- from: u,
55
+ let n = e.slice(y, f), r = t(n, 0);
56
+ r && (r.char !== "`" || n.indexOf("`", r.length) < 0) && (o = {
57
+ char: r.char,
58
+ length: r.length
59
+ }, b = !0, i.push({
60
+ from: d,
61
61
  to: e.length
62
62
  }));
63
63
  }
64
- let b = 0, x = 0;
65
- if (!y && !_) {
66
- let t = h;
64
+ let x = 0, S = 0;
65
+ if (!b && !v) {
66
+ let t = g;
67
67
  for (;;) {
68
68
  let n = t;
69
69
  for (let t = 0; t < 3 && e[n] === " "; t++) n++;
70
70
  if (e[n] !== ">") break;
71
- t = n + 1, e[t] === " " && t++, b++;
71
+ t = n + 1, e[t] === " " && t++, x++;
72
72
  }
73
73
  let n = t;
74
- for (; n < d && (e[n] === " " || e[n] === " ");) n++;
75
- let r = /^([-+*]|\d{1,9}[.)])(?=[ \t]|$)/.exec(e.slice(n, d)), a = n - t >= 4 && i.length === 0;
76
- if (r && !a) {
77
- let e = n - h;
78
- for (; i.length && i[i.length - 1] >= e;) i.pop();
79
- i.push(e);
74
+ for (; n < f && (e[n] === " " || e[n] === " ");) n++;
75
+ let r = /^([-+*]|\d{1,9}[.)])(?=[ \t]|$)/.exec(e.slice(n, f)), i = n - t >= 4 && a.length === 0;
76
+ if (r && !i) {
77
+ let e = n - g;
78
+ for (; a.length && a[a.length - 1] >= e;) a.pop();
79
+ a.push(e);
80
80
  } else {
81
81
  let e = n - t;
82
- for (; i.length && (e < i[i.length - 1] || o && e <= i[i.length - 1]);) i.pop();
82
+ for (; a.length && (e < a[a.length - 1] || s && e <= a[a.length - 1]);) a.pop();
83
83
  }
84
- x = b + i.length, x > s && (s = x);
84
+ S = x + a.length, S > c && (c = S);
85
85
  }
86
- o = !y && (_ || /^[ \t]*(?:>[ \t]*)*$/.test(f)), n.push({
87
- from: u,
88
- to: d,
89
- text: f,
90
- blank: _,
91
- indent: g,
92
- quoteDepth: b,
93
- fenced: y,
94
- depth: x
86
+ s = !b && (v || /^[ \t]*(?:>[ \t]*)*$/.test(p)), r.push({
87
+ from: d,
88
+ to: f,
89
+ text: p,
90
+ blank: v,
91
+ indent: _,
92
+ quoteDepth: x,
93
+ fenced: b,
94
+ depth: S
95
95
  });
96
96
  }
97
97
  return {
98
- lines: n,
99
- maxMarkdownDepth: s,
100
- potentialDepth: c,
101
- fenceSpans: r
98
+ lines: r,
99
+ maxMarkdownDepth: c,
100
+ potentialDepth: l,
101
+ fenceSpans: i
102
102
  };
103
103
  }
104
- var g = class {
104
+ var r = class {
105
105
  source;
106
106
  lineStarts = [0];
107
107
  logicalLines;
@@ -117,7 +117,7 @@ var g = class {
117
117
  return this.logicalLines = e;
118
118
  }
119
119
  get facts() {
120
- return this.factsValue ??= h(this.source);
120
+ return this.factsValue ??= n(this.source);
121
121
  }
122
122
  lineIndexAt(e) {
123
123
  let t = 0, n = this.lineStarts.length - 1;
@@ -130,7 +130,7 @@ var g = class {
130
130
  lineStartAt(e) {
131
131
  return this.lineStarts[this.lineIndexAt(e)];
132
132
  }
133
- }, _ = class {
133
+ }, i = class {
134
134
  context;
135
135
  chunks = [];
136
136
  segments = [];
@@ -192,17 +192,17 @@ var g = class {
192
192
  return n ? n.source + (e - n.from) * n.step : t;
193
193
  }
194
194
  };
195
- function v(e) {
195
+ function a(e) {
196
196
  if (typeof e != "string") return 0;
197
197
  let t = 0;
198
198
  for (let n of e) t += 1;
199
199
  return t;
200
200
  }
201
- function y(e, t) {
201
+ function o(e, t) {
202
202
  let n = e.slice(0, Math.max(0, t)), r = n.charCodeAt(n.length - 1);
203
203
  return r >= 55296 && r <= 56319 ? n.slice(0, -1) : n;
204
204
  }
205
- function* b(e, t = !1) {
205
+ function* s(e, t = !1) {
206
206
  let n = [{
207
207
  nodes: e,
208
208
  index: 0
@@ -221,8 +221,42 @@ function* b(e, t = !1) {
221
221
  }) : t && (yield r);
222
222
  }
223
223
  }
224
+ // src/local/observability-messages.ts
225
+ var c = Object.freeze({
226
+ "local.worker.timeout": {
227
+ en: "The background compilation request timed out after {timeoutMs} ms.",
228
+ zh: "编译 Worker 请求在 {timeoutMs} 毫秒后超时。"
229
+ },
230
+ "local.worker.error": {
231
+ en: "The background compiler failed while processing the request.",
232
+ zh: "编译 Worker 处理请求时失败。"
233
+ },
234
+ "local.worker.compile": {
235
+ en: "The background compiler could not complete this request.",
236
+ zh: "编译 Worker 无法完成此请求。"
237
+ },
238
+ "local.worker.compile.detail": {
239
+ en: "The background compiler could not complete this request: {detail}",
240
+ zh: "编译 Worker 无法完成此请求:{detail}"
241
+ },
242
+ "local.worker.stale-response": {
243
+ en: "The background compiler returned a response for an older source revision.",
244
+ zh: "编译 Worker 返回了较旧源码版本的响应。"
245
+ },
246
+ "local.export.failure": {
247
+ en: "The {stage} stage of export failed.",
248
+ zh: "导出流程的 {stage} 阶段失败。"
249
+ },
250
+ "local.resource.budget": {
251
+ en: "Resource {budget} used {actual} {unit}, exceeding the limit of {limit}.",
252
+ zh: "资源 {budget} 已使用 {actual} {unit},超过上限 {limit}。"
253
+ }
254
+ });
255
+ function l(e, t, n = {}) {
256
+ return c[e][t].replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g, (e, t) => String(n[t] ?? ""));
257
+ }
224
258
  // src/local/configuration/diagnostic-messages.ts
225
- var x = {
259
+ var u = {
226
260
  "local.version.unsupported": {
227
261
  en: "This reader accepts {supported}; migrate {declared} or use a compatible reader.",
228
262
  zh: "此阅读器支持 {supported};请迁移 {declared} 或使用兼容的阅读器。"
@@ -1679,7 +1713,7 @@ var x = {
1679
1713
  en: "Dynamic {attribute} date bound for parameter {name} is not a valid YYYY-MM-DD value.",
1680
1714
  zh: "参数 {name} 的动态 {attribute} 日期边界不是合法的 YYYY-MM-DD。"
1681
1715
  }
1682
- }, S = {
1716
+ }, d = {
1683
1717
  "local.options.invalid.object": "options.notObject",
1684
1718
  "local.options.invalid.limits": "options.limitsNotObject",
1685
1719
  "local.options.invalid.max-syntax-nodes": "options.maxSyntaxNodes",
@@ -1972,57 +2006,57 @@ var x = {
1972
2006
  "local.runtime.value.option": "runtime.option",
1973
2007
  "local.runtime.value.budget": "runtime.budget",
1974
2008
  "local.runtime.value.range-order": "runtime.rangeOrder"
1975
- }, te = 16, C = 256, ne = 2e3;
1976
- function re(e) {
1977
- if (typeof e == "string") return e.length > C ? `${y(e, 255)}…` : e;
2009
+ }, f = 16, p = 256, m = 2e3;
2010
+ function h(e) {
2011
+ if (typeof e == "string") return e.length > p ? `${o(e, 255)}…` : e;
1978
2012
  if (typeof e == "number") return Number.isFinite(e) ? e : String(e);
1979
2013
  if (typeof e == "boolean" || e === null) return e;
1980
2014
  if (e === void 0) return "";
1981
2015
  try {
1982
2016
  let t = JSON.stringify(e) ?? String(e);
1983
- return t.length > C ? `${y(t, 255)}…` : t;
2017
+ return t.length > p ? `${o(t, 255)}…` : t;
1984
2018
  } catch {
1985
- return y(String(e), C);
2019
+ return o(String(e), p);
1986
2020
  }
1987
2021
  }
1988
- function ie(e) {
2022
+ function g(e) {
1989
2023
  let t = Object.entries(e);
1990
2024
  if (t.length === 0) return;
1991
2025
  let n = {}, r = 0, i = 0;
1992
2026
  for (let [e, a] of t) {
1993
- if (i >= te) break;
2027
+ if (i >= f) break;
1994
2028
  if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)) continue;
1995
2029
  let t;
1996
2030
  try {
1997
- t = re(a);
2031
+ t = h(a);
1998
2032
  } catch {
1999
2033
  t = "";
2000
2034
  }
2001
2035
  let o = typeof t == "string" ? t.length : String(t).length;
2002
- if (r + o > ne) break;
2036
+ if (r + o > m) break;
2003
2037
  n[e] = t, r += o, i += 1;
2004
2038
  }
2005
2039
  return i > 0 ? n : void 0;
2006
2040
  }
2007
- function w(e, t) {
2008
- let n = t ? ie(t) : void 0;
2041
+ function _(e, t) {
2042
+ let n = t ? g(t) : void 0;
2009
2043
  return n ? {
2010
2044
  key: e,
2011
2045
  params: n
2012
2046
  } : { key: e };
2013
2047
  }
2014
- var ae = /* @__PURE__ */ "local.parse,local.budget,local.options.invalid,local.theme.expression,local.theme.name,local.theme.attribute,local.theme.malformed,local.theme.duplicate,local.theme.late,local.theme.nested,local.attribute,local.attribute.name,local.attribute.duplicate,local.budget.name,local.budget.math,local.tag.unclosed,local.tag.closing,local.tag.name,local.tag.mismatch,local.tag.shape,local.footnote.unsupported,local.interpolation,local.math.unclosed,local.math.whitespace,local.component.unknown,local.html,local.html.fallback,local.html.table,local.html.repair,local.html.literal,local.author.placement,local.author.unclosed,local.author.css-placement,local.author.script-placement,local.author.component-conflict,local.recovery.unclosed,local.recovery.mismatch,local.recovery.stray-close".split(","), oe = /* @__PURE__ */ "local.budget.data-table.cells,local.budget.data-table.columns,local.budget.data-table.rows,local.computation.budget,local.computation.const,local.computation.cycle,local.computation.duplicate,local.computation.expression,local.computation.name,local.computation.placement,local.computation.reserved,local.computation.unknown,local.external.placement,local.external.name,local.external.reserved,local.external.duplicate,local.external.conflict,local.external.type,local.host.structure,local.computation.value,local.data-table.column,local.data-table.key,local.data-table.rows,local.data-table.value,local.validation.budget,local.validation.expression,local.validation.failed,local.validation.fields,local.validation.placement,local.validation.when,local.parse,local.legacy,local.component.unknown,local.host.attribute,local.attribute.unknown,local.budget.attribute,local.attribute.color,local.attribute.required,local.label.required,local.attribute.static,local.expression.empty,local.expression.invalid,local.attribute.type,local.attribute.range,local.constraint,local.selection.key,local.structure.parent,local.structure.children,local.budget.array,local.option.value,local.tab.value,local.step.value,local.quiz.answer,local.diagram.node,local.diagram.edge,local.checklist.body,local.budget.identifier,local.binding.name,local.binding.reserved,local.binding.type,local.binding.exclusive,local.binding.constraint,local.binding.option,local.initial.duplicate,local.initial.length,local.initial.email,local.initial.range,local.initial.option,local.initial.type,local.initial.date,local.initial,local.initial.step,local.binding.unknown,local.type,local.interpolation,local.attribute.interpolation,local.anchor.id,local.anchor.duplicate,local.jump.target,local.budget.plot.curves,local.budget.plot.points,local.math.formula,local.math,local.math.display,local.math.binding,local.table.header,local.table.row,local.chart.numeric,local.chart.column,local.chart.negative,local.timeline.header,local.timeline.value,local.html.extended,local.html.attribute,local.html.unsafe-url,local.html.capability,local.capability.html,local.capability.plot".split(","), se = [
2048
+ var v = /* @__PURE__ */ "local.parse,local.budget,local.options.invalid,local.theme.expression,local.theme.name,local.theme.attribute,local.theme.malformed,local.theme.duplicate,local.theme.late,local.theme.nested,local.attribute,local.attribute.name,local.attribute.duplicate,local.budget.name,local.budget.math,local.tag.unclosed,local.tag.closing,local.tag.name,local.tag.mismatch,local.tag.shape,local.footnote.unsupported,local.interpolation,local.math.unclosed,local.math.whitespace,local.component.unknown,local.html,local.html.fallback,local.html.table,local.html.repair,local.html.literal,local.author.placement,local.author.unclosed,local.author.css-placement,local.author.script-placement,local.author.component-conflict,local.recovery.unclosed,local.recovery.mismatch,local.recovery.stray-close".split(","), y = /* @__PURE__ */ "local.budget.data-table.cells,local.budget.data-table.columns,local.budget.data-table.rows,local.computation.budget,local.computation.const,local.computation.cycle,local.computation.duplicate,local.computation.expression,local.computation.name,local.computation.placement,local.computation.reserved,local.computation.unknown,local.external.placement,local.external.name,local.external.reserved,local.external.duplicate,local.external.conflict,local.external.type,local.host.structure,local.computation.value,local.data-table.column,local.data-table.key,local.data-table.rows,local.data-table.value,local.validation.budget,local.validation.expression,local.validation.failed,local.validation.fields,local.validation.placement,local.validation.when,local.parse,local.legacy,local.component.unknown,local.host.attribute,local.attribute.unknown,local.budget.attribute,local.attribute.color,local.attribute.required,local.label.required,local.attribute.static,local.expression.empty,local.expression.invalid,local.attribute.type,local.attribute.range,local.constraint,local.selection.key,local.structure.parent,local.structure.children,local.budget.array,local.option.value,local.tab.value,local.step.value,local.quiz.answer,local.diagram.node,local.diagram.edge,local.checklist.body,local.budget.identifier,local.binding.name,local.binding.reserved,local.binding.type,local.binding.exclusive,local.binding.constraint,local.binding.option,local.initial.duplicate,local.initial.length,local.initial.email,local.initial.range,local.initial.option,local.initial.type,local.initial.date,local.initial,local.initial.step,local.binding.unknown,local.type,local.interpolation,local.attribute.interpolation,local.anchor.id,local.anchor.duplicate,local.jump.target,local.budget.plot.curves,local.budget.plot.points,local.math.formula,local.math,local.math.display,local.math.binding,local.table.header,local.table.row,local.chart.numeric,local.chart.column,local.chart.negative,local.timeline.header,local.timeline.value,local.html.extended,local.html.attribute,local.html.unsafe-url,local.html.capability,local.capability.html,local.capability.plot".split(","), b = [
2015
2049
  "local.runtime.binding",
2016
2050
  "local.runtime.value",
2017
2051
  "local.runtime.external"
2018
- ], ce = [
2052
+ ], x = [
2019
2053
  "local.theme.name",
2020
2054
  "local.theme.missing",
2021
2055
  "local.theme.manifest",
2022
2056
  "local.theme.duplicate",
2023
2057
  "local.theme.protocol",
2024
2058
  "local.theme.modes"
2025
- ], T = [
2059
+ ], S = [
2026
2060
  "expression-index",
2027
2061
  "expression-cycle",
2028
2062
  "expression-syntax",
@@ -2042,7 +2076,7 @@ var ae = /* @__PURE__ */ "local.parse,local.budget,local.options.invalid,local.t
2042
2076
  "expression-domain",
2043
2077
  "expression-divide-by-zero",
2044
2078
  "expression-interpolation"
2045
- ], le = [
2079
+ ], C = [
2046
2080
  "latex-budget",
2047
2081
  "latex-syntax",
2048
2082
  "latex-empty",
@@ -2057,7 +2091,13 @@ var ae = /* @__PURE__ */ "local.parse,local.budget,local.options.invalid,local.t
2057
2091
  "latex-undefined",
2058
2092
  "latex-plot-range",
2059
2093
  "latex-plot-samples"
2060
- ], ue = [
2094
+ ], w = [
2095
+ ...Object.keys(c),
2096
+ "local.worker.compile",
2097
+ "local.build.resource-budget",
2098
+ "local.extension.resource-budget",
2099
+ "local.extension.resource-conflict",
2100
+ "local.extension.resource-invalid",
2061
2101
  "local.version.unsupported",
2062
2102
  "local.version.malformed",
2063
2103
  "local.version.duplicate",
@@ -2068,101 +2108,76 @@ var ae = /* @__PURE__ */ "local.parse,local.budget,local.options.invalid,local.t
2068
2108
  "local.upgrade.text-length",
2069
2109
  "local.upgrade.expression",
2070
2110
  "local.upgrade.version-missing",
2071
- ...ae,
2072
- ...oe,
2073
- ...se,
2074
- ...ce
2075
- ], E = Object.freeze(Array.from(/* @__PURE__ */ new Set([
2076
- ...ue,
2077
- ...T,
2078
- ...T.map((e) => `local.expression.${e}`),
2079
- ...le
2080
- ]))), de = Object.freeze([...Object.keys(S), ...Object.keys(x).filter((e) => e.startsWith("error."))].sort());
2111
+ ...v,
2112
+ ...y,
2113
+ ...b,
2114
+ ...x
2115
+ ], T = Object.freeze(Array.from(/* @__PURE__ */ new Set([
2116
+ ...w,
2117
+ ...S,
2118
+ ...S.map((e) => `local.expression.${e}`),
2119
+ ...C
2120
+ ]))), E = Object.freeze([
2121
+ ...Object.keys(d),
2122
+ ...Object.keys(u).filter((e) => e.startsWith("error.")),
2123
+ ...Object.keys(c)
2124
+ ].sort());
2081
2125
  function D(e) {
2082
- if (Object.hasOwn(S, e)) return S[e];
2083
- if (Object.hasOwn(x, e)) return e;
2126
+ if (Object.hasOwn(d, e)) return d[e];
2127
+ if (Object.hasOwn(u, e)) return e;
2084
2128
  }
2085
2129
  function O(e, t = "en") {
2130
+ if (Object.hasOwn(c, e)) return c[e][t === "zh" ? "zh" : "en"];
2086
2131
  let n = D(e);
2087
- if (n) return x[n][t === "zh" ? "zh" : "en"];
2132
+ if (n) return u[n][t === "zh" ? "zh" : "en"];
2088
2133
  }
2089
- function fe(e) {
2090
- return typeof e == "string" && E.includes(e);
2134
+ function k(e) {
2135
+ return typeof e == "string" && T.includes(e);
2091
2136
  }
2092
- function k(e, t) {
2137
+ function A(e, t) {
2093
2138
  return t ? e.replace(/\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (e, n) => {
2094
2139
  let r = t[n];
2095
2140
  return r === void 0 ? "" : String(r);
2096
2141
  }) : e;
2097
2142
  }
2098
- function A(e, t = "en", n) {
2143
+ function j(e, t = "en", n) {
2099
2144
  let r = O(e, t);
2100
- return r === void 0 ? "" : k(r, n);
2145
+ return r === void 0 ? "" : A(r, n);
2101
2146
  }
2102
- function j(e) {
2103
- return A(e.key, "en", e.params);
2147
+ function M(e) {
2148
+ return j(e.key, "en", e.params);
2104
2149
  }
2105
- function pe(e, t = "en") {
2106
- let n = typeof e.messageKey == "string" ? e.messageKey : void 0, r = n === void 0 ? void 0 : O(n, t), i = e.params;
2107
- if (t === "zh" && i) {
2108
- let e = n === void 0 ? void 0 : D(n);
2150
+ function N(t, n = "en") {
2151
+ let r = typeof t.messageKey == "string" ? t.messageKey : void 0, i = r === void 0 ? void 0 : O(r, n), a = t.params ?? t.details;
2152
+ if (n === "zh" && a) {
2153
+ let e = r === void 0 ? void 0 : D(r);
2109
2154
  if (e === "expression.error" || e === "math.computeFailed") {
2110
- let e = typeof i.code == "string" ? O(`error.${i.code}`, "zh") : void 0;
2155
+ let e = typeof a.code == "string" ? O(`error.${a.code}`, "zh") : void 0;
2111
2156
  if (e) {
2112
- let t = typeof i.near == "string" && i.near ? ` 相关源码:${i.near}` : "";
2113
- i = {
2114
- ...i,
2157
+ let t = typeof a.near == "string" && a.near ? ` 相关源码:${a.near}` : "";
2158
+ a = {
2159
+ ...a,
2115
2160
  detail: e + t
2116
2161
  };
2117
2162
  }
2118
- } else if (e === "runtime.budget" && typeof i.detailKey == "string") {
2119
- let e = O(i.detailKey, "zh");
2120
- e && (i = {
2121
- ...i,
2122
- detail: k(e, i)
2163
+ } else if (e === "runtime.budget" && typeof a.detailKey == "string") {
2164
+ let e = O(a.detailKey, "zh");
2165
+ e && (a = {
2166
+ ...a,
2167
+ detail: A(e, a)
2123
2168
  });
2124
2169
  }
2125
2170
  }
2126
- let a = r === void 0 ? typeof e.message == "string" ? e.message : String(e.message ?? "") : k(r, i), o = typeof a == "string" ? a : String(a ?? "");
2127
- return o.length > 2e3 ? `${y(o, u - 1)}…` : o;
2128
- }
2129
- // src/local/html/html-names.ts
2130
- var M = /* @__PURE__ */ new Set(/* @__PURE__ */ "b.strong.i.em.s.del.u.mark.sup.sub.br.hr.img.p.h1.h2.h3.h4.h5.h6.div.span.details.summary.blockquote.code.pre.ul.ol.li.a".split(".")), me = /* @__PURE__ */ new Set([
2131
- "div",
2132
- "p",
2133
- "h1",
2134
- "h2",
2135
- "h3",
2136
- "h4",
2137
- "h5",
2138
- "h6"
2139
- ]);
2140
- function he(e) {
2141
- let t = e.trim().toLowerCase();
2142
- return t === "left" || t === "center" || t === "right" || t === "justify" ? t : null;
2143
- }
2144
- var ge = /* @__PURE__ */ new Set([
2145
- "href",
2146
- "target",
2147
- "rel"
2148
- ]);
2149
- function _e(e, t) {
2150
- if (t?.toLowerCase() !== "_blank") return e;
2151
- let n = [], r = /* @__PURE__ */ new Set();
2152
- for (let t of (e ?? "").split(/[\t\n\f\r ]+/)) {
2153
- let e = t.toLowerCase();
2154
- t && e !== "opener" && !r.has(e) && (r.add(e), n.push(t));
2155
- }
2156
- for (let e of ["noopener", "noreferrer"]) r.has(e) || n.push(e);
2157
- return n.join(" ");
2171
+ let s = i === void 0 ? typeof t.message == "string" ? t.message : String(t.message ?? "") : A(i, a), c = typeof s == "string" ? s : String(s ?? "");
2172
+ return c.length > 2e3 ? `${o(c, e - 1)}…` : c;
2158
2173
  }
2159
2174
  // src/themes/document-theme.ts
2160
- var N = "reactive-md-theme-1", P = Object.freeze({
2175
+ var P = "reactive-md-theme-1", F = Object.freeze({
2161
2176
  name: "default",
2162
- protocol: N,
2177
+ protocol: P,
2163
2178
  colorSchemes: Object.freeze(["light", "dark"])
2164
2179
  });
2165
- function ve(e, t) {
2180
+ function I(e, t) {
2166
2181
  let n = typeof t == "string" ? t.length : Infinity;
2167
2182
  if (!e || typeof e.start != "number" || typeof e.end != "number" || !Number.isFinite(e.start) || !Number.isFinite(e.end)) return {
2168
2183
  start: 0,
@@ -2174,7 +2189,7 @@ function ve(e, t) {
2174
2189
  end: Math.max(r, Math.min(n, Math.floor(e.end)))
2175
2190
  };
2176
2191
  }
2177
- function ye(e, t) {
2192
+ function L(e, t) {
2178
2193
  if (typeof e != "string" || e.length === 0) return {
2179
2194
  line: 1,
2180
2195
  column: 1
@@ -2186,11 +2201,11 @@ function ye(e, t) {
2186
2201
  column: t - i + 1
2187
2202
  };
2188
2203
  }
2189
- function be(e, t, n, r) {
2190
- let i = ve(n, r), { line: a, column: o } = ye(r, i.start);
2204
+ function R(e, t, n, r) {
2205
+ let i = I(n, r), { line: a, column: o } = L(r, i.start);
2191
2206
  return {
2192
2207
  code: e,
2193
- message: j(t),
2208
+ message: M(t),
2194
2209
  severity: "warning",
2195
2210
  range: i,
2196
2211
  line: a,
@@ -2199,605 +2214,52 @@ function be(e, t, n, r) {
2199
2214
  ...t.params ? { params: t.params } : {}
2200
2215
  };
2201
2216
  }
2202
- function xe(e, t, n, r) {
2217
+ function z(e, t, n, r) {
2203
2218
  let i = (e, t) => ({
2204
- name: P.name,
2205
- diagnostics: [be(e, t, n, r)]
2219
+ name: F.name,
2220
+ diagnostics: [R(e, t, n, r)]
2206
2221
  }), a = e;
2207
2222
  if (a == null || a === "") return {
2208
- name: P.name,
2223
+ name: F.name,
2209
2224
  diagnostics: []
2210
2225
  };
2211
- if (!F(a)) return i("local.theme.name", w("local.theme.name", {
2226
+ if (!V(a)) return i("local.theme.name", _("local.theme.name", {
2212
2227
  name: String(a),
2213
2228
  limit: 64
2214
2229
  }));
2215
2230
  let o = a;
2216
- if (o === P.name) return {
2217
- name: P.name,
2231
+ if (o === F.name) return {
2232
+ name: F.name,
2218
2233
  diagnostics: []
2219
2234
  };
2220
- if (!Array.isArray(t)) return i("local.theme.missing", w("local.theme.missing", { name: o }));
2235
+ if (!Array.isArray(t)) return i("local.theme.missing", _("local.theme.missing", { name: o }));
2221
2236
  let s = 0, c = null;
2222
2237
  try {
2223
2238
  for (let e of t) typeof e == "object" && e && !Array.isArray(e) && e.name === o && (s += 1, c = e);
2224
2239
  } catch {
2225
- return i("local.theme.manifest", w("local.theme.manifest.unreadable"));
2240
+ return i("local.theme.manifest", _("local.theme.manifest.unreadable"));
2226
2241
  }
2227
- if (s === 0) return i("local.theme.missing", w("local.theme.missing", { name: o }));
2228
- if (s > 1) return i("local.theme.duplicate", w("local.theme.duplicate", { name: o }));
2242
+ if (s === 0) return i("local.theme.missing", _("local.theme.missing", { name: o }));
2243
+ if (s > 1) return i("local.theme.duplicate", _("local.theme.duplicate", { name: o }));
2229
2244
  try {
2230
2245
  let e = c;
2231
- if (!e || typeof e != "object") return i("local.theme.manifest", w("local.theme.manifest.definition", { name: o }));
2232
- if (e.protocol !== "reactive-md-theme-1") return i("local.theme.protocol", w("local.theme.protocol", {
2246
+ if (!e || typeof e != "object") return i("local.theme.manifest", _("local.theme.manifest.definition", { name: o }));
2247
+ if (e.protocol !== "reactive-md-theme-1") return i("local.theme.protocol", _("local.theme.protocol", {
2233
2248
  name: o,
2234
- protocol: N
2249
+ protocol: P
2235
2250
  }));
2236
2251
  let t = e.colorSchemes;
2237
- if (!Array.isArray(t) || !t.includes("light") || !t.includes("dark")) return i("local.theme.modes", w("local.theme.modes", { name: o }));
2252
+ if (!Array.isArray(t) || !t.includes("light") || !t.includes("dark")) return i("local.theme.modes", _("local.theme.modes", { name: o }));
2238
2253
  } catch {
2239
- return i("local.theme.manifest", w("local.theme.manifest.selected", { name: o }));
2254
+ return i("local.theme.manifest", _("local.theme.manifest.selected", { name: o }));
2240
2255
  }
2241
2256
  return {
2242
2257
  name: o,
2243
2258
  diagnostics: []
2244
2259
  };
2245
2260
  }
2246
- var Se = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
2247
- function F(e) {
2248
- return typeof e == "string" && e.length > 0 && e.length <= 64 && Se.test(e);
2249
- }
2250
- var I = Object.freeze([
2251
- Object.freeze({
2252
- name: "computed",
2253
- form: "leaf",
2254
- childRule: "none",
2255
- label: "none",
2256
- props: {
2257
- name: {
2258
- kind: "string",
2259
- static: !0,
2260
- required: !0
2261
- },
2262
- value: {
2263
- kind: "string",
2264
- required: !0
2265
- }
2266
- },
2267
- structure: {
2268
- rule: "none",
2269
- label: "none"
2270
- },
2271
- rules: [{
2272
- kind: "require-full-interpolation",
2273
- attributes: ["value"]
2274
- }]
2275
- }),
2276
- Object.freeze({
2277
- name: "const",
2278
- form: "leaf",
2279
- childRule: "none",
2280
- label: "none",
2281
- props: {
2282
- name: {
2283
- kind: "string",
2284
- static: !0,
2285
- required: !0
2286
- },
2287
- value: {
2288
- kind: "string",
2289
- required: !0
2290
- }
2291
- },
2292
- structure: {
2293
- rule: "none",
2294
- label: "none"
2295
- },
2296
- rules: [{
2297
- kind: "require-full-interpolation",
2298
- attributes: ["value"]
2299
- }]
2300
- }),
2301
- Object.freeze({
2302
- name: "external",
2303
- form: "leaf",
2304
- childRule: "none",
2305
- label: "none",
2306
- props: {
2307
- name: {
2308
- kind: "string",
2309
- static: !0,
2310
- required: !0
2311
- },
2312
- type: {
2313
- kind: "enum",
2314
- static: !0,
2315
- required: !0,
2316
- values: [
2317
- "string",
2318
- "number",
2319
- "boolean",
2320
- "string-array",
2321
- "number-array"
2322
- ]
2323
- }
2324
- },
2325
- structure: {
2326
- rule: "none",
2327
- label: "none"
2328
- }
2329
- })
2330
- ]);
2331
- function Ce(e, t) {
2332
- let n = Array.from({ length: t.length + 1 }, (e, t) => t);
2333
- for (let r = 1; r <= e.length; r++) {
2334
- let i = n[0];
2335
- n[0] = r;
2336
- for (let a = 1; a <= t.length; a++) {
2337
- let o = n[a];
2338
- n[a] = Math.min(n[a] + 1, n[a - 1] + 1, i + (e[r - 1] === t[a - 1] ? 0 : 1)), i = o;
2339
- }
2340
- }
2341
- return n[t.length];
2342
- }
2343
- function we(e, t) {
2344
- let n, r = Infinity;
2345
- for (let i of t) {
2346
- let t = Ce(e, i);
2347
- t < r && (n = i, r = t);
2348
- }
2349
- return r <= 2 ? n : void 0;
2350
- }
2351
- // src/sdk/compat-profile.ts
2352
- var L = Object.freeze([Object.freeze({
2353
- name: "reactive-md-config/v1@0.7.0",
2354
- protocol: t,
2355
- sdkRange: "0.7.0",
2356
- targetProtocol: r,
2357
- targetSdkRange: "0.7.0",
2358
- preset: Object.freeze({
2359
- id: "reactive-md/default",
2360
- version: "0.7.0"
2361
- }),
2362
- legacyKeys: Object.freeze([Object.freeze({
2363
- profile: t,
2364
- algorithm: "external-components/v1"
2365
- })]),
2366
- source: "git tag v0.7.0:src/presets/default.ts and src/sdk/config.ts; docs/compatibility/compatibility-ch.md"
2367
- })]);
2368
- function R(e, t = L) {
2369
- for (let n of t) if (n.preset.id === e.id && n.preset.version === e.version) return n;
2370
- }
2371
- function Te(e = []) {
2372
- return e.length === 0 ? L : Object.freeze([...L, ...e]);
2373
- }
2374
- // src/sdk/assembly.ts
2375
- var Ee = /* @__PURE__ */ new Set([
2376
- "protocol",
2377
- "presets",
2378
- "components",
2379
- "replacementPolicy",
2380
- "themes"
2381
- ]), z = 32, B = 256, V = 32;
2382
- function H(e, t) {
2383
- throw Error(`Invalid local SDK config (${e}): ${t}`);
2384
- }
2385
- function U(e, t) {
2386
- return e < t ? -1 : +(e > t);
2387
- }
2388
- function W(e, t) {
2389
- return [...e].sort((e, n) => U(t(e), t(n)));
2390
- }
2391
- function G(e) {
2392
- if (typeof e != "object" || !e || Array.isArray(e)) return !1;
2393
- let t = Object.getPrototypeOf(e);
2394
- return t === Object.prototype || t === null;
2395
- }
2396
- function K(e) {
2397
- if (Array.isArray(e)) return e.map(K);
2398
- if (G(e)) {
2399
- let t = {};
2400
- for (let n of Object.keys(e).sort(U)) t[n] = K(e[n]);
2401
- return t;
2402
- }
2403
- return e;
2404
- }
2405
- function q(e, t) {
2406
- return JSON.stringify(K(e)) === JSON.stringify(K(t));
2407
- }
2408
- function De(e) {
2409
- Array.isArray(e) || H("assembly.presets", "must be an array."), e.length > z && H("assembly.presets", `accepts at most ${z} packages.`);
2410
- let t = W(e.map((e, t) => {
2411
- try {
2412
- return m(e);
2413
- } catch (e) {
2414
- H(`assembly.presets[${t}]`, e instanceof Error ? e.message : String(e));
2415
- }
2416
- }), (e) => e.id), n = /* @__PURE__ */ new Set();
2417
- for (let e of t) n.has(e.id) && H("assembly.presets", `preset "${e.id}" is selected more than once.`), n.add(e.id);
2418
- return Object.freeze(t);
2419
- }
2420
- function Oe(e) {
2421
- Array.isArray(e) || H("assembly.components", "must be an array."), e.length > B && H("assembly.components", `accepts at most ${B} components.`);
2422
- let t = W(e.map((e, t) => {
2423
- try {
2424
- return o(e);
2425
- } catch (e) {
2426
- H(`assembly.components[${t}]`, e instanceof Error ? e.message : String(e));
2427
- }
2428
- }), (e) => e.id);
2429
- return Object.freeze(t);
2430
- }
2431
- function ke(e) {
2432
- Array.isArray(e) || H("assembly.themes", "must be an array."), e.length > V && H("assembly.themes", `accepts at most ${V} themes.`);
2433
- let t = /* @__PURE__ */ new Set();
2434
- return Object.freeze(W(e.map((e, n) => {
2435
- G(e) || H(`assembly.themes[${n}]`, "must be an object.");
2436
- let r = e.id, i = e.name, a = e.version;
2437
- return (typeof r != "string" || r.length === 0) && H(`assembly.themes[${n}].id`, "must be a non-empty string."), (typeof i != "string" || i.length === 0) && H(`assembly.themes[${n}].name`, "must be a non-empty string."), typeof a == "string" && l(a) || H(`assembly.themes[${n}].version`, "must be a semantic version."), t.has(r) && H("assembly.themes", `theme id "${r}" is declared more than once.`), t.add(r), Object.freeze({ ...e });
2438
- }), (e) => e.id));
2439
- }
2440
- function Ae(e) {
2441
- G(e) || H("assembly", "must be an object.");
2442
- for (let t of Object.keys(e)) Ee.has(t) || H("assembly", `unknown field "${t}".`);
2443
- e.protocol !== "reactive-md-assembly/v1" && H("assembly.protocol", `must be "${s}".`);
2444
- let t = e.replacementPolicy;
2445
- return t !== "allow" && t !== "forbid" && H("assembly.replacementPolicy", "must be \"allow\" or \"forbid\"."), Object.freeze({
2446
- protocol: s,
2447
- presets: De(e.presets),
2448
- components: Oe(e.components),
2449
- replacementPolicy: t,
2450
- themes: ke(e.themes)
2451
- });
2452
- }
2453
- function je(e) {
2454
- let t = new Map(e.map((e) => [e.id, e])), n = /* @__PURE__ */ new Map(), r = [], i = (e) => {
2455
- let a = n.get(e);
2456
- if (a === "done") return;
2457
- a === "visiting" && H("assembly.presets", `preset dependency cycle at "${e}".`);
2458
- let o = t.get(e);
2459
- o || H("assembly.presets", `missing preset dependency "${e}".`), n.set(e, "visiting");
2460
- for (let e of W(o.dependencies ?? [], (e) => e.id)) {
2461
- let n = t.get(e.id);
2462
- n || H("assembly.presets", `preset "${o.id}" requires missing preset "${e.id}".`), l(e.version) || H("assembly.presets", `preset dependency "${e.id}" must use an exact version.`), n.version !== e.version && H("assembly.presets", `preset "${o.id}" requires "${e.id}" ${e.version}, but ${n.version} is installed.`), i(e.id);
2463
- }
2464
- n.set(e, "done"), r.push(o);
2465
- };
2466
- for (let e of [...t.keys()].sort(U)) i(e);
2467
- return Object.freeze(r);
2468
- }
2469
- function J(e) {
2470
- let { description: t, ...n } = e;
2471
- return n;
2472
- }
2473
- function Y(e) {
2474
- return e.structure ?? d(e.children) ?? null;
2475
- }
2476
- function Me(e, t) {
2477
- for (let n of [
2478
- "interactive",
2479
- "static",
2480
- "ssr",
2481
- "offline"
2482
- ]) if (t.capabilities[n] && !e.capabilities[n]) return !1;
2483
- return !0;
2484
- }
2485
- function Ne(e, t) {
2486
- let n = e.definition, r = t.definition, i = `assembly.replacements["${n.id}"]`;
2487
- (n.id !== r.id || n.name !== r.name) && H(i, "the replacement must keep the target id and tag name."), n.form !== r.form && H(i, "the replacement must keep the target form.");
2488
- for (let e of Object.keys(n.props)) {
2489
- let t = n.props[e], a = r.props[e];
2490
- a || H(i, `the replacement removed prop "${e}".`), q(J(t), J(a)) || H(i, `the replacement changed the semantics of prop "${e}".`);
2491
- }
2492
- for (let e of Object.keys(r.props)) Object.hasOwn(n.props, e) || r.props[e].required === !0 && H(i, `the replacement added required prop "${e}".`);
2493
- let a = n.bindings ?? {}, o = r.bindings ?? {}, s = Object.keys(a).sort(U);
2494
- q(s, Object.keys(o).sort(U)) || H(i, "the replacement must keep the target binding slots unchanged.");
2495
- for (let e of s) q(a[e], o[e]) || H(i, `the replacement changed binding slot "${e}".`);
2496
- q(Y(n), Y(r)) || H(i, "the replacement changed the target child structure."), q(n.rules ?? [], r.rules ?? []) || H(i, "the replacement changed semantic rules."), q(n.slotRelations ?? [], r.slotRelations ?? []) || H(i, "the replacement changed slot relations."), n.legacyHost === !0 != (r.legacyHost === !0) && H(i, "the replacement changed legacyHost."), Me(r, n) || H(i, "the replacement downgraded a declared capability.");
2497
- }
2498
- function Pe(e, t) {
2499
- return e.id === t.id ? t.version === void 0 || a(t.version) !== null && n(e.version, t.version) : !1;
2500
- }
2501
- function Fe(e, t) {
2502
- return Object.freeze({
2503
- id: e.definition.id,
2504
- name: e.definition.name,
2505
- fromVersion: e.definition.version,
2506
- toVersion: t.definition.version,
2507
- fromDigest: c(e.definition),
2508
- toDigest: c(t.definition),
2509
- ...e.origin.kind === "preset" ? { fromPreset: e.origin.id } : {},
2510
- ...t.origin.kind === "preset" ? { toPreset: t.origin.id } : {}
2511
- });
2512
- }
2513
- function Ie(e, t) {
2514
- let n = [], r = 0;
2515
- for (let t of e) for (let e of t.components) n.push({
2516
- definition: e,
2517
- origin: {
2518
- kind: "preset",
2519
- id: t.id
2520
- },
2521
- index: r
2522
- }), r += 1;
2523
- for (let e of W(t, (e) => e.id)) n.push({
2524
- definition: e,
2525
- origin: { kind: "external" },
2526
- index: r
2527
- }), r += 1;
2528
- return n;
2529
- }
2530
- function Le(e) {
2531
- let t = /* @__PURE__ */ new Map();
2532
- for (let n of e) n.authoring !== void 0 && n.authoring.length !== 0 && t.set(n.id, new Map(n.authoring.map((e) => [e.componentId, e.authoring])));
2533
- return t;
2534
- }
2535
- function X(e, t) {
2536
- return t === void 0 ? e : e === void 0 ? t : Object.freeze({
2537
- ...e.title === void 0 ? {} : { title: e.title },
2538
- ...e.description === void 0 ? {} : { description: e.description },
2539
- ...e.category === void 0 ? {} : { category: e.category },
2540
- ...e.insertText === void 0 ? {} : { insertText: e.insertText },
2541
- ...t.title === void 0 ? {} : { title: t.title },
2542
- ...t.description === void 0 ? {} : { description: t.description },
2543
- ...t.category === void 0 ? {} : { category: t.category },
2544
- ...t.insertText === void 0 ? {} : { insertText: t.insertText }
2545
- });
2546
- }
2547
- function Z(e, t) {
2548
- let n = e.origin.kind === "preset" ? t.get(e.origin.id)?.get(e.definition.id) : void 0;
2549
- return X(e.definition.authoring, n);
2550
- }
2551
- function Re(e, t) {
2552
- return t === void 0 || t === e.authoring ? e : o({
2553
- ...e,
2554
- authoring: t
2555
- });
2556
- }
2557
- function ze(e, t, n) {
2558
- let r = /* @__PURE__ */ new Map();
2559
- for (let t of e) {
2560
- let e = r.get(t.definition.id);
2561
- e ? e.push(t) : r.set(t.definition.id, [t]);
2562
- }
2563
- let i = [], a = [];
2564
- for (let e of r.values()) {
2565
- if (e.length === 1) {
2566
- let r = e[0];
2567
- r.definition.replaces !== void 0 && (t === "forbid" && H("assembly.replacements", `replacement for "${r.definition.id}" is forbidden.`), H("assembly.replacements", `replacement for "${r.definition.id}" has no base contribution.`));
2568
- let a = Z(r, n);
2569
- i.push({
2570
- ...r,
2571
- position: r.index,
2572
- ...a === void 0 ? {} : { authoring: a }
2573
- });
2574
- continue;
2575
- }
2576
- let r = e.filter((e) => e.definition.replaces !== void 0);
2577
- t === "forbid" && r.length > 0 && H("assembly.replacements", `replacement for "${e[0].definition.id}" is forbidden.`), r.length === 0 && H("assembly.components", `component id "${e[0].definition.id}" is declared more than once.`), r.length > 1 && H("assembly.replacements", `component id "${e[0].definition.id}" has more than one replacement.`), e.length > 2 && H("assembly.replacements", `component id "${e[0].definition.id}" has ambiguous base contributions.`);
2578
- let o = r[0], s = e.filter((e) => e !== o);
2579
- s.length !== 1 && H("assembly.replacements", `component id "${e[0].definition.id}" must have exactly one base.`);
2580
- let c = s[0];
2581
- c.definition.replaces !== void 0 && H("assembly.replacements", `component id "${e[0].definition.id}" uses a replacement chain.`);
2582
- let l = o.definition.replaces;
2583
- Pe(c.definition, l) || H("assembly.replacements", `replacement for "${c.definition.id}" does not match base version ${c.definition.version}.`), Ne(c, o);
2584
- let u = X(Z(c, n), Z(o, n));
2585
- i.push({
2586
- ...o,
2587
- position: c.index,
2588
- ...u === void 0 ? {} : { authoring: u }
2589
- }), a.push(Fe(c, o));
2590
- }
2591
- return i.sort((e, t) => e.position - t.position), {
2592
- active: Object.freeze(i),
2593
- replacements: Object.freeze(W(a, (e) => e.id))
2594
- };
2595
- }
2596
- function Be(t) {
2597
- let r = /* @__PURE__ */ new Map(), i = new Map(t.map((e) => [e.definition.id, e.definition]));
2598
- for (let a of t) {
2599
- let t = a.definition, o = r.get(t.name);
2600
- o !== void 0 && ((o.origin.kind === "preset" || a.origin.kind === "preset") && H("assembly.components", `name "${t.name}" conflicts with a built-in component "${o.definition.id}".`), H("assembly.components", `component name "${t.name}" is declared more than once by "${o.definition.id}" and "${t.id}".`)), r.set(t.name, a);
2601
- let s = t.requires?.kernel;
2602
- s !== void 0 && !n("0.7.0", s) && H("assembly.components", `component "${t.id}" requires kernel ${s}, but ${e} is installed.`);
2603
- for (let e of t.dependencies ?? []) {
2604
- let r = i.get(e.id);
2605
- r || H("assembly.dependencies", `component "${t.id}" requires missing component "${e.id}".`), e.version !== void 0 && !n(r.version, e.version) && H("assembly.dependencies", `component "${t.id}" requires "${e.id}" ${e.version}, but version ${r.version} is installed.`);
2606
- }
2607
- }
2608
- let a = /* @__PURE__ */ new Map(), o = (e, t) => {
2609
- let n = a.get(e);
2610
- if (n !== "done") {
2611
- n === "visiting" && H("assembly.dependencies", `dependency cycle: ${[...t, e].join(" -> ")}.`), a.set(e, "visiting");
2612
- for (let n of i.get(e)?.dependencies ?? []) i.has(n.id) && o(n.id, [...t, e]);
2613
- a.set(e, "done");
2614
- }
2615
- };
2616
- for (let e of [...i.keys()].sort(U)) o(e, []);
2617
- }
2618
- function Ve(e, t) {
2619
- let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = (e, t) => {
2620
- n.get(e.id) && H("assembly.themes", `theme id "${e.id}" is declared by both ${t} and another source.`), r.get(e.name) && H("assembly.themes", `theme name "${e.name}" is declared by both ${t} and another source.`), n.set(e.id, e), r.set(e.name, e);
2621
- };
2622
- for (let t of e) for (let e of t.themes ?? []) i(e, `preset:${t.id}`);
2623
- for (let e of t) i(e, "external");
2624
- return Object.freeze(W([...n.values()], (e) => e.id));
2625
- }
2626
- function He(e) {
2627
- return Object.freeze(W(e.map((e) => ({
2628
- id: e.id,
2629
- version: e.version,
2630
- digest: p(e)
2631
- })), (e) => e.id));
2632
- }
2633
- function Ue(e, t, n) {
2634
- let a = JSON.stringify({
2635
- protocol: r,
2636
- presets: W(e, (e) => e.id),
2637
- registry: [...t].map((e) => ({
2638
- id: e.id,
2639
- name: e.name,
2640
- version: e.version,
2641
- digest: c(e)
2642
- })).sort((e, t) => U(e.id, t.id)),
2643
- replacements: W(n, (e) => e.id)
2644
- });
2645
- return i(a);
2646
- }
2647
- function Q(e, n) {
2648
- let r = JSON.stringify({
2649
- protocol: t,
2650
- presets: [{
2651
- id: e.id,
2652
- version: e.version
2653
- }],
2654
- components: [...n].map((e) => ({
2655
- id: e.id,
2656
- version: e.version,
2657
- digest: c(e)
2658
- })).sort((e, t) => U(e.id, t.id))
2659
- });
2660
- return i(r);
2661
- }
2662
- function We(e, t = {}) {
2663
- let n = je(e.presets), r = ze(Ie(n, e.components), e.replacementPolicy, Le(n));
2664
- Be(r.active);
2665
- let i = Object.freeze(r.active.map((e) => Re(e.definition, e.authoring))), a = Object.freeze(W(r.active.filter((e) => e.origin.kind === "external").map((e) => e.definition), (e) => e.id)), o = He(n), s = Ve(n, e.themes), c = Ue(o, i, r.replacements), l = [], u = t.legacyProfiles === void 0 || n.length !== 1 || r.replacements.length !== 0 ? void 0 : R({
2666
- id: n[0].id,
2667
- version: n[0].version
2668
- }, t.legacyProfiles), d = u?.legacyKeys[0];
2669
- return u !== void 0 && d !== void 0 && l.push(Object.freeze({
2670
- profile: d.profile,
2671
- key: Q(u.preset, a)
2672
- })), Object.freeze({
2673
- presets: o,
2674
- components: a,
2675
- replacements: r.replacements,
2676
- registry: i,
2677
- themes: s,
2678
- key: c,
2679
- legacyKeys: Object.freeze(l)
2680
- });
2681
- }
2682
- function Ge(e, t, n = t.legacyKeys) {
2683
- return Object.freeze({
2684
- protocol: r,
2685
- assembly: e,
2686
- key: t.key,
2687
- presets: t.presets,
2688
- components: t.components,
2689
- replacements: t.replacements,
2690
- registry: t.registry,
2691
- themes: t.themes,
2692
- legacyKeys: Object.freeze(n)
2693
- });
2694
- }
2695
- function Ke(e) {
2696
- return Object.freeze({
2697
- protocol: "reactive-md-assembly-seal/v1",
2698
- configKey: e.key,
2699
- presets: Object.freeze(W(e.presets, (e) => e.id)),
2700
- components: Object.freeze(W(e.registry.map(f), (e) => e.id)),
2701
- replacements: Object.freeze(W(e.replacements, (e) => e.id)),
2702
- legacyKeys: Object.freeze(W(e.legacyKeys, (e) => e.key))
2703
- });
2704
- }
2705
- function qe(e) {
2706
- return i(JSON.stringify(Ke(e)));
2707
- }
2708
- function Je(e, t) {
2709
- return e.key === t || e.legacyKeys.some((e) => e.key === t);
2710
- }
2711
- // src/sdk/config-validation.ts
2712
- var Ye = 16777216, Xe = /* @__PURE__ */ new Set([
2713
- "__proto__",
2714
- "constructor",
2715
- "prototype"
2716
- ]), Ze = /* @__PURE__ */ new Set([
2717
- "protocol",
2718
- "key",
2719
- "assembly",
2720
- "presets",
2721
- "components",
2722
- "replacements",
2723
- "registry",
2724
- "themes",
2725
- "legacyKeys"
2726
- ]);
2727
- function $(e, t) {
2728
- throw Error(`Invalid local SDK config (${e}): ${t}`);
2729
- }
2730
- function Qe(e) {
2731
- if (typeof e != "object" || !e || Array.isArray(e)) return !1;
2732
- let t = Object.getPrototypeOf(e);
2733
- return t === Object.prototype || t === null;
2734
- }
2735
- function $e(e, t, n) {
2736
- for (let r of Object.keys(e)) Xe.has(r) && $(n, `field "${r}" is not allowed.`), t.has(r) || $(n, `unknown field "${r}".`);
2737
- }
2738
- function et(e, t, n = []) {
2739
- if (e === void 0) return Object.freeze([t]);
2740
- Array.isArray(e) || $("presets", "must be an array."), e.length === 0 && $("presets", "must select at least the default preset.");
2741
- let r = [];
2742
- for (let e of [t, ...n.map((e) => e.preset)]) r.some((t) => t.id === e.id && t.version === e.version) || r.push(e);
2743
- let i = /* @__PURE__ */ new Set(), a = [];
2744
- for (let n = 0; n < e.length; n += 1) {
2745
- let o = e[n], s, c;
2746
- typeof o == "string" ? s = o : Qe(o) ? ((o.id === void 0 || typeof o.id != "string") && $(`presets[${n}].id`, "must be a string."), s = o.id, o.version !== void 0 && (typeof o.version != "string" && $(`presets[${n}].version`, "must be a string."), c = o.version)) : $(`presets[${n}]`, "must be a preset id or preset reference.");
2747
- let l = s === "default" ? t.id : s, u = r.filter((e) => e.id === l);
2748
- u.length === 0 && $(`presets[${n}]`, `unsupported preset "${s}"; local.config.migration-unsupported: no compatibility profile matches this identity.`);
2749
- let d = c === void 0 ? u.length === 1 ? u[0] : void 0 : u.find((e) => e.version === c);
2750
- d === void 0 && $(`presets[${n}]`, `unsupported preset "${s}"${c === void 0 ? "" : ` version "${c}"`}; local.config.migration-unsupported: no compatibility profile matches this identity.`), i.has(d.id) && $("presets", `"${d.id}" is selected more than once.`), a.length > 0 && a[0].id !== d.id && $("presets", "reactive-md-config/v1 selects exactly one default preset identity."), i.add(d.id), a.push(d);
2751
- }
2752
- return Object.freeze(a);
2753
- }
2754
- function tt(e, t) {
2755
- if (e.components === void 0) return;
2756
- let n = new Map(t.map((e) => [e.id, e]));
2757
- for (let t of e.components) {
2758
- let r = n.get(t.id);
2759
- r && r.name === t.name && r.version === t.version && c(r) === t.digest || $("presets", `local.config.migration-unsupported: profile "${e.name}" cannot map legacy component "${t.id}".`);
2760
- }
2761
- }
2762
- function nt(e) {
2763
- let t = /* @__PURE__ */ new Set();
2764
- for (let n of e) t.add(n.name), t.add(n.id);
2765
- return t;
2766
- }
2767
- function rt(t, r) {
2768
- let i = new Map(t.map((e) => [e.id, e])), a = nt(r);
2769
- for (let r of t) {
2770
- let t = r.requires?.kernel;
2771
- t !== void 0 && !n("0.7.0", t) && $("requires", `component "${r.id}" requires kernel ${t}, but ${e} is installed.`);
2772
- for (let e of r.dependencies ?? []) {
2773
- let t = i.get(e.id)?.version ?? (a.has(e.id) ? "0.7.0" : null);
2774
- t === null && $("dependencies", `component "${r.id}" requires missing component "${e.id}".`), e.version !== void 0 && !n(t, e.version) && $("dependencies", `component "${r.id}" requires "${e.id}" ${e.version}, but version ${t} is installed.`);
2775
- }
2776
- }
2777
- let o = /* @__PURE__ */ new Map(), s = (e, t) => {
2778
- let n = o.get(e);
2779
- if (n === "done") return;
2780
- n === "visiting" && $("dependencies", `dependency cycle: ${[...t, e].join(" -> ")}.`), o.set(e, "visiting");
2781
- let r = i.get(e);
2782
- for (let n of r?.dependencies ?? []) i.has(n.id) && s(n.id, [...t, e]);
2783
- o.set(e, "done");
2784
- };
2785
- for (let e of i.keys()) s(e, []);
2786
- }
2787
- function it(e, t) {
2788
- if (e === void 0) return Object.freeze([]);
2789
- Array.isArray(e) || $("components", "must be an array."), e.length > 64 && $("components", "accepts at most 64 external components.");
2790
- let n = new Set([
2791
- ...t.map((e) => e.name),
2792
- ...I.map((e) => e.name),
2793
- ...M
2794
- ].map((e) => e.toLowerCase()));
2795
- n.add("theme");
2796
- let r = new Set(t.map((e) => e.id)), i = /* @__PURE__ */ new Set(), a = [];
2797
- for (let t = 0; t < e.length; t += 1) {
2798
- let s = o(e[t]);
2799
- n.has(s.name.toLowerCase()) && $(`components[${t}]`, `name "${s.name}" conflicts with a built-in component, HTML tag or theme declaration.`), r.has(s.id) && $("components", `component id "${s.id}" is declared more than once.`), i.has(s.name) && $("components", `component name "${s.name}" is declared more than once.`), r.add(s.id), i.add(s.name), a.push(s);
2800
- }
2801
- return rt(a, t), Object.freeze(a);
2261
+ var B = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
2262
+ function V(e) {
2263
+ return typeof e == "string" && e.length > 0 && e.length <= 64 && B.test(e);
2802
2264
  }
2803
- export { E as A, v as B, F as C, M as D, ge as E, O as F, b as H, de as I, A as L, pe as M, fe as N, he as O, w as P, _ as R, N as S, me as T, y as V, R as _, Qe as a, we as b, tt as c, Ge as d, Je as f, L as g, We as h, $ as i, j, _e as k, Ke as l, Ae as m, Ye as n, it as o, Q as p, $e as r, et as s, Ze as t, qe as u, Te as v, xe as w, P as x, I as y, g as z };
2265
+ export { a as _, T as a, k as c, E as d, j as f, r as g, i as h, z as i, _ as l, l as m, P as n, M as o, c as p, V as r, N as s, F as t, O as u, o as v, s as y };