reactive-md 0.6.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (471) hide show
  1. package/CHANGELOG-ch.md +66 -0
  2. package/CHANGELOG.md +66 -0
  3. package/CONTRIBUTING-ch.md +6 -62
  4. package/CONTRIBUTING.md +5 -63
  5. package/README-ch.md +232 -67
  6. package/README-en.md +209 -71
  7. package/README.md +209 -71
  8. package/SECURITY-ch.md +3 -1
  9. package/SECURITY.md +3 -1
  10. package/THIRD_PARTY_NOTICES.md +1909 -87
  11. package/cli/args.mjs +33 -1
  12. package/cli/build.mjs +62 -1
  13. package/cli/check.mjs +444 -0
  14. package/cli/help.mjs +181 -3
  15. package/cli/init.mjs +1577 -0
  16. package/cli/main.mjs +11 -1
  17. package/cli/package-loader.mjs +41 -0
  18. package/dist-library/LocalDocumentView-6trX7xJc.js +97920 -0
  19. package/dist-library/{authoring-BEVyth5X.js → authoring-BsfSwQRm.js} +237 -209
  20. package/dist-library/compiler--ea2CKQF.js +61 -0
  21. package/dist-library/compiler-core-kPiH-gOV.js +11805 -0
  22. package/dist-library/component-state-Cq2K5gkS.js +490 -0
  23. package/dist-library/component-state-D_cw_EHe.js +54 -0
  24. package/dist-library/config-validation-DXTynAw7.js +3005 -0
  25. package/dist-library/default-components-Z_YMio5P.js +2346 -0
  26. package/dist-library/identity-MYJXKSkB.js +1443 -0
  27. package/dist-library/math-display-BJz4gbFc.js +24000 -0
  28. package/dist-library/math-sample-BGEW49zY.js +1124 -0
  29. package/dist-library/options-CX5m5n-J.js +115 -0
  30. package/dist-library/parser-standard-DlCk7sLo.js +10122 -0
  31. package/dist-library/props-DGlBk0e5.js +183 -0
  32. package/dist-library/react-ByOHunUW.js +122 -0
  33. package/dist-library/reactive-md-authoring.js +712 -1077
  34. package/dist-library/reactive-md-build.js +7966 -0
  35. package/dist-library/reactive-md-compiler-standard.js +33 -0
  36. package/dist-library/reactive-md-compiler.js +22 -0
  37. package/dist-library/reactive-md-default-packs.js +71 -0
  38. package/dist-library/reactive-md-default-preset.js +10 -0
  39. package/dist-library/reactive-md-export.js +111 -0
  40. package/dist-library/reactive-md-print.css +18 -3
  41. package/dist-library/reactive-md-react-runtime.js +251 -0
  42. package/dist-library/reactive-md-react-server.js +55 -0
  43. package/dist-library/reactive-md-react-unstyled.js +9 -1
  44. package/dist-library/reactive-md-react.js +9 -1
  45. package/dist-library/reactive-md-runtime-browser.js +51 -0
  46. package/dist-library/reactive-md-runtime.js +3 -0
  47. package/dist-library/reactive-md-sdk.js +6 -0
  48. package/dist-library/reactive-md-standalone-host.js +442 -0
  49. package/dist-library/reactive-md-testing-browser.js +523 -0
  50. package/dist-library/reactive-md-testing-react.js +221 -0
  51. package/dist-library/reactive-md-testing.js +638 -0
  52. package/dist-library/reactive-md-vite.js +959 -0
  53. package/dist-library/reactive-md.css +1 -1
  54. package/dist-library/reactive-md.js +1080 -795
  55. package/dist-library/registry-B9Jc3FVe.js +1174 -0
  56. package/dist-library/resources-BGt8mpDA.js +204 -0
  57. package/dist-library/runtime-C-sbfpOX.js +1157 -0
  58. package/dist-library/runtime-Dkq7ldyg.js +172 -0
  59. package/dist-library/schema-ZFufO8V0.js +39 -0
  60. package/dist-library/shareable-DDVL4Fi9.js +844 -0
  61. package/dist-library/types/authoring/catalog.d.ts +168 -0
  62. package/dist-library/types/authoring/conformance.d.ts +24 -0
  63. package/dist-library/types/{editor → authoring}/editor-i18n.d.ts +3 -24
  64. package/dist-library/types/authoring/extensions.d.ts +13 -0
  65. package/dist-library/types/authoring/index.d.ts +14 -11
  66. package/dist-library/types/authoring/insert.d.ts +16 -0
  67. package/dist-library/types/{editor → authoring}/native-components.d.ts +19 -2
  68. package/dist-library/types/authoring/templates.d.ts +65 -0
  69. package/dist-library/types/build/diagnostics.d.ts +8 -0
  70. package/dist-library/types/build/digest.d.ts +5 -0
  71. package/dist-library/types/build/entry.d.ts +9 -0
  72. package/dist-library/types/build/host.d.ts +36 -0
  73. package/dist-library/types/build/index.d.ts +99 -0
  74. package/dist-library/types/build/notices.d.ts +29 -0
  75. package/dist-library/types/build/resources.d.ts +60 -0
  76. package/dist-library/types/build/vite.d.ts +15 -0
  77. package/dist-library/types/compiler/index.d.ts +22 -0
  78. package/dist-library/types/compiler/result.d.ts +30 -0
  79. package/dist-library/types/compiler/standard.d.ts +16 -0
  80. package/dist-library/types/compiler/types.d.ts +69 -0
  81. package/dist-library/types/components/chart-motion.d.ts +12 -0
  82. package/dist-library/types/components/controls.d.ts +21 -0
  83. package/dist-library/types/{local → components}/data-table.d.ts +10 -24
  84. package/dist-library/types/components/default-chart-types.d.ts +22 -0
  85. package/dist-library/types/components/default-chart.d.ts +2 -0
  86. package/dist-library/types/components/default-preset.d.ts +10 -0
  87. package/dist-library/types/components/diagram-inspector.d.ts +24 -0
  88. package/dist-library/types/components/gallery.d.ts +6 -0
  89. package/dist-library/types/components/layout.d.ts +23 -0
  90. package/dist-library/types/components/mafs-plot-grid.d.ts +57 -0
  91. package/dist-library/types/components/mafs-visuals.d.ts +40 -0
  92. package/dist-library/types/components/numeric-sliders.d.ts +3 -0
  93. package/dist-library/types/components/uiarc/calendar/calendar.d.ts +26 -0
  94. package/dist-library/types/components/uiarc/date-picker/date-picker.d.ts +29 -0
  95. package/dist-library/types/components/uiarc/lib/motion-tokens.d.ts +2 -0
  96. package/dist-library/types/components/uiarc/lib/use-today.d.ts +2 -0
  97. package/dist-library/types/components/uiarc/motion-tokens.d.ts +60 -0
  98. package/dist-library/types/components/uiarc/rmd-motion.d.ts +12 -0
  99. package/dist-library/types/components/uiarc/select/select.d.ts +21 -0
  100. package/dist-library/types/components/uiarc/slider/slider.d.ts +53 -0
  101. package/dist-library/types/components/use-hydrated.d.ts +6 -0
  102. package/dist-library/types/components/visuals.d.ts +13 -0
  103. package/dist-library/types/export/component-state.d.ts +39 -0
  104. package/dist-library/types/export/index.d.ts +47 -0
  105. package/dist-library/types/export/requirements.d.ts +23 -0
  106. package/dist-library/types/export/resources.d.ts +8 -0
  107. package/dist-library/types/export/restoration.d.ts +52 -0
  108. package/dist-library/types/index.d.ts +1 -0
  109. package/dist-library/types/local/compilation/compiler-core.d.ts +16 -0
  110. package/dist-library/types/local/compilation/compiler-services.d.ts +64 -0
  111. package/dist-library/types/local/compilation/compiler-structure.d.ts +46 -0
  112. package/dist-library/types/local/compilation/compiler-values.d.ts +9 -0
  113. package/dist-library/types/local/compilation/compiler.d.ts +34 -0
  114. package/dist-library/types/local/compilation/component-kernel.d.ts +487 -0
  115. package/dist-library/types/local/{dependencies.d.ts → compilation/dependencies.d.ts} +4 -3
  116. package/dist-library/types/local/{diagnostics.d.ts → configuration/diagnostic-messages.d.ts} +193 -65
  117. package/dist-library/types/local/configuration/diagnostics.d.ts +58 -0
  118. package/dist-library/types/local/{limits.d.ts → configuration/limits.d.ts} +15 -2
  119. package/dist-library/types/local/configuration/options-core.d.ts +120 -0
  120. package/dist-library/types/local/configuration/options.d.ts +17 -0
  121. package/dist-library/types/local/configuration/portable-options.d.ts +3 -0
  122. package/dist-library/types/local/configuration/schema-core.d.ts +32 -0
  123. package/dist-library/types/local/configuration/schema.d.ts +12 -0
  124. package/dist-library/types/local/contracts/types.d.ts +519 -0
  125. package/dist-library/types/local/{version.d.ts → contracts/version.d.ts} +1 -1
  126. package/dist-library/types/local/{computations.d.ts → evaluation/computations.d.ts} +6 -3
  127. package/dist-library/types/local/{expression.d.ts → evaluation/expression.d.ts} +2 -2
  128. package/dist-library/types/local/{math-display.d.ts → evaluation/math-display.d.ts} +2 -16
  129. package/dist-library/types/local/evaluation/math-sample.d.ts +23 -0
  130. package/dist-library/types/local/evaluation/math.d.ts +73 -0
  131. package/dist-library/types/local/{validation.d.ts → evaluation/validation.d.ts} +1 -1
  132. package/dist-library/types/local/html/html-details.d.ts +16 -0
  133. package/dist-library/types/local/html/html-entities.d.ts +7 -0
  134. package/dist-library/types/local/html/html-policy.d.ts +43 -0
  135. package/dist-library/types/local/html/html-recovery.d.ts +16 -0
  136. package/dist-library/types/local/html/html-table-names.d.ts +9 -0
  137. package/dist-library/types/local/{html-table.d.ts → html/html-table.d.ts} +2 -6
  138. package/dist-library/types/local/{html.d.ts → html/html.d.ts} +1 -1
  139. package/dist-library/types/local/index.d.ts +31 -24
  140. package/dist-library/types/local/markdown/fast-markdown.d.ts +137 -0
  141. package/dist-library/types/local/{footnotes.d.ts → markdown/footnotes.d.ts} +1 -1
  142. package/dist-library/types/local/{heading-anchors.d.ts → markdown/heading-anchors.d.ts} +12 -2
  143. package/dist-library/types/local/markdown/markdown-blocks.d.ts +55 -0
  144. package/dist-library/types/local/markdown/markdown-structure.d.ts +3 -0
  145. package/dist-library/types/local/markdown/plain-paragraphs.d.ts +10 -0
  146. package/dist-library/types/local/parsing/lexical.d.ts +21 -0
  147. package/dist-library/types/local/parsing/parse-budget.d.ts +67 -0
  148. package/dist-library/types/local/parsing/parser-capabilities.d.ts +42 -0
  149. package/dist-library/types/local/parsing/parser-core.d.ts +65 -0
  150. package/dist-library/types/local/parsing/parser-standard.d.ts +7 -0
  151. package/dist-library/types/local/parsing/parser.d.ts +16 -0
  152. package/dist-library/types/local/parsing/rmd-recovery.d.ts +48 -0
  153. package/dist-library/types/local/{LocalDocumentView.d.ts → rendering/LocalDocumentView.d.ts} +67 -24
  154. package/dist-library/types/local/rendering/legacy-component-adapter.d.ts +36 -0
  155. package/dist-library/types/local/rendering/render-types.d.ts +57 -0
  156. package/dist-library/types/local/rendering/view-revision.d.ts +75 -0
  157. package/dist-library/types/local/{retention.d.ts → runtime/retention.d.ts} +1 -1
  158. package/dist-library/types/local/runtime/runtime.d.ts +34 -0
  159. package/dist-library/types/local/{state.d.ts → runtime/state.d.ts} +4 -4
  160. package/dist-library/types/local/session/compiler-cache.d.ts +44 -0
  161. package/dist-library/types/local/session/incremental.d.ts +48 -0
  162. package/dist-library/types/local/session/parse-session.d.ts +62 -0
  163. package/dist-library/types/local/session/row-reuse.d.ts +46 -0
  164. package/dist-library/types/local/{authoring.d.ts → source/authoring.d.ts} +11 -3
  165. package/dist-library/types/local/source/node-walk.d.ts +3 -0
  166. package/dist-library/types/local/source/source-context.d.ts +63 -0
  167. package/dist-library/types/local/{source-migration.d.ts → source/source-migration.d.ts} +2 -2
  168. package/dist-library/types/local/{i18n.d.ts → theme/i18n.d.ts} +2 -2
  169. package/dist-library/types/local/theme/theme-name.d.ts +3 -0
  170. package/dist-library/types/local/{theme.d.ts → theme/theme.d.ts} +3 -3
  171. package/dist-library/types/local/transport/compile-patch.d.ts +127 -0
  172. package/dist-library/types/local/{compiled-data.d.ts → transport/compiled-data.d.ts} +1 -1
  173. package/dist-library/types/local/transport/flat-compiled-data.d.ts +17 -0
  174. package/dist-library/types/local/transport/shared-data.d.ts +10 -0
  175. package/dist-library/types/local/transport/worker.d.ts +265 -0
  176. package/dist-library/types/local/widgets/visuals.d.ts +25 -0
  177. package/dist-library/types/presets/default-authoring.d.ts +50 -0
  178. package/dist-library/types/presets/default-components.d.ts +4 -0
  179. package/dist-library/types/presets/default-semantics.d.ts +8 -0
  180. package/dist-library/types/presets/default.d.ts +11 -0
  181. package/dist-library/types/presets/identity.d.ts +7 -0
  182. package/dist-library/types/presets/packs.d.ts +4 -0
  183. package/dist-library/types/react/component-api.d.ts +260 -0
  184. package/dist-library/types/react/component-primitives.d.ts +21 -0
  185. package/dist-library/types/react/component-utils.d.ts +125 -0
  186. package/dist-library/types/react/default-theme.d.ts +6 -0
  187. package/dist-library/types/react/field-validation.d.ts +11 -0
  188. package/dist-library/types/react/index.d.ts +17 -5
  189. package/dist-library/types/react/overflow-text-tooltip.d.ts +6 -0
  190. package/dist-library/types/react/package.d.ts +69 -0
  191. package/dist-library/types/react/runtime/common.d.ts +4 -0
  192. package/dist-library/types/react/runtime/index.d.ts +8 -0
  193. package/dist-library/types/react/runtime/useComponentState.d.ts +30 -0
  194. package/dist-library/types/react/runtime/useKeys.d.ts +16 -0
  195. package/dist-library/types/react/runtime/useSwipe.d.ts +27 -0
  196. package/dist-library/types/react/runtime/useTicker.d.ts +17 -0
  197. package/dist-library/types/react/sdk.d.ts +110 -0
  198. package/dist-library/types/react/server.d.ts +15 -0
  199. package/dist-library/types/react/tooltip-layer.d.ts +10 -0
  200. package/dist-library/types/react/use-draft-field.d.ts +17 -0
  201. package/dist-library/types/runtime-services/browser/index.d.ts +63 -0
  202. package/dist-library/types/runtime-services/component-state.d.ts +152 -0
  203. package/dist-library/types/runtime-services/identity.d.ts +41 -0
  204. package/dist-library/types/runtime-services/index.d.ts +10 -0
  205. package/dist-library/types/runtime-services/random.d.ts +42 -0
  206. package/dist-library/types/runtime-services/runtime.d.ts +51 -0
  207. package/dist-library/types/runtime-services/scheduler.d.ts +44 -0
  208. package/dist-library/types/sdk/assembly.d.ts +73 -0
  209. package/dist-library/types/sdk/compat-profile.d.ts +57 -0
  210. package/dist-library/types/sdk/compiler-config.d.ts +33 -0
  211. package/dist-library/types/sdk/config-validation.d.ts +33 -0
  212. package/dist-library/types/sdk/config.d.ts +35 -0
  213. package/dist-library/types/sdk/hash.d.ts +9 -0
  214. package/dist-library/types/sdk/index.d.ts +10 -0
  215. package/dist-library/types/sdk/manifest.d.ts +49 -0
  216. package/dist-library/types/sdk/pattern.d.ts +11 -0
  217. package/dist-library/types/sdk/preset-core.d.ts +11 -0
  218. package/dist-library/types/sdk/preset.d.ts +9 -0
  219. package/dist-library/types/sdk/props.d.ts +33 -0
  220. package/dist-library/types/sdk/registry-core.d.ts +16 -0
  221. package/dist-library/types/sdk/registry.d.ts +18 -0
  222. package/dist-library/types/sdk/theme.d.ts +73 -0
  223. package/dist-library/types/sdk/types.d.ts +221 -0
  224. package/dist-library/types/sdk/version.d.ts +49 -0
  225. package/dist-library/types/shareable.d.ts +29 -3
  226. package/dist-library/types/standalone/diagnostics.d.ts +16 -0
  227. package/dist-library/types/standalone/events.d.ts +4 -0
  228. package/dist-library/types/standalone/library.d.ts +6 -0
  229. package/dist-library/types/standalone/payload.d.ts +15 -0
  230. package/dist-library/types/standalone/prepare.d.ts +21 -0
  231. package/dist-library/types/standalone/session.d.ts +68 -0
  232. package/dist-library/types/standalone/version.d.ts +7 -0
  233. package/dist-library/types/testing/behavior.d.ts +19 -0
  234. package/dist-library/types/testing/browser.d.ts +126 -0
  235. package/dist-library/types/testing/cases.d.ts +16 -0
  236. package/dist-library/types/testing/index.d.ts +13 -0
  237. package/dist-library/types/testing/manifest.d.ts +10 -0
  238. package/dist-library/types/testing/react.d.ts +45 -0
  239. package/dist-library/types/testing/report.d.ts +20 -0
  240. package/dist-library/types/testing/types.d.ts +125 -0
  241. package/dist-library/types/testing/values.d.ts +22 -0
  242. package/dist-library/types/vite/client.d.ts +36 -0
  243. package/dist-library/types/vite/discovery.d.ts +51 -0
  244. package/dist-library/types/vite/index.d.ts +31 -0
  245. package/dist-library/types/vite/registration.d.ts +109 -0
  246. package/dist-library/types-BFCrMrg0.js +52 -0
  247. package/dist-library/validation-W-bmny-x.js +2253 -0
  248. package/dist-library/values-CIt8AjiU.js +134 -0
  249. package/dist-standalone/reactive-md-standalone.css +1 -1
  250. package/dist-standalone/reactive-md-standalone.js +591 -95
  251. package/docs/README-ch.md +90 -0
  252. package/docs/README.md +87 -81
  253. package/docs/compatibility/compatibility-ch.md +22 -14
  254. package/docs/compatibility/compatibility-en.md +22 -14
  255. package/docs/compatibility/source-versioning-ch.md +15 -12
  256. package/docs/compatibility/source-versioning-en.md +16 -13
  257. package/docs/development/component-development-ch.md +51 -195
  258. package/docs/development/component-development-en.md +51 -195
  259. package/docs/development/component-development-reference-ch.md +253 -0
  260. package/docs/development/component-development-reference-en.md +238 -0
  261. package/docs/development/component-protocol-ch.md +51 -50
  262. package/docs/development/component-protocol-en.md +52 -49
  263. package/docs/development/local-module-layout-ch.md +59 -0
  264. package/docs/development/local-module-layout-en.md +59 -0
  265. package/docs/development/performance-overview-ch.md +402 -0
  266. package/docs/development/performance-overview-en.md +402 -0
  267. package/docs/development/releasing-ch.md +8 -104
  268. package/docs/development/releasing-en.md +8 -104
  269. package/docs/guides/local-guide-ch.md +28 -9
  270. package/docs/guides/local-guide-en.md +31 -12
  271. package/docs/integration/author-tools-ch.md +4 -2
  272. package/docs/integration/author-tools-en.md +4 -2
  273. package/docs/integration/codemirror-ch.md +52 -0
  274. package/docs/integration/codemirror-en.md +29 -0
  275. package/docs/integration/compiler-ch.md +47 -0
  276. package/docs/integration/compiler-en.md +34 -0
  277. package/docs/integration/directory-discovery-ch.md +53 -0
  278. package/docs/integration/directory-discovery-en.md +31 -0
  279. package/docs/integration/editor-ch.md +48 -21
  280. package/docs/integration/editor-en.md +48 -21
  281. package/docs/integration/extension-sdk-ch.md +392 -0
  282. package/docs/integration/extension-sdk-en.md +377 -0
  283. package/docs/integration/local-integration-ch.md +63 -9
  284. package/docs/integration/local-integration-en.md +89 -13
  285. package/docs/integration/repository-split-ch.md +40 -0
  286. package/docs/integration/repository-split-en.md +23 -0
  287. package/docs/integration/shareable-export-ch.md +46 -2
  288. package/docs/integration/shareable-export-en.md +46 -2
  289. package/docs/reference/computations-formatting-ch.md +4 -2
  290. package/docs/reference/computations-formatting-en.md +4 -2
  291. package/docs/reference/constraints-collections-ch.md +21 -1
  292. package/docs/reference/constraints-collections-en.md +21 -1
  293. package/docs/reference/diagnostics-counting-ch.md +1 -1
  294. package/docs/reference/diagnostics-counting-en.md +1 -1
  295. package/docs/reference/html-compatibility-ch.md +4 -0
  296. package/docs/reference/html-compatibility-en.md +4 -0
  297. package/docs/reference/local-components-v2-ch.md +2 -0
  298. package/docs/reference/local-components-v2-en.md +2 -0
  299. package/docs/reference/local-interaction-syntax-ch.md +51 -15
  300. package/docs/reference/local-interaction-syntax-en.md +58 -14
  301. package/docs/reference/theme-protocol-ch.md +79 -7
  302. package/docs/reference/theme-protocol-en.md +79 -7
  303. package/docs/reference/tolerance-ch.md +64 -0
  304. package/docs/reference/tolerance-en.md +57 -0
  305. package/docs/releases/release-0.4.0-ch.md +2 -0
  306. package/docs/releases/release-0.4.0-en.md +2 -0
  307. package/docs/releases/release-0.4.1-ch.md +2 -0
  308. package/docs/releases/release-0.4.1-en.md +2 -0
  309. package/docs/releases/release-0.5.0-ch.md +2 -0
  310. package/docs/releases/release-0.5.0-en.md +2 -0
  311. package/docs/releases/release-0.5.1-ch.md +2 -0
  312. package/docs/releases/release-0.5.1-en.md +2 -0
  313. package/docs/releases/release-0.5.2-ch.md +2 -0
  314. package/docs/releases/release-0.5.2-en.md +2 -0
  315. package/docs/releases/release-0.5.3-ch.md +2 -0
  316. package/docs/releases/release-0.5.3-en.md +2 -0
  317. package/docs/releases/release-0.6.0-ch.md +2 -0
  318. package/docs/releases/release-0.6.0-en.md +2 -0
  319. package/docs/releases/release-0.6.1-ch.md +2 -0
  320. package/docs/releases/release-0.6.1-en.md +2 -0
  321. package/docs/releases/release-0.7.0-ch.md +86 -0
  322. package/docs/releases/release-0.7.0-en.md +86 -0
  323. package/docs/releases/release-0.8.0-ch.md +126 -0
  324. package/docs/releases/release-0.8.0-en.md +126 -0
  325. package/examples/component-package/LICENSE +21 -0
  326. package/examples/component-package/NOTICES.md +12 -0
  327. package/examples/component-package/README-ch.md +101 -0
  328. package/examples/component-package/README.md +133 -0
  329. package/examples/component-package/package.json +35 -0
  330. package/examples/component-package/sample/document.reactive.md +14 -0
  331. package/examples/component-package/scripts/build-export.mjs +44 -0
  332. package/examples/component-package/scripts/build.mjs +130 -0
  333. package/examples/component-package/scripts/verify.mjs +257 -0
  334. package/examples/component-package/src/assets/notice.svg +4 -0
  335. package/examples/component-package/src/component.css +40 -0
  336. package/examples/component-package/src/components.tsx +105 -0
  337. package/examples/component-package/src/harness.tsx +34 -0
  338. package/examples/component-package/src/manifests.ts +71 -0
  339. package/examples/component-package/src/node-entry.ts +18 -0
  340. package/examples/component-package/src/sample.ts +4 -0
  341. package/examples/component-package/src/theme.css +44 -0
  342. package/examples/component-package/src/theme.ts +22 -0
  343. package/examples/component-package/tsconfig.json +15 -0
  344. package/examples/conformance/README-ch.md +55 -0
  345. package/examples/conformance/README.md +2 -0
  346. package/examples/conformance/local-draft-3.json +296 -0
  347. package/examples/game-2048-package/LICENSE +21 -0
  348. package/examples/game-2048-package/NOTICES.md +11 -0
  349. package/examples/game-2048-package/README-ch.md +97 -0
  350. package/examples/game-2048-package/README.md +102 -0
  351. package/examples/game-2048-package/package.json +35 -0
  352. package/examples/game-2048-package/sample/document.reactive.md +17 -0
  353. package/examples/game-2048-package/scripts/build-export.mjs +44 -0
  354. package/examples/game-2048-package/scripts/build.mjs +130 -0
  355. package/examples/game-2048-package/scripts/verify.mjs +180 -0
  356. package/examples/game-2048-package/src/component.css +161 -0
  357. package/examples/game-2048-package/src/components.tsx +326 -0
  358. package/examples/game-2048-package/src/game-engine.ts +228 -0
  359. package/examples/game-2048-package/src/harness.tsx +34 -0
  360. package/examples/game-2048-package/src/manifest.ts +85 -0
  361. package/examples/game-2048-package/src/node-entry.ts +30 -0
  362. package/examples/game-2048-package/src/sample.ts +4 -0
  363. package/examples/game-2048-package/tsconfig.json +15 -0
  364. package/examples/integration/README-ch.md +63 -0
  365. package/examples/integration/README.md +17 -1
  366. package/examples/integration/extension-sdk/README-ch.md +24 -0
  367. package/examples/integration/extension-sdk/README.md +24 -0
  368. package/examples/integration/extension-sdk/advanced-standalone.ts +6 -0
  369. package/examples/integration/extension-sdk/advanced.tsx +101 -0
  370. package/examples/integration/extension-sdk/env.d.ts +2 -0
  371. package/examples/integration/extension-sdk/extensions.tsx +97 -0
  372. package/examples/integration/extension-sdk/index.html +3 -0
  373. package/examples/integration/extension-sdk/main.tsx +10 -0
  374. package/examples/integration/extension-sdk/package.json +6 -0
  375. package/examples/integration/extension-sdk/standalone.ts +7 -0
  376. package/examples/integration/extension-sdk/tsconfig.json +8 -0
  377. package/examples/integration/react-comprehensive/index.html +12 -0
  378. package/examples/integration/react-comprehensive/main.jsx +123 -0
  379. package/examples/integration/react-comprehensive/package.json +18 -0
  380. package/examples/local/README-ch.md +76 -0
  381. package/examples/local/README.md +4 -2
  382. package/examples/local/scenarios/blog-zh.reactive.md +71 -0
  383. package/examples/local/scenarios/blog.reactive.md +71 -0
  384. package/examples/local/scenarios/classroom-zh.reactive.md +97 -0
  385. package/examples/local/scenarios/classroom.reactive.md +97 -0
  386. package/examples/local/scenarios/proposal-zh.reactive.md +79 -0
  387. package/examples/local/scenarios/proposal.reactive.md +79 -0
  388. package/examples/local/scenarios/survey-zh.reactive.md +74 -0
  389. package/examples/local/scenarios/survey.reactive.md +74 -0
  390. package/examples/local/showcase/README-ch.md +22 -0
  391. package/examples/local/showcase/README.md +9 -3
  392. package/examples/local/showcase/features.reactive.md +637 -0
  393. package/examples/local/showcase/zh/features.reactive.md +637 -0
  394. package/examples/sci-fi-theme/README-ch.md +131 -0
  395. package/examples/sci-fi-theme/README.md +146 -0
  396. package/examples/sci-fi-theme/demo/demo.css +532 -0
  397. package/examples/sci-fi-theme/demo/document.reactive.md +185 -0
  398. package/examples/sci-fi-theme/demo/index.html +13 -0
  399. package/examples/sci-fi-theme/demo/main.tsx +180 -0
  400. package/examples/sci-fi-theme/docs/design-system-ch.md +245 -0
  401. package/examples/sci-fi-theme/docs/design-system.md +474 -0
  402. package/examples/sci-fi-theme/package.json +27 -0
  403. package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -0
  404. package/examples/sci-fi-theme/src/components.css +1460 -0
  405. package/examples/sci-fi-theme/src/index.ts +6 -0
  406. package/examples/sci-fi-theme/src/sci-fi.css +5 -0
  407. package/examples/sci-fi-theme/src/theme.ts +37 -0
  408. package/examples/sci-fi-theme/src/tokens.css +408 -0
  409. package/examples/sci-fi-theme/tsconfig.json +20 -0
  410. package/examples/sci-fi-theme/vite.config.ts +24 -0
  411. package/examples/tetris-package/LICENSE +21 -0
  412. package/examples/tetris-package/NOTICES.md +11 -0
  413. package/examples/tetris-package/README-ch.md +91 -0
  414. package/examples/tetris-package/README.md +95 -0
  415. package/examples/tetris-package/package.json +35 -0
  416. package/examples/tetris-package/sample/document.reactive.md +16 -0
  417. package/examples/tetris-package/scripts/build-export.mjs +44 -0
  418. package/examples/tetris-package/scripts/build.mjs +130 -0
  419. package/examples/tetris-package/scripts/verify.mjs +173 -0
  420. package/examples/tetris-package/src/component.css +145 -0
  421. package/examples/tetris-package/src/components.tsx +334 -0
  422. package/examples/tetris-package/src/harness.tsx +34 -0
  423. package/examples/tetris-package/src/manifests.ts +93 -0
  424. package/examples/tetris-package/src/node-entry.ts +16 -0
  425. package/examples/tetris-package/src/sample.ts +4 -0
  426. package/examples/tetris-package/src/tetris-engine.ts +325 -0
  427. package/examples/tetris-package/tsconfig.json +15 -0
  428. package/package.json +98 -44
  429. package/dist-library/compiler-Cm3ppMxG.js +0 -46044
  430. package/dist-library/react-Bh7_oxZp.js +0 -59655
  431. package/dist-library/reactive-md-editor.css +0 -2
  432. package/dist-library/reactive-md-editor.js +0 -3853
  433. package/dist-library/runtime-DlFYQ4s_.js +0 -498
  434. package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +0 -7
  435. package/dist-library/types/editor/editor-toolbar.d.ts +0 -24
  436. package/dist-library/types/editor/editor-view-bar.d.ts +0 -11
  437. package/dist-library/types/editor/extended-native-components.d.ts +0 -58
  438. package/dist-library/types/editor/index.d.ts +0 -9
  439. package/dist-library/types/editor/locale.d.ts +0 -13
  440. package/dist-library/types/editor/source-authoring.d.ts +0 -59
  441. package/dist-library/types/editor/types.d.ts +0 -48
  442. package/dist-library/types/editor/use-gutter-metrics.d.ts +0 -5
  443. package/dist-library/types/editor/use-source-history.d.ts +0 -16
  444. package/dist-library/types/local/compiler.d.ts +0 -4
  445. package/dist-library/types/local/math.d.ts +0 -48
  446. package/dist-library/types/local/options.d.ts +0 -36
  447. package/dist-library/types/local/parser.d.ts +0 -13
  448. package/dist-library/types/local/render-types.d.ts +0 -27
  449. package/dist-library/types/local/runtime.d.ts +0 -2
  450. package/dist-library/types/local/schema.d.ts +0 -77
  451. package/dist-library/types/local/types.d.ts +0 -263
  452. package/dist-library/types/local/visuals.d.ts +0 -12
  453. package/dist-library/types/local/worker.d.ts +0 -98
  454. package/docs/development/performance-ch.md +0 -76
  455. package/docs/development/performance-en.md +0 -76
  456. /package/dist-library/types/{editor → authoring}/command-types.d.ts +0 -0
  457. /package/dist-library/types/{editor → authoring}/editor-commands.d.ts +0 -0
  458. /package/dist-library/types/local/{locale.d.ts → contracts/locale.d.ts} +0 -0
  459. /package/dist-library/types/local/{collection-functions.d.ts → evaluation/collection-functions.d.ts} +0 -0
  460. /package/dist-library/types/local/{data-functions.d.ts → evaluation/data-functions.d.ts} +0 -0
  461. /package/dist-library/types/local/{dates.d.ts → evaluation/dates.d.ts} +0 -0
  462. /package/dist-library/types/local/{formatting.d.ts → evaluation/formatting.d.ts} +0 -0
  463. /package/dist-library/types/local/{html-names.d.ts → html/html-names.d.ts} +0 -0
  464. /package/dist-library/types/local/{text-length.d.ts → source/text-length.d.ts} +0 -0
  465. /package/dist-library/types/local/{colors.d.ts → theme/colors.d.ts} +0 -0
  466. /package/dist-library/types/local/{code-block.d.ts → widgets/code-block.d.ts} +0 -0
  467. /package/dist-library/types/local/{code-languages.d.ts → widgets/code-languages.d.ts} +0 -0
  468. /package/dist-library/types/local/{diagram-layout.d.ts → widgets/diagram-layout.d.ts} +0 -0
  469. /package/dist-library/types/local/{image-view.d.ts → widgets/image-view.d.ts} +0 -0
  470. /package/dist-library/types/local/{math-view.d.ts → widgets/math-view.d.ts} +0 -0
  471. /package/dist-library/types/local/{table-surface.d.ts → widgets/table-surface.d.ts} +0 -0
