reactive-md 0.9.2 → 0.9.3
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 +363 -333
- package/CHANGELOG.md +364 -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/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 +323 -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-D6zQkTkt.js +112 -0
- package/dist-library/{LocalDocumentViewCore-DXE0I0Qc.js → LocalDocumentViewCore-CmJhemcA.js} +356 -9441
- package/dist-library/LocalReactiveDocumentCore-lAKOGAZ7.js +283 -0
- package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +143 -0
- package/dist-library/{authoring-Ci_KzJ0q.js → authoring-B14SsOXZ.js} +21 -20
- package/dist-library/chart-B1TUtzm-.js +3 -0
- package/dist-library/color-values-r8Wf7ALn.js +6 -0
- package/dist-library/{compile-Dx6Uw3D9.js → compile-D50B5_Ww.js} +25 -25
- package/dist-library/compile-cache-key-6GgpETz_.js +28 -0
- package/dist-library/compiler-DLkKUK4t.js +98 -0
- package/dist-library/{compiler-core-DDDdvuLy.js → compiler-core-Niqhp9wV.js} +2877 -3262
- package/dist-library/{registry-core-C9xOunaw.js → component-kernel-IG4wOO0i.js} +72 -195
- package/dist-library/{component-state-BRwvTV0d.js → component-state-Ht-hOK0W.js} +1 -1
- package/dist-library/component-utils-eSj5IdG4.js +338 -0
- package/dist-library/computations-CffoW7Ff.js +340 -0
- package/dist-library/config-validation-Cpol91_M.js +456 -0
- package/dist-library/controls-B-CLSK8Q.js +5927 -0
- package/dist-library/controls-DWlx-AQl.js +3 -0
- package/dist-library/{coordinate-B1VFK9fd.js → coordinate-PyLPMIQK.js} +85 -85
- package/dist-library/data-BtFlkJzp.js +3 -0
- package/dist-library/{data-table-8-3F15Jf.js → data-table-Kv_ZA2Z2.js} +14 -13
- package/dist-library/data-visuals-_Z7QqYTk.js +384 -0
- package/dist-library/{default-components-s21NevON.js → default-components-jugH7Ubr.js} +327 -326
- package/dist-library/{config-DXLvctiZ.js → default-config-DIrRpuQz.js} +103 -88
- package/dist-library/default-options-DU5dxuU6.js +125 -0
- package/dist-library/{registry-D6OGkOcX.js → default-registry-BlloaZi7.js} +4 -4
- package/dist-library/default-schema-Ch-Vznpm.js +33 -0
- package/dist-library/diagram-BLepzI8l.js +3 -0
- package/dist-library/{display-B_uutKkN.js → display-y4v9v0Qd.js} +1 -1
- package/dist-library/dist-Cueh1Psp.js +4761 -0
- package/dist-library/{document-theme-C8J6UyNO.js → document-theme-DBAfnk7y.js} +57 -2
- package/dist-library/{export-CIAIPBov.js → export-heVBqgxA.js} +64 -63
- package/dist-library/gallery-BC6FYTqw.js +3 -0
- package/dist-library/{gallery-Dv1rOvL0.js → gallery-Q6VPS2ep.js} +1 -1
- package/dist-library/{html-Cr4CBwAH.js → html-CCnvzan1.js} +49 -48
- package/dist-library/{incremental-9nx92u9c.js → incremental-Bzvh8_lB.js} +526 -379
- package/dist-library/{layout-BBB2VF0S.js → layout-BfUzzO2b.js} +147 -156
- package/dist-library/layout-BnfDeUNy.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-B0jthpRw.js +20 -0
- package/dist-library/motion-tokens-Czk0RDmS.js +283 -0
- package/dist-library/mount-preset-C_i37FvY.js +24 -0
- package/dist-library/numeric-sliders-CkWS0-ja.js +542 -0
- package/dist-library/{observability-4KqXhIEU.js → observability-CYLuvFfL.js} +124 -43
- package/dist-library/package-core-9UK5ZdqB.js +127 -0
- package/dist-library/parser-9yNJxGip.js +8 -0
- package/dist-library/parser-standard-BPIy4HOu.js +4872 -0
- package/dist-library/plugin-packs-CZb46nuv.js +19 -0
- package/dist-library/{preset-core-DeZPA8IE.js → preset-core-BW3NWZJ9.js} +212 -210
- package/dist-library/props-pJRrfDc6.js +179 -0
- package/dist-library/react-BSo0o998.js +32 -0
- package/dist-library/reactive-md-authoring.js +268 -257
- package/dist-library/reactive-md-build.js +7 -10
- package/dist-library/reactive-md-compiler-session.js +4 -0
- package/dist-library/reactive-md-compiler-standard.js +6 -6
- 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 +31 -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 +2 -2
- package/dist-library/reactive-md-minimal-react-preset.js +22 -20
- 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 +797 -0
- package/dist-library/reactive-md-plugin-chart.js +6 -5
- 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 +9 -9
- 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-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 +36 -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 +26 -25
- 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 +9 -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-worker-pool.js +401 -0
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +82 -1548
- package/dist-library/registry-core-CziAIP5P.js +125 -0
- package/dist-library/render-nodes-DKjg_TR1.js +9369 -0
- package/dist-library/requirements-DhIkxAbl.js +157 -0
- package/dist-library/resources-B_nbROgj.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 +1825 -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 +1480 -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-BpQdZmFI.js → runtime-CuJndKqK.js} +53 -52
- package/dist-library/runtime-requirement-C4-vNcf5.js +769 -0
- package/dist-library/schema-core-4sd1Vu7V.js +132 -0
- package/dist-library/{sdk-core-ChslheKs.js → sdk-core-BLsW9cCy.js} +497 -524
- package/dist-library/{session-core-dxQCJBNa.js → session-core-DLBRPV7f.js} +26 -25
- package/dist-library/{shareable-B8xMoGEa.js → shareable-C6mUerpQ.js} +145 -142
- 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 +11 -1
- package/dist-library/types/authoring/extensions.d.ts +1 -1
- package/dist-library/types/authoring/index.d.ts +3 -3
- 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/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/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 +1 -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 +0 -2
- package/dist-library/types/components/table/data-table-model.d.ts +48 -0
- package/dist-library/types/components/table/data-table.d.ts +1 -48
- package/dist-library/types/{local/configuration → contracts}/component-kernel.d.ts +4 -2
- 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/runtime-types.d.ts +19 -0
- 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-core.d.ts +1 -1
- package/dist-library/types/local/compilation/compiler-embedding.d.ts +20 -0
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +5 -4
- package/dist-library/types/local/compilation/compiler-structure.d.ts +1 -1
- package/dist-library/types/local/compilation/compiler-tables.d.ts +3 -2
- package/dist-library/types/local/compilation/compiler-validation.d.ts +5 -9
- package/dist-library/types/local/compilation/compiler-values.d.ts +1 -1
- 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 +55 -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/index.d.ts +6 -1
- 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/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/performance-report.d.ts +70 -0
- package/dist-library/types/local/runtime/runtime-pool.d.ts +14 -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 +37 -25
- 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 +3 -2
- 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/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 +3 -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 +2 -2
- 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 +2 -2
- 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 +12 -3
- 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/config.d.ts +2 -35
- package/dist-library/types/sdk/default-identity.d.ts +3 -0
- package/dist-library/types/sdk/index.d.ts +1 -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/types.d.ts +2 -2
- package/dist-library/types/sdk/version.d.ts +2 -0
- package/dist-library/types/standalone/session-core.d.ts +1 -1
- package/dist-library/{types-Ib5kSScP.js → types-Bza88SGK.js} +1 -1
- package/dist-library/use-hydrated-W-laKPhY.js +22975 -0
- package/dist-library/validation-XXlb-spV.js +860 -0
- package/dist-library/{version-DAxuGOG2.js → version-B0G1699c.js} +24 -33
- package/dist-library/visual-frame-y5RFhJ0_.js +19 -0
- package/dist-library/visual-helpers-CRmaqCHX.js +75 -0
- package/dist-library/visuals-CdHezgh5.js +3 -0
- package/dist-library/visuals-CoVSjVD8.js +49159 -0
- package/dist-library/worker-D6WMV8xJ.js +1632 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +121 -120
- package/docs/README-ch.md +102 -101
- package/docs/README.md +102 -101
- package/docs/compatibility/compatibility-ch.md +146 -146
- package/docs/compatibility/compatibility-en.md +146 -146
- package/docs/compatibility/deprecation-ch.md +1 -1
- package/docs/compatibility/deprecation-en.md +1 -1
- package/docs/compatibility/source-versioning-ch.md +162 -162
- package/docs/compatibility/source-versioning-en.md +162 -162
- package/docs/compatibility/support-matrix-ch.md +1 -1
- package/docs/compatibility/support-matrix-en.md +1 -1
- 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 +532 -532
- package/docs/guides/local-guide-en.md +532 -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 +398 -394
- package/docs/integration/extension-sdk-en.md +383 -379
- package/docs/integration/local-integration-ch.md +648 -646
- package/docs/integration/local-integration-en.md +664 -662
- package/docs/integration/shareable-export-ch.md +307 -307
- package/docs/integration/shareable-export-en.md +309 -309
- package/docs/reference/diagnostics-counting-ch.md +104 -104
- package/docs/reference/diagnostics-counting-en.md +104 -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 +724 -724
- package/docs/reference/local-interaction-syntax-en.md +722 -722
- package/docs/reference/public-api-ch.md +114 -7
- package/docs/reference/public-api-en.md +114 -7
- package/docs/reference/theme-protocol-ch.md +198 -198
- package/docs/reference/theme-protocol-en.md +217 -217
- 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/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 +61 -2
- package/dist-library/LocalDocumentView-BuqgJZEY.js +0 -109
- package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +0 -275
- 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/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/props-sJ8vk0cr.js +0 -183
- package/dist-library/react-0DCh-Mar.js +0 -7
- package/dist-library/resources-B0x_w3s9.js +0 -229
- package/dist-library/schema-BryM_VRW.js +0 -40
- 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/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,24 +1,62 @@
|
|
|
1
1
|
import { a as e, i as t, r as n, s as r } from "./latex-1w7aQgD5.js";
|
|
2
|
-
import
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import { n as
|
|
10
|
-
import { t as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { n as
|
|
14
|
-
import {
|
|
15
|
-
import { i as
|
|
16
|
-
import { i as
|
|
17
|
-
import { _ as
|
|
18
|
-
import { n as
|
|
19
|
-
import { t as
|
|
2
|
+
import "./limits-CFERRrlC.js";
|
|
3
|
+
import { _ as i, a, c as o, d as s, i as c, l, m as u, n as d, o as f, p, r as m, s as ee, t as te, u as h } from "./document-theme-DBAfnk7y.js";
|
|
4
|
+
import { a as g, t as ne } from "./compile-D50B5_Ww.js";
|
|
5
|
+
import { t as _ } from "./types-daDo2c_w.js";
|
|
6
|
+
import { t as v } from "./compiler-DLkKUK4t.js";
|
|
7
|
+
import { t as re } from "./default-options-DU5dxuU6.js";
|
|
8
|
+
import { n as ie, r as y, t as b } from "./observability-core-Bcu7vpnl.js";
|
|
9
|
+
import { i as x, n as S, r as C, t as w } from "./authoring-B14SsOXZ.js";
|
|
10
|
+
import { t as T } from "./parser-9yNJxGip.js";
|
|
11
|
+
import { n as E, t as D } from "./incremental-Bzvh8_lB.js";
|
|
12
|
+
import { t as O } from "./compile-cache-key-6GgpETz_.js";
|
|
13
|
+
import { a as k, i as A, n as j, o as M, r as N } from "./runtime-CuJndKqK.js";
|
|
14
|
+
import { i as P } from "./identity-BUx0Q_-d.js";
|
|
15
|
+
import { a as F, b as I, c as L, g as R, h as z, i as B, m as V, n as H, o as U, t as W, v as G, y as K } from "./worker-D6WMV8xJ.js";
|
|
16
|
+
import { i as ae, n as q, r as J, t as oe } from "./sample-bP4zHB3L.js";
|
|
17
|
+
import { _ as se, a as ce, f as le, g as ue, h as de, i as fe, m as pe, n as me, p as he, r as ge, t as _e, v as ve, y as ye } from "./shareable-C6mUerpQ.js";
|
|
18
|
+
import { n as be, t as xe } from "./observability-CYLuvFfL.js";
|
|
19
|
+
import { t as Se } from "./component-state-Ht-hOK0W.js";
|
|
20
|
+
// src/local/runtime/runtime-pool.ts
|
|
21
|
+
function Ce(e, t) {
|
|
22
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].every((n) => Object.is(e[n], t[n]));
|
|
23
|
+
}
|
|
24
|
+
function we({ idleDisposeMs: e = 0, maxIdle: t = 8 } = {}) {
|
|
25
|
+
if (!Number.isInteger(t) || t < 0 || !Number.isFinite(e) || e < 0 || e > 2147483647) throw RangeError("Invalid runtime pool capacity or idle delay.");
|
|
26
|
+
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = !1;
|
|
27
|
+
function a(e) {
|
|
28
|
+
n.delete(e), r.delete(e), clearTimeout(e.timer), e.runtime.dispose();
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
acquire(o, s = {}) {
|
|
32
|
+
if (i) throw Error("The local runtime pool is disposed.");
|
|
33
|
+
let c = [...n].find((e) => e.runtime.document.source === o.source && Ce(e.options, s) && I(e.runtime.document, o));
|
|
34
|
+
c || (c = {
|
|
35
|
+
runtime: j(o, s),
|
|
36
|
+
options: { ...s },
|
|
37
|
+
leases: 0
|
|
38
|
+
}, n.add(c));
|
|
39
|
+
let l = c;
|
|
40
|
+
r.delete(l), clearTimeout(l.timer), l.leases++;
|
|
41
|
+
let u = !1;
|
|
42
|
+
return {
|
|
43
|
+
runtime: l.runtime,
|
|
44
|
+
release() {
|
|
45
|
+
if (!u && (u = !0, !--l.leases)) {
|
|
46
|
+
if (i) a(l);
|
|
47
|
+
else for (r.add(l), l.timer = setTimeout(() => a(l), e); r.size > t;) a(r.values().next().value);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
dispose() {
|
|
53
|
+
i = !0;
|
|
54
|
+
for (let e of r) a(e);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
20
58
|
// src/local/source/source-migration.ts
|
|
21
|
-
var
|
|
59
|
+
var Y = /* @__PURE__ */ new Set([
|
|
22
60
|
"sum",
|
|
23
61
|
"average",
|
|
24
62
|
"minOf",
|
|
@@ -36,7 +74,7 @@ var Pe = /* @__PURE__ */ new Set([
|
|
|
36
74
|
"slice",
|
|
37
75
|
"dateCompare",
|
|
38
76
|
"dateDiff"
|
|
39
|
-
]),
|
|
77
|
+
]), Te = /* @__PURE__ */ new Set([
|
|
40
78
|
"jump",
|
|
41
79
|
"anchor",
|
|
42
80
|
"text",
|
|
@@ -53,12 +91,12 @@ var Pe = /* @__PURE__ */ new Set([
|
|
|
53
91
|
"data-table",
|
|
54
92
|
"column",
|
|
55
93
|
"external"
|
|
56
|
-
]),
|
|
94
|
+
]), Ee = /* @__PURE__ */ new Set(["external"]), X = /* @__PURE__ */ new Set([
|
|
57
95
|
"local-draft-1",
|
|
58
96
|
"local-draft-2",
|
|
59
|
-
|
|
60
|
-
]),
|
|
61
|
-
function
|
|
97
|
+
_
|
|
98
|
+
]), Z = `<!-- reactive-md: ${_} -->`;
|
|
99
|
+
function Q(e) {
|
|
62
100
|
let t = e.diagnostics.filter((t) => t.code.startsWith("local.version.") || t.code === "local.budget" || t.code === "local.parse" && !e.nodes.length), n = e.versionDeclaration?.version ?? null;
|
|
63
101
|
return {
|
|
64
102
|
declaredVersion: n,
|
|
@@ -68,10 +106,10 @@ function ze(e) {
|
|
|
68
106
|
diagnostics: t
|
|
69
107
|
};
|
|
70
108
|
}
|
|
71
|
-
function
|
|
72
|
-
return
|
|
109
|
+
function De(e) {
|
|
110
|
+
return Q(T(e));
|
|
73
111
|
}
|
|
74
|
-
function
|
|
112
|
+
function Oe(e, t, n, r, i = "error") {
|
|
75
113
|
let a = l(t, r), o = e.slice(0, n.start), s = o.lastIndexOf("\n");
|
|
76
114
|
return {
|
|
77
115
|
code: t,
|
|
@@ -84,11 +122,11 @@ function Ve(e, t, n, r, i = "error") {
|
|
|
84
122
|
...a.params ? { params: a.params } : {}
|
|
85
123
|
};
|
|
86
124
|
}
|
|
87
|
-
function
|
|
88
|
-
let n =
|
|
125
|
+
function $(e, t = {}) {
|
|
126
|
+
let n = T(e), r = Q(n), i = typeof t == "object" && !!t && !Array.isArray(t), a = i ? t.fromVersion ?? r.effectiveVersion : r.effectiveVersion, o = typeof a == "string" ? a : "", s = {
|
|
89
127
|
ok: !1,
|
|
90
128
|
fromVersion: o,
|
|
91
|
-
toVersion:
|
|
129
|
+
toVersion: _,
|
|
92
130
|
needsMigration: !n.versionDeclaration || o !== "local-draft-3",
|
|
93
131
|
diagnostics: r.diagnostics.filter((e) => e.code !== "local.version.unsupported")
|
|
94
132
|
}, c = {
|
|
@@ -109,15 +147,15 @@ function He(e, t = {}) {
|
|
|
109
147
|
}
|
|
110
148
|
s.diagnostics.push(e);
|
|
111
149
|
}, d = (t, n, r, i) => {
|
|
112
|
-
u(
|
|
150
|
+
u(Oe(e, t, n, r, i));
|
|
113
151
|
};
|
|
114
|
-
if (!i || typeof a != "string" || !
|
|
152
|
+
if (!i || typeof a != "string" || !X.has(o) || t.allowSemanticChanges !== void 0 && typeof t.allowSemanticChanges != "boolean" || t.fromVersion !== void 0 && r.declaredVersion !== null && o !== r.declaredVersion) return d("local.upgrade.from-version", l, {
|
|
115
153
|
from: o,
|
|
116
154
|
detail: "use local-draft-1, local-draft-2 or local-draft-3 and match the source declaration"
|
|
117
155
|
}), c;
|
|
118
|
-
let f = n.versionDeclaration ? e.slice(0, l.start) + e.slice(l.start, l.end).replace(/[^\r\n]/g, " ") + e.slice(l.end) : e, p = n.versionDeclaration ?
|
|
156
|
+
let f = n.versionDeclaration ? e.slice(0, l.start) + e.slice(l.start, l.end).replace(/[^\r\n]/g, " ") + e.slice(l.end) : e, p = n.versionDeclaration ? T(f) : n;
|
|
119
157
|
if (o === "local-draft-1" || o === "local-draft-2") {
|
|
120
|
-
let e = o === "local-draft-1" ?
|
|
158
|
+
let e = o === "local-draft-1" ? Te : Ee, n = (r) => {
|
|
121
159
|
for (let i of r) if (i.name && e.has(i.name)) d("local.upgrade.tag", i.range, { name: i.name });
|
|
122
160
|
else {
|
|
123
161
|
if (o === "local-draft-1") {
|
|
@@ -129,13 +167,13 @@ function He(e, t = {}) {
|
|
|
129
167
|
"bind-y"
|
|
130
168
|
]) {
|
|
131
169
|
let t = i.attrs?.[e];
|
|
132
|
-
t &&
|
|
170
|
+
t && Y.has(t) && d("local.upgrade.reserved-binding", i.range, { name: t });
|
|
133
171
|
}
|
|
134
172
|
(i.name === "input" || i.name === "textarea") && (i.attrs?.["max-length"] !== void 0 || Number(i.attrs?.["min-length"] ?? 0) > 0) && d("local.upgrade.text-length", i.range, void 0, t.allowSemanticChanges ? "warning" : "error");
|
|
135
173
|
let e = [...i.type === "interpolation" ? [i.value ?? ""] : [], ...Object.values(i.attrs ?? {}).flatMap((e) => [...e.matchAll(/\{\{([\s\S]*?)\}\}/g)].map((e) => e[1]))];
|
|
136
174
|
for (let t of e) {
|
|
137
175
|
let e = t.replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/g, "");
|
|
138
|
-
(e.includes("[") || [...
|
|
176
|
+
(e.includes("[") || [...Y].some((t) => RegExp(`\\b${t}\\s*\\(`).test(e))) && d("local.upgrade.expression", i.range);
|
|
139
177
|
}
|
|
140
178
|
}
|
|
141
179
|
i.type !== "fallback" && i.children && n(i.children);
|
|
@@ -144,18 +182,18 @@ function He(e, t = {}) {
|
|
|
144
182
|
n(p.nodes);
|
|
145
183
|
}
|
|
146
184
|
if (s.diagnostics.some((e) => e.severity === "error")) return c;
|
|
147
|
-
let m =
|
|
185
|
+
let m = v(f);
|
|
148
186
|
for (let e of m.diagnostics) u(e);
|
|
149
187
|
return m.ok && (!n.versionDeclaration && s.diagnostics.length < 100 && d("local.upgrade.version-missing", {
|
|
150
188
|
start: +(e.charCodeAt(0) === 65279),
|
|
151
189
|
end: +(e.charCodeAt(0) === 65279)
|
|
152
|
-
}, { version:
|
|
190
|
+
}, { version: _ }, "warning"), s.ok = !0), c;
|
|
153
191
|
}
|
|
154
|
-
function
|
|
155
|
-
return
|
|
192
|
+
function ke(e, t) {
|
|
193
|
+
return $(e, t).report;
|
|
156
194
|
}
|
|
157
|
-
function
|
|
158
|
-
let { report: n, declaration: r } =
|
|
195
|
+
function Ae(e, t) {
|
|
196
|
+
let { report: n, declaration: r } = $(e, t), i = {
|
|
159
197
|
...n,
|
|
160
198
|
source: e,
|
|
161
199
|
changed: !1,
|
|
@@ -165,7 +203,7 @@ function We(e, t) {
|
|
|
165
203
|
let a = +(e.charCodeAt(0) === 65279), o = r?.range ?? {
|
|
166
204
|
start: a,
|
|
167
205
|
end: a
|
|
168
|
-
}, s = e.includes("\r\n") ? "\r\n" : "\n", c = r ?
|
|
206
|
+
}, s = e.includes("\r\n") ? "\r\n" : "\n", c = r ? Z : `${Z}${s}${s}`, l = e.slice(0, o.start) + c + e.slice(o.end);
|
|
169
207
|
return {
|
|
170
208
|
...n,
|
|
171
209
|
source: l,
|
|
@@ -176,1508 +214,4 @@ function We(e, t) {
|
|
|
176
214
|
}]
|
|
177
215
|
};
|
|
178
216
|
}
|
|
179
|
-
|
|
180
|
-
var k = "patch-v1", Ge = 1, Ke = 4096, A = [
|
|
181
|
-
"initialState",
|
|
182
|
-
"bindings",
|
|
183
|
-
"bindingSlots",
|
|
184
|
-
"computations",
|
|
185
|
-
"dependencies",
|
|
186
|
-
"tableShapes"
|
|
187
|
-
];
|
|
188
|
-
function j(e) {
|
|
189
|
-
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
190
|
-
}
|
|
191
|
-
function M(e) {
|
|
192
|
-
return j(e) && typeof e.start == "number" && Number.isFinite(e.start) && typeof e.end == "number" && Number.isFinite(e.end);
|
|
193
|
-
}
|
|
194
|
-
function N() {
|
|
195
|
-
throw TypeError("Invalid local compile result patch");
|
|
196
|
-
}
|
|
197
|
-
function P(e, t) {
|
|
198
|
-
if (e === t) return !0;
|
|
199
|
-
if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
|
|
200
|
-
let n = Array.isArray(e);
|
|
201
|
-
if (n !== Array.isArray(t)) return !1;
|
|
202
|
-
if (n) {
|
|
203
|
-
let n = e, r = t;
|
|
204
|
-
if (n.length !== r.length) return !1;
|
|
205
|
-
for (let e = 0; e < n.length; e += 1) if (!P(n[e], r[e])) return !1;
|
|
206
|
-
return !0;
|
|
207
|
-
}
|
|
208
|
-
let r = e, i = t, a = Object.keys(r);
|
|
209
|
-
if (a.length !== Object.keys(i).length) return !1;
|
|
210
|
-
for (let e of a) if (!Object.hasOwn(i, e) || !P(r[e], i[e])) return !1;
|
|
211
|
-
return !0;
|
|
212
|
-
}
|
|
213
|
-
function F(e) {
|
|
214
|
-
return x(e, !1);
|
|
215
|
-
}
|
|
216
|
-
function I(e, t) {
|
|
217
|
-
if (typeof e != "string" || typeof t != "string" || e === t) return null;
|
|
218
|
-
let n = Math.min(e.length, t.length), r = 0;
|
|
219
|
-
for (; r < n && e.charCodeAt(r) === t.charCodeAt(r);) r += 1;
|
|
220
|
-
let i = e.length, a = t.length;
|
|
221
|
-
for (; i > r && a > r && e.charCodeAt(i - 1) === t.charCodeAt(a - 1);) --i, --a;
|
|
222
|
-
return {
|
|
223
|
-
from: r,
|
|
224
|
-
to: i,
|
|
225
|
-
insert: t.slice(r, a)
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
function L(e) {
|
|
229
|
-
if (!j(e)) return null;
|
|
230
|
-
let { from: t, to: n, insert: r } = e;
|
|
231
|
-
return typeof t != "number" || !Number.isSafeInteger(t) || typeof n != "number" || !Number.isSafeInteger(n) || typeof r != "string" || t < 0 || n < t ? null : {
|
|
232
|
-
from: t,
|
|
233
|
-
to: n,
|
|
234
|
-
insert: r
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
function qe(e, t) {
|
|
238
|
-
let n = L(t);
|
|
239
|
-
return n === null || typeof e != "string" || n.to > e.length ? null : e.slice(0, n.from) + n.insert + e.slice(n.to);
|
|
240
|
-
}
|
|
241
|
-
function R(e) {
|
|
242
|
-
let t = {};
|
|
243
|
-
for (let [n, r] of Object.entries(e)) n !== "children" && (t[n] = r);
|
|
244
|
-
return t;
|
|
245
|
-
}
|
|
246
|
-
function Je(e, t) {
|
|
247
|
-
let n = Object.keys(e).filter((e) => e !== "children"), r = Object.keys(t).filter((e) => e !== "children");
|
|
248
|
-
if (n.length !== r.length) return !1;
|
|
249
|
-
for (let r of n) if (!Object.hasOwn(t, r) || !P(e[r], t[r])) return !1;
|
|
250
|
-
return !0;
|
|
251
|
-
}
|
|
252
|
-
function z(e) {
|
|
253
|
-
return e.children === void 0 ? void 0 : e.children.map((e) => e.id);
|
|
254
|
-
}
|
|
255
|
-
function Ye(e, t) {
|
|
256
|
-
let n = z(e), r = z(t);
|
|
257
|
-
if (n === void 0 || r === void 0) return n === r;
|
|
258
|
-
if (n.length !== r.length) return !1;
|
|
259
|
-
for (let e = 0; e < n.length; e += 1) if (n[e] !== r[e]) return !1;
|
|
260
|
-
return !0;
|
|
261
|
-
}
|
|
262
|
-
function Xe(e, t) {
|
|
263
|
-
if (!Je(e, t) || !Ye(e, t)) return !1;
|
|
264
|
-
if (!e.children || !t.children) return !0;
|
|
265
|
-
for (let n = 0; n < e.children.length; n += 1) if (!Xe(e.children[n], t.children[n])) return !1;
|
|
266
|
-
return !0;
|
|
267
|
-
}
|
|
268
|
-
function Ze(e, t) {
|
|
269
|
-
let n = Object.keys(e).filter((e) => e !== "children" && e !== "range"), r = Object.keys(t).filter((e) => e !== "children" && e !== "range");
|
|
270
|
-
if (n.length !== r.length) return null;
|
|
271
|
-
for (let r of n) if (!Object.hasOwn(t, r) || !P(e[r], t[r])) return null;
|
|
272
|
-
if (!M(e.range) || !M(t.range)) return null;
|
|
273
|
-
let i = e.range.start - t.range.start;
|
|
274
|
-
if (e.range.end !== t.range.end + i) return null;
|
|
275
|
-
let a = z(e), o = z(t);
|
|
276
|
-
if (a === void 0 || o === void 0) {
|
|
277
|
-
if (a !== o) return null;
|
|
278
|
-
} else {
|
|
279
|
-
if (a.length !== o.length) return null;
|
|
280
|
-
for (let n = 0; n < a.length; n += 1) if (a[n] !== o[n] || Ze(e.children[n], t.children[n]) !== i) return null;
|
|
281
|
-
}
|
|
282
|
-
return i;
|
|
283
|
-
}
|
|
284
|
-
function Qe(e, t) {
|
|
285
|
-
let n = Object.keys(e).filter((e) => e !== "children" && e !== "range"), r = Object.keys(t).filter((e) => e !== "children" && e !== "range");
|
|
286
|
-
if (n.length !== r.length) return null;
|
|
287
|
-
for (let r of n) if (!Object.hasOwn(t, r) || !P(e[r], t[r])) return null;
|
|
288
|
-
if (!M(e.range) || !M(t.range)) return null;
|
|
289
|
-
let i = e.range.start - t.range.start;
|
|
290
|
-
return e.range.end === t.range.end + i ? i : null;
|
|
291
|
-
}
|
|
292
|
-
function B(e) {
|
|
293
|
-
let t = /* @__PURE__ */ new Map(), n = [...e].reverse();
|
|
294
|
-
for (; n.length > 0;) {
|
|
295
|
-
let e = n.pop();
|
|
296
|
-
if (t.set(e.id, e), e.children) for (let t = e.children.length - 1; t >= 0; --t) n.push(e.children[t]);
|
|
297
|
-
}
|
|
298
|
-
return t;
|
|
299
|
-
}
|
|
300
|
-
function $e(e, t, n, r) {
|
|
301
|
-
if (t !== void 0 && Xe(e, t)) return;
|
|
302
|
-
if (t === void 0) {
|
|
303
|
-
r.push({
|
|
304
|
-
id: e.id,
|
|
305
|
-
node: e
|
|
306
|
-
});
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
let i = Ze(e, t);
|
|
310
|
-
if (i !== null) {
|
|
311
|
-
i !== 0 && r.push({
|
|
312
|
-
id: e.id,
|
|
313
|
-
shift: i,
|
|
314
|
-
subtree: !0
|
|
315
|
-
});
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
let a = { id: e.id };
|
|
319
|
-
if (!Je(e, t)) {
|
|
320
|
-
let n = Qe(e, t);
|
|
321
|
-
n !== null && n !== 0 ? a.shift = n : a.data = R(e);
|
|
322
|
-
}
|
|
323
|
-
Ye(e, t) || (a.children = e.children === void 0 ? null : e.children.map((e) => e.id));
|
|
324
|
-
let o = r.length;
|
|
325
|
-
if (e.children) for (let t of e.children) $e(t, n.get(t.id), n, r);
|
|
326
|
-
Object.keys(a).length > 1 ? r.splice(o, 0, a) : r.length > o && r.splice(o, 0, { id: e.id });
|
|
327
|
-
}
|
|
328
|
-
function et(e, t) {
|
|
329
|
-
if (!j(e)) return { set: t };
|
|
330
|
-
let n = {}, r = [];
|
|
331
|
-
for (let [r, i] of Object.entries(t)) Object.hasOwn(e, r) && P(e[r], i) || (n[r] = i);
|
|
332
|
-
for (let n of Object.keys(e)) Object.hasOwn(t, n) || r.push(n);
|
|
333
|
-
return Object.keys(n).length === 0 && r.length === 0 ? null : {
|
|
334
|
-
...Object.keys(n).length === 0 ? {} : { set: n },
|
|
335
|
-
...r.length === 0 ? {} : { remove: r }
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
var tt = /* @__PURE__ */ new WeakMap();
|
|
339
|
-
function nt(e) {
|
|
340
|
-
let t = 2;
|
|
341
|
-
for (let n = 0; n < e.length; n++) {
|
|
342
|
-
let r = e.charCodeAt(n);
|
|
343
|
-
if (r === 34 || r === 92) t += 2;
|
|
344
|
-
else if (r < 32) t += r === 8 || r === 9 || r === 10 || r === 12 || r === 13 ? 2 : 6;
|
|
345
|
-
else if (r < 128) t++;
|
|
346
|
-
else if (r < 2048) t += 2;
|
|
347
|
-
else if (r >= 55296 && r <= 56319) {
|
|
348
|
-
let r = e.charCodeAt(n + 1);
|
|
349
|
-
r >= 56320 && r <= 57343 ? (t += 4, n++) : t += 6;
|
|
350
|
-
} else t += r >= 56320 && r <= 57343 ? 6 : 3;
|
|
351
|
-
}
|
|
352
|
-
return t;
|
|
353
|
-
}
|
|
354
|
-
function V(e, t) {
|
|
355
|
-
if (e === null) return {
|
|
356
|
-
bytes: 4,
|
|
357
|
-
nodes: 0
|
|
358
|
-
};
|
|
359
|
-
let n = typeof e;
|
|
360
|
-
if (n === "string") return {
|
|
361
|
-
bytes: nt(e),
|
|
362
|
-
nodes: 0
|
|
363
|
-
};
|
|
364
|
-
if (n === "number") return {
|
|
365
|
-
bytes: Number.isFinite(e) ? String(e).length : 4,
|
|
366
|
-
nodes: 0
|
|
367
|
-
};
|
|
368
|
-
if (n === "boolean") return {
|
|
369
|
-
bytes: e === !0 ? 4 : 5,
|
|
370
|
-
nodes: 0
|
|
371
|
-
};
|
|
372
|
-
if (n !== "object") return {
|
|
373
|
-
bytes: 0,
|
|
374
|
-
nodes: 0
|
|
375
|
-
};
|
|
376
|
-
let r = e, i = tt.get(r);
|
|
377
|
-
if (i !== void 0) return i;
|
|
378
|
-
if (t.has(r)) return {
|
|
379
|
-
bytes: 0,
|
|
380
|
-
nodes: 0
|
|
381
|
-
};
|
|
382
|
-
t.add(r);
|
|
383
|
-
let a, o = +!!lt(e);
|
|
384
|
-
if (Array.isArray(e)) {
|
|
385
|
-
a = 2;
|
|
386
|
-
for (let n = 0; n < e.length; n += 1) {
|
|
387
|
-
n > 0 && (a += 1);
|
|
388
|
-
let r = V(e[n], t);
|
|
389
|
-
a += r.bytes || 4, o += r.nodes;
|
|
390
|
-
}
|
|
391
|
-
} else {
|
|
392
|
-
a = 2;
|
|
393
|
-
let e = 0;
|
|
394
|
-
for (let n in r) {
|
|
395
|
-
if (!Object.hasOwn(r, n)) continue;
|
|
396
|
-
let i = r[n];
|
|
397
|
-
if (i === void 0) continue;
|
|
398
|
-
e > 0 && (a += 1), e += 1, a += nt(n) + 1;
|
|
399
|
-
let s = V(i, t);
|
|
400
|
-
a += s.bytes, o += s.nodes;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
t.delete(r);
|
|
404
|
-
let s = {
|
|
405
|
-
bytes: a,
|
|
406
|
-
nodes: o
|
|
407
|
-
};
|
|
408
|
-
return tt.set(r, s), s;
|
|
409
|
-
}
|
|
410
|
-
function rt(e, t) {
|
|
411
|
-
let n = e.document.nodes ?? [];
|
|
412
|
-
try {
|
|
413
|
-
let r = V(e, /* @__PURE__ */ new Set()), i = t.ok && typeof t.document.source == "string" ? t.document.source.length : 0;
|
|
414
|
-
if (r.bytes <= Math.max(i, Ke)) return {
|
|
415
|
-
patchBytes: r.bytes,
|
|
416
|
-
patchNodes: n.length,
|
|
417
|
-
preferFull: !1
|
|
418
|
-
};
|
|
419
|
-
let a = V(t, /* @__PURE__ */ new Set()), o = 0;
|
|
420
|
-
for (let e of n) e.node === void 0 ? e.data !== void 0 && (o += 1) : o += V(e.node, /* @__PURE__ */ new Set()).nodes;
|
|
421
|
-
let s = r.bytes * Ge >= a.bytes, c = a.nodes > 0 && o * Ge >= a.nodes;
|
|
422
|
-
return {
|
|
423
|
-
patchBytes: r.bytes,
|
|
424
|
-
fullBytes: a.bytes,
|
|
425
|
-
patchNodes: n.length,
|
|
426
|
-
fullNodes: a.nodes,
|
|
427
|
-
preferFull: s || c,
|
|
428
|
-
...s ? { reason: "bytes" } : c ? { reason: "nodes" } : {}
|
|
429
|
-
};
|
|
430
|
-
} catch {
|
|
431
|
-
return {
|
|
432
|
-
patchBytes: 0,
|
|
433
|
-
patchNodes: n.length,
|
|
434
|
-
preferFull: !1
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
function it(e, t) {
|
|
439
|
-
return st(e, t);
|
|
440
|
-
}
|
|
441
|
-
function at(e, t) {
|
|
442
|
-
let n = st(e, t);
|
|
443
|
-
return n ? {
|
|
444
|
-
patch: n,
|
|
445
|
-
cost: rt(n, t)
|
|
446
|
-
} : null;
|
|
447
|
-
}
|
|
448
|
-
function ot(e, t) {
|
|
449
|
-
let n = e.recoveries, r = t.recoveries;
|
|
450
|
-
return n === void 0 ? r === void 0 ? {} : { recoveries: r } : r !== void 0 && P(n, r) ? {} : { recoveries: r === void 0 ? null : r };
|
|
451
|
-
}
|
|
452
|
-
function st(e, t) {
|
|
453
|
-
try {
|
|
454
|
-
if (!e.ok || !t.ok) return null;
|
|
455
|
-
let n = e.document, r = t.document;
|
|
456
|
-
if (!j(n) || !j(r)) return null;
|
|
457
|
-
let i = {};
|
|
458
|
-
if (typeof n.source == "string" && typeof r.source == "string") {
|
|
459
|
-
let e = I(n.source, r.source);
|
|
460
|
-
e !== null && (i.source = e);
|
|
461
|
-
} else if (n.source !== r.source) return null;
|
|
462
|
-
let a = [], o = {}, s = {}, c = new Set(A), l = /* @__PURE__ */ new Set([...Object.keys(n), ...Object.keys(r)]);
|
|
463
|
-
for (let e of l) {
|
|
464
|
-
if (e === "source" || e === "nodes" || c.has(e)) continue;
|
|
465
|
-
let t = Object.hasOwn(r, e) && r[e] !== void 0, i = Object.hasOwn(n, e) && n[e] !== void 0;
|
|
466
|
-
t ? i && P(n[e], r[e]) || (o[e] = r[e]) : i && a.push(e);
|
|
467
|
-
}
|
|
468
|
-
for (let e of A) {
|
|
469
|
-
let t = Object.hasOwn(r, e) && r[e] !== void 0, i = Object.hasOwn(n, e) && n[e] !== void 0, c = i ? n[e] : void 0, l = t ? r[e] : void 0;
|
|
470
|
-
if (!t) {
|
|
471
|
-
i && a.push(e);
|
|
472
|
-
continue;
|
|
473
|
-
}
|
|
474
|
-
if (!j(l)) {
|
|
475
|
-
i && P(c, l) || (o[e] = l);
|
|
476
|
-
continue;
|
|
477
|
-
}
|
|
478
|
-
if (!i) {
|
|
479
|
-
s[e] = { set: l };
|
|
480
|
-
continue;
|
|
481
|
-
}
|
|
482
|
-
if (!j(c)) {
|
|
483
|
-
o[e] = l;
|
|
484
|
-
continue;
|
|
485
|
-
}
|
|
486
|
-
let u = et(c, l);
|
|
487
|
-
u !== null && (s[e] = u);
|
|
488
|
-
}
|
|
489
|
-
let u = Array.isArray(n.nodes) ? n.nodes : [], d = Array.isArray(r.nodes) ? r.nodes : [], f = u.map((e) => e.id), p = d.map((e) => e.id), m = f.length !== p.length;
|
|
490
|
-
if (!m) {
|
|
491
|
-
for (let e = 0; e < f.length; e += 1) if (f[e] !== p[e]) {
|
|
492
|
-
m = !0;
|
|
493
|
-
break;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
let h = [], g = B(u);
|
|
497
|
-
for (let e of d) $e(e, g.get(e.id), g, h);
|
|
498
|
-
return m && (i.roots = p), h.length > 0 && (i.nodes = h), a.length > 0 && (i.removed = a), Object.keys(o).length > 0 && (i.values = o), Object.keys(s).length > 0 && (i.records = s), {
|
|
499
|
-
kind: "result-patch",
|
|
500
|
-
protocol: k,
|
|
501
|
-
document: i,
|
|
502
|
-
...P(e.diagnostics, t.diagnostics) ? {} : { diagnostics: t.diagnostics },
|
|
503
|
-
...ot(e, t)
|
|
504
|
-
};
|
|
505
|
-
} catch {
|
|
506
|
-
return null;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
function ct(e, t) {
|
|
510
|
-
let n = R(e);
|
|
511
|
-
return M(n.range) || N(), n.range = {
|
|
512
|
-
start: n.range.start + t,
|
|
513
|
-
end: n.range.end + t
|
|
514
|
-
}, e.children && (n.children = e.children.map((e) => ct(e, t))), n;
|
|
515
|
-
}
|
|
516
|
-
function lt(e) {
|
|
517
|
-
return j(e) && typeof e.id == "string" && typeof e.type == "string" && M(e.range);
|
|
518
|
-
}
|
|
519
|
-
function ut(e, t) {
|
|
520
|
-
j(t) || N(), t.set !== void 0 && !j(t.set) && N(), t.remove !== void 0 && !Array.isArray(t.remove) && N();
|
|
521
|
-
let n = {};
|
|
522
|
-
if (j(e)) for (let [t, r] of Object.entries(e)) Object.defineProperty(n, t, {
|
|
523
|
-
value: r,
|
|
524
|
-
enumerable: !0,
|
|
525
|
-
configurable: !0,
|
|
526
|
-
writable: !0
|
|
527
|
-
});
|
|
528
|
-
else e !== void 0 && N();
|
|
529
|
-
if (t.set) for (let [e, r] of Object.entries(t.set)) Object.defineProperty(n, e, {
|
|
530
|
-
value: F(r),
|
|
531
|
-
enumerable: !0,
|
|
532
|
-
configurable: !0,
|
|
533
|
-
writable: !0
|
|
534
|
-
});
|
|
535
|
-
if (t.remove) for (let e of t.remove) typeof e != "string" && N(), delete n[e];
|
|
536
|
-
return n;
|
|
537
|
-
}
|
|
538
|
-
function dt(e, t) {
|
|
539
|
-
try {
|
|
540
|
-
if (!e.ok || !j(t) || t.kind !== "result-patch" || t.protocol !== "patch-v1") return null;
|
|
541
|
-
let n = t.document;
|
|
542
|
-
if (!j(n)) return null;
|
|
543
|
-
let r = e.document;
|
|
544
|
-
if (!j(r)) return null;
|
|
545
|
-
let i = {};
|
|
546
|
-
for (let [e, t] of Object.entries(r)) Object.defineProperty(i, e, {
|
|
547
|
-
value: t,
|
|
548
|
-
enumerable: !0,
|
|
549
|
-
configurable: !0,
|
|
550
|
-
writable: !0
|
|
551
|
-
});
|
|
552
|
-
if (n.removed !== void 0) {
|
|
553
|
-
if (!Array.isArray(n.removed)) return null;
|
|
554
|
-
for (let e of n.removed) {
|
|
555
|
-
if (typeof e != "string" || e === "nodes" || e === "source") return null;
|
|
556
|
-
delete i[e];
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
if (n.values !== void 0) {
|
|
560
|
-
if (!j(n.values)) return null;
|
|
561
|
-
for (let [e, t] of Object.entries(n.values)) {
|
|
562
|
-
if (e === "nodes" || e === "source") return null;
|
|
563
|
-
Object.defineProperty(i, e, {
|
|
564
|
-
value: F(t),
|
|
565
|
-
enumerable: !0,
|
|
566
|
-
configurable: !0,
|
|
567
|
-
writable: !0
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
if (n.records !== void 0) {
|
|
572
|
-
if (!j(n.records)) return null;
|
|
573
|
-
for (let e of Object.keys(n.records)) {
|
|
574
|
-
if (!A.includes(e)) return null;
|
|
575
|
-
let t = n.records[e];
|
|
576
|
-
t !== void 0 && (i[e] = ut(r[e], t));
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
let a = typeof r.source == "string" ? r.source : null;
|
|
580
|
-
if (a === null) return null;
|
|
581
|
-
if (n.source !== void 0) {
|
|
582
|
-
let e = L(n.source);
|
|
583
|
-
if (e === null) return null;
|
|
584
|
-
let t = qe(a, e);
|
|
585
|
-
if (t === null) return null;
|
|
586
|
-
a = t;
|
|
587
|
-
}
|
|
588
|
-
i.source = a;
|
|
589
|
-
let o = Array.isArray(r.nodes) ? r.nodes : [], s = B(o), c = /* @__PURE__ */ new Map();
|
|
590
|
-
if (n.nodes !== void 0) {
|
|
591
|
-
if (!Array.isArray(n.nodes)) return null;
|
|
592
|
-
for (let e of n.nodes) {
|
|
593
|
-
if (!j(e) || typeof e.id != "string" || c.has(e.id)) return null;
|
|
594
|
-
c.set(e.id, e);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
let l;
|
|
598
|
-
if (n.roots !== void 0) {
|
|
599
|
-
if (!Array.isArray(n.roots)) return null;
|
|
600
|
-
l = [];
|
|
601
|
-
for (let e of n.roots) {
|
|
602
|
-
if (typeof e != "string") return null;
|
|
603
|
-
l.push(e);
|
|
604
|
-
}
|
|
605
|
-
} else l = o.map((e) => e.id);
|
|
606
|
-
let u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Set(), f = (e) => {
|
|
607
|
-
let t = u.get(e);
|
|
608
|
-
if (t !== void 0) return t;
|
|
609
|
-
d.has(e) && N();
|
|
610
|
-
let n = c.get(e), r = s.get(e);
|
|
611
|
-
if (n === void 0) return r === void 0 && N(), u.set(e, r), r;
|
|
612
|
-
if (j(n) || N(), n.node !== void 0) {
|
|
613
|
-
(n.data !== void 0 || n.children !== void 0 || n.shift !== void 0 || n.subtree) && N(), lt(n.node) && n.node.id === e || N();
|
|
614
|
-
let t = F(n.node);
|
|
615
|
-
return u.set(e, t), t;
|
|
616
|
-
}
|
|
617
|
-
r === void 0 && n.data === void 0 && N(), n.subtree !== void 0 && n.subtree !== !0 && N(), n.shift !== void 0 && !Number.isSafeInteger(n.shift) && N(), n.data !== void 0 && n.shift !== void 0 && N(), n.children !== void 0 && n.children !== null && (!Array.isArray(n.children) || n.children.some((e) => typeof e != "string")) && N(), d.add(e);
|
|
618
|
-
let i;
|
|
619
|
-
if (n.subtree === !0) (r === void 0 || n.shift === void 0 || n.data !== void 0 || n.children !== void 0) && N(), i = ct(r, n.shift);
|
|
620
|
-
else {
|
|
621
|
-
let t;
|
|
622
|
-
n.data === void 0 ? (r === void 0 && N(), t = R(r), n.shift !== void 0 && (M(t.range) || N(), t.range = {
|
|
623
|
-
start: t.range.start + n.shift,
|
|
624
|
-
end: t.range.end + n.shift
|
|
625
|
-
})) : (j(n.data) || N(), t = F(n.data), delete t.children, t.id !== e && N());
|
|
626
|
-
let a;
|
|
627
|
-
if (n.children !== void 0) a = n.children === null ? null : [...n.children];
|
|
628
|
-
else {
|
|
629
|
-
let e = r?.children;
|
|
630
|
-
a = e === void 0 ? void 0 : e.map((e) => e.id);
|
|
631
|
-
}
|
|
632
|
-
a === null ? delete t.children : a !== void 0 && (t.children = a.map(f)), i = t;
|
|
633
|
-
}
|
|
634
|
-
return d.delete(e), u.set(e, i), i;
|
|
635
|
-
}, p = l.map(f);
|
|
636
|
-
i.nodes = n.roots === void 0 && n.nodes === void 0 ? r.nodes : p;
|
|
637
|
-
let m = t.diagnostics === void 0 ? e.diagnostics : Array.isArray(t.diagnostics) ? F(t.diagnostics) : N();
|
|
638
|
-
if (t.recoveries !== void 0 && t.recoveries !== null && !Array.isArray(t.recoveries)) return null;
|
|
639
|
-
let h = e.status === void 0 ? {} : { status: e.status };
|
|
640
|
-
if (t.recoveries === null) return {
|
|
641
|
-
ok: !0,
|
|
642
|
-
document: i,
|
|
643
|
-
diagnostics: m,
|
|
644
|
-
...h
|
|
645
|
-
};
|
|
646
|
-
let g = t.recoveries === void 0 ? e.recoveries : F([...t.recoveries]);
|
|
647
|
-
return {
|
|
648
|
-
ok: !0,
|
|
649
|
-
document: i,
|
|
650
|
-
diagnostics: m,
|
|
651
|
-
...h,
|
|
652
|
-
...g === void 0 ? {} : { recoveries: g }
|
|
653
|
-
};
|
|
654
|
-
} catch {
|
|
655
|
-
return null;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
// src/local/transport/flat-compiled-data.ts
|
|
659
|
-
var H = "flat-v1";
|
|
660
|
-
function ft(e) {
|
|
661
|
-
if (!e.ok) return !1;
|
|
662
|
-
let t = e.document.nodes.map((e) => ({
|
|
663
|
-
node: e,
|
|
664
|
-
depth: 0
|
|
665
|
-
}));
|
|
666
|
-
for (; t.length;) {
|
|
667
|
-
let { node: e, depth: n } = t.pop();
|
|
668
|
-
if (n >= 100) return !0;
|
|
669
|
-
if (e.children) for (let r of e.children) t.push({
|
|
670
|
-
node: r,
|
|
671
|
-
depth: n + 1
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
return !1;
|
|
675
|
-
}
|
|
676
|
-
function pt(e) {
|
|
677
|
-
let t = [], n = /* @__PURE__ */ new Map(), r = [], i = (e) => {
|
|
678
|
-
if (typeof e == "object" && e) {
|
|
679
|
-
let i = n.get(e);
|
|
680
|
-
if (i !== void 0) return i;
|
|
681
|
-
let a = t.length, o = Array.isArray(e) ? [
|
|
682
|
-
1,
|
|
683
|
-
e.length,
|
|
684
|
-
[]
|
|
685
|
-
] : [2, []];
|
|
686
|
-
return n.set(e, a), t.push(o), r.push({
|
|
687
|
-
value: e,
|
|
688
|
-
record: o
|
|
689
|
-
}), a;
|
|
690
|
-
}
|
|
691
|
-
if (e !== null && ![
|
|
692
|
-
"string",
|
|
693
|
-
"number",
|
|
694
|
-
"boolean",
|
|
695
|
-
"undefined"
|
|
696
|
-
].includes(typeof e)) throw TypeError("Unsupported compiler wire value");
|
|
697
|
-
let i = t.length;
|
|
698
|
-
return t.push([0, e]), i;
|
|
699
|
-
};
|
|
700
|
-
for (i(e); r.length;) {
|
|
701
|
-
let { value: e, record: t } = r.pop(), n = t[0] === 1 ? t[2] : t[1];
|
|
702
|
-
for (let t of Object.keys(e)) n.push([t, i(e[t])]);
|
|
703
|
-
}
|
|
704
|
-
return {
|
|
705
|
-
version: H,
|
|
706
|
-
records: t
|
|
707
|
-
};
|
|
708
|
-
}
|
|
709
|
-
function mt(e) {
|
|
710
|
-
if (!e || typeof e != "object") return null;
|
|
711
|
-
let t = e;
|
|
712
|
-
if (t.version !== "flat-v1" || !Array.isArray(t.records) || t.records.length === 0 || t.records.length > 2e6) return null;
|
|
713
|
-
let n = t.records, r = Array(n.length), i = Array(n.length), a = 0;
|
|
714
|
-
for (let e = 0; e < n.length; e++) {
|
|
715
|
-
let t = n[e];
|
|
716
|
-
if (!Array.isArray(t)) return null;
|
|
717
|
-
if (t[0] === 0) {
|
|
718
|
-
if (t.length !== 2 || t[1] !== null && ![
|
|
719
|
-
"string",
|
|
720
|
-
"number",
|
|
721
|
-
"boolean",
|
|
722
|
-
"undefined"
|
|
723
|
-
].includes(typeof t[1])) return null;
|
|
724
|
-
r[e] = t[1], i[e] = [];
|
|
725
|
-
continue;
|
|
726
|
-
}
|
|
727
|
-
let o = t[0] === 1;
|
|
728
|
-
if (!o && t[0] !== 2 || t.length !== (o ? 3 : 2) || o && (!Number.isSafeInteger(t[1]) || t[1] < 0 || t[1] > 1e6)) return null;
|
|
729
|
-
let s = o ? t[2] : t[1];
|
|
730
|
-
if (!Array.isArray(s)) return null;
|
|
731
|
-
let c = /* @__PURE__ */ new Set(), l = [];
|
|
732
|
-
for (let e of s) if (!Array.isArray(e) || e.length !== 2 || typeof e[0] != "string" || !Number.isSafeInteger(e[1]) || e[1] < 0 || e[1] >= n.length || c.has(e[0]) || o && (e[0] === "length" || !/^(0|[1-9][0-9]*)$/.test(e[0]) || Number(e[0]) >= t[1]) || (c.add(e[0]), l.push(e[1]), ++a > 4e6)) return null;
|
|
733
|
-
r[e] = o ? Array(t[1]) : {}, i[e] = l;
|
|
734
|
-
}
|
|
735
|
-
let o = new Uint8Array(n.length), s = [{
|
|
736
|
-
index: 0,
|
|
737
|
-
child: 0
|
|
738
|
-
}];
|
|
739
|
-
o[0] = 1;
|
|
740
|
-
let c = 1;
|
|
741
|
-
for (; s.length;) {
|
|
742
|
-
let e = s[s.length - 1], t = i[e.index];
|
|
743
|
-
if (e.child === t.length) {
|
|
744
|
-
o[e.index] = 2, s.pop();
|
|
745
|
-
continue;
|
|
746
|
-
}
|
|
747
|
-
let n = t[e.child++];
|
|
748
|
-
if (o[n] === 1) return null;
|
|
749
|
-
o[n] === 0 && (o[n] = 1, c++, s.push({
|
|
750
|
-
index: n,
|
|
751
|
-
child: 0
|
|
752
|
-
}));
|
|
753
|
-
}
|
|
754
|
-
if (c !== n.length) return null;
|
|
755
|
-
for (let e = 0; e < n.length; e++) {
|
|
756
|
-
let t = n[e];
|
|
757
|
-
if (t[0] === 0) continue;
|
|
758
|
-
let i = t[0] === 1 ? t[2] : t[1];
|
|
759
|
-
for (let [t, n] of i) Object.defineProperty(r[e], t, {
|
|
760
|
-
value: r[n],
|
|
761
|
-
enumerable: !0,
|
|
762
|
-
writable: !0,
|
|
763
|
-
configurable: !0
|
|
764
|
-
});
|
|
765
|
-
}
|
|
766
|
-
return r[0];
|
|
767
|
-
}
|
|
768
|
-
// src/local/transport/worker-job.ts
|
|
769
|
-
var ht = 150, gt = 200, _t = [
|
|
770
|
-
"maxSyntaxNodes",
|
|
771
|
-
"maxParseWork",
|
|
772
|
-
"maxMarkdownDepth"
|
|
773
|
-
];
|
|
774
|
-
function U(e) {
|
|
775
|
-
return e instanceof Error ? e.message : String(e);
|
|
776
|
-
}
|
|
777
|
-
function W() {
|
|
778
|
-
return typeof performance < "u" ? performance.now() : Date.now();
|
|
779
|
-
}
|
|
780
|
-
function G(e) {
|
|
781
|
-
return Number.isFinite(e) ? Math.max(0, Math.round(e)) : 0;
|
|
782
|
-
}
|
|
783
|
-
function K(e, t, n) {
|
|
784
|
-
let r = {
|
|
785
|
-
tokens: [],
|
|
786
|
-
bindings: [],
|
|
787
|
-
diagnostics: []
|
|
788
|
-
};
|
|
789
|
-
if (n.ok && n.document.source !== e || !n.ok && n.diagnostics.some((e) => e.code.startsWith("local.budget") || e.code.startsWith("local.options."))) return r;
|
|
790
|
-
try {
|
|
791
|
-
return se(e, t, {
|
|
792
|
-
...n.ok ? { document: n.document } : {},
|
|
793
|
-
diagnostics: !1
|
|
794
|
-
});
|
|
795
|
-
} catch {
|
|
796
|
-
return {
|
|
797
|
-
tokens: [],
|
|
798
|
-
bindings: [],
|
|
799
|
-
diagnostics: []
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
function vt(e) {
|
|
804
|
-
return Array.isArray(e) ? e.length > 32 ? Array(33) : e.map((e) => {
|
|
805
|
-
if (!e || typeof e != "object" || Array.isArray(e)) return e;
|
|
806
|
-
let t = e, n = { ...t }, r = t.props;
|
|
807
|
-
if (!r || typeof r != "object" || Array.isArray(r)) return n.props = r, n;
|
|
808
|
-
let i = {};
|
|
809
|
-
for (let [e, t] of Object.entries(r)) {
|
|
810
|
-
if (!t || typeof t != "object" || Array.isArray(t)) {
|
|
811
|
-
i[e] = t;
|
|
812
|
-
continue;
|
|
813
|
-
}
|
|
814
|
-
let n = t, r = { ...n };
|
|
815
|
-
Array.isArray(n.enum) && n.enum.length <= 64 && (r.enum = [...n.enum]), i[e] = r;
|
|
816
|
-
}
|
|
817
|
-
return n.props = i, n;
|
|
818
|
-
}) : e;
|
|
819
|
-
}
|
|
820
|
-
function yt(e) {
|
|
821
|
-
if (e !== void 0) try {
|
|
822
|
-
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
823
|
-
let t = e, n = {};
|
|
824
|
-
for (let e of S) Object.hasOwn(t, e) && (n[e] = t[e]);
|
|
825
|
-
if (Object.hasOwn(t, "markdownBreaks") && (n.markdownBreaks = t.markdownBreaks), Object.hasOwn(t, "sourcePhase") && (n.sourcePhase = t.sourcePhase), Object.hasOwn(t, "strict") && (n.strict = t.strict), Object.hasOwn(t, "limits")) {
|
|
826
|
-
let e = t.limits;
|
|
827
|
-
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
828
|
-
let t = {};
|
|
829
|
-
for (let n of _t) Object.hasOwn(e, n) && (t[n] = e[n]);
|
|
830
|
-
n.limits = t;
|
|
831
|
-
} else n.limits = e;
|
|
832
|
-
}
|
|
833
|
-
return Object.hasOwn(t, "hostComponents") && (n.hostComponents = vt(t.hostComponents)), Object.hasOwn(t, "config") && (n.config = ee(t.config)), n;
|
|
834
|
-
} catch {
|
|
835
|
-
return e;
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
function bt(e) {
|
|
839
|
-
try {
|
|
840
|
-
if (!e || typeof e != "object" || Array.isArray(e)) return "";
|
|
841
|
-
let t = e.limits;
|
|
842
|
-
if (!t || typeof t != "object" || Array.isArray(t)) return "";
|
|
843
|
-
let n = (e) => {
|
|
844
|
-
let n = t;
|
|
845
|
-
if (!Object.hasOwn(n, e) || n[e] === void 0) return "-";
|
|
846
|
-
let r = n[e];
|
|
847
|
-
return `${typeof r}:${String(r)}`;
|
|
848
|
-
};
|
|
849
|
-
return `:${n("maxParseWork")}:${n("maxMarkdownDepth")}`;
|
|
850
|
-
} catch {
|
|
851
|
-
return ":unreadable";
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
function xt(e) {
|
|
855
|
-
let t = te(e);
|
|
856
|
-
if (t !== "invalid") return t;
|
|
857
|
-
try {
|
|
858
|
-
return `invalid:${JSON.stringify(e)}`;
|
|
859
|
-
} catch {
|
|
860
|
-
return "invalid";
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
function q(e) {
|
|
864
|
-
return `${xt(e)}${bt(e)}`;
|
|
865
|
-
}
|
|
866
|
-
// src/local/transport/worker-handler.ts
|
|
867
|
-
function St(e, t, n, r) {
|
|
868
|
-
let i = e;
|
|
869
|
-
return typeof i.compileShared == "function" ? i.compileShared(t, n, r) : e.compile(t, n, r);
|
|
870
|
-
}
|
|
871
|
-
function Ct(e) {
|
|
872
|
-
return e === "streaming" || e === "final";
|
|
873
|
-
}
|
|
874
|
-
function J(e) {
|
|
875
|
-
return e.stats;
|
|
876
|
-
}
|
|
877
|
-
function Y(e, t, n, r) {
|
|
878
|
-
try {
|
|
879
|
-
e.postMessage({
|
|
880
|
-
id: t,
|
|
881
|
-
...r?.traceId === void 0 ? {} : {
|
|
882
|
-
traceId: r.traceId,
|
|
883
|
-
requestId: r.requestId,
|
|
884
|
-
sourceRevision: r.sourceRevision
|
|
885
|
-
},
|
|
886
|
-
ok: !1,
|
|
887
|
-
message: n
|
|
888
|
-
});
|
|
889
|
-
} catch {}
|
|
890
|
-
}
|
|
891
|
-
function wt(e, t, n, r, i) {
|
|
892
|
-
try {
|
|
893
|
-
e.postMessage({
|
|
894
|
-
id: t.id,
|
|
895
|
-
...t.traceId === void 0 ? {} : {
|
|
896
|
-
traceId: t.traceId,
|
|
897
|
-
requestId: t.requestId,
|
|
898
|
-
sourceRevision: t.sourceRevision
|
|
899
|
-
},
|
|
900
|
-
ok: !1,
|
|
901
|
-
message: n,
|
|
902
|
-
retryFull: !0,
|
|
903
|
-
code: r,
|
|
904
|
-
...i === void 0 ? {} : { revision: i }
|
|
905
|
-
});
|
|
906
|
-
} catch {}
|
|
907
|
-
}
|
|
908
|
-
function Tt(e) {
|
|
909
|
-
return !!e && typeof e == "object" && (e.control === "dispose" || e.control === "cancel-preparation");
|
|
910
|
-
}
|
|
911
|
-
function Et(e) {
|
|
912
|
-
if (!e || typeof e != "object") return !1;
|
|
913
|
-
let t = e;
|
|
914
|
-
return typeof t.from == "number" && Number.isSafeInteger(t.from) && typeof t.to == "number" && Number.isSafeInteger(t.to) && t.from >= 0 && t.to >= t.from && typeof t.insert == "string";
|
|
915
|
-
}
|
|
916
|
-
function Dt(e, t = {}) {
|
|
917
|
-
let n = e === void 0 ? globalThis : e;
|
|
918
|
-
if (!n || typeof n.postMessage != "function") throw TypeError("startLocalCompileWorker requires a worker scope with postMessage");
|
|
919
|
-
let r = t.createSession ? t.createSession() : D(), i = r, a = t.preparationDelay, o = typeof a == "number" && Number.isFinite(a) ? Math.max(0, a) : 200, s = typeof i.prepareAsync == "function", c = null, l = 0, u = !1, d = null, f = null, p = 0, m, h = () => {
|
|
920
|
-
p += 1, f !== null && (f.aborted = !0, f = null), d !== null && (clearTimeout(d), d = null);
|
|
921
|
-
}, g = () => new Promise((e) => {
|
|
922
|
-
typeof setTimeout == "function" ? setTimeout(e, 0) : e();
|
|
923
|
-
}), _ = async (e) => {
|
|
924
|
-
if (u || e !== p) return;
|
|
925
|
-
let t = i.prepareAsync;
|
|
926
|
-
if (typeof t != "function") return;
|
|
927
|
-
let n = { aborted: !1 };
|
|
928
|
-
f = n;
|
|
929
|
-
let r = W(), a = !1;
|
|
930
|
-
try {
|
|
931
|
-
a = await t.call(i, n, g);
|
|
932
|
-
} catch {} finally {
|
|
933
|
-
f === n && (f = null), a && !n.aborted && !u && e === p && (m = G(W() - r));
|
|
934
|
-
}
|
|
935
|
-
}, v = () => {
|
|
936
|
-
if (u || !s) return;
|
|
937
|
-
h();
|
|
938
|
-
let e = p;
|
|
939
|
-
d = setTimeout(() => {
|
|
940
|
-
d = null, _(e);
|
|
941
|
-
}, o);
|
|
942
|
-
}, y = () => {
|
|
943
|
-
if (!u) {
|
|
944
|
-
u = !0, h();
|
|
945
|
-
try {
|
|
946
|
-
r.dispose();
|
|
947
|
-
} catch {}
|
|
948
|
-
n.onmessage = null;
|
|
949
|
-
}
|
|
950
|
-
}, b = (e) => ({
|
|
951
|
-
compileMs: e,
|
|
952
|
-
...m === void 0 ? {} : { preparationMs: m }
|
|
953
|
-
}), x = (e) => {
|
|
954
|
-
let t = typeof e == "number" && Number.isSafeInteger(e) && e > 0 ? e : null;
|
|
955
|
-
return t === null ? l + 1 : t > l ? t : l + 1;
|
|
956
|
-
}, S = (e, t, i, a, o = !1, s) => {
|
|
957
|
-
let { id: l, traceId: u, requestId: d, sourceRevision: f } = e, p = c;
|
|
958
|
-
if (p === null) return !1;
|
|
959
|
-
let m = G(i), h = s === void 0 ? b(m) : {
|
|
960
|
-
...b(m),
|
|
961
|
-
...s
|
|
962
|
-
};
|
|
963
|
-
try {
|
|
964
|
-
let e = a ? {
|
|
965
|
-
id: l,
|
|
966
|
-
...u === void 0 ? {} : {
|
|
967
|
-
traceId: u,
|
|
968
|
-
requestId: d,
|
|
969
|
-
sourceRevision: f
|
|
970
|
-
},
|
|
971
|
-
ok: !0,
|
|
972
|
-
result: p.result,
|
|
973
|
-
duration: m,
|
|
974
|
-
incremental: J(r),
|
|
975
|
-
...p.sourcePhase === void 0 ? {} : { sourcePhase: p.sourcePhase },
|
|
976
|
-
protocol: k,
|
|
977
|
-
revision: t,
|
|
978
|
-
metrics: h
|
|
979
|
-
} : {
|
|
980
|
-
id: l,
|
|
981
|
-
...u === void 0 ? {} : {
|
|
982
|
-
traceId: u,
|
|
983
|
-
requestId: d,
|
|
984
|
-
sourceRevision: f
|
|
985
|
-
},
|
|
986
|
-
ok: !0,
|
|
987
|
-
result: p.result,
|
|
988
|
-
duration: m,
|
|
989
|
-
incremental: J(r),
|
|
990
|
-
...p.sourcePhase === void 0 ? {} : { sourcePhase: p.sourcePhase }
|
|
991
|
-
};
|
|
992
|
-
if (o && e.ok) {
|
|
993
|
-
let t = W();
|
|
994
|
-
e.analysis = K(p.source, p.options, p.result), e.metrics = {
|
|
995
|
-
...e.metrics,
|
|
996
|
-
analysisMs: G(W() - t)
|
|
997
|
-
};
|
|
998
|
-
}
|
|
999
|
-
if (p.deep && p.flatResults && e.ok) {
|
|
1000
|
-
let { result: t, ...r } = e, i = {
|
|
1001
|
-
...r,
|
|
1002
|
-
flatResult: pt(t)
|
|
1003
|
-
};
|
|
1004
|
-
n.postMessage(i);
|
|
1005
|
-
} else n.postMessage(e);
|
|
1006
|
-
return !0;
|
|
1007
|
-
} catch (e) {
|
|
1008
|
-
return Y(n, l, `Could not return the compile result: ${U(e)}`, {
|
|
1009
|
-
traceId: u,
|
|
1010
|
-
requestId: d,
|
|
1011
|
-
sourceRevision: f
|
|
1012
|
-
}), !1;
|
|
1013
|
-
}
|
|
1014
|
-
};
|
|
1015
|
-
return n.onmessage = (e) => {
|
|
1016
|
-
let t = e?.data;
|
|
1017
|
-
if (Tt(t)) {
|
|
1018
|
-
t.control === "dispose" ? y() : h();
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
if (!t || typeof t.id != "number") return;
|
|
1022
|
-
if (typeof t.source == "string") {
|
|
1023
|
-
let e = t, i = yt(e.options), a = e.sourcePhase === void 0 ? i?.sourcePhase : e.sourcePhase;
|
|
1024
|
-
if (a !== void 0 && !Ct(a)) {
|
|
1025
|
-
Y(n, e.id, "The requested source phase is not supported: expected \"streaming\" or \"final\"", e);
|
|
1026
|
-
return;
|
|
1027
|
-
}
|
|
1028
|
-
let o = a;
|
|
1029
|
-
h();
|
|
1030
|
-
let s = q(i), u = e.protocol === k, d = x(e.revision), f = W();
|
|
1031
|
-
try {
|
|
1032
|
-
if (c !== null && c.optionsKey !== s) try {
|
|
1033
|
-
r.clear();
|
|
1034
|
-
} catch {}
|
|
1035
|
-
let t = St(r, e.source, i, o), n = G(W() - f);
|
|
1036
|
-
l = d, c = {
|
|
1037
|
-
source: e.source,
|
|
1038
|
-
revision: d,
|
|
1039
|
-
options: i,
|
|
1040
|
-
optionsKey: s,
|
|
1041
|
-
result: t,
|
|
1042
|
-
deep: ft(t),
|
|
1043
|
-
flatResults: e.flatResults === H,
|
|
1044
|
-
...o === void 0 ? {} : { sourcePhase: o }
|
|
1045
|
-
}, S(e, d, n, u, e.includeAuthorAnalysis === !0) && v();
|
|
1046
|
-
} catch (t) {
|
|
1047
|
-
Y(n, e.id, U(t), e);
|
|
1048
|
-
}
|
|
1049
|
-
return;
|
|
1050
|
-
}
|
|
1051
|
-
if (t.protocol !== "patch-v1") return;
|
|
1052
|
-
h();
|
|
1053
|
-
let i = t, a = c, o = (e, t) => {
|
|
1054
|
-
wt(n, i, e, t, a?.revision);
|
|
1055
|
-
};
|
|
1056
|
-
if (a === null) {
|
|
1057
|
-
o("No complete compile is available to patch", "stale-base");
|
|
1058
|
-
return;
|
|
1059
|
-
}
|
|
1060
|
-
if ((a.sourcePhase ?? "final") !== "final") {
|
|
1061
|
-
o("The baseline was compiled from a streaming snapshot", "phase-mismatch");
|
|
1062
|
-
return;
|
|
1063
|
-
}
|
|
1064
|
-
if (typeof i.baseRevision != "number" || i.baseRevision !== a.revision) {
|
|
1065
|
-
o("The requested base revision is not current", "stale-base");
|
|
1066
|
-
return;
|
|
1067
|
-
}
|
|
1068
|
-
if (i.optionsKey !== void 0 && i.optionsKey !== a.optionsKey) {
|
|
1069
|
-
o("The options signature changed since the baseline", "options-mismatch");
|
|
1070
|
-
return;
|
|
1071
|
-
}
|
|
1072
|
-
if (!Et(i.edit)) {
|
|
1073
|
-
o("The source edit is invalid", "invalid-edit");
|
|
1074
|
-
return;
|
|
1075
|
-
}
|
|
1076
|
-
let s = i.edit;
|
|
1077
|
-
if (s.to > a.source.length) {
|
|
1078
|
-
o("The source edit does not fit the baseline", "invalid-edit");
|
|
1079
|
-
return;
|
|
1080
|
-
}
|
|
1081
|
-
let u = a.source.slice(0, s.from) + s.insert + a.source.slice(s.to);
|
|
1082
|
-
if (typeof i.targetLength == "number" && u.length !== i.targetLength) {
|
|
1083
|
-
o("The source edit produced an unexpected length", "invalid-edit");
|
|
1084
|
-
return;
|
|
1085
|
-
}
|
|
1086
|
-
let d = x(i.revision), f = W();
|
|
1087
|
-
try {
|
|
1088
|
-
let e = St(r, u, a.options, a.sourcePhase), t = G(W() - f), o = a.revision, s = a.result;
|
|
1089
|
-
l = d, c = {
|
|
1090
|
-
source: u,
|
|
1091
|
-
revision: d,
|
|
1092
|
-
options: a.options,
|
|
1093
|
-
optionsKey: a.optionsKey,
|
|
1094
|
-
result: e,
|
|
1095
|
-
deep: ft(e),
|
|
1096
|
-
flatResults: a.flatResults,
|
|
1097
|
-
...a.sourcePhase === void 0 ? {} : { sourcePhase: a.sourcePhase }
|
|
1098
|
-
};
|
|
1099
|
-
let p = null, h = 0;
|
|
1100
|
-
if (e.ok && s.ok && !c.deep && !a.deep) {
|
|
1101
|
-
let t = W();
|
|
1102
|
-
p = at(s, e), h = G(W() - t);
|
|
1103
|
-
}
|
|
1104
|
-
let g = p?.patch ?? null;
|
|
1105
|
-
if (g === null) {
|
|
1106
|
-
S(i, d, t, !0, i.includeAuthorAnalysis === !0) && v();
|
|
1107
|
-
return;
|
|
1108
|
-
}
|
|
1109
|
-
if (p !== null && p.cost.preferFull) {
|
|
1110
|
-
let e = p.cost, n = {
|
|
1111
|
-
patchEncodeMs: h,
|
|
1112
|
-
patchFallback: "cost",
|
|
1113
|
-
patchBytes: e.patchBytes,
|
|
1114
|
-
...e.fullBytes === void 0 ? {} : { fullBytes: e.fullBytes }
|
|
1115
|
-
};
|
|
1116
|
-
S(i, d, t, !0, i.includeAuthorAnalysis === !0, n) && v();
|
|
1117
|
-
return;
|
|
1118
|
-
}
|
|
1119
|
-
let _ = {
|
|
1120
|
-
compileMs: t,
|
|
1121
|
-
patchEncodeMs: h,
|
|
1122
|
-
patchNodes: g.document.nodes?.length ?? 0,
|
|
1123
|
-
...m === void 0 ? {} : { preparationMs: m }
|
|
1124
|
-
};
|
|
1125
|
-
try {
|
|
1126
|
-
let s = {
|
|
1127
|
-
id: i.id,
|
|
1128
|
-
...i.traceId === void 0 ? {} : {
|
|
1129
|
-
traceId: i.traceId,
|
|
1130
|
-
requestId: i.requestId,
|
|
1131
|
-
sourceRevision: i.sourceRevision
|
|
1132
|
-
},
|
|
1133
|
-
ok: !0,
|
|
1134
|
-
protocol: k,
|
|
1135
|
-
baseRevision: o,
|
|
1136
|
-
revision: d,
|
|
1137
|
-
patch: g,
|
|
1138
|
-
duration: t,
|
|
1139
|
-
incremental: J(r),
|
|
1140
|
-
...a.sourcePhase === void 0 ? {} : { sourcePhase: a.sourcePhase },
|
|
1141
|
-
metrics: _
|
|
1142
|
-
};
|
|
1143
|
-
if (i.includeAuthorAnalysis === !0) {
|
|
1144
|
-
let t = W();
|
|
1145
|
-
s.analysis = K(u, a.options, e), _.analysisMs = G(W() - t);
|
|
1146
|
-
}
|
|
1147
|
-
n.postMessage(s), v();
|
|
1148
|
-
} catch (e) {
|
|
1149
|
-
Y(n, i.id, `Could not return the compile result: ${U(e)}`, i);
|
|
1150
|
-
}
|
|
1151
|
-
} catch (e) {
|
|
1152
|
-
Y(n, i.id, U(e), i);
|
|
1153
|
-
}
|
|
1154
|
-
}, {
|
|
1155
|
-
dispose: y,
|
|
1156
|
-
cancelPreparation: h,
|
|
1157
|
-
get disposed() {
|
|
1158
|
-
return u;
|
|
1159
|
-
}
|
|
1160
|
-
};
|
|
1161
|
-
}
|
|
1162
|
-
// src/local/transport/worker.ts
|
|
1163
|
-
function Ot(e, t) {
|
|
1164
|
-
if (!e || typeof e != "object") return !1;
|
|
1165
|
-
let n = e, r = (e) => e && Number.isSafeInteger(e.start) && Number.isSafeInteger(e.end) && e.start >= 0 && e.end >= e.start && e.end <= t;
|
|
1166
|
-
if (!Array.isArray(n.tokens) || n.tokens.length > t + 1 || !Array.isArray(n.bindings) || n.bindings.length > t + 1 || !Array.isArray(n.diagnostics)) return !1;
|
|
1167
|
-
let i = 0, a = 0;
|
|
1168
|
-
for (let e of n.tokens) {
|
|
1169
|
-
if (!e || typeof e.kind != "string" || !r(e.range) || e.range.start < i) return !1;
|
|
1170
|
-
i = e.range.end;
|
|
1171
|
-
}
|
|
1172
|
-
for (let e of n.bindings) if (!e || typeof e.name != "string" || !Array.isArray(e.declarations) || !Array.isArray(e.references) || (a += e.declarations.length + e.references.length, a > t + 1 || !e.declarations.every(r) || !e.references.every(r))) return !1;
|
|
1173
|
-
return !0;
|
|
1174
|
-
}
|
|
1175
|
-
function kt(e, t, n) {
|
|
1176
|
-
let r = yt(t), i = n === void 0 ? At(t) : n, a = i === "streaming" || i === "final" ? i : void 0, o = i !== void 0 && a === void 0 ? i : void 0;
|
|
1177
|
-
return {
|
|
1178
|
-
source: e,
|
|
1179
|
-
options: r,
|
|
1180
|
-
optionsKey: q(r),
|
|
1181
|
-
scheduledAt: W(),
|
|
1182
|
-
sourcePhase: a === "streaming" ? "streaming" : "final",
|
|
1183
|
-
explicitPhase: i !== void 0,
|
|
1184
|
-
...o === void 0 ? {} : { invalidPhase: o }
|
|
1185
|
-
};
|
|
1186
|
-
}
|
|
1187
|
-
function At(e) {
|
|
1188
|
-
try {
|
|
1189
|
-
return !e || typeof e != "object" || Array.isArray(e) ? void 0 : e.sourcePhase;
|
|
1190
|
-
} catch {
|
|
1191
|
-
return;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
function X(e, t) {
|
|
1195
|
-
return e.source === t.source && e.optionsKey === t.optionsKey && e.sourcePhase === t.sourcePhase && e.explicitPhase === t.explicitPhase && e.invalidPhase === t.invalidPhase;
|
|
1196
|
-
}
|
|
1197
|
-
function Z(e) {
|
|
1198
|
-
return e.sourcePhase === "streaming" || e.explicitPhase ? { sourcePhase: e.sourcePhase } : {};
|
|
1199
|
-
}
|
|
1200
|
-
function Q(e, t) {
|
|
1201
|
-
return e.explicitPhase ? {
|
|
1202
|
-
ok: !1,
|
|
1203
|
-
diagnostics: [t],
|
|
1204
|
-
status: "failed"
|
|
1205
|
-
} : {
|
|
1206
|
-
ok: !1,
|
|
1207
|
-
diagnostics: [t]
|
|
1208
|
-
};
|
|
1209
|
-
}
|
|
1210
|
-
function jt() {
|
|
1211
|
-
return {
|
|
1212
|
-
ok: !1,
|
|
1213
|
-
status: "failed",
|
|
1214
|
-
diagnostics: [{
|
|
1215
|
-
code: "local.options.invalid",
|
|
1216
|
-
message: "Compile option sourcePhase must be \"streaming\" or \"final\".",
|
|
1217
|
-
severity: "error",
|
|
1218
|
-
range: {
|
|
1219
|
-
start: 0,
|
|
1220
|
-
end: 0
|
|
1221
|
-
},
|
|
1222
|
-
line: 1,
|
|
1223
|
-
column: 1,
|
|
1224
|
-
messageKey: "local.options.invalid.source-phase",
|
|
1225
|
-
phase: "host",
|
|
1226
|
-
recoverable: !1
|
|
1227
|
-
}]
|
|
1228
|
-
};
|
|
1229
|
-
}
|
|
1230
|
-
function Mt(e) {
|
|
1231
|
-
if (!e || typeof e != "object") return !1;
|
|
1232
|
-
let t = e;
|
|
1233
|
-
return !(typeof t.ok != "boolean" || !Array.isArray(t.diagnostics) || t.ok && (!t.document || typeof t.document != "object"));
|
|
1234
|
-
}
|
|
1235
|
-
function Nt(e) {
|
|
1236
|
-
return e.ok && "patch" in e && e.patch !== void 0;
|
|
1237
|
-
}
|
|
1238
|
-
var Pt = 160;
|
|
1239
|
-
function Ft(e) {
|
|
1240
|
-
let t = U(e).trim();
|
|
1241
|
-
return t.length === 0 ? "" : t.length > Pt ? `${v(t, 159)}…` : t;
|
|
1242
|
-
}
|
|
1243
|
-
function $(e) {
|
|
1244
|
-
let t = Ft(e);
|
|
1245
|
-
return {
|
|
1246
|
-
code: "local.worker.compile",
|
|
1247
|
-
messageKey: t ? "local.worker.compile.detail" : "local.worker.compile",
|
|
1248
|
-
...t ? { params: { detail: t } } : {},
|
|
1249
|
-
phase: "worker",
|
|
1250
|
-
recoverable: !1,
|
|
1251
|
-
message: t ? `Compilation failed: ${t}` : "Compilation failed",
|
|
1252
|
-
severity: "error",
|
|
1253
|
-
range: {
|
|
1254
|
-
start: 0,
|
|
1255
|
-
end: 0
|
|
1256
|
-
},
|
|
1257
|
-
line: 1,
|
|
1258
|
-
column: 1
|
|
1259
|
-
};
|
|
1260
|
-
}
|
|
1261
|
-
var It = class {
|
|
1262
|
-
options;
|
|
1263
|
-
delay;
|
|
1264
|
-
worker = null;
|
|
1265
|
-
timer = null;
|
|
1266
|
-
queued = null;
|
|
1267
|
-
inFlight = null;
|
|
1268
|
-
nextId = 1;
|
|
1269
|
-
nextRevision = 1;
|
|
1270
|
-
nextSourceRevision = 1;
|
|
1271
|
-
currentSourceRevision = 0;
|
|
1272
|
-
pending = !1;
|
|
1273
|
-
fallbackSession = null;
|
|
1274
|
-
disposed = !1;
|
|
1275
|
-
timeout = null;
|
|
1276
|
-
requestContexts = /* @__PURE__ */ new Map();
|
|
1277
|
-
obsoleteRequestIds = /* @__PURE__ */ new Set();
|
|
1278
|
-
reportedStaleRequestIds = /* @__PURE__ */ new Set();
|
|
1279
|
-
baseline = null;
|
|
1280
|
-
patchState = "unknown";
|
|
1281
|
-
startupFailure = null;
|
|
1282
|
-
constructor(e) {
|
|
1283
|
-
this.options = e;
|
|
1284
|
-
let t = e.delay;
|
|
1285
|
-
this.delay = typeof t == "number" && Number.isFinite(t) ? Math.max(0, t) : 150;
|
|
1286
|
-
try {
|
|
1287
|
-
let t = e.createWorker();
|
|
1288
|
-
t.onmessage = (e) => this.receive(e.data), t.onerror = (e) => {
|
|
1289
|
-
let t = e && typeof e.message == "string" ? String(e.message) : "";
|
|
1290
|
-
this.handleWorkerFailure(t || "The compile worker encountered an error");
|
|
1291
|
-
}, t.onmessageerror = () => this.handleWorkerFailure("The compile worker could not deliver the compile result"), this.worker = t;
|
|
1292
|
-
} catch (t) {
|
|
1293
|
-
this.worker = null, this.startupFailure = Ft(t), e.onModeChange?.("fallback", `Could not start the compile worker: ${U(t)}`);
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
schedule(e, t, n, r) {
|
|
1297
|
-
if (this.disposed) return;
|
|
1298
|
-
let i = {
|
|
1299
|
-
...kt(e, t, r),
|
|
1300
|
-
sourceRevision: this.nextSourceRevision++,
|
|
1301
|
-
traceId: ne()
|
|
1302
|
-
};
|
|
1303
|
-
this.currentSourceRevision = i.sourceRevision, this.inFlight && !X(this.inFlight.job, i) && this.obsoleteRequestIds.add(this.inFlight.id), this.queued = i, n && typeof n.baseSource == "string" && Et(n.edit) && n.edit.to <= n.baseSource.length && n.baseSource.slice(0, n.edit.from) + n.edit.insert + n.baseSource.slice(n.edit.to) === e && (this.queued.editHint = {
|
|
1304
|
-
baseSource: n.baseSource,
|
|
1305
|
-
edit: { ...n.edit }
|
|
1306
|
-
}), this.clearTimer(), i.sourcePhase === "streaming" && (this.baseline = null), this.setPending(!0), i.sourcePhase === "streaming" || !i.explicitPhase ? this.timer = setTimeout(() => {
|
|
1307
|
-
this.timer = null, this.drain();
|
|
1308
|
-
}, this.delay) : this.drain();
|
|
1309
|
-
}
|
|
1310
|
-
dispose() {
|
|
1311
|
-
if (this.disposed) return;
|
|
1312
|
-
this.disposed = !0, this.inFlight && (this.traceWorker(this.inFlight, "worker-cancel", { status: "disposed" }), this.obsoleteRequestIds.add(this.inFlight.id)), this.timeout !== null && clearTimeout(this.timeout), this.timeout = null, this.clearTimer(), this.queued = null, this.inFlight = null, this.resetProtocol();
|
|
1313
|
-
let e = this.worker;
|
|
1314
|
-
if (this.worker = null, e) {
|
|
1315
|
-
e.onmessage = null, e.onerror = null, e.onmessageerror = null;
|
|
1316
|
-
try {
|
|
1317
|
-
e.terminate();
|
|
1318
|
-
} catch {}
|
|
1319
|
-
}
|
|
1320
|
-
this.pending = !1, this.fallbackSession?.dispose(), this.fallbackSession = null;
|
|
1321
|
-
}
|
|
1322
|
-
drain() {
|
|
1323
|
-
if (this.disposed || this.timer !== null || this.inFlight !== null) return;
|
|
1324
|
-
let e = this.queued;
|
|
1325
|
-
e === null ? this.setPending(!1) : (this.queued = null, this.compile(e));
|
|
1326
|
-
}
|
|
1327
|
-
compile(e) {
|
|
1328
|
-
if (e.invalidPhase !== void 0) {
|
|
1329
|
-
this.deliver(e, {
|
|
1330
|
-
source: e.source,
|
|
1331
|
-
result: jt(),
|
|
1332
|
-
duration: 0,
|
|
1333
|
-
mode: this.worker === null ? "fallback" : "worker",
|
|
1334
|
-
...e.options === void 0 ? {} : { options: e.options },
|
|
1335
|
-
metrics: { queueMs: G(W() - e.scheduledAt) }
|
|
1336
|
-
}), this.finishRun();
|
|
1337
|
-
return;
|
|
1338
|
-
}
|
|
1339
|
-
let t = this.worker;
|
|
1340
|
-
if (!t) {
|
|
1341
|
-
this.compileFallback(e);
|
|
1342
|
-
return;
|
|
1343
|
-
}
|
|
1344
|
-
e.sourcePhase === "streaming" && (this.baseline = null);
|
|
1345
|
-
let n = this.nextId++, r = this.nextRevision++, { traceId: i, sourceRevision: a } = e, o = W(), s = this.baseline, c = e.sourcePhase === "final" && this.patchState === "enabled" && s !== null && s.optionsKey === e.optionsKey ? {
|
|
1346
|
-
traceId: i,
|
|
1347
|
-
requestId: n,
|
|
1348
|
-
sourceRevision: a,
|
|
1349
|
-
id: n,
|
|
1350
|
-
protocol: k,
|
|
1351
|
-
baseRevision: s.revision,
|
|
1352
|
-
revision: r,
|
|
1353
|
-
edit: e.editHint?.baseSource === s.source ? e.editHint.edit : I(s.source, e.source) ?? {
|
|
1354
|
-
from: 0,
|
|
1355
|
-
to: 0,
|
|
1356
|
-
insert: ""
|
|
1357
|
-
},
|
|
1358
|
-
targetLength: e.source.length,
|
|
1359
|
-
optionsKey: e.optionsKey
|
|
1360
|
-
} : {
|
|
1361
|
-
traceId: i,
|
|
1362
|
-
requestId: n,
|
|
1363
|
-
sourceRevision: a,
|
|
1364
|
-
id: n,
|
|
1365
|
-
source: e.source,
|
|
1366
|
-
...e.options === void 0 ? {} : { options: e.options },
|
|
1367
|
-
protocol: k,
|
|
1368
|
-
revision: r,
|
|
1369
|
-
flatResults: H,
|
|
1370
|
-
...e.sourcePhase === "streaming" || e.explicitPhase ? { sourcePhase: e.sourcePhase } : {}
|
|
1371
|
-
}, l = {
|
|
1372
|
-
id: n,
|
|
1373
|
-
job: e,
|
|
1374
|
-
startedAt: o,
|
|
1375
|
-
revision: r,
|
|
1376
|
-
traceId: i,
|
|
1377
|
-
sourceRevision: a
|
|
1378
|
-
};
|
|
1379
|
-
this.inFlight = l;
|
|
1380
|
-
let u = this.options.timeoutMs, d = typeof u == "number" && Number.isFinite(u) && u > 0 ? Math.min(2147483647, Math.ceil(u)) : 3e4;
|
|
1381
|
-
for (this.requestContexts.set(n, {
|
|
1382
|
-
traceId: i,
|
|
1383
|
-
sourceRevision: a
|
|
1384
|
-
}); this.requestContexts.size > 128;) {
|
|
1385
|
-
let e = this.requestContexts.keys().next().value;
|
|
1386
|
-
if (e === void 0) break;
|
|
1387
|
-
this.requestContexts.delete(e), this.obsoleteRequestIds.delete(e), this.reportedStaleRequestIds.delete(e);
|
|
1388
|
-
}
|
|
1389
|
-
if (this.timeout = setTimeout(() => {
|
|
1390
|
-
if (this.inFlight?.id !== n) return;
|
|
1391
|
-
let e = {
|
|
1392
|
-
...O("local.worker.timeout", {
|
|
1393
|
-
timeoutMs: d,
|
|
1394
|
-
requestId: n,
|
|
1395
|
-
sourceRevision: a
|
|
1396
|
-
}),
|
|
1397
|
-
phase: "worker"
|
|
1398
|
-
};
|
|
1399
|
-
this.obsoleteRequestIds.add(n), this.handleWorkerFailure(e.message, e);
|
|
1400
|
-
}, d), this.traceWorker(l, "worker-request"), !(this.disposed || this.inFlight !== l)) {
|
|
1401
|
-
this.options.includeAuthorAnalysis && (c.includeAuthorAnalysis = !0);
|
|
1402
|
-
try {
|
|
1403
|
-
t.postMessage(c);
|
|
1404
|
-
} catch (e) {
|
|
1405
|
-
this.obsoleteRequestIds.add(n), this.handleWorkerFailure(`Could not send the source to the compile worker: ${U(e)}`);
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
compileFallback(e) {
|
|
1410
|
-
if (this.disposed) return;
|
|
1411
|
-
e.sourcePhase === "streaming" && (this.baseline = null);
|
|
1412
|
-
let t = W(), { traceId: n, sourceRevision: r } = e;
|
|
1413
|
-
if (!this.isCurrentJob(e) || (T(this.options.observer, {
|
|
1414
|
-
type: "compile-start",
|
|
1415
|
-
traceId: n,
|
|
1416
|
-
sourceRevision: r,
|
|
1417
|
-
timestamp: Date.now(),
|
|
1418
|
-
status: "fallback"
|
|
1419
|
-
}), !this.isCurrentJob(e))) {
|
|
1420
|
-
this.finishRun();
|
|
1421
|
-
return;
|
|
1422
|
-
}
|
|
1423
|
-
let i;
|
|
1424
|
-
try {
|
|
1425
|
-
let t = this.options.fallbackCompile ?? ((e, t, n) => (this.fallbackSession ??= D(), this.fallbackSession.compile(e, t, n)));
|
|
1426
|
-
i = e.explicitPhase ? t(e.source, e.options, e.sourcePhase) : e.options === void 0 ? t(e.source) : t(e.source, e.options);
|
|
1427
|
-
} catch (t) {
|
|
1428
|
-
i = Q(e, $(t));
|
|
1429
|
-
}
|
|
1430
|
-
let a = G(W() - t);
|
|
1431
|
-
if (!this.isCurrentJob(e)) this.finishRun();
|
|
1432
|
-
else {
|
|
1433
|
-
if (this.startupFailure !== null) {
|
|
1434
|
-
let t = this.startupFailure;
|
|
1435
|
-
if (this.startupFailure = null, T(this.options.observer, {
|
|
1436
|
-
type: "worker-error",
|
|
1437
|
-
traceId: n,
|
|
1438
|
-
sourceRevision: r,
|
|
1439
|
-
timestamp: Date.now(),
|
|
1440
|
-
status: "failed",
|
|
1441
|
-
code: "local.worker.startup",
|
|
1442
|
-
...t ? { detail: t } : {}
|
|
1443
|
-
}), !this.isCurrentJob(e)) {
|
|
1444
|
-
this.finishRun();
|
|
1445
|
-
return;
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
T(this.options.observer, {
|
|
1449
|
-
type: "compile-end",
|
|
1450
|
-
traceId: n,
|
|
1451
|
-
sourceRevision: r,
|
|
1452
|
-
timestamp: Date.now(),
|
|
1453
|
-
durationMs: a,
|
|
1454
|
-
status: i.ok ? "ok" : "failed"
|
|
1455
|
-
}), this.isCurrentJob(e) && this.deliver(e, {
|
|
1456
|
-
source: e.source,
|
|
1457
|
-
result: i,
|
|
1458
|
-
duration: a,
|
|
1459
|
-
mode: "fallback",
|
|
1460
|
-
...this.options.includeAuthorAnalysis ? { analysis: K(e.source, e.options, i) } : {},
|
|
1461
|
-
...e.options === void 0 ? {} : { options: e.options },
|
|
1462
|
-
...Z(e),
|
|
1463
|
-
metrics: { queueMs: G(t - e.scheduledAt) }
|
|
1464
|
-
}), this.finishRun();
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
isCurrentJob(e) {
|
|
1468
|
-
return !this.disposed && e.sourceRevision === this.currentSourceRevision;
|
|
1469
|
-
}
|
|
1470
|
-
receive(e) {
|
|
1471
|
-
if (this.disposed) return;
|
|
1472
|
-
let t = this.inFlight;
|
|
1473
|
-
if (!e) return;
|
|
1474
|
-
if (t && e.id === t.id && (e.requestId !== void 0 && e.requestId !== t.id || e.traceId !== void 0 && e.traceId !== t.traceId || e.sourceRevision !== void 0 && e.sourceRevision !== t.sourceRevision)) {
|
|
1475
|
-
this.reportStale(t.id, t.traceId, t.sourceRevision, this.queued?.sourceRevision), this.handleWorkerFailure("The compile worker returned a response with a mismatched request context.");
|
|
1476
|
-
return;
|
|
1477
|
-
}
|
|
1478
|
-
if (!t || e.id !== t.id) {
|
|
1479
|
-
if (Number.isSafeInteger(e.id) && e.id > 0 && this.obsoleteRequestIds.has(e.id)) {
|
|
1480
|
-
let t = this.requestContexts.get(e.id);
|
|
1481
|
-
t && this.reportStale(e.id, t.traceId, t.sourceRevision, this.queued?.sourceRevision);
|
|
1482
|
-
}
|
|
1483
|
-
return;
|
|
1484
|
-
}
|
|
1485
|
-
this.timeout !== null && clearTimeout(this.timeout), this.timeout = null;
|
|
1486
|
-
let n, r = 0;
|
|
1487
|
-
if (e.ok && "flatResult" in e) {
|
|
1488
|
-
let t = W(), i = mt(e.flatResult);
|
|
1489
|
-
r = G(W() - t), n = Mt(i) ? {
|
|
1490
|
-
...e,
|
|
1491
|
-
result: i
|
|
1492
|
-
} : {
|
|
1493
|
-
id: e.id,
|
|
1494
|
-
ok: !1,
|
|
1495
|
-
retryFull: !0,
|
|
1496
|
-
message: "Invalid flat compile result"
|
|
1497
|
-
};
|
|
1498
|
-
} else n = e;
|
|
1499
|
-
this.inFlight = null;
|
|
1500
|
-
let i = t.job, a = G(W() - t.startedAt), o = G(t.startedAt - i.scheduledAt), s = null, c = r, l = null, u = "worker", d;
|
|
1501
|
-
if (n.ok) {
|
|
1502
|
-
if (Nt(n)) {
|
|
1503
|
-
let e = W(), t = this.applyResponsePatch(i, n);
|
|
1504
|
-
c = G(W() - e), t !== null && (s = t, d = n.revision);
|
|
1505
|
-
} else {
|
|
1506
|
-
let e = n;
|
|
1507
|
-
Mt(e.result) ? (s = e.result, d = typeof e.revision == "number" ? e.revision : void 0, i.sourcePhase === "streaming" || e.sourcePhase === "streaming" ? this.baseline = null : e.protocol === "patch-v1" && typeof e.revision == "number" && Number.isSafeInteger(e.revision) ? (this.patchState = "enabled", this.baseline = e.result.ok ? {
|
|
1508
|
-
source: i.source,
|
|
1509
|
-
optionsKey: i.optionsKey,
|
|
1510
|
-
revision: e.revision,
|
|
1511
|
-
result: e.result
|
|
1512
|
-
} : null) : (this.patchState = "legacy", this.baseline = null)) : l = "The compile worker returned an invalid result";
|
|
1513
|
-
}
|
|
1514
|
-
} else n.retryFull !== !0 && (l = n.message);
|
|
1515
|
-
let f = this.queued, p = f !== null && !X(f, i);
|
|
1516
|
-
if (l === null ? this.traceWorker(t, "worker-response", {
|
|
1517
|
-
durationMs: a,
|
|
1518
|
-
status: s ? s.ok ? "ok" : "failed" : l ? "failed" : "retry"
|
|
1519
|
-
}) : this.traceWorker(t, "worker-error", {
|
|
1520
|
-
durationMs: a,
|
|
1521
|
-
status: "failed",
|
|
1522
|
-
code: "local.worker.compile"
|
|
1523
|
-
}), !this.disposed) {
|
|
1524
|
-
if (p && (this.obsoleteRequestIds.add(t.id), this.reportStale(t.id, t.traceId, t.sourceRevision, f.sourceRevision)), f !== null && !p && this.queued === f && (this.queued = null, this.clearTimer(), this.currentSourceRevision = i.sourceRevision), s !== null) p || this.deliver(i, {
|
|
1525
|
-
source: i.source,
|
|
1526
|
-
result: s,
|
|
1527
|
-
duration: G(n.ok ? n.duration : 0),
|
|
1528
|
-
mode: u,
|
|
1529
|
-
...n.ok && this.options.includeAuthorAnalysis && Ot(n.analysis, i.source.length) ? { analysis: n.analysis } : {},
|
|
1530
|
-
...i.options === void 0 ? {} : { options: i.options },
|
|
1531
|
-
...Z(i),
|
|
1532
|
-
metrics: {
|
|
1533
|
-
queueMs: o,
|
|
1534
|
-
roundTripMs: a,
|
|
1535
|
-
...c > 0 ? { applyMs: c } : {},
|
|
1536
|
-
...n.ok && n.metrics ? { worker: n.metrics } : {}
|
|
1537
|
-
},
|
|
1538
|
-
...d === void 0 ? {} : { revision: d }
|
|
1539
|
-
}), this.finishRun();
|
|
1540
|
-
else if (l !== null) p || this.deliver(i, {
|
|
1541
|
-
source: i.source,
|
|
1542
|
-
result: Q(i, $(l)),
|
|
1543
|
-
duration: 0,
|
|
1544
|
-
mode: u,
|
|
1545
|
-
...i.options === void 0 ? {} : { options: i.options },
|
|
1546
|
-
...Z(i),
|
|
1547
|
-
metrics: {
|
|
1548
|
-
queueMs: o,
|
|
1549
|
-
roundTripMs: a
|
|
1550
|
-
}
|
|
1551
|
-
}), this.finishRun();
|
|
1552
|
-
else {
|
|
1553
|
-
if (p) this.inFlight === null && this.resetProtocol();
|
|
1554
|
-
else {
|
|
1555
|
-
let e = this.recoverWithFullResult(i);
|
|
1556
|
-
if (e === "dispatched") return;
|
|
1557
|
-
e !== "abandoned" && (this.patchState = "disabled", this.baseline = null, this.deliver(i, {
|
|
1558
|
-
source: i.source,
|
|
1559
|
-
result: Q(i, $("The compile worker could not apply an incremental result patch")),
|
|
1560
|
-
duration: 0,
|
|
1561
|
-
mode: u,
|
|
1562
|
-
...i.options === void 0 ? {} : { options: i.options },
|
|
1563
|
-
...Z(i),
|
|
1564
|
-
metrics: {
|
|
1565
|
-
queueMs: o,
|
|
1566
|
-
roundTripMs: a,
|
|
1567
|
-
...c > 0 ? { applyMs: c } : {}
|
|
1568
|
-
}
|
|
1569
|
-
}));
|
|
1570
|
-
}
|
|
1571
|
-
this.finishRun();
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
applyResponsePatch(e, t) {
|
|
1576
|
-
if (e.sourcePhase !== "final") return null;
|
|
1577
|
-
let n = this.baseline;
|
|
1578
|
-
if (n === null || n.optionsKey !== e.optionsKey || !Number.isSafeInteger(t.revision) || t.revision <= n.revision || t.baseRevision !== n.revision || t.protocol !== "patch-v1") return null;
|
|
1579
|
-
let r = dt(n.result, t.patch);
|
|
1580
|
-
if (r === null || !r.ok || r.document.source !== e.source) return null;
|
|
1581
|
-
let i;
|
|
1582
|
-
if (e.sourcePhase === "final" && e.explicitPhase) i = r.recoveries === void 0 ? {
|
|
1583
|
-
...r,
|
|
1584
|
-
status: "valid"
|
|
1585
|
-
} : {
|
|
1586
|
-
...r,
|
|
1587
|
-
status: "recovered"
|
|
1588
|
-
};
|
|
1589
|
-
else if (r.ok && r.status !== void 0) {
|
|
1590
|
-
let e = { ...r };
|
|
1591
|
-
delete e.status, i = e;
|
|
1592
|
-
} else i = r;
|
|
1593
|
-
return this.baseline = {
|
|
1594
|
-
source: e.source,
|
|
1595
|
-
optionsKey: e.optionsKey,
|
|
1596
|
-
revision: t.revision,
|
|
1597
|
-
result: i
|
|
1598
|
-
}, i;
|
|
1599
|
-
}
|
|
1600
|
-
recoverWithFullResult(e) {
|
|
1601
|
-
return this.worker === null || (e.recovery ?? 0) >= 1 ? "spent" : this.disposed || this.inFlight !== null || !this.isCurrentJob(e) ? "abandoned" : (this.resetProtocol(), this.compile({
|
|
1602
|
-
...e,
|
|
1603
|
-
recovery: (e.recovery ?? 0) + 1
|
|
1604
|
-
}), "dispatched");
|
|
1605
|
-
}
|
|
1606
|
-
handleWorkerFailure(e, t = {
|
|
1607
|
-
...O("local.worker.error"),
|
|
1608
|
-
recoverable: !0
|
|
1609
|
-
}) {
|
|
1610
|
-
if (this.disposed) return;
|
|
1611
|
-
this.timeout !== null && clearTimeout(this.timeout), this.timeout = null, this.resetProtocol();
|
|
1612
|
-
let n = this.inFlight;
|
|
1613
|
-
this.inFlight = null, n && this.obsoleteRequestIds.add(n.id), this.degrade(e), !this.disposed && (n && this.traceWorker(n, t.code === "local.worker.timeout" ? "worker-timeout" : "worker-error", {
|
|
1614
|
-
code: t.code,
|
|
1615
|
-
durationMs: G(W() - n.startedAt)
|
|
1616
|
-
}), !this.disposed && (w(this.options.observer, t), !this.disposed && (n && (this.queued === null || X(this.queued, n.job)) && (this.queued !== null && (this.queued = null, this.clearTimer(), this.currentSourceRevision = n.job.sourceRevision), this.compileFallback(n.job)), this.finishRun())));
|
|
1617
|
-
}
|
|
1618
|
-
degrade(e) {
|
|
1619
|
-
let t = this.worker;
|
|
1620
|
-
if (t) {
|
|
1621
|
-
this.worker = null, t.onmessage = null, t.onerror = null, t.onmessageerror = null;
|
|
1622
|
-
try {
|
|
1623
|
-
t.terminate();
|
|
1624
|
-
} catch {}
|
|
1625
|
-
this.options.onModeChange?.("fallback", e);
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
resetProtocol() {
|
|
1629
|
-
this.baseline = null, this.patchState = "unknown";
|
|
1630
|
-
}
|
|
1631
|
-
finishRun() {
|
|
1632
|
-
this.disposed || (this.drain(), !this.disposed && this.setPending(this.timer !== null || this.inFlight !== null || this.queued !== null));
|
|
1633
|
-
}
|
|
1634
|
-
deliver(e, t) {
|
|
1635
|
-
if (!this.isCurrentJob(e)) return;
|
|
1636
|
-
let n = this.baseline !== null && this.baseline.result === t.result, r = this.options.shareResults === !0 || !n ? t.result : F(t.result);
|
|
1637
|
-
for (let t of [...r.diagnostics, ...r.transientDiagnostics ?? []]) {
|
|
1638
|
-
if (!this.isCurrentJob(e)) return;
|
|
1639
|
-
w(this.options.observer, t);
|
|
1640
|
-
}
|
|
1641
|
-
this.isCurrentJob(e) && this.options.onResult({
|
|
1642
|
-
...t,
|
|
1643
|
-
result: r
|
|
1644
|
-
});
|
|
1645
|
-
}
|
|
1646
|
-
traceWorker(e, t, n = {}) {
|
|
1647
|
-
T(this.options.observer, {
|
|
1648
|
-
type: t,
|
|
1649
|
-
traceId: e.traceId,
|
|
1650
|
-
requestId: e.id,
|
|
1651
|
-
sourceRevision: e.sourceRevision,
|
|
1652
|
-
timestamp: Date.now(),
|
|
1653
|
-
...n
|
|
1654
|
-
});
|
|
1655
|
-
}
|
|
1656
|
-
reportStale(e, t, n, r) {
|
|
1657
|
-
if (this.disposed || this.reportedStaleRequestIds.has(e)) return;
|
|
1658
|
-
this.reportedStaleRequestIds.add(e);
|
|
1659
|
-
let i = "local.worker.stale-response", a = {
|
|
1660
|
-
...O(i, {
|
|
1661
|
-
requestId: e,
|
|
1662
|
-
sourceRevision: n,
|
|
1663
|
-
...r === void 0 ? {} : { currentRevision: r }
|
|
1664
|
-
}),
|
|
1665
|
-
phase: "worker"
|
|
1666
|
-
};
|
|
1667
|
-
T(this.options.observer, {
|
|
1668
|
-
type: "worker-stale-response",
|
|
1669
|
-
traceId: t,
|
|
1670
|
-
requestId: e,
|
|
1671
|
-
sourceRevision: n,
|
|
1672
|
-
timestamp: Date.now(),
|
|
1673
|
-
code: i
|
|
1674
|
-
}), !this.disposed && w(this.options.observer, a);
|
|
1675
|
-
}
|
|
1676
|
-
setPending(e) {
|
|
1677
|
-
this.pending !== e && (this.pending = e, this.options.onPendingChange?.(e));
|
|
1678
|
-
}
|
|
1679
|
-
clearTimer() {
|
|
1680
|
-
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
1681
|
-
}
|
|
1682
|
-
};
|
|
1683
|
-
export { g as DEFAULT_LOCAL_THEME, ht as LOCAL_COMPILE_DELAY_MS, gt as LOCAL_COMPILE_PREPARATION_DELAY_MS, a as LOCAL_DIAGNOSTIC_CODES, p as LOCAL_OBSERVABILITY_MESSAGES, k as LOCAL_RESULT_PATCH_PROTOCOL, xe as LOCAL_STATE_FORMAT, C as LOCAL_SYNTAX_VERSION, d as LOCAL_THEME_PROTOCOL, It as LocalCompileScheduler, ce as LocalCompileSession, y as LocalExpressionError, ke as SHAREABLE_HTML_FORMAT, Ee as SHAREABLE_HTML_FORMAT_V2, se as analyzeLocalSource, dt as applyLocalResultPatch, De as applyLocalState, le as applyLocalStateRetention, qe as applySourceEdit, Ue as checkLocalUpgrade, b as compileExpression, $ as compileFailureDiagnostic, n as compileLatex, re as compileLocal, t as compilePlotFormula, ae as completeLocalSource, i as countLocalCodePoints, Me as createDiagnosticReport, D as createLocalCompileSession, O as createLocalObservabilityDiagnostic, de as createLocalRuntime, Te as createLocalStateFile, ne as createLocalTraceId, Oe as createShareableHtml, I as diffSourceEdit, w as emitLocalDiagnostic, T as emitLocalTrace, it as encodeLocalResultPatch, Ce as exportLocalState, h as formatLocalDiagnostic, oe as formatLocalSource, u as formatObservabilityMessage, e as implicitGridSize, Se as importLocalState, Be as inspectLocalSourceVersion, o as isLocalDiagnosticCode, m as isLocalThemeName, te as localCompileOptionsKey, _ as localDiagnosticTemplate, s as localDiagnosticTemplateKeys, me as localSourceDigest, q as localWorkerOptionsKey, We as migrateLocalSource, pe as notifyLocalRuntime, ye as parseLocalState, fe as planLocalStateRetention, r as plotFormulaKind, ie as renameLocalBinding, Ne as resolveLocalComponentStateExport, Ae as resolveLocalState, we as resolveLocalStateBaseline, c as resolveLocalTheme, ve as sampleImplicit, ge as sampleParametric, _e as samplePlot, he as samplePolar, be as serializeForScript, je as serializeLocalState, Dt as startLocalCompileWorker, ue as updateLocalRuntime };
|
|
217
|
+
export { te as DEFAULT_LOCAL_THEME, F as LOCAL_COMPILE_DELAY_MS, U as LOCAL_COMPILE_PREPARATION_DELAY_MS, a as LOCAL_DIAGNOSTIC_CODES, p as LOCAL_OBSERVABILITY_MESSAGES, V as LOCAL_RESULT_PATCH_PROTOCOL, le as LOCAL_STATE_FORMAT, _ as LOCAL_SYNTAX_VERSION, d as LOCAL_THEME_PROTOCOL, W as LocalCompileScheduler, D as LocalCompileSession, g as LocalExpressionError, _e as SHAREABLE_HTML_FORMAT, me as SHAREABLE_HTML_FORMAT_V2, w as analyzeLocalSource, z as applyLocalResultPatch, he as applyLocalState, k as applyLocalStateRetention, R as applySourceEdit, ke as checkLocalUpgrade, ne as compileExpression, H as compileFailureDiagnostic, n as compileLatex, v as compileLocal, t as compilePlotFormula, S as completeLocalSource, i as countLocalCodePoints, xe as createDiagnosticReport, E as createLocalCompileSession, be as createLocalObservabilityDiagnostic, j as createLocalRuntime, we as createLocalRuntimePool, pe as createLocalStateFile, b as createLocalTraceId, ge as createShareableHtml, G as diffSourceEdit, ie as emitLocalDiagnostic, y as emitLocalTrace, K as encodeLocalResultPatch, de as exportLocalState, ee as formatLocalDiagnostic, C as formatLocalSource, u as formatObservabilityMessage, e as implicitGridSize, ue as importLocalState, De as inspectLocalSourceVersion, o as isLocalDiagnosticCode, m as isLocalThemeName, O as localCompileCacheKey, re as localCompileOptionsKey, h as localDiagnosticTemplate, s as localDiagnosticTemplateKeys, P as localSourceDigest, L as localWorkerOptionsKey, Ae as migrateLocalSource, N as notifyLocalRuntime, se as parseLocalState, M as planLocalStateRetention, r as plotFormulaKind, x as renameLocalBinding, Se as resolveLocalComponentStateExport, ve as resolveLocalState, fe as resolveLocalStateBaseline, c as resolveLocalTheme, oe as sampleImplicit, q as sampleParametric, J as samplePlot, ae as samplePolar, ce as serializeForScript, ye as serializeLocalState, B as startLocalCompileWorker, A as updateLocalRuntime };
|