reactive-md 0.8.0 → 0.9.1
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 +54 -4
- package/CHANGELOG.md +55 -4
- package/CONTRIBUTING-ch.md +13 -2
- package/CONTRIBUTING.md +13 -2
- package/README-ch.md +132 -23
- package/README-en.md +130 -21
- package/README.md +128 -21
- package/SECURITY-ch.md +3 -3
- package/SECURITY.md +3 -3
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/cli/args.mjs +51 -1
- package/cli/assets.mjs +6 -1
- package/cli/build.mjs +125 -9
- package/cli/fs-utils.mjs +3 -3
- package/cli/help.mjs +12 -5
- package/cli/init.mjs +1 -1
- package/cli/package.mjs +1 -0
- package/dist-library/LocalDocumentView-sthUP0ct.js +109 -0
- package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
- package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
- package/dist-library/{authoring-BsfSwQRm.js → authoring-Dsune4Hy.js} +240 -218
- package/dist-library/compile-wUv8KEge.js +1249 -0
- package/dist-library/{compiler-core-kPiH-gOV.js → compiler-core-As_m-MNm.js} +5372 -5559
- package/dist-library/compiler-eOfcinZs.js +62 -0
- package/dist-library/component-state-BoLCGee4.js +801 -0
- package/dist-library/{component-state-D_cw_EHe.js → component-state-C52ZFJGl.js} +2 -2
- package/dist-library/{registry-B9Jc3FVe.js → config-BadfhjdP.js} +374 -457
- package/dist-library/{config-validation-DXTynAw7.js → config-validation-F47AcE6o.js} +549 -751
- package/dist-library/controls-CcT6n7k_.js +6740 -0
- package/dist-library/coordinate-CWS9p5q_.js +293 -0
- package/dist-library/data-table-Bgccxd7h.js +296 -0
- package/dist-library/{default-components-Z_YMio5P.js → default-components-BwQf0oP-.js} +344 -334
- package/dist-library/{math-display-BJz4gbFc.js → display-B-VhqVND.js} +1299 -1299
- package/dist-library/export-BqVmTXm8.js +369 -0
- package/dist-library/gallery-CY6mTx8i.js +360 -0
- package/dist-library/html-CNT4KD-2.js +757 -0
- package/dist-library/{math-sample-BGEW49zY.js → incremental-Dv0FSp_U.js} +476 -394
- package/dist-library/latex-1w7aQgD5.js +928 -0
- package/dist-library/layout-C0YlEPGr.js +562 -0
- package/dist-library/mount-preset-KxvtKgJb.js +13 -0
- package/dist-library/options-1aDLK7JY.js +121 -0
- package/dist-library/{react-ByOHunUW.js → package-core-WFK1RhAZ.js} +49 -55
- package/dist-library/{parser-standard-DlCk7sLo.js → parser-standard-Yuf3A_VI.js} +6605 -7097
- package/dist-library/plugin-packs-B1XPWcFs.js +18 -0
- package/dist-library/{identity-MYJXKSkB.js → preset-core-CKc5YXSM.js} +31 -31
- package/dist-library/{props-DGlBk0e5.js → props-sJ8vk0cr.js} +1 -1
- package/dist-library/react-BbyAgeXc.js +6070 -0
- package/dist-library/react-D5iGiUdL.js +7 -0
- package/dist-library/reactive-md-authoring.js +222 -223
- package/dist-library/reactive-md-build.js +126 -72
- package/dist-library/reactive-md-compiler-standard.js +12 -10
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-default-packs.js +2 -2
- package/dist-library/reactive-md-default-preset.js +4 -4
- package/dist-library/reactive-md-export-assets.js +57 -0
- package/dist-library/reactive-md-export.js +5 -111
- package/dist-library/reactive-md-minimal-preset.js +24 -0
- package/dist-library/reactive-md-minimal-react-preset.js +26 -0
- package/dist-library/reactive-md-minimal-styles.js +80 -0
- package/dist-library/reactive-md-minimal.css +2 -0
- package/dist-library/reactive-md-pdf.js +7582 -0
- package/dist-library/reactive-md-plugin-chart.js +13 -0
- package/dist-library/reactive-md-plugin-data.js +17 -0
- package/dist-library/reactive-md-plugin-diagram.js +18 -0
- package/dist-library/reactive-md-plugin-forms.js +18 -0
- package/dist-library/reactive-md-plugin-gallery.js +12 -0
- package/dist-library/reactive-md-plugin-navigation.js +15 -0
- package/dist-library/reactive-md-plugin-network.js +222 -0
- package/dist-library/reactive-md-plugin-plot.js +24 -0
- package/dist-library/reactive-md-print.css +5 -0
- package/dist-library/reactive-md-react-minimal.js +28 -0
- package/dist-library/reactive-md-react-server.js +34 -32
- package/dist-library/reactive-md-react-unstyled.js +14 -9
- package/dist-library/reactive-md-react.js +14 -9
- package/dist-library/reactive-md-runtime-browser.js +847 -15
- package/dist-library/reactive-md-runtime.js +3 -3
- package/dist-library/reactive-md-sdk.js +8 -6
- package/dist-library/reactive-md-standalone-configured.js +16 -0
- package/dist-library/reactive-md-standalone-host.js +9 -438
- package/dist-library/reactive-md-testing-browser.js +5 -4
- package/dist-library/reactive-md-testing-react.js +46 -44
- package/dist-library/reactive-md-testing.js +45 -44
- package/dist-library/reactive-md-vite.js +135 -37
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +590 -498
- package/dist-library/registry-B9NGct4d.js +20 -0
- package/dist-library/registry-core-Bbad9Bm2.js +479 -0
- package/dist-library/{resources-BGt8mpDA.js → resources-D2GDQS0p.js} +45 -45
- package/dist-library/{runtime-Dkq7ldyg.js → runtime-B2fxeveq.js} +1 -1
- package/dist-library/runtime-kcA7bG7G.js +1282 -0
- package/dist-library/sample-bP4zHB3L.js +289 -0
- package/dist-library/{schema-ZFufO8V0.js → schema-BufhKUSM.js} +12 -11
- package/dist-library/sdk-core-BoJT1SIt.js +1166 -0
- package/dist-library/session-core-nmJHuR9c.js +452 -0
- package/dist-library/{shareable-DDVL4Fi9.js → shareable-DpbE-59H.js} +250 -283
- package/dist-library/tooltip-layer-HDLrSWs0.js +28 -0
- package/dist-library/types/authoring/catalog.d.ts +2 -3
- package/dist-library/types/authoring/editor-i18n.d.ts +1 -1
- package/dist-library/types/authoring/index.d.ts +1 -1
- package/dist-library/types/authoring/insert.d.ts +1 -1
- package/dist-library/types/authoring/templates.d.ts +2 -2
- package/dist-library/types/build/diagnostics.d.ts +1 -1
- package/dist-library/types/build/host.d.ts +1 -1
- package/dist-library/types/build/index.d.ts +1 -1
- package/dist-library/types/build/notices.d.ts +1 -1
- package/dist-library/types/build/resources.d.ts +1 -1
- package/dist-library/types/build/vite.d.ts +1 -1
- package/dist-library/types/compiler/index.d.ts +2 -2
- package/dist-library/types/compiler/result.d.ts +1 -1
- package/dist-library/types/compiler/standard.d.ts +2 -2
- package/dist-library/types/compiler/types.d.ts +1 -1
- package/dist-library/types/components/{controls.d.ts → controls/controls.d.ts} +2 -3
- package/dist-library/types/components/{numeric-sliders.d.ts → controls/numeric-sliders.d.ts} +1 -1
- package/dist-library/types/components/{gallery.d.ts → gallery/gallery.d.ts} +1 -1
- package/dist-library/types/components/{layout.d.ts → layout/layout.d.ts} +1 -1
- package/dist-library/types/components/minimal-preset.d.ts +2 -0
- package/dist-library/types/components/mount-preset.d.ts +4 -0
- package/dist-library/types/components/network/submit-button.d.ts +10 -0
- package/dist-library/types/components/plot/coordinate.d.ts +2 -0
- package/dist-library/types/components/plugins/chart.d.ts +2 -0
- package/dist-library/types/components/plugins/data.d.ts +2 -0
- package/dist-library/types/components/plugins/diagram.d.ts +2 -0
- package/dist-library/types/components/plugins/forms.d.ts +2 -0
- package/dist-library/types/components/plugins/gallery.d.ts +2 -0
- package/dist-library/types/components/plugins/navigation.d.ts +2 -0
- package/dist-library/types/components/plugins/network.d.ts +2 -0
- package/dist-library/types/components/plugins/plot.d.ts +2 -0
- package/dist-library/types/components/shared/visual-frame.d.ts +12 -0
- package/dist-library/types/components/{visuals.d.ts → shared/visuals.d.ts} +1 -7
- package/dist-library/types/components/{data-table.d.ts → table/data-table.d.ts} +2 -2
- package/dist-library/types/export/component-state.d.ts +1 -1
- package/dist-library/types/export/index.d.ts +2 -1
- package/dist-library/types/export/print-document.d.ts +18 -0
- package/dist-library/types/export/render-markup.d.ts +23 -0
- package/dist-library/types/export/requirements.d.ts +1 -1
- package/dist-library/types/export/resources.d.ts +1 -1
- package/dist-library/types/export/restoration.d.ts +1 -1
- package/dist-library/types/export-assets/index.d.ts +25 -0
- package/dist-library/types/local/compilation/compiler-attributes.d.ts +8 -0
- package/dist-library/types/local/compilation/compiler-bindings.d.ts +19 -0
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
- package/dist-library/types/local/compilation/compiler-declarations.d.ts +32 -0
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +32 -0
- package/dist-library/types/local/compilation/compiler-services.d.ts +62 -16
- package/dist-library/types/local/compilation/compiler-structure.d.ts +38 -3
- package/dist-library/types/local/compilation/compiler-tables.d.ts +30 -0
- package/dist-library/types/local/compilation/compiler-validation.d.ts +15 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +39 -1
- package/dist-library/types/local/compilation/compiler.d.ts +7 -14
- package/dist-library/types/local/compilation/dependencies.d.ts +1 -1
- package/dist-library/types/local/compilation/session/incremental.d.ts +75 -0
- package/dist-library/types/local/{session → compilation/session}/row-reuse.d.ts +1 -1
- package/dist-library/types/local/{session/compiler-cache.d.ts → compilation/session/semantic-cache.d.ts} +5 -19
- package/dist-library/types/local/compilation/streaming.d.ts +27 -0
- package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
- package/dist-library/types/local/{compilation → configuration}/component-kernel.d.ts +3 -79
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +1104 -1056
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +731 -0
- package/dist-library/types/local/configuration/diagnostics.d.ts +1 -1
- package/dist-library/types/local/configuration/kernel-value-rules.d.ts +66 -0
- package/dist-library/types/local/configuration/official-leaf-syntax.d.ts +24 -0
- package/dist-library/types/local/configuration/options-core.d.ts +5 -4
- package/dist-library/types/local/configuration/options.d.ts +2 -1
- package/dist-library/types/local/configuration/portable-options.d.ts +1 -1
- package/dist-library/types/local/configuration/schema-core.d.ts +1 -1
- package/dist-library/types/local/configuration/schema.d.ts +1 -1
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/evaluation/computations.d.ts +2 -2
- package/dist-library/types/local/evaluation/expression/compile.d.ts +30 -0
- package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -0
- package/dist-library/types/local/evaluation/expression/inference.d.ts +4 -0
- package/dist-library/types/local/evaluation/expression/syntax.d.ts +72 -0
- package/dist-library/types/local/evaluation/expression/values.d.ts +56 -0
- package/dist-library/types/local/evaluation/{math-display.d.ts → math/display.d.ts} +2 -2
- package/dist-library/types/local/evaluation/math/evaluation.d.ts +10 -0
- package/dist-library/types/local/evaluation/{math.d.ts → math/latex.d.ts} +58 -17
- package/dist-library/types/local/evaluation/{math-sample.d.ts → math/sample.d.ts} +4 -2
- package/dist-library/types/local/evaluation/math/syntax.d.ts +72 -0
- package/dist-library/types/local/evaluation/validation.d.ts +1 -1
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html-details.d.ts +1 -1
- package/dist-library/types/local/html/html-entities.d.ts +11 -2
- package/dist-library/types/local/html/html-recovery.d.ts +1 -1
- package/dist-library/types/local/html/html-table.d.ts +1 -1
- package/dist-library/types/local/html/html.d.ts +40 -4
- package/dist-library/types/local/index.d.ts +14 -13
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/{markdown → parsing}/fast-markdown.d.ts +1 -1
- package/dist-library/types/local/{markdown → parsing}/footnotes.d.ts +1 -1
- package/dist-library/types/local/{markdown → parsing}/heading-anchors.d.ts +1 -1
- package/dist-library/types/local/parsing/html-attributes.d.ts +14 -0
- package/dist-library/types/local/parsing/parse-budget.d.ts +1 -1
- package/dist-library/types/local/{session → parsing}/parse-session.d.ts +5 -5
- package/dist-library/types/local/parsing/parser-capabilities.d.ts +7 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +26 -0
- package/dist-library/types/local/parsing/parser-core.d.ts +10 -4
- package/dist-library/types/local/parsing/parser-internals.d.ts +54 -0
- package/dist-library/types/local/parsing/parser-region.d.ts +46 -0
- package/dist-library/types/local/parsing/parser-standard.d.ts +3 -0
- package/dist-library/types/local/parsing/parser-tags.d.ts +108 -0
- package/dist-library/types/local/parsing/parser.d.ts +3 -3
- package/dist-library/types/local/{markdown → parsing}/plain-paragraphs.d.ts +1 -1
- package/dist-library/types/local/parsing/rmd-recovery.d.ts +1 -1
- package/dist-library/types/local/parsing/theme-declaration.d.ts +22 -0
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentView.d.ts +5 -0
- package/dist-library/types/local/rendering/{LocalDocumentView.d.ts → document/LocalDocumentViewCore.d.ts} +48 -9
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +6 -0
- package/dist-library/types/local/rendering/document/render-nodes.d.ts +24 -0
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/use-color-scheme.d.ts +10 -0
- package/dist-library/types/local/rendering/document/validation-state.d.ts +31 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +146 -0
- package/dist-library/types/local/rendering/{view-revision.d.ts → document/view-revision.d.ts} +31 -4
- package/dist-library/types/local/rendering/render-types.d.ts +1 -1
- package/dist-library/types/local/{widgets/table-surface.d.ts → rendering/table/data-table.d.ts} +3 -0
- package/dist-library/types/local/rendering/table/table-numeric-columns.d.ts +7 -0
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/runtime/retention.d.ts +1 -1
- package/dist-library/types/local/runtime/runtime-document.d.ts +71 -0
- package/dist-library/types/local/runtime/runtime-migration.d.ts +19 -0
- package/dist-library/types/local/runtime/runtime-values.d.ts +39 -0
- package/dist-library/types/local/runtime/runtime.d.ts +4 -2
- package/dist-library/types/local/runtime/state.d.ts +1 -1
- package/dist-library/types/local/source/authoring-syntax.d.ts +48 -0
- package/dist-library/types/local/source/authoring.d.ts +1 -1
- package/dist-library/types/local/source/source-context.d.ts +23 -0
- package/dist-library/types/local/source/source-migration.d.ts +2 -2
- package/dist-library/types/local/transport/compile-patch.d.ts +1 -1
- package/dist-library/types/local/transport/flat-compiled-data.d.ts +1 -1
- package/dist-library/types/local/transport/shared-data.d.ts +1 -1
- package/dist-library/types/local/transport/worker-handler.d.ts +30 -0
- package/dist-library/types/local/transport/worker-job.d.ts +28 -0
- package/dist-library/types/local/transport/worker.d.ts +32 -46
- package/dist-library/types/local/{contracts/types.d.ts → types.d.ts} +78 -21
- package/dist-library/types/pdf.d.ts +22 -0
- package/dist-library/types/presets/identity.d.ts +1 -0
- package/dist-library/types/presets/minimal.d.ts +2 -0
- package/dist-library/types/presets/plugin-packs.d.ts +1 -0
- package/dist-library/types/react/component-api.d.ts +20 -4
- package/dist-library/types/react/component-primitives.d.ts +10 -10
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/index.d.ts +6 -5
- package/dist-library/types/{local/theme/i18n.d.ts → react/localization.d.ts} +2 -2
- package/dist-library/types/react/minimal.d.ts +13 -0
- package/dist-library/types/react/package-core.d.ts +67 -0
- package/dist-library/types/react/package.d.ts +3 -67
- package/dist-library/types/react/runtime/common.d.ts +1 -1
- package/dist-library/types/react/sdk-core.d.ts +115 -0
- package/dist-library/types/react/sdk.d.ts +4 -110
- package/dist-library/types/react/server.d.ts +2 -2
- package/dist-library/types/react/use-draft-field.d.ts +5 -1
- package/dist-library/types/runtime-services/browser/duplex.d.ts +163 -0
- package/dist-library/types/runtime-services/browser/http-sse.d.ts +117 -0
- package/dist-library/types/runtime-services/browser/index.d.ts +2 -1
- package/dist-library/types/runtime-services/component-state.d.ts +1 -1
- package/dist-library/types/runtime-services/index.d.ts +2 -0
- package/dist-library/types/runtime-services/network.d.ts +86 -0
- package/dist-library/types/runtime-services/runtime.d.ts +1 -1
- package/dist-library/types/sdk/config.d.ts +1 -1
- package/dist-library/types/sdk/index.d.ts +1 -0
- package/dist-library/types/sdk/props.d.ts +1 -1
- package/dist-library/types/sdk/registry-core.d.ts +1 -1
- package/dist-library/types/sdk/theme.d.ts +5 -4
- package/dist-library/types/sdk/types.d.ts +2 -2
- package/dist-library/types/shareable.d.ts +6 -5
- package/dist-library/types/standalone/diagnostics.d.ts +1 -1
- package/dist-library/types/standalone/host.d.ts +5 -0
- package/dist-library/types/standalone/payload.d.ts +1 -1
- package/dist-library/types/standalone/prepare.d.ts +2 -2
- package/dist-library/types/standalone/session-core.d.ts +68 -0
- package/dist-library/types/standalone/session.d.ts +6 -68
- package/dist-library/types/themes/contract.d.ts +7 -0
- package/dist-library/types/{local/theme/theme.d.ts → themes/document-theme.d.ts} +4 -3
- package/dist-library/types/vite/client.d.ts +19 -0
- package/dist-library/types/vite/index.d.ts +18 -3
- package/dist-library/types/vite/registration.d.ts +2 -2
- package/dist-library/{types-BFCrMrg0.js → types-BeNtPqdY.js} +1 -1
- package/dist-library/validation-BEBA_HvS.js +1121 -0
- package/dist-library/visual-frame-CyV1FXzs.js +48 -0
- package/dist-library/visuals-B5KSafVk.js +3 -0
- package/dist-library/visuals-BZbZYA7w.js +72572 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +146 -137
- package/docs/README-ch.md +16 -11
- package/docs/README.md +16 -11
- package/docs/compatibility/compatibility-ch.md +8 -8
- package/docs/compatibility/compatibility-en.md +8 -8
- package/docs/compatibility/source-versioning-ch.md +1 -1
- package/docs/compatibility/source-versioning-en.md +1 -1
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-development-reference-ch.md +4 -4
- package/docs/development/component-development-reference-en.md +4 -4
- package/docs/development/component-protocol-ch.md +14 -14
- package/docs/development/component-protocol-en.md +14 -14
- package/docs/development/extension-tutorial-ch.md +308 -0
- package/docs/development/extension-tutorial-en.md +308 -0
- package/docs/development/local-module-layout-ch.md +10 -50
- package/docs/development/local-module-layout-en.md +9 -49
- package/docs/development/performance-overview-ch.md +174 -154
- package/docs/development/performance-overview-en.md +174 -154
- package/docs/guides/local-guide-ch.md +2 -2
- package/docs/guides/local-guide-en.md +2 -2
- package/docs/integration/author-tools-ch.md +2 -2
- package/docs/integration/author-tools-en.md +2 -2
- package/docs/integration/compiler-ch.md +4 -2
- package/docs/integration/compiler-en.md +4 -2
- package/docs/integration/directory-discovery-ch.md +5 -1
- package/docs/integration/directory-discovery-en.md +5 -1
- package/docs/integration/editor-ch.md +35 -5
- package/docs/integration/editor-en.md +42 -4
- package/docs/integration/extension-sdk-ch.md +6 -4
- package/docs/integration/extension-sdk-en.md +6 -4
- package/docs/integration/local-integration-ch.md +201 -19
- package/docs/integration/local-integration-en.md +194 -18
- package/docs/integration/network-host-ch.md +75 -0
- package/docs/integration/network-host-en.md +75 -0
- package/docs/integration/shareable-export-ch.md +58 -16
- package/docs/integration/shareable-export-en.md +57 -15
- package/docs/reference/html-compatibility-ch.md +20 -67
- package/docs/reference/html-compatibility-en.md +19 -64
- package/docs/reference/local-interaction-syntax-ch.md +199 -26
- package/docs/reference/local-interaction-syntax-en.md +194 -27
- package/docs/reference/public-api-ch.md +416 -0
- package/docs/reference/public-api-en.md +416 -0
- package/docs/reference/theme-protocol-ch.md +27 -8
- package/docs/reference/theme-protocol-en.md +46 -8
- package/docs/releases/release-0.4.0-ch.md +2 -2
- package/docs/releases/release-0.4.0-en.md +2 -2
- package/docs/releases/release-0.8.0-ch.md +19 -3
- package/docs/releases/release-0.8.0-en.md +19 -3
- package/docs/releases/release-0.9.0-ch.md +44 -0
- package/docs/releases/release-0.9.0-en.md +44 -0
- package/docs/releases/release-0.9.1-ch.md +29 -0
- package/docs/releases/release-0.9.1-en.md +29 -0
- package/examples/component-package/README-ch.md +1 -1
- package/examples/component-package/README.md +1 -1
- package/examples/conformance/README-ch.md +3 -3
- package/examples/conformance/README.md +3 -3
- package/examples/game-2048-package/README-ch.md +3 -9
- package/examples/game-2048-package/README.md +8 -12
- package/examples/integration/README-ch.md +21 -2
- package/examples/integration/README.md +21 -2
- package/examples/integration/extension-sdk/README-ch.md +1 -1
- package/examples/integration/extension-sdk/README.md +1 -1
- package/examples/integration/streaming/index.html +48 -0
- package/examples/integration/streaming/main.js +175 -0
- package/examples/integration/streaming/package.json +13 -0
- package/examples/integration/streaming/worker.js +3 -0
- package/examples/local/README-ch.md +3 -3
- package/examples/local/README.md +2 -2
- package/examples/local/minimal-budget.reactive.md +48 -0
- package/examples/minimal-extension/README-ch.md +78 -0
- package/examples/minimal-extension/README.md +78 -0
- package/examples/minimal-extension/index.html +15 -0
- package/examples/minimal-extension/package.json +26 -0
- package/examples/minimal-extension/sample/document.reactive.md +10 -0
- package/examples/minimal-extension/scripts/build.mjs +32 -0
- package/examples/minimal-extension/scripts/export.mjs +72 -0
- package/examples/minimal-extension/scripts/test-node.mjs +75 -0
- package/examples/minimal-extension/src/extension.tsx +90 -0
- package/examples/minimal-extension/src/preview.tsx +12 -0
- package/examples/minimal-extension/src/source.ts +4 -0
- package/examples/minimal-extension/tsconfig.json +14 -0
- package/examples/network-survey/README.md +200 -0
- package/examples/network-survey/index.html +49 -0
- package/examples/network-survey/package.json +26 -0
- package/examples/network-survey/sample/document.reactive.md +51 -0
- package/examples/network-survey/src/components.tsx +325 -0
- package/examples/network-survey/src/host.ts +316 -0
- package/examples/network-survey/src/main.tsx +91 -0
- package/examples/network-survey/src/source.ts +1 -0
- package/examples/network-survey/tsconfig.json +26 -0
- package/examples/network-survey/vite.config.ts +227 -0
- package/examples/sci-fi-theme/README-ch.md +4 -2
- package/examples/sci-fi-theme/README.md +4 -2
- package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -0
- package/examples/sci-fi-theme/demo/demo.css +129 -23
- package/examples/sci-fi-theme/demo/document.reactive.md +27 -6
- package/examples/sci-fi-theme/demo/main.tsx +45 -10
- package/examples/sci-fi-theme/docs/design-system-ch.md +6 -6
- package/examples/sci-fi-theme/package.json +2 -1
- package/examples/sci-fi-theme/src/components.css +1064 -154
- package/examples/sci-fi-theme/src/notch.css +142 -0
- package/examples/sci-fi-theme/src/sci-fi.css +3 -1
- package/examples/sci-fi-theme/src/theme.ts +2 -0
- package/examples/sci-fi-theme/src/tokens.css +512 -408
- package/examples/tetris-package/README-ch.md +4 -4
- package/examples/tetris-package/README.md +4 -4
- package/package.json +70 -3
- package/dist-library/LocalDocumentView-6trX7xJc.js +0 -97920
- package/dist-library/compiler--ea2CKQF.js +0 -61
- package/dist-library/component-state-Cq2K5gkS.js +0 -490
- package/dist-library/options-CX5m5n-J.js +0 -115
- package/dist-library/runtime-C-sbfpOX.js +0 -1157
- package/dist-library/types/local/contracts/locale.d.ts +0 -1
- package/dist-library/types/local/contracts/version.d.ts +0 -2
- package/dist-library/types/local/evaluation/dates.d.ts +0 -2
- package/dist-library/types/local/evaluation/expression.d.ts +0 -47
- package/dist-library/types/local/markdown/markdown-structure.d.ts +0 -3
- package/dist-library/types/local/rendering/legacy-component-adapter.d.ts +0 -36
- package/dist-library/types/local/session/incremental.d.ts +0 -48
- package/dist-library/types/local/source/node-walk.d.ts +0 -3
- package/dist-library/types/local/source/text-length.d.ts +0 -13
- package/dist-library/types/local/theme/theme-name.d.ts +0 -3
- package/dist-library/types/local/widgets/visuals.d.ts +0 -25
- package/dist-library/types/react/default-theme.d.ts +0 -6
- package/dist-library/validation-W-bmny-x.js +0 -2253
- package/docs/development/releasing-ch.md +0 -12
- package/docs/development/releasing-en.md +0 -12
- package/docs/integration/codemirror-ch.md +0 -52
- package/docs/integration/codemirror-en.md +0 -29
- package/docs/integration/repository-split-ch.md +0 -40
- package/docs/integration/repository-split-en.md +0 -23
- package/docs/reference/computations-formatting-ch.md +0 -89
- package/docs/reference/computations-formatting-en.md +0 -89
- package/docs/reference/constraints-collections-ch.md +0 -104
- package/docs/reference/constraints-collections-en.md +0 -104
- package/docs/reference/local-components-v2-ch.md +0 -140
- package/docs/reference/local-components-v2-en.md +0 -106
- package/docs/reference/tolerance-ch.md +0 -64
- package/docs/reference/tolerance-en.md +0 -57
- /package/dist-library/types/components/{chart-motion.d.ts → chart/chart-motion.d.ts} +0 -0
- /package/dist-library/types/components/{default-chart-types.d.ts → chart/default-chart-types.d.ts} +0 -0
- /package/dist-library/types/components/{default-chart.d.ts → chart/default-chart.d.ts} +0 -0
- /package/dist-library/types/components/{diagram-inspector.d.ts → diagram/diagram-inspector.d.ts} +0 -0
- /package/dist-library/types/{local/widgets/diagram-layout.d.ts → components/diagram/layout.d.ts} +0 -0
- /package/dist-library/types/components/{mafs-plot-grid.d.ts → plot/mafs-plot-grid.d.ts} +0 -0
- /package/dist-library/types/components/{mafs-visuals.d.ts → plot/mafs-visuals.d.ts} +0 -0
- /package/dist-library/types/components/{use-hydrated.d.ts → shared/use-hydrated.d.ts} +0 -0
- /package/dist-library/types/local/{theme/colors.d.ts → configuration/color-values.d.ts} +0 -0
- /package/dist-library/types/local/evaluation/{collection-functions.d.ts → expression/collection-functions.d.ts} +0 -0
- /package/dist-library/types/local/evaluation/{data-functions.d.ts → expression/data-functions.d.ts} +0 -0
- /package/dist-library/types/local/evaluation/{formatting.d.ts → expression/formatting.d.ts} +0 -0
- /package/dist-library/types/local/{markdown → parsing}/markdown-blocks.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering/code}/code-block.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering/code}/code-languages.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering/image}/image-view.d.ts +0 -0
- /package/dist-library/types/local/{widgets → rendering}/math-view.d.ts +0 -0
|
@@ -1,7 +1,839 @@
|
|
|
1
|
-
import { a as e, w as t } from "./component-state-
|
|
1
|
+
import { a as e, w as t } from "./component-state-BoLCGee4.js";
|
|
2
|
+
// src/runtime-services/browser/duplex.ts
|
|
3
|
+
var n = 15e3, r = 65536, i = Object.freeze({
|
|
4
|
+
code: "cancelled",
|
|
5
|
+
message: "The operation was cancelled."
|
|
6
|
+
}), a = Object.freeze({
|
|
7
|
+
code: "transport",
|
|
8
|
+
message: "The channel could not communicate with its endpoint."
|
|
9
|
+
}), o = Object.freeze({
|
|
10
|
+
code: "unconfirmed",
|
|
11
|
+
message: "The submission was sent but was not confirmed."
|
|
12
|
+
}), s = Object.freeze({
|
|
13
|
+
code: "invalid-data",
|
|
14
|
+
message: "The channel received invalid data."
|
|
15
|
+
}), c = Object.freeze([]), l = 2048, u = 16, d = 200, f = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/, p = /[\u0000-\u001f\u007f]/, m = /[\u0000-\u001f\u007f]+/g, h = {
|
|
16
|
+
setTimeout(e, t) {
|
|
17
|
+
return globalThis.setTimeout(e, t);
|
|
18
|
+
},
|
|
19
|
+
clearTimeout(e) {
|
|
20
|
+
globalThis.clearTimeout(e);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function g(e) {
|
|
24
|
+
return {
|
|
25
|
+
ok: !1,
|
|
26
|
+
error: e
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function _(e, t, n) {
|
|
30
|
+
if (e === void 0) return n;
|
|
31
|
+
if (typeof e != "number" || !Number.isSafeInteger(e) || e < 1) throw TypeError(`${t} must be a positive integer.`);
|
|
32
|
+
return e;
|
|
33
|
+
}
|
|
34
|
+
function v(e, t, n) {
|
|
35
|
+
if (e === void 0) return n;
|
|
36
|
+
if (typeof e != "number" || !Number.isSafeInteger(e) || e < 0) throw TypeError(`${t} must be a non-negative integer.`);
|
|
37
|
+
return e;
|
|
38
|
+
}
|
|
39
|
+
function y(e) {
|
|
40
|
+
if (e === void 0) return c;
|
|
41
|
+
let t = typeof e == "string" ? [e] : Array.isArray(e) ? e : void 0;
|
|
42
|
+
if (t === void 0 || t.length > u) throw TypeError(`protocols must be a string or an array of at most ${u} tokens.`);
|
|
43
|
+
let n = [];
|
|
44
|
+
for (let e of t) {
|
|
45
|
+
if (typeof e != "string" || !f.test(e)) throw TypeError("Each WebSocket subprotocol must be a non-empty HTTP token.");
|
|
46
|
+
if (n.includes(e)) throw TypeError("WebSocket subprotocols must be unique.");
|
|
47
|
+
n.push(e);
|
|
48
|
+
}
|
|
49
|
+
return Object.freeze(n);
|
|
50
|
+
}
|
|
51
|
+
function b(e) {
|
|
52
|
+
if (typeof e != "string" || e.length === 0 || e !== e.trim() || e.length > l) throw TypeError("endpoint must be a non-empty, trimmed ws: or wss: URL.");
|
|
53
|
+
let t;
|
|
54
|
+
try {
|
|
55
|
+
t = new URL(e);
|
|
56
|
+
} catch {
|
|
57
|
+
throw TypeError("endpoint must be an absolute ws: or wss: URL.");
|
|
58
|
+
}
|
|
59
|
+
if (t.protocol !== "ws:" && t.protocol !== "wss:") throw TypeError("endpoint must use the ws: or wss: protocol.");
|
|
60
|
+
return t.toString();
|
|
61
|
+
}
|
|
62
|
+
function x(e) {
|
|
63
|
+
if (typeof e != "string") throw TypeError("endpoint must be a non-empty signaling path.");
|
|
64
|
+
let t = e.trim();
|
|
65
|
+
if (t.length === 0 || t.length > l || p.test(t)) throw TypeError("endpoint must be a non-empty signaling path without control characters.");
|
|
66
|
+
return t;
|
|
67
|
+
}
|
|
68
|
+
function S(e) {
|
|
69
|
+
if (e === void 0 || e === !1) return;
|
|
70
|
+
if (e === !0) return {
|
|
71
|
+
delayMs: 1e3,
|
|
72
|
+
maxDelayMs: 3e4,
|
|
73
|
+
attempts: Infinity
|
|
74
|
+
};
|
|
75
|
+
if (typeof e != "object" || !e) throw TypeError("reconnect must be a boolean or an options object.");
|
|
76
|
+
let t = v(e.delayMs, "reconnect.delayMs", 1e3), n = v(e.maxDelayMs, "reconnect.maxDelayMs", 3e4);
|
|
77
|
+
if (n < t) throw TypeError("reconnect.maxDelayMs must not be smaller than reconnect.delayMs.");
|
|
78
|
+
let r = v(e.attempts, "reconnect.attempts", Infinity);
|
|
79
|
+
if (r < 1) throw TypeError("reconnect.attempts must be at least 1.");
|
|
80
|
+
return {
|
|
81
|
+
delayMs: t,
|
|
82
|
+
maxDelayMs: n,
|
|
83
|
+
attempts: r
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function C(e) {
|
|
87
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
88
|
+
}
|
|
89
|
+
function w(e, t) {
|
|
90
|
+
if (!C(e)) throw TypeError(`${t} requires an options object.`);
|
|
91
|
+
}
|
|
92
|
+
function T(e) {
|
|
93
|
+
if (C(e)) {
|
|
94
|
+
if (e.type === "ack" && typeof e.requestId == "string") return {
|
|
95
|
+
type: "ack",
|
|
96
|
+
requestId: e.requestId
|
|
97
|
+
};
|
|
98
|
+
if (e.type === "reject" && typeof e.requestId == "string") return {
|
|
99
|
+
type: "reject",
|
|
100
|
+
requestId: e.requestId,
|
|
101
|
+
...typeof e.message == "string" ? { message: e.message } : {}
|
|
102
|
+
};
|
|
103
|
+
if (e.type === "data" && "value" in e) return {
|
|
104
|
+
type: "data",
|
|
105
|
+
value: e.value
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function E(e) {
|
|
110
|
+
if (typeof e == "string") return e.length === 0 ? void 0 : JSON.parse(e);
|
|
111
|
+
if (e instanceof ArrayBuffer || ArrayBuffer.isView(e)) return JSON.parse(new TextDecoder().decode(e));
|
|
112
|
+
}
|
|
113
|
+
var D = Object.freeze({
|
|
114
|
+
encodeSubmit(e) {
|
|
115
|
+
return JSON.stringify(e);
|
|
116
|
+
},
|
|
117
|
+
decode(e) {
|
|
118
|
+
return T(E(e));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
function ee(e) {
|
|
122
|
+
if (typeof e != "string") return "The channel rejected the submission.";
|
|
123
|
+
let t = e.replace(m, " ").trim().slice(0, d);
|
|
124
|
+
return t.length > 0 ? t : "The channel rejected the submission.";
|
|
125
|
+
}
|
|
126
|
+
function O(e) {
|
|
127
|
+
if (typeof e == "object" && e && "data" in e) return e.data;
|
|
128
|
+
}
|
|
129
|
+
var k = new TextEncoder();
|
|
130
|
+
function A(e, t) {
|
|
131
|
+
return typeof e == "string" ? e.length > t || k.encode(e).byteLength > t : (e instanceof ArrayBuffer || ArrayBuffer.isView(e)) && e.byteLength > t;
|
|
132
|
+
}
|
|
133
|
+
function j(e) {
|
|
134
|
+
if (typeof e != "object" || !e) return;
|
|
135
|
+
let t = e.release;
|
|
136
|
+
if (typeof t == "function") try {
|
|
137
|
+
t.call(e);
|
|
138
|
+
} catch {}
|
|
139
|
+
}
|
|
140
|
+
function M(e) {
|
|
141
|
+
try {
|
|
142
|
+
e.dispose();
|
|
143
|
+
} catch {}
|
|
144
|
+
}
|
|
145
|
+
function N(e, t) {
|
|
146
|
+
let { validateSubmit: c, validateSubscribe: l } = e;
|
|
147
|
+
if (c === void 0 && l === void 0) throw TypeError("A duplex channel needs validateSubmit, validateSubscribe, or both.");
|
|
148
|
+
if (c !== void 0 && typeof c != "function") throw TypeError("validateSubmit must be a function.");
|
|
149
|
+
if (l !== void 0 && typeof l != "function") throw TypeError("validateSubscribe must be a function.");
|
|
150
|
+
let u = e.codec ?? D;
|
|
151
|
+
if (typeof u != "object" || !u || typeof u.encodeSubmit != "function" || typeof u.decode != "function") throw TypeError("codec must provide encodeSubmit and decode functions.");
|
|
152
|
+
let d = e.timers ?? h;
|
|
153
|
+
if (typeof d != "object" || !d || typeof d.setTimeout != "function" || typeof d.clearTimeout != "function") throw TypeError("timers must provide setTimeout and clearTimeout functions.");
|
|
154
|
+
let f = _(e.ackTimeoutMs, "ackTimeoutMs", n), p = _(e.connectTimeoutMs, "connectTimeoutMs", n), m = _(e.maxMessageBytes, "maxMessageBytes", r), v = e.maxBytes === void 0 ? void 0 : _(e.maxBytes, "maxBytes", 1), y = S(e.reconnect), b = /* @__PURE__ */ new Map();
|
|
155
|
+
function x(e) {
|
|
156
|
+
e.reconnectTimer !== void 0 && (d.clearTimeout(e.reconnectTimer), e.reconnectTimer = void 0);
|
|
157
|
+
}
|
|
158
|
+
function C(e) {
|
|
159
|
+
x(e), e.connectTimer !== void 0 && (d.clearTimeout(e.connectTimer), e.connectTimer = void 0);
|
|
160
|
+
let t = e.connecting;
|
|
161
|
+
e.connecting = void 0, t !== void 0 && t.abort();
|
|
162
|
+
let n = e.handle;
|
|
163
|
+
e.handle = void 0, n !== void 0 && M(n);
|
|
164
|
+
}
|
|
165
|
+
function w(e) {
|
|
166
|
+
e.subscribers.size > 0 || e.pending.size > 0 || e.waiters.length > 0 || (e.reconnectTimer !== void 0 && x(e), (e.handle !== void 0 || e.connecting !== void 0) && C(e));
|
|
167
|
+
}
|
|
168
|
+
function T(e) {
|
|
169
|
+
e.signal.removeEventListener("abort", e.abortListener), b.delete(e.signal), e.subscribers.clear();
|
|
170
|
+
for (let t of [...e.pending.values()]) t.finish(g(i));
|
|
171
|
+
e.pending.clear();
|
|
172
|
+
let t = e.waiters;
|
|
173
|
+
e.waiters = [];
|
|
174
|
+
for (let e of t) e.fail(i);
|
|
175
|
+
C(e);
|
|
176
|
+
}
|
|
177
|
+
function E(e) {
|
|
178
|
+
let t = b.get(e);
|
|
179
|
+
if (t !== void 0) return t;
|
|
180
|
+
if (e.aborted) return;
|
|
181
|
+
let n = {
|
|
182
|
+
signal: e,
|
|
183
|
+
abortListener: () => {},
|
|
184
|
+
subscribers: /* @__PURE__ */ new Set(),
|
|
185
|
+
pending: /* @__PURE__ */ new Map(),
|
|
186
|
+
waiters: [],
|
|
187
|
+
handle: void 0,
|
|
188
|
+
connecting: void 0,
|
|
189
|
+
connectTimer: void 0,
|
|
190
|
+
reconnectTimer: void 0,
|
|
191
|
+
reconnectAttempts: 0
|
|
192
|
+
}, r = () => {
|
|
193
|
+
T(n);
|
|
194
|
+
};
|
|
195
|
+
return n.abortListener = r, e.addEventListener("abort", r, { once: !0 }), b.set(e, n), n;
|
|
196
|
+
}
|
|
197
|
+
function O(e) {
|
|
198
|
+
if (y === void 0 || e.subscribers.size === 0) return !1;
|
|
199
|
+
if (e.reconnectAttempts += 1, e.reconnectAttempts > y.attempts) return e.reconnectAttempts = 0, !1;
|
|
200
|
+
let t = Math.min(y.delayMs * 2 ** (e.reconnectAttempts - 1), y.maxDelayMs);
|
|
201
|
+
for (let t of [...e.subscribers]) t.status("connecting");
|
|
202
|
+
return e.reconnectTimer = d.setTimeout(() => {
|
|
203
|
+
e.reconnectTimer = void 0, e.subscribers.size > 0 && e.handle === void 0 && e.connecting === void 0 && P(e);
|
|
204
|
+
}, t), !0;
|
|
205
|
+
}
|
|
206
|
+
function k(e) {
|
|
207
|
+
e.connectTimer !== void 0 && (d.clearTimeout(e.connectTimer), e.connectTimer = void 0);
|
|
208
|
+
}
|
|
209
|
+
function j(e, t, n) {
|
|
210
|
+
if (e.connecting !== t) {
|
|
211
|
+
M(n);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
e.connecting = void 0, k(e), e.handle = n, e.reconnectAttempts = 0;
|
|
215
|
+
for (let t of [...e.subscribers]) t.status("open");
|
|
216
|
+
let r = e.waiters;
|
|
217
|
+
e.waiters = [];
|
|
218
|
+
for (let e of r) e.ready();
|
|
219
|
+
}
|
|
220
|
+
function N(e, t) {
|
|
221
|
+
if (e.connecting !== t) return;
|
|
222
|
+
e.connecting = void 0, k(e);
|
|
223
|
+
let n = e.waiters;
|
|
224
|
+
e.waiters = [];
|
|
225
|
+
for (let e of n) e.fail(a);
|
|
226
|
+
if (e.subscribers.size === 0) w(e);
|
|
227
|
+
else if (!O(e)) for (let t of [...e.subscribers]) t.error(a), t.status("closed");
|
|
228
|
+
}
|
|
229
|
+
function P(e) {
|
|
230
|
+
if (e.handle !== void 0 || e.connecting !== void 0) return;
|
|
231
|
+
x(e);
|
|
232
|
+
let n = new AbortController();
|
|
233
|
+
e.connecting = n;
|
|
234
|
+
let r = {
|
|
235
|
+
message(t) {
|
|
236
|
+
L(e, t);
|
|
237
|
+
},
|
|
238
|
+
close() {
|
|
239
|
+
R(e);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
e.connectTimer = d.setTimeout(() => {
|
|
243
|
+
e.connectTimer = void 0, e.connecting === n && (n.abort(), N(e, n));
|
|
244
|
+
}, p);
|
|
245
|
+
let i;
|
|
246
|
+
try {
|
|
247
|
+
i = t(r, n.signal);
|
|
248
|
+
} catch {
|
|
249
|
+
N(e, n);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
Promise.resolve(i).then((t) => {
|
|
253
|
+
j(e, n, t);
|
|
254
|
+
}, () => {
|
|
255
|
+
N(e, n);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function F(e) {
|
|
259
|
+
x(e), P(e);
|
|
260
|
+
}
|
|
261
|
+
function I(e) {
|
|
262
|
+
for (let t of [...e.subscribers]) t.error(s);
|
|
263
|
+
}
|
|
264
|
+
function L(e, t) {
|
|
265
|
+
if (A(t, m)) {
|
|
266
|
+
I(e);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
let n;
|
|
270
|
+
try {
|
|
271
|
+
n = u.decode(t);
|
|
272
|
+
} catch {
|
|
273
|
+
I(e);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (n === void 0) return;
|
|
277
|
+
if (n.type === "data") {
|
|
278
|
+
for (let t of [...e.subscribers]) t.data(n.value);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
let r = e.pending.get(n.requestId);
|
|
282
|
+
r !== void 0 && (n.type === "ack" ? r.finish({ ok: !0 }) : r.finish({
|
|
283
|
+
ok: !1,
|
|
284
|
+
error: Object.freeze({
|
|
285
|
+
code: "rejected",
|
|
286
|
+
message: ee(n.message)
|
|
287
|
+
})
|
|
288
|
+
}));
|
|
289
|
+
}
|
|
290
|
+
function R(e) {
|
|
291
|
+
if (e.handle === void 0) return;
|
|
292
|
+
e.handle = void 0;
|
|
293
|
+
for (let t of [...e.pending.values()]) t.finish(g(o));
|
|
294
|
+
let t = e.waiters;
|
|
295
|
+
e.waiters = [];
|
|
296
|
+
for (let e of t) e.fail(a);
|
|
297
|
+
if (e.subscribers.size === 0) w(e);
|
|
298
|
+
else if (!O(e)) for (let t of [...e.subscribers]) t.error(a), t.status("closed");
|
|
299
|
+
}
|
|
300
|
+
function z(e) {
|
|
301
|
+
let t = E(e.sessionSignal);
|
|
302
|
+
if (t === void 0 || e.signal.aborted) return e.status("closed"), () => {};
|
|
303
|
+
let n = !0, r = () => {
|
|
304
|
+
n && (n = !1, e.signal.removeEventListener("abort", r), t.subscribers.delete(e), w(t));
|
|
305
|
+
};
|
|
306
|
+
return t.handle === void 0 ? (t.subscribers.add(e), e.status("connecting"), F(t)) : (t.subscribers.add(e), e.status("open")), e.signal.addEventListener("abort", r, { once: !0 }), r;
|
|
307
|
+
}
|
|
308
|
+
function B(e, t) {
|
|
309
|
+
let n = t.requestId, r = E(t.sessionSignal);
|
|
310
|
+
return r === void 0 ? Promise.resolve(g(i)) : new Promise((s) => {
|
|
311
|
+
let c = !1, l, p, m = (e) => {
|
|
312
|
+
if (c) return;
|
|
313
|
+
if (c = !0, l !== void 0 && (d.clearTimeout(l), l = void 0), t.signal.removeEventListener("abort", h), p !== void 0) {
|
|
314
|
+
let e = r.waiters.indexOf(p);
|
|
315
|
+
e >= 0 && r.waiters.splice(e, 1), p = void 0;
|
|
316
|
+
}
|
|
317
|
+
let i = r.pending.get(n);
|
|
318
|
+
i !== void 0 && i.finish === m && r.pending.delete(n), w(r), s(e);
|
|
319
|
+
}, h = () => {
|
|
320
|
+
m(g(i));
|
|
321
|
+
};
|
|
322
|
+
if (t.signal.aborted) {
|
|
323
|
+
m(g(i));
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
t.signal.addEventListener("abort", h, { once: !0 });
|
|
327
|
+
let _ = (i) => {
|
|
328
|
+
if (c) return;
|
|
329
|
+
let s;
|
|
330
|
+
try {
|
|
331
|
+
s = u.encodeSubmit({
|
|
332
|
+
type: "submit",
|
|
333
|
+
requestId: n,
|
|
334
|
+
payload: e,
|
|
335
|
+
...t.idempotencyKey === void 0 ? {} : { idempotencyKey: t.idempotencyKey }
|
|
336
|
+
});
|
|
337
|
+
} catch {
|
|
338
|
+
m(g(a));
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
r.pending.set(n, { finish: m }), l = d.setTimeout(() => {
|
|
342
|
+
l = void 0;
|
|
343
|
+
let e = r.pending.get(n);
|
|
344
|
+
e !== void 0 && e.finish === m && m(g(o));
|
|
345
|
+
}, f);
|
|
346
|
+
try {
|
|
347
|
+
i.send(s);
|
|
348
|
+
} catch {
|
|
349
|
+
m(g(a));
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
r.handle === void 0 ? (p = {
|
|
353
|
+
ready() {
|
|
354
|
+
p = void 0, r.handle === void 0 ? m(g(a)) : _(r.handle);
|
|
355
|
+
},
|
|
356
|
+
fail(e) {
|
|
357
|
+
m(g(e));
|
|
358
|
+
}
|
|
359
|
+
}, r.waiters.push(p), F(r)) : _(r.handle);
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
return Object.freeze({
|
|
363
|
+
...c === void 0 ? {} : { submit: Object.freeze({
|
|
364
|
+
validate: c,
|
|
365
|
+
...v === void 0 ? {} : { maxBytes: v },
|
|
366
|
+
send: B
|
|
367
|
+
}) },
|
|
368
|
+
...l === void 0 ? {} : { subscribe: Object.freeze({
|
|
369
|
+
validate: l,
|
|
370
|
+
...v === void 0 ? {} : { maxBytes: v },
|
|
371
|
+
open: z
|
|
372
|
+
}) }
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function P(e) {
|
|
376
|
+
return (t, n) => new Promise((r, i) => {
|
|
377
|
+
let a = !1, o = !1, s, c = [], l = () => {
|
|
378
|
+
if (s !== void 0) {
|
|
379
|
+
for (let [e, t] of c) s.removeEventListener(e, t);
|
|
380
|
+
c.length = 0;
|
|
381
|
+
}
|
|
382
|
+
}, u = () => {
|
|
383
|
+
let e = s;
|
|
384
|
+
if (s = void 0, e !== void 0) try {
|
|
385
|
+
e.close();
|
|
386
|
+
} catch {}
|
|
387
|
+
}, d = () => {
|
|
388
|
+
a || (a = !0, n.removeEventListener("abort", f), l(), u(), i(/* @__PURE__ */ Error("The WebSocket connection failed.")));
|
|
389
|
+
}, f = () => {
|
|
390
|
+
d();
|
|
391
|
+
};
|
|
392
|
+
n.addEventListener("abort", f, { once: !0 });
|
|
393
|
+
let p = (e, t) => {
|
|
394
|
+
s.addEventListener(e, t), c.push([e, t]);
|
|
395
|
+
}, m = () => {
|
|
396
|
+
a || (a = !0, o = !0, n.removeEventListener("abort", f), r({
|
|
397
|
+
send(e) {
|
|
398
|
+
s.send(e);
|
|
399
|
+
},
|
|
400
|
+
dispose() {
|
|
401
|
+
l(), u();
|
|
402
|
+
}
|
|
403
|
+
}));
|
|
404
|
+
}, h = (r) => {
|
|
405
|
+
if (a) return;
|
|
406
|
+
let c, u;
|
|
407
|
+
try {
|
|
408
|
+
c = b(r?.url ?? e.endpoint), u = y(r?.protocols ?? e.protocols);
|
|
409
|
+
} catch {
|
|
410
|
+
a = !0, n.removeEventListener("abort", f), i(/* @__PURE__ */ Error("The WebSocket endpoint is invalid."));
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
try {
|
|
414
|
+
s = e.createSocket(c, u);
|
|
415
|
+
} catch {
|
|
416
|
+
d();
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
try {
|
|
420
|
+
p("open", m), p("message", (e) => {
|
|
421
|
+
o && t.message(O(e));
|
|
422
|
+
}), p("close", () => {
|
|
423
|
+
o ? (l(), s = void 0, t.close()) : d();
|
|
424
|
+
}), p("error", () => {
|
|
425
|
+
o || d();
|
|
426
|
+
});
|
|
427
|
+
} catch {
|
|
428
|
+
d();
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
if (e.prepare === void 0) {
|
|
432
|
+
h(void 0);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
let g;
|
|
436
|
+
try {
|
|
437
|
+
g = e.prepare({ signal: n });
|
|
438
|
+
} catch {
|
|
439
|
+
d();
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
Promise.resolve(g).then((e) => {
|
|
443
|
+
h(e);
|
|
444
|
+
}, () => {
|
|
445
|
+
d();
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
function F(e, t) {
|
|
450
|
+
let n = globalThis.WebSocket;
|
|
451
|
+
if (typeof n != "function") throw TypeError("WebSocket is unavailable in this context; pass options.webSocket.");
|
|
452
|
+
return new n(e, t.length > 0 ? [...t] : void 0);
|
|
453
|
+
}
|
|
454
|
+
function I(e) {
|
|
455
|
+
w(e, "webSocketChannel");
|
|
456
|
+
let t = b(e.endpoint), n = y(e.protocols);
|
|
457
|
+
if (e.prepare !== void 0 && typeof e.prepare != "function") throw TypeError("prepare must be a function.");
|
|
458
|
+
let r = e.webSocket ?? F;
|
|
459
|
+
if (typeof r != "function") throw TypeError("webSocket must be a function.");
|
|
460
|
+
return N(e, P({
|
|
461
|
+
endpoint: t,
|
|
462
|
+
protocols: n,
|
|
463
|
+
...e.prepare === void 0 ? {} : { prepare: e.prepare },
|
|
464
|
+
createSocket: r
|
|
465
|
+
}));
|
|
466
|
+
}
|
|
467
|
+
function L(e) {
|
|
468
|
+
if (typeof e != "object" || !e) return !1;
|
|
469
|
+
let t = e.channel;
|
|
470
|
+
if (typeof t != "object" || !t) return !1;
|
|
471
|
+
let n = t;
|
|
472
|
+
return typeof n.send == "function" && typeof n.addEventListener == "function" && typeof n.removeEventListener == "function";
|
|
473
|
+
}
|
|
474
|
+
function R(e) {
|
|
475
|
+
return (t, n) => new Promise((r, i) => {
|
|
476
|
+
let a = !1, o = !1, s, c, l = [], u = () => {
|
|
477
|
+
if (s !== void 0) {
|
|
478
|
+
for (let [e, t] of l) s.removeEventListener(e, t);
|
|
479
|
+
l.length = 0;
|
|
480
|
+
}
|
|
481
|
+
}, d = () => {
|
|
482
|
+
u();
|
|
483
|
+
let e = c;
|
|
484
|
+
if (c = void 0, e !== void 0) try {
|
|
485
|
+
e();
|
|
486
|
+
} catch {}
|
|
487
|
+
}, f = () => {
|
|
488
|
+
a || o || (o = !0, n.removeEventListener("abort", p), d(), i(/* @__PURE__ */ Error("The WebRTC data channel failed.")));
|
|
489
|
+
}, p = () => {
|
|
490
|
+
f();
|
|
491
|
+
};
|
|
492
|
+
n.addEventListener("abort", p, { once: !0 });
|
|
493
|
+
let m = (e, t) => {
|
|
494
|
+
s.addEventListener(e, t), l.push([e, t]);
|
|
495
|
+
}, h = () => {
|
|
496
|
+
a || o || (a = !0, n.removeEventListener("abort", p), r({
|
|
497
|
+
send(e) {
|
|
498
|
+
s.send(e);
|
|
499
|
+
},
|
|
500
|
+
dispose() {
|
|
501
|
+
o || (o = !0, d());
|
|
502
|
+
}
|
|
503
|
+
}));
|
|
504
|
+
}, g = (e) => {
|
|
505
|
+
a && !o && t.message(O(e));
|
|
506
|
+
}, _ = () => {
|
|
507
|
+
a || f();
|
|
508
|
+
}, v = () => {
|
|
509
|
+
o || (a ? (o = !0, d(), t.close()) : f());
|
|
510
|
+
}, y = (e) => {
|
|
511
|
+
if (o) j(e);
|
|
512
|
+
else if (!L(e)) j(e), f();
|
|
513
|
+
else if (s = e.channel, c = typeof e.release == "function" ? e.release.bind(e) : void 0, n.aborted) f();
|
|
514
|
+
else try {
|
|
515
|
+
m("message", g), m("close", v), m("error", _), m("open", h);
|
|
516
|
+
let e = s.readyState;
|
|
517
|
+
e === "open" ? h() : e === "closed" && v();
|
|
518
|
+
} catch {
|
|
519
|
+
f();
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
}, b;
|
|
523
|
+
try {
|
|
524
|
+
b = e.connect(e.endpoint, n);
|
|
525
|
+
} catch {
|
|
526
|
+
f();
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
Promise.resolve(b).then(y, () => {
|
|
530
|
+
f();
|
|
531
|
+
});
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
function z(e) {
|
|
535
|
+
w(e, "webRtcChannel");
|
|
536
|
+
let t = x(e.endpoint);
|
|
537
|
+
if (typeof e.connect != "function") throw TypeError("connect must be a function that selects a peer.");
|
|
538
|
+
return N(e, R({
|
|
539
|
+
endpoint: t,
|
|
540
|
+
connect: e.connect
|
|
541
|
+
}));
|
|
542
|
+
}
|
|
543
|
+
// src/runtime-services/browser/http-sse.ts
|
|
544
|
+
var B = new TextEncoder();
|
|
545
|
+
function V(e, t) {
|
|
546
|
+
return e.length > t || B.encode(e).length > t;
|
|
547
|
+
}
|
|
548
|
+
var H = 2048, te = "Idempotency-Key", ne = 15e3, re = 2147483647, U = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/, ie = /[\u0000-\u0008\u000a-\u001f\u007f]/, ae = /^[A-Za-z][A-Za-z0-9!#$%&'*+\-.^_`|~]*$/, oe = /^[A-Za-z][A-Za-z0-9+.-]*:/, se = /^https?:\/\/[^/]/i, W = /[\u0000- \u007f]/;
|
|
549
|
+
function G(e, t) {
|
|
550
|
+
return {
|
|
551
|
+
ok: !1,
|
|
552
|
+
error: {
|
|
553
|
+
code: e,
|
|
554
|
+
message: t
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
function K(e, t) {
|
|
559
|
+
if (typeof e != "object" || !e) throw TypeError(`${t} requires an options object.`);
|
|
560
|
+
}
|
|
561
|
+
function q(e, t) {
|
|
562
|
+
if (typeof e != "string") throw TypeError(`${t} requires a string endpoint.`);
|
|
563
|
+
let n = e.trim();
|
|
564
|
+
if (n.length === 0) throw TypeError(`${t} requires a non-empty endpoint.`);
|
|
565
|
+
if (n.length > H) throw TypeError(`${t} endpoint must be at most ${H} characters.`);
|
|
566
|
+
if (W.test(n)) throw TypeError(`${t} endpoint must not contain whitespace or control characters.`);
|
|
567
|
+
if (n.includes("\\")) throw TypeError(`${t} endpoint must not contain backslashes.`);
|
|
568
|
+
if (oe.test(n)) {
|
|
569
|
+
if (!se.test(n)) throw TypeError(`${t} endpoint must use HTTP(S) or be a same-origin relative path.`);
|
|
570
|
+
try {
|
|
571
|
+
new URL(n);
|
|
572
|
+
} catch {
|
|
573
|
+
throw TypeError(`${t} endpoint must be a valid HTTP(S) URL.`);
|
|
574
|
+
}
|
|
575
|
+
return n;
|
|
576
|
+
}
|
|
577
|
+
if (n.startsWith("//")) throw TypeError(`${t} endpoint must not be protocol-relative.`);
|
|
578
|
+
if (n.startsWith("#")) throw TypeError(`${t} endpoint must name a resource, not a fragment.`);
|
|
579
|
+
return n;
|
|
580
|
+
}
|
|
581
|
+
function J(e, t) {
|
|
582
|
+
if (e !== void 0) {
|
|
583
|
+
if (typeof e != "function") throw TypeError(`${t} must be a function.`);
|
|
584
|
+
return e;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
function Y(e, t) {
|
|
588
|
+
if (e !== void 0) {
|
|
589
|
+
if (typeof e != "number" || !Number.isSafeInteger(e) || e <= 0) throw TypeError(`${t} must be a positive integer.`);
|
|
590
|
+
return e;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
function ce(e) {
|
|
594
|
+
if (e === void 0) return "POST";
|
|
595
|
+
if (typeof e != "string" || !ae.test(e)) throw TypeError("httpSubmit method must be an HTTP method token.");
|
|
596
|
+
return e;
|
|
597
|
+
}
|
|
598
|
+
function le(e) {
|
|
599
|
+
if (e !== void 0) {
|
|
600
|
+
if (e !== "omit" && e !== "same-origin" && e !== "include") throw TypeError("httpSubmit credentials must be \"omit\", \"same-origin\" or \"include\".");
|
|
601
|
+
return e;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function ue(e) {
|
|
605
|
+
if (e === void 0) return te;
|
|
606
|
+
if (e === null || e === "") return null;
|
|
607
|
+
if (typeof e != "string" || !U.test(e)) throw TypeError("httpSubmit idempotencyHeader must be an HTTP header name, null or an empty string.");
|
|
608
|
+
return e;
|
|
609
|
+
}
|
|
610
|
+
function X(e) {
|
|
611
|
+
if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("HTTP headers must be a plain object of strings.");
|
|
612
|
+
let t = {};
|
|
613
|
+
for (let [n, r] of Object.entries(e)) {
|
|
614
|
+
if (!U.test(n)) throw TypeError(`Invalid HTTP header name: ${n}.`);
|
|
615
|
+
if (typeof r != "string" || ie.test(r)) throw TypeError(`Invalid value for HTTP header ${n}.`);
|
|
616
|
+
t[n] = r;
|
|
617
|
+
}
|
|
618
|
+
return t;
|
|
619
|
+
}
|
|
620
|
+
function de(e) {
|
|
621
|
+
if (e !== void 0) return typeof e == "function" ? e : X(e);
|
|
622
|
+
}
|
|
623
|
+
function Z(e, t) {
|
|
624
|
+
let n = t.toLowerCase();
|
|
625
|
+
return Object.keys(e).some((e) => e.toLowerCase() === n);
|
|
626
|
+
}
|
|
627
|
+
function fe(e, t, n, r) {
|
|
628
|
+
let i = { ...e };
|
|
629
|
+
return t !== null && !Z(i, "content-type") && (i["Content-Type"] = t), n !== null && r.idempotencyKey !== void 0 && !Z(i, n) && (i[n] = r.idempotencyKey), i;
|
|
630
|
+
}
|
|
631
|
+
function pe(e) {
|
|
632
|
+
if (e !== void 0) return e;
|
|
633
|
+
let t = globalThis.fetch;
|
|
634
|
+
if (typeof t != "function") return;
|
|
635
|
+
let n = t;
|
|
636
|
+
return (e, t) => n.call(globalThis, e, t);
|
|
637
|
+
}
|
|
638
|
+
async function me(e, t, n) {
|
|
639
|
+
if (e === null) return "";
|
|
640
|
+
let r = e.getReader(), i = new TextDecoder(), a = t, o = "", s = !1, c = () => {
|
|
641
|
+
r.cancel().catch(() => {});
|
|
642
|
+
};
|
|
643
|
+
n.addEventListener("abort", c, { once: !0 });
|
|
644
|
+
try {
|
|
645
|
+
for (;;) {
|
|
646
|
+
let e = await r.read();
|
|
647
|
+
if (n.throwIfAborted(), e.done) return s = !0, o + i.decode();
|
|
648
|
+
if (a -= e.value.byteLength, a < 0) return;
|
|
649
|
+
o += i.decode(e.value, { stream: !0 });
|
|
650
|
+
}
|
|
651
|
+
} finally {
|
|
652
|
+
n.removeEventListener("abort", c), !s && !n.aborted && c(), r.releaseLock();
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
async function he(e, t, n, r) {
|
|
656
|
+
if (!r || t.aborted) e.body?.cancel().catch(() => {}), t.throwIfAborted();
|
|
657
|
+
else {
|
|
658
|
+
let i;
|
|
659
|
+
try {
|
|
660
|
+
i = await me(e.body, n, t);
|
|
661
|
+
} catch {
|
|
662
|
+
return G("unconfirmed", "The server responded but its confirmation could not be read.");
|
|
663
|
+
}
|
|
664
|
+
if (i === void 0) return G("unconfirmed", `The server response exceeds the ${n}-byte budget.`);
|
|
665
|
+
t.throwIfAborted();
|
|
666
|
+
try {
|
|
667
|
+
let t = r({
|
|
668
|
+
status: e.status,
|
|
669
|
+
ok: e.ok,
|
|
670
|
+
headers: e.headers,
|
|
671
|
+
text: i
|
|
672
|
+
});
|
|
673
|
+
if (t !== void 0) return t;
|
|
674
|
+
} catch {
|
|
675
|
+
return G("unconfirmed", "The server responded but its result could not be interpreted.");
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return e.ok ? { ok: !0 } : e.status >= 400 && e.status < 500 ? G("rejected", `The server rejected the submission (HTTP ${e.status}).`) : G("unconfirmed", `The submission outcome was not confirmed (HTTP ${e.status}).`);
|
|
679
|
+
}
|
|
680
|
+
function ge(e) {
|
|
681
|
+
K(e, "httpSubmit");
|
|
682
|
+
let t = q(e.endpoint, "httpSubmit");
|
|
683
|
+
if (typeof e.validate != "function") throw TypeError("httpSubmit requires a validate function.");
|
|
684
|
+
let n = Y(e.maxBytes, "httpSubmit maxBytes") ?? 65536, r = Y(e.maxResponseBytes, "httpSubmit maxResponseBytes") ?? 65536, i = Y(e.timeoutMs, "httpSubmit timeoutMs") ?? ne;
|
|
685
|
+
if (i > re) throw TypeError("httpSubmit timeoutMs exceeds the maximum timer delay.");
|
|
686
|
+
let a = ce(e.method), o = de(e.headers), s = le(e.credentials), c = J(e.fetch, "httpSubmit fetch"), l = J(e.encode, "httpSubmit encode"), u = J(e.interpret, "httpSubmit interpret"), d = ue(e.idempotencyHeader);
|
|
687
|
+
return Object.freeze({
|
|
688
|
+
validate: e.validate,
|
|
689
|
+
maxBytes: n,
|
|
690
|
+
async send(e, f) {
|
|
691
|
+
if (f.signal.aborted || f.sessionSignal.aborted) return G("cancelled", "The submission was cancelled.");
|
|
692
|
+
let p, m;
|
|
693
|
+
try {
|
|
694
|
+
let t = l === void 0 ? {
|
|
695
|
+
body: JSON.stringify(e),
|
|
696
|
+
contentType: "application/json"
|
|
697
|
+
} : l(e, f);
|
|
698
|
+
if (typeof t.body != "string") throw TypeError("The encoder must return a string body.");
|
|
699
|
+
p = t.body;
|
|
700
|
+
let n = t.contentType === void 0 ? "application/json" : t.contentType;
|
|
701
|
+
if (n !== null && typeof n != "string") throw TypeError("The encoder contentType must be a string or null.");
|
|
702
|
+
m = fe(typeof o == "function" ? X(o(f)) : o ?? {}, n, d, f);
|
|
703
|
+
} catch {
|
|
704
|
+
return G("transport", "The submission could not be encoded.");
|
|
705
|
+
}
|
|
706
|
+
let h = a === "GET" || a === "HEAD";
|
|
707
|
+
if (h && p !== "") return G("invalid-data", `${a} submissions cannot carry a request body.`);
|
|
708
|
+
if (V(p, n)) return G("invalid-data", `The submission exceeds the ${n}-byte budget.`);
|
|
709
|
+
let g = pe(c);
|
|
710
|
+
if (g === void 0) return G("transport", "HTTP fetch is unavailable in this context; pass options.fetch.");
|
|
711
|
+
if (f.signal.aborted || f.sessionSignal.aborted) return G("cancelled", "The submission was cancelled.");
|
|
712
|
+
let _ = new AbortController(), v, y = new Promise((e) => {
|
|
713
|
+
v = e;
|
|
714
|
+
}), b = (e) => {
|
|
715
|
+
v(e), _.abort();
|
|
716
|
+
}, x = () => b(G("cancelled", "The submission was cancelled."));
|
|
717
|
+
f.signal.addEventListener("abort", x, { once: !0 }), f.sessionSignal.addEventListener("abort", x, { once: !0 });
|
|
718
|
+
let S = setTimeout(() => b(G("unconfirmed", "The submission timed out before confirmation.")), i), C = async () => {
|
|
719
|
+
try {
|
|
720
|
+
return await he(await g(t, {
|
|
721
|
+
method: a,
|
|
722
|
+
headers: m,
|
|
723
|
+
body: h ? void 0 : p,
|
|
724
|
+
credentials: s,
|
|
725
|
+
signal: _.signal
|
|
726
|
+
}), _.signal, r, u);
|
|
727
|
+
} catch {
|
|
728
|
+
return G("unconfirmed", "The submission was sent but no confirmation arrived.");
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
try {
|
|
732
|
+
return await Promise.race([y, C()]);
|
|
733
|
+
} finally {
|
|
734
|
+
clearTimeout(S), f.signal.removeEventListener("abort", x), f.sessionSignal.removeEventListener("abort", x);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
function _e(e) {
|
|
740
|
+
if (e === void 0) return ["message"];
|
|
741
|
+
if (!Array.isArray(e) || e.length === 0) throw TypeError("sseStream events must be a non-empty array of event names.");
|
|
742
|
+
let t = /* @__PURE__ */ new Set();
|
|
743
|
+
for (let n of e) {
|
|
744
|
+
if (typeof n != "string" || n.length === 0 || W.test(n)) throw TypeError("sseStream event names must be non-empty strings without whitespace.");
|
|
745
|
+
if (n === "open" || n === "error") throw TypeError("sseStream event names must not be \"open\" or \"error\".");
|
|
746
|
+
if (t.has(n)) throw TypeError(`sseStream event name "${n}" is listed twice.`);
|
|
747
|
+
t.add(n);
|
|
748
|
+
}
|
|
749
|
+
return [...e];
|
|
750
|
+
}
|
|
751
|
+
function ve(e) {
|
|
752
|
+
let t = globalThis.EventSource;
|
|
753
|
+
if (typeof t == "function") return (n) => new t(n, { withCredentials: e });
|
|
754
|
+
}
|
|
755
|
+
function Q(e) {
|
|
756
|
+
return typeof e == "string" ? JSON.parse(e) : e;
|
|
757
|
+
}
|
|
758
|
+
function ye(e) {
|
|
759
|
+
K(e, "sseStream");
|
|
760
|
+
let t = q(e.endpoint, "sseStream");
|
|
761
|
+
if (typeof e.validate != "function") throw TypeError("sseStream requires a validate function.");
|
|
762
|
+
let n = Y(e.maxBytes, "sseStream maxBytes") ?? 65536, r = _e(e.events);
|
|
763
|
+
if (e.withCredentials !== void 0 && typeof e.withCredentials != "boolean") throw TypeError("sseStream withCredentials must be a boolean.");
|
|
764
|
+
let i = e.withCredentials === !0, a = J(e.createEventSource, "sseStream createEventSource"), o = J(e.decode, "sseStream decode");
|
|
765
|
+
return Object.freeze({
|
|
766
|
+
validate: e.validate,
|
|
767
|
+
maxBytes: n,
|
|
768
|
+
open(e) {
|
|
769
|
+
if (e.signal.aborted || e.sessionSignal.aborted) return () => {};
|
|
770
|
+
let s = a ?? ve(i);
|
|
771
|
+
if (s === void 0) return e.error({
|
|
772
|
+
code: "unavailable",
|
|
773
|
+
message: "EventSource is unavailable in this context; pass options.createEventSource."
|
|
774
|
+
}), e.status("closed"), () => {};
|
|
775
|
+
let c;
|
|
776
|
+
try {
|
|
777
|
+
c = s(t);
|
|
778
|
+
} catch {
|
|
779
|
+
return e.error({
|
|
780
|
+
code: "unavailable",
|
|
781
|
+
message: "The event stream could not be opened."
|
|
782
|
+
}), e.status("closed"), () => {};
|
|
783
|
+
}
|
|
784
|
+
let l = !1, u = [], d = () => {
|
|
785
|
+
l || e.status("open");
|
|
786
|
+
}, f = () => {
|
|
787
|
+
l || (e.error({
|
|
788
|
+
code: "transport",
|
|
789
|
+
message: "The event stream reported an error."
|
|
790
|
+
}), c.readyState === 2 ? (e.status("closed"), h()) : c.readyState === 0 && e.status("connecting"));
|
|
791
|
+
}, p = (t) => {
|
|
792
|
+
if (l) return;
|
|
793
|
+
let r = t.data;
|
|
794
|
+
if (r === void 0) return;
|
|
795
|
+
if (typeof r == "string" && V(r, n)) {
|
|
796
|
+
e.error({
|
|
797
|
+
code: "invalid-data",
|
|
798
|
+
message: `An event exceeded the ${n}-byte budget.`
|
|
799
|
+
});
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
let i;
|
|
803
|
+
try {
|
|
804
|
+
i = o === void 0 ? Q(r) : o(r, t);
|
|
805
|
+
} catch {
|
|
806
|
+
e.error({
|
|
807
|
+
code: "invalid-data",
|
|
808
|
+
message: "An event could not be decoded."
|
|
809
|
+
});
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
e.data(i);
|
|
813
|
+
};
|
|
814
|
+
function m() {
|
|
815
|
+
h();
|
|
816
|
+
}
|
|
817
|
+
function h() {
|
|
818
|
+
if (!l) {
|
|
819
|
+
l = !0;
|
|
820
|
+
for (let [e, t] of u) c.removeEventListener(e, t);
|
|
821
|
+
e.signal.removeEventListener("abort", m), e.sessionSignal.removeEventListener("abort", m);
|
|
822
|
+
try {
|
|
823
|
+
c.close();
|
|
824
|
+
} catch {}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
u.push(["open", d], ["error", f]);
|
|
828
|
+
for (let e of r) u.push([e, p]);
|
|
829
|
+
for (let [e, t] of u) c.addEventListener(e, t);
|
|
830
|
+
return e.signal.addEventListener("abort", m, { once: !0 }), e.sessionSignal.addEventListener("abort", m, { once: !0 }), (e.signal.aborted || e.sessionSignal.aborted) && h(), h;
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
}
|
|
2
834
|
// src/runtime-services/browser/index.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
835
|
+
var be = "reactive-md:component-state:v1:", $ = 128;
|
|
836
|
+
function xe(e, t = {}) {
|
|
5
837
|
let n = globalThis, r = t.page ?? (typeof n.addEventListener == "function" ? n : void 0), i = t.document ?? (typeof n.document?.addEventListener == "function" ? n.document : void 0);
|
|
6
838
|
if (r === void 0 || i === void 0) return () => {};
|
|
7
839
|
let a = () => {
|
|
@@ -15,7 +847,7 @@ function i(e, t = {}) {
|
|
|
15
847
|
s || (s = !0, r.removeEventListener("pagehide", a), i.removeEventListener("visibilitychange", o));
|
|
16
848
|
};
|
|
17
849
|
}
|
|
18
|
-
function
|
|
850
|
+
function Se() {
|
|
19
851
|
let e;
|
|
20
852
|
try {
|
|
21
853
|
e = globalThis.localStorage;
|
|
@@ -25,27 +857,27 @@ function a() {
|
|
|
25
857
|
if (typeof e != "object" || !e || typeof e.getItem != "function" || typeof e.setItem != "function" || typeof e.removeItem != "function") throw TypeError("localStorage is unavailable in this context; pass options.storage instead.");
|
|
26
858
|
return e;
|
|
27
859
|
}
|
|
28
|
-
function
|
|
860
|
+
function Ce(n) {
|
|
29
861
|
if (typeof n != "object" || !n) throw TypeError("createLocalBrowserStateStorage requires an options object.");
|
|
30
|
-
let
|
|
31
|
-
if (
|
|
32
|
-
let
|
|
33
|
-
if (typeof
|
|
34
|
-
let
|
|
862
|
+
let r = t(n.documentId);
|
|
863
|
+
if (r === void 0) throw TypeError("createLocalBrowserStateStorage requires a valid documentId.");
|
|
864
|
+
let i = n.keyPrefix ?? "reactive-md:component-state:v1:";
|
|
865
|
+
if (typeof i != "string" || i.length === 0 || i.length > $) throw TypeError(`keyPrefix must be a non-empty string of at most ${$} characters.`);
|
|
866
|
+
let a = n.storage ?? Se(), o = `${i}${r}`;
|
|
35
867
|
return Object.freeze({
|
|
36
|
-
key:
|
|
868
|
+
key: o,
|
|
37
869
|
read() {
|
|
38
|
-
let e =
|
|
870
|
+
let e = a.getItem(o);
|
|
39
871
|
return e === null ? null : e;
|
|
40
872
|
},
|
|
41
873
|
write(t) {
|
|
42
874
|
let n = JSON.stringify(t);
|
|
43
875
|
if (n.length > 1048576) throw RangeError(`The serialized component state exceeds the ${e}-character storage budget.`);
|
|
44
|
-
|
|
876
|
+
a.setItem(o, n);
|
|
45
877
|
},
|
|
46
878
|
remove() {
|
|
47
|
-
|
|
879
|
+
a.removeItem(o);
|
|
48
880
|
}
|
|
49
881
|
});
|
|
50
882
|
}
|
|
51
|
-
export { n as LOCAL_COMPONENT_STATE_STORAGE_PREFIX,
|
|
883
|
+
export { n as DEFAULT_DUPLEX_ACK_TIMEOUT_MS, r as DEFAULT_DUPLEX_MESSAGE_BYTES, be as LOCAL_COMPONENT_STATE_STORAGE_PREFIX, Ce as createLocalBrowserStateStorage, xe as flushComponentStateOnPageHide, ge as httpSubmit, D as jsonDuplexCodec, ye as sseStream, z as webRtcChannel, I as webSocketChannel };
|