@@ -0,0 +1,1443 @@
1
+ // src/local/configuration/limits.ts
2
+ var e = 1e6, t = 1e4, n = 2e7, r = 1e3, i = 1e5, a = 1e4, o = 1e5, s = 2e3, c = 16, l = 2e4, u = 2e6, d = 1e3, f = 100, p = 20, m = 2e3, h = 1e4;
3
+ function g(e) {
4
+ if (e.length > 254 || /\s/.test(e)) return !1;
5
+ let t = e.indexOf("@");
6
+ if (t < 1 || t !== e.lastIndexOf("@")) return !1;
7
+ let n = e.lastIndexOf(".");
8
+ return n > t + 1 && n < e.length - 1;
9
+ }
10
+ // src/sdk/hash.ts
11
+ function _(e) {
12
+ let t = 2166136261, n = 16777619;
13
+ for (let r = 0; r < e.length; r += 1) {
14
+ let i = e.charCodeAt(r);
15
+ t ^= i, t = Math.imul(t, 16777619) >>> 0, n ^= i + r, n = Math.imul(n, 2246822507) >>> 0;
16
+ }
17
+ let r = e.length;
18
+ return t ^= r, t = Math.imul(t, 16777619) >>> 0, n ^= r, n = Math.imul(n, 3266489909) >>> 0, `rmd-${t.toString(16).padStart(8, "0")}${n.toString(16).padStart(8, "0")}`;
19
+ }
20
+ // src/sdk/pattern.ts
21
+ function v(e, t) {
22
+ let n = e[t];
23
+ if (n === "*" || n === "+" || n === "?") return { length: e[t + 1] === "?" ? 2 : 1 };
24
+ if (n !== "{") return null;
25
+ let r = /^\{(\d+)(?:,(\d*))?\}/.exec(e.slice(t));
26
+ return r ? { length: r[0].length + +(e[t + r[0].length] === "?") } : null;
27
+ }
28
+ function y(e) {
29
+ let t = [], n = !1, r = !1;
30
+ for (let i = 0; i < e.length; i += 1) {
31
+ let a = e[i];
32
+ if (n) {
33
+ n = !1;
34
+ continue;
35
+ }
36
+ if (a === "\\") {
37
+ let t = e[i + 1];
38
+ if (t !== void 0 && t >= "1" && t <= "9" || t === "k" && e[i + 2] === "<") return !1;
39
+ n = !0;
40
+ continue;
41
+ }
42
+ if (r) {
43
+ a === "]" && (r = !1);
44
+ continue;
45
+ }
46
+ if (a === "[") {
47
+ r = !0;
48
+ continue;
49
+ }
50
+ if (a === "(") {
51
+ if (e[i + 1] === "?") {
52
+ if (e[i + 2] !== ":") return !1;
53
+ t.push({
54
+ quantified: !1,
55
+ alternation: !1
56
+ }), i += 2;
57
+ continue;
58
+ }
59
+ t.push({
60
+ quantified: !1,
61
+ alternation: !1
62
+ });
63
+ continue;
64
+ }
65
+ if (a === "|") {
66
+ let e = t[t.length - 1];
67
+ e && (e.alternation = !0);
68
+ continue;
69
+ }
70
+ if (a === ")") {
71
+ let n = t.pop();
72
+ if (!n) return !1;
73
+ let r = v(e, i + 1);
74
+ if (r && (n.quantified || n.alternation)) return !1;
75
+ let a = t[t.length - 1];
76
+ a && (a.quantified = a.quantified || n.quantified || r !== null, a.alternation = a.alternation || n.alternation), r && (i += r.length);
77
+ continue;
78
+ }
79
+ let o = v(e, i);
80
+ if (o) {
81
+ let e = t[t.length - 1];
82
+ e && (e.quantified = !0), i += o.length - 1;
83
+ }
84
+ }
85
+ return t.length === 0 && !n && !r;
86
+ }
87
+ // src/sdk/version.ts
88
+ var b = "0.7.0", x = "reactive-md-component/v1", ee = "reactive-md-config/v1", te = "reactive-md-config/v2", S = "reactive-md-preset/v1", ne = "reactive-md-react-preset/v1", re = "reactive-md-assembly/v1", ie = "reactive-md-extensions/v1", ae = 128, oe = 8, se = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/, ce = /^0\d+$/;
89
+ function le(e) {
90
+ if (e === void 0) return Object.freeze([]);
91
+ let t = e.split("."), n = [];
92
+ for (let e of t) {
93
+ if (e.length === 0 || ce.test(e) && e !== "0" && /^\d+$/.test(e) || /^\d+$/.test(e) && !Number.isSafeInteger(Number(e))) return null;
94
+ n.push(/^\d+$/.test(e) ? Number(e) : e);
95
+ }
96
+ return Object.freeze(n);
97
+ }
98
+ function C(e) {
99
+ let t = se.exec(e);
100
+ if (!t) return null;
101
+ let [, n, r, i, a] = t;
102
+ for (let e of [
103
+ n,
104
+ r,
105
+ i
106
+ ]) if (e.length > 1 && e.startsWith("0") || !Number.isSafeInteger(Number(e))) return null;
107
+ let o = le(a);
108
+ return o === null ? null : {
109
+ major: Number(n),
110
+ minor: Number(r),
111
+ patch: Number(i),
112
+ prerelease: o
113
+ };
114
+ }
115
+ function ue(e, t) {
116
+ return typeof e == "number" && typeof t == "number" ? e === t ? 0 : e < t ? -1 : 1 : typeof e == "number" ? -1 : typeof t == "number" ? 1 : e === t ? 0 : e < t ? -1 : 1;
117
+ }
118
+ function de(e, t) {
119
+ for (let n of [
120
+ "major",
121
+ "minor",
122
+ "patch"
123
+ ]) if (e[n] !== t[n]) return e[n] < t[n] ? -1 : 1;
124
+ if (e.prerelease.length === 0 && t.prerelease.length === 0) return 0;
125
+ if (e.prerelease.length === 0) return 1;
126
+ if (t.prerelease.length === 0) return -1;
127
+ let n = Math.min(e.prerelease.length, t.prerelease.length);
128
+ for (let r = 0; r < n; r += 1) {
129
+ let n = ue(e.prerelease[r], t.prerelease[r]);
130
+ if (n !== 0) return n;
131
+ }
132
+ return e.prerelease.length === t.prerelease.length ? 0 : e.prerelease.length < t.prerelease.length ? -1 : 1;
133
+ }
134
+ function w(e, t, n) {
135
+ return {
136
+ major: e,
137
+ minor: t,
138
+ patch: n,
139
+ prerelease: Object.freeze([])
140
+ };
141
+ }
142
+ function fe(e, t) {
143
+ if (e === "^") {
144
+ let e = t.major > 0 ? w(t.major + 1, 0, 0) : t.minor > 0 ? w(0, t.minor + 1, 0) : w(0, 0, t.patch + 1);
145
+ return [{
146
+ operator: ">=",
147
+ version: t
148
+ }, {
149
+ operator: "<",
150
+ version: e
151
+ }];
152
+ }
153
+ return e === "~" ? [{
154
+ operator: ">=",
155
+ version: t
156
+ }, {
157
+ operator: "<",
158
+ version: w(t.major, t.minor + 1, 0)
159
+ }] : [{
160
+ operator: e,
161
+ version: t
162
+ }];
163
+ }
164
+ function T(e) {
165
+ if (typeof e != "string") return null;
166
+ let t = e.trim();
167
+ if (t.length === 0 || t.length > 128) return null;
168
+ let n = t.split(/\s+/);
169
+ if (n.length === 0 || n.length > 8) return null;
170
+ let r = [];
171
+ try {
172
+ for (let e of n) {
173
+ let t = "=", n = e;
174
+ e.startsWith(">=") || e.startsWith("<=") ? (t = e.slice(0, 2), n = e.slice(2)) : (e.startsWith(">") || e.startsWith("<") || e.startsWith("=") || e.startsWith("^") || e.startsWith("~")) && (t = e[0], n = e.slice(1));
175
+ let i = C(n);
176
+ if (i === null || (r.push(...fe(t, i)), r.length > 16)) return null;
177
+ }
178
+ } catch {
179
+ return null;
180
+ }
181
+ return Object.freeze({
182
+ source: t,
183
+ comparators: Object.freeze(r)
184
+ });
185
+ }
186
+ function E(e) {
187
+ return typeof e == "string" && C(e) !== null;
188
+ }
189
+ function pe(e, t) {
190
+ try {
191
+ let n = C(e);
192
+ if (n === null) return !1;
193
+ let r = typeof t == "string" ? T(t) : t;
194
+ if (!r || !Array.isArray(r.comparators) || r.comparators.length === 0 || n.prerelease.length && !r.comparators.some(({ version: e }) => e.prerelease.length && e.major === n.major && e.minor === n.minor && e.patch === n.patch)) return !1;
195
+ for (let e of r.comparators) {
196
+ let t = de(n, e.version);
197
+ switch (e.operator) {
198
+ case "=":
199
+ if (t !== 0) return !1;
200
+ break;
201
+ case ">":
202
+ if (t <= 0) return !1;
203
+ break;
204
+ case ">=":
205
+ if (t < 0) return !1;
206
+ break;
207
+ case "<":
208
+ if (t >= 0) return !1;
209
+ break;
210
+ case "<=":
211
+ if (t > 0) return !1;
212
+ break;
213
+ default: return !1;
214
+ }
215
+ }
216
+ return !0;
217
+ } catch {
218
+ return !1;
219
+ }
220
+ }
221
+ function me(e) {
222
+ return typeof e == "object" && !!e && typeof e.source == "string" && Array.isArray(e.comparators);
223
+ }
224
+ // src/sdk/manifest.ts
225
+ var he = 64, ge = 64, _e = 128, ve = 160, ye = 64, be = 64, xe = 512, D = 4096, Se = 16, Ce = 32, we = 256, Te = 65536, O = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/, k = /^[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)*$/, Ee = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/, De = /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/, A = /* @__PURE__ */ new Set([
226
+ "__proto__",
227
+ "constructor",
228
+ "prototype"
229
+ ]), j = /* @__PURE__ */ new WeakSet(), Oe = /* @__PURE__ */ new Set([
230
+ "string",
231
+ "number",
232
+ "boolean",
233
+ "enum"
234
+ ]), ke = /* @__PURE__ */ new Set([
235
+ "leaf",
236
+ "inline",
237
+ "container"
238
+ ]), Ae = /* @__PURE__ */ new Set([
239
+ "string",
240
+ "number",
241
+ "boolean",
242
+ "null",
243
+ "array",
244
+ "number-array"
245
+ ]), je = /* @__PURE__ */ new Set([
246
+ "text",
247
+ "number",
248
+ "boolean",
249
+ "choice",
250
+ "date",
251
+ "timer",
252
+ "checklist",
253
+ "tabs",
254
+ "diagram",
255
+ "multi-select",
256
+ "selection",
257
+ "steps",
258
+ "collection"
259
+ ]), Me = /* @__PURE__ */ new Set([
260
+ "empty",
261
+ "false",
262
+ "max-step",
263
+ "nearest-zero",
264
+ "min",
265
+ "first-option",
266
+ "first-tab",
267
+ "first-step",
268
+ "first-node",
269
+ "checked",
270
+ "duration",
271
+ "empty-array",
272
+ "none"
273
+ ]), Ne = /* @__PURE__ */ new Set([
274
+ "none",
275
+ "inline",
276
+ "markdown"
277
+ ]), Pe = /* @__PURE__ */ new Set([
278
+ "none",
279
+ "any",
280
+ "inline",
281
+ "content",
282
+ "table",
283
+ "plot",
284
+ "diagram",
285
+ "quiz",
286
+ "options",
287
+ "tabs",
288
+ "steps",
289
+ "components"
290
+ ]), Fe = /* @__PURE__ */ new Set(/* @__PURE__ */ "numeric-range.text-length.date-bounds.nonempty.progress-bounds.timer-duration.option-count.selection-requires.inline-body.no-components.single-table.math-body.options-body.value-sequence.only-children.diagram-body.quiz-body.checklist-body.dynamic-constraints.require-full-interpolation.scoped-expressions.row-values.validation-rule.anchor.navigation.data-table.plot-math.chart-table.timeline-table.table-selection.retain.self-binding-read.inline-math-reads.value-date.value-length.value-required.value-email".split(".")), Ie = /* @__PURE__ */ new Set([
291
+ "none",
292
+ "required",
293
+ "optional"
294
+ ]), Le = /* @__PURE__ */ new Set([
295
+ "id",
296
+ "name",
297
+ "version",
298
+ "protocol",
299
+ "form",
300
+ "props",
301
+ "bindings",
302
+ "children",
303
+ "structure",
304
+ "rules",
305
+ "slotRelations",
306
+ "legacyHost",
307
+ "capabilities",
308
+ "authoring",
309
+ "dependencies",
310
+ "styles",
311
+ "requires",
312
+ "replaces"
313
+ ]), Re = /* @__PURE__ */ new Set([
314
+ "kind",
315
+ "required",
316
+ "static",
317
+ "dynamic",
318
+ "default",
319
+ "nullable",
320
+ "enum",
321
+ "values",
322
+ "pattern",
323
+ "min",
324
+ "max",
325
+ "integer",
326
+ "positive",
327
+ "color",
328
+ "coerce",
329
+ "description"
330
+ ]), ze = /* @__PURE__ */ new Set([
331
+ "kind",
332
+ "family",
333
+ "bind",
334
+ "initial",
335
+ "initialRule",
336
+ "required",
337
+ "exclusive",
338
+ "constraints",
339
+ "options",
340
+ "maxItems",
341
+ "requiresAttributes",
342
+ "compare",
343
+ "retain"
344
+ ]), Be = /* @__PURE__ */ new Set([
345
+ "min",
346
+ "max",
347
+ "step"
348
+ ]), Ve = /* @__PURE__ */ new Set([
349
+ "interactive",
350
+ "static",
351
+ "ssr",
352
+ "offline"
353
+ ]), He = /* @__PURE__ */ new Set([
354
+ "title",
355
+ "description",
356
+ "category",
357
+ "insertText"
358
+ ]), Ue = /* @__PURE__ */ new Set(["kind", "required"]), We = /* @__PURE__ */ new Set([
359
+ "rule",
360
+ "label",
361
+ "parents",
362
+ "child",
363
+ "children",
364
+ "min",
365
+ "max",
366
+ "inlineOnly",
367
+ "noComponents",
368
+ "valueAttribute",
369
+ "generatedPrefix",
370
+ "forbidSeparator",
371
+ "maxItems"
372
+ ]), Ge = /* @__PURE__ */ new Set(["id", "version"]), Ke = /* @__PURE__ */ new Set(["kernel"]), qe = /* @__PURE__ */ new Set(["id", "version"]), Je = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/, Ye = /^[A-Za-z][A-Za-z0-9]*$/, M = /* @__PURE__ */ new Set(["setMany"]), Xe = 16, Ze = 32, Qe = 16, $e = 32, et = /* @__PURE__ */ new Set([
373
+ "bind",
374
+ "initial",
375
+ "disabled"
376
+ ]);
377
+ function N(e, t) {
378
+ throw Error(`Invalid local component manifest (${e}): ${t}`);
379
+ }
380
+ function tt(e) {
381
+ try {
382
+ let t = JSON.stringify(e);
383
+ return typeof t == "string" ? typeof TextEncoder == "function" ? new TextEncoder().encode(t).length : t.length * 2 : Infinity;
384
+ } catch {
385
+ return Infinity;
386
+ }
387
+ }
388
+ function P(e) {
389
+ if (typeof e != "object" || !e || Array.isArray(e)) return !1;
390
+ let t = Object.getPrototypeOf(e);
391
+ return t === Object.prototype || t === null;
392
+ }
393
+ function F(e, t, n) {
394
+ for (let r of Object.keys(e)) A.has(r) && N(n, `field "${r}" is not allowed.`), t.has(r) || N(n, `unknown field "${r}".`);
395
+ }
396
+ function I(e, t) {
397
+ return typeof e != "boolean" && N(t, "must be a boolean."), e;
398
+ }
399
+ function L(e, t, n = D) {
400
+ return typeof e != "string" && N(t, "must be a string."), e.length > n && N(t, `exceeds the ${n}-character limit.`), e;
401
+ }
402
+ function R(e, t) {
403
+ return typeof e == "number" && Number.isFinite(e) || N(t, "must be a finite number."), e;
404
+ }
405
+ function z(e, t) {
406
+ return typeof e != "string" && N(t, "must be a string."), e.length > 128 && N(t, "exceeds the 128-character limit."), O.test(e) || N(t, "must use lowercase kebab-case."), e;
407
+ }
408
+ function B(e, t) {
409
+ P(e) || N(t, "must be an object.");
410
+ let n = {}, r = Object.keys(e).sort();
411
+ for (let i of r) A.has(i) && N(t, `locale "${i}" is not allowed.`), De.test(i) || N(t, `locale "${i}" must look like "en" or "zh-CN".`), n[i] = L(e[i], `${t}.${i}`, 256);
412
+ return n;
413
+ }
414
+ function nt(e, t) {
415
+ P(e) || N(t, "must be an object."), F(e, He, t);
416
+ let n = {};
417
+ return e.title !== void 0 && (n.title = B(e.title, `${t}.title`)), e.description !== void 0 && (n.description = B(e.description, `${t}.description`)), e.category !== void 0 && (n.category = L(e.category, `${t}.category`, 64)), e.insertText !== void 0 && (n.insertText = L(e.insertText, `${t}.insertText`, D)), n;
418
+ }
419
+ function rt(e, t, n) {
420
+ P(e) || N(n, "must be an object."), F(e, Ue, n);
421
+ let r = e.kind;
422
+ typeof r == "string" && Ne.has(r) || N(`${n}.kind`, "must be \"none\", \"inline\" or \"markdown\".");
423
+ let i = r;
424
+ e.required !== void 0 && I(e.required, `${n}.required`);
425
+ let a = e.required === !0;
426
+ return t === "leaf" && i !== "none" && N(n, "a leaf component cannot declare body content."), t === "inline" && i === "markdown" && N(n, "an inline component cannot declare Markdown block content."), a && i === "none" && N(n, "cannot require body content of kind \"none\"."), {
427
+ kind: i,
428
+ ...a ? { required: !0 } : {}
429
+ };
430
+ }
431
+ function it(e) {
432
+ if (e !== void 0) return e.kind === "none" ? Object.freeze({
433
+ rule: "none",
434
+ label: "none"
435
+ }) : e.kind === "inline" ? Object.freeze({
436
+ rule: "inline",
437
+ label: "none",
438
+ inlineOnly: !0,
439
+ noComponents: !0,
440
+ ...e.required ? { min: 1 } : {}
441
+ }) : Object.freeze({
442
+ rule: "any",
443
+ label: "none",
444
+ ...e.required ? { min: 1 } : {}
445
+ });
446
+ }
447
+ function V(e, t) {
448
+ Array.isArray(e) || N(t, "must be an array of component names."), e.length > 32 && N(t, "accepts at most 32 names.");
449
+ let n = /* @__PURE__ */ new Set(), r = [];
450
+ for (let i of e) {
451
+ let e = z(i, t);
452
+ n.has(e) && N(t, `name "${e}" is declared more than once.`), n.add(e), r.push(e);
453
+ }
454
+ return r;
455
+ }
456
+ function at(e, t) {
457
+ let n = R(e, t);
458
+ return (!Number.isInteger(n) || n < 0) && N(t, "must be a nonnegative integer."), n;
459
+ }
460
+ function ot(e, t, n) {
461
+ P(e) || N(n, "must be an object."), F(e, We, n);
462
+ let r = e.rule;
463
+ typeof r == "string" && Pe.has(r) || N(`${n}.rule`, "is not a supported child rule.");
464
+ let i = r;
465
+ t === "leaf" && i !== "none" && N(n, "a leaf component cannot declare body content."), t === "inline" && i !== "none" && i !== "inline" && i !== "any" && N(n, "an inline component only supports \"none\", \"inline\" or \"any\".");
466
+ let o = { rule: i };
467
+ if (e.label !== void 0 && (typeof e.label == "string" && Ie.has(e.label) || N(`${n}.label`, "must be \"none\", \"required\" or \"optional\"."), o.label = e.label), e.parents !== void 0 && (o.parents = V(e.parents, `${n}.parents`)), e.child !== void 0 && (o.child = z(e.child, `${n}.child`)), e.children !== void 0 && (o.children = V(e.children, `${n}.children`)), e.min !== void 0 && (o.min = U(e.min, `${n}.min`, a)), e.max !== void 0 && (o.max = U(e.max, `${n}.max`, a)), o.min !== void 0 && o.max !== void 0 && o.min > o.max && N(n, "\"min\" cannot exceed \"max\"."), e.inlineOnly !== void 0 && (o.inlineOnly = I(e.inlineOnly, `${n}.inlineOnly`)), e.noComponents !== void 0 && (o.noComponents = I(e.noComponents, `${n}.noComponents`)), e.valueAttribute !== void 0 && (o.valueAttribute = z(e.valueAttribute, `${n}.valueAttribute`)), e.generatedPrefix !== void 0) {
468
+ let t = L(e.generatedPrefix, `${n}.generatedPrefix`, 128);
469
+ t.length === 0 && N(`${n}.generatedPrefix`, "must not be empty."), o.generatedPrefix = t;
470
+ }
471
+ if (e.forbidSeparator !== void 0) {
472
+ let t = L(e.forbidSeparator, `${n}.forbidSeparator`, 4);
473
+ t.length === 0 && N(`${n}.forbidSeparator`, "must not be empty."), o.forbidSeparator = t;
474
+ }
475
+ return e.maxItems !== void 0 && (o.maxItems = U(e.maxItems, `${n}.maxItems`, a)), o;
476
+ }
477
+ function H(e, t) {
478
+ return z(e, t);
479
+ }
480
+ function st(e, t) {
481
+ return at(e, t);
482
+ }
483
+ function U(e, t, n) {
484
+ let r = at(e, t);
485
+ return r > n && N(t, `cannot exceed the kernel limit ${n}.`), r;
486
+ }
487
+ function W(e, t) {
488
+ return V(e, t);
489
+ }
490
+ function ct(e, t) {
491
+ return Array.isArray(e) || N(t, "must be an array of strings."), e.length > 32 && N(t, "accepts at most 32 values."), e.map((e) => L(e, t, 128));
492
+ }
493
+ function lt(e, t) {
494
+ P(e) || N(t, "must be an object.");
495
+ let n = e.kind;
496
+ typeof n == "string" && Fe.has(n) || N(`${t}.kind`, "is not a supported rule.");
497
+ let r = (n) => F(e, /* @__PURE__ */ new Set(["kind", ...n]), t), i = (n) => {
498
+ let r = {};
499
+ for (let i of n) e[i] !== void 0 && (r[i] = H(e[i], `${t}.${i}`));
500
+ return r;
501
+ };
502
+ switch (n) {
503
+ case "numeric-range": {
504
+ r([
505
+ "min",
506
+ "max",
507
+ "step",
508
+ "order",
509
+ "integer",
510
+ "positiveInteger"
511
+ ]);
512
+ let a;
513
+ return e.order !== void 0 && (e.order !== "nondecreasing" && e.order !== "increasing" && N(`${t}.order`, "must be \"nondecreasing\" or \"increasing\"."), a = e.order), {
514
+ kind: n,
515
+ ...i([
516
+ "min",
517
+ "max",
518
+ "step",
519
+ "integer",
520
+ "positiveInteger"
521
+ ]),
522
+ ...a ? { order: a } : {}
523
+ };
524
+ }
525
+ case "text-length": return r(["min", "max"]), {
526
+ kind: n,
527
+ ...i(["min", "max"])
528
+ };
529
+ case "date-bounds": return r([
530
+ "min",
531
+ "max",
532
+ "required"
533
+ ]), {
534
+ kind: n,
535
+ ...i([
536
+ "min",
537
+ "max",
538
+ "required"
539
+ ])
540
+ };
541
+ case "nonempty": return r(["attribute"]), {
542
+ kind: n,
543
+ attribute: H(e.attribute, `${t}.attribute`)
544
+ };
545
+ case "progress-bounds": return r([
546
+ "value",
547
+ "max",
548
+ "defaultMax"
549
+ ]), {
550
+ kind: n,
551
+ value: H(e.value, `${t}.value`),
552
+ max: H(e.max, `${t}.max`),
553
+ defaultMax: R(e.defaultMax, `${t}.defaultMax`)
554
+ };
555
+ case "timer-duration": return r(["attribute", "default"]), {
556
+ kind: n,
557
+ attribute: H(e.attribute, `${t}.attribute`),
558
+ default: R(e.default, `${t}.default`)
559
+ };
560
+ case "option-count": return r(["max"]), {
561
+ kind: n,
562
+ ...e.max === void 0 ? {} : { max: H(e.max, `${t}.max`) }
563
+ };
564
+ case "selection-requires": return r(["key", "attributes"]), {
565
+ kind: n,
566
+ key: H(e.key, `${t}.key`),
567
+ attributes: W(e.attributes, `${t}.attributes`)
568
+ };
569
+ case "inline-body": return r(["strict"]), {
570
+ kind: n,
571
+ ...e.strict === void 0 ? {} : { strict: I(e.strict, `${t}.strict`) }
572
+ };
573
+ case "no-components":
574
+ case "math-body":
575
+ case "inline-math-reads": return r([]), { kind: n };
576
+ case "single-table": return r(["fallbackSingle"]), {
577
+ kind: n,
578
+ ...e.fallbackSingle === void 0 ? {} : { fallbackSingle: I(e.fallbackSingle, `${t}.fallbackSingle`) }
579
+ };
580
+ case "options-body": return r([
581
+ "child",
582
+ "valueAttribute",
583
+ "unique",
584
+ "max",
585
+ "forbidSeparator"
586
+ ]), {
587
+ kind: n,
588
+ child: H(e.child, `${t}.child`),
589
+ valueAttribute: H(e.valueAttribute, `${t}.valueAttribute`),
590
+ unique: e.unique === void 0 || I(e.unique, `${t}.unique`),
591
+ ...e.max === void 0 ? {} : { max: U(e.max, `${t}.max`, a) },
592
+ ...e.forbidSeparator === void 0 ? {} : { forbidSeparator: L(e.forbidSeparator, `${t}.forbidSeparator`, 4) }
593
+ };
594
+ case "value-sequence": return r([
595
+ "child",
596
+ "valueAttribute",
597
+ "min",
598
+ "generatedPrefix",
599
+ "unique",
600
+ "duplicateCode"
601
+ ]), {
602
+ kind: n,
603
+ child: H(e.child, `${t}.child`),
604
+ valueAttribute: H(e.valueAttribute, `${t}.valueAttribute`),
605
+ min: st(e.min, `${t}.min`),
606
+ generatedPrefix: L(e.generatedPrefix, `${t}.generatedPrefix`, 128),
607
+ unique: e.unique === void 0 || I(e.unique, `${t}.unique`),
608
+ ...e.duplicateCode === void 0 ? {} : { duplicateCode: L(e.duplicateCode, `${t}.duplicateCode`, 128) }
609
+ };
610
+ case "only-children": return r([
611
+ "children",
612
+ "min",
613
+ "max",
614
+ "maxCode",
615
+ "onlyCode"
616
+ ]), {
617
+ kind: n,
618
+ children: W(e.children, `${t}.children`),
619
+ min: st(e.min, `${t}.min`),
620
+ ...e.max === void 0 ? {} : { max: U(e.max, `${t}.max`, a) },
621
+ ...e.maxCode === void 0 ? {} : { maxCode: L(e.maxCode, `${t}.maxCode`, 128) },
622
+ ...e.onlyCode === void 0 ? {} : { onlyCode: L(e.onlyCode, `${t}.onlyCode`, 128) }
623
+ };
624
+ case "diagram-body": return r([
625
+ "node",
626
+ "edge",
627
+ "id",
628
+ "from",
629
+ "to",
630
+ "label"
631
+ ]), {
632
+ kind: n,
633
+ node: H(e.node, `${t}.node`),
634
+ edge: H(e.edge, `${t}.edge`),
635
+ id: H(e.id, `${t}.id`),
636
+ from: H(e.from, `${t}.from`),
637
+ to: H(e.to, `${t}.to`),
638
+ ...e.label === void 0 ? {} : { label: H(e.label, `${t}.label`) }
639
+ };
640
+ case "quiz-body": return r([
641
+ "type",
642
+ "answer",
643
+ "tolerance",
644
+ "child",
645
+ "valueAttribute",
646
+ "max"
647
+ ]), {
648
+ kind: n,
649
+ type: H(e.type, `${t}.type`),
650
+ answer: H(e.answer, `${t}.answer`),
651
+ tolerance: H(e.tolerance, `${t}.tolerance`),
652
+ child: H(e.child, `${t}.child`),
653
+ valueAttribute: H(e.valueAttribute, `${t}.valueAttribute`),
654
+ ...e.max === void 0 ? {} : { max: U(e.max, `${t}.max`, a) }
655
+ };
656
+ case "checklist-body": return r(["itemLimit"]), {
657
+ kind: n,
658
+ itemLimit: U(e.itemLimit, `${t}.itemLimit`, a)
659
+ };
660
+ case "dynamic-constraints":
661
+ case "require-full-interpolation": return r(["attributes"]), {
662
+ kind: n,
663
+ attributes: W(e.attributes, `${t}.attributes`)
664
+ };
665
+ case "scoped-expressions": return r(["attributes", "scope"]), e.scope !== "row" && e.scope !== "validation" && N(`${t}.scope`, "must be \"row\" or \"validation\"."), {
666
+ kind: n,
667
+ attributes: W(e.attributes, `${t}.attributes`),
668
+ scope: e.scope
669
+ };
670
+ case "row-values": return r([
671
+ "rows",
672
+ "key",
673
+ "child",
674
+ "childValue"
675
+ ]), {
676
+ kind: n,
677
+ rows: H(e.rows, `${t}.rows`),
678
+ key: H(e.key, `${t}.key`),
679
+ child: H(e.child, `${t}.child`),
680
+ childValue: H(e.childValue, `${t}.childValue`)
681
+ };
682
+ case "validation-rule": return r([
683
+ "when",
684
+ "fields",
685
+ "message",
686
+ "placement",
687
+ "max"
688
+ ]), e.placement !== "container" && e.placement !== "prose" && N(`${t}.placement`, "must be \"container\" or \"prose\"."), {
689
+ kind: n,
690
+ when: H(e.when, `${t}.when`),
691
+ fields: H(e.fields, `${t}.fields`),
692
+ message: H(e.message, `${t}.message`),
693
+ placement: e.placement,
694
+ max: U(e.max, `${t}.max`, 100)
695
+ };
696
+ case "anchor": return r(["id"]), {
697
+ kind: n,
698
+ id: H(e.id, `${t}.id`)
699
+ };
700
+ case "navigation": return r(["target"]), {
701
+ kind: n,
702
+ target: H(e.target, `${t}.target`)
703
+ };
704
+ case "data-table": return r([
705
+ "rows",
706
+ "key",
707
+ "child",
708
+ "childValue",
709
+ "label",
710
+ "maxRows",
711
+ "defaultMaxRows",
712
+ "documentRows",
713
+ "documentCells",
714
+ "maxColumns"
715
+ ]), {
716
+ kind: n,
717
+ rows: H(e.rows, `${t}.rows`),
718
+ key: H(e.key, `${t}.key`),
719
+ child: H(e.child, `${t}.child`),
720
+ childValue: H(e.childValue, `${t}.childValue`),
721
+ label: H(e.label, `${t}.label`),
722
+ maxRows: H(e.maxRows, `${t}.maxRows`),
723
+ defaultMaxRows: U(e.defaultMaxRows, `${t}.defaultMaxRows`, d),
724
+ documentRows: U(e.documentRows, `${t}.documentRows`, m),
725
+ documentCells: U(e.documentCells, `${t}.documentCells`, h),
726
+ maxColumns: U(e.maxColumns, `${t}.maxColumns`, 20)
727
+ };
728
+ case "plot-math": return r([
729
+ "min",
730
+ "max",
731
+ "samples",
732
+ "curves",
733
+ "points"
734
+ ]), {
735
+ kind: n,
736
+ min: H(e.min, `${t}.min`),
737
+ max: H(e.max, `${t}.max`),
738
+ samples: H(e.samples, `${t}.samples`),
739
+ curves: U(e.curves, `${t}.curves`, 16),
740
+ points: U(e.points, `${t}.points`, l)
741
+ };
742
+ case "chart-table": return r([
743
+ "chartKind",
744
+ "x",
745
+ "y"
746
+ ]), {
747
+ kind: n,
748
+ chartKind: H(e.chartKind, `${t}.chartKind`),
749
+ x: H(e.x, `${t}.x`),
750
+ y: H(e.y, `${t}.y`)
751
+ };
752
+ case "timeline-table": return r(["headerSets"]), Array.isArray(e.headerSets) || N(`${t}.headerSets`, "must be an array."), {
753
+ kind: n,
754
+ headerSets: e.headerSets.map((e, n) => ct(e, `${t}.headerSets[${n}]`))
755
+ };
756
+ case "table-selection": return r(["key", "bindings"]), {
757
+ kind: n,
758
+ key: H(e.key, `${t}.key`),
759
+ bindings: W(e.bindings, `${t}.bindings`)
760
+ };
761
+ case "retain": return r(["value"]), {
762
+ kind: n,
763
+ value: I(e.value, `${t}.value`)
764
+ };
765
+ case "self-binding-read": return r(["mode", "attribute"]), e.mode !== "always" && e.mode !== "attribute" && N(`${t}.mode`, "must be \"always\" or \"attribute\"."), {
766
+ kind: n,
767
+ mode: e.mode,
768
+ ...e.attribute === void 0 ? {} : { attribute: H(e.attribute, `${t}.attribute`) }
769
+ };
770
+ case "value-date": return r([
771
+ "min",
772
+ "max",
773
+ "required"
774
+ ]), {
775
+ kind: n,
776
+ ...i([
777
+ "min",
778
+ "max",
779
+ "required"
780
+ ])
781
+ };
782
+ case "value-length": return r([
783
+ "min",
784
+ "max",
785
+ "email",
786
+ "emailType"
787
+ ]), {
788
+ kind: n,
789
+ ...i([
790
+ "min",
791
+ "max",
792
+ "email"
793
+ ]),
794
+ ...e.emailType === void 0 ? {} : { emailType: L(e.emailType, `${t}.emailType`, 128) }
795
+ };
796
+ case "value-required": return r(["required"]), {
797
+ kind: n,
798
+ required: H(e.required, `${t}.required`)
799
+ };
800
+ case "value-email": return r(["type", "value"]), {
801
+ kind: n,
802
+ ...i(["type"]),
803
+ ...e.value === void 0 ? {} : { value: L(e.value, `${t}.value`, 128) }
804
+ };
805
+ default: N(`${t}.kind`, "is not a supported rule.");
806
+ }
807
+ }
808
+ function ut(e) {
809
+ Array.isArray(e) || N("rules", "must be an array."), e.length > 32 && N("rules", "accepts at most 32 rules.");
810
+ let t = [];
811
+ for (let n = 0; n < e.length; n += 1) t.push(lt(e[n], `rules[${n}]`));
812
+ return t;
813
+ }
814
+ function dt(e) {
815
+ Array.isArray(e) || N("slotRelations", "must be an array."), e.length > 16 && N("slotRelations", "accepts at most 16 relations.");
816
+ let t = [];
817
+ for (let n = 0; n < e.length; n += 1) {
818
+ let r = e[n], i = `slotRelations[${n}]`;
819
+ P(r) || N(i, "must be an object."), F(r, /* @__PURE__ */ new Set(["lower", "upper"]), i), t.push({
820
+ lower: z(r.lower, `${i}.lower`),
821
+ upper: z(r.upper, `${i}.upper`)
822
+ });
823
+ }
824
+ return t;
825
+ }
826
+ function ft(e, t) {
827
+ P(e) || N(t, "must be an object."), F(e, Ve, t);
828
+ let n = (n) => e[n] !== void 0 && I(e[n], `${t}.${n}`);
829
+ return {
830
+ interactive: n("interactive"),
831
+ static: n("static"),
832
+ ssr: n("ssr"),
833
+ offline: n("offline")
834
+ };
835
+ }
836
+ function pt(e, t) {
837
+ P(e) || N(t, "must be an object."), F(e, Re, t);
838
+ let n = e.kind;
839
+ typeof n == "string" && Oe.has(n) || N(`${t}.kind`, "must be \"string\", \"number\", \"boolean\" or \"enum\".");
840
+ let r = n, i = { kind: r };
841
+ for (let n of [
842
+ "required",
843
+ "static",
844
+ "dynamic",
845
+ "integer",
846
+ "positive",
847
+ "color",
848
+ "nullable"
849
+ ]) e[n] !== void 0 && (i[n] = I(e[n], `${t}.${n}`));
850
+ i.static === !0 && i.dynamic === !0 && N(t, "cannot be both static and dynamic."), e.coerce !== void 0 && (e.coerce !== "text" && N(`${t}.coerce`, "must be \"text\"."), r !== "string" && N(`${t}.coerce`, "is only valid for kind \"string\"."), i.coerce = "text");
851
+ let a = e.enum === void 0 ? e.values : e.enum, o = a !== void 0;
852
+ if (r !== "enum") o && N(t, `"enum" is only valid for kind "enum", not "${r}".`);
853
+ else {
854
+ e.enum !== void 0 && e.values !== void 0 && N(t, "use \"enum\" or \"values\", not both."), Array.isArray(a) && a.length !== 0 || N(`${t}.enum`, "must be a non-empty string array."), a.length > 64 && N(`${t}.enum`, "accepts at most 64 values.");
855
+ let n = /* @__PURE__ */ new Set(), r = [];
856
+ for (let e of a) {
857
+ let i = L(e, `${t}.enum`, 128);
858
+ n.has(i) && N(`${t}.enum`, `value "${i}" is declared more than once.`), n.add(i), r.push(i);
859
+ }
860
+ i.enum = r;
861
+ }
862
+ let s = e.pattern !== void 0;
863
+ if (r !== "string") s && N(t, `"pattern" is only valid for kind "string", not "${r}".`);
864
+ else if (s) {
865
+ typeof e.pattern != "string" && N(`${t}.pattern`, "must be a string."), e.pattern.length > 512 && N(`${t}.pattern`, "exceeds the 512-character limit.");
866
+ try {
867
+ new RegExp(e.pattern);
868
+ } catch {
869
+ N(`${t}.pattern`, "is not a valid regular expression.");
870
+ }
871
+ y(e.pattern) || N(`${t}.pattern`, "uses unsupported regex syntax; nested quantifiers, quantified alternation, backreferences and lookarounds are rejected."), i.pattern = e.pattern;
872
+ }
873
+ let c = e.min !== void 0, l = e.max !== void 0;
874
+ if (r === "number" ? (c && (i.min = R(e.min, `${t}.min`)), l && (i.max = R(e.max, `${t}.max`)), i.min !== void 0 && i.max !== void 0 && i.min > i.max && N(t, "\"min\" cannot exceed \"max\".")) : ((c || l) && N(t, "\"min\" and \"max\" are only valid for kind \"number\"."), i.integer === !0 && N(t, "\"integer\" is only valid for kind \"number\"."), i.positive === !0 && N(t, "\"positive\" is only valid for kind \"number\".")), i.color === !0 && r !== "string" && N(t, "\"color\" is only valid for kind \"string\"."), e.description !== void 0 && (i.description = B(e.description, `${t}.description`)), e.default !== void 0) {
875
+ let n = e.default;
876
+ if (n === null) i.nullable !== !0 && N(`${t}.default`, "is null but the prop is not nullable."), i.default = null;
877
+ else if (r === "string") i.default = L(n, `${t}.default`);
878
+ else if (r === "number") {
879
+ let e = R(n, `${t}.default`);
880
+ i.integer === !0 && !Number.isInteger(e) && N(`${t}.default`, "must be an integer."), i.positive === !0 && !(e > 0) && N(`${t}.default`, "must be greater than zero."), i.min !== void 0 && e < i.min && N(`${t}.default`, `is below the minimum ${i.min}.`), i.max !== void 0 && e > i.max && N(`${t}.default`, `exceeds the maximum ${i.max}.`), i.default = e;
881
+ } else if (r === "boolean") i.default = I(n, `${t}.default`);
882
+ else {
883
+ let e = L(n, `${t}.default`, 128);
884
+ i.enum?.includes(e) || N(`${t}.default`, `"${e}" is not an allowed enum value.`), i.default = e;
885
+ }
886
+ if (i.pattern !== void 0 && r === "string" && typeof i.default == "string") {
887
+ let e = !0;
888
+ try {
889
+ e = new RegExp(i.pattern).test(i.default);
890
+ } catch {
891
+ e = !1;
892
+ }
893
+ e || N(`${t}.default`, `does not match pattern ${i.pattern}.`);
894
+ }
895
+ }
896
+ return i;
897
+ }
898
+ function mt(e, t) {
899
+ P(e) || N(t, "must be an object with \"literal\" or \"prop\".");
900
+ let n = Object.keys(e);
901
+ n.length !== 1 && N(t, "must contain exactly one of \"literal\" or \"prop\".");
902
+ let r = n[0];
903
+ if (A.has(r) && N(t, `field "${r}" is not allowed.`), r === "literal") return { literal: R(e.literal, `${t}.literal`) };
904
+ if (r === "prop") return { prop: z(e.prop, `${t}.prop`) };
905
+ N(t, `unknown field "${r}"; use "literal" or "prop".`);
906
+ }
907
+ function ht(e, t, n, r) {
908
+ P(e) || N(r, "must be an object."), F(e, Be, r);
909
+ let i = {};
910
+ for (let n of [
911
+ "min",
912
+ "max",
913
+ "step"
914
+ ]) {
915
+ if (e[n] === void 0) continue;
916
+ let a = mt(e[n], `${r}.${n}`);
917
+ if ("prop" in a) {
918
+ let e = t[a.prop];
919
+ e === void 0 && N(`${r}.${n}`, `references undeclared prop "${a.prop}".`), e.kind !== "number" && N(`${r}.${n}`, `references prop "${a.prop}", which is not a number.`);
920
+ }
921
+ n === "step" && "literal" in a && !(a.literal > 0) && N(`${r}.step`, "must be greater than 0."), i[n] = a;
922
+ }
923
+ return n !== "number" && (i.min || i.max || i.step) && N(r, "\"min\", \"max\" and \"step\" are only valid for number bindings."), i.min && "literal" in i.min && i.max && "literal" in i.max && i.min.literal > i.max.literal && N(r, "\"min\" cannot exceed \"max\"."), i;
924
+ }
925
+ function gt(e, t) {
926
+ if (e === "number") return t === "timer" ? /* @__PURE__ */ new Set([
927
+ "duration",
928
+ "min",
929
+ "nearest-zero"
930
+ ]) : /* @__PURE__ */ new Set([
931
+ "min",
932
+ "nearest-zero",
933
+ "max-step"
934
+ ]);
935
+ if (e === "boolean") return /* @__PURE__ */ new Set(["false"]);
936
+ if (e === "null") return /* @__PURE__ */ new Set(["empty"]);
937
+ if (e === "array") return t === "checklist" ? /* @__PURE__ */ new Set(["checked", "empty-array"]) : /* @__PURE__ */ new Set(["empty-array"]);
938
+ if (e === "number-array") return /* @__PURE__ */ new Set(["empty-array"]);
939
+ switch (t) {
940
+ case "choice":
941
+ case "selection": return /* @__PURE__ */ new Set(["first-option", "none"]);
942
+ case "tabs": return /* @__PURE__ */ new Set(["first-tab"]);
943
+ case "steps": return /* @__PURE__ */ new Set(["first-step"]);
944
+ case "diagram": return /* @__PURE__ */ new Set(["first-node"]);
945
+ case "date": return /* @__PURE__ */ new Set(["empty"]);
946
+ default: return /* @__PURE__ */ new Set(["empty"]);
947
+ }
948
+ }
949
+ function _t(e, t, n, r = !1) {
950
+ P(e) || N(n, "must be an object."), F(e, ze, n);
951
+ let i = e.kind;
952
+ typeof i == "string" && Ae.has(i) || N(`${n}.kind`, "must be \"string\", \"number\", \"boolean\", \"array\", \"number-array\" or \"null\".");
953
+ let a = i, o = e.family;
954
+ typeof o == "string" && je.has(o) || N(`${n}.family`, "must be a supported binding family.");
955
+ let s = o;
956
+ ({
957
+ number: /* @__PURE__ */ new Set(["number", "timer"]),
958
+ boolean: /* @__PURE__ */ new Set(["boolean"]),
959
+ string: /* @__PURE__ */ new Set([
960
+ "text",
961
+ "choice",
962
+ "date",
963
+ "tabs",
964
+ "diagram",
965
+ "steps",
966
+ "selection"
967
+ ]),
968
+ array: /* @__PURE__ */ new Set([
969
+ "multi-select",
970
+ "checklist",
971
+ "collection"
972
+ ]),
973
+ "number-array": /* @__PURE__ */ new Set(["collection"]),
974
+ null: /* @__PURE__ */ new Set(["text"])
975
+ })[a]?.has(s) || N(`${n}.family`, `"${s}" is not supported for a ${a} binding.`);
976
+ let c;
977
+ if (e.options !== void 0) {
978
+ a !== "string" && N(`${n}.options`, "is only valid for a string binding."), s !== "choice" && N(`${n}.options`, "requires family \"choice\".");
979
+ let t = e.options;
980
+ Array.isArray(t) && t.length !== 0 || N(`${n}.options`, "must be a non-empty string array."), t.length > 64 && N(`${n}.options`, "accepts at most 64 values.");
981
+ let r = /* @__PURE__ */ new Set(), i = [];
982
+ for (let e of t) {
983
+ let t = L(e, `${n}.options`, 128);
984
+ t.length === 0 && N(`${n}.options`, "values must be non-empty."), r.has(t) && N(`${n}.options`, `value "${t}" is declared more than once.`), r.add(t), i.push(t);
985
+ }
986
+ c = i;
987
+ }
988
+ a === "string" && s === "choice" && c === void 0 && !r && N(`${n}.options`, "is required for a choice binding."), s !== "choice" && c !== void 0 && N(`${n}.options`, "is only valid for family \"choice\".");
989
+ let l = z(e.bind, `${n}.bind`), u = z(e.initial, `${n}.initial`);
990
+ l === u && N(n, "\"bind\" and \"initial\" must name different attributes."), (M.has(l) || M.has(u)) && N(n, "binding attributes cannot use a reserved slot name."), (Object.hasOwn(t, l) || Object.hasOwn(t, u)) && N(n, "binding attributes are reserved and cannot be declared as props.");
991
+ let d = gt(a, s), f;
992
+ if (e.initialRule === void 0) switch (a) {
993
+ case "number":
994
+ f = s === "timer" ? "duration" : "nearest-zero";
995
+ break;
996
+ case "boolean":
997
+ f = "false";
998
+ break;
999
+ case "array":
1000
+ f = s === "checklist" ? "checked" : "empty-array";
1001
+ break;
1002
+ case "number-array":
1003
+ f = "empty-array";
1004
+ break;
1005
+ case "null":
1006
+ f = "empty";
1007
+ break;
1008
+ default: f = s === "choice" ? "first-option" : s === "tabs" ? "first-tab" : s === "steps" ? "first-step" : s === "diagram" ? "first-node" : s === "selection" ? "none" : "empty";
1009
+ }
1010
+ else typeof e.initialRule == "string" && Me.has(e.initialRule) || N(`${n}.initialRule`, "is not a supported initial rule."), f = e.initialRule;
1011
+ d.has(f) || N(`${n}.initialRule`, `is not supported for a ${a} ${s} binding.`), e.required !== void 0 && I(e.required, `${n}.required`), e.exclusive !== void 0 && I(e.exclusive, `${n}.exclusive`), e.retain !== void 0 && I(e.retain, `${n}.retain`);
1012
+ let p;
1013
+ e.constraints !== void 0 && (p = ht(e.constraints, t, a, `${n}.constraints`));
1014
+ let m;
1015
+ if (e.maxItems !== void 0) {
1016
+ if (a !== "array" && a !== "number-array" && N(`${n}.maxItems`, "is only valid for array or number-array bindings."), m = mt(e.maxItems, `${n}.maxItems`), "prop" in m) {
1017
+ let e = t[m.prop];
1018
+ e === void 0 && N(`${n}.maxItems`, `references undeclared prop "${m.prop}".`), e.kind !== "number" && N(`${n}.maxItems`, `references prop "${m.prop}", which is not a number.`), e.dynamic === !0 && N(`${n}.maxItems`, "requires a static numeric property.");
1019
+ } else (!Number.isInteger(m.literal) || m.literal < 0) && N(`${n}.maxItems`, "must be a nonnegative integer.");
1020
+ }
1021
+ let h;
1022
+ if (e.requiresAttributes !== void 0) {
1023
+ h = V(e.requiresAttributes, `${n}.requiresAttributes`);
1024
+ for (let e of h) Object.hasOwn(t, e) || N(`${n}.requiresAttributes`, `references undeclared prop "${e}".`);
1025
+ }
1026
+ let g;
1027
+ if (e.compare !== void 0) {
1028
+ g = V(e.compare, `${n}.compare`);
1029
+ for (let e of g) Object.hasOwn(t, e) || N(`${n}.compare`, `references undeclared prop "${e}".`);
1030
+ }
1031
+ return {
1032
+ kind: a,
1033
+ family: s,
1034
+ bind: l,
1035
+ initial: u,
1036
+ initialRule: f,
1037
+ ...e.required === !0 ? { required: !0 } : {},
1038
+ ...e.exclusive === !0 ? { exclusive: !0 } : {},
1039
+ ...c ? { options: c } : {},
1040
+ ...p ? { constraints: p } : {},
1041
+ ...m ? { maxItems: m } : {},
1042
+ ...h ? { requiresAttributes: h } : {},
1043
+ ...g ? { compare: g } : {},
1044
+ ...e.retain === !1 ? { retain: !1 } : {}
1045
+ };
1046
+ }
1047
+ function vt(e, t) {
1048
+ P(e) || N(t, "must be an object."), F(e, Ge, t);
1049
+ let n = e.id;
1050
+ (typeof n != "string" || !k.test(n) || n.length > 160) && N(`${t}.id`, "must be a lowercase namespaced id.");
1051
+ let r;
1052
+ if (e.version !== void 0) {
1053
+ let n = e.version, i = T(n);
1054
+ i === null && N(`${t}.version`, "must be an exact version or a supported range (exact, ^, ~, >=, <=, >, <)."), r = i.source;
1055
+ }
1056
+ return {
1057
+ id: n,
1058
+ ...r ? { version: r } : {}
1059
+ };
1060
+ }
1061
+ function yt(e) {
1062
+ P(e) || N("requires", "must be an object."), F(e, Ke, "requires");
1063
+ let t;
1064
+ if (e.kernel !== void 0) {
1065
+ let n = T(e.kernel);
1066
+ n === null && N("requires.kernel", "must be a supported kernel version range (exact, ^, ~, >=, <=, >, <)."), t = n.source;
1067
+ }
1068
+ return { ...t ? { kernel: t } : {} };
1069
+ }
1070
+ function bt(e, t) {
1071
+ P(e) || N("replaces", "must be an object."), F(e, qe, "replaces");
1072
+ let n = e.id;
1073
+ (typeof n != "string" || !k.test(n) || n.length > 160) && N("replaces.id", "must be a lowercase namespaced id."), n !== t && N("replaces.id", "must equal the declaring manifest id.");
1074
+ let r;
1075
+ if (e.version !== void 0) {
1076
+ let t = T(e.version);
1077
+ t === null && N("replaces.version", "must be an exact version or a supported range (exact, ^, ~, >=, <=, >, <)."), r = t.source;
1078
+ }
1079
+ return {
1080
+ id: n,
1081
+ ...r ? { version: r } : {}
1082
+ };
1083
+ }
1084
+ function xt(e) {
1085
+ Array.isArray(e) || N("styles", "must be an array of style-resource ids."), e.length > 32 && N("styles", "accepts at most 32 resources.");
1086
+ let t = /* @__PURE__ */ new Set(), n = [];
1087
+ for (let r = 0; r < e.length; r += 1) {
1088
+ let i = e[r];
1089
+ (typeof i != "string" || i.length === 0 || i.length > 256) && N(`styles[${r}]`, "must be a non-empty string of at most 256 characters."), Je.test(i) || N(`styles[${r}]`, "must be a bounded resource id."), t.has(i) && N("styles", `resource "${i}" is declared more than once.`), t.add(i), n.push(i);
1090
+ }
1091
+ return n;
1092
+ }
1093
+ function G(e) {
1094
+ if (typeof e == "object" && e && j.has(e)) return e;
1095
+ P(e) || N("manifest", "must be an object."), F(e, Le, "manifest");
1096
+ let t = e.id;
1097
+ (typeof t != "string" || t.length > 160 || !k.test(t)) && N("id", "must be a lowercase namespaced id such as \"example/rating\".");
1098
+ let n = z(e.name, "name"), r = e.version;
1099
+ (typeof r != "string" || r.length > 64 || !Ee.test(r)) && N("version", "must be a semantic version such as 1.0.0."), e.protocol !== "reactive-md-component/v1" && N("protocol", `must be "${x}".`);
1100
+ let i = e.form;
1101
+ typeof i == "string" && ke.has(i) || N("form", "must be \"leaf\", \"inline\" or \"container\".");
1102
+ let a = i;
1103
+ P(e.props) || N("props", "must be an object.");
1104
+ let o = Object.keys(e.props).sort();
1105
+ o.length > 64 && N("props", "accepts at most 64 properties.");
1106
+ let s = {};
1107
+ for (let t of o) A.has(t) && N("props", `property "${t}" is not allowed.`), (!O.test(t) || t.length > 128) && N("props", `property "${t}" must use lowercase kebab-case.`), s[t] = pt(e.props[t], `props.${t}`);
1108
+ let c;
1109
+ if (e.bindings !== void 0) {
1110
+ P(e.bindings) || N("bindings", "must be an object.");
1111
+ let t = Object.keys(e.bindings);
1112
+ t.length === 0 && N("bindings", "must declare at least one binding slot."), t.length > 16 && N("bindings", "accepts at most 16 slots.");
1113
+ let n = {}, r = /* @__PURE__ */ new Set();
1114
+ for (let i of t) {
1115
+ A.has(i) && N("bindings", `field "${i}" is not allowed.`), Ye.test(i) || N("bindings", `slot "${i}" must be a letter followed by letters or digits.`), M.has(i) && N("bindings", `slot "${i}" is reserved by the runtime.`);
1116
+ let t = _t(e.bindings[i], s, `bindings.${i}`, a === "container" && Array.isArray(e.rules) && e.rules.some((e) => P(e) && e.kind === "options-body"));
1117
+ i !== "value" && (t.kind !== "number" || t.family !== "number") && N(`bindings.${i}`, "numeric named slots support kind \"number\" with family \"number\" in this contract."), i !== "value" && P(e.bindings[i]) && e.bindings[i].exclusive === !1 && N(`bindings.${i}.exclusive`, "named slots require exclusive ownership in this contract.");
1118
+ for (let e of [t.bind, t.initial]) r.has(e) && N("bindings", `attribute "${e}" is claimed by more than one binding.`), r.add(e);
1119
+ n[i] = i === "value" ? t : {
1120
+ ...t,
1121
+ exclusive: !0
1122
+ };
1123
+ }
1124
+ c = n;
1125
+ }
1126
+ let l = e.children === void 0 ? void 0 : rt(e.children, a, "children");
1127
+ e.children !== void 0 && e.structure !== void 0 && N("manifest", "cannot declare both \"children\" and \"structure\"; use \"structure\".");
1128
+ let u = e.structure === void 0 ? it(l) : ot(e.structure, a, "structure"), d = e.rules === void 0 ? void 0 : ut(e.rules), f = e.slotRelations === void 0 ? void 0 : dt(e.slotRelations);
1129
+ e.legacyHost !== void 0 && I(e.legacyHost, "legacyHost");
1130
+ let p = ft(e.capabilities, "capabilities"), m = e.authoring === void 0 ? void 0 : nt(e.authoring, "authoring"), h = e.styles === void 0 ? void 0 : xt(e.styles), g = e.requires === void 0 ? void 0 : yt(e.requires), _ = e.replaces === void 0 ? void 0 : bt(e.replaces, t), v;
1131
+ if (e.dependencies !== void 0) {
1132
+ Array.isArray(e.dependencies) || N("dependencies", "must be an array."), e.dependencies.length > 16 && N("dependencies", "accepts at most 16 entries.");
1133
+ let t = /* @__PURE__ */ new Set(), n = [];
1134
+ for (let r = 0; r < e.dependencies.length; r += 1) {
1135
+ let i = vt(e.dependencies[r], `dependencies[${r}]`);
1136
+ t.has(i.id) && N("dependencies", `"${i.id}" is declared more than once.`), t.add(i.id), n.push(i);
1137
+ }
1138
+ v = n;
1139
+ }
1140
+ let y = {
1141
+ id: t,
1142
+ name: n,
1143
+ version: r,
1144
+ protocol: x,
1145
+ form: a,
1146
+ props: s,
1147
+ ...c ? { bindings: c } : {},
1148
+ ...l ? { children: l } : {},
1149
+ ...u && !l ? { structure: u } : {},
1150
+ ...d ? { rules: d } : {},
1151
+ ...f ? { slotRelations: f } : {},
1152
+ ...e.legacyHost === !0 ? { legacyHost: !0 } : {},
1153
+ capabilities: p,
1154
+ ...m ? { authoring: m } : {},
1155
+ ...h ? { styles: h } : {},
1156
+ ...g ? { requires: g } : {},
1157
+ ...v ? { dependencies: v } : {},
1158
+ ..._ ? { replaces: _ } : {}
1159
+ };
1160
+ tt(y) > 65536 && N("manifest", `serialized size exceeds the ${Te}-byte budget.`);
1161
+ let b = Ct(y);
1162
+ return j.add(b), b;
1163
+ }
1164
+ function St(e) {
1165
+ return G(e);
1166
+ }
1167
+ function Ct(e) {
1168
+ if (typeof e != "object" || !e) return e;
1169
+ for (let t of Object.keys(e)) Ct(e[t]);
1170
+ return Object.freeze(e);
1171
+ }
1172
+ function wt(e) {
1173
+ return {
1174
+ kind: e.kind,
1175
+ ...e.required === !0 ? { required: !0 } : {},
1176
+ ...e.static === !0 ? { static: !0 } : {},
1177
+ ...e.dynamic === void 0 ? {} : { dynamic: e.dynamic },
1178
+ ...e.default === void 0 ? {} : { default: e.default },
1179
+ ...e.nullable === !0 ? { nullable: !0 } : {},
1180
+ ...e.enum ? { enum: [...e.enum] } : {},
1181
+ ...e.pattern === void 0 ? {} : { pattern: e.pattern },
1182
+ ...e.min === void 0 ? {} : { min: e.min },
1183
+ ...e.max === void 0 ? {} : { max: e.max },
1184
+ ...e.integer === !0 ? { integer: !0 } : {},
1185
+ ...e.positive === !0 ? { positive: !0 } : {},
1186
+ ...e.color === !0 ? { color: !0 } : {},
1187
+ ...e.coerce === void 0 ? {} : { coerce: e.coerce }
1188
+ };
1189
+ }
1190
+ function K(e) {
1191
+ return "literal" in e ? { literal: e.literal } : { prop: e.prop };
1192
+ }
1193
+ function Tt(e) {
1194
+ return {
1195
+ ...e.min ? { min: K(e.min) } : {},
1196
+ ...e.max ? { max: K(e.max) } : {},
1197
+ ...e.step ? { step: K(e.step) } : {}
1198
+ };
1199
+ }
1200
+ function Et(e) {
1201
+ let t = e.constraints;
1202
+ return {
1203
+ kind: e.kind,
1204
+ family: e.family,
1205
+ bind: e.bind,
1206
+ initial: e.initial,
1207
+ initialRule: e.initialRule,
1208
+ ...e.required === !0 ? { required: !0 } : {},
1209
+ ...e.exclusive === !0 ? { exclusive: !0 } : {},
1210
+ ...e.options ? { options: [...e.options] } : {},
1211
+ ...t ? { constraints: Tt(t) } : {},
1212
+ ...e.maxItems ? { maxItems: K(e.maxItems) } : {},
1213
+ ...e.requiresAttributes ? { requiresAttributes: [...e.requiresAttributes] } : {},
1214
+ ...e.compare ? { compare: [...e.compare] } : {},
1215
+ ...e.retain === !1 ? { retain: !1 } : {}
1216
+ };
1217
+ }
1218
+ function Dt(e) {
1219
+ return {
1220
+ rule: e.rule,
1221
+ ...e.label === void 0 ? {} : { label: e.label },
1222
+ ...e.parents ? { parents: [...e.parents] } : {},
1223
+ ...e.child === void 0 ? {} : { child: e.child },
1224
+ ...e.children ? { children: [...e.children] } : {},
1225
+ ...e.min === void 0 ? {} : { min: e.min },
1226
+ ...e.max === void 0 ? {} : { max: e.max },
1227
+ ...e.inlineOnly === void 0 ? {} : { inlineOnly: e.inlineOnly },
1228
+ ...e.noComponents === void 0 ? {} : { noComponents: e.noComponents },
1229
+ ...e.valueAttribute === void 0 ? {} : { valueAttribute: e.valueAttribute },
1230
+ ...e.generatedPrefix === void 0 ? {} : { generatedPrefix: e.generatedPrefix },
1231
+ ...e.forbidSeparator === void 0 ? {} : { forbidSeparator: e.forbidSeparator },
1232
+ ...e.maxItems === void 0 ? {} : { maxItems: e.maxItems }
1233
+ };
1234
+ }
1235
+ function Ot(e) {
1236
+ let t = e, n = Object.keys(t).sort(), r = {};
1237
+ for (let e of n) {
1238
+ let n = t[e];
1239
+ r[e] = Array.isArray(n) ? n.map((e) => Array.isArray(e) ? [...e] : e) : n;
1240
+ }
1241
+ return r;
1242
+ }
1243
+ function kt(e) {
1244
+ let t = {};
1245
+ for (let n of Object.keys(e.props).sort()) t[n] = wt(e.props[n]);
1246
+ let n = {};
1247
+ if (e.bindings) for (let t of Object.keys(e.bindings).sort()) n[t] = Et(e.bindings[t]);
1248
+ return {
1249
+ protocol: e.protocol,
1250
+ id: e.id,
1251
+ name: e.name,
1252
+ version: e.version,
1253
+ form: e.form,
1254
+ props: t,
1255
+ ...e.bindings ? { bindings: n } : {},
1256
+ ...e.children ? { children: {
1257
+ kind: e.children.kind,
1258
+ ...e.children.required ? { required: !0 } : {}
1259
+ } } : {},
1260
+ ...e.structure ? { structure: Dt(e.structure) } : {},
1261
+ ...e.rules ? { rules: e.rules.map(Ot) } : {},
1262
+ ...e.slotRelations ? { slotRelations: e.slotRelations.map((e) => ({ ...e })) } : {},
1263
+ capabilities: {
1264
+ interactive: e.capabilities.interactive,
1265
+ static: e.capabilities.static,
1266
+ ssr: e.capabilities.ssr,
1267
+ offline: e.capabilities.offline
1268
+ },
1269
+ ...e.styles ? { styles: [...e.styles] } : {},
1270
+ ...e.requires?.kernel ? { requires: { kernel: e.requires.kernel } } : {},
1271
+ ...e.dependencies ? { dependencies: [...e.dependencies].map((e) => ({ ...e })).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)) } : {},
1272
+ ...e.replaces ? { replaces: {
1273
+ id: e.replaces.id,
1274
+ ...e.replaces.version ? { version: e.replaces.version } : {}
1275
+ } } : {}
1276
+ };
1277
+ }
1278
+ var At = /* @__PURE__ */ new WeakMap();
1279
+ function q(e) {
1280
+ let t = j.has(e) ? e : G(e), n = At.get(t);
1281
+ if (n !== void 0) return n;
1282
+ let r = _(JSON.stringify(kt(t)));
1283
+ return At.set(t, r), r;
1284
+ }
1285
+ function jt(e) {
1286
+ return Object.freeze({
1287
+ id: e.id,
1288
+ name: e.name,
1289
+ version: e.version,
1290
+ digest: q(e)
1291
+ });
1292
+ }
1293
+ function Mt(e) {
1294
+ return typeof e == "string" && e.length <= 128 && O.test(e);
1295
+ }
1296
+ function J(e) {
1297
+ return typeof e == "string" && e.length > 0 && e.length <= 160 && k.test(e);
1298
+ }
1299
+ // src/sdk/preset-core.ts
1300
+ var Nt = 160, Pt = 256, Ft = 32, It = 256, Lt = 4096, Rt = /^[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)*$/, zt = /* @__PURE__ */ new Set([
1301
+ "__proto__",
1302
+ "constructor",
1303
+ "prototype"
1304
+ ]), Bt = /* @__PURE__ */ new Set([
1305
+ "protocol",
1306
+ "id",
1307
+ "version",
1308
+ "components",
1309
+ "authoring",
1310
+ "themes",
1311
+ "dependencies",
1312
+ "metadata"
1313
+ ]), Vt = /* @__PURE__ */ new Set([
1314
+ "title",
1315
+ "description",
1316
+ "category",
1317
+ "insertText"
1318
+ ]), Ht = /* @__PURE__ */ new Set(["title", "description"]), Ut = /* @__PURE__ */ new Set(["id", "version"]), Wt = /* @__PURE__ */ new WeakSet();
1319
+ function Y(e, t) {
1320
+ throw Error(`Invalid local preset (${e}): ${t}`);
1321
+ }
1322
+ function X(e) {
1323
+ if (typeof e != "object" || !e || Array.isArray(e)) return !1;
1324
+ let t = Object.getPrototypeOf(e);
1325
+ return t === Object.prototype || t === null;
1326
+ }
1327
+ function Z(e, t, n) {
1328
+ for (let r of Object.keys(e)) zt.has(r) && Y(n, `field "${r}" is not allowed.`), t.has(r) || Y(n, `unknown field "${r}".`);
1329
+ }
1330
+ function Q(e, t) {
1331
+ X(e) || Y(t, "must be a locale-keyed string map.");
1332
+ let n = {};
1333
+ for (let r of Object.keys(e).sort()) {
1334
+ zt.has(r) && Y(t, `locale "${r}" is not allowed.`), /^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/.test(r) || Y(t, `locale "${r}" must look like "en" or "zh-CN".`);
1335
+ let i = e[r];
1336
+ (typeof i != "string" || i.length > Lt) && Y(t, `locale "${r}" must be a bounded string.`), n[r] = i;
1337
+ }
1338
+ return Object.freeze(n);
1339
+ }
1340
+ function Gt(e) {
1341
+ X(e) || Y("authoring", "must be an object."), Z(e, Vt, "authoring");
1342
+ let t = {};
1343
+ return e.title !== void 0 && (t.title = Q(e.title, "authoring.title")), e.description !== void 0 && (t.description = Q(e.description, "authoring.description")), e.category !== void 0 && ((typeof e.category != "string" || e.category.length > 64) && Y("authoring.category", "must be a bounded string."), t.category = e.category), e.insertText !== void 0 && ((typeof e.insertText != "string" || e.insertText.length > Lt) && Y("authoring.insertText", "must be a bounded string."), t.insertText = e.insertText), Object.freeze(t);
1344
+ }
1345
+ function Kt(e, t) {
1346
+ Array.isArray(e) || Y("authoring", "must be an array."), e.length > It && Y("authoring", `accepts at most ${It} entries.`);
1347
+ let n = new Set(t.map((e) => e.id)), r = /* @__PURE__ */ new Set(), i = [];
1348
+ for (let t = 0; t < e.length; t += 1) {
1349
+ let a = e[t];
1350
+ X(a) || Y(`authoring[${t}]`, "must be an object."), Z(a, /* @__PURE__ */ new Set(["componentId", "authoring"]), `authoring[${t}]`);
1351
+ let o = a.componentId;
1352
+ typeof o == "string" && J(o) || Y(`authoring[${t}].componentId`, "must be a lowercase namespaced id."), n.has(o) || Y(`authoring[${t}].componentId`, `"${o}" is not declared by this preset.`), r.has(o) && Y("authoring", `component "${o}" is declared more than once.`), r.add(o), i.push(Object.freeze({
1353
+ componentId: o,
1354
+ authoring: Gt(a.authoring)
1355
+ }));
1356
+ }
1357
+ return Object.freeze(i.sort((e, t) => e.componentId < t.componentId ? -1 : +(e.componentId > t.componentId)));
1358
+ }
1359
+ function qt(e) {
1360
+ Array.isArray(e) || Y("dependencies", "must be an array."), e.length > Ft && Y("dependencies", `accepts at most ${Ft} entries.`);
1361
+ let t = /* @__PURE__ */ new Set(), n = [];
1362
+ for (let r = 0; r < e.length; r += 1) {
1363
+ let i = e[r];
1364
+ X(i) || Y(`dependencies[${r}]`, "must be an object."), Z(i, Ut, `dependencies[${r}]`);
1365
+ let a = i.id;
1366
+ typeof a == "string" && J(a) || Y(`dependencies[${r}].id`, "must be a lowercase namespaced id."), t.has(a) && Y("dependencies", `"${a}" is declared more than once.`), t.add(a);
1367
+ let o = i.version;
1368
+ typeof o == "string" && E(o) || Y(`dependencies[${r}].version`, "must be an exact semantic version."), n.push(Object.freeze({
1369
+ id: a,
1370
+ version: o
1371
+ }));
1372
+ }
1373
+ return Object.freeze(n.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
1374
+ }
1375
+ function Jt(e) {
1376
+ Array.isArray(e) || Y("themes", "must be an array.");
1377
+ let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
1378
+ for (let i = 0; i < e.length; i += 1) {
1379
+ let a = e[i];
1380
+ X(a) || Y(`themes[${i}]`, "must be an object.");
1381
+ let o = a.id, s = a.name, c = a.version;
1382
+ (typeof o != "string" || o.length === 0) && Y(`themes[${i}].id`, "must be a non-empty string."), (typeof s != "string" || s.length === 0) && Y(`themes[${i}].name`, "must be a non-empty string."), typeof c == "string" && E(c) || Y(`themes[${i}].version`, "must be a semantic version."), n.has(o) && Y("themes", `theme id "${o}" is declared more than once.`), r.has(s) && Y("themes", `theme name "${s}" is declared more than once.`), n.add(o), r.add(s), t.push(Object.freeze({ ...a }));
1383
+ }
1384
+ return Object.freeze(t.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)));
1385
+ }
1386
+ function Yt(e) {
1387
+ return X(e) || Y("metadata", "must be an object."), Z(e, Ht, "metadata"), Object.freeze({
1388
+ ...e.title === void 0 ? {} : { title: Q(e.title, "metadata.title") },
1389
+ ...e.description === void 0 ? {} : { description: Q(e.description, "metadata.description") }
1390
+ });
1391
+ }
1392
+ function $(e) {
1393
+ if (X(e) && Wt.has(e)) return e;
1394
+ X(e) || Y("preset", "must be an object."), Z(e, Bt, "preset"), e.protocol !== "reactive-md-preset/v1" && Y("protocol", `must be "${S}".`);
1395
+ let t = e.id;
1396
+ (typeof t != "string" || t.length > Nt || !Rt.test(t)) && Y("id", "must be a lowercase namespaced id.");
1397
+ let n = e.version;
1398
+ typeof n == "string" && E(n) || Y("version", "must be a semantic version such as \"1.0.0\"."), Array.isArray(e.components) || Y("components", "must be an array."), e.components.length > Pt && Y("components", `accepts at most ${Pt} components.`);
1399
+ let r = [], i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1400
+ for (let t = 0; t < e.components.length; t += 1) {
1401
+ let n;
1402
+ try {
1403
+ n = St(e.components[t]);
1404
+ } catch (e) {
1405
+ Y(`components[${t}]`, e instanceof Error ? e.message : String(e));
1406
+ }
1407
+ i.has(n.id) && Y("components", `component id "${n.id}" is declared more than once.`), a.has(n.name) && Y("components", `component name "${n.name}" is declared more than once.`), i.add(n.id), a.add(n.name), r.push(n);
1408
+ }
1409
+ let o = e.authoring === void 0 ? void 0 : Kt(e.authoring, r), s = e.themes === void 0 ? void 0 : Jt(e.themes), c = e.dependencies === void 0 ? void 0 : qt(e.dependencies), l = e.metadata === void 0 ? void 0 : Yt(e.metadata), u = e.components, d = Object.isFrozen(u) && u.length === r.length && u.every((e, t) => e === r[t]) ? u : Object.freeze(r), f = Object.freeze({
1410
+ protocol: S,
1411
+ id: t,
1412
+ version: n,
1413
+ components: d,
1414
+ ...o ? { authoring: o } : {},
1415
+ ...s ? { themes: s } : {},
1416
+ ...c ? { dependencies: c } : {},
1417
+ ...l ? { metadata: l } : {}
1418
+ });
1419
+ return Wt.add(f), f;
1420
+ }
1421
+ function Xt(e) {
1422
+ return $(e);
1423
+ }
1424
+ function Zt(e) {
1425
+ let t = $(e);
1426
+ return _(JSON.stringify({
1427
+ protocol: S,
1428
+ id: t.id,
1429
+ version: t.version,
1430
+ components: [...t.components].map((e) => ({
1431
+ id: e.id,
1432
+ version: e.version,
1433
+ digest: q(e)
1434
+ })).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)),
1435
+ dependencies: [...t.dependencies ?? []].map((e) => ({
1436
+ id: e.id,
1437
+ version: e.version
1438
+ })).sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id))
1439
+ }));
1440
+ }
1441
+ // src/presets/identity.ts
1442
+ var Qt = "reactive-md/default", $t = b;
1443
+ export { h as $, it as A, oe as B, kt as C, q as D, Mt as E, te as F, T as G, E as H, ie as I, f as J, y as K, S as L, re as M, x as N, jt as O, ee as P, a as Q, ne as R, ye as S, J as T, me as U, ae as V, pe as W, n as X, r as Y, t as Z, Qe as _, $ as a, c as at, Ce as b, he as c, i as ct, ve as d, m as et, Te as f, Ze as g, ge as h, Zt as i, e as it, G as j, tt as k, Se as l, o as lt, xe as m, $t as n, d as nt, et as o, l as ot, _e as p, _ as q, Xt as r, s as rt, Xe as s, u as st, Qt as t, p as tt, be as u, g as ut, D as v, St as w, we as x, $e as y, b as z };