reactive-md 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +397 -333
- package/CHANGELOG.md +398 -334
- package/CONTRIBUTING-ch.md +22 -22
- package/CONTRIBUTING.md +22 -22
- package/README-ch.md +431 -431
- package/README-en.md +431 -431
- package/README.md +429 -429
- package/SECURITY-ch.md +83 -83
- package/SECURITY.md +83 -83
- package/THIRD_PARTY_NOTICES.md +0 -57
- package/bin/reactive-md.mjs +39 -39
- package/cli/args.mjs +263 -263
- package/cli/assets.mjs +395 -395
- package/cli/build.mjs +445 -445
- package/cli/check.mjs +444 -444
- package/cli/document.mjs +130 -130
- package/cli/errors.mjs +61 -61
- package/cli/fs-utils.mjs +133 -133
- package/cli/glob.mjs +203 -203
- package/cli/help.mjs +325 -323
- package/cli/init.mjs +1577 -1577
- package/cli/lint.mjs +177 -177
- package/cli/main.mjs +65 -65
- package/cli/migrate.mjs +368 -368
- package/cli/package-loader.mjs +41 -41
- package/cli/package.mjs +211 -211
- package/dist-library/LocalDocumentView-CP2QG86k.js +114 -0
- package/dist-library/{LocalDocumentViewCore-DXE0I0Qc.js → LocalDocumentViewCore-Cd6yMEkg.js} +379 -9445
- package/dist-library/LocalReactiveDocumentCore-VuYpZqdn.js +283 -0
- package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
- package/dist-library/authoring-Bwu_zCWs.js +768 -0
- package/dist-library/chart-B1TUtzm-.js +3 -0
- package/dist-library/choice-values-BItGjPD2.js +58 -0
- package/dist-library/color-values-r8Wf7ALn.js +6 -0
- package/dist-library/compile-B35rfzKr.js +1742 -0
- package/dist-library/compile-cache-key-D21X2Obx.js +28 -0
- package/dist-library/compiler-DBwLawMZ.js +98 -0
- package/dist-library/{compiler-core-DDDdvuLy.js → compiler-core-kkDiQ1RK.js} +4202 -3496
- package/dist-library/component-kernel-CsJSabHX.js +372 -0
- package/dist-library/{component-state-BRwvTV0d.js → component-state-Da0G8Ajc.js} +1 -1
- package/dist-library/component-utils-ZM3jUJNy.js +339 -0
- package/dist-library/conditional-branches-CIhJXasR.js +17 -0
- package/dist-library/config-validation-DbmsWAEV.js +469 -0
- package/dist-library/controls-DRy5rzzN.js +5970 -0
- package/dist-library/controls-DWlx-AQl.js +3 -0
- package/dist-library/{coordinate-B1VFK9fd.js → coordinate-c54pHfgf.js} +89 -89
- package/dist-library/data-BtFlkJzp.js +3 -0
- package/dist-library/data-table-CSAkm1eU.js +290 -0
- package/dist-library/data-table-model-DruztQFt.js +391 -0
- package/dist-library/data-visuals-rZQUeQM0.js +384 -0
- package/dist-library/{default-components-s21NevON.js → default-components-B-39etG9.js} +518 -355
- package/dist-library/{config-DXLvctiZ.js → default-config-CCa8rm2k.js} +265 -230
- package/dist-library/default-options-By16CVw1.js +131 -0
- package/dist-library/{registry-D6OGkOcX.js → default-registry-DXJy66xj.js} +4 -4
- package/dist-library/default-schema-CeYiEW1K.js +33 -0
- package/dist-library/diagram-BLepzI8l.js +3 -0
- package/dist-library/display-Bb6hAG5T.js +2065 -0
- package/dist-library/dist-Cueh1Psp.js +4761 -0
- package/dist-library/{document-theme-C8J6UyNO.js → document-theme-CJvN-nC1.js} +246 -4
- package/dist-library/{export-CIAIPBov.js → export-BSV4E0jv.js} +135 -135
- package/dist-library/font-aliases-CKYjwn4o.js +4 -0
- package/dist-library/gallery-BC6FYTqw.js +3 -0
- package/dist-library/{gallery-Dv1rOvL0.js → gallery-DM2yTVZJ.js} +1 -1
- package/dist-library/{html-Cr4CBwAH.js → html-CY9mC3Sr.js} +49 -48
- package/dist-library/{incremental-9nx92u9c.js → incremental-B-wW4H3F.js} +537 -384
- package/dist-library/{display-B_uutKkN.js → katex-4ukd4ZxT.js} +1555 -3618
- package/dist-library/layout-CPQggKxk.js +592 -0
- package/dist-library/layout-CaDWsDof.js +3 -0
- package/dist-library/limits-CFERRrlC.js +10 -0
- package/dist-library/localization-COdJ6lw2.js +6 -0
- package/dist-library/mafs-CnzDC5CR.js +3 -0
- package/dist-library/math-view-CyGTS6kv.js +20 -0
- package/dist-library/motion-tokens-Czk0RDmS.js +283 -0
- package/dist-library/mount-preset-DtrCX4G8.js +24 -0
- package/dist-library/numeric-sliders-BmJ1LCLx.js +542 -0
- package/dist-library/{observability-4KqXhIEU.js → observability-BVQ16ByQ.js} +125 -43
- package/dist-library/package-core-Cu_r_qs7.js +128 -0
- package/dist-library/parser-BHl9Lxbw.js +8 -0
- package/dist-library/parser-standard-DDAKv_DZ.js +4872 -0
- package/dist-library/plugin-packs-CkI0floL.js +19 -0
- package/dist-library/preset-core-BKPbH_Nv.js +1371 -0
- package/dist-library/props-0iDqxlTk.js +174 -0
- package/dist-library/react-74jdGBmu.js +32 -0
- package/dist-library/reactive-md-authoring.js +315 -296
- package/dist-library/reactive-md-build.js +334 -43
- package/dist-library/reactive-md-compiler-session.js +4 -0
- package/dist-library/reactive-md-compiler-standard.js +10 -10
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-contracts.js +6 -0
- package/dist-library/reactive-md-default-packs.js +32 -15
- package/dist-library/reactive-md-default-preset.js +7 -7
- package/dist-library/reactive-md-export.js +6 -5
- package/dist-library/reactive-md-minimal-preset.js +3 -2
- package/dist-library/reactive-md-minimal-react-preset.js +26 -23
- package/dist-library/reactive-md-minimal.css +1 -1
- package/dist-library/reactive-md-observability.js +125 -3
- package/dist-library/reactive-md-pack-style-manifest.js +805 -0
- package/dist-library/reactive-md-plugin-chart.js +14 -9
- package/dist-library/reactive-md-plugin-data.js +8 -8
- package/dist-library/reactive-md-plugin-diagram.js +7 -6
- package/dist-library/reactive-md-plugin-forms.js +14 -13
- package/dist-library/reactive-md-plugin-gallery.js +6 -5
- package/dist-library/reactive-md-plugin-navigation.js +8 -8
- package/dist-library/reactive-md-plugin-network.js +13 -13
- package/dist-library/reactive-md-plugin-plot.js +7 -6
- package/dist-library/reactive-md-print.css +304 -304
- package/dist-library/reactive-md-react-component-accordion.js +10 -0
- package/dist-library/reactive-md-react-component-alert.js +10 -0
- package/dist-library/reactive-md-react-component-anchor.js +10 -0
- package/dist-library/reactive-md-react-component-badge.js +10 -0
- package/dist-library/reactive-md-react-component-card.js +10 -0
- package/dist-library/reactive-md-react-component-chart.js +22 -0
- package/dist-library/reactive-md-react-component-checkbox.js +10 -0
- package/dist-library/reactive-md-react-component-checklist.js +10 -0
- package/dist-library/reactive-md-react-component-choices.js +10 -0
- package/dist-library/reactive-md-react-component-column.js +6 -0
- package/dist-library/reactive-md-react-component-coordinate.js +21 -0
- package/dist-library/reactive-md-react-component-counter.js +10 -0
- package/dist-library/reactive-md-react-component-data-table.js +14 -0
- package/dist-library/reactive-md-react-component-date.js +10 -0
- package/dist-library/reactive-md-react-component-diagram.js +22 -0
- package/dist-library/reactive-md-react-component-disclosure.js +10 -0
- package/dist-library/reactive-md-react-component-edge.js +22 -0
- package/dist-library/reactive-md-react-component-else.js +10 -0
- package/dist-library/reactive-md-react-component-gallery-item.js +10 -0
- package/dist-library/reactive-md-react-component-gallery.js +10 -0
- package/dist-library/reactive-md-react-component-grid.js +10 -0
- package/dist-library/reactive-md-react-component-if.js +10 -0
- package/dist-library/reactive-md-react-component-input.js +10 -0
- package/dist-library/reactive-md-react-component-jump.js +10 -0
- package/dist-library/reactive-md-react-component-multi-select.js +10 -0
- package/dist-library/reactive-md-react-component-node.js +22 -0
- package/dist-library/reactive-md-react-component-number.js +10 -0
- package/dist-library/reactive-md-react-component-option.js +10 -0
- package/dist-library/reactive-md-react-component-panel.js +10 -0
- package/dist-library/reactive-md-react-component-plot.js +26 -0
- package/dist-library/reactive-md-react-component-progress.js +10 -0
- package/dist-library/reactive-md-react-component-quiz.js +10 -0
- package/dist-library/reactive-md-react-component-radio-group.js +10 -0
- package/dist-library/reactive-md-react-component-range-slider.js +10 -0
- package/dist-library/reactive-md-react-component-section.js +10 -0
- package/dist-library/reactive-md-react-component-select.js +10 -0
- package/dist-library/reactive-md-react-component-slider.js +10 -0
- package/dist-library/reactive-md-react-component-step.js +10 -0
- package/dist-library/reactive-md-react-component-steps.js +10 -0
- package/dist-library/reactive-md-react-component-tab.js +10 -0
- package/dist-library/reactive-md-react-component-table.js +14 -0
- package/dist-library/reactive-md-react-component-tabs.js +10 -0
- package/dist-library/reactive-md-react-component-text.js +10 -0
- package/dist-library/reactive-md-react-component-textarea.js +10 -0
- package/dist-library/reactive-md-react-component-timeline.js +14 -0
- package/dist-library/reactive-md-react-component-timer.js +10 -0
- package/dist-library/reactive-md-react-component-toggle.js +10 -0
- package/dist-library/reactive-md-react-component-tooltip.js +10 -0
- package/dist-library/reactive-md-react-component-validation.js +10 -0
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-pack-controls.js +44 -0
- package/dist-library/reactive-md-react-pack-data.js +21 -0
- package/dist-library/reactive-md-react-pack-layout.js +37 -0
- package/dist-library/reactive-md-react-pack-visuals.js +43 -0
- package/dist-library/reactive-md-react-packed.js +50 -0
- package/dist-library/reactive-md-react-server.js +29 -27
- package/dist-library/reactive-md-react-static-server.js +24 -0
- package/dist-library/reactive-md-react-static.js +1 -0
- package/dist-library/reactive-md-react-unstyled.js +15 -12
- package/dist-library/reactive-md-react.js +15 -12
- package/dist-library/reactive-md-scan.js +1 -0
- package/dist-library/reactive-md-sdk.js +23 -9
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +32 -32
- package/dist-library/reactive-md-testing.js +12 -12
- package/dist-library/reactive-md-vite.js +25 -9
- package/dist-library/reactive-md-worker-pool.js +401 -0
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +97 -1554
- package/dist-library/registry-core-DxEaxhJ6.js +126 -0
- package/dist-library/render-nodes-B6j6Ip5I.js +9404 -0
- package/dist-library/requirements-C56sFIEs.js +157 -0
- package/dist-library/resources-6VaNgk-h.js +74 -0
- package/dist-library/rmd-pack-controls.css +1032 -0
- package/dist-library/rmd-pack-data.css +724 -0
- package/dist-library/rmd-pack-layout.css +1834 -0
- package/dist-library/rmd-pack-resource-chart.css +300 -0
- package/dist-library/rmd-pack-resource-controls.css +781 -0
- package/dist-library/rmd-pack-resource-data-visuals.css +501 -0
- package/dist-library/rmd-pack-resource-diagram.css +106 -0
- package/dist-library/rmd-pack-resource-gallery.css +346 -0
- package/dist-library/rmd-pack-resource-graphics.css +516 -0
- package/dist-library/rmd-pack-resource-layout.css +1489 -0
- package/dist-library/rmd-pack-resource-mafs-core.css +124 -0
- package/dist-library/rmd-pack-resource-mafs.css +129 -0
- package/dist-library/rmd-pack-resource-visual-base.css +224 -0
- package/dist-library/rmd-pack-visuals.css +1394 -0
- package/dist-library/runtime-BHeuLOv_.js +1369 -0
- package/dist-library/runtime-requirement-DzPO8raU.js +772 -0
- package/dist-library/schema-core-CDXfxdID.js +155 -0
- package/dist-library/sdk-core-CnE-n0Z7.js +1295 -0
- package/dist-library/{session-core-dxQCJBNa.js → session-core-C071yQwV.js} +147 -133
- package/dist-library/sha256-utf16-Bmandi_H.js +937 -0
- package/dist-library/shareable-CHCDnl6j.js +844 -0
- package/dist-library/shared-bTzN-F4g.js +3 -0
- package/dist-library/structural-views-30-YD_TJ.js +11 -0
- package/dist-library/table-surface-CfZn_tk-.js +13 -0
- package/dist-library/types/assemblies/compile-cache-key.d.ts +11 -0
- package/dist-library/types/assemblies/default-config.d.ts +35 -0
- package/dist-library/types/{local/configuration/options.d.ts → assemblies/default-options.d.ts} +4 -4
- package/dist-library/types/assemblies/default-registry.d.ts +18 -0
- package/dist-library/types/{local/configuration/schema.d.ts → assemblies/default-schema.d.ts} +4 -4
- package/dist-library/types/authoring/catalog.d.ts +14 -2
- package/dist-library/types/authoring/extensions.d.ts +1 -1
- package/dist-library/types/authoring/index.d.ts +4 -4
- package/dist-library/types/authoring/templates.d.ts +1 -1
- package/dist-library/types/compiler/index.d.ts +1 -0
- package/dist-library/types/compiler/session.d.ts +19 -0
- package/dist-library/types/compiler/standard.d.ts +1 -0
- package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
- package/dist-library/types/components/chart/default-chart.d.ts +7 -0
- package/dist-library/types/components/entries/accordion.d.ts +3 -0
- package/dist-library/types/components/entries/alert.d.ts +3 -0
- package/dist-library/types/components/entries/anchor.d.ts +3 -0
- package/dist-library/types/components/entries/badge.d.ts +3 -0
- package/dist-library/types/components/entries/card.d.ts +3 -0
- package/dist-library/types/components/entries/chart.d.ts +3 -0
- package/dist-library/types/components/entries/checkbox.d.ts +3 -0
- package/dist-library/types/components/entries/checklist.d.ts +3 -0
- package/dist-library/types/components/entries/choices.d.ts +3 -0
- package/dist-library/types/components/entries/column.d.ts +3 -0
- package/dist-library/types/components/entries/coordinate.d.ts +3 -0
- package/dist-library/types/components/entries/counter.d.ts +3 -0
- package/dist-library/types/components/entries/data-table.d.ts +3 -0
- package/dist-library/types/components/entries/date.d.ts +3 -0
- package/dist-library/types/components/entries/diagram.d.ts +3 -0
- package/dist-library/types/components/entries/disclosure.d.ts +3 -0
- package/dist-library/types/components/entries/edge.d.ts +3 -0
- package/dist-library/types/components/entries/else.d.ts +3 -0
- package/dist-library/types/components/entries/gallery-item.d.ts +3 -0
- package/dist-library/types/components/entries/gallery.d.ts +3 -0
- package/dist-library/types/components/entries/grid.d.ts +3 -0
- package/dist-library/types/components/entries/if.d.ts +3 -0
- package/dist-library/types/components/entries/input.d.ts +3 -0
- package/dist-library/types/components/entries/jump.d.ts +3 -0
- package/dist-library/types/components/entries/multi-select.d.ts +3 -0
- package/dist-library/types/components/entries/node.d.ts +3 -0
- package/dist-library/types/components/entries/number.d.ts +3 -0
- package/dist-library/types/components/entries/option.d.ts +3 -0
- package/dist-library/types/components/entries/panel.d.ts +3 -0
- package/dist-library/types/components/entries/plot.d.ts +3 -0
- package/dist-library/types/components/entries/progress.d.ts +3 -0
- package/dist-library/types/components/entries/quiz.d.ts +3 -0
- package/dist-library/types/components/entries/radio-group.d.ts +3 -0
- package/dist-library/types/components/entries/range-slider.d.ts +3 -0
- package/dist-library/types/components/entries/section.d.ts +3 -0
- package/dist-library/types/components/entries/select.d.ts +3 -0
- package/dist-library/types/components/entries/slider.d.ts +3 -0
- package/dist-library/types/components/entries/step.d.ts +3 -0
- package/dist-library/types/components/entries/steps.d.ts +3 -0
- package/dist-library/types/components/entries/tab.d.ts +3 -0
- package/dist-library/types/components/entries/table.d.ts +3 -0
- package/dist-library/types/components/entries/tabs.d.ts +3 -0
- package/dist-library/types/components/entries/text.d.ts +3 -0
- package/dist-library/types/components/entries/textarea.d.ts +3 -0
- package/dist-library/types/components/entries/timeline.d.ts +3 -0
- package/dist-library/types/components/entries/timer.d.ts +3 -0
- package/dist-library/types/components/entries/toggle.d.ts +3 -0
- package/dist-library/types/components/entries/tooltip.d.ts +3 -0
- package/dist-library/types/components/entries/validation.d.ts +3 -0
- package/dist-library/types/components/layout/layout.d.ts +6 -3
- package/dist-library/types/components/layout/structural-views.d.ts +3 -0
- package/dist-library/types/components/mount-preset.d.ts +2 -0
- package/dist-library/types/components/packs/controls.d.ts +2 -0
- package/dist-library/types/components/packs/data.d.ts +2 -0
- package/dist-library/types/components/packs/layout.d.ts +2 -0
- package/dist-library/types/components/packs/visuals.d.ts +2 -0
- package/dist-library/types/components/shared/data-visuals.d.ts +3 -0
- package/dist-library/types/components/shared/table-surface.d.ts +10 -0
- package/dist-library/types/components/shared/visual-helpers.d.ts +24 -0
- package/dist-library/types/components/shared/visuals.d.ts +1 -3
- package/dist-library/types/components/table/data-table-model.d.ts +141 -0
- package/dist-library/types/components/table/data-table.d.ts +3 -50
- package/dist-library/types/{local/configuration → contracts}/component-kernel.d.ts +9 -2
- package/dist-library/types/contracts/font-aliases.d.ts +18 -0
- package/dist-library/types/contracts/index.d.ts +8 -0
- package/dist-library/types/{local/configuration → contracts}/limits.d.ts +9 -1
- package/dist-library/types/contracts/localization.d.ts +6 -0
- package/dist-library/types/contracts/number-literal.d.ts +2 -0
- package/dist-library/types/contracts/runtime-types.d.ts +19 -0
- package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
- package/dist-library/types/export/index.d.ts +4 -1
- package/dist-library/types/local/compilation/cache-version.d.ts +1 -0
- package/dist-library/types/local/compilation/compile-status.d.ts +2 -0
- package/dist-library/types/local/compilation/compiler-bindings.d.ts +1 -1
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +4 -1
- package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +1 -1
- package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
- package/dist-library/types/local/compilation/compiler-embedding.d.ts +20 -0
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +17 -5
- package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +9 -3
- package/dist-library/types/local/compilation/compiler-tables.d.ts +4 -2
- package/dist-library/types/local/compilation/compiler-validation.d.ts +14 -7
- package/dist-library/types/local/compilation/compiler-values.d.ts +2 -3
- package/dist-library/types/local/compilation/compiler.d.ts +1 -1
- package/dist-library/types/local/compilation/component-usage.d.ts +2 -0
- package/dist-library/types/local/compilation/runtime-requirement.d.ts +3 -0
- package/dist-library/types/local/compilation/session/incremental.d.ts +5 -1
- package/dist-library/types/local/compilation/streaming.d.ts +1 -1
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +228 -2
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
- package/dist-library/types/local/configuration/embedding.d.ts +4 -0
- package/dist-library/types/local/configuration/kernel-value-rules.d.ts +1 -1
- package/dist-library/types/local/configuration/options-core.d.ts +8 -2
- package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
- package/dist-library/types/local/evaluation/computations.d.ts +13 -5
- package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
- package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
- package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
- package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
- package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
- package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
- package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
- package/dist-library/types/local/evaluation/validation.d.ts +8 -6
- package/dist-library/types/local/index.d.ts +10 -4
- package/dist-library/types/local/observability-core.d.ts +20 -1
- package/dist-library/types/local/observability.d.ts +2 -0
- package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
- package/dist-library/types/local/parsing/parse-budget.d.ts +18 -2
- package/dist-library/types/local/parsing/parser-region.d.ts +13 -2
- package/dist-library/types/local/parsing/parser-tags.d.ts +6 -1
- package/dist-library/types/local/parsing/rmd-recovery.d.ts +8 -0
- package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
- package/dist-library/types/local/performance-report.d.ts +70 -0
- package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
- package/dist-library/types/local/runtime/runtime-pool.d.ts +14 -0
- package/dist-library/types/local/runtime/runtime.d.ts +3 -1
- package/dist-library/types/local/runtime/state.d.ts +30 -15
- package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
- package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
- package/dist-library/types/local/source/authoring.d.ts +10 -0
- package/dist-library/types/local/source/source-migration.d.ts +1 -0
- package/dist-library/types/local/transport/worker-handler.d.ts +3 -0
- package/dist-library/types/local/transport/worker-job.d.ts +12 -2
- package/dist-library/types/local/transport/worker-pool.d.ts +68 -0
- package/dist-library/types/local/transport/worker.d.ts +14 -0
- package/dist-library/types/local/types.d.ts +70 -27
- package/dist-library/types/observability.d.ts +1 -0
- package/dist-library/types/presets/default-semantics.d.ts +1 -1
- package/dist-library/types/presets/identity.d.ts +1 -8
- package/dist-library/types/presets/pack-style-entry.d.ts +3 -0
- package/dist-library/types/presets/pack-style-manifest.d.ts +11 -0
- package/dist-library/types/react/component-api.d.ts +24 -4
- package/dist-library/types/react/component-loader.d.ts +61 -0
- package/dist-library/types/react/component-primitives.d.ts +5 -5
- package/dist-library/types/react/component-utils.d.ts +11 -0
- package/dist-library/types/react/font-aliases.d.ts +2 -0
- package/dist-library/types/react/index.d.ts +9 -5
- package/dist-library/types/react/localization.d.ts +5 -6
- package/dist-library/types/react/minimal.d.ts +2 -2
- package/dist-library/types/react/package-core.d.ts +6 -0
- package/dist-library/types/react/packed.d.ts +17 -0
- package/dist-library/types/react/render-lifecycle.d.ts +9 -0
- package/dist-library/types/{local → react}/rendering/document/ExtendedHtmlFragment.d.ts +1 -1
- package/dist-library/types/{local → react}/rendering/document/LocalDocumentViewCore.d.ts +11 -4
- package/dist-library/types/react/rendering/document/LocalPooledDocumentView.d.ts +8 -0
- package/dist-library/types/react/rendering/document/LocalReactiveDocumentCore.d.ts +6 -0
- package/dist-library/types/react/rendering/document/LocalStaticDocumentView.d.ts +18 -0
- package/dist-library/types/react/rendering/document/StaticExternalSlot.d.ts +25 -0
- package/dist-library/types/react/rendering/document/StaticHostData.d.ts +14 -0
- package/dist-library/types/{local → react}/rendering/document/render-nodes.d.ts +8 -8
- package/dist-library/types/react/rendering/document/static-runtime.d.ts +11 -0
- package/dist-library/types/{local → react}/rendering/document/use-author-script.d.ts +2 -2
- package/dist-library/types/{local → react}/rendering/document/validation-state.d.ts +3 -3
- package/dist-library/types/{local → react}/rendering/document/view-render-context.d.ts +40 -8
- package/dist-library/types/{local → react}/rendering/document/view-revision.d.ts +5 -14
- package/dist-library/types/{local → react}/rendering/render-types.d.ts +5 -5
- package/dist-library/types/react/rendering/table/data-table.d.ts +5 -0
- package/dist-library/types/{local → react}/rendering/table/table-numeric-columns.d.ts +3 -3
- package/dist-library/types/react/sdk-core.d.ts +15 -4
- package/dist-library/types/react/sdk.d.ts +2 -1
- package/dist-library/types/react/server.d.ts +3 -10
- package/dist-library/types/react/static-server.d.ts +12 -0
- package/dist-library/types/scan/index.d.ts +15 -0
- package/dist-library/types/sdk/assembly.d.ts +3 -0
- package/dist-library/types/sdk/config.d.ts +2 -35
- package/dist-library/types/sdk/default-identity.d.ts +3 -0
- package/dist-library/types/sdk/font.d.ts +13 -0
- package/dist-library/types/sdk/index.d.ts +2 -1
- package/dist-library/types/sdk/preset.d.ts +9 -0
- package/dist-library/types/sdk/props.d.ts +8 -3
- package/dist-library/types/sdk/registry-core.d.ts +2 -2
- package/dist-library/types/sdk/registry.d.ts +2 -18
- package/dist-library/types/sdk/theme.d.ts +5 -0
- package/dist-library/types/sdk/types.d.ts +8 -2
- package/dist-library/types/sdk/version.d.ts +2 -0
- package/dist-library/types/shareable.d.ts +15 -3
- package/dist-library/types/standalone/prepare.d.ts +4 -2
- package/dist-library/types/standalone/session-core.d.ts +5 -2
- package/dist-library/types/vite/index.d.ts +3 -0
- package/dist-library/types/vite/registration.d.ts +1 -0
- package/dist-library/{types-Ib5kSScP.js → types-B4qG8J4S.js} +1 -1
- package/dist-library/types-FYhRWRn9.js +3 -0
- package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
- package/dist-library/validation-DRuW0Wl9.js +433 -0
- package/dist-library/{version-DAxuGOG2.js → version-4wzhbvDG.js} +24 -33
- package/dist-library/visual-frame-y5RFhJ0_.js +19 -0
- package/dist-library/visual-helpers-UU6xiL8g.js +75 -0
- package/dist-library/visuals-7xzoL9ql.js +49340 -0
- package/dist-library/visuals-CdHezgh5.js +3 -0
- package/dist-library/worker-3ldRjOEG.js +1632 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +127 -366
- package/docs/README-ch.md +104 -101
- package/docs/README.md +104 -101
- package/docs/compatibility/api-stability-ch.md +1 -1
- package/docs/compatibility/api-stability-en.md +1 -1
- package/docs/compatibility/compatibility-ch.md +146 -146
- package/docs/compatibility/compatibility-en.md +146 -146
- package/docs/compatibility/compatibility-manifest.schema.json +3 -2
- package/docs/compatibility/deprecation-ch.md +2 -2
- package/docs/compatibility/deprecation-en.md +2 -2
- package/docs/compatibility/source-versioning-ch.md +170 -162
- package/docs/compatibility/source-versioning-en.md +171 -162
- package/docs/compatibility/support-matrix-ch.md +4 -3
- package/docs/compatibility/support-matrix-en.md +4 -3
- package/docs/development/component-development-ch.md +66 -66
- package/docs/development/component-development-en.md +66 -66
- package/docs/development/component-development-reference-ch.md +269 -253
- package/docs/development/component-development-reference-en.md +254 -238
- package/docs/development/component-protocol-ch.md +768 -748
- package/docs/development/component-protocol-en.md +770 -750
- package/docs/development/extension-tutorial-ch.md +308 -308
- package/docs/development/extension-tutorial-en.md +308 -308
- package/docs/development/performance-overview-ch.md +422 -422
- package/docs/development/performance-overview-en.md +422 -422
- package/docs/guides/local-guide-ch.md +621 -532
- package/docs/guides/local-guide-en.md +621 -532
- package/docs/integration/author-tools-ch.md +66 -64
- package/docs/integration/author-tools-en.md +66 -64
- package/docs/integration/compiler-ch.md +90 -49
- package/docs/integration/compiler-en.md +77 -36
- package/docs/integration/directory-discovery-en.md +1 -1
- package/docs/integration/editor-ch.md +295 -295
- package/docs/integration/editor-en.md +303 -303
- package/docs/integration/extension-sdk-ch.md +424 -394
- package/docs/integration/extension-sdk-en.md +409 -379
- package/docs/integration/local-integration-ch.md +648 -646
- package/docs/integration/local-integration-en.md +664 -662
- package/docs/integration/pdf-export-ch.md +42 -0
- package/docs/integration/pdf-export-en.md +42 -0
- package/docs/integration/shareable-export-ch.md +299 -307
- package/docs/integration/shareable-export-en.md +301 -309
- package/docs/reference/diagnostics-counting-ch.md +127 -104
- package/docs/reference/diagnostics-counting-en.md +127 -104
- package/docs/reference/html-compatibility-ch.md +93 -93
- package/docs/reference/html-compatibility-en.md +95 -95
- package/docs/reference/local-interaction-syntax-ch.md +913 -724
- package/docs/reference/local-interaction-syntax-en.md +911 -722
- package/docs/reference/public-api-ch.md +134 -21
- package/docs/reference/public-api-en.md +134 -21
- package/docs/reference/theme-protocol-ch.md +198 -198
- package/docs/reference/theme-protocol-en.md +217 -217
- package/docs/releases/release-0.10.0-ch.md +45 -0
- package/docs/releases/release-0.10.0-en.md +45 -0
- package/docs/releases/release-0.4.0-ch.md +91 -91
- package/docs/releases/release-0.4.0-en.md +91 -91
- package/docs/releases/release-0.4.1-ch.md +25 -25
- package/docs/releases/release-0.4.1-en.md +25 -25
- package/docs/releases/release-0.5.0-ch.md +43 -43
- package/docs/releases/release-0.5.0-en.md +43 -43
- package/docs/releases/release-0.5.1-ch.md +41 -41
- package/docs/releases/release-0.5.1-en.md +41 -41
- package/docs/releases/release-0.5.2-ch.md +37 -37
- package/docs/releases/release-0.5.2-en.md +37 -37
- package/docs/releases/release-0.5.3-ch.md +26 -26
- package/docs/releases/release-0.5.3-en.md +26 -26
- package/docs/releases/release-0.6.0-ch.md +59 -59
- package/docs/releases/release-0.6.0-en.md +59 -59
- package/docs/releases/release-0.6.1-ch.md +29 -29
- package/docs/releases/release-0.6.1-en.md +29 -29
- package/docs/releases/release-0.7.0-ch.md +86 -86
- package/docs/releases/release-0.7.0-en.md +86 -86
- package/docs/releases/release-0.9.3-ch.md +45 -0
- package/docs/releases/release-0.9.3-en.md +45 -0
- package/examples/component-package/README-ch.md +101 -101
- package/examples/component-package/README.md +133 -133
- package/examples/conformance/README-ch.md +55 -55
- package/examples/conformance/README.md +55 -55
- package/examples/conformance/component-protocol-1.json +482 -482
- package/examples/conformance/component-protocol-1.schema.json +76 -76
- package/examples/conformance/local-draft-1.json +50 -50
- package/examples/conformance/local-draft-2.json +212 -212
- package/examples/conformance/local-draft-4.json +441 -0
- package/examples/game-2048-package/LICENSE +21 -21
- package/examples/game-2048-package/NOTICES.md +11 -11
- package/examples/game-2048-package/README-ch.md +91 -91
- package/examples/game-2048-package/README.md +98 -98
- package/examples/game-2048-package/package.json +35 -35
- package/examples/game-2048-package/sample/document.reactive.md +17 -17
- package/examples/game-2048-package/scripts/build-export.mjs +44 -44
- package/examples/game-2048-package/scripts/build.mjs +130 -130
- package/examples/game-2048-package/scripts/verify.mjs +180 -180
- package/examples/game-2048-package/src/component.css +161 -161
- package/examples/game-2048-package/src/components.tsx +326 -326
- package/examples/game-2048-package/src/game-engine.ts +228 -228
- package/examples/game-2048-package/src/harness.tsx +34 -34
- package/examples/game-2048-package/src/manifest.ts +85 -85
- package/examples/game-2048-package/src/node-entry.ts +30 -30
- package/examples/game-2048-package/src/sample.ts +4 -4
- package/examples/game-2048-package/tsconfig.json +15 -15
- package/examples/integration/README-ch.md +114 -82
- package/examples/integration/README.md +114 -82
- package/examples/integration/chat-session/index.mjs +91 -0
- package/examples/integration/chat-session/package.json +10 -0
- package/examples/integration/core/index.mjs +32 -32
- package/examples/integration/extension-sdk/README-ch.md +24 -24
- package/examples/integration/extension-sdk/README.md +24 -24
- package/examples/integration/static-embed/embed.mjs +44 -0
- package/examples/integration/static-embed/index.html +12 -0
- package/examples/integration/static-embed/main.mjs +24 -0
- package/examples/integration/static-embed/references.mjs +5 -0
- package/examples/integration/static-embed/render.mjs +10 -0
- package/examples/integration/worker/index.html +19 -19
- package/examples/integration/worker/main.js +61 -61
- package/examples/integration/worker/package.json +13 -13
- package/examples/integration/worker/worker.js +3 -3
- package/examples/local/README-ch.md +76 -76
- package/examples/local/README.md +76 -76
- package/examples/local/charts.reactive.md +73 -73
- package/examples/local/recipes/invoice-zh.reactive.md +36 -36
- package/examples/local/recipes/invoice.reactive.md +36 -36
- package/examples/local/recipes/workshop-zh.reactive.md +33 -33
- package/examples/local/recipes/workshop.reactive.md +33 -33
- package/examples/local/showcase/README-ch.md +22 -22
- package/examples/local/showcase/README.md +31 -31
- package/examples/local/showcase/explore.reactive.md +102 -102
- package/examples/local/showcase/flow.reactive.md +86 -86
- package/examples/local/showcase/forms.reactive.md +126 -126
- package/examples/local/showcase/functions.reactive.md +119 -119
- package/examples/local/showcase/layout.reactive.md +100 -100
- package/examples/local/showcase/statistics.reactive.md +108 -108
- package/examples/local/showcase/tasks.reactive.md +89 -89
- package/examples/local/showcase/zh/explore.reactive.md +102 -102
- package/examples/local/showcase/zh/flow.reactive.md +86 -86
- package/examples/local/showcase/zh/forms.reactive.md +126 -126
- package/examples/local/showcase/zh/functions.reactive.md +119 -119
- package/examples/local/showcase/zh/layout.reactive.md +100 -100
- package/examples/local/showcase/zh/statistics.reactive.md +108 -108
- package/examples/local/showcase/zh/tasks.reactive.md +89 -89
- package/examples/minimal-extension/README-ch.md +78 -78
- package/examples/minimal-extension/README.md +78 -78
- package/examples/minimal-extension/index.html +15 -15
- package/examples/minimal-extension/package.json +26 -26
- package/examples/minimal-extension/sample/document.reactive.md +10 -10
- package/examples/minimal-extension/scripts/build.mjs +32 -32
- package/examples/minimal-extension/scripts/export.mjs +72 -72
- package/examples/minimal-extension/scripts/test-node.mjs +75 -75
- package/examples/minimal-extension/src/extension.tsx +90 -90
- package/examples/minimal-extension/src/preview.tsx +12 -12
- package/examples/minimal-extension/src/source.ts +4 -4
- package/examples/minimal-extension/tsconfig.json +14 -14
- package/examples/sci-fi-theme/README-ch.md +133 -133
- package/examples/sci-fi-theme/README.md +148 -148
- package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
- package/examples/sci-fi-theme/demo/demo.css +638 -638
- package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
- package/examples/sci-fi-theme/demo/index.html +13 -13
- package/examples/sci-fi-theme/demo/main.tsx +215 -215
- package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
- package/examples/sci-fi-theme/docs/design-system.md +474 -474
- package/examples/sci-fi-theme/package.json +28 -28
- package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
- package/examples/sci-fi-theme/src/components.css +2370 -2370
- package/examples/sci-fi-theme/src/index.ts +6 -6
- package/examples/sci-fi-theme/src/notch.css +142 -142
- package/examples/sci-fi-theme/src/sci-fi.css +7 -7
- package/examples/sci-fi-theme/src/theme.ts +39 -39
- package/examples/sci-fi-theme/tsconfig.json +20 -20
- package/examples/sci-fi-theme/vite.config.ts +24 -24
- package/examples/tetris-package/LICENSE +21 -21
- package/examples/tetris-package/NOTICES.md +11 -11
- package/examples/tetris-package/README-ch.md +91 -91
- package/examples/tetris-package/README.md +95 -95
- package/examples/tetris-package/package.json +35 -35
- package/examples/tetris-package/sample/document.reactive.md +16 -16
- package/examples/tetris-package/scripts/build-export.mjs +44 -44
- package/examples/tetris-package/scripts/build.mjs +130 -130
- package/examples/tetris-package/scripts/verify.mjs +173 -173
- package/examples/tetris-package/src/component.css +145 -145
- package/examples/tetris-package/src/components.tsx +334 -334
- package/examples/tetris-package/src/harness.tsx +34 -34
- package/examples/tetris-package/src/manifests.ts +93 -93
- package/examples/tetris-package/src/node-entry.ts +16 -16
- package/examples/tetris-package/src/sample.ts +4 -4
- package/examples/tetris-package/src/tetris-engine.ts +325 -325
- package/examples/tetris-package/tsconfig.json +15 -15
- package/package.json +66 -2
- package/dist-library/LocalDocumentView-BuqgJZEY.js +0 -109
- package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +0 -275
- package/dist-library/authoring-Ci_KzJ0q.js +0 -892
- package/dist-library/compile-Dx6Uw3D9.js +0 -1249
- package/dist-library/compiler-dxLPB9Ym.js +0 -86
- package/dist-library/config-validation-D3D7Dy2J.js +0 -586
- package/dist-library/controls-DoZyLCrV.js +0 -6740
- package/dist-library/data-table-8-3F15Jf.js +0 -296
- package/dist-library/layout-BBB2VF0S.js +0 -562
- package/dist-library/mount-preset-DMZ5wd3t.js +0 -13
- package/dist-library/options-BBp9IcHm.js +0 -121
- package/dist-library/package-core-K5xesGqy.js +0 -117
- package/dist-library/parser-standard-CBA1-hdG.js +0 -9630
- package/dist-library/plugin-packs-Bh1HhLym.js +0 -19
- package/dist-library/preset-core-DeZPA8IE.js +0 -1298
- package/dist-library/props-sJ8vk0cr.js +0 -183
- package/dist-library/react-0DCh-Mar.js +0 -7
- package/dist-library/registry-core-C9xOunaw.js +0 -479
- package/dist-library/resources-B0x_w3s9.js +0 -229
- package/dist-library/runtime-BpQdZmFI.js +0 -1288
- package/dist-library/schema-BryM_VRW.js +0 -40
- package/dist-library/sdk-core-ChslheKs.js +0 -1167
- package/dist-library/shareable-B8xMoGEa.js +0 -814
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +0 -6
- package/dist-library/types/local/rendering/table/data-table.d.ts +0 -13
- package/dist-library/types-daDo2c_w.js +0 -3
- package/dist-library/validation-B3RI0xOk.js +0 -1123
- package/dist-library/visual-frame-_rcd5HUv.js +0 -48
- package/dist-library/visuals-DkDhNdEZ.js +0 -72572
- /package/dist-library/types/{local/configuration → contracts}/color-values.d.ts +0 -0
- /package/dist-library/types/{local/html → contracts}/html-names.d.ts +0 -0
- /package/dist-library/types/{local/configuration → contracts}/schema-core.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/code/code-block.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/code/code-languages.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/document/LocalDocumentView.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/document/use-color-scheme.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/image/image-view.d.ts +0 -0
- /package/dist-library/types/{local → react}/rendering/math-view.d.ts +0 -0
|
@@ -1,1249 +0,0 @@
|
|
|
1
|
-
import { A as e, k as t, y as n } from "./version-DAxuGOG2.js";
|
|
2
|
-
import { _ as r, l as i, o as a } from "./document-theme-C8J6UyNO.js";
|
|
3
|
-
// src/local/evaluation/expression/values.ts
|
|
4
|
-
var o = class extends Error {
|
|
5
|
-
offset;
|
|
6
|
-
code;
|
|
7
|
-
constructor(e, t, n = 0) {
|
|
8
|
-
super(t), this.name = "LocalExpressionError", this.code = e, this.offset = n;
|
|
9
|
-
}
|
|
10
|
-
}, s = /* @__PURE__ */ "abs.sqrt.floor.ceil.round.min.max.pow.sin.cos.tan.asin.acos.atan.exp.log.len.contains.clamp.sum.average.minOf.maxOf.formatNumber.formatPercent.formatScientific.formatCurrency.trim.lower.upper.startsWith.endsWith.replace.slice.dateCompare.dateDiff".split("."), c = new Set(s), l = /* @__PURE__ */ new Map([["pi", Math.PI], ["e", Math.E]]), u = /* @__PURE__ */ new Set([
|
|
11
|
-
"__proto__",
|
|
12
|
-
"prototype",
|
|
13
|
-
"constructor"
|
|
14
|
-
]), ee = /* @__PURE__ */ new Set([
|
|
15
|
-
"string",
|
|
16
|
-
"number",
|
|
17
|
-
"boolean",
|
|
18
|
-
"null",
|
|
19
|
-
"array",
|
|
20
|
-
"number-array"
|
|
21
|
-
]), te = /* @__PURE__ */ new Set([
|
|
22
|
-
...s,
|
|
23
|
-
"x",
|
|
24
|
-
"y",
|
|
25
|
-
"pi",
|
|
26
|
-
"e",
|
|
27
|
-
"true",
|
|
28
|
-
"false",
|
|
29
|
-
"null",
|
|
30
|
-
...u
|
|
31
|
-
]), ne = 4e3, d = t;
|
|
32
|
-
function f(r) {
|
|
33
|
-
if (r.length > 1e4) return {
|
|
34
|
-
code: "expression-budget",
|
|
35
|
-
...i("local.budget.value.array", { limit: n }),
|
|
36
|
-
message: `Array exceeds the ${n}-item limit.`
|
|
37
|
-
};
|
|
38
|
-
let a = null, o = 0;
|
|
39
|
-
for (let n of r) if (typeof n == "string") {
|
|
40
|
-
if (a === "number") return {
|
|
41
|
-
code: "expression-value",
|
|
42
|
-
key: "error.array.homogeneous",
|
|
43
|
-
message: "Array elements must all be strings or all be numbers."
|
|
44
|
-
};
|
|
45
|
-
if (a = "string", n.length > 1e5) return {
|
|
46
|
-
code: "expression-budget",
|
|
47
|
-
...i("local.budget.value.array-member", { limit: t }),
|
|
48
|
-
message: `Array member exceeds the ${t}-character limit.`
|
|
49
|
-
};
|
|
50
|
-
if (o += n.length, o > 1e5) return {
|
|
51
|
-
code: "expression-budget",
|
|
52
|
-
...i("local.budget.value.array-contents", { limit: e }),
|
|
53
|
-
message: `Array contents exceed the ${e}-character limit.`
|
|
54
|
-
};
|
|
55
|
-
} else if (typeof n == "number") {
|
|
56
|
-
if (a === "string") return {
|
|
57
|
-
code: "expression-value",
|
|
58
|
-
key: "error.array.homogeneous",
|
|
59
|
-
message: "Array elements must all be strings or all be numbers."
|
|
60
|
-
};
|
|
61
|
-
if (a = "number", !Number.isFinite(n)) return {
|
|
62
|
-
code: "expression-value",
|
|
63
|
-
key: "error.array.finite",
|
|
64
|
-
message: "Array members must be finite numbers."
|
|
65
|
-
};
|
|
66
|
-
} else return {
|
|
67
|
-
code: "expression-value",
|
|
68
|
-
key: "error.array.members",
|
|
69
|
-
message: "Array members must be strings or finite numbers."
|
|
70
|
-
};
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
function p(e) {
|
|
74
|
-
if (typeof e == "string") return e.length > 1e5 ? i("local.budget.value.string", { limit: t }) : null;
|
|
75
|
-
if (Array.isArray(e)) {
|
|
76
|
-
let t = f(e);
|
|
77
|
-
return t ? i(t.key, t.params) : null;
|
|
78
|
-
}
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
function m(e) {
|
|
82
|
-
let t = p(e);
|
|
83
|
-
return t ? a(t) : null;
|
|
84
|
-
}
|
|
85
|
-
// src/local/evaluation/expression/syntax.ts
|
|
86
|
-
var re = /^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/, h = /[A-Za-z_]/, ie = /[A-Za-z0-9_]/;
|
|
87
|
-
function ae(e) {
|
|
88
|
-
let t = [], n = 0;
|
|
89
|
-
for (; n < e.length;) {
|
|
90
|
-
let r = e[n];
|
|
91
|
-
if (/\s/.test(r)) {
|
|
92
|
-
n += 1;
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (r >= "0" && r <= "9" || r === "." && /[0-9]/.test(e[n + 1] ?? "")) {
|
|
96
|
-
let r = re.exec(e.slice(n));
|
|
97
|
-
if (!r) throw new o("expression-syntax", "Invalid number.", n);
|
|
98
|
-
let i = r[0], a = Number(i);
|
|
99
|
-
if (!Number.isFinite(a)) throw new o("expression-number", `Number must be finite: ${i}.`, n);
|
|
100
|
-
t.push({
|
|
101
|
-
kind: "number",
|
|
102
|
-
value: i,
|
|
103
|
-
start: n,
|
|
104
|
-
number: a
|
|
105
|
-
}), n += i.length;
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
if (r === "\"" || r === "'") {
|
|
109
|
-
let i = n, a = r, s = "", c = n + 1, l = !1;
|
|
110
|
-
for (; c < e.length;) {
|
|
111
|
-
let t = e[c];
|
|
112
|
-
if (t === a) {
|
|
113
|
-
l = !0, c += 1;
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
if (t === "\n" || t === "\r") throw new o("expression-string", "String literals cannot span lines.", i);
|
|
117
|
-
if (t === "\\") {
|
|
118
|
-
let t = e[c + 1];
|
|
119
|
-
if (t === void 0) break;
|
|
120
|
-
switch (t) {
|
|
121
|
-
case "\\":
|
|
122
|
-
s += "\\";
|
|
123
|
-
break;
|
|
124
|
-
case "'":
|
|
125
|
-
s += "'";
|
|
126
|
-
break;
|
|
127
|
-
case "\"":
|
|
128
|
-
s += "\"";
|
|
129
|
-
break;
|
|
130
|
-
case "n":
|
|
131
|
-
s += "\n";
|
|
132
|
-
break;
|
|
133
|
-
case "t":
|
|
134
|
-
s += " ";
|
|
135
|
-
break;
|
|
136
|
-
default: throw new o("expression-string", `Unsupported escape \\${t}.`, c);
|
|
137
|
-
}
|
|
138
|
-
c += 2;
|
|
139
|
-
} else s += t, c += 1;
|
|
140
|
-
}
|
|
141
|
-
if (!l) throw new o("expression-string", "Unterminated string literal.", i);
|
|
142
|
-
if (s.length > d) throw new o("expression-budget", "String literal exceeds the length limit.", i);
|
|
143
|
-
t.push({
|
|
144
|
-
kind: "string",
|
|
145
|
-
value: s,
|
|
146
|
-
start: i
|
|
147
|
-
}), n = c;
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
if (h.test(r)) {
|
|
151
|
-
let r = n + 1;
|
|
152
|
-
for (; r < e.length && ie.test(e[r]);) r += 1;
|
|
153
|
-
t.push({
|
|
154
|
-
kind: "ident",
|
|
155
|
-
value: e.slice(n, r),
|
|
156
|
-
start: n
|
|
157
|
-
}), n = r;
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
let i = e.slice(n, n + 2);
|
|
161
|
-
if (e.startsWith("!==", n) || e.startsWith("===", n)) throw new o("expression-syntax", `Unsupported operator ${e.slice(n, n + 3)}.`, n);
|
|
162
|
-
if (i === "==" || i === "!=" || i === "<=" || i === ">=" || i === "&&" || i === "||") t.push({
|
|
163
|
-
kind: "punct",
|
|
164
|
-
value: i,
|
|
165
|
-
start: n
|
|
166
|
-
}), n += 2;
|
|
167
|
-
else if ("+-*/%()!<>?:,[]".includes(r)) t.push({
|
|
168
|
-
kind: "punct",
|
|
169
|
-
value: r,
|
|
170
|
-
start: n
|
|
171
|
-
}), n += 1;
|
|
172
|
-
else throw r === "=" ? new o("expression-assignment", "Assignments are not supported.", n) : r === "." ? new o("expression-property", "Property access is not supported.", n) : r === "&" || r === "|" ? new o("expression-syntax", `Use ${r}${r} for logical operations.`, n) : new o("expression-syntax", `Unrecognized character "${r}".`, n);
|
|
173
|
-
}
|
|
174
|
-
return t.push({
|
|
175
|
-
kind: "eof",
|
|
176
|
-
value: "",
|
|
177
|
-
start: e.length
|
|
178
|
-
}), t;
|
|
179
|
-
}
|
|
180
|
-
var oe = {
|
|
181
|
-
abs: [1, 1],
|
|
182
|
-
sqrt: [1, 1],
|
|
183
|
-
floor: [1, 1],
|
|
184
|
-
ceil: [1, 1],
|
|
185
|
-
round: [1, 1],
|
|
186
|
-
min: [1, 2 ** 53 - 1],
|
|
187
|
-
max: [1, 2 ** 53 - 1],
|
|
188
|
-
pow: [2, 2],
|
|
189
|
-
sin: [1, 1],
|
|
190
|
-
cos: [1, 1],
|
|
191
|
-
tan: [1, 1],
|
|
192
|
-
asin: [1, 1],
|
|
193
|
-
acos: [1, 1],
|
|
194
|
-
atan: [1, 1],
|
|
195
|
-
exp: [1, 1],
|
|
196
|
-
log: [1, 1],
|
|
197
|
-
len: [1, 1],
|
|
198
|
-
contains: [2, 2],
|
|
199
|
-
clamp: [3, 3],
|
|
200
|
-
sum: [1, 1],
|
|
201
|
-
average: [1, 1],
|
|
202
|
-
minOf: [1, 1],
|
|
203
|
-
maxOf: [1, 1],
|
|
204
|
-
formatNumber: [1, 4],
|
|
205
|
-
formatPercent: [1, 3],
|
|
206
|
-
formatScientific: [1, 3],
|
|
207
|
-
formatCurrency: [1, 4],
|
|
208
|
-
trim: [1, 1],
|
|
209
|
-
lower: [1, 1],
|
|
210
|
-
upper: [1, 1],
|
|
211
|
-
startsWith: [2, 2],
|
|
212
|
-
endsWith: [2, 2],
|
|
213
|
-
replace: [3, 3],
|
|
214
|
-
slice: [2, 3],
|
|
215
|
-
dateCompare: [2, 2],
|
|
216
|
-
dateDiff: [2, 3]
|
|
217
|
-
};
|
|
218
|
-
function se(e) {
|
|
219
|
-
let t = 0, n = [{
|
|
220
|
-
node: e,
|
|
221
|
-
depth: 1
|
|
222
|
-
}];
|
|
223
|
-
for (; n.length > 0;) {
|
|
224
|
-
let { node: e, depth: r } = n.pop();
|
|
225
|
-
switch (r > t && (t = r), e.kind) {
|
|
226
|
-
case "unary":
|
|
227
|
-
n.push({
|
|
228
|
-
node: e.operand,
|
|
229
|
-
depth: r + 1
|
|
230
|
-
});
|
|
231
|
-
break;
|
|
232
|
-
case "binary":
|
|
233
|
-
n.push({
|
|
234
|
-
node: e.left,
|
|
235
|
-
depth: r + 1
|
|
236
|
-
}), n.push({
|
|
237
|
-
node: e.right,
|
|
238
|
-
depth: r + 1
|
|
239
|
-
});
|
|
240
|
-
break;
|
|
241
|
-
case "conditional":
|
|
242
|
-
n.push({
|
|
243
|
-
node: e.test,
|
|
244
|
-
depth: r + 1
|
|
245
|
-
}), n.push({
|
|
246
|
-
node: e.consequent,
|
|
247
|
-
depth: r + 1
|
|
248
|
-
}), n.push({
|
|
249
|
-
node: e.alternate,
|
|
250
|
-
depth: r + 1
|
|
251
|
-
});
|
|
252
|
-
break;
|
|
253
|
-
case "call":
|
|
254
|
-
for (let t of e.args) n.push({
|
|
255
|
-
node: t,
|
|
256
|
-
depth: r + 1
|
|
257
|
-
});
|
|
258
|
-
break;
|
|
259
|
-
case "array":
|
|
260
|
-
for (let t of e.elements) n.push({
|
|
261
|
-
node: t,
|
|
262
|
-
depth: r + 1
|
|
263
|
-
});
|
|
264
|
-
break;
|
|
265
|
-
case "index": n.push({
|
|
266
|
-
node: e.target,
|
|
267
|
-
depth: r + 1
|
|
268
|
-
}), n.push({
|
|
269
|
-
node: e.index,
|
|
270
|
-
depth: r + 1
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
return t;
|
|
275
|
-
}
|
|
276
|
-
var ce = class {
|
|
277
|
-
tokens;
|
|
278
|
-
position = 0;
|
|
279
|
-
nodeCount = 0;
|
|
280
|
-
dependencyNames = [];
|
|
281
|
-
dependencySet = /* @__PURE__ */ new Set();
|
|
282
|
-
dependencyStarts = /* @__PURE__ */ new Map();
|
|
283
|
-
constructor(e) {
|
|
284
|
-
this.tokens = ae(e);
|
|
285
|
-
}
|
|
286
|
-
get dependencies() {
|
|
287
|
-
return this.dependencyNames;
|
|
288
|
-
}
|
|
289
|
-
get dependencyOffsets() {
|
|
290
|
-
return this.dependencyStarts;
|
|
291
|
-
}
|
|
292
|
-
parse() {
|
|
293
|
-
if (this.peek().kind === "eof") throw new o("expression-empty", "Expression is empty.", 0);
|
|
294
|
-
let e = this.parseConditional(0), t = this.peek();
|
|
295
|
-
if (t.kind !== "eof") throw new o("expression-syntax", `Unexpected content "${t.value}".`, t.start);
|
|
296
|
-
if (se(e) > 200) throw new o("expression-budget", "Expression is nested too deeply.", e.start);
|
|
297
|
-
return e;
|
|
298
|
-
}
|
|
299
|
-
peek() {
|
|
300
|
-
return this.tokens[this.position];
|
|
301
|
-
}
|
|
302
|
-
next() {
|
|
303
|
-
let e = this.tokens[this.position];
|
|
304
|
-
return this.position += 1, e;
|
|
305
|
-
}
|
|
306
|
-
isPunct(e) {
|
|
307
|
-
let t = this.peek();
|
|
308
|
-
return t.kind === "punct" && t.value === e;
|
|
309
|
-
}
|
|
310
|
-
expect(e) {
|
|
311
|
-
let t = this.peek();
|
|
312
|
-
if (t.kind !== "punct" || t.value !== e) throw new o("expression-syntax", `Missing "${e}".`, t.start);
|
|
313
|
-
return this.next();
|
|
314
|
-
}
|
|
315
|
-
node(e, t, n) {
|
|
316
|
-
if (this.nodeCount += 1, this.nodeCount > 2e3) throw new o("expression-budget", "Expression is too complex.", n);
|
|
317
|
-
if (t > 100) throw new o("expression-budget", "Expression is nested too deeply.", n);
|
|
318
|
-
return e;
|
|
319
|
-
}
|
|
320
|
-
parseConditional(e) {
|
|
321
|
-
let t = this.parseOr(e);
|
|
322
|
-
if (!this.isPunct("?")) return t;
|
|
323
|
-
let n = t.start;
|
|
324
|
-
this.next();
|
|
325
|
-
let r = this.parseConditional(e + 1);
|
|
326
|
-
this.expect(":");
|
|
327
|
-
let i = this.parseConditional(e + 1);
|
|
328
|
-
return this.node({
|
|
329
|
-
kind: "conditional",
|
|
330
|
-
test: t,
|
|
331
|
-
consequent: r,
|
|
332
|
-
alternate: i,
|
|
333
|
-
start: n
|
|
334
|
-
}, e, n);
|
|
335
|
-
}
|
|
336
|
-
parseOr(e) {
|
|
337
|
-
let t = this.parseAnd(e);
|
|
338
|
-
for (; this.isPunct("||");) {
|
|
339
|
-
let n = t.start;
|
|
340
|
-
this.next();
|
|
341
|
-
let r = this.parseAnd(e);
|
|
342
|
-
t = this.node({
|
|
343
|
-
kind: "binary",
|
|
344
|
-
operator: "||",
|
|
345
|
-
left: t,
|
|
346
|
-
right: r,
|
|
347
|
-
start: n
|
|
348
|
-
}, e, n);
|
|
349
|
-
}
|
|
350
|
-
return t;
|
|
351
|
-
}
|
|
352
|
-
parseAnd(e) {
|
|
353
|
-
let t = this.parseEquality(e);
|
|
354
|
-
for (; this.isPunct("&&");) {
|
|
355
|
-
let n = t.start;
|
|
356
|
-
this.next();
|
|
357
|
-
let r = this.parseEquality(e);
|
|
358
|
-
t = this.node({
|
|
359
|
-
kind: "binary",
|
|
360
|
-
operator: "&&",
|
|
361
|
-
left: t,
|
|
362
|
-
right: r,
|
|
363
|
-
start: n
|
|
364
|
-
}, e, n);
|
|
365
|
-
}
|
|
366
|
-
return t;
|
|
367
|
-
}
|
|
368
|
-
parseEquality(e) {
|
|
369
|
-
let t = this.parseRelational(e);
|
|
370
|
-
for (; this.isPunct("==") || this.isPunct("!=");) {
|
|
371
|
-
let n = t.start, r = this.next().value, i = this.parseRelational(e);
|
|
372
|
-
t = this.node({
|
|
373
|
-
kind: "binary",
|
|
374
|
-
operator: r,
|
|
375
|
-
left: t,
|
|
376
|
-
right: i,
|
|
377
|
-
start: n
|
|
378
|
-
}, e, n);
|
|
379
|
-
}
|
|
380
|
-
return t;
|
|
381
|
-
}
|
|
382
|
-
parseRelational(e) {
|
|
383
|
-
let t = this.parseAdditive(e);
|
|
384
|
-
for (; this.isPunct("<") || this.isPunct("<=") || this.isPunct(">") || this.isPunct(">=");) {
|
|
385
|
-
let n = t.start, r = this.next().value, i = this.parseAdditive(e);
|
|
386
|
-
t = this.node({
|
|
387
|
-
kind: "binary",
|
|
388
|
-
operator: r,
|
|
389
|
-
left: t,
|
|
390
|
-
right: i,
|
|
391
|
-
start: n
|
|
392
|
-
}, e, n);
|
|
393
|
-
}
|
|
394
|
-
return t;
|
|
395
|
-
}
|
|
396
|
-
parseAdditive(e) {
|
|
397
|
-
let t = this.parseMultiplicative(e);
|
|
398
|
-
for (; this.isPunct("+") || this.isPunct("-");) {
|
|
399
|
-
let n = t.start, r = this.next().value, i = this.parseMultiplicative(e);
|
|
400
|
-
t = this.node({
|
|
401
|
-
kind: "binary",
|
|
402
|
-
operator: r,
|
|
403
|
-
left: t,
|
|
404
|
-
right: i,
|
|
405
|
-
start: n
|
|
406
|
-
}, e, n);
|
|
407
|
-
}
|
|
408
|
-
return t;
|
|
409
|
-
}
|
|
410
|
-
parseMultiplicative(e) {
|
|
411
|
-
let t = this.parseUnary(e);
|
|
412
|
-
for (; this.isPunct("*") || this.isPunct("/") || this.isPunct("%");) {
|
|
413
|
-
let n = t.start, r = this.next().value, i = this.parseUnary(e);
|
|
414
|
-
t = this.node({
|
|
415
|
-
kind: "binary",
|
|
416
|
-
operator: r,
|
|
417
|
-
left: t,
|
|
418
|
-
right: i,
|
|
419
|
-
start: n
|
|
420
|
-
}, e, n);
|
|
421
|
-
}
|
|
422
|
-
return t;
|
|
423
|
-
}
|
|
424
|
-
parseUnary(e) {
|
|
425
|
-
let t = this.peek();
|
|
426
|
-
if (t.kind === "punct" && (t.value === "-" || t.value === "+" || t.value === "!")) {
|
|
427
|
-
this.next();
|
|
428
|
-
let n = this.parseUnary(e + 1);
|
|
429
|
-
return this.node({
|
|
430
|
-
kind: "unary",
|
|
431
|
-
operator: t.value,
|
|
432
|
-
operand: n,
|
|
433
|
-
start: t.start
|
|
434
|
-
}, e, t.start);
|
|
435
|
-
}
|
|
436
|
-
return this.parsePrimary(e);
|
|
437
|
-
}
|
|
438
|
-
parsePrimary(e) {
|
|
439
|
-
let t = this.parseAtom(e);
|
|
440
|
-
for (; this.isPunct("[");) {
|
|
441
|
-
let n = t.start;
|
|
442
|
-
this.next();
|
|
443
|
-
let r = this.parseConditional(e + 1);
|
|
444
|
-
this.expect("]"), t = this.node({
|
|
445
|
-
kind: "index",
|
|
446
|
-
target: t,
|
|
447
|
-
index: r,
|
|
448
|
-
start: n
|
|
449
|
-
}, e, n);
|
|
450
|
-
}
|
|
451
|
-
return t;
|
|
452
|
-
}
|
|
453
|
-
parseAtom(e) {
|
|
454
|
-
let t = this.peek();
|
|
455
|
-
if (t.kind === "number") return this.next(), this.node({
|
|
456
|
-
kind: "literal",
|
|
457
|
-
value: t.number,
|
|
458
|
-
start: t.start
|
|
459
|
-
}, e, t.start);
|
|
460
|
-
if (t.kind === "string") return this.next(), this.node({
|
|
461
|
-
kind: "literal",
|
|
462
|
-
value: t.value,
|
|
463
|
-
start: t.start
|
|
464
|
-
}, e, t.start);
|
|
465
|
-
if (t.kind === "ident") {
|
|
466
|
-
this.next();
|
|
467
|
-
let n = t.value;
|
|
468
|
-
if (this.isPunct("(")) {
|
|
469
|
-
if (!c.has(n)) throw new o("expression-unknown-function", `Unknown function "${n}".`, t.start);
|
|
470
|
-
this.next();
|
|
471
|
-
let r = [];
|
|
472
|
-
if (!this.isPunct(")")) for (r.push(this.parseConditional(e + 1)); this.isPunct(",");) this.next(), r.push(this.parseConditional(e + 1));
|
|
473
|
-
this.expect(")");
|
|
474
|
-
let [i, a] = oe[n];
|
|
475
|
-
if (r.length < i || r.length > a) throw new o("expression-arity", `Function ${n} expects ${i === a ? `${i} ${i === 1 ? "argument" : "arguments"}` : i === 1 ? "at least one argument" : `${i}–${a} arguments`}.`, t.start);
|
|
476
|
-
return this.node({
|
|
477
|
-
kind: "call",
|
|
478
|
-
name: n,
|
|
479
|
-
args: r,
|
|
480
|
-
start: t.start
|
|
481
|
-
}, e, t.start);
|
|
482
|
-
}
|
|
483
|
-
if (n === "true" || n === "false") return this.node({
|
|
484
|
-
kind: "literal",
|
|
485
|
-
value: n === "true",
|
|
486
|
-
start: t.start
|
|
487
|
-
}, e, t.start);
|
|
488
|
-
if (n === "null") return this.node({
|
|
489
|
-
kind: "literal",
|
|
490
|
-
value: null,
|
|
491
|
-
start: t.start
|
|
492
|
-
}, e, t.start);
|
|
493
|
-
let r = l.get(n);
|
|
494
|
-
if (r !== void 0) return this.node({
|
|
495
|
-
kind: "literal",
|
|
496
|
-
value: r,
|
|
497
|
-
start: t.start
|
|
498
|
-
}, e, t.start);
|
|
499
|
-
if (u.has(n)) throw new o("expression-forbidden-name", `Name "${n}" is not allowed.`, t.start);
|
|
500
|
-
if (c.has(n)) throw new o("expression-syntax", `Function ${n} must be called with parentheses.`, t.start);
|
|
501
|
-
return this.dependencySet.has(n) || (this.dependencySet.add(n), this.dependencyNames.push(n), this.dependencyStarts.set(n, t.start)), this.node({
|
|
502
|
-
kind: "reference",
|
|
503
|
-
name: n,
|
|
504
|
-
start: t.start
|
|
505
|
-
}, e, t.start);
|
|
506
|
-
}
|
|
507
|
-
if (t.kind === "punct" && t.value === "(") {
|
|
508
|
-
this.next();
|
|
509
|
-
let t = this.parseConditional(e + 1);
|
|
510
|
-
return this.expect(")"), t;
|
|
511
|
-
}
|
|
512
|
-
if (t.kind === "punct" && t.value === "[") {
|
|
513
|
-
this.next();
|
|
514
|
-
let n = [];
|
|
515
|
-
if (!this.isPunct("]")) for (n.push(this.parseConditional(e + 1)); this.isPunct(",");) this.next(), n.push(this.parseConditional(e + 1));
|
|
516
|
-
return this.expect("]"), this.node({
|
|
517
|
-
kind: "array",
|
|
518
|
-
elements: n,
|
|
519
|
-
start: t.start
|
|
520
|
-
}, e, t.start);
|
|
521
|
-
}
|
|
522
|
-
throw new o("expression-syntax", "Expected an expression.", t.start);
|
|
523
|
-
}
|
|
524
|
-
}, g = class extends Error {
|
|
525
|
-
code;
|
|
526
|
-
constructor(e, t) {
|
|
527
|
-
super(t), this.name = "LocalFunctionError", this.code = e;
|
|
528
|
-
}
|
|
529
|
-
}, _ = [
|
|
530
|
-
"en-US",
|
|
531
|
-
"zh-CN",
|
|
532
|
-
"de-DE",
|
|
533
|
-
"fr-FR",
|
|
534
|
-
"ja-JP"
|
|
535
|
-
], le = new Set(_), ue = /^[A-Z]{3}$/, v = 20, de = { signDisplay: "negative" };
|
|
536
|
-
function y(e) {
|
|
537
|
-
throw new g("expression-domain", e);
|
|
538
|
-
}
|
|
539
|
-
function b(e, n) {
|
|
540
|
-
if (e.length > 1e5) throw new g("expression-budget", `${n} exceeds the ${t}-character limit.`);
|
|
541
|
-
return e;
|
|
542
|
-
}
|
|
543
|
-
function x(e) {
|
|
544
|
-
return le.has(e) || y(`Unsupported locale "${e}"; expected one of ${_.join(", ")}.`), e;
|
|
545
|
-
}
|
|
546
|
-
function S(e, t) {
|
|
547
|
-
return (!Number.isInteger(e) || e < 0 || e > v) && y(`${t} digits must be an integer from 0 to ${v}.`), e;
|
|
548
|
-
}
|
|
549
|
-
function C(e) {
|
|
550
|
-
if (!Number.isFinite(e)) throw new g("expression-number", "Value must be a finite number.");
|
|
551
|
-
return e;
|
|
552
|
-
}
|
|
553
|
-
function w(e, t, n, r, i) {
|
|
554
|
-
let a;
|
|
555
|
-
try {
|
|
556
|
-
a = new Intl.NumberFormat(e, {
|
|
557
|
-
...t,
|
|
558
|
-
...de
|
|
559
|
-
});
|
|
560
|
-
} catch {
|
|
561
|
-
a = void 0;
|
|
562
|
-
}
|
|
563
|
-
return a === void 0 && y(i), b(a.format(n), r);
|
|
564
|
-
}
|
|
565
|
-
function fe(e, t = 2, n = "en-US", r = !0) {
|
|
566
|
-
let i = x(n), a = S(t, "formatNumber");
|
|
567
|
-
return typeof r != "boolean" && y("formatNumber grouping must be a boolean."), e === null ? "" : w(i, {
|
|
568
|
-
useGrouping: r,
|
|
569
|
-
minimumFractionDigits: a,
|
|
570
|
-
maximumFractionDigits: a,
|
|
571
|
-
roundingMode: "halfExpand"
|
|
572
|
-
}, C(e), "Formatted number", `Cannot format a number for locale "${i}".`);
|
|
573
|
-
}
|
|
574
|
-
function pe(e, t = 0, n = "en-US") {
|
|
575
|
-
let r = x(n), i = S(t, "formatPercent");
|
|
576
|
-
return e === null ? "" : w(r, {
|
|
577
|
-
style: "percent",
|
|
578
|
-
minimumFractionDigits: i,
|
|
579
|
-
maximumFractionDigits: i,
|
|
580
|
-
roundingMode: "halfExpand"
|
|
581
|
-
}, C(e), "Formatted percentage", `Cannot format a percentage for locale "${r}".`);
|
|
582
|
-
}
|
|
583
|
-
function me(e, t = 2, n = "en-US") {
|
|
584
|
-
let r = x(n), i = S(t, "formatScientific");
|
|
585
|
-
return e === null ? "" : w(r, {
|
|
586
|
-
notation: "scientific",
|
|
587
|
-
minimumFractionDigits: i,
|
|
588
|
-
maximumFractionDigits: i,
|
|
589
|
-
roundingMode: "halfExpand"
|
|
590
|
-
}, C(e), "Formatted number", `Cannot format a number for locale "${r}".`);
|
|
591
|
-
}
|
|
592
|
-
function he(e, t = "USD", n = 2, r = "en-US") {
|
|
593
|
-
let i = x(r);
|
|
594
|
-
ue.test(t) || y(`Currency "${t}" must be a three-letter uppercase code such as "USD".`);
|
|
595
|
-
let a = S(n, "formatCurrency");
|
|
596
|
-
return e === null ? "" : w(i, {
|
|
597
|
-
style: "currency",
|
|
598
|
-
currency: t,
|
|
599
|
-
minimumFractionDigits: a,
|
|
600
|
-
maximumFractionDigits: a,
|
|
601
|
-
roundingMode: "halfExpand"
|
|
602
|
-
}, C(e), "Formatted currency", `Currency code "${t}" is not accepted by Intl.`);
|
|
603
|
-
}
|
|
604
|
-
// src/local/evaluation/expression/inference.ts
|
|
605
|
-
function T(e) {
|
|
606
|
-
switch (e) {
|
|
607
|
-
case "string": return "string";
|
|
608
|
-
case "number": return "number";
|
|
609
|
-
case "boolean": return "boolean";
|
|
610
|
-
case "null": return "null";
|
|
611
|
-
case "array": return "array";
|
|
612
|
-
case "number-array": return "number array";
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
function E(e) {
|
|
616
|
-
return e === null ? "null" : Array.isArray(e) ? "array" : typeof e == "boolean" ? "boolean" : typeof e == "number" ? "number" : "string";
|
|
617
|
-
}
|
|
618
|
-
function D(e, t) {
|
|
619
|
-
throw new o("expression-type", e, t);
|
|
620
|
-
}
|
|
621
|
-
function O(e, t, n, r) {
|
|
622
|
-
e !== t && D(`${r}, got ${T(e)}.`, n);
|
|
623
|
-
}
|
|
624
|
-
function ge(e, t) {
|
|
625
|
-
return e === t ? e : e === "null" ? t : t === "null" ? e : null;
|
|
626
|
-
}
|
|
627
|
-
function k(e, t) {
|
|
628
|
-
switch (e.kind) {
|
|
629
|
-
case "literal": return E(e.value);
|
|
630
|
-
case "reference": {
|
|
631
|
-
if (typeof t != "object" || !t || !Object.prototype.hasOwnProperty.call(t, e.name)) throw new o("expression-unknown-name", `Variable "${e.name}" is not declared.`, e.start);
|
|
632
|
-
let n = t[e.name];
|
|
633
|
-
if (typeof n != "string" || !ee.has(n)) throw new o("expression-value", `Variable "${e.name}" has an invalid type.`, e.start);
|
|
634
|
-
return n;
|
|
635
|
-
}
|
|
636
|
-
case "unary": {
|
|
637
|
-
let n = k(e.operand, t);
|
|
638
|
-
return e.operator === "!" ? (O(n, "boolean", e.start, "Logical not requires a boolean"), "boolean") : (O(n, "number", e.start, `Unary ${e.operator} requires a number`), "number");
|
|
639
|
-
}
|
|
640
|
-
case "binary": {
|
|
641
|
-
let n = k(e.left, t), r = k(e.right, t);
|
|
642
|
-
switch (e.operator) {
|
|
643
|
-
case "+": return n === "number" && r === "number" ? "number" : n === "string" && r === "string" ? "string" : D(`Operator "+" requires two numbers or two strings, got ${T(n)} and ${T(r)}.`, e.start);
|
|
644
|
-
case "-":
|
|
645
|
-
case "*":
|
|
646
|
-
case "/":
|
|
647
|
-
case "%": return O(n, "number", e.start, `Operator "${e.operator}" requires a number`), O(r, "number", e.start, `Operator "${e.operator}" requires a number`), "number";
|
|
648
|
-
case "<":
|
|
649
|
-
case "<=":
|
|
650
|
-
case ">":
|
|
651
|
-
case ">=": return n === "number" && r === "number" || n === "string" && r === "string" ? "boolean" : D(`Comparison operator "${e.operator}" requires two numbers or two strings, got ${T(n)} and ${T(r)}.`, e.start);
|
|
652
|
-
case "==":
|
|
653
|
-
case "!=": return n !== r && n !== "null" && r !== "null" ? D(`Equality comparison requires matching types, got ${T(n)} and ${T(r)}.`, e.start) : "boolean";
|
|
654
|
-
case "&&":
|
|
655
|
-
case "||": return O(n, "boolean", e.start, "Logical operators require booleans"), O(r, "boolean", e.start, "Logical operators require booleans"), "boolean";
|
|
656
|
-
}
|
|
657
|
-
break;
|
|
658
|
-
}
|
|
659
|
-
case "array": {
|
|
660
|
-
if (e.elements.length === 0) return "number-array";
|
|
661
|
-
let n = null;
|
|
662
|
-
for (let r of e.elements) {
|
|
663
|
-
let e = k(r, t);
|
|
664
|
-
if (e !== "string" && e !== "number") return D(`Array literals require string or number elements, got ${T(e)}.`, r.start);
|
|
665
|
-
if (n === null) n = e;
|
|
666
|
-
else if (n !== e) return D(`Array literals require elements of one type, got ${T(n)} and ${T(e)}.`, r.start);
|
|
667
|
-
}
|
|
668
|
-
return n === "string" ? "array" : "number-array";
|
|
669
|
-
}
|
|
670
|
-
case "index": {
|
|
671
|
-
let n = k(e.target, t);
|
|
672
|
-
return O(k(e.index, t), "number", e.start, "Array index must be a number"), n === "array" ? "string" : n === "number-array" ? "number" : D(`Index access requires an array, got ${T(n)}.`, e.start);
|
|
673
|
-
}
|
|
674
|
-
case "conditional": {
|
|
675
|
-
O(k(e.test, t), "boolean", e.start, "Conditional test must be a boolean");
|
|
676
|
-
let n = k(e.consequent, t), r = k(e.alternate, t);
|
|
677
|
-
if (n === "array" && e.alternate.kind === "array" && e.alternate.elements.length === 0 || r === "array" && e.consequent.kind === "array" && e.consequent.elements.length === 0) return "array";
|
|
678
|
-
let i = ge(n, r);
|
|
679
|
-
return i === null ? D(`Conditional branches must have matching types or one null, got ${T(n)} and ${T(r)}.`, e.start) : i;
|
|
680
|
-
}
|
|
681
|
-
case "call": {
|
|
682
|
-
let n = e.args.map((e) => k(e, t));
|
|
683
|
-
switch (e.name) {
|
|
684
|
-
case "abs":
|
|
685
|
-
case "sqrt":
|
|
686
|
-
case "floor":
|
|
687
|
-
case "ceil":
|
|
688
|
-
case "round":
|
|
689
|
-
case "sin":
|
|
690
|
-
case "cos":
|
|
691
|
-
case "tan":
|
|
692
|
-
case "asin":
|
|
693
|
-
case "acos":
|
|
694
|
-
case "atan":
|
|
695
|
-
case "exp":
|
|
696
|
-
case "log": return O(n[0], "number", e.start, `Function ${e.name} requires a number`), "number";
|
|
697
|
-
case "min":
|
|
698
|
-
case "max":
|
|
699
|
-
case "pow":
|
|
700
|
-
case "clamp":
|
|
701
|
-
for (let t of n) O(t, "number", e.start, `Function ${e.name} requires a number`);
|
|
702
|
-
return "number";
|
|
703
|
-
case "len": return n[0] !== "string" && n[0] !== "array" && n[0] !== "number-array" && D(`Function len requires a string or array, got ${T(n[0])}.`, e.start), "number";
|
|
704
|
-
case "contains":
|
|
705
|
-
if (n[0] === "number-array") return O(n[1], "number", e.start, "Function contains requires a numeric member"), "boolean";
|
|
706
|
-
if (n[0] === "string" || n[0] === "array") return O(n[1], "string", e.start, "Function contains requires a string member"), "boolean";
|
|
707
|
-
D(`Function contains requires a string or array, got ${T(n[0])}.`, e.start);
|
|
708
|
-
break;
|
|
709
|
-
case "sum":
|
|
710
|
-
case "average":
|
|
711
|
-
case "minOf":
|
|
712
|
-
case "maxOf": return O(n[0], "number-array", e.start, `Function ${e.name} requires a numeric array`), "number";
|
|
713
|
-
case "formatNumber":
|
|
714
|
-
case "formatPercent":
|
|
715
|
-
case "formatScientific": return n[0] !== "number" && n[0] !== "null" && D(`Function ${e.name} requires a number or null, got ${T(n[0])}.`, e.start), n[1] !== void 0 && O(n[1], "number", e.start, `Function ${e.name} requires numeric fraction digits`), n[2] !== void 0 && O(n[2], "string", e.start, `Function ${e.name} requires a string locale`), e.name === "formatNumber" && n[3] !== void 0 && O(n[3], "boolean", e.start, "Function formatNumber requires a boolean grouping flag"), "string";
|
|
716
|
-
case "formatCurrency": return n[0] !== "number" && n[0] !== "null" && D(`Function formatCurrency requires a number or null, got ${T(n[0])}.`, e.start), n[1] !== void 0 && O(n[1], "string", e.start, "Function formatCurrency requires a string currency code"), n[2] !== void 0 && O(n[2], "number", e.start, "Function formatCurrency requires numeric fraction digits"), n[3] !== void 0 && O(n[3], "string", e.start, "Function formatCurrency requires a string locale"), "string";
|
|
717
|
-
case "trim":
|
|
718
|
-
case "lower":
|
|
719
|
-
case "upper": return O(n[0], "string", e.start, `Function ${e.name} requires a string`), "string";
|
|
720
|
-
case "startsWith":
|
|
721
|
-
case "endsWith": return O(n[0], "string", e.start, `Function ${e.name} requires a string`), O(n[1], "string", e.start, `Function ${e.name} requires a string search value`), "boolean";
|
|
722
|
-
case "replace": return O(n[0], "string", e.start, "Function replace requires a string"), O(n[1], "string", e.start, "Function replace requires a string search value"), O(n[2], "string", e.start, "Function replace requires a string replacement"), "string";
|
|
723
|
-
case "slice": return O(n[0], "string", e.start, "Function slice requires a string"), O(n[1], "number", e.start, "Function slice requires a numeric start index"), n[2] !== void 0 && O(n[2], "number", e.start, "Function slice requires a numeric end index"), "string";
|
|
724
|
-
case "dateCompare": return O(n[0], "string", e.start, "Function dateCompare requires a date string"), O(n[1], "string", e.start, "Function dateCompare requires a date string"), "number";
|
|
725
|
-
case "dateDiff": return O(n[0], "string", e.start, "Function dateDiff requires a date string"), O(n[1], "string", e.start, "Function dateDiff requires a date string"), n[2] !== void 0 && O(n[2], "string", e.start, "Function dateDiff requires a string unit"), "number";
|
|
726
|
-
}
|
|
727
|
-
break;
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
throw new o("expression-type", "Unsupported expression.", 0);
|
|
731
|
-
}
|
|
732
|
-
// src/local/evaluation/expression/collection-functions.ts
|
|
733
|
-
function A() {
|
|
734
|
-
throw new g("expression-number", "The result is not a finite number.");
|
|
735
|
-
}
|
|
736
|
-
function j(e) {
|
|
737
|
-
if (!Number.isFinite(e)) throw new g("expression-value", "Numeric array members must be finite numbers.");
|
|
738
|
-
return e;
|
|
739
|
-
}
|
|
740
|
-
function M(e) {
|
|
741
|
-
let t = 0;
|
|
742
|
-
for (let n of e) t += j(n);
|
|
743
|
-
return Number.isFinite(t) || A(), t;
|
|
744
|
-
}
|
|
745
|
-
function _e(e) {
|
|
746
|
-
if (e.length === 0) return null;
|
|
747
|
-
let t = M(e) / e.length;
|
|
748
|
-
return Number.isFinite(t) || A(), t;
|
|
749
|
-
}
|
|
750
|
-
function N(e) {
|
|
751
|
-
if (e.length === 0) return null;
|
|
752
|
-
let t = j(e[0]);
|
|
753
|
-
for (let n = 1; n < e.length; n += 1) {
|
|
754
|
-
let r = j(e[n]);
|
|
755
|
-
r < t && (t = r);
|
|
756
|
-
}
|
|
757
|
-
return t;
|
|
758
|
-
}
|
|
759
|
-
function P(e) {
|
|
760
|
-
if (e.length === 0) return null;
|
|
761
|
-
let t = j(e[0]);
|
|
762
|
-
for (let n = 1; n < e.length; n += 1) {
|
|
763
|
-
let r = j(e[n]);
|
|
764
|
-
r > t && (t = r);
|
|
765
|
-
}
|
|
766
|
-
return t;
|
|
767
|
-
}
|
|
768
|
-
// src/local/evaluation/expression/data-functions.ts
|
|
769
|
-
function F(e) {
|
|
770
|
-
throw new g("expression-domain", e);
|
|
771
|
-
}
|
|
772
|
-
function I(e) {
|
|
773
|
-
return b(e.trim(), "trim result");
|
|
774
|
-
}
|
|
775
|
-
function ve(e) {
|
|
776
|
-
return b(e.toLowerCase(), "lower result");
|
|
777
|
-
}
|
|
778
|
-
function ye(e) {
|
|
779
|
-
return b(e.toUpperCase(), "upper result");
|
|
780
|
-
}
|
|
781
|
-
function be(e, t) {
|
|
782
|
-
return e.startsWith(t);
|
|
783
|
-
}
|
|
784
|
-
function xe(e, t) {
|
|
785
|
-
return e.endsWith(t);
|
|
786
|
-
}
|
|
787
|
-
function Se(e, n, r) {
|
|
788
|
-
n.length === 0 && F("replace search text must not be empty.");
|
|
789
|
-
let i = r.length - n.length;
|
|
790
|
-
if (i > 0) {
|
|
791
|
-
let r = 0, a = 0;
|
|
792
|
-
for (;;) {
|
|
793
|
-
let t = e.indexOf(n, a);
|
|
794
|
-
if (t < 0) break;
|
|
795
|
-
r += 1, a = t + n.length;
|
|
796
|
-
}
|
|
797
|
-
if (e.length + r * i > 1e5) throw new g("expression-budget", `replace result would exceed the ${t}-character limit.`);
|
|
798
|
-
}
|
|
799
|
-
let a = "", o = 0;
|
|
800
|
-
for (;;) {
|
|
801
|
-
let t = e.indexOf(n, o);
|
|
802
|
-
if (t < 0) break;
|
|
803
|
-
a += e.slice(o, t), a += r, o = t + n.length;
|
|
804
|
-
}
|
|
805
|
-
return a += e.slice(o), b(a, "replace result");
|
|
806
|
-
}
|
|
807
|
-
function L(e, t) {
|
|
808
|
-
return e < 0 ? Math.max(t + e, 0) : Math.min(e, t);
|
|
809
|
-
}
|
|
810
|
-
function Ce(e, t, n) {
|
|
811
|
-
Number.isInteger(t) || F("slice start must be an integer."), n !== void 0 && !Number.isInteger(n) && F("slice end must be an integer.");
|
|
812
|
-
let r = Array.from(e), i = r.length, a = L(t, i), o = n === void 0 ? i : L(n, i);
|
|
813
|
-
return o <= a ? "" : b(r.slice(a, o).join(""), "slice result");
|
|
814
|
-
}
|
|
815
|
-
var we = /* @__PURE__ */ new Map([
|
|
816
|
-
["days", 864e5],
|
|
817
|
-
["hours", 36e5],
|
|
818
|
-
["minutes", 6e4],
|
|
819
|
-
["seconds", 1e3],
|
|
820
|
-
["milliseconds", 1]
|
|
821
|
-
]), Te = "days, hours, minutes, seconds or milliseconds";
|
|
822
|
-
function R(e) {
|
|
823
|
-
let t = Oe(e);
|
|
824
|
-
if (t === null) throw new g("expression-domain", `Date "${e}" must be a valid YYYY-MM-DD calendar date in years 0001-9999.`);
|
|
825
|
-
return t;
|
|
826
|
-
}
|
|
827
|
-
function Ee(e, t) {
|
|
828
|
-
let n = R(e), r = R(t);
|
|
829
|
-
return n === r ? 0 : n < r ? -1 : 1;
|
|
830
|
-
}
|
|
831
|
-
function De(e, t, n = "days") {
|
|
832
|
-
let r = we.get(n);
|
|
833
|
-
return r === void 0 && F(`dateDiff unit must be ${Te}.`), (R(e) - R(t)) / r;
|
|
834
|
-
}
|
|
835
|
-
function Oe(e) {
|
|
836
|
-
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
837
|
-
if (!t) return null;
|
|
838
|
-
let n = Number(t[1]), r = Number(t[2]), i = Number(t[3]);
|
|
839
|
-
if (n < 1 || r < 1 || r > 12 || i < 1 || i > 31) return null;
|
|
840
|
-
let a = /* @__PURE__ */ new Date(0);
|
|
841
|
-
return a.setUTCFullYear(n, r - 1, i), a.getUTCFullYear() === n && a.getUTCMonth() === r - 1 && a.getUTCDate() === i ? a.getTime() : null;
|
|
842
|
-
}
|
|
843
|
-
// src/local/evaluation/expression/evaluation.ts
|
|
844
|
-
function z(e, t, n = "expression-eval") {
|
|
845
|
-
throw new o(n, e, t);
|
|
846
|
-
}
|
|
847
|
-
function ke(e) {
|
|
848
|
-
if (typeof e != "object" || !e || Array.isArray(e)) throw new o("expression-value", "Expression environment must be an object.", 0);
|
|
849
|
-
}
|
|
850
|
-
function Ae(e, t, n) {
|
|
851
|
-
if (e === null) return null;
|
|
852
|
-
if (typeof e == "string") {
|
|
853
|
-
let r = m(e);
|
|
854
|
-
if (r) throw new o("expression-budget", `Variable "${t}": ${r}`, n);
|
|
855
|
-
return e;
|
|
856
|
-
}
|
|
857
|
-
if (typeof e == "boolean") return e;
|
|
858
|
-
if (typeof e == "number") {
|
|
859
|
-
if (!Number.isFinite(e)) throw new o("expression-value", `Variable "${t}" must be a finite number.`, n);
|
|
860
|
-
return e;
|
|
861
|
-
}
|
|
862
|
-
if (Array.isArray(e)) {
|
|
863
|
-
let r = f(e);
|
|
864
|
-
if (r) throw new o(r.code, `Variable "${t}": ${r.message}`, n);
|
|
865
|
-
return e;
|
|
866
|
-
}
|
|
867
|
-
throw new o("expression-value", `Variable "${t}" has an invalid value type.`, n);
|
|
868
|
-
}
|
|
869
|
-
function je(e, t, n) {
|
|
870
|
-
return ke(e), Object.prototype.hasOwnProperty.call(e, t) || z(`Variable "${t}" is not declared.`, n, "expression-unknown-name"), Ae(e[t], t, n);
|
|
871
|
-
}
|
|
872
|
-
function B(e, t, n = "Expected a number") {
|
|
873
|
-
return typeof e == "number" && Number.isFinite(e) || z(`${n}.`, t, "expression-type"), e;
|
|
874
|
-
}
|
|
875
|
-
function V(e, t, n = "Expected a boolean") {
|
|
876
|
-
return typeof e != "boolean" && z(`${n}.`, t, "expression-type"), e;
|
|
877
|
-
}
|
|
878
|
-
function H(e, t, n = "Expected a string") {
|
|
879
|
-
return typeof e != "string" && z(`${n}.`, t, "expression-type"), e;
|
|
880
|
-
}
|
|
881
|
-
function U(e, t, n) {
|
|
882
|
-
Array.isArray(e) || z(`${n}.`, t, "expression-type");
|
|
883
|
-
for (let r of e) typeof r == "number" && Number.isFinite(r) || z(`${n}.`, t, "expression-type");
|
|
884
|
-
return e;
|
|
885
|
-
}
|
|
886
|
-
function Me(e, t) {
|
|
887
|
-
let n = f(e);
|
|
888
|
-
return n && z(n.message, t, n.code), e;
|
|
889
|
-
}
|
|
890
|
-
function W(e, t) {
|
|
891
|
-
try {
|
|
892
|
-
return t();
|
|
893
|
-
} catch (t) {
|
|
894
|
-
throw t instanceof g ? new o(t.code, t.message, e) : t;
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
function G(e, t) {
|
|
898
|
-
return Number.isNaN(e) && z("The result is undefined.", t, "expression-domain"), Number.isFinite(e) || z("The result is not a finite number.", t, "expression-number"), e;
|
|
899
|
-
}
|
|
900
|
-
function Ne(e, t) {
|
|
901
|
-
let n = Array.from(e), r = Array.from(t), i = Math.min(n.length, r.length);
|
|
902
|
-
for (let e = 0; e < i; e += 1) {
|
|
903
|
-
let t = n[e].codePointAt(0), i = r[e].codePointAt(0);
|
|
904
|
-
if (t !== i) return t < i ? -1 : 1;
|
|
905
|
-
}
|
|
906
|
-
return n.length === r.length ? 0 : n.length < r.length ? -1 : 1;
|
|
907
|
-
}
|
|
908
|
-
function Pe(e, t) {
|
|
909
|
-
if (e === t) return !0;
|
|
910
|
-
if (Array.isArray(e) && Array.isArray(t)) {
|
|
911
|
-
if (e.length !== t.length) return !1;
|
|
912
|
-
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
913
|
-
return !0;
|
|
914
|
-
}
|
|
915
|
-
return !1;
|
|
916
|
-
}
|
|
917
|
-
function Fe(e, t) {
|
|
918
|
-
return K(e, t, { steps: 0 }, 1);
|
|
919
|
-
}
|
|
920
|
-
function K(e, t, n, i) {
|
|
921
|
-
switch (n.steps += 1, n.steps > 1e4 && z("Expression evaluation exceeded the step limit.", e.start, "expression-budget"), i > 250 && z("Expression evaluation is nested too deeply.", e.start, "expression-budget"), e.kind) {
|
|
922
|
-
case "literal": return e.value;
|
|
923
|
-
case "reference": return je(t, e.name, e.start);
|
|
924
|
-
case "unary": {
|
|
925
|
-
let r = K(e.operand, t, n, i + 1);
|
|
926
|
-
if (e.operator === "!") return !V(r, e.start, "Logical not requires a boolean");
|
|
927
|
-
let a = B(r, e.start, `Unary ${e.operator} requires a number`);
|
|
928
|
-
return G(e.operator === "-" ? -a : a, e.start);
|
|
929
|
-
}
|
|
930
|
-
case "binary": {
|
|
931
|
-
if (e.operator === "&&" || e.operator === "||") {
|
|
932
|
-
let r = V(K(e.left, t, n, i + 1), e.start, "Logical operators require booleans");
|
|
933
|
-
return e.operator === "&&" && !r ? !1 : e.operator === "||" && r ? !0 : V(K(e.right, t, n, i + 1), e.start, "Logical operators require booleans");
|
|
934
|
-
}
|
|
935
|
-
let r = K(e.left, t, n, i + 1), a = K(e.right, t, n, i + 1);
|
|
936
|
-
switch (e.operator) {
|
|
937
|
-
case "+":
|
|
938
|
-
if (typeof r == "number" && typeof a == "number") return G(r + a, e.start);
|
|
939
|
-
if (typeof r == "string" && typeof a == "string") {
|
|
940
|
-
let t = r + a;
|
|
941
|
-
return t.length > d && z("String result exceeds the length limit.", e.start, "expression-budget"), t;
|
|
942
|
-
}
|
|
943
|
-
z("Operator \"+\" requires two numbers or two strings.", e.start, "expression-type");
|
|
944
|
-
case "-":
|
|
945
|
-
case "*":
|
|
946
|
-
case "/":
|
|
947
|
-
case "%": {
|
|
948
|
-
let t = B(r, e.start, `Operator "${e.operator}" requires a number`), n = B(a, e.start, `Operator "${e.operator}" requires a number`);
|
|
949
|
-
return (e.operator === "/" || e.operator === "%") && n === 0 && z("Division by zero.", e.start, "expression-divide-by-zero"), G(e.operator === "-" ? t - n : e.operator === "*" ? t * n : e.operator === "/" ? t / n : t % n, e.start);
|
|
950
|
-
}
|
|
951
|
-
case "==":
|
|
952
|
-
case "!=": {
|
|
953
|
-
let t = E(r), n = E(a);
|
|
954
|
-
t !== n && t !== "null" && n !== "null" && z("Equality comparison requires matching types.", e.start, "expression-type");
|
|
955
|
-
let i = Pe(r, a);
|
|
956
|
-
return e.operator === "==" ? i : !i;
|
|
957
|
-
}
|
|
958
|
-
case "<":
|
|
959
|
-
case "<=":
|
|
960
|
-
case ">":
|
|
961
|
-
case ">=": {
|
|
962
|
-
let t;
|
|
963
|
-
return typeof r == "number" && typeof a == "number" ? t = r === a ? 0 : r < a ? -1 : 1 : typeof r == "string" && typeof a == "string" ? t = Ne(r, a) : z(`Comparison operator "${e.operator}" requires two numbers or two strings.`, e.start, "expression-type"), e.operator === "<" ? t < 0 : e.operator === "<=" ? t <= 0 : e.operator === ">" ? t > 0 : t >= 0;
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
break;
|
|
967
|
-
}
|
|
968
|
-
case "conditional": return K(V(K(e.test, t, n, i + 1), e.start, "Conditional test must be a boolean") ? e.consequent : e.alternate, t, n, i + 1);
|
|
969
|
-
case "array": {
|
|
970
|
-
let r = [];
|
|
971
|
-
for (let a of e.elements) r.push(K(a, t, n, i + 1));
|
|
972
|
-
return Me(r, e.start);
|
|
973
|
-
}
|
|
974
|
-
case "index": {
|
|
975
|
-
let r = K(e.target, t, n, i + 1), a = B(K(e.index, t, n, i + 1), e.start, "Array index must be a number");
|
|
976
|
-
return Number.isSafeInteger(a) || z("Array index must be a finite integer.", e.start, "expression-index"), Array.isArray(r) || z("Index access requires an array.", e.start, "expression-type"), a < 0 || a >= r.length ? null : r[a];
|
|
977
|
-
}
|
|
978
|
-
case "call": {
|
|
979
|
-
let a = e.args.map((e) => K(e, t, n, i + 1));
|
|
980
|
-
switch (e.name) {
|
|
981
|
-
case "abs":
|
|
982
|
-
case "sqrt":
|
|
983
|
-
case "floor":
|
|
984
|
-
case "ceil":
|
|
985
|
-
case "round":
|
|
986
|
-
case "sin":
|
|
987
|
-
case "cos":
|
|
988
|
-
case "tan":
|
|
989
|
-
case "asin":
|
|
990
|
-
case "acos":
|
|
991
|
-
case "atan":
|
|
992
|
-
case "exp":
|
|
993
|
-
case "log": {
|
|
994
|
-
let t = B(a[0], e.start, `Function ${e.name} requires a number`);
|
|
995
|
-
e.name === "sqrt" && t < 0 && z("sqrt requires a non-negative argument.", e.start, "expression-domain"), e.name === "log" && t <= 0 && z("log requires a positive argument.", e.start, "expression-domain"), (e.name === "asin" || e.name === "acos") && (t < -1 || t > 1) && z(`${e.name} requires an argument between -1 and 1.`, e.start, "expression-domain");
|
|
996
|
-
let n;
|
|
997
|
-
switch (e.name) {
|
|
998
|
-
case "abs":
|
|
999
|
-
n = Math.abs(t);
|
|
1000
|
-
break;
|
|
1001
|
-
case "sqrt":
|
|
1002
|
-
n = Math.sqrt(t);
|
|
1003
|
-
break;
|
|
1004
|
-
case "floor":
|
|
1005
|
-
n = Math.floor(t);
|
|
1006
|
-
break;
|
|
1007
|
-
case "ceil":
|
|
1008
|
-
n = Math.ceil(t);
|
|
1009
|
-
break;
|
|
1010
|
-
case "round":
|
|
1011
|
-
n = Math.round(t);
|
|
1012
|
-
break;
|
|
1013
|
-
case "sin":
|
|
1014
|
-
n = Math.sin(t);
|
|
1015
|
-
break;
|
|
1016
|
-
case "cos":
|
|
1017
|
-
n = Math.cos(t);
|
|
1018
|
-
break;
|
|
1019
|
-
case "tan":
|
|
1020
|
-
n = Math.tan(t);
|
|
1021
|
-
break;
|
|
1022
|
-
case "asin":
|
|
1023
|
-
n = Math.asin(t);
|
|
1024
|
-
break;
|
|
1025
|
-
case "acos":
|
|
1026
|
-
n = Math.acos(t);
|
|
1027
|
-
break;
|
|
1028
|
-
case "atan":
|
|
1029
|
-
n = Math.atan(t);
|
|
1030
|
-
break;
|
|
1031
|
-
case "exp":
|
|
1032
|
-
n = Math.exp(t);
|
|
1033
|
-
break;
|
|
1034
|
-
default: n = Math.log(t);
|
|
1035
|
-
}
|
|
1036
|
-
return G(n, e.start);
|
|
1037
|
-
}
|
|
1038
|
-
case "min":
|
|
1039
|
-
case "max": {
|
|
1040
|
-
let t = B(a[0], e.start, `Function ${e.name} requires a number`);
|
|
1041
|
-
for (let n = 1; n < a.length; n += 1) {
|
|
1042
|
-
let r = B(a[n], e.start, `Function ${e.name} requires a number`);
|
|
1043
|
-
t = e.name === "min" ? Math.min(t, r) : Math.max(t, r);
|
|
1044
|
-
}
|
|
1045
|
-
return G(t, e.start);
|
|
1046
|
-
}
|
|
1047
|
-
case "pow": return G(B(a[0], e.start, "Function pow requires a number") ** +B(a[1], e.start, "Function pow requires a number"), e.start);
|
|
1048
|
-
case "clamp": {
|
|
1049
|
-
let t = B(a[0], e.start, "Function clamp requires a number"), n = B(a[1], e.start, "Function clamp requires a number"), r = B(a[2], e.start, "Function clamp requires a number");
|
|
1050
|
-
return n > r && z("clamp lower bound cannot exceed upper bound.", e.start, "expression-domain"), G(Math.min(r, Math.max(n, t)), e.start);
|
|
1051
|
-
}
|
|
1052
|
-
case "len": {
|
|
1053
|
-
let t = a[0];
|
|
1054
|
-
if (typeof t == "string") return r(t);
|
|
1055
|
-
if (Array.isArray(t)) return t.length;
|
|
1056
|
-
z("Function len requires a string or array.", e.start, "expression-type");
|
|
1057
|
-
}
|
|
1058
|
-
case "contains": {
|
|
1059
|
-
let t = a[0], n = a[1];
|
|
1060
|
-
if (typeof t == "string") return t.includes(H(n, e.start, "Function contains requires a string member"));
|
|
1061
|
-
if (Array.isArray(t)) {
|
|
1062
|
-
if (typeof n == "string") {
|
|
1063
|
-
for (let n of t) typeof n != "string" && z("Function contains requires a string member for a string array.", e.start, "expression-type");
|
|
1064
|
-
return t.includes(n);
|
|
1065
|
-
}
|
|
1066
|
-
if (typeof n == "number" && Number.isFinite(n)) {
|
|
1067
|
-
for (let n of t) typeof n != "number" && z("Function contains requires a numeric member for a numeric array.", e.start, "expression-type");
|
|
1068
|
-
return t.includes(n);
|
|
1069
|
-
}
|
|
1070
|
-
z("Function contains requires a string or numeric member.", e.start, "expression-type");
|
|
1071
|
-
}
|
|
1072
|
-
z("Function contains requires a string or array.", e.start, "expression-type");
|
|
1073
|
-
}
|
|
1074
|
-
case "sum": {
|
|
1075
|
-
let t = U(a[0], e.start, "Function sum requires a numeric array");
|
|
1076
|
-
return W(e.start, () => M(t));
|
|
1077
|
-
}
|
|
1078
|
-
case "average": {
|
|
1079
|
-
let t = U(a[0], e.start, "Function average requires a numeric array");
|
|
1080
|
-
return W(e.start, () => _e(t));
|
|
1081
|
-
}
|
|
1082
|
-
case "minOf": {
|
|
1083
|
-
let t = U(a[0], e.start, "Function minOf requires a numeric array");
|
|
1084
|
-
return W(e.start, () => N(t));
|
|
1085
|
-
}
|
|
1086
|
-
case "maxOf": {
|
|
1087
|
-
let t = U(a[0], e.start, "Function maxOf requires a numeric array");
|
|
1088
|
-
return W(e.start, () => P(t));
|
|
1089
|
-
}
|
|
1090
|
-
case "formatNumber": {
|
|
1091
|
-
let t = a[0] === null ? null : B(a[0], e.start, "Function formatNumber requires a number or null"), n = a[1] === void 0 ? 2 : B(a[1], e.start, "Function formatNumber requires numeric fraction digits"), r = a[2] === void 0 ? "en-US" : H(a[2], e.start, "Function formatNumber requires a string locale"), i = a[3] === void 0 || V(a[3], e.start, "Function formatNumber requires a boolean grouping flag");
|
|
1092
|
-
return W(e.start, () => fe(t, n, r, i));
|
|
1093
|
-
}
|
|
1094
|
-
case "formatPercent": {
|
|
1095
|
-
let t = a[0] === null ? null : B(a[0], e.start, "Function formatPercent requires a number or null"), n = a[1] === void 0 ? 0 : B(a[1], e.start, "Function formatPercent requires numeric fraction digits"), r = a[2] === void 0 ? "en-US" : H(a[2], e.start, "Function formatPercent requires a string locale");
|
|
1096
|
-
return W(e.start, () => pe(t, n, r));
|
|
1097
|
-
}
|
|
1098
|
-
case "formatScientific": {
|
|
1099
|
-
let t = a[0] === null ? null : B(a[0], e.start, "Function formatScientific requires a number or null"), n = a[1] === void 0 ? 2 : B(a[1], e.start, "Function formatScientific requires numeric fraction digits"), r = a[2] === void 0 ? "en-US" : H(a[2], e.start, "Function formatScientific requires a string locale");
|
|
1100
|
-
return W(e.start, () => me(t, n, r));
|
|
1101
|
-
}
|
|
1102
|
-
case "formatCurrency": {
|
|
1103
|
-
let t = a[0] === null ? null : B(a[0], e.start, "Function formatCurrency requires a number or null"), n = a[1] === void 0 ? "USD" : H(a[1], e.start, "Function formatCurrency requires a string currency code"), r = a[2] === void 0 ? 2 : B(a[2], e.start, "Function formatCurrency requires numeric fraction digits"), i = a[3] === void 0 ? "en-US" : H(a[3], e.start, "Function formatCurrency requires a string locale");
|
|
1104
|
-
return W(e.start, () => he(t, n, r, i));
|
|
1105
|
-
}
|
|
1106
|
-
case "trim": return W(e.start, () => I(H(a[0], e.start, "Function trim requires a string")));
|
|
1107
|
-
case "lower": return W(e.start, () => ve(H(a[0], e.start, "Function lower requires a string")));
|
|
1108
|
-
case "upper": return W(e.start, () => ye(H(a[0], e.start, "Function upper requires a string")));
|
|
1109
|
-
case "startsWith": return W(e.start, () => be(H(a[0], e.start, "Function startsWith requires a string"), H(a[1], e.start, "Function startsWith requires a string search value")));
|
|
1110
|
-
case "endsWith": return W(e.start, () => xe(H(a[0], e.start, "Function endsWith requires a string"), H(a[1], e.start, "Function endsWith requires a string search value")));
|
|
1111
|
-
case "replace": {
|
|
1112
|
-
let t = H(a[0], e.start, "Function replace requires a string"), n = H(a[1], e.start, "Function replace requires a string search value"), r = H(a[2], e.start, "Function replace requires a string replacement");
|
|
1113
|
-
return W(e.start, () => Se(t, n, r));
|
|
1114
|
-
}
|
|
1115
|
-
case "slice": {
|
|
1116
|
-
let t = H(a[0], e.start, "Function slice requires a string"), n = B(a[1], e.start, "Function slice requires a numeric start index"), r = a[2] === void 0 ? void 0 : B(a[2], e.start, "Function slice requires a numeric end index");
|
|
1117
|
-
return W(e.start, () => Ce(t, n, r));
|
|
1118
|
-
}
|
|
1119
|
-
case "dateCompare": {
|
|
1120
|
-
let t = H(a[0], e.start, "Function dateCompare requires a date string"), n = H(a[1], e.start, "Function dateCompare requires a date string");
|
|
1121
|
-
return W(e.start, () => Ee(t, n));
|
|
1122
|
-
}
|
|
1123
|
-
case "dateDiff": {
|
|
1124
|
-
let t = H(a[0], e.start, "Function dateDiff requires a date string"), n = H(a[1], e.start, "Function dateDiff requires a date string"), r = a[2] === void 0 ? "days" : H(a[2], e.start, "Function dateDiff requires a string unit");
|
|
1125
|
-
return W(e.start, () => De(t, n, r));
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
break;
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
throw new o("expression-eval", "Unsupported expression.", 0);
|
|
1132
|
-
}
|
|
1133
|
-
// src/local/evaluation/expression/compile.ts
|
|
1134
|
-
var q = t, Ie = 500, J = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new WeakMap();
|
|
1135
|
-
function Le(e, t) {
|
|
1136
|
-
return Y.get(e)?.get(t);
|
|
1137
|
-
}
|
|
1138
|
-
function X(e) {
|
|
1139
|
-
if (typeof e != "string") throw new o("expression-syntax", "Expression must be a string.", 0);
|
|
1140
|
-
if (e.length > 4e3) throw new o("expression-budget", `Expression exceeds the ${ne}-character limit.`, 0);
|
|
1141
|
-
let t = J.get(e);
|
|
1142
|
-
if (t) return t;
|
|
1143
|
-
let n = new ce(e), r = n.parse(), i = [...n.dependencies], a = Object.freeze({
|
|
1144
|
-
source: e,
|
|
1145
|
-
dependencies: i,
|
|
1146
|
-
evaluate(e) {
|
|
1147
|
-
return Fe(r, e);
|
|
1148
|
-
},
|
|
1149
|
-
inferType(e) {
|
|
1150
|
-
return k(r, e);
|
|
1151
|
-
}
|
|
1152
|
-
});
|
|
1153
|
-
if (J.size >= Ie) {
|
|
1154
|
-
let e = J.keys().next().value;
|
|
1155
|
-
e !== void 0 && J.delete(e);
|
|
1156
|
-
}
|
|
1157
|
-
return Y.set(a, n.dependencyOffsets), J.set(e, a), a;
|
|
1158
|
-
}
|
|
1159
|
-
function Z(e) {
|
|
1160
|
-
if (e.length > q) throw new o("expression-budget", "Interpolation template exceeds the length limit.", 0);
|
|
1161
|
-
let t = [], n = 0;
|
|
1162
|
-
for (;;) {
|
|
1163
|
-
let r = e.indexOf("{{", n);
|
|
1164
|
-
if (r < 0) {
|
|
1165
|
-
n < e.length && t.push({
|
|
1166
|
-
kind: "text",
|
|
1167
|
-
value: e.slice(n)
|
|
1168
|
-
});
|
|
1169
|
-
break;
|
|
1170
|
-
}
|
|
1171
|
-
r > n && t.push({
|
|
1172
|
-
kind: "text",
|
|
1173
|
-
value: e.slice(n, r)
|
|
1174
|
-
});
|
|
1175
|
-
let i = r + 2, a = "", s = !1;
|
|
1176
|
-
for (; i < e.length;) {
|
|
1177
|
-
let t = e[i];
|
|
1178
|
-
if (a !== "") {
|
|
1179
|
-
if (t === "\\") {
|
|
1180
|
-
i += 2;
|
|
1181
|
-
continue;
|
|
1182
|
-
}
|
|
1183
|
-
t === a && (a = ""), i += 1;
|
|
1184
|
-
} else if (t === "\"" || t === "'") a = t, i += 1;
|
|
1185
|
-
else {
|
|
1186
|
-
if (t === "{" && e[i + 1] === "{") throw new o("expression-interpolation", "Interpolations cannot be nested.", i);
|
|
1187
|
-
if (t === "}" && e[i + 1] === "}") {
|
|
1188
|
-
s = !0;
|
|
1189
|
-
break;
|
|
1190
|
-
}
|
|
1191
|
-
i += 1;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
if (!s) throw new o("expression-interpolation", "Interpolation is missing }}.", r);
|
|
1195
|
-
let c = e.slice(r + 2, i);
|
|
1196
|
-
if (c.trim() === "") throw new o("expression-empty", "Interpolation expression is empty.", r + 2);
|
|
1197
|
-
t.push({
|
|
1198
|
-
kind: "expression",
|
|
1199
|
-
source: c,
|
|
1200
|
-
start: r + 2
|
|
1201
|
-
}), n = i + 2;
|
|
1202
|
-
}
|
|
1203
|
-
return t;
|
|
1204
|
-
}
|
|
1205
|
-
function Q(e) {
|
|
1206
|
-
try {
|
|
1207
|
-
return X(e.source);
|
|
1208
|
-
} catch (t) {
|
|
1209
|
-
throw t instanceof o ? new o(t.code, t.message, e.start + t.offset) : t;
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
function $(e, t, n) {
|
|
1213
|
-
try {
|
|
1214
|
-
return e.evaluate(t);
|
|
1215
|
-
} catch (e) {
|
|
1216
|
-
throw e instanceof o ? new o(e.code, e.message, n + e.offset) : e;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
function Re(e, t) {
|
|
1220
|
-
if (e === null) return "";
|
|
1221
|
-
if (typeof e == "string") return e;
|
|
1222
|
-
if (typeof e == "number") {
|
|
1223
|
-
if (!Number.isFinite(e)) throw new o("expression-value", "Cannot display a non-finite number.", t);
|
|
1224
|
-
return String(e);
|
|
1225
|
-
}
|
|
1226
|
-
if (typeof e == "boolean") return e ? "true" : "false";
|
|
1227
|
-
throw Array.isArray(e) ? new o("expression-type", "Cannot insert an array as text; convert it with a function such as len first.", t) : new o("expression-type", "Cannot display this value as text.", t);
|
|
1228
|
-
}
|
|
1229
|
-
function ze(e, t) {
|
|
1230
|
-
let n = [], r = 0;
|
|
1231
|
-
for (let i of e) {
|
|
1232
|
-
let e;
|
|
1233
|
-
if (e = i.kind === "text" ? i.value : Re($(Q(i), t, i.start), i.start), r += e.length, r > d) throw new o("expression-budget", "Interpolation result exceeds the length limit.", 0);
|
|
1234
|
-
n.push(e);
|
|
1235
|
-
}
|
|
1236
|
-
return n.join("");
|
|
1237
|
-
}
|
|
1238
|
-
function Be(e, t) {
|
|
1239
|
-
if (typeof e != "string") throw new o("expression-interpolation", "Interpolation template must be a string.", 0);
|
|
1240
|
-
if (e.length > q) throw new o("expression-budget", `Interpolation template exceeds the ${q}-character limit.`, 0);
|
|
1241
|
-
return e.includes("{{") ? ze(Z(e), t) : e;
|
|
1242
|
-
}
|
|
1243
|
-
function Ve(e) {
|
|
1244
|
-
if (typeof e != "string") throw new o("expression-interpolation", "Interpolation template must be a string.", 0);
|
|
1245
|
-
let t = /* @__PURE__ */ new Set();
|
|
1246
|
-
for (let n of Z(e)) if (n.kind === "expression") for (let e of Q(n).dependencies) t.add(e);
|
|
1247
|
-
return [...t];
|
|
1248
|
-
}
|
|
1249
|
-
export { o as a, p as c, Ve as i, Le as n, te as o, Be as r, m as s, X as t };
|